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

[or-cvs] r10072: Minimize the libraries that we link things against: there is (in tor/trunk: . src/or)



Author: nickm
Date: 2007-04-30 16:50:09 -0400 (Mon, 30 Apr 2007)
New Revision: 10072

Modified:
   tor/trunk/
   tor/trunk/acinclude.m4
   tor/trunk/src/or/Makefile.am
Log:
 r12591@catbus:  nickm | 2007-04-30 16:50:03 -0400
 Minimize the libraries that we link things against: there is no reason to link tor-resolve against zlib, openssl, or libevent, for example.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12591] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/acinclude.m4
===================================================================
--- tor/trunk/acinclude.m4	2007-04-30 19:48:45 UTC (rev 10071)
+++ tor/trunk/acinclude.m4	2007-04-30 20:50:09 UTC (rev 10072)
@@ -18,6 +18,27 @@
   fi
 ])
 
+AC_DEFUN([TOR_DEFINE_CODEPATH],
+[
+  if test x$1 = "x(system)"; then
+    TOR_LDFLAGS_$2=""
+    TOR_CPPFLAGS_$2=""
+  else
+   if test -d "$1/lib"; then
+     TOR_LDFLAGS_$2="-L$1/lib"
+   else
+     TOR_LDFLAGS_$2="-L$1"
+   fi
+   if test -d "$1/include"; then
+     TOR_CPPFLAGS_$2="-I$1/include"
+   else
+     TOR_CPPFLAGS_$2="-I$1"
+   fi
+  fi
+  AC_SUBST(TOR_CPPFLAGS_$2)
+  AC_SUBST(TOR_LDFLAGS_$2)
+])
+
 dnl 1:libname
 AC_DEFUN([TOR_WARN_MISSING_LIB], [
 h=""
@@ -118,6 +139,8 @@
    TOR_EXTEND_CODEPATH($tor_cv_library_$1_dir)
 fi
 
+TOR_DEFINE_CODEPATH($tor_cv_library_$1_dir , $1)
+
 if test -z "$CROSS_COMPILE"; then
   AC_CACHE_CHECK([whether we need extra options to link $1],
                  tor_cv_library_$1_linker_option, [
@@ -151,9 +174,13 @@
   ]) dnl end cache check check for extra options.
 
   if test "$tor_cv_library_$1_linker_option" != "(none)" ; then
-   LDFLAGS="$tor_cv_library_$1_linker_option $LDFLAGS"
+    TOR_LDFLAGS_$1="$tor_cv_library_$1_linker_option"
   fi
 fi # cross-compile
 
+LIBS="$tor_saved_LIBS"
+LDFLAGS="$tor_saved_LDFLAGS"
+CPPFLAGS="$TOR_CPPFLAGS_$1 $tor_saved_CPPFLAGS"
+
 ]) dnl end defun
 

Modified: tor/trunk/src/or/Makefile.am
===================================================================
--- tor/trunk/src/or/Makefile.am	2007-04-30 19:48:45 UTC (rev 10071)
+++ tor/trunk/src/or/Makefile.am	2007-04-30 20:50:09 UTC (rev 10072)
@@ -13,6 +13,9 @@
 	eventdns.c \
 	tor_main.c
 
+tor_LIBS = -lz -levent -lssl -lcrypto
+tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@ \
+        -lz -levent -lssl -lcrypto
 tor_LDADD = ../common/libor.a ../common/libor-crypto.a
 
 test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
@@ -24,6 +27,8 @@
 	eventdns.c \
 	test.c
 
+test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
+        @TOR_LDFLAGS_libevent@ -lz -levent -lssl -lcrypto
 test_LDADD = ../common/libor.a ../common/libor-crypto.a
 
 noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i