summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m478
-rw-r--r--configure.ac1
2 files changed, 44 insertions, 35 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 5f855e2e0..d02b078e8 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -29,11 +29,13 @@ AC_PREREQ(2.60)
dnl ------------------------------------------------------------
dnl You must put in MPFR_CONFIGS everything which configure MPFR
dnl except:
-dnl -everything dealing with CC and CFLAGS in particular the ABI
-dnl but the IEEE-754 specific flags must be set here.
-dnl -GMP's linkage.
-dnl -Libtool stuff.
-dnl -Handling of special arguments of MPFR's configure.
+dnl - Everything dealing with CC and CFLAGS in particular the ABI
+dnl but the IEEE-754 specific flags must be set here.
+dnl - Tests that depend on gmp.h (see MPFR_CHECK_DBL2INT_BUG as an example:
+dnl a function needs to be defined and called in configure.ac).
+dnl - GMP's linkage.
+dnl - Libtool stuff.
+dnl - Handling of special arguments of MPFR's configure.
AC_DEFUN([MPFR_CONFIGS],
[
AC_REQUIRE([AC_OBJEXT])
@@ -226,36 +228,6 @@ static double get_max (void) { static volatile double d = DBL_MAX; return d; }
fi
fi
-dnl Check for double-to-integer conversion bug
-dnl https://gforge.inria.fr/tracker/index.php?func=detail&aid=14435
-AC_CACHE_CHECK([for double-to-integer conversion bug], mpfr_cv_dbl_int_bug, [
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <gmp.h>
-]], [[
- double d;
- mp_limb_t u;
- int i;
-
- d = 1.0;
- for (i = 0; i < GMP_NUMB_BITS - 1; i++)
- d = d + d;
- u = (mp_limb_t) d;
- for (; i > 0; i--)
- {
- if (u & 1)
- break;
- u = u >> 1;
- }
- return (i == 0 && u == 1UL) ? 0 : 1;
-]])], [mpfr_cv_dbl_int_bug="no"],
- [mpfr_cv_dbl_int_bug="yes"],
- [mpfr_cv_dbl_int_bug="cannot test, assume not present"])
-])
-if test "$mpfr_cv_dbl_int_bug" = "yes"; then
- AC_MSG_ERROR([double-to-integer conversion is incorrect.
-You need to use another compiler (or lower the optimization level).])
-fi
-
dnl Check if subnormal (denormalized) numbers are supported
AC_CACHE_CHECK([for subnormal numbers], mpfr_cv_have_denorms, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
@@ -551,6 +523,42 @@ CPPFLAGS="$saved_CPPFLAGS"
dnl end of MPFR_CONFIGS
+dnl MPFR_CHECK_DBL2INT_BUG
+dnl ----------------------
+dnl Check for double-to-integer conversion bug
+dnl https://gforge.inria.fr/tracker/index.php?func=detail&aid=14435
+AC_DEFUN([MPFR_CHECK_DBL2INT_BUG], [
+AC_REQUIRE([MPFR_CONFIGS])dnl
+AC_CACHE_CHECK([for double-to-integer conversion bug], mpfr_cv_dbl_int_bug, [
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <gmp.h>
+]], [[
+ double d;
+ mp_limb_t u;
+ int i;
+
+ d = 1.0;
+ for (i = 0; i < GMP_NUMB_BITS - 1; i++)
+ d = d + d;
+ u = (mp_limb_t) d;
+ for (; i > 0; i--)
+ {
+ if (u & 1)
+ break;
+ u = u >> 1;
+ }
+ return (i == 0 && u == 1UL) ? 0 : 1;
+]])], [mpfr_cv_dbl_int_bug="no"],
+ [mpfr_cv_dbl_int_bug="yes"],
+ [mpfr_cv_dbl_int_bug="cannot test, assume not present"])
+])
+if test "$mpfr_cv_dbl_int_bug" = "yes"; then
+ AC_MSG_ERROR([double-to-integer conversion is incorrect.
+You need to use another compiler (or lower the optimization level).])
+fi
+])
+
+
dnl MPFR_C_LONG_DOUBLE_FORMAT
dnl -------------------------
dnl Determine the format of a long double.
diff --git a/configure.ac b/configure.ac
index 85273e793..a622e1c18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -510,6 +510,7 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
return (strcmp (buffer, gmp_version) != 0) ? 1 : 0;
]])],
[AC_MSG_RESULT(yes)
+ MPFR_CHECK_DBL2INT_BUG
MPFR_CHECK_PRINTF_SPEC],
[AC_MSG_RESULT(no)
AC_MSG_WARN([==========================================================])