This change helps bootstrapping on platforms where sha1sum is actually gsha1sum.

From 1832d3dfba847aba6567b5056af0cad1978dd51f Mon Sep 17 00:00:00 2001
From: Akim Demaille <[email protected]>
Date: Wed, 19 Aug 2009 15:37:23 +0200
Subject: [PATCH 1/2] bootstrap: find sha1sum when named gsha1sum.

        * bootstrap (find_tool): New.
        ($SHA1SUM): New.
        Use it.
---
 ChangeLog           |    7 +++++++
 build-aux/bootstrap |   35 +++++++++++++++++++++++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5259d2d..8d5a7cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-19  Akim Demaille  <[email protected]>
+
+       bootstrap: find sha1sum when named gsha1sum.
+       * bootstrap (find_tool): New.
+       ($SHA1SUM): New.
+       Use it.
+
 2009-08-17  Joel E. Denny  <[email protected]>
 
        maint.mk: give full control over update-copyright exclusions
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 1e7bfac..417d7ea 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -148,6 +148,37 @@ copy=false
 # on which version control system (if any) is used in the source directory.
 vc_ignore=auto
 
+# find_tool ENVVAR NAMES...
+# -------------------------
+find_tool ()
+{
+  # Find sha1sum, named gsha1sum on MacPorts.
+  find_tool_envvar=$1
+  shift
+  if eval test x"\$$find_tool_envvar" = x; then
+    for i
+    do
+      if ($i --version </dev/null) >/dev/null 2>&1; then
+       find_tool_res=$i
+       break
+      fi
+    done
+  fi
+  if test x"$find_tool_res" = x; then
+    echo >&2 "$0: $find_tool_name is required"
+    exit 1
+  fi
+  ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
+    echo >&2 "$0: cannot run $find_tool_res --version"
+    exit 1
+  }
+  eval "$find_tool_envvar=\"$find_tool_res\""
+  eval "export $find_tool_envvar"
+}
+
+# Find sha1sum, named gsha1sum on MacPorts.
+find_tool SHA1SUM sha1sum gsha1sum
+
 # Override the default configuration, if necessary.
 # Make sure that bootstrap.conf is sourced from the current directory
 # if we were invoked as "sh bootstrap".
@@ -420,11 +451,11 @@ update_po_files() {
     cksum_file="$ref_po_dir/$po.s1"
     if ! test -f "$cksum_file" ||
         ! test -f "$po_dir/$po.po" ||
-        ! ${SHA1SUM-sha1sum} -c --status "$cksum_file" \
+        ! $SHA1SUM -c --status "$cksum_file" \
             < "$new_po" > /dev/null; then
       echo "updated $po_dir/$po.po..."
       cp "$new_po" "$po_dir/$po.po" \
-          && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
+          && $SHA1SUM < "$new_po" > "$cksum_file"
     fi
   done
 }
-- 
1.6.4


Reply via email to