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

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