unify autogen.sh scripts
authorHans Ulrich Niedermann <hun@n-dimensional.de>
Thu, 24 Mar 2005 15:40:28 +0000 (16:40 +0100)
committerHans Ulrich Niedermann <hun@n-dimensional.de>
Thu, 24 Mar 2005 15:40:28 +0000 (16:40 +0100)
autogen.sh

index b4cc04e..56d89e5 100755 (executable)
@@ -5,11 +5,19 @@
 # print_help() function.
 
 
+if test "$(pwd)" != "`pwd`"
+then
+       echo "Urgh. Dinosaur shell, eh?"
+       exit 1
+fi
+
+
 ########################################################################
-# Initial values
+# Constant and initial values
 
 debug=false
 self="$(basename "$0")"
+autogen_version="0.3.0"
 
 
 ########################################################################
@@ -29,6 +37,8 @@ If there is no directory given, the location of $self is assumed.
 Commands:
     --help
         Print this help text
+    --version
+        Print the tool versions
     --verbose
         Verbose output
 
@@ -49,6 +59,22 @@ EOF
 
 
 ########################################################################
+# Print software versions
+
+print_versions() {
+    echo "${self} (ndim's autogen) ${autogen_version}"
+    for tool in \
+       "${AUTOCONF-autoconf}" \
+       "${AUTOMAKE-automake}" \
+       "${AUTOPOINT-autopoint}" \
+       "${LIBTOOLIZE-libtoolize}"
+    do
+       "$tool" --version 2>&1 | sed '1q'
+    done
+}
+
+
+########################################################################
 # Initialize variables for configure.{in,ac} in $1
 
 init_vars() {
@@ -82,7 +108,7 @@ init_vars() {
     #        OK, the "init" part is done recursively by autopoint, so that is easy.
     #        But the cleaning should also work recursively, but that is difficult
     #        with the current structure of the script.
-    AG_SUBDIRS="$(for k in $(sed -n 's/^AC_CONFIG_SUBDIRS(\[\{0,1\}\([^])]*\).*/\1/p' "$CONFIGURE_AC"); do echo "${dir}/${k}"; done)"
+    AG_SUBDIRS="$(for k in $(sed -n 's/^[[:space:]]*AC_CONFIG_SUBDIRS(\[\{0,1\}\([^])]*\).*/\1/p' "$CONFIGURE_AC"); do echo "${dir}/${k}"; done)"
     AG_AUX="$(sed -n 's/^AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")"
     if test "x$AG_AUX" = "x"; then
        AG_AUX="."
@@ -254,6 +280,10 @@ for param in $@; do
        --verbose)
            debug="true"
            ;;
+       --version)
+           print_versions
+           exit 0
+           ;;
        -h|--help)
            print_help
            exit 0