changeset 5374:24fcb96121cb draft

configure: add --with-eghook=foo Allows to force for example ypbind if it's not installed.
author Roy Marples <roy@marples.name>
date Wed, 17 Jun 2020 15:12:13 +0100
parents 086c01fecfca
children 0bbad3cb3f65
files configure
diffstat 1 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Jun 17 11:25:58 2020 +0100
+++ b/configure	Wed Jun 17 15:12:13 2020 +0100
@@ -88,6 +88,8 @@
 	PKG_CONFIG) PKG_CONFIG=$var;;
 	--with-hook) HOOKSCRIPTS="$HOOKSCRIPTS${HOOKSCRIPTS:+ }$var";;
 	--with-hooks|HOOKSCRIPTS) HOOKSCRIPTS=$var; HOOKSET=true;;
+	--with-eghook) EGHOOKSCRIPTS="$EGHOOKSCRIPTS${EGHOOKSCRIPTS+ }$var";;
+	--with-hooks|EGHOOKSCRIPTS) EGHOOKSCRIPTS=$var; EGHOOKSET=true;;
 	--with-default-hostname) _DEFAULT_HOSTNAME=$var;;
 	--build) BUILD=$var;;
 	--host) HOST=$var; HOSTCC=$var-;;
@@ -1712,16 +1714,24 @@
 	fi
 fi
 
+find_hook()
+{
+	for h in [0-9][0-9]"-$x" [0-9][0-9]"-$x.in" \
+	    [0-9][0-9]"-$x.sh" [0-9][0-9]"-$x.sh.in" \
+	    [0-9][0-9]"-$x.conf" [0-9][0-9]"-$x.conf.in"
+	do
+		[ -e "$h" ] && break
+	done
+	[ -e "$h" ] || return 1
+	echo "${h%%.in}"
+	return 0
+}
+
 if cd hooks; then
 	for x in $HOOKSCRIPTS; do
 		printf "Finding hook $x ... "
-		for h in [0-9][0-9]"-$x" \
-		    [0-9][0-9]"-$x.sh" \
-		    [0-9][0-9]"-$x.conf"
-		do
-			[ -e "$h" ] && break
-		done
-		if [ ! -e "$h" ]; then
+		h=$(find_hook "$x")
+		if [ -z "$h" ]; then
 			echo "no"
 		else
 			echo "$h"
@@ -1733,13 +1743,8 @@
 	done
 	for x in $EGHOOKSCRIPTS; do
 		printf "Finding example hook $x ... "
-		for h in [0-9][0-9]"-$x" \
-		    [0-9][0-9]"-$x.sh" \
-		    [0-9][0-9]"-$x.conf"
-		do
-			[ -e "$h" ] && break
-		done
-		if [ ! -e "$h" ]; then
+		h=$(find_hook "$x")
+		if [ -z "$h" ]; then
 			echo "no"
 		else
 			echo "$h"