source: git/m4/flint-check.m4 @ fccea5

spielwiese
Last change on this file since fccea5 was fccea5, checked in by Martin Lee <martinlee84@…>, 10 years ago
chg: Flint with gmp detection
  • Property mode set to 100755
File size: 3.2 KB
Line 
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
11dnl LB_CHECK_FLINT ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
12dnl
13dnl Test for FLINT and define
14dnl FLINT_CFLAGS and FLINT_LIBS
15
16AC_DEFUN([LB_CHECK_FLINT],
17[
18DEFAULT_CHECKING_PATH="/usr /usr/local /sw /opt/local"
19
20AC_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"
32             fi],
33             [FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"])
34
35min_flint_version=ifelse([$1], ,2.3,$1)
36
37
38dnl Check for existence
39BACKUP_CFLAGS=${CFLAGS}
40BACKUP_LIBS=${LIBS}
41
42if test -n "$FLINT_HOME_PATH"; then
43AC_MSG_CHECKING(for FLINT >= $min_flint_version)
44fi
45
46AC_LANG_PUSH([C])
47
48for FLINT_HOME in ${FLINT_HOME_PATH}
49 do     
50## if test -r "$FLINT_HOME/include/flint/fmpz.h"; then
51
52        if test "x$FLINT_HOME" != "x/usr"; then
53                FLINT_CFLAGS="-I${FLINT_HOME}/include/"
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"
62       
63        CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS} ${GMP_CFLAGS}"
64        LIBS="${BACKUP_LIBS} ${FLINT_LIBS} ${GMP_LIBS}"
65
66        AC_TRY_LINK(
67        [#include <flint/fmpz.h>],
68        [fmpz_t a; fmpz_init (a);],
69        [
70        AC_TRY_RUN(
71        [#include <flint/flint.h>
72        int main () { if ((int) version[0] < 2) return -1; else return 0; }     
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        ])
92#else
93#       flint_found="no"
94#fi
95done
96AC_LANG_POP([C])
97
98CFLAGS=${BACKUP_CFLAGS}
99LIBS=${BACKUP_LIBS}
100#unset LD_LIBRARY_PATH
101
102
103if 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])
117elif test -n "$flint_problem"; then
118        AC_MSG_RESULT(problem)
119        echo "Sorry, your FLINT version is too old. Disabling."
120        ifelse([$3], , :, [$3])
121elif test   "x$flint_found" = "xno";  then
122        AC_MSG_RESULT(not found)
123        ifelse([$3], , :, [$3])
124fi     
125
126AM_CONDITIONAL(SING_HAVE_FLINT, test "x$HAVE_FLINT" = "xyes")
127])
128
Note: See TracBrowser for help on using the repository browser.