Sam Varshavchik napsal(a):
I don't know the right way to fix this, but something is definitely broken; and something needs to be fixed, one way or the other. The question is what exactly needs to be fixed.
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. You don't need to do this on x86, and the test program generated by AC_TRY_LINK_FUNC does not include any headers, but uses a manual prototype.
So, what now?
Fetchmail uses this (after checking for the presence of the necessary header files):
| AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | #include <sys/types.h> | #ifdef HAVE_NETINET_IN_H | #include <netinet/in.h> | #endif | #ifdef HAVE_ARPA_NAMESER_H | #include <arpa/nameser.h> | #endif | #ifdef HAVE_RESOLV_H | #include <resolv.h> | #endif | extern int res_search(); | ]], [[res_search(0, 0, 0, 0, 0);]])], | [AC_MSG_RESULT([found]) | AC_DEFINE(HAVE_RES_SEARCH, [1], | [Define to 1 if you have the 'res_search' function.]) | break], [AC_MSG_RESULT([not found])])
Mirek