changeset 37452:c2e4d1b0105b

bootstrap: print more diagnostics for missing programs * build-aux/bootstrap: only suppress stderr when checking for alternative program names. This supports programs issuing non standard error messages like: "Provide an AUTOMAKE_VERSION environment variable, please" Reported by Ingo Schwarze with OpenBSD
author Pádraig Brady <P@draigBrady.com>
date Thu, 23 Oct 2014 13:59:08 +0100
parents e276a3a4e682
children da28b03c7269
files ChangeLog build-aux/bootstrap
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 23 13:26:23 2014 +0100
+++ b/ChangeLog	Thu Oct 23 13:59:08 2014 +0100
@@ -1,3 +1,10 @@
+2014-10-23  Pádraig Brady  <P@draigBrady.com>
+
+	bootstrap: print more diagnostics for missing programs
+	* build-aux/bootstrap: only suppress stderr when checking for
+	alternative program names.  This supports programs issuing non
+	standard error messages.
+
 2014-10-23  Pádraig Brady  <P@draigBrady.com>
 
 	bootstrap: only update the gnulib submodule
--- a/build-aux/bootstrap	Thu Oct 23 13:26:23 2014 +0100
+++ b/build-aux/bootstrap	Thu Oct 23 13:59:08 2014 +0100
@@ -210,7 +210,17 @@
 use_git=true
 
 check_exists() {
-  ($1 --version </dev/null) >/dev/null 2>&1
+  if test "$1" = "--verbose"; then
+    ($2 --version </dev/null) >/dev/null 2>&1
+    if test $? -ge 126; then
+      # If not found, run with diagnostics as one may be
+      # presented with env variables to set to find the right version
+      ($2 --version </dev/null)
+    fi
+  else
+    ($1 --version </dev/null) >/dev/null 2>&1
+  fi
+
   test $? -lt 126
 }
 
@@ -408,7 +418,7 @@
 get_version() {
   app=$1
 
-  $app --version >/dev/null 2>&1 || return 1
+  $app --version >/dev/null 2>&1 || { $app --version; return 1; }
 
   $app --version 2>&1 |
   sed -n '# Move version to start of line.
@@ -467,7 +477,7 @@
     if [ "$req_ver" = "-" ]; then
       # Merely require app to exist; not all prereq apps are well-behaved
       # so we have to rely on $? rather than get_version.
-      if ! check_exists $app; then
+      if ! check_exists --verbose $app; then
         warn_ "Error: '$app' not found"
         ret=1
       fi