From cf3d92a7a7f897411152830feb3846e58481ae70 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 13 May 2008 14:01:23 +0000 Subject: [PATCH] no unnecessary linking with librt. git-svn-id: file:///svn/unbound/trunk@1081 be551aaa-1e26-0410-a405-d3ace91eadb9 --- configure | 129 +++++++++++++++++++++++++------------------------- configure.ac | 5 +- doc/Changelog | 1 + 3 files changed, 69 insertions(+), 66 deletions(-) diff --git a/configure b/configure index 261ea580e..49666fa72 100755 --- a/configure +++ b/configure @@ -21932,8 +21932,71 @@ if test "$ac_res" != no; then fi -# check for library used by libevent after 1.3c -{ echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5 + +# check for libevent + +# Check whether --with-libevent was given. +if test "${with_libevent+set}" = set; then + withval=$with_libevent; +else + withval="no" +fi + +if test x_$withval == x_yes -o x_$withval != x_no; then + { echo "$as_me:$LINENO: checking for libevent" >&5 +echo $ECHO_N "checking for libevent... $ECHO_C" >&6; } + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" + fi + for dir in $withval; do + thedir="$dir" + if test -f "$dir/include/event.h"; then + found_libevent="yes" + CPPFLAGS="$CPPFLAGS -I$thedir/include" + break; + fi + done + if test x_$found_libevent != x_yes; then + if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then + # libevent source directory + { echo "$as_me:$LINENO: result: found in $thedir" >&5 +echo "${ECHO_T}found in $thedir" >&6; } + CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" + BAK_LDFLAGS="$LDFLAGS" + # remove evdns from linking + mkdir build >/dev/null 2>&1 + mkdir build/libevent >/dev/null 2>&1 + mkdir build/libevent/.libs >/dev/null 2>&1 + ev_files_o=`ls $thedir/*.o | grep -v evdns\.o` + ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo` + ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o` + cp $ev_files_o build/libevent + cp $ev_files_lo build/libevent + cp $ev_files_libso build/libevent/.libs + LATE_LDFLAGS="build/libevent/*.lo -lm" + LDFLAGS="build/libevent/*.o $LDFLAGS -lm" + else + { { echo "$as_me:$LINENO: error: Cannot find the libevent library in $withval +You can restart ./configure --with-libevent=no to use a builtin alternative. +Please note that this alternative is not as capable as libevent when using +large outgoing port ranges. " >&5 +echo "$as_me: error: Cannot find the libevent library in $withval +You can restart ./configure --with-libevent=no to use a builtin alternative. +Please note that this alternative is not as capable as libevent when using +large outgoing port ranges. " >&2;} + { (exit 1); exit 1; }; } + fi + else + { echo "$as_me:$LINENO: result: found in $thedir" >&5 +echo "${ECHO_T}found in $thedir" >&6; } + LDFLAGS="$LDFLAGS -L$thedir/lib" + if test "x$enable_rpath" = xyes; then + RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib" + fi + fi + + # check for library used by libevent after 1.3c + { echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5 echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6; } if test "${ac_cv_search_clock_gettime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -22017,68 +22080,6 @@ if test "$ac_res" != no; then fi -# check for libevent - -# Check whether --with-libevent was given. -if test "${with_libevent+set}" = set; then - withval=$with_libevent; -else - withval="no" -fi - -if test x_$withval == x_yes -o x_$withval != x_no; then - { echo "$as_me:$LINENO: checking for libevent" >&5 -echo $ECHO_N "checking for libevent... $ECHO_C" >&6; } - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" - fi - for dir in $withval; do - thedir="$dir" - if test -f "$dir/include/event.h"; then - found_libevent="yes" - CPPFLAGS="$CPPFLAGS -I$thedir/include" - break; - fi - done - if test x_$found_libevent != x_yes; then - if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then - # libevent source directory - { echo "$as_me:$LINENO: result: found in $thedir" >&5 -echo "${ECHO_T}found in $thedir" >&6; } - CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" - BAK_LDFLAGS="$LDFLAGS" - # remove evdns from linking - mkdir build >/dev/null 2>&1 - mkdir build/libevent >/dev/null 2>&1 - mkdir build/libevent/.libs >/dev/null 2>&1 - ev_files_o=`ls $thedir/*.o | grep -v evdns\.o` - ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo` - ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o` - cp $ev_files_o build/libevent - cp $ev_files_lo build/libevent - cp $ev_files_libso build/libevent/.libs - LATE_LDFLAGS="build/libevent/*.lo -lm" - LDFLAGS="build/libevent/*.o $LDFLAGS -lm" - else - { { echo "$as_me:$LINENO: error: Cannot find the libevent library in $withval -You can restart ./configure --with-libevent=no to use a builtin alternative. -Please note that this alternative is not as capable as libevent when using -large outgoing port ranges. " >&5 -echo "$as_me: error: Cannot find the libevent library in $withval -You can restart ./configure --with-libevent=no to use a builtin alternative. -Please note that this alternative is not as capable as libevent when using -large outgoing port ranges. " >&2;} - { (exit 1); exit 1; }; } - fi - else - { echo "$as_me:$LINENO: result: found in $thedir" >&5 -echo "${ECHO_T}found in $thedir" >&6; } - LDFLAGS="$LDFLAGS -L$thedir/lib" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib" - fi - fi - { echo "$as_me:$LINENO: checking for library containing event_set" >&5 echo $ECHO_N "checking for library containing event_set... $ECHO_C" >&6; } if test "${ac_cv_search_event_set+set}" = set; then diff --git a/configure.ac b/configure.ac index 308677c44..1e7fabfa6 100644 --- a/configure.ac +++ b/configure.ac @@ -506,8 +506,6 @@ fi # check to see if libraries are needed for these functions. AC_SEARCH_LIBS([inet_pton], [nsl]) AC_SEARCH_LIBS([socket], [socket]) -# check for library used by libevent after 1.3c -AC_SEARCH_LIBS([clock_gettime], [rt]) # check for libevent AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], @@ -558,6 +556,9 @@ large outgoing port ranges. ]) fi fi AC_SUBST(RUNTIME_PATH) + # check for library used by libevent after 1.3c + AC_SEARCH_LIBS([clock_gettime], [rt]) + AC_SEARCH_LIBS(event_set, [event]) AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later diff --git a/doc/Changelog b/doc/Changelog index 9e62f6d0d..4577f2932 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Added root ipv6 addresses to builtin root hints. - TODO modified for post 1.0 plans. - trunk version set to 1.0.0. + - no unnecessary linking with librt (only when libevent/libev used). 7 May 2008: Wouter - fixup no-ip4 problem with error callback in outside network. -- 2.47.2