From b62abf9f21499abda5b703271d5663a2a7380ca0 Mon Sep 17 00:00:00 2001 From: Jacob Appelbaum Date: Wed, 16 Mar 2011 18:35:31 -0700 Subject: Fix libevent autoconf bug #2698 --- changes/bug2698 | 3 +++ configure.in | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 changes/bug2698 diff --git a/changes/bug2698 b/changes/bug2698 new file mode 100644 index 000000000..3c2468f5e --- /dev/null +++ b/changes/bug2698 @@ -0,0 +1,3 @@ + o Minor build issues + - We incorrectly linked libevent when configured with + --enable-static-libevent. Fixes bug 2698. diff --git a/configure.in b/configure.in index 4436fe207..bd9417425 100644 --- a/configure.in +++ b/configure.in @@ -271,7 +271,21 @@ tor_libevent_pkg_debian="libevent-dev" tor_libevent_devpkg_redhat="libevent-devel" tor_libevent_devpkg_debian="libevent-dev" -TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $TOR_LIB_WS32], [ +dnl On Gnu/Linux or any place we require it, we'll add librt to the Libevent +dnl linking for static builds. +STATIC_LIBEVENT_FLAGS="" +if test "$enable_static_libevent" = "yes"; then + dnl Determine if we have clock_gettime in librt + AC_SEARCH_LIBS([clock_gettime], [rt], + [have_rt=yes]) + if test "$have_rt" = yes; then + STATIC_LIBEVENT_FLAGS=" -lrt " + else + STATIC_LIBEVENT_FLAGS="" + fi +fi + +TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32], [ #ifdef WIN32 #include #endif @@ -294,7 +308,7 @@ dnl Now check for particular libevent functions. save_LIBS="$LIBS" save_LDFLAGS="$LDFLAGS" save_CPPFLAGS="$CPPFLAGS" -LIBS="-levent $TOR_LIB_WS32 $LIBS" +LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS" LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS" CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS" AC_CHECK_FUNCS(event_get_version event_get_version_number event_get_method event_set_log_callback evdns_set_outgoing_bind_address event_base_loopexit) @@ -315,7 +329,7 @@ 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" + TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent.a $STATIC_LIBEVENT_FLAGS" fi else TOR_LIBEVENT_LIBS="-levent" -- cgit v1.2.3 From 47621188328c19be18a6915f937e4e0f7e04fba8 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 27 Mar 2011 05:35:17 +0200 Subject: Small tweaks for bug2698 bugfix --- changes/bug2698 | 9 ++++++--- configure.in | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changes/bug2698 b/changes/bug2698 index 3c2468f5e..d995788bf 100644 --- a/changes/bug2698 +++ b/changes/bug2698 @@ -1,3 +1,6 @@ - o Minor build issues - - We incorrectly linked libevent when configured with - --enable-static-libevent. Fixes bug 2698. + o Minor bugfixes: + - Fix an issue that prevented static linking of libevent on + some platforms (notably Linux). Fixes bug 2698, bugfix on + versions 0.2.1.23/0.2.2.8-alpha (the versions introducing + the --with-static-libevent configure option). + diff --git a/configure.in b/configure.in index bd9417425..6ed43ce23 100644 --- a/configure.in +++ b/configure.in @@ -280,8 +280,6 @@ if test "$enable_static_libevent" = "yes"; then [have_rt=yes]) if test "$have_rt" = yes; then STATIC_LIBEVENT_FLAGS=" -lrt " - else - STATIC_LIBEVENT_FLAGS="" fi fi -- cgit v1.2.3