summaryrefslogtreecommitdiff
path: root/src/emacs-module.c
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2019-04-24 19:35:36 +0200
committerPhilipp Stephani <phst@google.com>2019-04-24 23:27:43 +0200
commit4eb7f9ef595c10df1ea78518b2f0410a0e79ec70 (patch)
treeb5721d7166a2b7d7285879bcb06b3a122182f6ff /src/emacs-module.c
parent553220fca670ec13180e0763bc9338fbf8ed4b30 (diff)
downloademacs-4eb7f9ef595c10df1ea78518b2f0410a0e79ec70.tar.gz
Unbreak build when building without GMP support.
Add support for a new preprocessor macro EMACS_MODULE_HAVE_MPZ_T to emacs-module.h. If this macro is defined, assume that mpz_t is already defined and don’t include gmp.h. Don’t document the new macro for now, as it’s unclear whether we want to support this in modules outside the Emacs tree. * src/emacs-module.h.in: Allow user to prevent inclusion of gmp.h. * src/emacs-module.c: Use mini-gmp if GMP is unavailable. Don’t include gmp.h. * src/lisp.h: Don’t require gmp.h. It’s not needed for lisp.h. * test/Makefile.in (GMP_LIB, GMP_OBJ): New variables. ($(test_module)): Use them. * test/data/emacs-module/mod-test.c: Use mini-gmp if GMP is unavailable.
Diffstat (limited to 'src/emacs-module.c')
-rw-r--r--src/emacs-module.c7
1 files changed, 5 insertions, 2 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"