summary refs log tree commit diff
path: root/autogen.sh
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2024-01-16 17:33:54 +0100
committerAlexander Barton <alex@barton.de>2024-01-16 22:32:33 +0100
commit5f494ec5fe7f22ef198f98c2e752237e91363e4f (patch)
tree2e81a11861bafa0a92ecbe4dc75651d53429ef7a /autogen.sh
parentccb0cf3170047d7bf372c9a43c4a6dfee1228126 (diff)
downloadngircd-5f494ec5fe7f22ef198f98c2e752237e91363e4f.tar.gz
ngircd-5f494ec5fe7f22ef198f98c2e752237e91363e4f.zip
autogen.sh: Prefere automake 1.11 over other releases
GNU automake 1.11 is the last release supporting "de-ANSI-fication"
using the included ansi2knr tool. And becuase we _want_ to support old
K&R platforms, we try hard to use this release of automake when
available to generate our build system.
Diffstat (limited to 'autogen.sh')
-rwxr-xr-xautogen.sh48
1 files changed, 32 insertions, 16 deletions
diff --git a/autogen.sh b/autogen.sh
index bb548227..0cf9a0e3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2024 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -60,16 +60,43 @@
 #   and runs it with these arguments: "./configure --prefix=$HOME".
 #
 
+Check_Tool()
+{
+	searchlist="$1"
+	major="$2"
+	minor="$3"
+
+	for name in $searchlist; do
+		$EXIST "${name}${major}${minor}" >/dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			echo "${name}${major}${minor}"
+			return 0
+		fi
+		$EXIST "${name}-${major}.${minor}" >/dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			echo "${name}-${major}.${minor}"
+			return 0
+		fi
+	done
+	return 1
+}
+
 Search()
 {
-	[ $# -eq 2 ] || exit 1
+	[ $# -lt 2 ] && return 1
+	[ $# -gt 3 ] && return 1
 
 	searchlist="$1"
 	major="$2"
+	minor_pref="$3"
 	minor=99
 
 	[ -n "$PREFIX" ] && searchlist="${PREFIX}/$1 ${PREFIX}/bin/$1 $searchlist"
 
+	if [ -n "$minor_pref" ]; then
+		Check_Tool "$searchlist" "$major" "$minor_pref" && return 0
+	fi
+
 	for name in $searchlist; do
 		$EXIST "${name}" >/dev/null 2>&1
 		if [ $? -eq 0 ]; then
@@ -83,18 +110,7 @@ Search()
 	done
 
 	while [ $minor -ge 0 ]; do
-		for name in $searchlist; do
-			$EXIST "${name}${major}${minor}" >/dev/null 2>&1
-			if [ $? -eq 0 ]; then
-				echo "${name}${major}${minor}"
-				return 0
-			fi
-			$EXIST "${name}-${major}.${minor}" >/dev/null 2>&1
-			if [ $? -eq 0 ]; then
-				echo "${name}-${major}.${minor}"
-				return 0
-			fi
-		done
+		Check_Tool "$searchlist" "$major" "$minor" && return 0
 		minor=$(expr $minor - 1)
 	done
 	return 1
@@ -140,11 +156,11 @@ fi
 # Try to detect the needed tools when no environment variable already
 # specifies one:
 echo "Searching for required tools ..."
-[ -z "$ACLOCAL" ] && ACLOCAL=$(Search aclocal 1)
+[ -z "$ACLOCAL" ] && ACLOCAL=$(Search aclocal 1 11)
 [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL"
 [ -z "$AUTOHEADER" ] && AUTOHEADER=$(Search autoheader 2)
 [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER"
-[ -z "$AUTOMAKE" ] && AUTOMAKE=$(Search automake 1)
+[ -z "$AUTOMAKE" ] && AUTOMAKE=$(Search automake 1 11)
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE"
 [ -z "$AUTOCONF" ] && AUTOCONF=$(Search autoconf 2)
 [ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF"