- (dtucker) [configure.ac] Bug #867: Additional tests for res_query in
   libresolv, fixes problems detecting it on some platforms
   (eg Linux/x86-64).  From Kurt Roeckx via Debian, ok mouring@
diff --git a/configure.ac b/configure.ac
index 053204d..850205c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.216 2004/04/23 08:53:10 dtucker Exp $
+# $Id: configure.ac,v 1.217 2004/05/13 01:56:17 dtucker Exp $
 #
 # Copyright (c) 1999-2004 Damien Miller
 #
@@ -2156,6 +2156,25 @@
 		# Needed by our getrrsetbyname()
 		AC_SEARCH_LIBS(res_query, resolv)
 		AC_SEARCH_LIBS(dn_expand, resolv)
+		AC_MSG_CHECKING(if res_query will link)
+		AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
+		   [AC_MSG_RESULT(no)
+		    saved_LIBS="$LIBS"
+		    LIBS="$LIBS -lresolv"
+		    AC_MSG_CHECKING(for res_query in -lresolv)
+		    AC_LINK_IFELSE([
+#include <resolv.h>
+int main()
+{
+	res_query (0, 0, 0, 0, 0);
+	return 0;
+}
+			],
+			[LIBS="$LIBS -lresolv"
+			 AC_MSG_RESULT(yes)],
+			[LIBS="$saved_LIBS"
+			 AC_MSG_RESULT(no)])
+		    ])
 		AC_CHECK_FUNCS(_getshort _getlong)
 		AC_CHECK_MEMBER(HEADER.ad,
 			[AC_DEFINE(HAVE_HEADER_AD)],,