source: git/m4/flint-check.m4 @ 7938f1f

spielwiese
Last change on this file since 7938f1f was 7938f1f, checked in by Hans Schoenemann <hannes@…>, 4 years ago
fix: flint at unusal place: set rpath
  • Property mode set to 100644
File size: 2.7 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 Test for FLINT and define
12dnl FLINT_CFLAGS and FLINT_LIBS
13
14AC_DEFUN([LB_CHECK_FLINT],
15[
16DEFAULT_CHECKING_PATH="/usr /usr/local /sw /opt/local"
17
18AC_ARG_WITH(flint,
19[  --with-flint=<path>|yes|no  Use FLINT library. If argument is no, you do not have
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.
25             ],
26             [if test "x$withval" = xyes ; then
27                        FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"
28              elif test "x$withval" != xno ; then
29                        FLINT_HOME_PATH="$withval"
30             fi],
31             [FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"])
32
33dnl Check for existence
34BACKUP_CFLAGS=${CFLAGS}
35BACKUP_LIBS=${LIBS}
36
37AC_LANG_PUSH([C])
38
39flint_found="no"
40dnl check for system installed libraries if FLINT_HOME_PATH is the default
41if test "$FLINT_HOME_PATH" = "$DEFAULT_CHECKING_PATH" ; then
42        FLINT_CFLAGS=""
43        FLINT_LIBS="-lflint -lmpfr -lgmp"
44
45        # we suppose that mpfr and mpir to be in the same place or available by default
46        CFLAGS="${BACKUP_CFLAGS} ${GMP_CPPFLAGS}"
47        LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}"
48
49        AC_CHECK_HEADER([flint/fmpz.h],
50                [AC_CHECK_LIB(flint,fmpz_init,
51                        [flint_found="yes"],
52                        [],
53                        [])],
54                [],
55                [])
56fi
57
58dnl if flint was not previously found, search FLINT_HOME_PATH
59if 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/"
65                FLINT_LIBS="-L${FLINT_HOME}/lib -Wl,-rpath -Wl,${FLINT_HOME}/lib -lflint -lmpfr -lgmp"
66                AM_LDFLAGS+="-rpath ${FLINT_HOME}/lib"
67
68        # we suppose that mpfr and mpir to be in the same place or available by default
69                CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS} ${GMP_CPPFLAGS}"
70                LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}"
71
72                AC_CHECK_LIB(flint,fmpz_init,
73                [flint_found="yes"],
74                [],
75                []
76                )
77                fi
78        done
79fi
80
81AC_LANG_POP([C])
82
83CFLAGS=${BACKUP_CFLAGS}
84LIBS=${BACKUP_LIBS}
85#unset LD_LIBRARY_PATH
86
87AC_MSG_CHECKING(for FLINT)
88
89if test "x$flint_found" = "xyes" ; then
90        AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed])
91        HAVE_FLINT=yes
92        AC_MSG_RESULT(found)
93else
94        AC_MSG_RESULT(not found)
95        FLINT_CFLAGS=""
96        FLINT_LIBS=""
97        FLINT_HOME=""
98fi
99AC_SUBST(FLINT_CFLAGS)
100AC_SUBST(FLINT_LIBS)
101AC_SUBST(FLINT_HOME)
102])
103
Note: See TracBrowser for help on using the repository browser.