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

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