1 AC_DEFUN([AX_DETECT_GMP], [
2 AX_SUBMODULE(gmp,system|build,system)
5 if test "x$with_gmp_prefix" != "x"; then
6 isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
7 GMP_CPPFLAGS="-I$with_gmp_prefix/include"
8 GMP_LDFLAGS="-L$with_gmp_prefix/lib"
11 SAVE_CPPFLAGS="$CPPFLAGS"
12 SAVE_LDFLAGS="$LDFLAGS"
14 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
15 LDFLAGS="$GMP_LDFLAGS $LDFLAGS"
16 LIBS="$GMP_LIBS $LIBS"
17 AC_CHECK_HEADER([gmp.h], [], [AC_ERROR([gmp.h header not found])])
18 AC_CHECK_LIB([gmp], [main], [], [AC_ERROR([gmp library not found])])
19 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], [[
21 if (mpz_divisible_p(n, d))
22 mpz_divexact_ui(n, n, 4);
23 ]])], [], [AC_ERROR([gmp library too old])])
24 CPPFLAGS="$SAVE_CPPFLAGS"
25 LDFLAGS="$SAVE_LDFLAGS"
29 GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
30 GMP_LIBS="$with_gmp_builddir/libgmp.la"
33 SAVE_CPPFLAGS="$CPPFLAGS"
34 SAVE_LDFLAGS="$LDFLAGS"
36 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
37 LDFLAGS="$GMP_LDFLAGS $LDFLAGS"
38 LIBS="$GMP_LIBS $LIBS"
39 need_get_memory_functions=false
40 AC_CHECK_DECLS(mp_get_memory_functions,[],[
41 need_get_memory_functions=true
43 CPPFLAGS="$SAVE_CPPFLAGS"
44 LDFLAGS="$SAVE_LDFLAGS"
46 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)