source: git/m4/flint-check.m4 @ 7b9d49

spielwiese
Last change on this file since 7b9d49 was 7c00d6, checked in by Martin Lee <martinlee84@…>, 12 years ago
chg: adapted flint check macro due to changes in FLINT
  • Property mode set to 100755
File size: 3.1 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
42AC_LANG_PUSH(C)
43
44if test -n "$FLINT_HOME_PATH"; then
45AC_MSG_CHECKING(for FLINT >= $min_flint_version)
46fi
47
48for FLINT_HOME in ${FLINT_HOME_PATH}
49 do     
50if 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/flint"
54                FLINT_LIBS="-L${FLINT_HOME}/lib -lflint -lmpfr -lmpir"
55        else
56                FLINT_CFLAGS=
57                FLINT_LIBS="-lflint"           
58        fi     
59        CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS}"
60        LIBS="${BACKUP_LIBS} ${FLINT_LIBS}"
61
62        AC_TRY_LINK(
63        [#include <fmpz.h>],
64        [fmpz_t a; fmpz_init (a);],
65        [
66        AC_TRY_RUN(
67        [#include <flint.h>
68        int main () { if ((int) version[0] < 2) return -1; else return 0; }     
69        ],[
70        flint_found="yes"       
71        break
72        ],[     
73        flint_problem="$problem $FLINT_HOME"   
74        unset FLINT_CFLAGS
75        unset FLINT_LIBS       
76        ],[
77        flint_found="yes"
78        flint_cross="yes"       
79        break
80        ])     
81        ],
82        [
83        flint_found="no"
84        flint_checked="$checked $FLINT_HOME"
85        unset FLINT_CFLAGS
86        unset FLINT_LIBS       
87        ])
88else
89        flint_found="no"
90fi
91done
92
93if test "x$flint_found" = "xyes" ; then         
94        AC_SUBST(FLINT_CFLAGS)
95        AC_SUBST(FLINT_LIBS)
96        AC_SUBST(FLINT_HOME)
97        AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed])
98        HAVE_FLINT=yes
99        if test "x$flint_cross" != "xyes"; then
100                AC_MSG_RESULT(found)
101        else
102                AC_MSG_RESULT(unknown)
103                echo "WARNING: You appear to be cross compiling, so there is no way to determine"
104                echo "whether your FLINT version is new enough. I am assuming it is."
105        fi
106        ifelse([$2], , :, [$2])
107elif test -n "$flint_problem"; then
108        AC_MSG_RESULT(problem)
109        echo "Sorry, your FLINT version is too old. Disabling."
110        ifelse([$3], , :, [$3])
111elif test   "x$flint_found" = "xno";  then
112        AC_MSG_RESULT(not found)
113        ifelse([$3], , :, [$3])
114fi     
115
116AC_LANG_POP
117
118AM_CONDITIONAL(SING_HAVE_FLINT, test "x$HAVE_FLINT" = "xyes")
119
120CFLAGS=${BACKUP_CFLAGS}
121LIBS=${BACKUP_LIBS}
122#unset LD_LIBRARY_PATH
123
124])
125
Note: See TracBrowser for help on using the repository browser.