From 4e1ffdd17c2c95c88867d48966d1ad3e8a600bb7 Mon Sep 17 00:00:00 2001 From: Guido Cossu Date: Thu, 10 Nov 2016 18:44:36 +0000 Subject: [PATCH] Adding git info to the configure output --- configure.ac | 8 ++++++++ scripts/configure.commit | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 scripts/configure.commit diff --git a/configure.ac b/configure.ac index 46fda677..944e53ef 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,9 @@ AC_CONFIG_SRCDIR([lib/Grid.h]) AC_CONFIG_HEADERS([lib/Config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +################ Get git info +#AC_REVISION([m4_esyscmd_s([./scripts/configure.commit])]) + ############### Checks for programs CXXFLAGS="-O3 $CXXFLAGS" AC_PROG_CXX @@ -379,10 +382,15 @@ AC_CONFIG_FILES(tests/qdpxx/Makefile) AC_CONFIG_FILES(benchmarks/Makefile) AC_OUTPUT +git_commit=`cd $srcdir && ./scripts/configure.commit` + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Summary of configuration for $PACKAGE v$VERSION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +----- GIT VERSION ------------------------------------- +$git_commit + ----- PLATFORM ---------------------------------------- architecture (build) : $build_cpu os (build) : $build_os diff --git a/scripts/configure.commit b/scripts/configure.commit new file mode 100755 index 00000000..77991392 --- /dev/null +++ b/scripts/configure.commit @@ -0,0 +1,19 @@ + + +#! /bin/sh +# Display the SHA1 of the commit in which configure.ac was last modified. +# If it's not checked in yet, use the SHA1 of HEAD plus -dirty. + +# + +if [ ! -d .git ] ; then + # if no .git directory, assume they're not using Git + printf 'unknown commit' +elif git diff --quiet HEAD -- configure.ac ; then + # configure.ac is not modified + printf 'commit: %s\n' `git rev-parse --short HEAD -- configure.ac` + printf 'branch: %s\n' `git rev-parse --abbrev-ref HEAD` +else # configure.ac is modified + printf 'commit: %s-dirty\n' `git rev-parse --short HEAD` + printf 'branch: %s\n' `git rev-parse --abbrev-ref HEAD` + fi \ No newline at end of file