doc: fix typo
[platform/upstream/isl.git] / configure.ac
index 3213de0..edd3693 100644 (file)
@@ -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 <gmp.h>]], [[
+               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"
@@ -55,13 +71,39 @@ build)
        ;;
 esac
 SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+SAVE_LIBS="$LIBS"
 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
+LDFLAGS="$GMP_LDFLAGS $LDFLAGS"
+LIBS="$GMP_LIBS $LIBS"
 need_get_memory_functions=false
 AC_CHECK_DECLS(mp_get_memory_functions,[],[
        need_get_memory_functions=true
 ],[#include <gmp.h>])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], [[
+       mpz_t x,y,g,a,b;
+       mpz_init(x);
+       mpz_init(y);
+       mpz_init(g);
+       mpz_init(a);
+       mpz_init(b);
+       mpz_set_si(x, -1);
+       mpz_set_si(y, 9);
+       mpz_gcdext(g, a, b, x, y);
+       if (mpz_get_si(a) == -1 && mpz_get_si(b) == 0)
+               return 0;
+       else
+               return 1;
+]])], [need_normalized_gcdext=false], [need_normalized_gcdext=true],
+[need_normalized_gcdext=true])
 CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+LIBS="$SAVE_LIBS"
 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
+if test $need_normalized_gcdext = true; then
+AC_DEFINE([GMP_NORMALIZE_GCDEXT], [],
+       [result of mpz_gcdext needs to be normalized])
+fi
 
 AX_SUBMODULE(piplib,no|system|build,no)