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

558 lines
15 KiB
Diff
Raw Normal View History

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