configure: Improve the check for the resolver library.

This commit is contained in:
Alexandre Julliard 2014-07-23 15:23:07 +02:00
parent 35dd553038
commit 1b2977420e
2 changed files with 53 additions and 29 deletions

49
configure vendored
View File

@ -11687,11 +11687,16 @@ fi
if test "$ac_cv_header_resolv_h" = "yes" if test "$ac_cv_header_resolv_h" = "yes"
then then
ac_save_LIBS="$LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for resolver library" >&5
for lib in '' -lresolv $as_echo_n "checking for resolver library... " >&6; }
do if ${ac_cv_have_resolv+:} false; then :
LIBS="$lib $ac_save_LIBS" $as_echo_n "(cached) " >&6
cat confdefs.h - <<_ACEOF >conftest.$ac_ext else
ac_save_LIBS="$LIBS"
for lib in '' -lresolv
do
LIBS="$lib $ac_save_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
@ -11700,25 +11705,37 @@ then
int int
main () main ()
{ {
res_query("foo",ns_c_in,0,0,0); if (!(_res.options & RES_INIT)) res_init(); res_query("foo",ns_c_in,0,0,0)
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_have_resolv=${lib:-"none required"}
$as_echo "#define HAVE_RESOLV 1" >>confdefs.h else
ac_cv_have_resolv="not found"
RESOLV_LIBS="$lib"
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
if test "${RESOLV_LIBS+set}" = set; then test "x$ac_cv_have_resolv" = "xnot found" || break
break done
fi LIBS="$ac_save_LIBS"
done fi
LIBS="$ac_save_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_resolv" >&5
$as_echo "$ac_cv_have_resolv" >&6; }
case "$ac_cv_have_resolv" in
"not found") ;;
"none required")
$as_echo "#define HAVE_RESOLV 1" >>confdefs.h
;;
*)
$as_echo "#define HAVE_RESOLV 1" >>confdefs.h
RESOLV_LIBS=$ac_cv_have_resolv
;;
esac
fi fi
if test "x$with_lcms2" != "xno" if test "x$with_lcms2" != "xno"

View File

@ -1419,21 +1419,28 @@ WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_port_gp_port_info_list_new" !=
dnl **** Check for resolver library *** dnl **** Check for resolver library ***
if test "$ac_cv_header_resolv_h" = "yes" if test "$ac_cv_header_resolv_h" = "yes"
then then
ac_save_LIBS="$LIBS" AC_CACHE_CHECK([for resolver library], ac_cv_have_resolv,
for lib in '' -lresolv [ac_save_LIBS="$LIBS"
do for lib in '' -lresolv
LIBS="$lib $ac_save_LIBS" do
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_NETINET_IN_H LIBS="$lib $ac_save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include <resolv.h>]],[[res_query("foo",ns_c_in,0,0,0);]])], #include <resolv.h>]],[[if (!(_res.options & RES_INIT)) res_init(); res_query("foo",ns_c_in,0,0,0)]])],
[AC_DEFINE(HAVE_RESOLV, 1, [Define if you have the resolver library and header]) [ac_cv_have_resolv=${lib:-"none required"}],[ac_cv_have_resolv="not found"])
AC_SUBST(RESOLV_LIBS,"$lib")]) test "x$ac_cv_have_resolv" = "xnot found" || break
if test "${RESOLV_LIBS+set}" = set; then done
break LIBS="$ac_save_LIBS"])
fi
done case "$ac_cv_have_resolv" in
LIBS="$ac_save_LIBS" "not found") ;;
"none required")
AC_DEFINE(HAVE_RESOLV, 1, [Define if you have the resolver library and header]) ;;
*)
AC_DEFINE(HAVE_RESOLV, 1)
AC_SUBST(RESOLV_LIBS,$ac_cv_have_resolv) ;;
esac
fi fi
dnl **** Check for LittleCMS *** dnl **** Check for LittleCMS ***