]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add --enable-static-(openssl|libevent) options
authorNick Mathewson <nickm@torproject.org>
Sun, 24 Jan 2010 19:34:47 +0000 (14:34 -0500)
committerNick Mathewson <nickm@torproject.org>
Sun, 24 Jan 2010 19:34:47 +0000 (14:34 -0500)
These options only work when using --with-(openssl|libevent)-dir to
explicitly pick a libevent or openssl location.

acinclude.m4
configure.in
src/or/Makefile.am
src/tools/Makefile.am

index 47d421c260b060abbfb62ee601c97b503d63e866..76e992572c7b0b5aea17bb33ee442a4b33de8448 100644 (file)
@@ -27,8 +27,10 @@ AC_DEFUN([TOR_DEFINE_CODEPATH],
   else
    if test -d "$1/lib"; then
      TOR_LDFLAGS_$2="-L$1/lib"
+     TOR_LIBDIR_$2="$1/lib"
    else
      TOR_LDFLAGS_$2="-L$1"
+     TOR_LIBDIR_$2="$1"
    fi
    if test -d "$1/include"; then
      TOR_CPPFLAGS_$2="-I$1/include"
index 7e2dd034ed954a35b9cecb4468e7e821c378636a..92dc45fd68acb7763043df37d25c35cdcc0eebae 100644 (file)
@@ -42,6 +42,10 @@ AC_ARG_ENABLE(openbsd-malloc,
    AS_HELP_STRING(--enable-openbsd-malloc, Use malloc code from openbsd.  Linux only))
 AC_ARG_ENABLE(instrument-downloads,
    AS_HELP_STRING(--enable-instrument-downloads, Instrument downloads of directory resources etc.))
+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))
 
 if test x$enable_buf_freelists != xno; then
   AC_DEFINE(ENABLE_BUF_FREELISTS, 1,
@@ -281,6 +285,17 @@ LIBS="$save_LIBS"
 LDFLAGS="$save_LDFLAGS"
 CPPFLAGS="$save_CPPFLAGS"
 
+if test "$enable_static_libevent" = "yes"; then
+   if test "$tor_cv_library_libevent_dir" = "(system)"; then
+     AC_MSG_ERROR("You must specify an explicit --with-libevent-dir=x option when using --enable-static-libevent")
+   else
+     TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent.a"
+   fi
+else
+     TOR_LIBEVENT_LIBS="-levent"
+fi
+AC_SUBST(TOR_LIBEVENT_LIBS)
+
 dnl ------------------------------------------------------
 dnl Where do you live, openssl?  And how do we call you?
 
@@ -306,6 +321,19 @@ TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI],
 
 dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
 
+echo "tor_cv_library_openssl_dir is $tor_cv_library_openssl_dir"
+if test "$enable_static_openssl" = "yes"; then
+   if test "$tor_cv_library_openssl_dir" = "(system)"; then
+     AC_MSG_ERROR("You must specify an explicit --with-openssl-dir=x option when using --enable-static-openssl")
+   else
+     TOR_OPENSSL_LIBS="$TOR_LIBDIR_openssl/libcrypto.a $TOR_LIBDIR_openssl/libssl.a"
+   fi
+else
+     TOR_OPENSSL_LIBS="-lcrypto -lssl"
+fi
+echo "TOR_OPENSSL_LIBS=$TOR_OPENSSL_LIBS"
+AC_SUBST(TOR_OPENSSL_LIBS)
+
 dnl ------------------------------------------------------
 dnl Where do you live, zlib?  And how do we call you?
 
index 28d7e736dcd4380e4302a84f44457e927c40d951..ad2476ff15d7a78caaeaef7a88d8a6cddc4dc1b0 100644 (file)
@@ -33,7 +33,7 @@ AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
 
 tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
 tor_LDADD = ../common/libor.a ../common/libor-crypto.a \
-  -lz -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@
+  -lz @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
 test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
        circuituse.c command.c config.c \
        connection.c connection_edge.c connection_or.c control.c \
@@ -48,7 +48,7 @@ test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
 test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
 test_LDADD = ../common/libor.a ../common/libor-crypto.a \
-        -lz -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@
+        -lz @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
 
 noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i
 
index 79393d685447b60da1c7724b3f939c7a19ab60f9..41786e4378693e2245d36e4450e25d78c958cd78 100644 (file)
@@ -3,16 +3,16 @@ noinst_PROGRAMS =  tor-checkkey
 
 tor_resolve_SOURCES = tor-resolve.c
 tor_resolve_LDFLAGS = @TOR_LDFLAGS_libevent@
-tor_resolve_LDADD = ../common/libor.a -levent @TOR_LIB_WS32@
+tor_resolve_LDADD = ../common/libor.a  @TOR_LIBEVENT_LIBS@ @TOR_LIB_WS32@
 
 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 \
-        -lz -lcrypto -levent @TOR_LIB_WS32@ @TOR_LIB_GDI@
+        -lz  @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 \
-        -lz -lcrypto -levent @TOR_LIB_WS32@ @TOR_LIB_GDI@
+        -lz  @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@