[network-manager-applet/nma-1-2] build: use GIT_SHA_RECORD() macro from "m4/git-sha-record.m4"



commit ee61c47919ac23a4bb964c3d03439a0760f944f1
Author: Thomas Haller <thaller redhat com>
Date:   Wed Sep 14 12:45:45 2016 +0200

    build: use GIT_SHA_RECORD() macro from "m4/git-sha-record.m4"
    
    See 
https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=b33aacbc91864f20f4733919af1a4cf8f725ca94
    
    (cherry picked from commit 309570724cd3c6e4de9593359e8bbfd1a0bf7323)
    (cherry picked from commit 972292126d809c244e76caf06cdac4301e217fcf)

 configure.ac         |    4 +---
 m4/git-sha-record.m4 |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c0f9e58..c57f09a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,9 +25,7 @@ dnl Initialize libtool
 LT_PREREQ([2.2.6])
 LT_INIT
 
-m4_define([nma_git_sha], [m4_esyscmd([ ( [ -d ./.git/ ] && [ "$(readlink -f ./.git/)" = "$(readlink -f 
"$(git rev-parse --git-dir 2>/dev/null)" 2>/dev/null)" ] && git rev-parse --verify -q HEAD 2>/dev/null ) || 
true ])])
-NMA_GIT_SHA=nma_git_sha
-AC_DEFINE_UNQUOTED(NMA_GIT_SHA,"$NMA_GIT_SHA",[git commit id of the original source code version])
+GIT_SHA_RECORD(NMA_GIT_SHA)
 
 dnl
 dnl Checks for typedefs, structures, and compiler characteristics.
diff --git a/m4/git-sha-record.m4 b/m4/git-sha-record.m4
new file mode 100644
index 0000000..e259b39
--- /dev/null
+++ b/m4/git-sha-record.m4
@@ -0,0 +1,15 @@
+dnl GIT_SHA_RECORD($1, $2)
+dnl
+dnl $1: the name of the assigned variable. For example NM_GIT_SHA,
+dnl     NMA_GIT_SHA, LIBNL_GIT_SHA.
+dnl $2: by default, a define to config.h is added. This can be
+dnl     suppressed by passing "no-config-h".
+dnl
+AC_DEFUN([GIT_SHA_RECORD], [
+    m4_define([git_sha_record_v],
+              [m4_esyscmd([ ( [ -d ./.git/ ] && [ "$(readlink -f ./.git/)" = "$(readlink -f "$(git rev-parse 
--git-dir 2>/dev/null)" 2>/dev/null)" ] && git rev-parse --verify -q HEAD 2>/dev/null ) || true ])])
+$1=git_sha_record_v
+if test ""$2"" != "no-config-h" ; then
+    AC_DEFINE_UNQUOTED($1,"$$1",[git commit id of the original source code version])
+fi
+])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]