[configure] Fix res_query check for OS X

https://bugzilla.gnome.org/show_bug.cgi?id=586150
This commit is contained in:
Dan Winship 2010-01-13 11:24:28 -05:00
parent a6ab4b7872
commit 956b3b507d
2 changed files with 20 additions and 18 deletions

View File

@ -1012,23 +1012,25 @@ AC_CHECK_HEADERS([netdb.h wspiapi.h])
if test $glib_native_win32 = no; then if test $glib_native_win32 = no; then
AC_CHECK_FUNCS(strndup setresuid setreuid) AC_CHECK_FUNCS(strndup setresuid setreuid)
AC_CHECK_HEADERS(sys/prctl.h arpa/nameser_compat.h) AC_CHECK_HEADERS(sys/prctl.h arpa/nameser_compat.h)
AC_CHECK_FUNC(res_query, ,
[AC_CHECK_LIB(resolv, res_query, [ LIBASYNCNS_LIBADD="-lresolv" ], # We can't just use AC_CHECK_FUNC/AC_CHECK_LIB here. Bug 586150
[ save_libs="$LIBS" AC_MSG_CHECKING([for res_query])
LIBS="-lresolv $LIBS" AC_TRY_LINK([#include <resolv.h>],
AC_MSG_CHECKING([for res_query in -lresolv (alternate version)]) [res_query("test", 0, 0, (void *)0, 0);],
AC_LINK_IFELSE( [AC_MSG_RESULT([yes])],
[AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])], [save_libs="$LIBS"
[ AC_MSG_RESULT(yes) LIBS="-lresolv $LIBS"
LIBASYNCNS_LIBADD="-lresolv" ], AC_TRY_LINK([#include <resolv.h>],
[ AC_MSG_RESULT(no) [res_query("test", 0, 0, (void *)0, 0);],
AC_CHECK_LIB(bind, res_query, [AC_MSG_RESULT([in -lresolv])
[ LIBASYNCNS_LIBADD="-lbind" ], LIBASYNCNS_LIBADD="-lresolv"],
[ AC_MSG_ERROR(res_query not found) ] ) ] ) [LIBS="-lbind $save_libs"
LIBS="$save_libs" AC_TRY_LINK([#include <resolv.h>],
] ) [res_query("test", 0, 0, (void *)0, 0);],
] [AC_MSG_RESULT([in -lbind])
) LIBASYNCNS_LIBADD="-lbind"],
[AC_MSG_ERROR(not found)])])
LIBS="$save_libs"])
AC_SUBST(LIBASYNCNS_LIBADD) AC_SUBST(LIBASYNCNS_LIBADD)
fi fi

View File

@ -10,5 +10,5 @@ Description: glib I/O library
Version: @VERSION@ Version: @VERSION@
Requires: glib-2.0,gobject-2.0,gmodule-no-export-2.0 Requires: glib-2.0,gobject-2.0,gmodule-no-export-2.0
Libs: -L${libdir} -lgio-2.0 Libs: -L${libdir} -lgio-2.0
Libs.private: @ZLIB_LIBS@ Libs.private: @ZLIB_LIBS@ @LIBASYNCNS_LIBADD@
Cflags: Cflags: