]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
configure.ac: fix res_query detection 9820/head
authorJohn Coyle <dx9err@gmail.com>
Sun, 6 Mar 2016 02:42:12 +0000 (21:42 -0500)
committerJohn Coyle <dx9err@gmail.com>
Thu, 23 Jun 2016 00:43:16 +0000 (20:43 -0400)
Signed-off-by: John Coyle <dx9err@gmail.com>
configure.ac

index b83cdf9e4e91e06cb2f8ba053a05869625c76556..bda5f815bb6f57713ab296db8a04b22192d2716f 100644 (file)
@@ -354,38 +354,42 @@ if test x"$linux" = x"yes"; then
 fi
 
 #
-# Check for res_nquery in libresolv. There are several variations. On OSX
+# Check for res_nquery or res_query in libresolv. There are several variations. On OSX
 # res_nquery is a macro defined in resolv.h, so the typical AC_CHECK_LIB
-# doesn't work. On FreeBSD res_nquery can be found in libc. The required
-# library for linking (if any) is defined RESOLV_LIBS.
+# doesn't work. On FreeBSD res_nquery can be found in libc. On Alpine res_query can be
+# found in libc. The required library for linking (if any) is defined RESOLV_LIBS.
 #
 AC_CHECK_HEADER([resolv.h], [], [], [#include <netinet/in.h>])
 
 AC_DEFUN([CHECK_RESOLV_LIBS], [{
-  AC_MSG_CHECKING([if res_nquery will link (LIBS=$1)])
+  AC_MSG_CHECKING([if $1 will link (LIBS=$3)])
   saved_LIBS="${LIBS}"
-  LIBS="$1"
+  LIBS="$3"
   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
         #include <netinet/in.h>
         #include <resolv.h>
-      ]], [[res_nquery(0, 0, 0, 0, 0, 0);]])],
+      ]], [[$1$2;]])],
       [AC_MSG_RESULT([yes])
-      [$2]],
+      AC_DEFINE(AS_TR_CPP([HAVE_$1]), 1, [Define if you have $1])
+      [$4]],
       AC_MSG_RESULT([no]))
   LIBS="${saved_LIBS}"
 }])
 
 RESOLV_LIBS=""
-CHECK_RESOLV_LIBS([$RESOLV_LIBS], [resolv_libs="ok"])
+CHECK_RESOLV_LIBS([res_nquery], [(0, 0, 0, 0, 0, 0)], [$RESOLV_LIBS], [resolv_libs="ok"])
 if test x"$resolv_libs" != "xok"; then
   RESOLV_LIBS="-lresolv"
-  CHECK_RESOLV_LIBS([$RESOLV_LIBS], [resolv_libs="ok"])
+  CHECK_RESOLV_LIBS([res_nquery], [(0, 0, 0, 0, 0, 0)], [$RESOLV_LIBS], [resolv_libs="ok"])
   if test x"$resolv_libs" != "xok"; then
-    AC_MSG_FAILURE([no resolv library found])
+    RESOLV_LIBS=""
+    CHECK_RESOLV_LIBS([res_query], [(0, 0, 0, 0, 0)], [$RESOLV_LIBS], [resolv_libs="ok"])
+    if test x"$resolv_libs" != "xok"; then
+      AC_MSG_FAILURE([no resolv library found])
+    fi
   fi
 fi
 AC_SUBST([RESOLV_LIBS])
-AC_DEFINE(HAVE_RES_NQUERY, 1, [Define if you have res_nquery])
 
 dnl check for libkeyutils on linux
 KEYUTILS_LIB=""