source: git/m4/flint-check.m4 @ 2e7e3dc

fieker-DuValspielwiese
Last change on this file since 2e7e3dc was 151154, checked in by Hans Schoenemann <hannes@…>, 4 years ago
add rpath for FLINT in non-default location
  • Property mode set to 100644
File size: 2.6 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
67        # we suppose that mpfr and mpir to be in the same place or available by default
68                CFLAGS="${BACKUP_CFLAGS} ${FLINT_CFLAGS} ${GMP_CPPFLAGS}"
69                LIBS="${FLINT_LIBS} ${GMP_LIBS} ${BACKUP_LIBS}"
70
71                AC_CHECK_LIB(flint,fmpz_init,
72                [flint_found="yes"],
73                [],
74                []
75                )
76                fi
77        done
78fi
79
80AC_LANG_POP([C])
81
82CFLAGS=${BACKUP_CFLAGS}
83LIBS=${BACKUP_LIBS}
84#unset LD_LIBRARY_PATH
85
86AC_MSG_CHECKING(for FLINT)
87
88if test "x$flint_found" = "xyes" ; then
89        AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed])
90        HAVE_FLINT=yes
91        AC_MSG_RESULT(found)
92else
93        AC_MSG_RESULT(not found)
94        FLINT_CFLAGS=""
95        FLINT_LIBS=""
96        FLINT_HOME=""
97fi
98AC_SUBST(FLINT_CFLAGS)
99AC_SUBST(FLINT_LIBS)
100AC_SUBST(FLINT_HOME)
101])
102
Note: See TracBrowser for help on using the repository browser.