Revert "integer-gmp: improve cross-compiling support GmpDerivedConstants.h"
[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 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 dnl--------------------------------------------------------------------
37 dnl * Detect gmp
38 dnl--------------------------------------------------------------------
39
40 HaveLibGmp=NO
41 GMP_LIBS=
42 HaveFrameworkGMP=NO
43 GMP_FRAMEWORK=
44
45 if test "$GMP_PREFER_FRAMEWORK" = "YES"
46 then
47     LOOK_FOR_GMP_FRAMEWORK
48     LOOK_FOR_GMP_LIB
49 else
50     LOOK_FOR_GMP_LIB
51     LOOK_FOR_GMP_FRAMEWORK
52 fi
53 if test "$HaveFrameworkGMP" = "YES" || test "$HaveLibGmp" = "YES"
54 then
55     AC_CHECK_HEADER([gmp.h], , [AC_MSG_ERROR([Cannot find gmp.h])])
56 fi
57
58 dnl--------------------------------------------------------------------
59 dnl * Make sure we got some form of gmp
60 dnl--------------------------------------------------------------------
61
62 AC_SUBST(GMP_INCLUDE_DIRS)
63 AC_SUBST(GMP_LIBS)
64 AC_SUBST(GMP_LIB_DIRS)
65 AC_SUBST(GMP_FRAMEWORK)
66 AC_SUBST(HaveLibGmp)
67 AC_SUBST(HaveFrameworkGMP)
68
69 AC_CONFIG_FILES([integer-gmp.buildinfo gmp/config.mk])
70
71 dnl--------------------------------------------------------------------
72 dnl * Generate the header cbits/GmpDerivedConstants.h
73 dnl--------------------------------------------------------------------
74
75 AC_OUTPUT