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

Re: autoconf breakage on x86_64.



Hello,

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
> > `res_query'
> 
> > 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,
                 [], [],
[[#ifdef HAVE_SYS_TYPES_H
#  include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#  include <netinet/in.h>   /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
#  include <arpa/nameser.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_NETDB_H
#  include <netdb.h>
#endif]])

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,
	Stepan Kasal


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