Blame SOURCES/autofs-5.1.4-fix-libresolv-configure-check.patch

aea863
autofs-5.1.4 - fix libresolv configure check
aea863
aea863
From: Ian Kent <raven@themaw.net>
aea863
aea863
The libresolv functions are not found by AC_CHECK_LIB() unless
aea863
they are prefixed with "__".
aea863
aea863
So change the library check to also look for __<function> during
aea863
the check.
aea863
aea863
Signed-off-by: Ian Kent <raven@themaw.net>
aea863
---
aea863
 CHANGELOG    |    1 +
aea863
 configure    |   41 +++++++++++++++++++++++++++++++++++++++++
aea863
 configure.in |    2 +-
aea863
 3 files changed, 43 insertions(+), 1 deletion(-)
aea863
aea863
diff --git a/CHANGELOG b/CHANGELOG
aea863
index a7bb89dc..dbfb8389 100644
aea863
--- a/CHANGELOG
aea863
+++ b/CHANGELOG
aea863
@@ -13,6 +13,7 @@ xx/xx/2018 autofs-5.1.5
aea863
 - fix monotonic_elapsed.
aea863
 - Makefiles.rules: remove 'samples' from SUBDIRS.
aea863
 - dont allow trailing slash in master map mount points.
aea863
+- fix libresolv configure check.
aea863
 
aea863
 19/12/2017 autofs-5.1.4
aea863
 - fix spec file url.
aea863
diff --git a/configure b/configure
aea863
index 2d517aac..5c8aae30 100755
aea863
--- a/configure
aea863
+++ b/configure
aea863
@@ -4821,6 +4821,47 @@ fi
aea863
 $as_echo "$ac_cv_lib_resolv_res_query" >&6; }
aea863
 if test "x$ac_cv_lib_resolv_res_query" = xyes; then :
aea863
   LIBRESOLV="-lresolv"
aea863
+else
aea863
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_query in -lresolv" >&5
aea863
+$as_echo_n "checking for __res_query in -lresolv... " >&6; }
aea863
+if ${ac_cv_lib_resolv___res_query+:} false; then :
aea863
+  $as_echo_n "(cached) " >&6
aea863
+else
aea863
+  ac_check_lib_save_LIBS=$LIBS
aea863
+LIBS="-lresolv  $LIBS"
aea863
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
aea863
+/* end confdefs.h.  */
aea863
+
aea863
+/* Override any GCC internal prototype to avoid an error.
aea863
+   Use char because int might match the return type of a GCC
aea863
+   builtin and then its argument prototype would still apply.  */
aea863
+#ifdef __cplusplus
aea863
+extern "C"
aea863
+#endif
aea863
+char __res_query ();
aea863
+int
aea863
+main ()
aea863
+{
aea863
+return __res_query ();
aea863
+  ;
aea863
+  return 0;
aea863
+}
aea863
+_ACEOF
aea863
+if ac_fn_c_try_link "$LINENO"; then :
aea863
+  ac_cv_lib_resolv___res_query=yes
aea863
+else
aea863
+  ac_cv_lib_resolv___res_query=no
aea863
+fi
aea863
+rm -f core conftest.err conftest.$ac_objext \
aea863
+    conftest$ac_exeext conftest.$ac_ext
aea863
+LIBS=$ac_check_lib_save_LIBS
aea863
+fi
aea863
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv___res_query" >&5
aea863
+$as_echo "$ac_cv_lib_resolv___res_query" >&6; }
aea863
+if test "x$ac_cv_lib_resolv___res_query" = xyes; then :
aea863
+  LIBRESOLV="-lresolv"
aea863
+fi
aea863
+
aea863
 fi
aea863
 
aea863
 
aea863
diff --git a/configure.in b/configure.in
aea863
index d74775cc..4d1208f5 100644
aea863
--- a/configure.in
aea863
+++ b/configure.in
aea863
@@ -217,7 +217,7 @@ AC_SUBST(NSL_LIBS)
aea863
 NSL_CFLAGS=""
aea863
 ])
aea863
 
aea863
-AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv")
aea863
+AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv", AC_CHECK_LIB(resolv, __res_query, LIBRESOLV="-lresolv"))
aea863
 AC_SUBST(LIBRESOLV)
aea863
 
aea863
 #