[Dnsmasq-discuss] [PATCH] Add support for libnettle with mini-gmp

Andre Heider a.heider at gmail.com
Sat Jun 14 20:53:25 UTC 2014


libnettle can be compiled with --enable-mini-gmp which does not require
an external libgmp.

To support both variants, fix one header which works everywhere and stop
linking against libgmp if HAVE_NETTLE_MINI is in COPTS.
---

Hi,

OpenWRT supports mini-gmp via CONFIG_LIBNETTLE_MINI, and I ran into a compile
error on this setup.

This patch fixes the issue, please consider applying.

Thanks,
Andre


 Makefile     | 2 +-
 src/dnssec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index c58b50b..b1ab7e7 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ lua_cflags =    `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CON
 lua_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1` 
 nettle_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --cflags nettle hogweed`
 nettle_libs =   `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --libs nettle hogweed`
-gmp_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --copy -lgmp`
+gmp_libs =      `echo $(COPTS) | grep HAVE_NETTLE_MINI >/dev/null 2>&1 || echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --copy -lgmp`
 sunos_libs =    `if uname | grep SunOS >/dev/null 2>&1; then echo -lsocket -lnsl -lposix4; fi`
 version =     -DVERSION='\"`$(top)/bld/get-version $(top)`\"'
 
diff --git a/src/dnssec.c b/src/dnssec.c
index 44d626b..446a99d 100644
--- a/src/dnssec.c
+++ b/src/dnssec.c
@@ -26,7 +26,7 @@
 #  include <nettle/ecc-curve.h>
 #endif
 #include <nettle/nettle-meta.h>
-#include <gmp.h>
+#include <nettle/bignum.h>
 
 #define SERIAL_UNDEF  -100
 #define SERIAL_EQ        0
-- 
2.0.0




More information about the Dnsmasq-discuss mailing list