Bug 867 - configure fails to find res_query/dn_expand on Linux amd64
Summary: configure fails to find res_query/dn_expand on Linux amd64
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 3.8.1p1
Hardware: Other Linux
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL: http://bugs.debian.org/242462
Keywords:
Depends on:
Blocks: 822
  Show dependency treegraph
 
Reported: 2004-05-12 07:03 AEST by Colin Watson
Modified: 2004-09-11 13:18 AEST (History)
0 users

See Also:


Attachments
look for res_query using compilation test (772 bytes, patch)
2004-05-12 07:05 AEST, Colin Watson
no flags Details | Diff
Check for res_query in libc before searching libresolv (1.04 KB, patch)
2004-05-12 10:19 AEST, Darren Tucker
no flags Details | Diff
Keep AC_SEARCH_LIBS too. (1.01 KB, patch)
2004-05-12 12:16 AEST, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Watson 2004-05-12 07:03:59 AEST
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.
Comment 1 Colin Watson 2004-05-12 07:05:06 AEST
Created attachment 630 [details]
look for res_query using compilation test
Comment 2 Darren Tucker 2004-05-12 09:47:20 AEST
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?
Comment 3 Colin Watson 2004-05-12 10:00:43 AEST
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.
Comment 4 Darren Tucker 2004-05-12 10:08:54 AEST
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).
Comment 5 Darren Tucker 2004-05-12 10:19:57 AEST
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.
Comment 6 Darren Tucker 2004-05-12 12:16:46 AEST
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.
Comment 7 Darren Tucker 2004-05-13 09:51:56 AEST
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.
Comment 8 Ben Lindstrom 2004-05-13 09:55:30 AEST
No quarms here,  OK.
Comment 9 Darren Tucker 2004-05-13 12:05:35 AEST
Thanks to all, slight variant of patch #633 (better spacing, eliminated double
"[[ ]]") committed to HEAD and 3.8.1 branch.