summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-04-15 21:27:48 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2014-04-15 21:27:48 +0000
commit2c1a66209916fac30a2aecc734d42cec87857b42 (patch)
tree34476b2cadc03bb1519c935330a88a69cd28af34 /configure.ac
parent2a175fc28e255e94b1d003aa6720863313340583 (diff)
downloadmpfr-2c1a66209916fac30a2aecc734d42cec87857b42.tar.gz
BYTES_PER_MP_LIMB -> MPFR_BYTES_PER_MP_LIMB for GMP 6 compatibility
when --with-gmp-build is used. See mailing-list discussion: https://sympa.inria.fr/sympa/arc/mpfr/2014-04/msg00000.html Updated configure test on GMP_NUMB_BITS and sizeof(mp_limb_t): * BYTES_PER_MP_LIMB is no longer tested. * 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. (merged changesets r9029,9030 from the trunk, with conflict resolution) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@9034 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac26
1 files changed, 16 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index ba1401c3d..7e6162ea2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -435,23 +435,29 @@ if test "$use_gmp_build" = yes ; then
])
fi
-dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB
+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).
-if test "$use_gmp_build" = yes ; then
- AC_MSG_CHECKING(for valid GMP_NUMB_BITS)
- AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+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"
-#include "gmp-impl.h"
]], [[
- return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
- && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1;
+ 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 is incorrect.
-You probably need to change some of the GMP or MPFR compile options.])],
+ 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])])
-fi
dnl We really need to link using libtool. But it is impossible with the current