Blame SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch

d5dcad
autofs-5.1.4 - use systemd sd_notify() at startup
d5dcad
d5dcad
From: Ian Kent <raven@themaw.net>
d5dcad
d5dcad
autofs needs to ensure statd is started before any NFS mounts
d5dcad
are attempted.
d5dcad
d5dcad
When starting the statd service with the autofs service the statd
d5dcad
service will trigger a restart of the autofs service during its
d5dcad
start up. Sometimes this can happen during the automount start up
d5dcad
itself.
d5dcad
d5dcad
When this happens it causes systemd to become confused and remove
d5dcad
the pid file created by automount leaving systemd thinking the
d5dcad
autofs service had failed start up when it was actually running.
d5dcad
d5dcad
It was recommened that autofs be changed to a "Type=notify" service
d5dcad
to avoid this. Using this a pid file is no longer needed and is now
d5dcad
not used.
d5dcad
d5dcad
Signed-off-by: Ian Kent <raven@themaw.net>
d5dcad
---
d5dcad
 CHANGELOG                 |    1 
d5dcad
 Makefile.conf.in          |    3 
d5dcad
 aclocal.m4                |    3 
d5dcad
 autofs.spec               |    1 
d5dcad
 configure                 |  948 +++++++++++++++++++++++++++-------------------
d5dcad
 configure.in              |    8 
d5dcad
 daemon/Makefile           |    5 
d5dcad
 daemon/automount.c        |   83 ++--
d5dcad
 samples/autofs.service.in |    5 
d5dcad
 9 files changed, 635 insertions(+), 422 deletions(-)
d5dcad
d5dcad
--- autofs-5.1.4.orig/CHANGELOG
d5dcad
+++ autofs-5.1.4/CHANGELOG
d5dcad
@@ -22,6 +22,7 @@ xx/xx/2018 autofs-5.1.5
d5dcad
 - improve hostname lookup error logging.
d5dcad
 - tiny patch for autofs typo and possible bug.
d5dcad
 - add units After line to include statd service.
d5dcad
+- use systemd sd_notify() at startup.
d5dcad
 
d5dcad
 19/12/2017 autofs-5.1.4
d5dcad
 - fix spec file url.
d5dcad
--- autofs-5.1.4.orig/Makefile.conf.in
d5dcad
+++ autofs-5.1.4/Makefile.conf.in
d5dcad
@@ -18,6 +18,9 @@ NSLLIB    = @NSL_LIBS@
d5dcad
 NSLCFLAGS = @NSL_CFLAGS@
d5dcad
 LIBRESOLV = @LIBRESOLV@
d5dcad
 
d5dcad
+SYSTEMD = @WITH_SYSTEMD@
d5dcad
+LIBSYSTEMD = @systemd_LIBS@
d5dcad
+
d5dcad
 # Hesiod support: yes (1) no (0)
d5dcad
 HESIOD = @HAVE_HESIOD@
d5dcad
 LIBHESIOD = @LIBHESIOD@
d5dcad
--- autofs-5.1.4.orig/aclocal.m4
d5dcad
+++ autofs-5.1.4/aclocal.m4
d5dcad
@@ -257,14 +257,17 @@ AC_DEFUN([AF_WITH_SYSTEMD],
d5dcad
       fi
d5dcad
     done
d5dcad
   fi
d5dcad
+  WITH_SYSTEMD=0
d5dcad
   if test -n "$systemddir"; then
d5dcad
     AC_MSG_RESULT($systemddir)
d5dcad
+    WITH_SYSTEMD=1
d5dcad
   else
d5dcad
     AC_MSG_RESULT(not found)
d5dcad
   fi
d5dcad
 else
d5dcad
  if test "$withval" != no; then
d5dcad
   systemddir=$withval
d5dcad
+  WITH_SYSTEMD=1
d5dcad
  fi
d5dcad
 fi])
d5dcad
 ])
d5dcad
--- autofs-5.1.4.orig/autofs.spec
d5dcad
+++ autofs-5.1.4/autofs.spec
d5dcad
@@ -32,6 +32,7 @@ Source: https://www.kernel.org/pub/linux
d5dcad
 Buildroot: %{_tmppath}/%{name}-tmp
d5dcad
 %if %{with_systemd}
d5dcad
 BuildRequires: systemd-units
d5dcad
+BuildRequires: systemd-devel
d5dcad
 %endif
d5dcad
 %if %{with_libtirpc}
d5dcad
 BuildRequires: libtirpc-devel
d5dcad
--- autofs-5.1.4.orig/configure
d5dcad
+++ autofs-5.1.4/configure
d5dcad
@@ -674,6 +674,12 @@ MOUNT_NFS
d5dcad
 HAVE_MOUNT
d5dcad
 MOUNT
d5dcad
 DMALLOCLIB
d5dcad
+TIRPC_LIBS
d5dcad
+TIRPC_CFLAGS
d5dcad
+flagdir
d5dcad
+fifodir
d5dcad
+mapdir
d5dcad
+confdir
d5dcad
 OBJEXT
