From ee6e142192a8511460fa2262cc9b5293fbab995f Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 17 Jan 2008 08:17:24 +0000 Subject: [PATCH] configure fixes. git-svn-id: file:///svn/unbound/trunk@869 be551aaa-1e26-0410-a405-d3ace91eadb9 --- config.h.in | 10 +-- configure | 221 +++++++++++++++++++++++++++++++++++++------------- configure.ac | 7 +- doc/Changelog | 3 + 4 files changed, 173 insertions(+), 68 deletions(-) diff --git a/config.h.in b/config.h.in index 8739093c2..1659a0fcc 100644 --- a/config.h.in +++ b/config.h.in @@ -57,14 +57,8 @@ /* Define to 1 if you have the `crypto' library (-lcrypto). */ #undef HAVE_LIBCRYPTO -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define to 1 if you have the `rt' library (-lrt). */ -#undef HAVE_LIBRT - -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET +/* Define to 1 if you have the `ldns' library (-lldns). */ +#undef HAVE_LIBLDNS /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ diff --git a/configure b/configure index cbcdc6f1f..7d404c359 100755 --- a/configure +++ b/configure @@ -21692,14 +21692,12 @@ fi fi # check to see if libraries are needed for these functions. - -{ echo "$as_me:$LINENO: checking for inet_pton in -lnsl" >&5 -echo $ECHO_N "checking for inet_pton in -lnsl... $ECHO_C" >&6; } -if test "${ac_cv_lib_nsl_inet_pton+set}" = set; then +{ echo "$as_me:$LINENO: checking for library containing inet_pton" >&5 +echo $ECHO_N "checking for library containing inet_pton... $ECHO_C" >&6; } +if test "${ac_cv_search_inet_pton+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" + ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21722,7 +21720,14 @@ return inet_pton (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; @@ -21740,37 +21745,42 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_nsl_inet_pton=yes + ac_cv_search_inet_pton=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_nsl_inet_pton=no + fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if test "${ac_cv_search_inet_pton+set}" = set; then + break fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_pton" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_inet_pton" >&6; } -if test $ac_cv_lib_nsl_inet_pton = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNSL 1 -_ACEOF - - LIBS="-lnsl $LIBS" - +done +if test "${ac_cv_search_inet_pton+set}" = set; then + : +else + ac_cv_search_inet_pton=no fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_inet_pton" >&5 +echo "${ECHO_T}$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +fi -{ echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 -echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then +{ echo "$as_me:$LINENO: checking for library containing socket" >&5 +echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6; } +if test "${ac_cv_search_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" + ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21793,7 +21803,14 @@ return socket (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; @@ -21811,38 +21828,43 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_socket_socket=yes + ac_cv_search_socket=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_socket_socket=no + fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if test "${ac_cv_search_socket+set}" = set; then + break fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; } -if test $ac_cv_lib_socket_socket = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSOCKET 1 -_ACEOF - - LIBS="-lsocket $LIBS" +done +if test "${ac_cv_search_socket+set}" = set; then + : +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5 +echo "${ECHO_T}$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # check for library used by libevent after 1.3c - -{ echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 -echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6; } -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then +{ 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 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" + ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21865,7 +21887,14 @@ return clock_gettime (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; @@ -21883,26 +21912,33 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_rt_clock_gettime=yes + ac_cv_search_clock_gettime=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_rt_clock_gettime=no + fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if test "${ac_cv_search_clock_gettime+set}" = set; then + break fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 -echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6; } -if test $ac_cv_lib_rt_clock_gettime = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRT 1 -_ACEOF - - LIBS="-lrt $LIBS" +done +if test "${ac_cv_search_clock_gettime+set}" = set; then + : +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5 +echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -23900,6 +23936,77 @@ echo "${ECHO_T}$ac_cv_lib_ldns_ldns_rr_new" >&6; } if test $ac_cv_lib_ldns_ldns_rr_new = yes; then +{ echo "$as_me:$LINENO: checking for ldns_rr_free in -lldns" >&5 +echo $ECHO_N "checking for ldns_rr_free in -lldns... $ECHO_C" >&6; } +if test "${ac_cv_lib_ldns_ldns_rr_free+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldns $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ldns_rr_free (); +int +main () +{ +return ldns_rr_free (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_ldns_ldns_rr_free=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_ldns_ldns_rr_free=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ldns_ldns_rr_free" >&5 +echo "${ECHO_T}$ac_cv_lib_ldns_ldns_rr_free" >&6; } +if test $ac_cv_lib_ldns_ldns_rr_free = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBLDNS 1 +_ACEOF + + LIBS="-lldns $LIBS" + +fi + + for ac_func in inet_aton do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index 94f53b78a..3d8db09b6 100644 --- a/configure.ac +++ b/configure.ac @@ -521,10 +521,10 @@ if test x_$withval != x_no; then fi # check to see if libraries are needed for these functions. -AC_CHECK_LIB(nsl, inet_pton) -AC_CHECK_LIB(socket, socket) +AC_SEARCH_LIBS([inet_pton], [nsl]) +AC_SEARCH_LIBS([socket], [socket]) # check for library used by libevent after 1.3c -AC_CHECK_LIB(rt, clock_gettime) +AC_SEARCH_LIBS([clock_gettime], [rt]) # check for libevent AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], @@ -623,6 +623,7 @@ AC_ARG_WITH(ldns, AC_CHECK_LIB(ldns, ldns_rr_new, [ dnl ldns was found, check compat functions +AC_CHECK_LIB(ldns, [ldns_rr_free]) AC_REPLACE_FUNCS(inet_aton) AC_REPLACE_FUNCS(inet_pton) AC_REPLACE_FUNCS(inet_ntop) diff --git a/doc/Changelog b/doc/Changelog index 48159808c..5cc98459e 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +17 January 2008: Wouter + - fixup configure in case -lldns is installed. + 16 January 2008: Wouter - incoming queries to the server with TC bit on are replied FORMERR. - interface-automatic replied the wrong source address on localhost -- 2.47.2