summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-14 12:41:20 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-14 12:41:20 +0000
commita4b981eea416fb8feb22a82aaade3fca8d26d717 (patch)
tree148d4f75af06be20be5889d07a494aa7400264b6
parentbdcfea39f2467be9eb43bbb034623ac1fab8e260 (diff)
parent6e1f5be8f399e811d1bdf5fd28be112717ab88d4 (diff)
downloadmpfr-a4b981eea416fb8feb22a82aaade3fca8d26d717.tar.gz
Started to implement --with-mini-gmp (building mini-gmp and linking
not correctly handled yet, thus "make check" failure is expected). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/with-mini-gmp@13192 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--configure.ac29
-rw-r--r--src/mpfr-impl.h4
-rw-r--r--src/mpfr.h4
3 files changed, 34 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 1af04b5d4..da0b494ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,6 +121,24 @@ AC_ARG_WITH(gmp_build,
fi
])
+AC_ARG_WITH(mini_gmp,
+ [ --with-mini-gmp=DIR use mini-gmp (sources in DIR) instead of GMP],
+ [
+ MPFR_PARSE_DIRECTORY(["$withval"],[withval])
+ if test -z "$gmp_lib_path" && test -z "$with_gmp_include" && \
+ test -z "$use_gmp_build"; then
+ if test -f "$withval/mini-gmp.c" && test -f "$withval/mini-gmp.h"; then
+ AC_DEFINE([MPFR_USE_MINI_GMP],1,[Use mini-gmp])
+ CPPFLAGS="$CPPFLAGS -I$withval"
+ use_mini_gmp=yes
+ else
+ AC_MSG_FAILURE([mini-gmp.{c,h} not found in $withval])
+ fi
+ else
+ AC_MSG_FAILURE([Do not use --with-mini-gmp and other --with-gmp options simultaneously.])
+ fi
+ ])
+
AC_ARG_WITH(mulhigh_size,
[ --with-mulhigh-size=NUM internal threshold table for mulhigh],
AC_DEFINE_UNQUOTED([MPFR_MULHIGH_SIZE],$withval, [Mulhigh size]))
@@ -218,7 +236,7 @@ dnl AM_PROG_AR must be put after the following code.
dnl We do not do this check if mini-gmp is used. Note that the status of
dnl --enable-mini-gmp is already available even though this option will
-dnl be handled later (at this time, --with-mini-gmp is not handled yet).
+dnl be handled later.
if test -z "$user_redefine_cc" && \
test "$cross_compiling" != yes && \
@@ -368,13 +386,13 @@ AC_ARG_ENABLE(float128,
test_libgmp=__gmpz_init
-dnl Removed this option?
+dnl Remove this option?
dnl This option assumes that mini-gmp has already been built (like if
dnl it were a real GMP) and that the corresponding gmp.h is the one of
dnl mini-gmp. Thus the --enable-mini-gmp is misused, because the fact
dnl that mini-gmp is enabled or not is what the gmp.h file contains.
dnl Said otherwise, this should have just been an autodetection.
-dnl Note: A future --with-mini-gmp option may make this one obsolete.
+dnl Note: The --with-mini-gmp option may make this one obsolete.
AC_ARG_ENABLE(mini-gmp,
[ --enable-mini-gmp build MPFR with mini-gmp (experimental) [[default=no]]],
[ case $enableval in
@@ -619,6 +637,8 @@ dnl
dnl Setup GMP detection (continued)
dnl
+if test "$use_mini_gmp" != yes ; then
+
dnl Check minimal GMP version
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.
@@ -777,6 +797,9 @@ AC_CHECK_FUNCS([__gmpn_rsblsh1_n])
MPFR_CHECK_MP_LIMB_T_VS_LONG
MPFR_CHECK_MP_LIMB_T_VS_INTMAX
+dnl End of the GMP checks (no mini-gmp)
+fi
+
dnl The getrusage function is needed for MPFR bench (cf tools/bench)
AC_CHECK_FUNCS([getrusage])
diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h
index a6493848a..1237198dc 100644
--- a/src/mpfr-impl.h
+++ b/src/mpfr-impl.h
@@ -88,7 +88,11 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#endif
#include "mpfr-thread.h"
+#ifndef MPFR_USE_MINI_GMP
#include "gmp.h"
+#else
+#include "mini-gmp.h"
+#endif
/* With the current code, MPFR_LONG_WITHIN_LIMB must be defined if an
unsigned long fits in a limb. Since one cannot rely on the configure
diff --git a/src/mpfr.h b/src/mpfr.h
index 95762297d..f960b5763 100644
--- a/src/mpfr.h
+++ b/src/mpfr.h
@@ -49,7 +49,11 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_VERSION \
MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL)
+#ifndef MPFR_USE_MINI_GMP
#include <gmp.h>
+#else
+#include <mini-gmp.h>
+#endif
/* Avoid some problems with macro expansion if the user defines macros
with the same name as keywords. By convention, identifiers and macro