[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 LB_CHECK_FLINT ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
---|
| 12 | dnl |
---|
| 13 | dnl Test for FLINT and define |
---|
| 14 | dnl FLINT_CFLAGS and FLINT_LIBS |
---|
| 15 | |
---|
| 16 | AC_DEFUN([LB_CHECK_FLINT], |
---|
| 17 | [ |
---|
| 18 | DEFAULT_CHECKING_PATH="/usr /usr/local /sw /opt/local" |
---|
| 19 | |
---|
| 20 | AC_ARG_WITH(flint, |
---|
| 21 | [ --with-flint=<path>|yes|no Use FLINT library. If argument is no, you do not have |
---|
| 22 | the library installed on your machine (set as |
---|
| 23 | default). If argument is yes or <empty> that means |
---|
| 24 | the library is reachable with the standard search |
---|
| 25 | path (/usr or /usr/local). Otherwise you give the |
---|
| 26 | <path> to the directory which contain the library. |
---|
| 27 | ], |
---|
| 28 | [if test "$withval" = yes ; then |
---|
| 29 | FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}" |
---|
| 30 | elif test "$withval" != no ; then |
---|
| 31 | FLINT_HOME_PATH="$withval" |
---|
[4979482] | 32 | fi], |
---|
| 33 | [FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"]) |
---|
[97a059] | 34 | |
---|
[401911] | 35 | min_flint_version=ifelse([$1], ,2.3,$1) |
---|
[97a059] | 36 | |
---|
| 37 | |
---|
| 38 | dnl Check for existence |
---|
| 39 | BACKUP_CFLAGS=${CFLAGS} |
---|
| 40 | BACKUP_LIBS=${LIBS} |
---|
| 41 | |
---|
| 42 | if test -n "$FLINT_HOME_PATH"; then |
---|
| 43 | AC_MSG_CHECKING(for FLINT >= $min_flint_version) |
---|
| 44 | fi |
---|
| 45 | |
---|
[f30df9] | 46 | AC_LANG_PUSH([C]) |
---|
| 47 | |
---|
[97a059] | 48 | for FLINT_HOME in ${FLINT_HOME_PATH} |
---|
| 49 | do |
---|
[f30df9] | 50 | ## if test -r "$FLINT_HOME/include/flint/fmpz.h"; then |
---|
[97a059] | 51 | |
---|
[246bbb] | 52 | if test "x$FLINT_HOME" != "x/usr"; then |
---|
[3cadd0] | 53 | FLINT_CFLAGS="-I${FLINT_HOME}/include/" |
---|
[246bbb] | 54 | FLINT_LIBS="-L${FLINT_HOME}/lib" |
---|
| 55 | else |
---|
| 56 | FLINT_CFLAGS="" |
---|
| 57 | FLINT_LIBS="" |
---|
| 58 | fi |
---|
| 59 | |
---|
| 60 | # we suppose that mpfr and mpir to be in the same place or available by default |
---|
| 61 | FLINT_LIBS="$FLINT_LIBS -lflint -lmpfr -lmpir" |
---|
| 62 | |
---|
[97a059] | 63 | CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS}" |
---|
| 64 | LIBS="${BACKUP_LIBS} ${FLINT_LIBS}" |
---|
| 65 | |
---|
| 66 | AC_TRY_LINK( |
---|
[3cadd0] | 67 | [#include <flint/fmpz.h>], |
---|
[97a059] | 68 | [fmpz_t a; fmpz_init (a);], |
---|
| 69 | [ |
---|
| 70 | AC_TRY_RUN( |
---|
[3cadd0] | 71 | [#include <flint/flint.h> |
---|
[401911] | 72 | int main () { if ((int) version[0] < 2) return -1; else return 0; } |
---|
[97a059] | 73 | ],[ |
---|
| 74 | flint_found="yes" |
---|
| 75 | break |
---|
| 76 | ],[ |
---|
| 77 | flint_problem="$problem $FLINT_HOME" |
---|
| 78 | unset FLINT_CFLAGS |
---|
| 79 | unset FLINT_LIBS |
---|
| 80 | ],[ |
---|
| 81 | flint_found="yes" |
---|
| 82 | flint_cross="yes" |
---|
| 83 | break |
---|
| 84 | ]) |
---|
| 85 | ], |
---|
| 86 | [ |
---|
| 87 | flint_found="no" |
---|
| 88 | flint_checked="$checked $FLINT_HOME" |
---|
| 89 | unset FLINT_CFLAGS |
---|
| 90 | unset FLINT_LIBS |
---|
| 91 | ]) |
---|
[f30df9] | 92 | #else |
---|
| 93 | # flint_found="no" |
---|
| 94 | #fi |
---|
[97a059] | 95 | done |
---|
[f30df9] | 96 | AC_LANG_POP([C]) |
---|
| 97 | |
---|
| 98 | CFLAGS=${BACKUP_CFLAGS} |
---|
| 99 | LIBS=${BACKUP_LIBS} |
---|
| 100 | #unset LD_LIBRARY_PATH |
---|
| 101 | |
---|
[97a059] | 102 | |
---|
| 103 | if test "x$flint_found" = "xyes" ; then |
---|
| 104 | AC_SUBST(FLINT_CFLAGS) |
---|
| 105 | AC_SUBST(FLINT_LIBS) |
---|
| 106 | AC_SUBST(FLINT_HOME) |
---|
| 107 | AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed]) |
---|
| 108 | HAVE_FLINT=yes |
---|
| 109 | if test "x$flint_cross" != "xyes"; then |
---|
| 110 | AC_MSG_RESULT(found) |
---|
| 111 | else |
---|
| 112 | AC_MSG_RESULT(unknown) |
---|
| 113 | echo "WARNING: You appear to be cross compiling, so there is no way to determine" |
---|
| 114 | echo "whether your FLINT version is new enough. I am assuming it is." |
---|
| 115 | fi |
---|
| 116 | ifelse([$2], , :, [$2]) |
---|
| 117 | elif test -n "$flint_problem"; then |
---|
| 118 | AC_MSG_RESULT(problem) |
---|
| 119 | echo "Sorry, your FLINT version is too old. Disabling." |
---|
| 120 | ifelse([$3], , :, [$3]) |
---|
| 121 | elif test "x$flint_found" = "xno"; then |
---|
| 122 | AC_MSG_RESULT(not found) |
---|
| 123 | ifelse([$3], , :, [$3]) |
---|
| 124 | fi |
---|
| 125 | |
---|
| 126 | AM_CONDITIONAL(SING_HAVE_FLINT, test "x$HAVE_FLINT" = "xyes") |
---|
| 127 | ]) |
---|
| 128 | |
---|