d5dcad
 EXEEXT
d5dcad
 ac_ct_CC
d5dcad
@@ -681,16 +687,13 @@ CPPFLAGS
d5dcad
 LDFLAGS
d5dcad
 CFLAGS
d5dcad
 CC
d5dcad
-TIRPC_LIBS
d5dcad
-TIRPC_CFLAGS
d5dcad
+systemd_LIBS
d5dcad
+systemd_CFLAGS
d5dcad
+WITH_SYSTEMD
d5dcad
+systemddir
d5dcad
 PKG_CONFIG_LIBDIR
d5dcad
 PKG_CONFIG_PATH
d5dcad
 PKG_CONFIG
d5dcad
-flagdir
d5dcad
-fifodir
d5dcad
-mapdir
d5dcad
-confdir
d5dcad
-systemddir
d5dcad
 piddir
d5dcad
 initdir
d5dcad
 target_alias
d5dcad
@@ -760,13 +763,15 @@ target_alias
d5dcad
 PKG_CONFIG
d5dcad
 PKG_CONFIG_PATH
d5dcad
 PKG_CONFIG_LIBDIR
d5dcad
-TIRPC_CFLAGS
d5dcad
-TIRPC_LIBS
d5dcad
+systemd_CFLAGS
d5dcad
+systemd_LIBS
d5dcad
 CC
d5dcad
 CFLAGS
d5dcad
 LDFLAGS
d5dcad
 LIBS
d5dcad
 CPPFLAGS
d5dcad
+TIRPC_CFLAGS
d5dcad
+TIRPC_LIBS
d5dcad
 NSL_CFLAGS
d5dcad
 NSL_LIBS
d5dcad
 CPP'
d5dcad
@@ -1413,9 +1418,10 @@ Some influential environment variables:
d5dcad
               directories to add to pkg-config's search path
d5dcad
   PKG_CONFIG_LIBDIR
d5dcad
               path overriding pkg-config's built-in search path
d5dcad
-  TIRPC_CFLAGS
d5dcad
-              C compiler flags for TIRPC, overriding pkg-config
d5dcad
-  TIRPC_LIBS  linker flags for TIRPC, overriding pkg-config
d5dcad
+  systemd_CFLAGS
d5dcad
+              C compiler flags for systemd, overriding pkg-config
d5dcad
+  systemd_LIBS
d5dcad
+              linker flags for systemd, overriding pkg-config
d5dcad
   CC          C compiler command
d5dcad
   CFLAGS      C compiler flags
d5dcad
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
d5dcad
@@ -1423,6 +1429,9 @@ 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
+  TIRPC_CFLAGS
d5dcad
+              C compiler flags for TIRPC, overriding pkg-config
d5dcad
+  TIRPC_LIBS  linker flags for TIRPC, overriding pkg-config
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
@@ -2291,166 +2300,6 @@ if test -z "$piddir"; then
d5dcad
 fi
d5dcad
 
d5dcad
 
