[gnutls-devel] [PATCH] build: explicit linkage with gmp library
Alon Bar-Lev
alon.barlev at gmail.com
Sun Jun 2 14:45:06 CEST 2013
gnutls uses gmp library explicitly so it needs to explicit link against
it so that all symbols may be resolved.
Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
lib/nettle/Makefile.am | 3 ++-
m4/hooks.m4 | 12 +++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/nettle/Makefile.am b/lib/nettle/Makefile.am
index e2b704e..56d180a 100644
--- a/lib/nettle/Makefile.am
+++ b/lib/nettle/Makefile.am
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
-AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS)
+AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS) $(GMP_CFLAGS)
AM_CPPFLAGS = \
-I$(srcdir)/../../gl \
-I$(builddir)/../../gl \
@@ -35,3 +35,4 @@ noinst_LTLIBRARIES = libcrypto.la
libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c rnd.c init.c egd.c egd.h \
gnettle.h
+libcrypto_la_LIBADD = $(GMP_LIBS)
diff --git a/m4/hooks.m4 b/m4/hooks.m4
index 3439edb..84a3afc 100644
--- a/m4/hooks.m4
+++ b/m4/hooks.m4
@@ -77,10 +77,20 @@ AC_MSG_ERROR([[
*** Libhogweed (nettle's companion library) was not found. Note that you must compile nettle with gmp support.
]])
])
+ AC_ARG_VAR(GMP_CFLAGS, [C compiler flags for gmp])
+ AC_ARG_VAR(GMP_LIBS, [linker flags for gmp])
+ if test x$GMP_LIBS = x; then
+ AC_CHECK_LIB(gmp, __gmpz_cmp, [GMP_LIBS="-lgmp"], [AC_MSG_ERROR([[
+***
+*** gmp was not found. while nettle was.
+]])])
+ fi
+ AC_SUBST(GMP_CFLAGS)
+ AC_SUBST(GMP_LIBS)
AM_CONDITIONAL(ENABLE_NETTLE, test "$cryptolib" = "nettle")
AC_DEFINE([HAVE_LIBNETTLE], 1, [nettle is enabled])
- GNUTLS_REQUIRES_PRIVATE="Requires.private: nettle, hogweed"
+ GNUTLS_REQUIRES_PRIVATE="Requires.private: nettle, hogweed, gmp"
AC_ARG_WITH(included-libtasn1,
AS_HELP_STRING([--with-included-libtasn1], [use the included libtasn1]),
--
1.8.1.5
More information about the Gnutls-devel
mailing list