[tor-commits] [tor/master] Link to libevent_openssl statically when requested

nickm at torproject.org nickm at torproject.org
Fri May 6 13:54:26 UTC 2011


commit e36f9d1d9beec0daed57b68f936293dccc77b171
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Fri May 6 15:34:00 2011 +0200

    Link to libevent_openssl statically when requested
    
    When configure tor with --enable-bufferevents and
    --enable-static-libevent, libevent_openssl would still be linked
    dynamically. Fix this and refactor src/or/Makefile.am along the way.
---
 changes/bug3118      |    4 ++++
 configure.in         |    9 +++++++--
 src/or/Makefile.am   |    7 +------
 src/test/Makefile.am |    8 +-------
 4 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/changes/bug3118 b/changes/bug3118
new file mode 100644
index 0000000..c702981
--- /dev/null
+++ b/changes/bug3118
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Correctly link libevent_openssl when --enable-static-libevent
+      is passed to configure. Fixes bug 3118; bugfix on 0.2.3.1-alpha.
+
diff --git a/configure.in b/configure.in
index 58d32a1..26c933b 100644
--- a/configure.in
+++ b/configure.in
@@ -410,7 +410,6 @@ if test "$enable_static_libevent" = "yes"; then
 else
      TOR_LIBEVENT_LIBS="-levent"
 fi
-AC_SUBST(TOR_LIBEVENT_LIBS)
 
 dnl This isn't the best test for Libevent 2.0.3-alpha.  Once it's released,
 dnl we can do much better.
@@ -458,8 +457,14 @@ CPPFLAGS="$save_CPPFLAGS"
 
 AM_CONDITIONAL(USE_BUFFEREVENTS, test "$enable_bufferevents" = "yes")
 if test "$enable_bufferevents" = "yes"; then
-   AC_DEFINE(USE_BUFFEREVENTS, 1, [Defined if we're going to use Libevent's buffered IO API])
+  AC_DEFINE(USE_BUFFEREVENTS, 1, [Defined if we're going to use Libevent's buffered IO API])
+  if test "$enable_static_libevent" = "yes"; then
+    TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent_openssl.a $TOR_LIBEVENT_LIBS"
+  else
+    TOR_LIBEVENT_LIBS="-levent_openssl $TOR_LIBEVENT_LIBS"
+  fi
 fi
+AC_SUBST(TOR_LIBEVENT_LIBS)
 
 dnl ------------------------------------------------------
 dnl Where do you live, openssl?  And how do we call you?
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index f0d5a0f..a12d56b 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -69,17 +69,12 @@ AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
 # This seems to matter nowhere but on windows, but I assure you that it
 # matters a lot there, and is quite hard to debug if you forget to do it.
 
-if USE_BUFFEREVENTS
-levent_openssl_lib = -levent_openssl
-else
-levent_openssl_lib =
-endif
 
 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 \
 	@TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
-	@TOR_LIB_WS32@ @TOR_LIB_GDI@ $(levent_openssl_lib)
+	@TOR_LIB_WS32@ @TOR_LIB_GDI@
 
 noinst_HEADERS = \
 	buffers.h				\
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 174c1af..a4f93d1 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -22,18 +22,12 @@ test_SOURCES = \
 	test_util.c \
 	tinytest.c
 
-if USE_BUFFEREVENTS
-levent_openssl_lib = -levent_openssl
-else
-levent_openssl_lib =
-endif
-
 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 \
 	@TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
-	@TOR_LIB_WS32@ @TOR_LIB_GDI@ $(levent_openssl_lib)
+	@TOR_LIB_WS32@ @TOR_LIB_GDI@
 
 noinst_HEADERS = \
 	tinytest.h \



More information about the tor-commits mailing list