]> arthur.barton.de Git - ngircd-alex.git/blobdiff - autogen.sh
Clarify that "CAFile" is not set by default
[ngircd-alex.git] / autogen.sh
index 3f86295ae0ab25fc8b98ca65f9b883f1ca266543..0cf9a0e391b5ac8425c2ba54e03a690b5ea6ca80 100755 (executable)
@@ -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
 #   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
@@ -103,7 +119,8 @@ Search()
 Notfound()
 {
        echo "Error: $* not found!"
-       echo "Please install recent versions of GNU autoconf and GNU automake."
+       echo 'Please install supported versions of GNU autoconf, GNU automake'
+       echo 'and pkg-config: see the INSTALL file for details.'
        exit 1
 }
 
@@ -139,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"
@@ -161,6 +178,7 @@ AUTOMAKE_VERSION=$(echo $AUTOMAKE | cut -d'-' -f2-)
 [ -z "$GO" ] && [ -n "$CONFIGURE_ARGS" ] && GO=1
 
 # Verify that all tools have been found
+command -v pkg-config >/dev/null || Notfound pkg-config
 [ -z "$ACLOCAL" ] && Notfound aclocal
 [ -z "$AUTOHEADER" ] && Notfound autoheader
 [ -z "$AUTOMAKE" ] && Notfound automake
@@ -168,7 +186,7 @@ AUTOMAKE_VERSION=$(echo $AUTOMAKE | cut -d'-' -f2-)
 
 AM_VERSION=$($AUTOMAKE --version | head -n 1 | sed -e 's/.* //g')
 ifs=$IFS; IFS="."; set $AM_VERSION; IFS=$ifs
-AM_MAJOR="$1"; AM_MINOR="$2"; AM_PATCHLEVEL="$3"
+AM_MAJOR="$1"; AM_MINOR="$2"
 echo "Detected automake $AM_VERSION ..."
 
 AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng"
@@ -194,6 +212,7 @@ if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -ge "13" ]; then
        SERIAL_TESTS="serial-tests"
 else
        # automake < 1.13 => no new test harness, nothing to do
+       # shellcheck disable=SC2034
        SERIAL_TEST=""
 fi