From 62977c31da1eec0999a5d5b787966f1bd1f92ce2 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sat, 1 Apr 2006 10:27:53 +0000 Subject: Miloslav Trmac: Fix res_search autodetection. svn path=/branches/BRANCH_6-3/; revision=4763 --- configure.ac | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index cf32079a..fd3371bd 100644 --- a/configure.ac +++ b/configure.ac @@ -137,7 +137,7 @@ AC_FUNC_VPRINTF AC_SUBST(EXTRAOBJ) AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid dnl - res_search strerror syslog snprintf vprintf vsnprintf vsyslog dnl + strerror syslog snprintf vprintf vsnprintf vsyslog dnl atexit inet_aton strftime setrlimit socketpair sigprocmask dnl sigaction strdup setlocale) @@ -147,10 +147,32 @@ AC_CHECK_DECLS(strerror) # and breaks gethostbyname(2). It's better to use the bind stuff in the C # library. So don't add -lresolv to the link list unless it's necessary # (It will be necessary when using GNU libc6). -AC_CHECK_FUNC(res_search, - AC_MSG_RESULT(using libc's resolver functions), - AC_CHECK_LIB(resolv,res_search, - [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found))) +old_libs=$LIBS +for lib in '' -lresolv; do + if test -z "$lib"; then + AC_MSG_CHECKING([for res_search in libc]) + else + AC_MSG_CHECKING([for res_search in $lib]) + fi + LIBS="$old_LIBS $lib" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_NAMESER_H +#include +#endif +#ifdef HAVE_RESOLV_H +#include +#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])]) +done dnl Check for libcrypt -- it may live in libc or libcrypt, as on IRIX AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt,crypt)) -- cgit v1.2.3