aboutsummaryrefslogtreecommitdiffstats
path: root/m4/update_build_version
diff options
context:
space:
mode:
Diffstat (limited to 'm4/update_build_version')
-rwxr-xr-xm4/update_build_version41
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/update_build_version b/m4/update_build_version
new file mode 100755
index 000000000000..35d4e1c9dfc4
--- /dev/null
+++ b/m4/update_build_version
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Update the build version file for am-utils
+# Erez Zadok <ezk AT cs.columbia.edu>
+#set -x
+
+file="build_version.h"
+vers=1
+
+if test -f $file
+then
+ egrep AMU_BUILD_VERSION $file | while read a b vers
+ do
+ vers=`expr $vers + 1`
+ echo '/* do not edit this file by hand */' > $file
+ echo '/* auto-generated by update_build_version script */' >> $file
+ echo '#define AMU_BUILD_VERSION '$vers >> $file
+ done
+else
+ echo '/* do not edit this file by hand */' > $file
+ echo '/* auto-generated by update_build_version script */' >> $file
+ echo '#define AMU_BUILD_VERSION '$vers >> $file
+fi
+
+if test -n "$USER"
+then
+ build_user="$USER"
+else
+ if test -n "$LOGNAME"
+ then
+ build_user="$LOGNAME"
+ else
+ build_user=`(whoami) 2>/dev/null` || build_user=unknown
+ fi
+fi
+echo '#define BUILD_USER "'$build_user'"' >> $file
+
+build_host=`(hostname || uname -n) 2>/dev/null` || build_host=unknown
+echo '#define BUILD_HOST "'$build_host'"' >> $file
+
+build_date=`(date) 2>/dev/null` || build_date=unknown_date
+echo '#define BUILD_DATE "'$build_date'"' >> $file