From 62e9ff1328fdffd4e0e40b1c039668f79aece64f Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Sun, 9 Jun 2013 04:46:52 +0000 Subject: Add --with-zlib=[DIR] configure option. --- configure.ac | 40 ++++++++++++++++++++++++++++++++-------- src/core/Makefile.am | 2 +- src/datastore/Makefile.am | 2 +- src/dht/Makefile.am | 4 ---- src/testbed/Makefile.am | 6 +++--- src/util/Makefile.am | 2 +- 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 178fdf94a..52bc8967d 100644 --- a/configure.ac +++ b/configure.ac @@ -568,14 +568,38 @@ AM_CONDITIONAL(HAVE_POSTGRES, test x$postgres = xtrue) AC_SUBST(POSTGRES_CPPFLAGS) AC_SUBST(POSTGRES_LDFLAGS) -# test for libz (maybe required for linking mysql) -zlib=1 -AC_CHECK_LIB(z, compress,,zlib=0) -AM_CONDITIONAL(HAVE_ZLIB, test x$zlib = x1) -if test "$zlib" != 1 -then - AC_MSG_ERROR([GNUnet requires zlib]) -fi +# test for zlib +SAVE_LDFLAGS=$LDFLAGS +SAVE_CPPFLAGS=$CPPFLAGS +AC_ARG_WITH(zlib, + [ --with-zlib[[=DIR]] use libz in DIR], + [AS_IF([test "$withval" = "no"], + [AC_MSG_ERROR([GNUnet requires zlib])], + [test "$withval" != "yes"], + [ + Z_DIR=$withval + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + ]) + ]) +AC_CHECK_HEADER(zlib.h, + [], + [AC_MSG_ERROR([GNUnet requires zlib])]) +AC_CHECK_LIB(z, compress2, + [ + AC_DEFINE([HAVE_ZLIB], [], [Have compression library]) + if test "x${Z_DIR}" != "x"; then + Z_CFLAGS="-I${Z_DIR}/include" + Z_LIBS="-L${Z_DIR}/lib -lz" + else + Z_LIBS="-lz" + fi], + [AC_MSG_ERROR([GNUnet requires zlib])]) +AC_SUBST(Z_CFLAGS) +AC_SUBST(Z_LIBS) + +LDFLAGS=$SAVE_LDFLAGS +CPPFLAGS=$SAVE_CPPFLAGS # mysql & windows AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include ]) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index a3ef13f5a..7e4cd7f54 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -49,7 +49,7 @@ gnunet_service_core_LDADD = \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/transport/libgnunettransport.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(GN_LIBINTL) -lz + $(GN_LIBINTL) $(Z_LIBS) gnunet_core_SOURCES = \ diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am index c2acc2ffe..ef14175b2 100644 --- a/src/datastore/Makefile.am +++ b/src/datastore/Makefile.am @@ -124,7 +124,7 @@ libgnunet_plugin_datastore_mysql_la_SOURCES = \ libgnunet_plugin_datastore_mysql_la_LIBADD = \ $(top_builddir)/src/mysql/libgnunetmysql.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lz -lmysqlclient + $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) $(Z_LIBS) -lmysqlclient libgnunet_plugin_datastore_mysql_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) $(MYSQL_LDFLAGS) -lmysqlclient libgnunet_plugin_datastore_mysql_la_CPPFLAGS = \ diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am index 6bbc19188..305931728 100644 --- a/src/dht/Makefile.am +++ b/src/dht/Makefile.am @@ -12,10 +12,6 @@ libexecdir= $(pkglibdir)/libexec/ pkgcfg_DATA = \ dht.conf -if HAVE_ZLIB - ZLIB_LNK = -lz -endif - if USE_COVERAGE AM_CFLAGS = --coverage -O0 XLIB = -lgcov diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index 902d8391b..eb6d050ad 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -48,7 +48,7 @@ gnunet_service_testbed_LDADD = $(XLIB) \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(top_builddir)/src/arm/libgnunetarm.la \ - $(LTLIBINTL) -lz + $(LTLIBINTL) $(Z_LIBS) gnunet_service_testbed_DEPENDENCIES = \ libgnunettestbed.la @@ -71,7 +71,7 @@ gnunet_helper_testbed_LDADD = $(XLIB) \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ libgnunettestbed.la \ - $(LTLIBINTL) -lz + $(LTLIBINTL) $(Z_LIBS) gnunet_helper_testbed_DEPENDENCIES = \ gnunet-service-testbed.$(OBJEXT) \ libgnunettestbed.la @@ -268,7 +268,7 @@ test_gnunet_helper_testbed_SOURCES = \ test_gnunet_helper_testbed_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ libgnunettestbed.la \ - -lz + $(Z_LIBZ) test_testbed_api_testbed_run_topologyrandom_SOURCES = \ test_testbed_api_testbed_run.c diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 491006a42..06cd283c8 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -116,7 +116,7 @@ libgnunetutil_la_LIBADD = \ $(LIBGCRYPT_LIBS) \ $(LTLIBICONV) \ $(LTLIBINTL) \ - -lltdl -lz -lunistring $(XLIB) + -lltdl $(Z_LIBS) -lunistring $(XLIB) libgnunetutil_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ -- cgit v1.2.3