From 36cf9fda6a5cc4bcbfe98319b48af636fa142590 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 12 Nov 2009 20:41:54 +0900 Subject: Proper detection of a usable libresolv.so or libresolv.a. glibc 2.9 and later are no longer retarded and support SRV record lookups without having to link against a static library. --- configure | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'configure') diff --git a/configure b/configure index b3a98086..9d92cedf 100755 --- a/configure +++ b/configure @@ -266,7 +266,7 @@ EOF detect_ldap() { - TMPFILE=`mktemp` + TMPFILE=$(mktemp) if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then cat<>Makefile.settings EFLAGS+=-lldap @@ -281,6 +281,43 @@ EOF fi } +RESOLV_TESTCODE=' +#include +#include + +int main() +{ + ns_initparse( NULL, 0, NULL ); + ns_parserr( NULL, ns_s_an, 0, NULL ); +} +' + +detect_resolv_dynamic() +{ + echo "$RESOLV_TESTCODE" | $CC -o /dev/null -x c - -lresolv >/dev/null 2>/dev/null + if [ "$?" = "0" ]; then + echo 'EFLAGS+=-lresolv' >> Makefile.settings + return 0 + fi + + return 1 +} + +detect_resolv_static() +{ + for i in $systemlibdirs; do + if [ -f $i/libresolv.a ]; then + echo "$RESOLV_TESTCODE" | $CC -o /dev/null -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null + if [ "$?" = "0" ]; then + echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings + return 0 + fi + fi + done + + return 1 +} + if [ "$ssl" = "auto" ]; then detect_gnutls if [ "$ret" = "0" ]; then @@ -348,13 +385,9 @@ fi; echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings -for i in $systemlibdirs; do - if [ -f $i/libresolv.a ]; then - echo '#define HAVE_RESOLV_A' >> config.h - echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings - break - fi -done +if detect_resolv_dynamic || detect_resolv_static; then + echo '#define HAVE_RESOLV_A' >> config.h +fi STORAGES="text xml" -- cgit v1.2.3