diff options
-rw-r--r-- | src/emacs-module.c | 7 | ||||
-rw-r--r-- | src/emacs-module.h.in | 2 | ||||
-rw-r--r-- | test/Makefile.in | 3 | ||||
-rw-r--r-- | test/data/emacs-module/mod-test.c | 9 |
4 files changed, 15 insertions, 6 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index b6a12386267..0b7b3d6ffbe 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -70,6 +70,11 @@ To add a new module function, proceed as follows: #include <config.h> +#ifndef HAVE_GMP +#include "mini-gmp.h" +#define EMACS_MODULE_HAVE_MPZ_T +#endif + #define EMACS_MODULE_GMP #include "emacs-module.h" @@ -80,8 +85,6 @@ To add a new module function, proceed as follows: #include <stdlib.h> #include <time.h> -#include <gmp.h> - #include "lisp.h" #include "bignum.h" #include "dynlib.h" diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in index e61aadfc3ac..fbc62a61ef4 100644 --- a/src/emacs-module.h.in +++ b/src/emacs-module.h.in @@ -28,7 +28,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <stdbool.h> #endif -#ifdef EMACS_MODULE_GMP +#if defined EMACS_MODULE_GMP && !defined EMACS_MODULE_HAVE_MPZ_T #include <gmp.h> #endif diff --git a/test/Makefile.in b/test/Makefile.in index 2282ccd951c..ec20a427ba5 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -257,6 +257,7 @@ endif HYBRID_MALLOC = @HYBRID_MALLOC@ LIBEGNU_ARCHIVE = ../lib/lib$(if $(HYBRID_MALLOC),e)gnu.a GMP_LIB = @GMP_LIB@ +GMP_OBJ = $(if @GMP_OBJ@, ../src/@GMP_OBJ@) # Note: emacs-module.h is generated from emacs-module.h.in, hence we # look in ../src, not $(srcdir)/../src. @@ -269,7 +270,7 @@ src/emacs-module-tests.log: $(test_module) $(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h $(LIBEGNU_ARCHIVE) $(AM_V_at)${MKDIR_P} $(dir $@) $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ - -o $@ $< $(LIBEGNU_ARCHIVE) $(GMP_LIB) + -o $@ $< $(LIBEGNU_ARCHIVE) $(GMP_LIB) $(GMP_OBJ) endif ## Check that there is no 'automated' subdirectory, which would diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index 8ac08f71534..b7007bd80ff 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -27,11 +27,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <string.h> #include <time.h> +#ifdef HAVE_GMP +#include <gmp.h> +#else +#include "mini-gmp.h" +#define EMACS_MODULE_HAVE_MPZ_T +#endif + #define EMACS_MODULE_GMP #include <emacs-module.h> -#include <gmp.h> - #include "timespec.h" int plugin_is_GPL_compatible; |