autofs-5.0.5 - add piddir to configure

From: Ian Kent <ikent@redhat.com>

In order to accomodate possible changes or different pid file
locations add directory selection for pid file directory to
configure. Also update the fifo directory and flag file directory
configure checks.
---

 CHANGELOG             |    1 +
 Makefile.conf.in      |    3 +++
 aclocal.m4            |   20 ++++++++++++++++++--
 configure             |    4 ++--
 redhat/Makefile       |    1 +
 redhat/autofs.init.in |    4 ++--
 samples/Makefile      |    2 +-
 7 files changed, 28 insertions(+), 7 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 076830f..c2a7b1f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,7 @@
 - fix ipv6 name lookup check.
 - fix ipv6 rpc calls.
 - fix ipv6 configure check.
+- add piddir to configure.
 
 28/06/2011 autofs-5.0.6
 -----------------------
diff --git a/Makefile.conf.in b/Makefile.conf.in
index 80093c1..f49dbd0 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -79,6 +79,9 @@ autofsconfdir = @confdir@
 # Location for autofs maps
 autofsmapdir = @mapdir@
 
+# Localtion of pid files
+autofspiddir = @piddir@
+
 # Location for autofs fifos
 autofsfifodir = @fifodir@
 
diff --git a/aclocal.m4 b/aclocal.m4
index e1e12f7..461801d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -121,13 +121,29 @@ AC_DEFUN(AF_MAP_D,
 fi])
 
 dnl --------------------------------------------------------------------------
+dnl AF_PID_D
+dnl
+dnl Check the location of the pid file directory.
+dnl --------------------------------------------------------------------------
+AC_DEFUN(AF_PID_D,
+[if test -z "$piddir"; then
+  for pid_d in /run /var/run /tmp; do
+    if test -z "$piddir"; then
+      if test -d "$pid_d"; then
+        piddir="$pid_d"
+      fi
+    fi
+  done
+fi])
+
+dnl --------------------------------------------------------------------------
 dnl AF_FIFO_D
 dnl
 dnl Check the location of the autofs fifos directory
 dnl --------------------------------------------------------------------------
 AC_DEFUN(AF_FIFO_D,
 [if test -z "$fifodir"; then
-  for fifo_d in /var/run /tmp; do
+  for fifo_d in /run /var/run /tmp; do
     if test -z "$fifodir"; then
       if test -d "$fifo_d"; then
         fifodir="$fifo_d"
@@ -143,7 +159,7 @@ dnl Check the location of the autofs flag file directory
 dnl --------------------------------------------------------------------------
 AC_DEFUN(AF_FLAG_D,
 [if test -z "$flagdir"; then
-  for flag_d in /var/run /tmp; do
+  for flag_d in /run /var/run /tmp; do
     if test -z "$flagdir"; then
       if test -d "$flag_d"; then
         flagdir="$flag_d"
diff --git a/configure b/configure
index 62599a9..0d014c1 100755
--- a/configure
+++ b/configure
@@ -2184,7 +2184,7 @@ $as_echo "$mapdir" >&6; }
 # The user can specify --with-fifodir=PATH to specify where autofs fifos go
 #
 if test -z "$fifodir"; then
-  for fifo_d in /var/run /tmp; do
+  for fifo_d in /run /var/run /tmp; do
     if test -z "$fifodir"; then
       if test -d "$fifo_d"; then
         fifodir="$fifo_d"
@@ -2214,7 +2214,7 @@ $as_echo "$fifodir" >&6; }
 # The user can specify --with-flagdir=PATH to specify where autofs flag file goes
 #
 if test -z "$flagdir"; then
-  for flag_d in /var/run /tmp; do
+  for flag_d in /run /var/run /tmp; do
     if test -z "$flagdir"; then
       if test -d "$flag_d"; then
         flagdir="$flag_d"
diff --git a/redhat/Makefile b/redhat/Makefile
index ea83719..b9ad209 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -8,6 +8,7 @@ autofs.init: autofs.init.in
 	sed -e "s|@@sbindir@@|$(sbindir)|g" \
 	    -e "s|@@autofslibdir@@|$(autofslibdir)|g" \
 	    -e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+	    -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
 	    -e "s|@@initdir@@|$(initdir)|g" < autofs.init.in > autofs.init
 
 autofs.sysconfig: autofs.sysconfig.in
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index 48d387d..38b9eeb 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -86,7 +86,7 @@ function start() {
 	fi
 
 	echo -n $"Starting $prog: "
-	$prog $OPTIONS --pid-file /var/run/autofs.pid
+	$prog $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
 	RETVAL=$?
 	if [ $RETVAL -eq 0 ] ; then
 		success "$prog startup"
@@ -171,7 +171,7 @@ case "$1" in
 		stop
 		;;
 	status)
-		status -p /var/run/autofs.pid -l autofs $prog
+		status -p @@autofspiddir@@/autofs.pid -l autofs $prog
 		;;
 	restart|force-reload)
 		restart
diff --git a/samples/Makefile b/samples/Makefile
index 81f401d..2a6e898 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -21,7 +21,7 @@ dirs:
 	install -d -m 755 $(INSTALLROOT)$(autofsmapdir)
 	install -d -m 755 $(INSTALLROOT)$(autofsconfdir)
 	install -d -m 755 $(INSTALLROOT)$(autofslibdir)
-	install -d -m 755 $(INSTALLROOT)/var/run/autofs
+	install -d -m 755 $(INSTALLROOT)$(autofspiddir)
 
 .PHONY: autofs.init
 autofs.init: