summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-04-15 13:01:25 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-04-15 13:01:25 +0000
commit17168a18a35ee90641f0d3ecd34211db387e1140 (patch)
tree0508d7851d3b831b8683ea4b43fdb627707418ad /configure.ac
parent845504bef1ef2842f131d5a2dd4db2df2a7e763e (diff)
downloadmpfr-17168a18a35ee90641f0d3ecd34211db387e1140.tar.gz
Re-added configure test on GMP_NUMB_BITS and sizeof(mp_limb_t), and
updated it: * BYTES_PER_MP_LIMB is no longer tested (see r9029). * The test is now always run, not just when --with-gmp-build is used. * Results are output in config.log in case of failure. * The error message has been updated. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9030 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac24
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ca8027806..1de2edacd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -509,6 +509,30 @@ if test "$use_gmp_build" = yes ; then
])
fi
+dnl Check for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency.
+dnl Problems may occur if gmp.h was generated with some ABI
+dnl and is used with another ABI (or if nails are used).
+dnl This test doesn't need to link with libgmp (at least it shouldn't).
+AC_MSG_CHECKING(for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency)
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+#include <limits.h>
+#include "gmp.h"
+]], [[
+ if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT)
+ return 0;
+ fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS);
+ fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t));
+ fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n",
+ (long) (sizeof(mp_limb_t) * CHAR_BIT));
+ return 1;
+]])], [AC_MSG_RESULT(yes)], [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent.
+You probably need to change some of the GMP or MPFR compile options.
+See 'config.log' for details (search for GMP_NUMB_BITS).])],
+ [AC_MSG_RESULT([can't test])])
+
dnl Check if we can link with GMP
AC_CHECK_LIB(gmp, $test_libgmp, [LIBS="-lgmp $LIBS"],
[AC_MSG_ERROR(libgmp not found or uses a different ABI (including static vs shared).