]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
bootstrap: support tools that don't accept '--version' in buildreq.
authorGary V. Vaughan <gary@gnu.org>
Fri, 23 Aug 2013 10:23:29 +0000 (17:23 +0700)
committerGary V. Vaughan <gary@gnu.org>
Fri, 23 Aug 2013 12:47:47 +0000 (19:47 +0700)
* gl/build-aux/bootstrap.in (func_check_tool): Check whether there
is an executable as given or on the command PATH.
(func_check_version): Use func_check_tool to avoid invoking --version
when buildreq specifies '-' for the version number.
* bootstrap: Regenerate.
Reported by Mike Miller.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
bootstrap
gl/build-aux/bootstrap.in

index 5b382d85dc7b8e0bdc9a8001f52c4b7ca9efb702..80b1887f06ed55989b24d7fa36fbee9dae00ac83 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -2203,7 +2203,7 @@ test extract-trace = "$progname" && func_main "$@"
 # End:
 
 # Set a version string for *this* script.
-scriptversion=2013-08-22.10; # UTC
+scriptversion=2013-08-23.19; # UTC
 
 # 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
@@ -4479,6 +4479,35 @@ func_get_version ()
 }
 
 
+# func_check_tool APP
+# -------------------
+# Search PATH for an executable at APP.
+func_check_tool ()
+{
+    $debug_cmd
+
+    func_check_tool_result=
+
+    case $1 in
+    *[\\/]*)
+      test -x "$1" && func_check_tool_result=$1
+      ;;
+    *)
+      save_IFS=$IFS
+      IFS=:
+      for _G_check_tool_path in $PATH; do
+        IFS=$save_IFS
+       if test -x "$_G_check_tool_path/$1"; then
+         func_check_tool_result=$_G_check_tool_path/$1
+         break
+       fi
+      done
+      IFS=$save_IFS
+      ;;
+    esac
+}
+
+
 # func_check_versions APP1 VER1 URL1 ...[APPN VERN URLN]
 # ------------------------------------------------------
 func_check_versions ()
@@ -4507,26 +4536,39 @@ delimited list of triples; 'program min-version url'."
       _G_appvar=`echo $_G_app |tr '[a-z]' '[A-Z]'`
       test TAR = "$_G_appvar" && _G_appvar=AMTAR
       eval "_G_app=\${$_G_appvar-$_G_app}"
-      _G_instver=`func_get_version $_G_app`
 
-      test -z "$_G_instver" \
-          || func_verbose "found '$_G_app' version $_G_instver."
+      # Fail if no version specified, but the program can't be found.
+      if test x- = "x$_G_reqver"; then
+        func_check_tool $_G_app
+       if test -z "$func_check_tool_result"; then
+         func_error "Prerequisite '$_G_app' not not found. Please install it, or
+'export $_G_appvar=/path/to/$_G_app'."
+          func_check_versions_result=false
+       else
+         func_verbose "found '$func_check_tool_result' for $_G_appvar."
+       fi
+      else
+        _G_instver=`func_get_version $_G_app`
 
-      # Fail if --version didn't work.
-      if test -z "$_G_instver"; then
-        func_error "Prerequisite '$_G_app' not found. Please install it, or
+        test -z "$_G_instver" \
+            || func_verbose "found '$_G_app' version $_G_instver."
+
+        # Fail if --version didn't work.
+        if test -z "$_G_instver"; then
+          func_error "Prerequisite '$_G_app' not found. Please install it, or
 'export $_G_appvar=/path/to/$_G_app'."
-        func_check_versions_result=false
-
-      # Fail if a new version than what we have is required.
-      elif test x- != "x$_G_reqver"; then
-        _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2`
-        test "$_G_newer" != "$_G_instver" && {
-          func_error "\
-'$_G_app' version == $_G_instver is too old
-'$_G_app' version >= $_G_reqver is required"
           func_check_versions_result=false
-        }
+
+        # Fail if a newer version than what we have is required.
+        else
+          _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2`
+          test "$_G_newer" != "$_G_instver" && {
+            func_error "\
+  '$_G_app' version == $_G_instver is too old
+  '$_G_app' version >= $_G_reqver is required"
+            func_check_versions_result=false
+          }
+        fi
       fi
     done
 }
index 34e4155e6fbba6d84b64ce86c2c009d29d807442..8678d062b7eb25524ff439b13a2957b134e98da4 100755 (executable)
@@ -13,7 +13,7 @@
 . `echo "$0" |${SED-sed} 's|[^/]*$||'`"extract-trace"
 
 # Set a version string for *this* script.
-scriptversion=2013-08-22.10; # UTC
+scriptversion=2013-08-23.19; # UTC
 
 # 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
@@ -2289,6 +2289,35 @@ func_get_version ()
 }
 
 
+# func_check_tool APP
+# -------------------
+# Search PATH for an executable at APP.
+func_check_tool ()
+{
+    $debug_cmd
+
+    func_check_tool_result=
+
+    case $1 in
+    *[\\/]*)
+      test -x "$1" && func_check_tool_result=$1
+      ;;
+    *)
+      save_IFS=$IFS
+      IFS=:
+      for _G_check_tool_path in $PATH; do
+        IFS=$save_IFS
+       if test -x "$_G_check_tool_path/$1"; then
+         func_check_tool_result=$_G_check_tool_path/$1
+         break
+       fi
+      done
+      IFS=$save_IFS
+      ;;
+    esac
+}
+
+
 # func_check_versions APP1 VER1 URL1 ...[APPN VERN URLN]
 # ------------------------------------------------------
 func_check_versions ()
@@ -2317,26 +2346,39 @@ delimited list of triples; 'program min-version url'."
       _G_appvar=`echo $_G_app |tr '[a-z]' '[A-Z]'`
       test TAR = "$_G_appvar" && _G_appvar=AMTAR
       eval "_G_app=\${$_G_appvar-$_G_app}"
-      _G_instver=`func_get_version $_G_app`
 
-      test -z "$_G_instver" \
-          || func_verbose "found '$_G_app' version $_G_instver."
+      # Fail if no version specified, but the program can't be found.
+      if test x- = "x$_G_reqver"; then
+        func_check_tool $_G_app
+       if test -z "$func_check_tool_result"; then
+         func_error "Prerequisite '$_G_app' not not found. Please install it, or
+'export $_G_appvar=/path/to/$_G_app'."
+          func_check_versions_result=false
+       else
+         func_verbose "found '$func_check_tool_result' for $_G_appvar."
+       fi
+      else
+        _G_instver=`func_get_version $_G_app`
+
+        test -z "$_G_instver" \
+            || func_verbose "found '$_G_app' version $_G_instver."
 
-      # Fail if --version didn't work.
-      if test -z "$_G_instver"; then
-        func_error "Prerequisite '$_G_app' not found. Please install it, or
+        # Fail if --version didn't work.
+        if test -z "$_G_instver"; then
+          func_error "Prerequisite '$_G_app' not found. Please install it, or
 'export $_G_appvar=/path/to/$_G_app'."
-        func_check_versions_result=false
-
-      # Fail if a new version than what we have is required.
-      elif test x- != "x$_G_reqver"; then
-        _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2`
-        test "$_G_newer" != "$_G_instver" && {
-          func_error "\
-'$_G_app' version == $_G_instver is too old
-'$_G_app' version >= $_G_reqver is required"
           func_check_versions_result=false
-        }
+
+        # Fail if a newer version than what we have is required.
+        else
+          _G_newer=`func_sort_ver $_G_reqver $_G_instver |cut -d' ' -f2`
+          test "$_G_newer" != "$_G_instver" && {
+            func_error "\
+  '$_G_app' version == $_G_instver is too old
+  '$_G_app' version >= $_G_reqver is required"
+            func_check_versions_result=false
+          }
+        fi
       fi
     done
 }