[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Add --enable-static-zlib option



Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Wed, 14 Apr 2010 16:48:05 +0200
Subject: Add --enable-static-zlib option
Commit: 71fb687ddd2d9c11dbacbc9e115b1c95620ae5bd

Works like the --enable-static-openssl/libevent options. Requires
--with-zlib-dir to be set. Note that other dependencies might still
pull in a dynamicly linked zlib, if you don't link them in statically
too.
---
 changes/static_zlib   |    4 ++++
 configure.in          |   15 +++++++++++++++
 src/or/Makefile.am    |    2 +-
 src/test/Makefile.am  |    2 +-
 src/tools/Makefile.am |    4 ++--
 5 files changed, 23 insertions(+), 4 deletions(-)
 create mode 100644 changes/static_zlib

diff --git a/changes/static_zlib b/changes/static_zlib
new file mode 100644
index 0000000..77a6131
--- /dev/null
+++ b/changes/static_zlib
@@ -0,0 +1,4 @@
+  o Minor features:
+    - Support for statically linking openssl/libevent was added earlier, now
+      also allow statically linking zlib by specifying --enable-static-zlib.
+      Enhancement requested by asdsa on #tor, see bug 1358.
diff --git a/configure.in b/configure.in
index d2868a2..91010ab 100644
--- a/configure.in
+++ b/configure.in
@@ -30,6 +30,8 @@ AC_ARG_ENABLE(static-openssl,
    AS_HELP_STRING(--enable-static-openssl, Link against a static openssl library. Requires --with-openssl-dir))
 AC_ARG_ENABLE(static-libevent,
    AS_HELP_STRING(--enable-static-libevent, Link against a static libevent library. Requires --with-libevent-dir))
+AC_ARG_ENABLE(static-zlib,
+   AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir))
 
 if test x$enable_buf_freelists != xno; then
   AC_DEFINE(ENABLE_BUF_FREELISTS, 1,
@@ -351,6 +353,19 @@ TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
     [zlibVersion(); exit(0);], [--with-zlib-dir],
     [/opt/zlib])
 
+if test "$enable_static_zlib" = "yes"; then
+   if test "$tor_cv_library_zlib_dir" = "(system)"; then
+     AC_MSG_ERROR("You must specify an explicit --with-zlib-dir=x option when
+ using --enable-static-zlib")
+   else
+     TOR_ZLIB_LIBS="$TOR_LIBDIR_zlib/libz.a"
+     echo "$TOR_LIBDIR_zlib/libz.a"
+   fi
+else
+     TOR_ZLIB_LIBS="-lz"
+fi
+AC_SUBST(TOR_ZLIB_LIBS)
+
 dnl Make sure to enable support for large off_t if available.
 
 AC_SYS_LARGEFILE
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index cfa8a03..a354db5 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -43,7 +43,7 @@ AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
 tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
 tor_LDADD = ./libtor.a ../common/libor.a ../common/libor-crypto.a \
 	../common/libor-event.a \
-	-lz -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
+	@TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
 
 noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i
 
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 7df13da..546fa2f 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -25,6 +25,6 @@ test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
 test_LDADD = ../or/libtor.a ../common/libor.a ../common/libor-crypto.a \
 	../common/libor-event.a \
-	-lz -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
+	@TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
 
 noinst_HEADERS = tinytest.h tinytest_macros.h test.h
diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
index be03f8d..1bb5076 100644
--- a/src/tools/Makefile.am
+++ b/src/tools/Makefile.am
@@ -9,10 +9,10 @@ tor_gencert_SOURCES = tor-gencert.c
 tor_gencert_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
 tor_gencert_LDADD = ../common/libor.a ../common/libor-crypto.a \
-        -lm -lz @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
+        -lm @TOR_ZLIB_LIBS@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
 
 tor_checkkey_SOURCES = tor-checkkey.c
 tor_checkkey_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
 tor_checkkey_LDADD = ../common/libor.a ../common/libor-crypto.a \
-        -lm -lz @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
+        -lm @TOR_ZLIB_LIBS@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
-- 
1.6.5