From e7ec164563d5657d3cfede16476496c31708bfea Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Thu, 23 Sep 2010 18:20:31 +0200 Subject: [PATCH] configure: Detect resolver functionality on FreeBSD. On FreeBSD this is part of libc. --- configure | 17 +++++++++++------ configure.ac | 15 ++++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 788a57a0463..49375779cfb 100755 --- a/configure +++ b/configure @@ -9977,13 +9977,13 @@ esac fi -RESOLVLIBS="" - if test "$ac_cv_header_resolv_h" = "yes" then ac_save_LIBS="$LIBS" - LIBS="$LIBS -lresolv" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + for lib in '' -lresolv + do + LIBS="$lib $ac_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_NETINET_IN_H #include @@ -9992,7 +9992,7 @@ then int main () { -res_init(); +res_query("foo",ns_c_in,0,0,0); ; return 0; } @@ -10001,10 +10001,15 @@ if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_RESOLV 1" >>confdefs.h - RESOLVLIBS="-lresolv" + RESOLVLIBS="$lib" + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + if test "${RESOLVLIBS+set}" = set; then + break + fi + done LIBS="$ac_save_LIBS" fi diff --git a/configure.ac b/configure.ac index f2792939f47..341ba181911 100644 --- a/configure.ac +++ b/configure.ac @@ -1266,17 +1266,22 @@ WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_gp_camera_new" != "yes"], dnl **** Check for resolver library *** -AC_SUBST(RESOLVLIBS,"") if test "$ac_cv_header_resolv_h" = "yes" then ac_save_LIBS="$LIBS" - LIBS="$LIBS -lresolv" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_NETINET_IN_H + for lib in '' -lresolv + do + LIBS="$lib $ac_save_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_NETINET_IN_H #include #endif -#include ]],[[res_init();]])], +#include ]],[[res_query("foo",ns_c_in,0,0,0);]])], [AC_DEFINE(HAVE_RESOLV, 1, [Define if you have the resolver library and header]) - RESOLVLIBS="-lresolv"]) + AC_SUBST(RESOLVLIBS,"$lib")]) + if test "${RESOLVLIBS+set}" = set; then + break + fi + done LIBS="$ac_save_LIBS" fi