diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2009-11-12 20:41:54 +0900 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2009-11-12 20:41:54 +0900 | 
| commit | 36cf9fda6a5cc4bcbfe98319b48af636fa142590 (patch) | |
| tree | 7b6a2fc76091a9b8ca651014c7738f8a89b4f1cb | |
| parent | fb51d85751b36098ad4271bc4553ade4dc53f20b (diff) | |
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.
| -rwxr-xr-x | configure | 49 | 
1 files changed, 41 insertions, 8 deletions
| @@ -266,7 +266,7 @@ EOF  detect_ldap()  { -	TMPFILE=`mktemp` +	TMPFILE=$(mktemp)  	if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then  		cat<<EOF>>Makefile.settings  EFLAGS+=-lldap @@ -281,6 +281,43 @@ EOF  	fi  } +RESOLV_TESTCODE=' +#include <arpa/nameser.h> +#include <resolv.h>  + +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" | 
