Fix GMP v4 compatibility.
[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/gmp-wrappers.cmm])
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 AC_ARG_WITH([gmp-framework-preferred],
31   [AC_HELP_STRING([--with-gmp-framework-preferred],
32     [on OSX, prefer the GMP framework to the gmp lib])],
33     [GMP_PREFER_FRAMEWORK=YES],
34     [GMP_PREFER_FRAMEWORK=NO])
35
36 AC_ARG_WITH([intree-gmp],
37   [AC_HELP_STRING([--with-intree-gmp],
38     [force using the in-tree GMP])],
39     [GMP_FORCE_INTREE=YES],
40     [GMP_FORCE_INTREE=NO])
41
42 dnl--------------------------------------------------------------------
43 dnl * Detect gmp
44 dnl--------------------------------------------------------------------
45
46 HaveLibGmp=NO
47 GMP_LIBS=
48 HaveFrameworkGMP=NO
49 GMP_FRAMEWORK=
50 HaveSecurePowm=0
51
52 if test "$GMP_FORCE_INTREE" != "YES"
53 then
54     if test "$GMP_PREFER_FRAMEWORK" = "YES"
55     then
56         LOOK_FOR_GMP_FRAMEWORK
57         LOOK_FOR_GMP_LIB
58     else
59         LOOK_FOR_GMP_LIB
60         LOOK_FOR_GMP_FRAMEWORK
61     fi
62 fi
63 if test "$HaveFrameworkGMP" = "YES" || test "$HaveLibGmp" = "YES"
64 then
65     AC_CHECK_HEADER([gmp.h], , [AC_MSG_ERROR([Cannot find gmp.h])])
66 fi
67
68 dnl--------------------------------------------------------------------
69 dnl * Make sure we got some form of gmp
70 dnl--------------------------------------------------------------------
71
72 AC_SUBST(GMP_INCLUDE_DIRS)
73 AC_SUBST(GMP_LIBS)
74 AC_SUBST(GMP_LIB_DIRS)
75 AC_SUBST(GMP_FRAMEWORK)
76 AC_SUBST(HaveLibGmp)
77 AC_SUBST(HaveFrameworkGMP)
78 AC_SUBST(HaveSecurePowm)
79
80 AC_CONFIG_FILES([integer-gmp.buildinfo gmp/config.mk include/HsIntegerGmp.h])
81
82 dnl--------------------------------------------------------------------
83 dnl * Generate the header cbits/GmpDerivedConstants.h
84 dnl--------------------------------------------------------------------
85
86 AC_OUTPUT