update to track changes to CCCS in the RTS
[packages/integer-gmp.git] / configure.ac
1 AC_INIT([Haskell integer (GMP)], [0.1], [libraries@haskell.org], [integer])
2
3 # Safety check: Ensure that we are in the correct source directory.
4 AC_CONFIG_SRCDIR([cbits/mkGmpDerivedConstants.c])
5
6 AC_CANONICAL_TARGET
7
8 AC_ARG_WITH([cc],
9             [C compiler],
10             [CC=$withval])
11 AC_PROG_CC()
12
13
14 dnl--------------------------------------------------------------------
15 dnl * Deal with arguments telling us gmp is somewhere odd
16 dnl--------------------------------------------------------------------
17
18 AC_ARG_WITH([gmp-includes],
19   [AC_HELP_STRING([--with-gmp-includes],
20     [directory containing gmp.h])],
21     [GMP_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"],
22     [GMP_INCLUDE_DIRS=])
23
24 AC_ARG_WITH([gmp-libraries],
25   [AC_HELP_STRING([--with-gmp-libraries],
26     [directory containing gmp library])],
27     [GMP_LIB_DIRS=$withval; LDFLAGS="-L$withval"],
28     [GMP_LIB_DIRS=])
29
30
31 dnl--------------------------------------------------------------------
32 dnl * Check whether this machine has gmp/gmp3 installed
33 dnl--------------------------------------------------------------------
34
35 AC_CHECK_LIB([gmp],  [__gmpz_fdiv_qr],
36              [HaveLibGmp=YES; GMP_LIBS=gmp],
37              [HaveLibGmp=NO;  GMP_LIBS=])
38 if test "$HaveLibGmp" = "NO"; then
39 AC_CHECK_LIB([gmp3], [__gmpz_fdiv_qr],
40              [HaveLibGmp=YES; GMP_LIBS=gmp3],
41              [HaveLibGmp=NO;  GMP_LIBS=])
42 fi
43
44 dnl--------------------------------------------------------------------
45 dnl * Mac OS X only: check for GMP.framework
46 dnl--------------------------------------------------------------------
47
48 case $target_os in
49   darwin*)
50     AC_MSG_CHECKING([for GMP.framework])
51     save_libs="$LIBS"
52     LIBS="-framework GMP"
53     AC_TRY_LINK_FUNC(__gmpz_fdiv_qr,
54       [HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP; GMP_LIBS=],
55       [HaveFrameworkGMP=NO])
56     LIBS="$save_libs"
57     AC_MSG_RESULT([$HaveFrameworkGMP])
58     ;;
59 esac
60
61 AC_CHECK_HEADER([gmp.h], , [HaveFrameworkGMP=NO; HaveLibGmp=NO; GMP_LIBS=])
62
63 dnl--------------------------------------------------------------------
64 dnl * Make sure we got some form of gmp
65 dnl--------------------------------------------------------------------
66
67 AC_SUBST(GMP_INCLUDE_DIRS)
68 AC_SUBST(GMP_LIBS)
69 AC_SUBST(GMP_LIB_DIRS)
70 AC_SUBST(GMP_FRAMEWORK)
71 AC_SUBST(HaveLibGmp)
72 AC_SUBST(HaveFrameworkGMP)
73
74 AC_CONFIG_FILES([integer-gmp.buildinfo gmp/config.mk])
75
76 dnl--------------------------------------------------------------------
77 dnl * Generate the header cbits/GmpDerivedConstants.h
78 dnl--------------------------------------------------------------------
79
80 AC_OUTPUT