On Tue, Sep 26, 2006 at 07:04:55AM +0200, Miloslav Trmac wrote:
Sam Varshavchik napsal(a):
> LIBS="-lresolv $LIBS"
> AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
> /tmp/ccW7EeDX.o(.text+0x7): In function `main':
> /home/mrsam/src/courier/authlib/configure:5160: undefined reference to
> The reason appears to be that you have to #include <resolv.conf> on
> x86_64 in order to succesfully pull res_query() out of libresolv.so.
well, using resolv.h portably can be tricky. The glibc manpage says
that you have to include netinet/in.h and arpa/nameser.h first.
Moreover, on Solaris 9, you have to include netdb.h, too.
So to check for resolv.h correctly, you have to do this:
AC_CHECK_HEADERS(sys/types.h netinet/in.h arpa/nameser.h netdb.h resolv.h,
# include <sys/types.h>
# include <netinet/in.h> /* inet_ functions / structs */
# include <arpa/nameser.h> /* DNS HEADER struct */
# include <netdb.h>
In Autoconf 2.60, the above code is available as AC_HEADER_RESOLV.
And this should be enough, because systems with resolv.h should also
have an implementation. So my guess is that no further checking is
needed, but I'm not an expert on systemology.
If there are really systems with resolv.h but without res_query, you
might use a variation of what Miloslav Trmac posted (adding netdb.h).
But remeber that the goal of configure is to adapt the project to all
possible Unix flavours, not to check for broken installations.
If there are further questions, the mailing list autoconf gnu org
might also be a good place to discuss them.
Have a nice day,