Debian bug #242462 from Kurt Roeckx <Q@ping.be> reports: 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. The right thing to do definitely seems to be for configure to use the documented interface to res_query (i.e. #include <resolv.h>, compile) rather than poking about in libraries for it by hand. I'll attach Kurt's patch in a moment.
Created attachment 630 [details] look for res_query using compilation test
Comment on attachment 630 [details] look for res_query using compilation test >- 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)) The new check is not going to look for res_query in libresolv, is it?
The portion of the patch after the portion you quoted appears to do exactly that. (On closer inspection it does look buggy, though; for starters it seems that it'll add -lresolv twice on success.) I think the patch is trying to check for res_query in libc first and then in libresolv.
Yeah, that looks like what it's trying to do but there's a missing [] pair. As it stands -lresolv will be added whether it's needed or not since the block I quoted doesn't actually do anything except generate a message. There's no check for dn_query any more either, I don't know if that matters if the res_query one always works (the HAVE_DN_EXPAND and HAVE_RES_QUERY defines never get used).
Created attachment 631 [details] Check for res_query in libc before searching libresolv This seems to be what was intended. In testing here it stops if res_query is found in libc.
Created attachment 633 [details] Keep AC_SEARCH_LIBS too. Hmm, patch #631 breaks old Solaris boxes, which needs: #include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> I'm concerned that we might trip over dependancies on other platforms, so I think we should keep the AC_SEARCH_LIBS calls and just add the new checks.
Kurt has confirmed that patch #633 fixes the problem for him, I think it's the way to go if someone wants to OK it.
No quarms here, OK.
Thanks to all, slight variant of patch #633 (better spacing, eliminated double "[[ ]]") committed to HEAD and 3.8.1 branch.