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

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