diff --git a/acx_nlnetlabs.m4 b/acx_nlnetlabs.m4 index 0d91b16d4..314784ff0 100644 --- a/acx_nlnetlabs.m4 +++ b/acx_nlnetlabs.m4 @@ -539,6 +539,17 @@ if test "x$enable_rpath" = xno; then fi ]) +dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is +dnl an absolute path. +dnl $1: the pathname to add. +AC_DEFUN([ACX_RUNTIME_PATH_ADD], [ + if test "x$enable_rpath" = xyes; then + if echo "$1" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$1" + fi + fi +]) + dnl Check for SSL. dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. @@ -580,9 +591,7 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], dnl assume /usr is already in the lib and dynlib paths. if test "$ssldir" != "/usr"; then LDFLAGS="$LDFLAGS -L$ssldir/lib" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" - fi + ACX_RUNTIME_PATH_ADD([$ssldir/lib]) fi AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) diff --git a/configure b/configure index 1a154072c..558df4867 100755 --- a/configure +++ b/configure @@ -23449,9 +23449,13 @@ $as_echo "found in $ssldir" >&6; } HAVE_SSL=yes if test "$ssldir" != "/usr"; then LDFLAGS="$LDFLAGS -L$ssldir/lib" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" - fi + + if test "x$enable_rpath" = xyes; then + if echo "$ssldir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + fi + fi { $as_echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5 @@ -25151,6 +25155,8 @@ if test "$ac_res" != no; then fi + + # check for libevent # Check whether --with-libevent was given. @@ -25182,6 +25188,7 @@ $as_echo_n "checking for libevent... " >&6; } { $as_echo "$as_me:$LINENO: result: found in $thedir" >&5 $as_echo "found in $thedir" >&6; } CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" + BAK_LDFLAGS_SET="1" BAK_LDFLAGS="$LDFLAGS" # remove evdns from linking mkdir build >/dev/null 2>&1 @@ -25211,12 +25218,15 @@ large outgoing port ranges. " >&2;} $as_echo "found in $thedir" >&6; } if test "$thedir" != "/usr"; then LDFLAGS="$LDFLAGS -L$thedir/lib" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib" - fi + + if test "x$enable_rpath" = xyes; then + if echo "$thedir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib" + fi + fi + fi fi - # check for library used by libevent after 1.3c { $as_echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } @@ -25954,7 +25964,7 @@ _ACEOF fi done # only in libev. (tested on 3.51) - if test -n "$BAK_LDFLAGS"; then + if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi else @@ -29207,9 +29217,13 @@ if test "${with_ldns+set}" = set; then withval=$with_ldns; specialldnsdir="$withval" CPPFLAGS="-I$withval/include $CPPFLAGS" LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$withval/lib" + if echo "$withval/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$withval/lib" + fi fi + ldnsdir="$withval" diff --git a/configure.ac b/configure.ac index 04fb9bc00..e1ca0bdf3 100644 --- a/configure.ac +++ b/configure.ac @@ -346,6 +346,8 @@ fi AC_SEARCH_LIBS([inet_pton], [nsl]) AC_SEARCH_LIBS([socket], [socket]) +AC_SUBST(RUNTIME_PATH) + # check for libevent AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], [use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]), @@ -371,6 +373,7 @@ if test x_$withval = x_yes -o x_$withval != x_no; then # libevent source directory AC_MSG_RESULT(found in $thedir) CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" + BAK_LDFLAGS_SET="1" BAK_LDFLAGS="$LDFLAGS" # remove evdns from linking mkdir build >/dev/null 2>&1 @@ -395,12 +398,9 @@ large outgoing port ranges. ]) dnl assume /usr is in default path. if test "$thedir" != "/usr"; then LDFLAGS="$LDFLAGS -L$thedir/lib" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib" - fi + ACX_RUNTIME_PATH_ADD([$thedir/lib]) fi fi - AC_SUBST(RUNTIME_PATH) # check for library used by libevent after 1.3c AC_SEARCH_LIBS([clock_gettime], [rt]) @@ -411,7 +411,7 @@ large outgoing port ranges. ]) AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51) - if test -n "$BAK_LDFLAGS"; then + if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi else @@ -498,9 +498,7 @@ AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATH], [ specialldnsdir="$withval" CPPFLAGS="-I$withval/include $CPPFLAGS" LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" - if test "x$enable_rpath" = xyes; then - RUNTIME_PATH="$RUNTIME_PATH -R$withval/lib" - fi + ACX_RUNTIME_PATH_ADD([$withval/lib]) ldnsdir="$withval" AC_SUBST(ldnsdir) ]) diff --git a/doc/Changelog b/doc/Changelog index 4774dd951..41e3a1221 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +30 March 2009: Wouter + - Fixup LDFLAGS from libevent sourcedir compile configure restore. + - Fixup so no non-absolute rpaths are added. + 27 March 2009: Wouter - nicer -h output. report linked libraries and modules. - prints modules in intuitive order (config file friendly).