Add config.sh which searches for gnu versions of 'cp' 'stat' 'date' and 'xargs'.

Signed-off-by: Bryan Larsen <[EMAIL PROTECTED]>
---

 config.sh |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/config.sh b/config.sh
new file mode 100755
--- /dev/null
+++ b/config.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Search for gnu utils.
+# Copyright (c) Bryan Larsen, 2005
+#
+# cogito and git-*-script rely on gnu versions of
+# cp, date, xargs and stat.  Look for them and
+# ensure they're gnu.
+#
+
+set -e
+
+if which gdate > /dev/null ; then 
+    DATE=gdate ;
+else 
+    DATE=date ; 
+fi ;
+
+# you don't actually have to have gnu date, it just works better.
+
+if which gcp > /dev/null ; then 
+    CP=gcp ; 
+else 
+    CP=cp ; 
+fi ;
+
+if $CP -a config.sh cp-test-dummy ; then 
+    rm cp-test-dummy ;
+else 
+    echo 'You must have gnu cp installed'; 
+    exit 1; 
+fi ;
+
+if which gnuxargs > /dev/null ; then 
+    XARGS=gnuxargs ; 
+else 
+    XARGS=xargs ; 
+fi ;
+
+if ! ( echo | $XARGS -r ) ; then 
+    echo 'You must have gnu xargs installed'; 
+    exit 1; 
+fi ;
+
+if which gstat > /dev/null ; then
+    STAT=gstat ;
+else
+    STAT=stat ;
+fi ;
+
+if ! ($STAT -c '%s' config.sh > /dev/null ) ; then
+    if which awk > /dev/null ; then
+       STAT=dont_have_stat ;
+    else
+       echo 'You must have awk or gnu stat installed.';
+       exit 1;
+    fi
+fi ;
+
+echo CP=$CP > config
+echo XARGS=$XARGS >> config
+echo DATE=$DATE >> config
+echo STAT=$STAT >> config
+
+set +e
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to