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

View File

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