d5dcad
-#
d5dcad
-# Check for systemd unit files direectory exists if unit file installation
d5dcad
-# is requested
d5dcad
-#
d5dcad
-
d5dcad
-# Check whether --with-systemd was given.
d5dcad
-if test "${with_systemd+set}" = set; then :
d5dcad
-  withval=$with_systemd; if test "$withval" = yes; then
d5dcad
-  if test -z "$systemddir"; then
d5dcad
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
d5dcad
-$as_echo_n "checking location of the systemd unit files directory... " >&6; }
d5dcad
-    for systemd_d in /usr/lib/systemd/system /usr/lib64/systemd/system /lib/systemd/system /lib64/systemd/system; do
d5dcad
-      if test -z "$systemddir"; then
d5dcad
-        if test -d "$systemd_d"; then
d5dcad
-          systemddir="$systemd_d"
d5dcad
-        fi
d5dcad
-      fi
d5dcad
-    done
d5dcad
-  fi
d5dcad
-  if test -n "$systemddir"; then
d5dcad
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
d5dcad
-$as_echo "$systemddir" >&6; }
d5dcad
-  else
d5dcad
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
d5dcad
-$as_echo "not found" >&6; }
d5dcad
-  fi
d5dcad
-else
d5dcad
- if test "$withval" != no; then
d5dcad
-  systemddir=$withval
d5dcad
- fi
d5dcad
-fi
d5dcad
-fi
d5dcad
-
d5dcad
-
d5dcad
-
d5dcad
-
d5dcad
-#
d5dcad
-# Location of system config script directory?
d5dcad
-#
d5dcad
-if test -z "$confdir"; then
d5dcad
-  for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do
d5dcad
-    if test -z "$confdir"; then
d5dcad
-      if test -d "$conf_d"; then
d5dcad
-	confdir="$conf_d"
d5dcad
-      fi
d5dcad
-    fi
d5dcad
-  done
d5dcad
-fi
d5dcad
-
d5dcad
-# Check whether --with-confdir was given.
d5dcad
-if test "${with_confdir+set}" = set; then :
d5dcad
-  withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
-	then
d5dcad
-		:
d5dcad
-	else
d5dcad
-		confdir="${withval}"
d5dcad
-	fi
d5dcad
-
d5dcad
-fi
d5dcad
-
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5
d5dcad
-$as_echo_n "checking for autofs configuration file directory... " >&6; }
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5
d5dcad
-$as_echo "$confdir" >&6; }
d5dcad
-
d5dcad
-
d5dcad
-#
d5dcad
-# The user can specify --with-mapsdir=PATH to specify autofs maps go
d5dcad
-#
d5dcad
-if test -z "$mapdir"; then
d5dcad
-  for map_d in /etc/autofs /etc; do
d5dcad
-    if test -z "$mapdir"; then
d5dcad
-      if test -d "$map_d"; then
d5dcad
-	mapdir="$map_d"
d5dcad
-      fi
d5dcad
-    fi
d5dcad
-  done
d5dcad
-fi
d5dcad
-
d5dcad
-# Check whether --with-mapdir was given.
d5dcad
-if test "${with_mapdir+set}" = set; then :
d5dcad
-  withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
-	then
d5dcad
-		:
d5dcad
-	else
d5dcad
-		mapdir="${withval}"
d5dcad
-	fi
d5dcad
-
d5dcad
-fi
d5dcad
-
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5
d5dcad
-$as_echo_n "checking for autofs maps directory... " >&6; }
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5
d5dcad
-$as_echo "$mapdir" >&6; }
d5dcad
-
d5dcad
-
d5dcad
-#
d5dcad
-# The user can specify --with-fifodir=PATH to specify where autofs fifos go
d5dcad
-#
d5dcad
-if test -z "$fifodir"; then
d5dcad
-  for fifo_d in /run /var/run /tmp; do
d5dcad
-    if test -z "$fifodir"; then
d5dcad
-      if test -d "$fifo_d"; then
d5dcad
-        fifodir="$fifo_d"
d5dcad
-      fi
d5dcad
-    fi
d5dcad
-  done
d5dcad
-fi
d5dcad
-
d5dcad
-# Check whether --with-fifodir was given.
d5dcad
-if test "${with_fifodir+set}" = set; then :
d5dcad
-  withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
-	then
d5dcad
-		:
d5dcad
-	else
d5dcad
-		fifodir="${withval}"
d5dcad
-	fi
d5dcad
-
d5dcad
-fi
d5dcad
-
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5
d5dcad
-$as_echo_n "checking for autofs fifos directory... " >&6; }
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5
d5dcad
-$as_echo "$fifodir" >&6; }
d5dcad
-
d5dcad
-
d5dcad
-#
d5dcad
-# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
d5dcad
-#
d5dcad
-if test -z "$flagdir"; then
d5dcad
-  for flag_d in /run /var/run /tmp; do
d5dcad
-    if test -z "$flagdir"; then
d5dcad
-      if test -d "$flag_d"; then
d5dcad
-        flagdir="$flag_d"
d5dcad
-      fi
d5dcad
-    fi
d5dcad
-  done
d5dcad
-fi
d5dcad
-
d5dcad
-# Check whether --with-flagdir was given.
d5dcad
-if test "${with_flagdir+set}" = set; then :
d5dcad
-  withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
-	then
d5dcad
-		:
d5dcad
-	else
d5dcad
-		flagdir="${withval}"
d5dcad
-	fi
d5dcad
-
d5dcad
-fi
d5dcad
-
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5
d5dcad
-$as_echo_n "checking for autofs flag file directory... " >&6; }
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5
d5dcad
-$as_echo "$flagdir" >&6; }
d5dcad
-
d5dcad
-
d5dcad
-#
d5dcad
-# Use libtirpc
d5dcad
-#
d5dcad
-
d5dcad
 
d5dcad
 
d5dcad
 
d5dcad
@@ -2571,111 +2420,46 @@ $as_echo "no" >&6; }
d5dcad
 	fi
d5dcad
 fi
d5dcad
 
d5dcad
-# Check whether --with-libtirpc was given.
d5dcad
-if test "${with_libtirpc+set}" = set; then :
d5dcad
-  withval=$with_libtirpc;
d5dcad
-fi
d5dcad
-
d5dcad
-if test "x$with_libtirpc" = "xyes"; then
d5dcad
-
d5dcad
-pkg_failed=no
d5dcad
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIRPC" >&5
d5dcad
-$as_echo_n "checking for TIRPC... " >&6; }
d5dcad
+#
d5dcad
+# Check for systemd unit files direectory exists if unit file installation
d5dcad
+# is requested
d5dcad
+#
d5dcad
 
d5dcad
-if test -n "$TIRPC_CFLAGS"; then
d5dcad
-    pkg_cv_TIRPC_CFLAGS="$TIRPC_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 \"libtirpc\""; } >&5
d5dcad
-  ($PKG_CONFIG --exists --print-errors "libtirpc") 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_TIRPC_CFLAGS=`$PKG_CONFIG --cflags "libtirpc" 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 "$TIRPC_LIBS"; then
d5dcad
-    pkg_cv_TIRPC_LIBS="$TIRPC_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 \"libtirpc\""; } >&5
d5dcad
-  ($PKG_CONFIG --exists --print-errors "libtirpc") 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_TIRPC_LIBS=`$PKG_CONFIG --libs "libtirpc" 2>/dev/null`
d5dcad
-		      test "x$?" != "x0" && pkg_failed=yes
d5dcad
+# Check whether --with-systemd was given.
d5dcad
+if test "${with_systemd+set}" = set; then :
d5dcad
+  withval=$with_systemd; if test "$withval" = yes; then
d5dcad
+  if test -z "$systemddir"; then
d5dcad
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
d5dcad
+$as_echo_n "checking location of the systemd unit files directory... " >&6; }
d5dcad
+    for systemd_d in /usr/lib/systemd/system /usr/lib64/systemd/system /lib/systemd/system /lib64/systemd/system; do
d5dcad
+      if test -z "$systemddir"; then
d5dcad
+        if test -d "$systemd_d"; then
d5dcad
+          systemddir="$systemd_d"
d5dcad
+        fi
d5dcad
+      fi
d5dcad
+    done
d5dcad
+  fi
d5dcad
+  WITH_SYSTEMD=0
d5dcad
+  if test -n "$systemddir"; then
d5dcad
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
d5dcad
+$as_echo "$systemddir" >&6; }
d5dcad
+    WITH_SYSTEMD=1
d5dcad
+  else
d5dcad
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
d5dcad
+$as_echo "not found" >&6; }
d5dcad
+  fi
d5dcad
 else
d5dcad
-  pkg_failed=yes
d5dcad
-fi
d5dcad
- else
d5dcad
-    pkg_failed=untried
d5dcad
+ if test "$withval" != no; then
d5dcad
+  systemddir=$withval
d5dcad
+  WITH_SYSTEMD=1
d5dcad
+ fi
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
-	        TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1`
d5dcad
-        else
d5dcad
-	        TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1`
d5dcad
-        fi
d5dcad
-	# Put the nasty error message in config.log where it belongs
d5dcad
-	echo "$TIRPC_PKG_ERRORS" >&5
d5dcad
-
d5dcad
-	as_fn_error $? "Package requirements (libtirpc) were not met:
d5dcad
-
d5dcad
-$TIRPC_PKG_ERRORS
d5dcad
-
d5dcad
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
d5dcad
-installed software in a non-standard prefix.
d5dcad
 
d5dcad
-Alternatively, you may set the environment variables TIRPC_CFLAGS
d5dcad
-and TIRPC_LIBS to avoid the need to call pkg-config.
d5dcad
-See the pkg-config man page for more details." "$LINENO" 5
d5dcad
-elif test $pkg_failed = untried; then
d5dcad
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
-$as_echo "no" >&6; }
d5dcad
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
d5dcad
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
d5dcad
-as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
d5dcad
-is in your PATH or set the PKG_CONFIG environment variable to the full
d5dcad
-path to pkg-config.
d5dcad
-
d5dcad
-Alternatively, you may set the environment variables TIRPC_CFLAGS
d5dcad
-and TIRPC_LIBS to avoid the need to call pkg-config.
d5dcad
-See the pkg-config man page for more details.
d5dcad
-
d5dcad
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
d5dcad
-See \`config.log' for more details" "$LINENO" 5; }
d5dcad
-else
d5dcad
-	TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS
d5dcad
-	TIRPC_LIBS=$pkg_cv_TIRPC_LIBS
d5dcad
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
d5dcad
-$as_echo "yes" >&6; }
d5dcad
 
d5dcad
 
d5dcad
-$as_echo "#define WITH_LIBTIRPC 1" >>confdefs.h
d5dcad
-
d5dcad
-
d5dcad
-$as_echo "#define TIRPC_WORKAROUND 1" >>confdefs.h
d5dcad
-
d5dcad
 
d5dcad
-fi
d5dcad
-  ac_ext=c
d5dcad
+ac_ext=c
d5dcad
 ac_cpp='$CPP $CPPFLAGS'
d5dcad
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
d5dcad
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
d5dcad
@@ -3465,7 +3249,511 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
d5dcad
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
d5dcad
 
d5dcad
 
d5dcad
-for ac_func in getrpcbyname getservbyname
d5dcad
+
d5dcad
+pkg_failed=no
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd" >&5
d5dcad
+$as_echo_n "checking for systemd... " >&6; }
d5dcad
+
d5dcad
+if test -n "$systemd_CFLAGS"; then
d5dcad
+    pkg_cv_systemd_CFLAGS="$systemd_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 \"libsystemd\""; } >&5
d5dcad
+  ($PKG_CONFIG --exists --print-errors "libsystemd") 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_systemd_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 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 "$systemd_LIBS"; then
d5dcad
+    pkg_cv_systemd_LIBS="$systemd_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 \"libsystemd\""; } >&5
d5dcad
+  ($PKG_CONFIG --exists --print-errors "libsystemd") 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_systemd_LIBS=`$PKG_CONFIG --libs "libsystemd" 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
+	        systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
d5dcad
+        else
d5dcad
+	        systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
d5dcad
+        fi
d5dcad
+	# Put the nasty error message in config.log where it belongs
d5dcad
+	echo "$systemd_PKG_ERRORS" >&5
d5dcad
+
d5dcad
+
d5dcad
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5
d5dcad
+$as_echo_n "checking for sm_notify in -lsystemd... " >&6; }
d5dcad
+if ${ac_cv_lib_systemd_sm_notify+:} false; then :
d5dcad
+  $as_echo_n "(cached) " >&6
d5dcad
+else
d5dcad
+  ac_check_lib_save_LIBS=$LIBS
d5dcad
+LIBS="-lsystemd  $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 sm_notify ();
d5dcad
+int
d5dcad
+main ()
d5dcad
+{
d5dcad
+return sm_notify ();
d5dcad
+  ;
d5dcad
+  return 0;
d5dcad
+}
d5dcad
+_ACEOF
d5dcad
+if ac_fn_c_try_link "$LINENO"; then :
d5dcad
+  ac_cv_lib_systemd_sm_notify=yes
d5dcad
+else
d5dcad
+  ac_cv_lib_systemd_sm_notify=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_systemd_sm_notify" >&5
d5dcad
+$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; }
d5dcad
+if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then :
d5dcad
+  systemd_LIBS="-lsystemd"
d5dcad
+fi
d5dcad
+
d5dcad
+
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 sm_notify in -lsystemd" >&5
d5dcad
+$as_echo_n "checking for sm_notify in -lsystemd... " >&6; }
d5dcad
+if ${ac_cv_lib_systemd_sm_notify+:} false; then :
d5dcad
+  $as_echo_n "(cached) " >&6
d5dcad
+else
d5dcad
+  ac_check_lib_save_LIBS=$LIBS
d5dcad
+LIBS="-lsystemd  $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 sm_notify ();
d5dcad
+int
d5dcad
+main ()
d5dcad
+{
d5dcad
+return sm_notify ();
d5dcad
+  ;
d5dcad
+  return 0;
d5dcad
+}
d5dcad
+_ACEOF
d5dcad
+if ac_fn_c_try_link "$LINENO"; then :
d5dcad
+  ac_cv_lib_systemd_sm_notify=yes
d5dcad
+else
d5dcad
+  ac_cv_lib_systemd_sm_notify=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_systemd_sm_notify" >&5
d5dcad
+$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; }
d5dcad
+if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then :
d5dcad
+  systemd_LIBS="-lsystemd"
d5dcad
+fi
d5dcad
+
d5dcad
+
d5dcad
+
d5dcad
+else
d5dcad
+	systemd_CFLAGS=$pkg_cv_systemd_CFLAGS
d5dcad
+	systemd_LIBS=$pkg_cv_systemd_LIBS
d5dcad
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
d5dcad
+$as_echo "yes" >&6; }
d5dcad
+
d5dcad
+fi
d5dcad
+
d5dcad
+#
d5dcad
+# Location of system config script directory?
d5dcad
+#
d5dcad
+if test -z "$confdir"; then
d5dcad
+  for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do
d5dcad
+    if test -z "$confdir"; then
d5dcad
+      if test -d "$conf_d"; then
d5dcad
+	confdir="$conf_d"
d5dcad
+      fi
d5dcad
+    fi
d5dcad
+  done
d5dcad
+fi
d5dcad
+
d5dcad
+# Check whether --with-confdir was given.
d5dcad
+if test "${with_confdir+set}" = set; then :
d5dcad
+  withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
+	then
d5dcad
+		:
d5dcad
+	else
d5dcad
+		confdir="${withval}"
d5dcad
+	fi
d5dcad
+
d5dcad
+fi
d5dcad
+
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5
d5dcad
+$as_echo_n "checking for autofs configuration file directory... " >&6; }
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5
d5dcad
+$as_echo "$confdir" >&6; }
d5dcad
+
d5dcad
+
d5dcad
+#
d5dcad
+# The user can specify --with-mapsdir=PATH to specify autofs maps go
d5dcad
+#
d5dcad
+if test -z "$mapdir"; then
d5dcad
+  for map_d in /etc/autofs /etc; do
d5dcad
+    if test -z "$mapdir"; then
d5dcad
+      if test -d "$map_d"; then
d5dcad
+	mapdir="$map_d"
d5dcad
+      fi
d5dcad
+    fi
d5dcad
+  done
d5dcad
+fi
d5dcad
+
d5dcad
+# Check whether --with-mapdir was given.
d5dcad
+if test "${with_mapdir+set}" = set; then :
d5dcad
+  withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
+	then
d5dcad
+		:
d5dcad
+	else
d5dcad
+		mapdir="${withval}"
d5dcad
+	fi
d5dcad
+
d5dcad
+fi
d5dcad
+
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5
d5dcad
+$as_echo_n "checking for autofs maps directory... " >&6; }
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5
d5dcad
+$as_echo "$mapdir" >&6; }
d5dcad
+
d5dcad
+
d5dcad
+#
d5dcad
+# The user can specify --with-fifodir=PATH to specify where autofs fifos go
d5dcad
+#
d5dcad
+if test -z "$fifodir"; then
d5dcad
+  for fifo_d in /run /var/run /tmp; do
d5dcad
+    if test -z "$fifodir"; then
d5dcad
+      if test -d "$fifo_d"; then
d5dcad
+        fifodir="$fifo_d"
d5dcad
+      fi
d5dcad
+    fi
d5dcad
+  done
d5dcad
+fi
d5dcad
+
d5dcad
+# Check whether --with-fifodir was given.
d5dcad
+if test "${with_fifodir+set}" = set; then :
d5dcad
+  withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
+	then
d5dcad
+		:
d5dcad
+	else
d5dcad
+		fifodir="${withval}"
d5dcad
+	fi
d5dcad
+
d5dcad
+fi
d5dcad
+
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5
d5dcad
+$as_echo_n "checking for autofs fifos directory... " >&6; }
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5
d5dcad
+$as_echo "$fifodir" >&6; }
d5dcad
+
d5dcad
+
d5dcad
+#
d5dcad
+# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
d5dcad
+#
d5dcad
+if test -z "$flagdir"; then
d5dcad
+  for flag_d in /run /var/run /tmp; do
d5dcad
+    if test -z "$flagdir"; then
d5dcad
+      if test -d "$flag_d"; then
d5dcad
+        flagdir="$flag_d"
d5dcad
+      fi
d5dcad
+    fi
d5dcad
+  done
d5dcad
+fi
d5dcad
+
d5dcad
+# Check whether --with-flagdir was given.
d5dcad
+if test "${with_flagdir+set}" = set; then :
d5dcad
+  withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
d5dcad
+	then
d5dcad
+		:
d5dcad
+	else
d5dcad
+		flagdir="${withval}"
d5dcad
+	fi
d5dcad
+
d5dcad
+fi
d5dcad
+
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5
d5dcad
+$as_echo_n "checking for autofs flag file directory... " >&6; }
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5
d5dcad
+$as_echo "$flagdir" >&6; }
d5dcad
+
d5dcad
+
d5dcad
+#
d5dcad
+# Use libtirpc
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
+# Check whether --with-libtirpc was given.
d5dcad
+if test "${with_libtirpc+set}" = set; then :
d5dcad
+  withval=$with_libtirpc;
d5dcad
+fi
d5dcad
+
d5dcad
+if test "x$with_libtirpc" = "xyes"; then
d5dcad
+
d5dcad
+pkg_failed=no
d5dcad
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIRPC" >&5
d5dcad
+$as_echo_n "checking for TIRPC... " >&6; }
d5dcad
+
d5dcad
+if test -n "$TIRPC_CFLAGS"; then
d5dcad
+    pkg_cv_TIRPC_CFLAGS="$TIRPC_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 \"libtirpc\""; } >&5
d5dcad
+  ($PKG_CONFIG --exists --print-errors "libtirpc") 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_TIRPC_CFLAGS=`$PKG_CONFIG --cflags "libtirpc" 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 "$TIRPC_LIBS"; then
d5dcad
+    pkg_cv_TIRPC_LIBS="$TIRPC_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 \"libtirpc\""; } >&5
d5dcad
+  ($PKG_CONFIG --exists --print-errors "libtirpc") 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_TIRPC_LIBS=`$PKG_CONFIG --libs "libtirpc" 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
+	        TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1`
d5dcad
+        else
d5dcad
+	        TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1`
d5dcad
+        fi
d5dcad
+	# Put the nasty error message in config.log where it belongs
d5dcad
+	echo "$TIRPC_PKG_ERRORS" >&5
d5dcad
+
d5dcad
+	as_fn_error $? "Package requirements (libtirpc) were not met:
d5dcad
+
d5dcad
+$TIRPC_PKG_ERRORS
d5dcad
+
d5dcad
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
d5dcad
+installed software in a non-standard prefix.
d5dcad
+
d5dcad
+Alternatively, you may set the environment variables TIRPC_CFLAGS
d5dcad
+and TIRPC_LIBS to avoid the need to call pkg-config.
d5dcad
+See the pkg-config man page for more details." "$LINENO" 5
d5dcad
+elif test $pkg_failed = untried; then
d5dcad
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
d5dcad
+$as_echo "no" >&6; }
d5dcad
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
d5dcad
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
d5dcad
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
d5dcad
+is in your PATH or set the PKG_CONFIG environment variable to the full
d5dcad
+path to pkg-config.
d5dcad
+
d5dcad
+Alternatively, you may set the environment variables TIRPC_CFLAGS
d5dcad
+and TIRPC_LIBS to avoid the need to call pkg-config.
d5dcad
+See the pkg-config man page for more details.
d5dcad
+
d5dcad
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
d5dcad
+See \`config.log' for more details" "$LINENO" 5; }
d5dcad
+else
d5dcad
+	TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS
d5dcad
+	TIRPC_LIBS=$pkg_cv_TIRPC_LIBS
d5dcad
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
d5dcad
+$as_echo "yes" >&6; }
d5dcad
+
d5dcad
+
d5dcad
+$as_echo "#define WITH_LIBTIRPC 1" >>confdefs.h
d5dcad
+
d5dcad
+
d5dcad
+$as_echo "#define TIRPC_WORKAROUND 1" >>confdefs.h
d5dcad
+
d5dcad
+
d5dcad
+fi
d5dcad
+  for ac_func in getrpcbyname getservbyname
d5dcad
 do :
d5dcad
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
d5dcad
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
d5dcad
@@ -4522,126 +4810,6 @@ fi
d5dcad
 
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
--- autofs-5.1.4.orig/configure.in
d5dcad
+++ autofs-5.1.4/configure.in
d5dcad
@@ -48,6 +48,7 @@ AF_INIT_D()
d5dcad
 AC_SUBST(initdir)
d5dcad
 AF_PID_D()
d5dcad
 AC_SUBST(piddir)
d5dcad
+PKG_PROG_PKG_CONFIG()
d5dcad
 
d5dcad
 #
d5dcad
 # Check for systemd unit files direectory exists if unit file installation
d5dcad
@@ -55,6 +56,12 @@ AC_SUBST(piddir)
d5dcad
 #
d5dcad
 AF_WITH_SYSTEMD()
d5dcad
 AC_SUBST(systemddir)
d5dcad
+AC_SUBST(WITH_SYSTEMD)
d5dcad
+PKG_CHECK_MODULES([systemd],[libsystemd],,
d5dcad
+[
d5dcad
+  AC_CHECK_LIB(systemd, sm_notify, systemd_LIBS="-lsystemd")
d5dcad
+  AC_SUBST(systemd_LIBS)
d5dcad
+])
d5dcad
 
d5dcad
 #
d5dcad
 # Location of system config script directory?
d5dcad
@@ -218,7 +225,6 @@ fi
d5dcad
 AC_CHECK_LIB(rt, clock_gettime, LIBCLOCK_GETTIME="-lrt")
d5dcad
 AC_SUBST(LIBCLOCK_GETTIME)
d5dcad
 
d5dcad
-PKG_PROG_PKG_CONFIG()
d5dcad
 PKG_CHECK_MODULES([NSL],[libnsl],,
d5dcad
 [
d5dcad
 AC_CHECK_LIB(nsl, yp_match, NSL_LIBS="-lnsl")
d5dcad
--- autofs-5.1.4.orig/daemon/Makefile
d5dcad
+++ autofs-5.1.4/daemon/Makefile
d5dcad
@@ -22,6 +22,11 @@ CFLAGS += -DVERSION_STRING=\"$(version)\
d5dcad
 LDFLAGS += -rdynamic
d5dcad
 LIBS += -ldl -lpthread
d5dcad
 
d5dcad
+ifeq ($(SYSTEMD), 1)
d5dcad
+    CFLAGS += -DWITH_SYSTEMD
d5dcad
+    LIBS += $(LIBSYSTEMD)
d5dcad
+endif
d5dcad
+
d5dcad
 ifeq ($(LDAP), 1)
d5dcad
     CFLAGS += $(XML_FLAGS)
d5dcad
     LIBS += $(XML_LIBS)
d5dcad
--- autofs-5.1.4.orig/daemon/automount.c
d5dcad
+++ autofs-5.1.4/daemon/automount.c
d5dcad
@@ -36,6 +36,9 @@
d5dcad
 #include <dirent.h>
d5dcad
 #include <sys/vfs.h>
d5dcad
 #include <sys/utsname.h>
d5dcad
+#ifdef WITH_SYSTEMD
d5dcad
+#include <systemd/sd-daemon.h>
d5dcad
+#endif
d5dcad
 
d5dcad
 #include "automount.h"
d5dcad
 #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND)
d5dcad
@@ -67,7 +70,7 @@ unsigned int global_selection_options;
d5dcad
 long global_negative_timeout = -1;
d5dcad
 int do_force_unlink = 0;		/* Forceably unlink mount tree at startup */
d5dcad
 
d5dcad
-static int start_pipefd[2];
d5dcad
+static int start_pipefd[2] = {-1, -1};
d5dcad
 static int st_stat = 1;
d5dcad
 static int *pst_stat = &st_stat;
d5dcad
 static pthread_t state_mach_thid;
d5dcad
@@ -1206,12 +1209,6 @@ static void become_daemon(unsigned foreg
d5dcad
 		exit(0);
d5dcad
 	}
d5dcad
 
d5dcad
-	if (open_pipe(start_pipefd) < 0) {
d5dcad
-		fprintf(stderr, "%s: failed to create start_pipefd.\n",
d5dcad
-			program);
d5dcad
-		exit(0);
d5dcad
-	}
d5dcad
-
d5dcad
 	/* Detach from foreground process */
d5dcad
 	if (foreground) {
d5dcad
 		if (daemon_check && !aquire_flag_file()) {
d5dcad
@@ -1221,6 +1218,12 @@ static void become_daemon(unsigned foreg
d5dcad
 		}
d5dcad
 		log_to_stderr();
d5dcad
 	} else {
d5dcad
+		if (open_pipe(start_pipefd) < 0) {
d5dcad
+			fprintf(stderr, "%s: failed to create start_pipefd.\n",
d5dcad
+				program);
d5dcad
+			exit(0);
d5dcad
+		}
d5dcad
+
d5dcad
 		pid = fork();
d5dcad
 		if (pid > 0) {
d5dcad
 			close(start_pipefd[1]);
d5dcad
@@ -2450,8 +2453,10 @@ int main(int argc, char *argv[])
d5dcad
 	if (pthread_attr_init(&th_attr)) {
d5dcad
 		logerr("%s: failed to init thread attribute struct!",
d5dcad
 		     program);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2460,8 +2465,10 @@ int main(int argc, char *argv[])
d5dcad
 	if (pthread_attr_init(&th_attr_detached)) {
d5dcad
 		logerr("%s: failed to init thread attribute struct!",
d5dcad
 		     program);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2471,8 +2478,10 @@ int main(int argc, char *argv[])
d5dcad
 			&th_attr_detached, PTHREAD_CREATE_DETACHED)) {
d5dcad
 		logerr("%s: failed to set detached thread attribute!",
d5dcad
 		     program);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2483,8 +2492,10 @@ int main(int argc, char *argv[])
d5dcad
 			&th_attr_detached, detached_thread_stack_size)) {
d5dcad
 		logerr("%s: failed to set stack size thread attribute!",
d5dcad
 		       program);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2495,8 +2506,10 @@ int main(int argc, char *argv[])
d5dcad
 			&th_attr_detached, &detached_thread_stack_size)) {
d5dcad
 		logerr("%s: failed to get detached thread stack size!",
d5dcad
 		       program);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2513,8 +2526,10 @@ int main(int argc, char *argv[])
d5dcad
 		logerr("%s: failed to create thread data key for std env vars!",
d5dcad
 		       program);
d5dcad
 		master_kill(master_list);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2525,8 +2540,10 @@ int main(int argc, char *argv[])
d5dcad
 		logerr("%s: failed to create thread data key for attempt ID!",
d5dcad
 		       program);
d5dcad
 		master_kill(master_list);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2537,8 +2554,10 @@ int main(int argc, char *argv[])
d5dcad
 	if (!alarm_start_handler()) {
d5dcad
 		logerr("%s: failed to create alarm handler thread!", program);
d5dcad
 		master_kill(master_list);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2547,8 +2566,10 @@ int main(int argc, char *argv[])
d5dcad
 	if (!st_start_handler()) {
d5dcad
 		logerr("%s: failed to create FSM handler thread!", program);
d5dcad
 		master_kill(master_list);
d5dcad
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-		close(start_pipefd[1]);
d5dcad
+		if (start_pipefd[1] != -1) {
d5dcad
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+			close(start_pipefd[1]);
d5dcad
+		}
d5dcad
 		release_flag_file();
d5dcad
 		macro_free_global_table();
d5dcad
 		exit(1);
d5dcad
@@ -2596,9 +2617,15 @@ int main(int argc, char *argv[])
d5dcad
 	 */
d5dcad
 	do_force_unlink = 0;
d5dcad
 
d5dcad
-	st_stat = 0;
d5dcad
-	res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
-	close(start_pipefd[1]);
d5dcad
+	if (start_pipefd[1] != -1) {
d5dcad
+		st_stat = 0;
d5dcad
+		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
d5dcad
+		close(start_pipefd[1]);
d5dcad
+	}
d5dcad
+
d5dcad
+#ifdef WITH_SYSTEMD
d5dcad
+	sd_notify(1, "READY=1");
d5dcad
+#endif
d5dcad
 
d5dcad
 	state_mach_thid = pthread_self();
d5dcad
 	statemachine(NULL);
d5dcad
--- autofs-5.1.4.orig/samples/autofs.service.in
d5dcad
+++ autofs-5.1.4/samples/autofs.service.in
d5dcad
@@ -4,10 +4,9 @@ After=network.target ypbind.service sssd
d5dcad
 Wants=network-online.target rpc-statd.service rpcbind.service
d5dcad
 
d5dcad
 [Service]
d5dcad
-Type=forking
d5dcad
-PIDFile=@@autofspiddir@@/autofs.pid
d5dcad
+Type=notify
d5dcad
 EnvironmentFile=-@@autofsconfdir@@/autofs
d5dcad
-ExecStart=@@sbindir@@/automount $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
d5dcad
+ExecStart=@@sbindir@@/automount $OPTIONS --foreground --dont-check-daemon
d5dcad
 ExecReload=/usr/bin/kill -HUP $MAINPID
d5dcad
 KillMode=process
d5dcad
 TimeoutSec=180