X-Git-Url: https://arthur.barton.de/gitweb/?p=ngircd-alex.git;a=blobdiff_plain;f=autogen.sh;h=bb5482278ea9d0c52f9582fbda19810e76d997cd;hp=3f86295ae0ab25fc8b98ca65f9b883f1ca266543;hb=HEAD;hpb=804c2403203258ba8b9bf869be3f9ef057c2d39a diff --git a/autogen.sh b/autogen.sh index 3f86295a..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 @@ -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