Added a second test for libresolv that takes into
authorArt Cancro <ajc@citadel.org>
Thu, 24 Jan 2008 04:51:44 +0000 (04:51 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 24 Jan 2008 04:51:44 +0000 (04:51 +0000)
consideration the fact that res_query() is a macro on some hosts.

citadel/configure.ac

index 8f7f4495ace31e885b8918ff0079fb6bb9e8d5e2..a11eb11a82bf603c6a618ceca025f796d372f6d0 100644 (file)
@@ -389,9 +389,21 @@ case "`uname -a`" in
        test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
        AC_CHECK_LIB(resolv, res_query,
                RESOLV="$RESOLV -lresolv",
-               [
-                       AC_MSG_ERROR(libresolv was not found.  Citadel requires the resolver library.)
-               ]
+               [dnl Have to include resolv.h as res_query is sometimes defined as a macro
+                       AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
+                       saved_libs="$LIBS"
+                       LIBS="-lresolv $LIBS"
+                       AC_TRY_LINK([
+                               #ifdef HAVE_RESOLV_H
+                               #include <resolv.h>
+                               #endif],
+                               [res_query(0,0,0,0,0)],
+                               [AC_MSG_RESULT(yes)
+                                               have_res_query=yes],
+                               [AC_MSG_RESULT(no)
+                                       AC_MSG_ERROR(libresolv was not found.  Citadel requires the resolver library.)
+                               ])
+         ]
        )
        ;;
 esac