Blame SOURCES/autofs-5.1.4-account-for-libnsl-changes.patch

d5dcad
autofs-5.1.4 - account for recent libnsl changes
d5dcad
d5dcad
From: Ian Kent <raven@themaw.net>
d5dcad
d5dcad
The glibc RPC code has been dropped.
d5dcad
d5dcad
The NIS functionality comes in the libnsl library but it installs
d5dcad
its files into sub directories of the system include and library
d5dcad
directories.
d5dcad
d5dcad
So configure needs to check for this and allow for it in the
d5dcad
compile and linking of the NIS and NIS+ lookup modules.
d5dcad
---
d5dcad
 CHANGELOG           |    1 
d5dcad
 Makefile.conf.in    |    4 -
d5dcad
 Makefile.rules      |    2 
d5dcad
 aclocal.m4          |   45 ++++++++
d5dcad
 configure           |  288 ++++++++++++++++++++++++++++++++++++++++++++++++---
d5dcad
 configure.in        |   27 ++---
d5dcad
 include/config.h.in |    3 +
d5dcad
 modules/Makefile    |   10 ++
d5dcad
 8 files changed, 343 insertions(+), 37 deletions(-)
d5dcad
d5dcad
diff --git a/CHANGELOG b/CHANGELOG
d5dcad
index 9d19c0a7..2d5d5b1f 100644
d5dcad
--- a/CHANGELOG
d5dcad
+++ b/CHANGELOG
d5dcad
@@ -8,6 +8,7 @@ xx/xx/2018 autofs-5.1.5
d5dcad
 - fix sublink option not set from defaults.
d5dcad
 - fix error return in do_nfs_mount().
d5dcad
 - add error handling for ext_mount_add().
d5dcad
+- account for recent libnsl changes.
d5dcad
 
d5dcad
 19/12/2017 autofs-5.1.4
d5dcad
 - fix spec file url.
d5dcad
diff --git a/Makefile.conf.in b/Makefile.conf.in
d5dcad
index f879e262..85662654 100644
d5dcad
--- a/Makefile.conf.in
d5dcad
+++ b/Makefile.conf.in
d5dcad
@@ -14,8 +14,8 @@ DAEMON_LDFLAGS = @DAEMON_LDFLAGS@
d5dcad
 # Glibc < 2.17 requires librt for clock_gettime()
d5dcad
 LIBCLOCK_GETTIME = @LIBCLOCK_GETTIME@
d5dcad
 
d5dcad
-# Special parameters for glibc (libc 6)
d5dcad
-LIBNSL    = @LIBNSL@
d5dcad
+NSLLIB    = @NSL_LIBS@
d5dcad
+NSLCFLAGS = @NSL_CFLAGS@
d5dcad
 LIBRESOLV = @LIBRESOLV@
d5dcad
 
d5dcad
 # Hesiod support: yes (1) no (0)
d5dcad
diff --git a/Makefile.rules b/Makefile.rules
d5dcad
index 0edf9bfe..2bfa043c 100644
d5dcad
--- a/Makefile.rules
d5dcad
+++ b/Makefile.rules
d5dcad
@@ -54,8 +54,6 @@ ifdef DMALLOCLIB
d5dcad
 LIBS += $(DMALLOCLIB)
d5dcad
 endif
d5dcad
 
d5dcad
-LIBS += $(LIBNSL)
d5dcad
-
d5dcad
 LIBS += $(LIBCLOCK_GETTIME)
d5dcad
 
d5dcad
 # Standard rules
d5dcad
diff --git a/aclocal.m4 b/aclocal.m4
d5dcad
index 51772043..f1ed3870 100644
d5dcad
--- a/aclocal.m4
d5dcad
+++ b/aclocal.m4
d5dcad
@@ -417,3 +417,48 @@ fi
d5dcad
 LIBS="$af_check_ldap_parse_page_control_save_libs"
d5dcad
 ])
d5dcad
 
d5dcad
+dnl --------------------------------------------------------------------------
d5dcad
+dnl AF_CHECK_YPCLNT_HEADER
d5dcad
+dnl
d5dcad
+dnl Check for include file rpcsvc/ypclnt.h for YellowPages support.
d5dcad
+dnl --------------------------------------------------------------------------
d5dcad
+AC_DEFUN([AF_CHECK_YPCLNT_HEADER],
d5dcad
+[
d5dcad
+# save current CFLAGS
d5dcad
+af_check_ypclnt_header_save_cflags="$CFLAGS"
d5dcad
+CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS"
d5dcad
+
d5dcad
+HAVE_YPCLNT=0
d5dcad
+AC_CHECK_HEADER([rpcsvc/ypclnt.h], HAVE_YPCLNT=1)
d5dcad
+AC_SUBST(HAVE_YPCLNT)
d5dcad
+if test "$HAVE_YPCLNT" = "1"; then
d5dcad
+	AC_DEFINE(HAVE_YPCLNT, 1,
d5dcad
+		[Define if using YellowPages])
d5dcad
+fi
d5dcad
+
d5dcad
+# restore libs
d5dcad
+CFLAGS="$af_check_ypclnt_header_save_cflags"
d5dcad
+])
d5dcad
+
d5dcad
+dnl --------------------------------------------------------------------------
d5dcad
+dnl AF_CHECK_NIS_HEADER
d5dcad
+dnl
d5dcad
+dnl Check for include file rpcsvc/nis.h for NIS+ support.
d5dcad
+dnl --------------------------------------------------------------------------
d5dcad
+AC_DEFUN([AF_CHECK_NIS_HEADER],
d5dcad
+[
d5dcad
+# save current CFLAGS
d5dcad
+af_check_nis_header_save_cflags="$CFLAGS"
d5dcad
+CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS"
d5dcad
+
d5dcad
+HAVE_NISPLUS=0
d5dcad
+AC_CHECK_HEADER([rpcsvc/nis.h], HAVE_NISPLUS=1)
d5dcad
+AC_SUBST(HAVE_NISPLUS)
d5dcad
+if test "$HAVE_NISPLUS" = "1"; then
d5dcad
+	AC_DEFINE(HAVE_NISPLUS, 1,
d5dcad
+		[Define if using NIS+])
d5dcad
+fi
d5dcad
+
d5dcad
+# restore libs
d5dcad
+CFLAGS="$af_check_nis_header_save_cflags"
d5dcad
+])
d5dcad
diff --git a/configure b/configure
d5dcad
index 476cea4b..2d517aac 100755
d5dcad
--- a/configure
d5dcad
+++ b/configure
d5dcad
@@ -634,8 +634,8 @@ XML_FLAGS
d5dcad
 LIBLDAP
d5dcad
 HAVE_LDAP
d5dcad
 LDAP_FLAGS
d5dcad
-HAVE_YPCLNT
d5dcad
 HAVE_NISPLUS
d5dcad
+HAVE_YPCLNT
d5dcad
 EGREP
d5dcad
 GREP
d5dcad
 CPP
d5dcad
@@ -643,7 +643,8 @@ HESIOD_FLAGS
d5dcad
 LIBHESIOD
d5dcad
 HAVE_HESIOD
d5dcad
 LIBRESOLV
d5dcad
-LIBNSL
d5dcad
+NSL_LIBS
d5dcad
+NSL_CFLAGS
d5dcad
 LIBCLOCK_GETTIME
d5dcad
 KRB5_CONFIG
d5dcad
 XML_CONFIG
d5dcad
@@ -764,6 +765,8 @@ CFLAGS
d5dcad
 LDFLAGS
d5dcad
 LIBS
d5dcad
 CPPFLAGS
d5dcad
+NSL_CFLAGS
d5dcad
+NSL_LIBS
d5dcad
 CPP'
d5dcad
 
d5dcad
 
d5dcad
@@ -1417,6 +1420,8 @@ Some influential environment variables:
d5dcad
   LIBS        libraries to pass to the linker, e.g. -l<library>
d5dcad
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
d5dcad
               you have headers in a nonstandard directory <include dir>
d5dcad
+  NSL_CFLAGS  C compiler flags for NSL, overriding pkg-config
d5dcad
+  NSL_LIBS    linker flags for NSL, overriding pkg-config
d5dcad
   CPP         C preprocessor
d5dcad
 
d5dcad
 Use these variables to override the choices made by `configure' or to help
d5dcad
@@ -4500,9 +4505,186 @@ fi
d5dcad
 
d5dcad
 
d5dcad
 
d5dcad
-#
d5dcad
-# glibc/libc 6 new libraries
d5dcad
-#
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
d5dcad
+	if test -n "$ac_tool_prefix"; then
d5dcad
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
d5dcad
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
d5dcad
+$as_echo_n "checking for $ac_word... " >&6; }
d5dcad
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
d5dcad
+  $as_echo_n "(cached) " >&6
d5dcad
+else
d5dcad
+  case $PKG_CONFIG in
d5dcad
+  [\\/]* | ?:[\\/]*)
d5dcad
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
d5dcad
+  ;;
d5dcad
+  *)
d5dcad
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
d5dcad
+for as_dir in $PATH
d5dcad
+do
d5dcad
+  IFS=$as_save_IFS
d5dcad
+  test -z "$as_dir" && as_dir=.
d5dcad
+    for ac_exec_ext in '' $ac_executable_extensions; do
d5dcad
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
d5dcad
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
d5dcad
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
d5dcad
+    break 2
d5dcad
+  fi
d5dcad
+done
d5dcad
+  done
d5dcad
+IFS=$as_save_IFS
d5dcad
+
d5dcad
+  ;;
d5dcad
+esac
d5dcad
+fi
d5dcad
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
d5dcad
+if test -n "$PKG_CONFIG"; then
d5dcad
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
d5dcad
+$as_echo "$PKG_CONFIG" >&6; }
d5dcad
+else
d5dcad
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
+$as_echo "no" >&6; }
d5dcad
+fi
d5dcad
+
d5dcad
+
d5dcad
+fi
d5dcad
+if test -z "$ac_cv_path_PKG_CONFIG"; then
d5dcad
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
d5dcad
+  # Extract the first word of "pkg-config", so it can be a program name with args.
d5dcad
+set dummy pkg-config; ac_word=$2
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
d5dcad
+$as_echo_n "checking for $ac_word... " >&6; }
d5dcad
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
d5dcad
+  $as_echo_n "(cached) " >&6
d5dcad
+else
d5dcad
+  case $ac_pt_PKG_CONFIG in
d5dcad
+  [\\/]* | ?:[\\/]*)
d5dcad
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
d5dcad
+  ;;
d5dcad
+  *)
d5dcad
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
d5dcad
+for as_dir in $PATH
d5dcad
+do
d5dcad
+  IFS=$as_save_IFS
d5dcad
+  test -z "$as_dir" && as_dir=.
d5dcad
+    for ac_exec_ext in '' $ac_executable_extensions; do
d5dcad
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
d5dcad
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
d5dcad
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
d5dcad
+    break 2
d5dcad
+  fi
d5dcad
+done
d5dcad
+  done
d5dcad
+IFS=$as_save_IFS
d5dcad
+
d5dcad
+  ;;
d5dcad
+esac
d5dcad
+fi
d5dcad
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
d5dcad
+if test -n "$ac_pt_PKG_CONFIG"; then
d5dcad
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
d5dcad
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
d5dcad
+else
d5dcad
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
+$as_echo "no" >&6; }
d5dcad
+fi
d5dcad
+
d5dcad
+  if test "x$ac_pt_PKG_CONFIG" = x; then
d5dcad
+    PKG_CONFIG=""
d5dcad
+  else
d5dcad
+    case $cross_compiling:$ac_tool_warned in
d5dcad
+yes:)
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
d5dcad
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
d5dcad
+ac_tool_warned=yes ;;
d5dcad
+esac
d5dcad
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
d5dcad
+  fi
d5dcad
+else
d5dcad
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
d5dcad
+fi
d5dcad
+
d5dcad
+fi
d5dcad
+if test -n "$PKG_CONFIG"; then
d5dcad
+	_pkg_min_version=0.9.0
d5dcad
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
d5dcad
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
d5dcad
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
d5dcad
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
d5dcad
+$as_echo "yes" >&6; }
d5dcad
+	else
d5dcad
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
+$as_echo "no" >&6; }
d5dcad
+		PKG_CONFIG=""
d5dcad
+	fi
d5dcad
+fi
d5dcad
+
d5dcad
+pkg_failed=no
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSL" >&5
d5dcad
+$as_echo_n "checking for NSL... " >&6; }
d5dcad
+
d5dcad
+if test -n "$NSL_CFLAGS"; then
d5dcad
+    pkg_cv_NSL_CFLAGS="$NSL_CFLAGS"
d5dcad
+ elif test -n "$PKG_CONFIG"; then
d5dcad
+    if test -n "$PKG_CONFIG" && \
d5dcad
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5
d5dcad
+  ($PKG_CONFIG --exists --print-errors "libnsl") 2>&5
d5dcad
+  ac_status=$?
d5dcad
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
d5dcad
+  test $ac_status = 0; }; then
d5dcad
+  pkg_cv_NSL_CFLAGS=`$PKG_CONFIG --cflags "libnsl" 2>/dev/null`
d5dcad
+		      test "x$?" != "x0" && pkg_failed=yes
d5dcad
+else
d5dcad
+  pkg_failed=yes
d5dcad
+fi
d5dcad
+ else
d5dcad
+    pkg_failed=untried
d5dcad
+fi
d5dcad
+if test -n "$NSL_LIBS"; then
d5dcad
+    pkg_cv_NSL_LIBS="$NSL_LIBS"
d5dcad
+ elif test -n "$PKG_CONFIG"; then
d5dcad
+    if test -n "$PKG_CONFIG" && \
d5dcad
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5
d5dcad
+  ($PKG_CONFIG --exists --print-errors "libnsl") 2>&5
d5dcad
+  ac_status=$?
d5dcad
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
d5dcad
+  test $ac_status = 0; }; then
d5dcad
+  pkg_cv_NSL_LIBS=`$PKG_CONFIG --libs "libnsl" 2>/dev/null`
d5dcad
+		      test "x$?" != "x0" && pkg_failed=yes
d5dcad
+else
d5dcad
+  pkg_failed=yes
d5dcad
+fi
d5dcad
+ else
d5dcad
+    pkg_failed=untried
d5dcad
+fi
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+if test $pkg_failed = yes; then
d5dcad
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
+$as_echo "no" >&6; }
d5dcad
+
d5dcad
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
d5dcad
+        _pkg_short_errors_supported=yes
d5dcad
+else
d5dcad
+        _pkg_short_errors_supported=no
d5dcad
+fi
d5dcad
+        if test $_pkg_short_errors_supported = yes; then
d5dcad
+	        NSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnsl" 2>&1`
d5dcad
+        else
d5dcad
+	        NSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnsl" 2>&1`
d5dcad
+        fi
d5dcad
+	# Put the nasty error message in config.log where it belongs
d5dcad
+	echo "$NSL_PKG_ERRORS" >&5
d5dcad
+
d5dcad
+
d5dcad
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5
d5dcad
 $as_echo_n "checking for yp_match in -lnsl... " >&6; }
d5dcad
 if ${ac_cv_lib_nsl_yp_match+:} false; then :
d5dcad
@@ -4540,10 +4722,66 @@ fi
d5dcad
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_yp_match" >&5
d5dcad
 $as_echo "$ac_cv_lib_nsl_yp_match" >&6; }
d5dcad
 if test "x$ac_cv_lib_nsl_yp_match" = xyes; then :
d5dcad
-  LIBNSL="-lnsl"
d5dcad
+  NSL_LIBS="-lnsl"
d5dcad
 fi
d5dcad
 
d5dcad
 
d5dcad
+NSL_CFLAGS=""
d5dcad
+
d5dcad
+elif test $pkg_failed = untried; then
d5dcad
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
+$as_echo "no" >&6; }
d5dcad
+
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5
d5dcad
+$as_echo_n "checking for yp_match in -lnsl... " >&6; }
d5dcad
+if ${ac_cv_lib_nsl_yp_match+:} false; then :
d5dcad
+  $as_echo_n "(cached) " >&6
d5dcad
+else
d5dcad
+  ac_check_lib_save_LIBS=$LIBS
d5dcad
+LIBS="-lnsl  $LIBS"
d5dcad
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
d5dcad
+/* end confdefs.h.  */
d5dcad
+
d5dcad
+/* Override any GCC internal prototype to avoid an error.
d5dcad
+   Use char because int might match the return type of a GCC
d5dcad
+   builtin and then its argument prototype would still apply.  */
d5dcad
+#ifdef __cplusplus
d5dcad
+extern "C"
d5dcad
+#endif
d5dcad
+char yp_match ();
d5dcad
+int
d5dcad
+main ()
d5dcad
+{
d5dcad
+return yp_match ();
d5dcad
+  ;
d5dcad
+  return 0;
d5dcad
+}
d5dcad
+_ACEOF
d5dcad
+if ac_fn_c_try_link "$LINENO"; then :
d5dcad
+  ac_cv_lib_nsl_yp_match=yes
d5dcad
+else
d5dcad
+  ac_cv_lib_nsl_yp_match=no
d5dcad
+fi
d5dcad
+rm -f core conftest.err conftest.$ac_objext \
d5dcad
+    conftest$ac_exeext conftest.$ac_ext
d5dcad
+LIBS=$ac_check_lib_save_LIBS
d5dcad
+fi
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_yp_match" >&5
d5dcad
+$as_echo "$ac_cv_lib_nsl_yp_match" >&6; }
d5dcad
+if test "x$ac_cv_lib_nsl_yp_match" = xyes; then :
d5dcad
+  NSL_LIBS="-lnsl"
d5dcad
+fi
d5dcad
+
d5dcad
+
d5dcad
+NSL_CFLAGS=""
d5dcad
+
d5dcad
+else
d5dcad
+	NSL_CFLAGS=$pkg_cv_NSL_CFLAGS
d5dcad
+	NSL_LIBS=$pkg_cv_NSL_LIBS
d5dcad
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
d5dcad
+$as_echo "yes" >&6; }
d5dcad
+
d5dcad
+fi
d5dcad
 
d5dcad
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_query in -lresolv" >&5
d5dcad
 $as_echo_n "checking for res_query in -lresolv... " >&6; }
d5dcad
@@ -4659,8 +4897,6 @@ fi
d5dcad
 
d5dcad
 LDFLAGS="${AF_tmp_ldflags}"
d5dcad
 
d5dcad
-# NIS+ support?
d5dcad
-HAVE_NISPLUS=0
d5dcad
 ac_ext=c
d5dcad
 ac_cpp='$CPP $CPPFLAGS'
d5dcad
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
d5dcad
@@ -5058,15 +5294,11 @@ fi
d5dcad
 done
d5dcad
 
d5dcad
 
d5dcad
-ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/nis.h" "ac_cv_header_rpcsvc_nis_h" "$ac_includes_default"
d5dcad
-if test "x$ac_cv_header_rpcsvc_nis_h" = xyes; then :
d5dcad
-  HAVE_NISPLUS=1
d5dcad
-fi
d5dcad
-
d5dcad
 
d5dcad
+# save current CFLAGS
d5dcad
+af_check_ypclnt_header_save_cflags="$CFLAGS"
d5dcad
+CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS"
d5dcad
 
d5dcad
-
d5dcad
-# YellowPages support?
d5dcad
 HAVE_YPCLNT=0
d5dcad
 ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/ypclnt.h" "ac_cv_header_rpcsvc_ypclnt_h" "$ac_includes_default"
d5dcad
 if test "x$ac_cv_header_rpcsvc_ypclnt_h" = xyes; then :
d5dcad
@@ -5081,6 +5313,32 @@ $as_echo "#define HAVE_YPCLNT 1" >>confdefs.h
d5dcad
 
d5dcad
 fi
d5dcad
 
d5dcad
+# restore libs
d5dcad
+CFLAGS="$af_check_ypclnt_header_save_cflags"
d5dcad
+
d5dcad
+
d5dcad
+# save current CFLAGS
d5dcad
+af_check_nis_header_save_cflags="$CFLAGS"
d5dcad
+CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS"
d5dcad
+
d5dcad
+HAVE_NISPLUS=0
d5dcad
+ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/nis.h" "ac_cv_header_rpcsvc_nis_h" "$ac_includes_default"
d5dcad
+if test "x$ac_cv_header_rpcsvc_nis_h" = xyes; then :
d5dcad
+  HAVE_NISPLUS=1
d5dcad
+fi
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+if test "$HAVE_NISPLUS" = "1"; then
d5dcad
+
d5dcad
+$as_echo "#define HAVE_NISPLUS 1" >>confdefs.h
d5dcad
+
d5dcad
+fi
d5dcad
+
d5dcad
+# restore libs
d5dcad
+CFLAGS="$af_check_nis_header_save_cflags"
d5dcad
+
d5dcad
+
d5dcad
 #
d5dcad
 # OpenLDAP support?  Expect that this may have a special directory...
d5dcad
 #
d5dcad
diff --git a/configure.in b/configure.in
d5dcad
index d3660923..d74775cc 100644
d5dcad
--- a/configure.in
d5dcad
+++ b/configure.in
d5dcad
@@ -209,11 +209,13 @@ fi
d5dcad
 AC_CHECK_LIB(rt, clock_gettime, LIBCLOCK_GETTIME="-lrt")
d5dcad
 AC_SUBST(LIBCLOCK_GETTIME)
d5dcad
 
d5dcad
-#
d5dcad
-# glibc/libc 6 new libraries
d5dcad
-#
d5dcad
-AC_CHECK_LIB(nsl, yp_match, LIBNSL="-lnsl")
d5dcad
-AC_SUBST(LIBNSL)
d5dcad
+PKG_PROG_PKG_CONFIG()
d5dcad
+PKG_CHECK_MODULES([NSL],[libnsl],,
d5dcad
+[
d5dcad
+AC_CHECK_LIB(nsl, yp_match, NSL_LIBS="-lnsl")
d5dcad
+AC_SUBST(NSL_LIBS)
d5dcad
+NSL_CFLAGS=""
d5dcad
+])
d5dcad
 
d5dcad
 AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv")
d5dcad
 AC_SUBST(LIBRESOLV)
d5dcad
@@ -254,19 +256,8 @@ AC_SUBST(LIBHESIOD)
d5dcad
 AC_SUBST(HESIOD_FLAGS)
d5dcad
 LDFLAGS="${AF_tmp_ldflags}"
d5dcad
 
d5dcad
-# NIS+ support?
d5dcad
-HAVE_NISPLUS=0
d5dcad
-AC_CHECK_HEADER(rpcsvc/nis.h, HAVE_NISPLUS=1)
d5dcad
-AC_SUBST(HAVE_NISPLUS)
d5dcad
-
d5dcad
-# YellowPages support?
d5dcad
-HAVE_YPCLNT=0
d5dcad
-AC_CHECK_HEADER([rpcsvc/ypclnt.h], HAVE_YPCLNT=1)
d5dcad
-AC_SUBST(HAVE_YPCLNT)
d5dcad
-if test "$HAVE_YPCLNT" = "1"; then
d5dcad
-	AC_DEFINE(HAVE_YPCLNT, 1,
d5dcad
-		[Define if using YellowPages])
d5dcad
-fi
d5dcad
+AF_CHECK_YPCLNT_HEADER()
d5dcad
+AF_CHECK_NIS_HEADER()
d5dcad
 
d5dcad
 #
d5dcad
 # OpenLDAP support?  Expect that this may have a special directory...
d5dcad
diff --git a/include/config.h.in b/include/config.h.in
d5dcad
index 04873e8f..991a2bda 100644
d5dcad
--- a/include/config.h.in
d5dcad
+++ b/include/config.h.in
d5dcad
@@ -57,6 +57,9 @@
d5dcad
 /* define if you have MOUNT_NFS */
d5dcad
 #undef HAVE_MOUNT_NFS
d5dcad
 
d5dcad
+/* Define if using NIS+ */
d5dcad
+#undef HAVE_NISPLUS
d5dcad
+
d5dcad
 /* define if the umount command supports the -c option */
d5dcad
 #undef HAVE_NO_CANON_UMOUNT
d5dcad
 
d5dcad
diff --git a/modules/Makefile b/modules/Makefile
d5dcad
index d9ab06c5..0447559a 100644
d5dcad
--- a/modules/Makefile
d5dcad
+++ b/modules/Makefile
d5dcad
@@ -116,6 +116,16 @@ parse_amd.so: parse_amd.c amd_parse.tab.o amd_tok.o
d5dcad
 #
d5dcad
 # Ad hoc compilation rules for modules which need auxilliary libraries
d5dcad
 #
d5dcad
+lookup_yp.so: lookup_yp.c
d5dcad
+	$(CC) $(SOLDFLAGS) $(CFLAGS) $(NSLCFLAGS) -o lookup_yp.so \
d5dcad
+		lookup_yp.c $(LDFLAGS) $(AUTOFS_LIB) $(LIBS) $(NSLLIB)
d5dcad
+	$(STRIP) lookup_yp.so
d5dcad
+
d5dcad
+lookup_nisplus.so: lookup_nisplus.c
d5dcad
+	$(CC) $(SOLDFLAGS) $(CFLAGS) $(NSLCFLAGS) -o lookup_nisplus.so \
d5dcad
+		lookup_nisplus.c $(LDFLAGS) $(AUTOFS_LIB) $(LIBS) $(NSLLIB)
d5dcad
+	$(STRIP) lookup_nisplus.so
d5dcad
+
d5dcad
 lookup_hesiod.so: lookup_hesiod.c
d5dcad
 	$(CC) $(SOLDFLAGS) $(CFLAGS) $(HESIOD_FLAGS) -o lookup_hesiod.so \
d5dcad
 		lookup_hesiod.c $(LDFLAGS) $(AUTOFS_LIB) $(LIBHESIOD) $(LIBRESOLV) $(LIBS)