[97a059] | 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 | [ |
---|
[effb43] | 16 | DEFAULT_CHECKING_PATH="/usr /usr/local /sw /opt/local" |
---|
[97a059] | 17 | |
---|
| 18 | AC_ARG_WITH(flint, |
---|
| 19 | [ --with-flint=<path>|yes|no Use FLINT library. If argument is no, you do not have |
---|
[75f460] | 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. |
---|
[97a059] | 25 | ], |
---|
[416af8] | 26 | [if test "x$withval" = xyes ; then |
---|
[97a059] | 27 | FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}" |
---|
[416af8] | 28 | elif test "x$withval" != xno ; then |
---|
[97a059] | 29 | FLINT_HOME_PATH="$withval" |
---|
[4979482] | 30 | fi], |
---|
| 31 | [FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"]) |
---|
[97a059] | 32 | |
---|
| 33 | dnl Check for existence |
---|
| 34 | BACKUP_CFLAGS=${CFLAGS} |
---|
| 35 | BACKUP_LIBS=${LIBS} |
---|
| 36 | |
---|
[f30df9] | 37 | AC_LANG_PUSH([C]) |
---|
| 38 | |
---|
[952bd16] | 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="" |
---|
[04975c] | 43 | FLINT_LIBS="-lflint -lmpfr -lgmp" |
---|
[75f460] | 44 | |
---|
[246bbb] | 45 | # we suppose that mpfr and mpir to be in the same place or available by default |
---|
[952bd16] | 46 | CFLAGS="${BACKUP_CFLAGS} ${GMP_CPPFLAGS}" |
---|
[6ed33f] | 47 | LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}" |
---|
[97a059] | 48 | |
---|
[952bd16] | 49 | AC_CHECK_HEADER([flint/fmpz.h], |
---|
| 50 | [AC_CHECK_LIB(flint,fmpz_init, |
---|
| 51 | [flint_found="yes"], |
---|
| 52 | [], |
---|
| 53 | [])], |
---|
| 54 | [], |
---|
| 55 | []) |
---|
[cee403] | 56 | fi |
---|
[952bd16] | 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/" |
---|
[151154] | 65 | FLINT_LIBS="-L${FLINT_HOME}/lib -Wl,-rpath -Wl,${FLINT_HOME}/lib -lflint -lmpfr -lgmp" |
---|
[952bd16] | 66 | |
---|
| 67 | # we suppose that mpfr and mpir to be in the same place or available by default |
---|
| 68 | CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS} ${GMP_CPPFLAGS}" |
---|
[6ed33f] | 69 | LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}" |
---|
[952bd16] | 70 | |
---|
| 71 | AC_CHECK_LIB(flint,fmpz_init, |
---|
| 72 | [flint_found="yes"], |
---|
| 73 | [], |
---|
| 74 | [] |
---|
| 75 | ) |
---|
| 76 | fi |
---|
| 77 | done |
---|
| 78 | fi |
---|
| 79 | |
---|
[f30df9] | 80 | AC_LANG_POP([C]) |
---|
| 81 | |
---|
| 82 | CFLAGS=${BACKUP_CFLAGS} |
---|
| 83 | LIBS=${BACKUP_LIBS} |
---|
| 84 | #unset LD_LIBRARY_PATH |
---|
| 85 | |
---|
[6b44a8] | 86 | AC_MSG_CHECKING(for FLINT) |
---|
[97a059] | 87 | |
---|
[75f460] | 88 | if test "x$flint_found" = "xyes" ; then |
---|
[97a059] | 89 | AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed]) |
---|
| 90 | HAVE_FLINT=yes |
---|
[416af8] | 91 | AC_MSG_RESULT(found) |
---|
| 92 | else |
---|
[97a059] | 93 | AC_MSG_RESULT(not found) |
---|
[b8d464] | 94 | FLINT_CFLAGS="" |
---|
| 95 | FLINT_LIBS="" |
---|
| 96 | FLINT_HOME="" |
---|
[75f460] | 97 | fi |
---|
[b8d464] | 98 | AC_SUBST(FLINT_CFLAGS) |
---|
| 99 | AC_SUBST(FLINT_LIBS) |
---|
| 100 | AC_SUBST(FLINT_HOME) |
---|
[97a059] | 101 | ]) |
---|
| 102 | |
---|