1 | # Check for FLINT |
---|
2 | # Bradford Hovinen, 2001-06-13 |
---|
3 | # Modified by Pascal Giorgi, 2003-12-03 |
---|
4 | # Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12 |
---|
5 | # Stolen from Chris Lahey 99-2-5 |
---|
6 | # stolen from Manish Singh again |
---|
7 | # stolen back from Frank Belew |
---|
8 | # stolen from Manish Singh |
---|
9 | # Shamelessly stolen from Owen Taylor |
---|
10 | |
---|
11 | dnl Test for FLINT and define |
---|
12 | dnl FLINT_CFLAGS and FLINT_LIBS |
---|
13 | |
---|
14 | AC_DEFUN([LB_CHECK_FLINT], |
---|
15 | [ |
---|
16 | DEFAULT_CHECKING_PATH="/usr /usr/local /sw /opt/local" |
---|
17 | |
---|
18 | AC_ARG_WITH(flint, |
---|
19 | [ --with-flint=<path>|yes|no Use FLINT library. If argument is no, you do not have |
---|
20 | the library installed on your machine (set as |
---|
21 | default). If argument is yes or <empty> that means |
---|
22 | the library is reachable with the standard search |
---|
23 | path (/usr or /usr/local). Otherwise you give the |
---|
24 | <path> to the directory which contain the library. |
---|
25 | ], |
---|
26 | [if test "x$withval" = xyes ; then |
---|
27 | FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}" |
---|
28 | elif test "x$withval" != xno ; then |
---|
29 | FLINT_HOME_PATH="$withval" |
---|
30 | fi], |
---|
31 | [FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"]) |
---|
32 | |
---|
33 | dnl Check for existence |
---|
34 | BACKUP_CFLAGS=${CFLAGS} |
---|
35 | BACKUP_LIBS=${LIBS} |
---|
36 | |
---|
37 | AC_LANG_PUSH([C]) |
---|
38 | |
---|
39 | flint_found="no" |
---|
40 | dnl check for system installed libraries if FLINT_HOME_PATH is the default |
---|
41 | if test "$FLINT_HOME_PATH" = "$DEFAULT_CHECKING_PATH" ; then |
---|
42 | FLINT_CFLAGS="" |
---|
43 | FLINT_LIBS="-lflint -lmpfr -lgmp" |
---|
44 | |
---|
45 | # we suppose that mpfr and mpir to be in the same place or available by default |
---|
46 | CFLAGS="${BACKUP_CFLAGS} ${GMP_CPPFLAGS}" |
---|
47 | LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}" |
---|
48 | |
---|
49 | AC_CHECK_HEADER([flint/fmpz.h], |
---|
50 | [AC_CHECK_LIB(flint,fmpz_init, |
---|
51 | [flint_found="yes"], |
---|
52 | [], |
---|
53 | [])], |
---|
54 | [], |
---|
55 | []) |
---|
56 | fi |
---|
57 | |
---|
58 | dnl if flint was not previously found, search FLINT_HOME_PATH |
---|
59 | if test "x$flint_found" = "xno" ; then |
---|
60 | for FLINT_HOME in ${FLINT_HOME_PATH} |
---|
61 | do |
---|
62 | if test -r "$FLINT_HOME/include/flint/fmpz.h"; then |
---|
63 | |
---|
64 | FLINT_CFLAGS="-I${FLINT_HOME}/include/" |
---|
65 | FLINT_LIBS="-L${FLINT_HOME}/lib -Wl,-rpath -Wl,${FLINT_HOME}/lib -lflint -lmpfr -lgmp" |
---|
66 | AM_LDFLAGS+="-rpath ${FLINT_HOME}/lib" |
---|
67 | |
---|
68 | # we suppose that mpfr and mpir to be in the same place or available by default |
---|
69 | CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS} ${GMP_CPPFLAGS}" |
---|
70 | LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}" |
---|
71 | |
---|
72 | AC_CHECK_LIB(flint,fmpz_init, |
---|
73 | [flint_found="yes"], |
---|
74 | [], |
---|
75 | [] |
---|
76 | ) |
---|
77 | fi |
---|
78 | done |
---|
79 | fi |
---|
80 | |
---|
81 | AC_LANG_POP([C]) |
---|
82 | |
---|
83 | CFLAGS=${BACKUP_CFLAGS} |
---|
84 | LIBS=${BACKUP_LIBS} |
---|
85 | #unset LD_LIBRARY_PATH |
---|
86 | |
---|
87 | AC_MSG_CHECKING(for FLINT) |
---|
88 | |
---|
89 | if test "x$flint_found" = "xyes" ; then |
---|
90 | AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed]) |
---|
91 | HAVE_FLINT=yes |
---|
92 | AC_MSG_RESULT(found) |
---|
93 | else |
---|
94 | AC_MSG_RESULT(not found) |
---|
95 | FLINT_CFLAGS="" |
---|
96 | FLINT_LIBS="" |
---|
97 | FLINT_HOME="" |
---|
98 | fi |
---|
99 | AC_SUBST(FLINT_CFLAGS) |
---|
100 | AC_SUBST(FLINT_LIBS) |
---|
101 | AC_SUBST(FLINT_HOME) |
---|
102 | ]) |
---|
103 | |
---|