[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: don't presume availability of gmp
From: |
Mike Gran |
Subject: |
[Guile-commits] branch master updated: don't presume availability of gmp.pc |
Date: |
Wed, 03 Mar 2021 19:56:34 -0500 |
This is an automated email from the git hooks/post-receive script.
mike121 pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new 6ca3ab6 don't presume availability of gmp.pc
6ca3ab6 is described below
commit 6ca3ab621cd9e5054a47b5946dacd98df756a879
Author: Michael Gran <spk121@yahoo.com>
AuthorDate: Wed Mar 3 10:54:04 2021 -0800
don't presume availability of gmp.pc
This suggests moving the conditional that determines if mini-gmp is used
into scmconfig.h.
* configure.ac: replace PKG_CHECK_MODULES for gmp with AC_LIB_HAVE_LINKFLAGS
Remove ENABLE_MINI_GMP define. Also don't run mpz_inits test for
--enable-mini-gmp.
* libguile/gen-scmconfig.c (main) [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
with SCM_I_GSC_ENABLE_MINI_GMP
* libguile/bytevectors.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
with SCM_ENABLE_MINI_GMP
* libguile/init.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
with SCM_ENABLE_MINI_GMP
* libguile/numbers.c: include scm.h
[SCM_ENABLE_MINI_GMP]: provide mpz_inits and mpz_clears
[ENABLE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP to ENABLE_MINI_GMP
* libguile/numbers.h: include scm.h
* libguile/random.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
with SCM_ENABLE_MINI_GMP
* libguile/socket.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
with SCM_ENABLE_MINI_GMP
---
configure.ac | 25 +++++++++----------------
libguile/bytevectors.c | 4 +++-
libguile/gen-scmconfig.c | 2 +-
libguile/init.c | 4 +++-
libguile/numbers.c | 7 ++++---
libguile/numbers.h | 9 +++++----
libguile/random.c | 12 +++++++-----
libguile/socket.c | 3 ++-
8 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/configure.ac b/configure.ac
index 559f0ed..a3cdaff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -647,33 +647,26 @@ AC_CACHE_SAVE
dnl GMP tests
-PKG_CHECK_MODULES([GMP],[gmp],
- [],
- [$enable_mini_gmp=yes])
-
SCM_I_GSC_ENABLE_MINI_GMP=0
AC_ARG_ENABLE(mini-gmp,
[AS_HELP_STRING([--enable-mini-gmp],
[use mini-gmp instead of the full GMP library])])
-if test "$enable_mini_gmp" = yes || test "$enable_mini_gmp" = y; then
+if test "x$enable_mini_gmp" = xyes || test "x$enable_mini_gmp" = xy; then
SCM_I_GSC_ENABLE_MINI_GMP=1
- AC_DEFINE([ENABLE_MINI_GMP], 1,
- [Define this if you want to use mini-gmp.])
else
- LIBS="$GMP_LIBS $LIBS"
- CFLAGS="$GMP_CFLAGS $CFLAGS"
+ AC_LIB_HAVE_LINKFLAGS([gmp],[],[#include <gmp.h>], [mpz_import
(0,0,0,0,0,0,0);])
+ if test "x$HAVE_LIBGMP" != "xyes"; then
+ AC_MSG_ERROR([GNU MP 4.1 or greater not found])
+ fi
+ if test "x$LIBGMP_PREFIX" != "x"; then
+ CPPFLAGS="-I$LIBGMP_PREFIX $CPPFLAGS"
+ fi
+ AC_CHECK_DECLS([mpz_inits], [], [], [[#include <gmp.h>]])
fi
AC_SUBST([SCM_I_GSC_ENABLE_MINI_GMP])
AM_CONDITIONAL([USE_MINI_GMP], [test "x$enable_mini_gmp" = "xyes"])
-AC_CHECK_DECLS([mpz_inits], [], [],
- [[#if ENABLE_MINI_GMP
- #include "libguile/mini-gmp.h"
- #else
- #include <gmp.h>
- #endif]])
-
dnl GNU libunistring is checked for by Gnulib's `libunistring' module.
if test "x$LTLIBUNISTRING" = "x"; then
AC_MSG_ERROR([GNU libunistring is required, please install it.])
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 2671eee..2d6cbdb 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -35,7 +35,9 @@
#include <alloca.h>
#include <assert.h>
-#if ENABLE_MINI_GMP
+#include "scm.h"
+
+#if SCM_ENABLE_MINI_GMP
#include "mini-gmp.h"
#else
#include <gmp.h>
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 667789e..44b401f 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -379,7 +379,7 @@ main (int argc, char *argv[])
pf ("\n");
pf ("/* Define to 1 to use mini GMP. */\n");
-#ifdef ENABLE_MINI_GMP
+#if SCM_I_GSC_ENABLE_MINI_GMP == 1
pf ("#define SCM_ENABLE_MINI_GMP 1\n");
#else
pf ("#undef SCM_ENABLE_MINI_GMP\n");
diff --git a/libguile/init.c b/libguile/init.c
index 68077d1..beffc2c 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -31,7 +31,9 @@
#include <sys/stat.h>
#include <unistd.h>
-#if ENABLE_MINI_GMP
+#include "scm.h"
+
+#if SCM_ENABLE_MINI_GMP
#include "mini-gmp.h"
#else
#include <gmp.h>
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 670c9ec..107a05a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -110,9 +110,10 @@ verify (SCM_MOST_POSITIVE_FIXNUM <= (mp_limb_t) -1);
(SCM_I_FIXNUM_BIT-1 <= DBL_MANT_DIG \
|| ((n) ^ ((n) >> (SCM_I_FIXNUM_BIT-1))) < (1L << DBL_MANT_DIG))
-#if ! HAVE_DECL_MPZ_INITS
+#if (! HAVE_DECL_MPZ_INITS) || SCM_ENABLE_MINI_GMP
-/* GMP < 5.0.0 lacks `mpz_inits' and `mpz_clears'. Provide them. */
+/* GMP < 5.0.0 and mini-gmp lack `mpz_inits' and `mpz_clears'. Provide
+ them. */
#define VARARG_MPZ_ITERATOR(func) \
static void \
@@ -399,7 +400,7 @@ scm_i_big2dbl_2exp (SCM b, long *expon_p)
{
long expon;
double signif;
-#if ENABLE_MINI_GMP
+#if SCM_ENABLE_MINI_GMP
int iexpon;
signif = mpz_get_d (SCM_I_BIG_MPZ (b));
signif = frexp (signif, &iexpon);
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 58010cd..7fe8071 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -22,16 +22,17 @@
-#include "libguile/scmconfig.h"
-#include "libguile/error.h"
-#include "libguile/gc.h"
-#include "libguile/print.h"
+#include "libguile/scm.h"
#if SCM_ENABLE_MINI_GMP
#include "libguile/mini-gmp.h"
#else
#include <gmp.h>
#endif
+#include "libguile/error.h"
+#include "libguile/gc.h"
+#include "libguile/print.h"
+
/* Immediate Numbers, also known as fixnums
diff --git a/libguile/random.c b/libguile/random.c
index b955c2c..63da7f5 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -30,17 +30,19 @@
#include <sys/types.h>
#include <unistd.h>
+#include "scm.h"
+#if SCM_ENABLE_MINI_GMP
+#include "mini-gmp.h"
+#else
+#include <gmp.h>
+#endif
+
#include "arrays.h"
#include "feature.h"
#include "generalized-arrays.h"
#include "generalized-vectors.h"
#include "gsubr.h"
#include "list.h"
-#if ENABLE_MINI_GMP
-#include "mini-gmp.h"
-#else
-#include <gmp.h>
-#endif
#include "modules.h"
#include "numbers.h"
#include "numbers.h"
diff --git a/libguile/socket.c b/libguile/socket.c
index 1bd56a0..f463ec9 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -44,7 +44,8 @@
#include <netdb.h>
#include <arpa/inet.h>
-#if ENABLE_MINI_GMP
+#include "scm.h"
+#if SCM_ENABLE_MINI_GMP
#include "mini-gmp.h"
#else
#include <gmp.h>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch master updated: don't presume availability of gmp.pc,
Mike Gran <=