autogen 0.4.5 - autodetect automake, autoconf versions
authorHans Ulrich Niedermann <hun@n-dimensional.de>
Thu, 12 May 2005 13:11:12 +0000 (15:11 +0200)
committerHans Ulrich Niedermann <hun@n-dimensional.de>
Thu, 12 May 2005 13:11:12 +0000 (15:11 +0200)
autogen.sh

index f9de084..117ada5 100755 (executable)
@@ -19,7 +19,7 @@ debug="false"
 recursive="false"
 dryrun="false"
 self="$(basename "$0")"
-autogen_version="0.4.4"
+autogen_version="0.4.5"
 
 
 ########################################################################
@@ -61,9 +61,12 @@ Flags:
 
 ${self} depends on automake, autoconf, libtool and gettext.
 
-You may want to set AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
+You may want to set AUTOCONF, AUTOHEADER, AUTOMAKE, AUTORECONF, ACLOCAL,
 AUTOPOINT, LIBTOOLIZE to use specific version of these tools, and
 AUTORECONF_OPTS to add options to the call to autoreconf.
+
+If none of these variables are set, ${self} tries to find the most
+adequate version in \$PATH.
 __HELP_EOF__
 }
 
@@ -320,7 +323,7 @@ if cd "${dir}"; then
        if test "$status" -ne 0; then exit "$status"; fi
     fi
     if "$recursive"; then :; else
-       if execute_command autoreconf --install --symlink ${AUTORECONF_OPTS}; then
+       if execute_command ${AUTORECONF-"autoreconf"} --install --symlink ${AUTORECONF_OPTS}; then
            :; else
            status="$?"
            echo "autoreconf quit with exit code $status, aborting."
@@ -402,6 +405,57 @@ if test "x$pdirs" != "x"; then
     dirs="$pdirs"
 fi
 
+
+########################################################################
+# If not explicitly given, try to find most convenient tools in $PATH
+#
+# This method only works for tools made for parallel installation with
+# a version suffix, i.e. autoconf and automake.
+#
+# libtool and gettext do not support that, so you'll still have to
+# manually set the respective variables if the default does not work
+# for you.
+
+skip="false"
+oldversion="oldversion"
+while read flag variable binary version restofline; do
+       case "$flag" in
+       +)
+               if "$skip"; then skip=false; fi
+               if test -n "`eval echo \$\{$variable+"set"\}`"; then
+                       skip=:
+               else
+                       if test -x "`which ${binary}${version}`"; then
+                               export "$variable"="${binary}${version}"
+                               oldversion="${version}"
+                       else
+                               skip=:
+                       fi
+               fi
+               ;;
+       -)
+               if "$skip"; then :; else
+                       export "$variable"="${binary}${oldversion}"
+               fi
+               ;;
+       esac
+done<<EOF
++ AUTOMAKE     automake        -1.9
+- ACLOCAL      aclocal
++ AUTOMAKE     automake        -1.8
+- ACLOCAL      aclocal
++ AUTOCONF     autoconf        2.59
+- AUTOHEADER   autoheader
+- AUTORECONF   autoreconf
++ AUTOCONF     autoconf        2.50
+- AUTOHEADER   autoheader
+- AUTORECONF   autoreconf
+EOF
+
+
+########################################################################
+# Check that tool versions satisfy our needs
+
 if "$check_versions"; then
        # check tool versions
        errors=false