[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#242462: Unable to find res_* in libresolv.



Package: ssh
Version: 3.8p1-2

It seems configure is unable to detect res_query and others in
libresolv because resolv.h wasn't included.  It changes it to
__res_query, which is how it's called in the lib too.

The reason this works on some architectures is that they have a
weak alias from res_query to __res_query, but architectures (like
amd64) starting from glibc 2.2 or later don't have that.

I have attached a patch that fixes the detection.



Kurt

--- configure.ac.old	2004-04-05 19:52:04.000000000 +0200
+++ configure.ac	2004-04-06 22:02:15.277575169 +0200
@@ -2054,8 +2054,21 @@
 	[AC_DEFINE(HAVE_GETRRSETBYNAME)],
 	[
 		# Needed by our getrrsetbyname()
-		AC_SEARCH_LIBS(res_query, resolv)
-		AC_SEARCH_LIBS(dn_expand, resolv)
+		AC_MSG_CHECKING(for res_query)
+		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)],,

Reply to: