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

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