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

fieker-DuValspielwiese
Last change on this file since cee403 was cee403, checked in by Hans Schoenemann <hannes@…>, 4 years ago
flint check
  • Property mode set to 100644
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
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        FLINT_CFLAGS="-I${FLINT_HOME}/include/"
53        FLINT_LIBS="-L${FLINT_HOME}/lib -lflint -lmpfr"
54
55        # we suppose that mpfr and mpir to be in the same place or available by default
56        CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS} ${GMP_CPPFLAGS}"
57        LIBS="${BACKUP_LIBS} ${FLINT_LIBS} ${GMP_LIBS}"
58
59        AC_TRY_LINK(
60        [#include <flint/fmpz.h>],
61        [fmpz_t a; fmpz_init (a);],
62        [
63        AC_TRY_RUN(
64        [#include <flint/flint.h>
65        int main () { if ((int) version[0] < 2) return -1; else return 0; }
66        ],[
67        flint_found="yes"
68        break
69        ],[
70        flint_problem="$problem $FLINT_HOME"
71        unset FLINT_CFLAGS
72        unset FLINT_LIBS
73        ],[
74        flint_found="yes"
75        flint_cross="yes"
76        break
77        ])
78        ],
79        [
80        flint_found="no"
81        flint_checked="$checked $FLINT_HOME"
82        unset FLINT_CFLAGS
83        unset FLINT_LIBS
84        ])
85else
86        flint_found="no"
87fi
88done
89AC_LANG_POP([C])
90
91CFLAGS=${BACKUP_CFLAGS}
92LIBS=${BACKUP_LIBS}
93#unset LD_LIBRARY_PATH
94
95
96if test "x$flint_found" = "xyes" ; then
97        AC_SUBST(FLINT_CFLAGS)
98        AC_SUBST(FLINT_LIBS)
99        AC_SUBST(FLINT_HOME)
100        AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed])
101        HAVE_FLINT=yes
102        if test "x$flint_cross" != "xyes"; then
103                AC_MSG_RESULT(found)
104        else
105                AC_MSG_RESULT(unknown)
106                echo "WARNING: You appear to be cross compiling, so there is no way to determine"
107                echo "whether your FLINT version is new enough. I am assuming it is."
108        fi
109        ifelse([$2], , :, [$2])
110elif test -n "$flint_problem"; then
111        AC_MSG_RESULT(problem)
112        echo "Sorry, your FLINT version is too old. Disabling."
113        ifelse([$3], , :, [$3])
114elif test   "x$flint_found" = "xno";  then
115        AC_MSG_RESULT(not found)
116        ifelse([$3], , :, [$3])
117fi
118
119AM_CONDITIONAL(SING_HAVE_FLINT, test "x$HAVE_FLINT" = "xyes")
120])
121
Note: See TracBrowser for help on using the repository browser.