[or-cvs] Another configure.in fix. We copied some idiocy from our e...

Nick Mathewson nickm at seul.org
Mon Mar 13 05:42:21 UTC 2006


Update of /home/or/cvsroot/tor
In directory moria:/tmp/cvs-serv29735

Modified Files:
	configure.in 
Log Message:
Another configure.in fix.  We copied some idiocy from our example "look for openssl" code where we skipped checking for the presence of header files when deciding whether we needed a -L or -I option.  This broke the case where openssl/libevent was in our default linker search path, but not our default cpp search path.  Thanks go to cat-"pathological case"-xeger and her Solaris box.

Index: configure.in
===================================================================
RCS file: /home/or/cvsroot/tor/configure.in,v
retrieving revision 1.269
retrieving revision 1.270
diff -u -p -d -r1.269 -r1.270
--- configure.in	13 Mar 2006 04:58:46 -0000	1.269
+++ configure.in	13 Mar 2006 05:42:19 -0000	1.270
@@ -109,6 +109,7 @@ dnl Where do you live, libevent?  And ho
 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
   saved_LIBS="$LIBS"
   saved_LDFLAGS="$LDFLAGS"
+  saved_CPPFLAGS="$CPPFLAGS"
   le_found=no
   for ledir in $trylibeventdir "" $prefix /usr/local ; do
     LDFLAGS="$saved_LDFLAGS"
@@ -124,9 +125,16 @@ AC_CACHE_CHECK([for libevent directory],
       else
         LDFLAGS="-L$ledir $LDFLAGS"
       fi
+      if test -d "$ledir/include" ; then
+        CPPFLAGS="-I$ledir/include $CPPFLAGS"
+      else
+        CPPFLAGS="-I$ledir $CPPFLAGS"
+      fi
     fi
-    # Can I link it?
-    AC_TRY_LINK([], [ void *event_init(void); event_init(); ],
+    # Can I compile and link it?
+    AC_TRY_LINK([struct timeval { long tv_sec; long tv_usec; };
+typedef unsigned char u_char; typedef unsigned long size_t;
+#include <event.h>], [ event_init(); ],
        [ libevent_linked=yes ], [ libevent_linked=no ])
     if test $libevent_linked = yes; then
        if test ! -z "$ledir" ; then
@@ -140,6 +148,7 @@ AC_CACHE_CHECK([for libevent directory],
   done
   LIBS="$saved_LIBS"
   LDFLAGS="$saved_LDFLAGS"
+  CPPFLAGS="$saved_CPPFLAGS"
   if test $le_found = no ; then
     AC_MSG_ERROR([Could not find a linkable libevent. You can specify an explicit path using --with-libevent-dir])
   fi
@@ -156,7 +165,6 @@ if test $ac_cv_libevent_dir != "(system)
   if test -d "$ac_cv_libevent_dir/include" ; then
     CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
   else
-
     CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
   fi
 fi
@@ -199,6 +207,7 @@ dnl Where do you live, openssl?  And how
 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssl_dir, [
   saved_LIBS="$LIBS"
   saved_LDFLAGS="$LDFLAGS"
+  saved_CPPFLAGS="$CPPFLAGS"
   ssl_found=no
   for ssldir in $tryssldir "" $prefix /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /usr/pkg /opt /opt/openssl ; do
     LDFLAGS="$saved_LDFLAGS"
@@ -214,10 +223,15 @@ AC_CACHE_CHECK([for OpenSSL directory], 
       else
         LDFLAGS="-L$ssldir $LDFLAGS"
       fi
+      if test -d "$ssldir/include" ; then
+        CPPFLAGS="-I$ssldir/include $CPPFLAGS"
+      else
+        CPPFLAGS="-I$ssldir $CPPFLAGS"
+      fi
     fi
     # Can I link it?
-    AC_TRY_LINK([],
-       [ void RAND_add(const void *, int, double); RAND_add((void*)0,0,0); ],
+    AC_TRY_LINK([#include <openssl/rand.h>],
+       [ RAND_add((void*)0,0,0); ],
        [ openssl_linked=yes ], [ openssl_linked=no ])
     if test $openssl_linked = yes; then
        if test ! -z "$ssldir" ; then
@@ -231,6 +245,7 @@ AC_CACHE_CHECK([for OpenSSL directory], 
   done
   LIBS="$saved_LIBS"
   LDFLAGS="$saved_LDFLAGS"
+  CPPFLAGS="$saved_CPPFLAGS"
   if test $ssl_found = no ; then
     AC_MSG_ERROR([Could not find a linkable OpenSSL. You can specify an explicit path using --with-ssl-dir])
   fi



More information about the tor-commits mailing list