summaryrefslogtreecommitdiff
path: root/Build/source/libs/mpfr/mpfr-src/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/configure.ac')
-rw-r--r--Build/source/libs/mpfr/mpfr-src/configure.ac356
1 files changed, 239 insertions, 117 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/configure.ac b/Build/source/libs/mpfr/mpfr-src/configure.ac
index 27c609394c2..3c667390b77 100644
--- a/Build/source/libs/mpfr/mpfr-src/configure.ac
+++ b/Build/source/libs/mpfr/mpfr-src/configure.ac
@@ -1,5 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
+dnl WARNING! C code starting with # (preprocessor directives) must not
+dnl be indented!
+
AC_COPYRIGHT([
Copyright 1999-2017 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
@@ -23,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
])
dnl Add check-news when it checks for more than 15 lines
-AC_INIT([MPFR],[3.1.6])
+AC_INIT([MPFR],[4.0.0])
dnl Older Automake versions than 1.13 may still be supported, but no longer
dnl tested, and many things have changed in 1.13. Moreover the INSTALL file
@@ -34,10 +37,15 @@ AM_MAINTAINER_MODE(enable)
AC_CONFIG_MACRO_DIR([m4])
-dnl FIXME: The AC_ARG_ENABLE(decimal-float...) part does things too
-dnl early, even when this option is not used. In particular, it must
-dnl be put after AC_PROG_CC; another problem is that the GMP CFLAGS
-dnl and CC check may modify the compiler.
+dnl FIXME: Several AC_RUN_IFELSE programs can return several values
+dnl (one for each format to be detected), but the Autoconf manual says:
+dnl "This exit status might be that of a failed compilation, or it might
+dnl be that of a failed program execution." Unfortunately, we cannot
+dnl know whether a non-zero exit status comes from a failed compilation,
+dnl so that the detection may be incorrect. To avoid this problem, write
+dnl a test program for each possible format? Alternatively, the test
+dnl program could output the result of the format detection to a file
+dnl and return with the 0 exit status if it could do that successfully.
test_CFLAGS=${CFLAGS+set}
@@ -59,17 +67,21 @@ dnl There is still some problem with GMP's HAVE_CONFIG
dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in])
dnl Extra arguments to configure
+
unset gmp_lib_path GMP_CFLAGS GMP_CC
+
AC_ARG_WITH(gmp_include,
[ --with-gmp-include=DIR GMP include directory ],
MPFR_PARSE_DIRECTORY(["$withval"],[withval])
CPPFLAGS="$CPPFLAGS -I$withval")
+
AC_ARG_WITH(gmp_lib,
[ --with-gmp-lib=DIR GMP lib directory ], [
MPFR_PARSE_DIRECTORY(["$withval"],[withval])
LDFLAGS="$LDFLAGS -L$withval"
gmp_lib_path="$withval"
])
+
AC_ARG_WITH(gmp,
[ --with-gmp=DIR GMP install directory ], [
MPFR_PARSE_DIRECTORY(["$withval"],[withval])
@@ -124,19 +136,22 @@ AC_ARG_ENABLE(gmp-internals,
AC_ARG_ENABLE(assert,
[ --enable-assert enable ASSERT checking [[default=no]]],
[ case $enableval in
- yes) AC_DEFINE([MPFR_WANT_ASSERT],1,[Want assertion]) ;;
+ yes) AC_DEFINE([MPFR_WANT_ASSERT],1,[Want all simple assertions]) ;;
+ none) AC_DEFINE([MPFR_WANT_ASSERT],-1,[Do no want any assertion]) ;;
no) ;;
- full) AC_DEFINE([MPFR_WANT_ASSERT],2,[Want assertion]) ;;
- *) AC_MSG_ERROR([bad value for --enable-assert: yes, no or full]) ;;
+ full) AC_DEFINE([MPFR_WANT_ASSERT],2,[Want full assertions]) ;;
+ *) AC_MSG_ERROR([bad value for --enable-assert: yes, no, none or full]) ;;
esac])
+
AC_ARG_ENABLE(logging,
[ --enable-logging enable MPFR logging (the system must support it)
[[default=no]]],
[ case $enableval in
- yes) AC_DEFINE([MPFR_USE_LOGGING],1,[Log what MPFR does]) ;;
+ yes) AC_DEFINE([MPFR_USE_LOGGING],1,[Enable MPFR logging support]) ;;
no) ;;
*) AC_MSG_ERROR([bad value for --enable-logging: yes or no]) ;;
esac])
+
AC_ARG_ENABLE(thread-safe,
[ --disable-thread-safe explicitly disable TLS support
--enable-thread-safe build MPFR as thread safe, i.e. with TLS support
@@ -146,6 +161,18 @@ AC_ARG_ENABLE(thread-safe,
no) ;;
*) AC_MSG_ERROR([bad value for --enable-thread-safe: yes or no]) ;;
esac])
+
+AC_ARG_ENABLE(shared-cache,
+ [ --enable-shared-cache enable use of caches shared by all threads,
+ for all MPFR constants. It usually makes MPFR
+ dependent on PTHREAD [[default=no]]],
+ [ case $enableval in
+ yes) mpfr_want_shared_cache=yes
+ AC_DEFINE([WANT_SHARED_CACHE],1,[Want shared cache]) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-shared-cache: yes or no]) ;;
+ esac])
+
AC_ARG_ENABLE(warnings,
[ --enable-warnings allow MPFR to output warnings to stderr [[default=no]]],
[ case $enableval in
@@ -155,9 +182,11 @@ AC_ARG_ENABLE(warnings,
esac])
AC_ARG_ENABLE(tests-timeout,
- [ --enable-tests-timeout=NUM enable timeout (NUM seconds) for test programs
- (NUM <= 9999) [[default=no]]; if enabled, env variable
- $MPFR_TESTS_TIMEOUT overrides NUM (0: no timeout).],
+ [ --enable-tests-timeout=NUM
+ [[for developers]] enable timeout for test programs
+ (NUM seconds, <= 9999) [[default=no]]; if this is
+ enabled, the environment variable $MPFR_TESTS_TIMEOUT
+ overrides NUM (0: no timeout)],
[ case $enableval in
no) ;;
yes) AC_DEFINE([MPFR_TESTS_TIMEOUT], 0, [timeout limit]) ;;
@@ -166,6 +195,15 @@ AC_ARG_ENABLE(tests-timeout,
*) AC_MSG_ERROR([bad value for --enable-tests-timeout]) ;;
esac])
+AC_ARG_ENABLE(tune-for-coverage,
+ [ --enable-tune-for-coverage
+ [[for developers]] tune MPFR for coverage tests],
+ [ case $enableval in
+ no) ;;
+ yes) AC_DEFINE([MPFR_TUNE_COVERAGE], 1, [tune for coverage]) ;;
+ *) AC_MSG_ERROR([bad value for --enable-tune-for-coverage]) ;;
+ esac])
+
dnl
dnl Setup CC and CFLAGS
@@ -186,7 +224,7 @@ dnl (before we have the chance to get it from gmp.h) and does some
dnl checking related to this compiler (such as dependency tracking
dnl options); if the compiler changes due to __GMP_CC in gmp.h, one
dnl would have incorrect settings.
-dnl FIXME: Move this in aclocal ?
+dnl FIXME: Move this in acinclude.m4 ?
if test -z "$GMP_CC$GMP_CFLAGS" ; then
AC_MSG_CHECKING(for CC and CFLAGS in gmp.h)
GMP_CC=__GMP_CC
@@ -194,35 +232,34 @@ if test -z "$GMP_CC$GMP_CFLAGS" ; then
# /lib/cpp under Solaris doesn't support some environment variables
# used by GCC, such as C_INCLUDE_PATH. If the user has set up such
# environment variables, he probably wants to use them. So, let us
- # prefer cpp and gcc to /lib/cpp.
- for cpp in cpp gcc /lib/cpp cc c99
+ # prefer cpp and gcc to /lib/cpp. However, note that this won't
+ # work if GCC has been installed with versioned names only (e.g.
+ # with cpp-5 and gcc-5).
+ for cpp in "cpp -P" "cpp" "gcc -P -E" "gcc -E" "/lib/cpp -P" "/lib/cpp" "cc -P -E" "cc -E" "c99 -P -E" "c99 -E"
do
- case $cpp in
- *cpp*) ;;
- *) cpp="$cpp -E" ;;
- esac
- echo foo > conftest.c
- if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then
- # Get CC
- echo "#include \"gmp.h\"" > conftest.c
- echo "MPFR_OPTION __GMP_CC" >> conftest.c
- GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
- # Get CFLAGS
- echo "#include \"gmp.h\"" > conftest.c
- echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c
- unset rmpedantic
- [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;']
- GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'`
- break
- fi
+ # Get CC
+ echo "#include \"gmp.h\"" > conftest.c
+ echo "MPFR_OPTION __GMP_CC" >> conftest.c
+ $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt
+ test $? -ne 0 && continue
+ GMP_CC=`$EGREP MPFR_OPTION conftest.txt | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
+ # Get CFLAGS
+ echo "#include \"gmp.h\"" > conftest.c
+ echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c
+ unset rmpedantic
+ [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;']
+ $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt
+ test $? -ne 0 && continue
+ GMP_CFLAGS=`$EGREP MPFR_OPTION conftest.txt | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'`
+ break
done
rm -f conftest*
if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(failed)
GMP_CFLAGS=
GMP_CC=
else
- AC_MSG_RESULT(yes [CC=$GMP_CC CFLAGS=$GMP_CFLAGS])
+ AC_MSG_RESULT([CC=$GMP_CC CFLAGS=$GMP_CFLAGS])
fi
fi
@@ -249,9 +286,48 @@ AC_PROG_CC
AC_PROG_CPP
AC_LANG(C)
-dnl Support unusual archivers.
+dnl AM_PROG_AR is needed so that ar-lib (wrapper for Microsoft lib.exe)
+dnl gets installed by "automake -i" (if absent, "automake --warnings=all"
+dnl gives a warning).
AM_PROG_AR
+dnl This must done before MPFR_CONFIGS.
+LT_INIT(win32-dll)
+
+dnl Try to determine the double format
+AC_MSG_CHECKING(format of `double' floating point)
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+]], [[
+union ieee_double_extract
+{
+ double d;
+ unsigned char x[8];
+} t;
+t.d = 2.877939254133025759330166692961938679218292236328125; /* exact */
+if (sizeof (double) != 8)
+ return 0;
+if (sizeof (unsigned char) != 1)
+ return 0;
+if (t.x[0] == 1 && t.x[1] == 2 && t.x[2] == 3 && t.x[3] == 4 &&
+ t.x[4] == 5 && t.x[5] == 6 && t.x[6] == 7 && t.x[7] == 64)
+ return 1; /* little endian */
+else if (t.x[7] == 1 && t.x[6] == 2 && t.x[5] == 3 && t.x[4] == 4 &&
+ t.x[3] == 5 && t.x[2] == 6 && t.x[1] == 7 && t.x[0] == 64)
+ return 2; /* big endian */
+else
+ return 0; /* unknown */
+]])],
+ [mpfr_ieee_double=$?],
+ [mpfr_ieee_double=$?],
+ [mpfr_ieee_double=0])
+case "$mpfr_ieee_double" in
+ 1) AC_MSG_RESULT([IEEE little endian])
+ AC_DEFINE(HAVE_DOUBLE_IEEE_LITTLE_ENDIAN) ;;
+ 2) AC_MSG_RESULT([IEEE big endian])
+ AC_DEFINE(HAVE_DOUBLE_IEEE_BIG_ENDIAN) ;;
+ *) AC_MSG_WARN([format of `double' floating-point not recognized]) ;;
+esac
+
dnl For GCC, _Decimal64 was introduced in GCC 4.3 for some targets
dnl (note that it is not guaranteed to be available because it may
dnl be disabled in the GCC build). See:
@@ -262,56 +338,72 @@ dnl _Decimal64 support is broken with GCC 4.6.3 and 4.7.2 on powerpc64
dnl with the mode32 ABI, e.g. "-m32 -mpowerpc64 -mtune=970 -O3"; this
dnl is detected by the x != x test below.
AC_ARG_ENABLE(decimal-float,
- [ --enable-decimal-float build conversion functions from/to decimal floats
- (requires --with-gmp-build) [[default=no]]],
+ [ --disable-decimal-float explicitly disable decimal floats support
+ --enable-decimal-float build conversion functions from/to decimal floats
+ [[default=autodetect]]],
[ case $enableval in
- yes) AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1,
- [Build decimal float functions])
- AC_MSG_CHECKING(if compiler knows _Decimal64)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[_Decimal64 x;]])],
- [AC_MSG_RESULT(yes)
- if test "$use_gmp_build" != yes ; then
- AC_MSG_ERROR([decimal float support requires --with-gmp-build])
- fi
- AC_MSG_CHECKING(if _GMP_IEEE_FLOATS is defined)
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-#include "gmp.h"
-#include "gmp-impl.h"
-#ifndef _GMP_IEEE_FLOATS
-#error "_GMP_IEEE_FLOATS is not defined"
-#endif]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
- AC_MSG_ERROR([decimal float support requires _GMP_IEEE_FLOATS])])
- ],
- [AC_MSG_RESULT(no)
-AC_MSG_ERROR([Compiler doesn't know _Decimal64 (ISO/IEC TR 24732).
-Please use another compiler or build MPFR without --enable-decimal-float.])]
- )
- AC_MSG_CHECKING(decimal float format)
- AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <stdlib.h>
-]], [[
-volatile _Decimal64 x = 1;
-union { double d; _Decimal64 d64; } y;
-if (x != x) return 3;
-y.d64 = 1234567890123456.0dd;
-return y.d == 0.14894469406741037E-123 ? 0 :
- y.d == 0.59075095508629822E-68 ? 1 : 2;
-]])], [AC_MSG_RESULT(DPD)
- AC_DEFINE([DPD_FORMAT],1,[])],
- [case "$?" in
- 1) AC_MSG_RESULT(BID) ;;
- 2) AC_MSG_FAILURE(neither DPD nor BID) ;;
- 3) AC_MSG_FAILURE([_Decimal64 support is broken.
-Please use another compiler or build MPFR without --enable-decimal-float.]) ;;
- *) AC_MSG_FAILURE(internal error) ;;
- esac],
- [AC_MSG_RESULT(assuming DPD)
- AC_DEFINE([DPD_FORMAT],1,[])])
- ;;
+ yes) ;;
no) ;;
*) AC_MSG_ERROR([bad value for --enable-decimal-float: yes or no]) ;;
esac])
+dnl GCC >= 4.3 provides __float128, but since this is not standard,
+dnl the default is "autodetect" and not "yes"
+AC_ARG_ENABLE(float128,
+ [ --disable-float128 explicitly disable __float128 support
+ --enable-float128 build conversion functions from/to __float128
+ [[default=autodetect]]],
+ [ case $enableval in
+ yes) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-float128: yes or no]) ;;
+ esac])
+
+test_libgmp=__gmpz_init
+
+AC_ARG_ENABLE(mini-gmp,
+ [ --enable-mini-gmp build MPFR with mini-gmp (experimental) [[default=no]]],
+ [ case $enableval in
+ yes) AC_DEFINE([MPFR_USE_MINI_GMP],1,[Use mini-gmp])
+ # With mini-gmp, mp_limb_t is always unsigned long.
+ AC_COMPUTE_INT(nettle_cv_gmp_numb_bits, [(sizeof(unsigned long) * CHAR_BIT)],
+ [#include <limits.h>],
+ [AC_MSG_FAILURE([cannot find value of GMP_NUMB_BITS])])
+ AC_MSG_RESULT([$nettle_cv_gmp_numb_bits bits])
+ AC_DEFINE_UNQUOTED([GMP_NUMB_BITS], $nettle_cv_gmp_numb_bits, [number of bits in a limb])
+ AC_DEFINE([GMP_NAIL_BITS], 0, [number of nails in a limb])
+ test_libgmp=mpz_init;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-mini-gmp: yes or no]) ;;
+ esac])
+
+AC_ARG_ENABLE(debug-prediction,
+ [ --enable-debug-prediction
+ [[for developers]] enable debug of branch prediction
+ (for x86 and x86-64 with GCC, static libs)],
+ [ case $enableval in
+ yes) if test "$enable_shared" != no; then
+ AC_MSG_ERROR([--enable-debug-prediction can only work in static mode (--disable-shared)])
+ fi
+ AC_DEFINE([MPFR_DEBUG_PREDICTION],1,
+ [Enable debug of branch prediction]) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-debug-prediction: yes or no]) ;;
+ esac])
+
+AC_ARG_ENABLE(lto,
+ [ --enable-lto build MPFR with link-time-optimization
+ (experimental) [[default: no]]],
+ [ case $enableval in
+ yes) if test "$enable_shared" != "no"; then
+ AC_MSG_ERROR([--enable-lto can only work in static mode (--disable-shared)])
+ fi
+ enable_lto=yes
+ ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-lto: yes or no]) ;;
+ esac])
+
dnl Check if compiler is ICC, and if such a case, disable GCC
dnl And add some specific flags.
dnl Don't add Warnings Flags (Otherwise you'll get more than 20000 warnings).
@@ -325,15 +417,22 @@ dnl the GCC variable confuses libtool. See:
dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485421
dnl * If need be, the gcc predefined macros __GNUC_* can be disabled
dnl thanks to the -no-gcc option.
+dnl * Now use -mieee-fp instead of -mp (ICC 13 says: option '-mp' is
+dnl deprecated and will be removed in a future release.). According
+dnl to "icc -help", both options are equivalent; it also suggests
+dnl to use -fp-model <arg> instead of -mp, but what is <arg>? Anyway
+dnl -mieee-fp solves the tset_d failure due to a negative zero. This
+dnl option has been introduced in ICC 9.0 for Linux (2005-06):
+dnl http://www.ncsa.illinois.edu/UserInfo/Resources/Software/Intel/Compilers/9.0/C_ReleaseNotes.htm
AC_MSG_CHECKING(for ICC)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if !defined(__ICC)
-# error "ICC Not Found"
+# error "Not ICC"
error
#endif
]], [[]])],[
AC_MSG_RESULT(yes)
- CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
+ CFLAGS="-fp_port -mieee-fp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
],[AC_MSG_RESULT(no)])
dnl If compiler is gcc, then use some specific flags.
@@ -373,6 +472,13 @@ esac
AC_C_CONST
AC_C_VOLATILE
+dnl Determine the endianness of integer. But since MPFR doesn't use
+dnl AC_CONFIG_HEADERS, configure cannot provide such information for
+dnl universal binaries containing variants with different endianness
+dnl (i.e. generic code must be used).
+AC_C_BIGENDIAN([AC_DEFINE(HAVE_BIG_ENDIAN)],[AC_DEFINE(HAVE_LITTLE_ENDIAN)],
+[true],[true])
+
MPFR_CONFIGS
# (Based on GMP 5.1)
@@ -409,15 +515,18 @@ dnl
dnl Incidentally, libtool does generate an import library libmpfr.dll.a,
dnl but it's "ar" format and cannot be used by the MS linker. There
dnl doesn't seem to be any GNU tool for generating or converting to .lib.
+dnl
+dnl The DLL version (the number in libmpfr-*.dll.def below) must be the
+dnl version of the oldest supported interface (i.e. CURRENT - AGE in
+dnl src/Makefile.am).
AC_SUBST(MPFR_LDFLAGS)
AC_SUBST(LIBMPFR_LDFLAGS)
-LT_INIT(win32-dll)
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
AC_MSG_CHECKING(for DLL/static GMP)
if test "$enable_shared" = yes; then
MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined"
- LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-4.dll.def"
+ LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-6.dll.def"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "gmp.h"
#if !__GMP_LIBGMP_DLL
@@ -426,7 +535,7 @@ error
#endif
]], [[]])],[AC_MSG_RESULT(DLL)],[
AC_MSG_RESULT(static)
- AC_MSG_ERROR([gmp.h isn't a DLL: use --enable-static --disable-shared]) ])
+ AC_MSG_ERROR([libgmp isn't provided as a DLL: use --enable-static --disable-shared]) ])
else
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "gmp.h"
@@ -436,7 +545,7 @@ error
#endif
]], [[]])],[AC_MSG_RESULT(static)],[
AC_MSG_RESULT(DLL)
- AC_MSG_ERROR([gmp.h is a DLL: use --disable-static --enable-shared]) ])
+ AC_MSG_ERROR([libgmp is provided as a DLL: use --disable-static --enable-shared]) ])
fi
;;
esac
@@ -488,22 +597,26 @@ dnl We only guarantee that with a *functional* and recent enough GMP version,
dnl MPFR will compile; we do not guarantee that GMP will compile.
dnl In particular fat builds are broken in GMP 4.3.2 and GMP 5.0.0
dnl (at least on 64-bit Core 2 under Linux),
-dnl see http://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html.
-AC_MSG_CHECKING(for recent GMP)
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+dnl see <https://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html>.
+if test -z "$enable_mini_gmp" ; then
+ AC_MSG_CHECKING(for recent GMP)
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "gmp.h"
-#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410)
-# error "min GMP version is 4.1.0"
+#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 500)
+# error "GMP 5.0.0 or newer is required"
error
#endif
-]])],[AC_MSG_RESULT(yes)],[
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([GMP 4.1.0 min required])
+ ]])],[AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([GMP 5.0.0 or newer is required])
])
+fi
dnl Check if gmp.h is usable at link time; this may detect errors such as
dnl with GMP 4.1, which uses "extern __inline__" unconditionally with all
-dnl GCC versions, which breaks by default with GCC 5.
+dnl GCC versions, which breaks by default with GCC 5 (this problem with
+dnl GMP 4.1 is no longer possible as we now require GMP 5.0.0 or newer,
+dnl but the same kind of problem may occur in the future).
dnl Note: No linking is done against the GMP library at this time, as we
dnl do not use any GMP symbol. The goal of this test is to avoid obscure
dnl errors with the following gmp.h tests.
@@ -512,10 +625,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include "gmp.h"
]],[[]])],[AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
- AC_MSG_ERROR([There is an incompatibility between gmp.h and the compiler.
-See 'config.log' for details.
-Such an incompatibility is known between GMP 4.1, which uses
-"extern __inline__" with all GCC versions, and GCC 5.])
+ AC_MSG_ERROR([there is an incompatibility between gmp.h and the compiler.
+See 'config.log' for details.])
])
dnl Check if we can use internal header files of GMP (only --with-gmp-build)
@@ -557,13 +668,12 @@ 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([cannot test])])
-
dnl Check if we can link with GMP
-AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
- [AC_MSG_ERROR(libgmp not found or uses a different ABI (including static vs shared).
-Please read the INSTALL file -- see "In case of problem".)])
+AC_CHECK_LIB(gmp, $test_libgmp, [LIBS="-lgmp $LIBS"],
+ [AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).
+Please read the INSTALL file -- see "In case of problem".])])
-dnl Check for corresponding 'gmp.h' and libgmp.a
+dnl Check for corresponding 'gmp.h' and libgmp
AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)
dnl We do not set LD_LIBRARY_PATH, as it is not possible to set it just
dnl before the test program is run, and we do not want to affect other
@@ -572,25 +682,29 @@ dnl incorrect and even have security implications.
dnl WARNING! LD_RUN_PATH is not taken into account by the GNU gold ld,
dnl e.g. from binutils-gold 2.22-5 under Debian; see
dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660813
-saved_LD_RUN_PATH="$LD_RUN_PATH"
-LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path"
-export LD_RUN_PATH
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+if test -z "$enable_mini_gmp" ; then
+ saved_LD_RUN_PATH="$LD_RUN_PATH"
+ LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path"
+ export LD_RUN_PATH
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <string.h>
#include "gmp.h"
-]], [[
+ ]], [[
char buffer[100];
sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
__GNU_MP_VERSION_PATCHLEVEL);
printf ("(%s/%s) ", buffer, gmp_version);
+ fflush (stdout);
+ /* Also put information in config.log (stderr) */
+ fprintf (stderr, "gmp.h: %s / libgmp: %s\n", buffer, gmp_version);
if (strcmp (buffer, gmp_version) == 0)
return 0;
if (__GNU_MP_VERSION_PATCHLEVEL != 0)
return 1;
sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR);
return (strcmp (buffer, gmp_version) != 0) ? 1 : 0;
-]])],
+ ]])],
[AC_MSG_RESULT(yes)
MPFR_CHECK_GMP
MPFR_CHECK_DBL2INT_BUG
@@ -613,10 +727,11 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_WARN([Temporary LD_RUN_PATH was "$LD_RUN_PATH".])
AC_MSG_WARN([==========================================================])
],AC_MSG_RESULT([cannot test])
-)
-LD_RUN_PATH="$saved_LD_RUN_PATH"
+ )
+ LD_RUN_PATH="$saved_LD_RUN_PATH"
+fi
-dnl Warning! __gmpn_rootrem is an internal GMP symbol; thus its behavior
+dnl __gmpn_sbpi1_divappr_q is an internal GMP symbol; thus its behavior
dnl may change or this symbol may be removed in the future (without being
dnl handled by the library versioning system, which is even worse, as this
dnl can mean undetected incompatibilities in case of GMP library upgrade,
@@ -625,8 +740,15 @@ dnl WANT_GMP_INTERNALS is defined. Only the GMP public API should be used
dnl by default, in particular by binary distributions. Moreover the check
dnl below may yield an incorrect result as libtool isn't used in configure
dnl (see above).
-dnl Same for __gmpn_sbpi1_divappr_q.
-AC_CHECK_FUNCS([__gmpn_rootrem __gmpn_sbpi1_divappr_q])
+AC_CHECK_FUNCS([__gmpn_sbpi1_divappr_q])
+dnl same for other GMP internal functions
+AC_CHECK_FUNCS([__gmpn_invert_limb])
+AC_CHECK_FUNCS([__gmpn_rsblsh_n])
+
+MPFR_CHECK_MP_LIMB_T_VS_LONG
+
+dnl The getrusage function is needed for MPFR bench (cf tools/bench)
+AC_CHECK_FUNCS([getrusage])
dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR
dnl and polluate (and slow down because libtool has to parse them) the build.
@@ -658,7 +780,7 @@ if $EGREP -q -e '-dev$' $srcdir/VERSION; then
fi
dnl Output
-AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in])
+AC_CONFIG_FILES([Makefile mpfr.pc doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in tools/bench/Makefile])
AC_OUTPUT
dnl NEWS README AUTHORS Changelog