configure.ac 3.43 KB
Newer Older
1
AC_PREREQ(2.60)
2
AC_INIT([Haskell integer (GMP)], [1.0], [libraries@haskell.org], [integer])
3

4
# Safety check: Ensure that we are in the correct source directory.
5
AC_CONFIG_SRCDIR([cbits/wrappers.c])
6

7
8
9
10
11
12
AC_CANONICAL_TARGET

AC_ARG_WITH([cc],
            [C compiler],
            [CC=$withval])
AC_PROG_CC()
13
14
dnl make extensions visible to allow feature-tests to detect them lateron
AC_USE_SYSTEM_EXTENSIONS
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


dnl--------------------------------------------------------------------
dnl * Deal with arguments telling us gmp is somewhere odd
dnl--------------------------------------------------------------------

AC_ARG_WITH([gmp-includes],
  [AC_HELP_STRING([--with-gmp-includes],
    [directory containing gmp.h])],
    [GMP_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"],
    [GMP_INCLUDE_DIRS=])

AC_ARG_WITH([gmp-libraries],
  [AC_HELP_STRING([--with-gmp-libraries],
    [directory containing gmp library])],
    [GMP_LIB_DIRS=$withval; LDFLAGS="-L$withval"],
    [GMP_LIB_DIRS=])

33
34
35
36
37
AC_ARG_WITH([gmp-framework-preferred],
  [AC_HELP_STRING([--with-gmp-framework-preferred],
    [on OSX, prefer the GMP framework to the gmp lib])],
    [GMP_PREFER_FRAMEWORK=YES],
    [GMP_PREFER_FRAMEWORK=NO])
38

39
40
41
42
43
44
AC_ARG_WITH([intree-gmp],
  [AC_HELP_STRING([--with-intree-gmp],
    [force using the in-tree GMP])],
    [GMP_FORCE_INTREE=YES],
    [GMP_FORCE_INTREE=NO])

45
dnl--------------------------------------------------------------------
46
dnl * Detect gmp
47
48
dnl--------------------------------------------------------------------

49
50
51
52
HaveLibGmp=NO
GMP_LIBS=
HaveFrameworkGMP=NO
GMP_FRAMEWORK=
Austin Seipp's avatar
Austin Seipp committed
53
HaveSecurePowm=0
54

55
if test "$GMP_FORCE_INTREE" != "YES"
56
then
57
58
59
60
61
62
63
64
    if test "$GMP_PREFER_FRAMEWORK" = "YES"
    then
        LOOK_FOR_GMP_FRAMEWORK
        LOOK_FOR_GMP_LIB
    else
        LOOK_FOR_GMP_LIB
        LOOK_FOR_GMP_FRAMEWORK
    fi
65
fi
66
67

AC_MSG_CHECKING([whether to use in-tree GMP])
68
if test "$HaveFrameworkGMP" = "YES" || test "$HaveLibGmp" = "YES"
69
then
70
71
    AC_MSG_RESULT([no])
    UseIntreeGmp=0
72
    AC_CHECK_HEADER([gmp.h], , [AC_MSG_ERROR([Cannot find gmp.h])])
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

    AC_MSG_CHECKING([GMP version])
    AC_COMPUTE_INT(GhcGmpVerMj, __GNU_MP_VERSION, [#include <gmp.h>],
        AC_MSG_ERROR([Unable to get value of __GNU_MP_VERSION]))
    AC_COMPUTE_INT(GhcGmpVerMi, __GNU_MP_VERSION_MINOR, [#include <gmp.h>],
        AC_MSG_ERROR([Unable to get value of __GNU_MP_VERSION_MINOR]))
    AC_COMPUTE_INT(GhcGmpVerPl, __GNU_MP_VERSION_PATCHLEVEL, [#include <gmp.h>],
        AC_MSG_ERROR([Unable to get value of __GNU_MP_VERSION_PATCHLEVEL]))
    AC_MSG_RESULT([$GhcGmpVerMj.$GhcGmpVerMi.$GhcGmpVerPl])

else
    AC_MSG_RESULT([yes])
    UseIntreeGmp=1
    HaveSecurePowm=1

    AC_MSG_CHECKING([GMP version])
    GhcGmpVerMj=5
    GhcGmpVerMi=0
    GhcGmpVerPl=4
    AC_MSG_RESULT([$GhcGmpVerMj.$GhcGmpVerMi.$GhcGmpVerPl])
93
fi
94

95

96
97
98
99
100
101
102
103
dnl--------------------------------------------------------------------
dnl * Make sure we got some form of gmp
dnl--------------------------------------------------------------------

AC_SUBST(GMP_INCLUDE_DIRS)
AC_SUBST(GMP_LIBS)
AC_SUBST(GMP_LIB_DIRS)
AC_SUBST(GMP_FRAMEWORK)
Ian Lynagh's avatar
Ian Lynagh committed
104
105
AC_SUBST(HaveLibGmp)
AC_SUBST(HaveFrameworkGMP)
Austin Seipp's avatar
Austin Seipp committed
106
AC_SUBST(HaveSecurePowm)
107
108
109
110
AC_SUBST(UseIntreeGmp)
AC_SUBST(GhcGmpVerMj)
AC_SUBST(GhcGmpVerMi)
AC_SUBST(GhcGmpVerPl)
111

Austin Seipp's avatar
Austin Seipp committed
112
AC_CONFIG_FILES([integer-gmp.buildinfo gmp/config.mk include/HsIntegerGmp.h])
113
114

dnl--------------------------------------------------------------------
115
dnl * Generate output files
116
117
118
dnl--------------------------------------------------------------------

AC_OUTPUT