changeset 37163:94affa13dea1

bootstrap: remove the --version requirement from ancillary tools * build-aux/bootstrap (check_exists): A new refactored function to determine if a command exists. (find_tool): Use the new function which does not require the --version option to be supported. (check_versions): Use the new function.
author Pádraig Brady <P@draigBrady.com>
date Sun, 18 Aug 2013 02:05:51 +0100
parents 2da368bd636c
children 40dfa49bda69
files ChangeLog build-aux/bootstrap
diffstat 2 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 26 21:31:15 2013 +0200
+++ b/ChangeLog	Sun Aug 18 02:05:51 2013 +0100
@@ -1,3 +1,12 @@
+2013-08-29  Pádraig Brady  <P@draigBrady.com>
+
+	bootstrap: remove the --version requirement from ancillary tools
+	* build-aux/bootstrap (check_exists): A new refactored function to
+	determine if a command exists.
+	(find_tool): Use the new function which does not require the
+	--version option to be supported.
+	(check_versions): Use the new function.
+
 2013-08-26  Simon Josefsson  <simon@josefsson.org>
 
 	gc: support HMAC-SHA256 and HMAC-SHA512.
--- a/build-aux/bootstrap	Mon Aug 26 21:31:15 2013 +0200
+++ b/build-aux/bootstrap	Sun Aug 18 02:05:51 2013 +0100
@@ -209,12 +209,16 @@
 # Use git to update gnulib sources
 use_git=true
 
+check_exists() {
+  ($1 --version </dev/null) >/dev/null 2>&1
+  test $? -lt 126
+}
+
 # find_tool ENVVAR NAMES...
 # -------------------------
 # Search for a required program.  Use the value of ENVVAR, if set,
-# otherwise find the first of the NAMES that can be run (i.e.,
-# supports --version).  If found, set ENVVAR to the program name,
-# die otherwise.
+# otherwise find the first of the NAMES that can be run.
+# If found, set ENVVAR to the program name, die otherwise.
 #
 # FIXME: code duplication, see also gnu-web-doc-update.
 find_tool ()
@@ -225,7 +229,7 @@
   eval "find_tool_res=\$$find_tool_envvar"
   if test x"$find_tool_res" = x; then
     for i; do
-      if ($i --version </dev/null) >/dev/null 2>&1; then
+      if check_exists $i; then
         find_tool_res=$i
         break
       fi
@@ -463,8 +467,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.
-      $app --version >/dev/null 2>&1 </dev/null
-      if [ 126 -le $? ]; then
+      if ! check_exists $app; then
         warn_ "Error: '$app' not found"
         ret=1
       fi
@@ -551,10 +554,10 @@
 echo "$0: Bootstrapping from checked-out $package sources..."
 
 # See if we can use gnulib's git-merge-changelog merge driver.
-if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
+if $use_git && test -d .git && check_exists git; then
   if git config merge.merge-changelog.driver >/dev/null ; then
     :
-  elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
+  elif check_exists git-merge-changelog; then
     echo "$0: initializing git-merge-changelog driver"
     git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
     git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'