From: Sven Verdoolaege Date: Sun, 28 Apr 2013 12:09:46 +0000 (+0200) Subject: detect missing gmp.h or missing/old gmp library during configure X-Git-Tag: isl-0.12~121 X-Git-Url: https://repo.or.cz/w/isl.git/commitdiff_plain/edb100dfdd5f85debf0a7929b6f7b3f18554d950 detect missing gmp.h or missing/old gmp library during configure Until now a missing gmp.h was only detected during compilation and a missing/old library only during linking. Signed-off-by: Sven Verdoolaege --- diff --git a/configure.ac b/configure.ac index 3213de0d..bb19ddec 100644 --- a/configure.ac +++ b/configure.ac @@ -48,6 +48,22 @@ system) GMP_LDFLAGS="-L$with_gmp_prefix/lib" fi GMP_LIBS=-lgmp + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" + LDFLAGS="$GMP_LDFLAGS $LDFLAGS" + LIBS="$GMP_LIBS $LIBS" + AC_CHECK_HEADER([gmp.h], [], [AC_ERROR([gmp.h header not found])]) + AC_CHECK_LIB([gmp], [main], [], [AC_ERROR([gmp library not found])]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + mpz_t n, d; + if (mpz_divisible_p(n, d)) + mpz_divexact_ui(n, n, 4); + ]])], [], [AC_ERROR([gmp library too old])]) + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" ;; build) GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"