summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-05-17 01:51:23 +0000
committerNick Mathewson <nickm@torproject.org>2005-05-17 01:51:23 +0000
commit79c056cbe1246fbefc7c2eed66e1665b8678657e (patch)
tree4a1af1e311acfb89aad769ffd2c9b37112fa383d
parentc5b986ec6cb773e0acf60da551622e6dbb4c04f1 (diff)
downloadtor-79c056cbe1246fbefc7c2eed66e1665b8678657e.tar.gz
tor-79c056cbe1246fbefc7c2eed66e1665b8678657e.zip
Very experimental code to try to make libevent work from bad /usr/local/libs
svn:r4238
-rw-r--r--configure.in83
1 files changed, 82 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 4b3b6bec37..f4cfaf1833 100644
--- a/configure.in
+++ b/configure.in
@@ -56,7 +56,88 @@ AC_SEARCH_LIBS(socket, [socket])
AC_SEARCH_LIBS(gethostbyname, [nsl])
AC_SEARCH_LIBS(pthread_create, [pthread])
AC_SEARCH_LIBS(pthread_detach, [pthread])
-AC_SEARCH_LIBS(event_loop, [event], , AC_MSG_ERROR(Libevent library not found. Tor requires libevent to build. You can get the latest version of libevent at http://www.monkey.org/~provos/libevent/ ))
+
+dnl ------------------------------------------------------
+dnl Where do you live, libevent?
+
+AC_SEARCH_LIBS(event_loop, [event], event_found=yes, event_found=no)
+
+if test "$event_found" = no; then
+ echo FLOOIE
+ saved_LIBS="$LIBS"
+ saved_LDFLAGS="$LDFLAGS"
+ saved_CPPFLAGS="$CPPFLAGS"
+ AC_CACHE_CHECK([for libevent in /usr/local/lib], ac_cv_libevent_local, [
+ LIBS="$LIBS -levent"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+ CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+ AC_TRY_COMPILE([
+#include <event.h>
+int main(void)
+{
+ event_init();
+ return 0;
+}], [ libevent_is_in_local=yes ], [ libevent_is_in_local=no ])
+ if test libevent_is_in_local = yes; then
+ AC_TRY_RUN([
+#include <event.h>
+int main(void)
+{
+ event_init();
+ return 0;
+}], , [ ac_cv_libevent_local=unlinked ])
+ else
+ ac_cv_libevent_local=no
+ fi
+ if test "$GCC" = yes -a $ac_vc_libevent_local = unlinked ; then
+ LDFLAGS="$LDFLAGS -Wl,-R/usr/local/lib"
+ AC_TRY_RUN([
+#include <event.h>
+int main(void)
+{
+ event_init();
+ return 0;
+}], [ ac_cv_libevent_local=unlinked_gcc_elf ])
+ fi
+
+ LIBS="$saved_LIBS"
+ CFLAGS="$saved_CFLAGS"
+ LDFLAGS="$saved_LDFLAGS" ])
+
+ if test $ac_cv_libevent_local != no; then
+ LIBS="$LIBS -levent"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+ CFLAGS="$CFLAGS -I/usr/local/include"
+ fi
+ if test $av_cv_libevent_local = unlinked_gcc_elf; then
+ LDFLAGS="$LDFLAGS -Wl,-R/usr/local/lib"
+ fi
+
+ if test $ac_cv_libevent_local = unlinked; then
+ echo <<EOF
+=====================================================
+HEY!!!!
+
+Your libevent library is installed in /usr/local/lib,
+but your dynamic linker isn't configured to look for
+it there.
+
+EOF
+ if test -f /etc/ld.so.conf; then
+ echo <<EOF
+Maybe you need to add /usr/local/lib to /etc/ld.so.conf,
+and then run ldconfig -v ?
+EOF
+ fi
+ echo <<EOF
+
+=====================================================
+EOF
+ fi
+fi
+
+dnl ------------------------------------------------------
+dnl Where do you live, OpenSSL?
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"