diff options
author | Thomas Haller <thaller@redhat.com> | 2016-09-13 10:32:57 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-09-14 14:13:16 +0200 |
commit | 06946bf2ce1c3fd42a35ada02f2096e52081a244 (patch) | |
tree | 837663b488c440381c8866ef58e6bc9033db6e9b | |
parent | 96b31cdd820c9b7861bd652f310c50893d04bdc6 (diff) | |
download | NetworkManager-06946bf2ce1c3fd42a35ada02f2096e52081a244.tar.gz |
build: move detection of NM_GIT_SHA to separate "m4/git-sha-record.m4"
We want to embed the current commit-id in the ./configure script.
That way the generated ./configure file in the source tarball
references the commit-id from which the tarball was created.
Then, in a second step, a script can check ./configure to find
the parent commit. This is for example done by the 'makerepo.sh'
script.
This is generally useful, and also done by network-manager-applet
and libnl3 projects. Move the function to a separate m4 macro
to reuse it. It should also be re-used in NetworkManager's VPN plugins.
(cherry picked from commit b33aacbc91864f20f4733919af1a4cf8f725ca94)
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | m4/git-sha-record.m4 | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 8d0f841bcf..a5be3ec44b 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,6 @@ m4_define([nm_minor_version], [4]) m4_define([nm_micro_version], [1]) m4_define([nm_version], [nm_major_version.nm_minor_version.nm_micro_version]) -m4_define([nm_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 ])]) AC_INIT([NetworkManager], [nm_version], [http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager], @@ -48,12 +47,12 @@ NM_MAJOR_VERSION=nm_major_version NM_MINOR_VERSION=nm_minor_version NM_MICRO_VERSION=nm_micro_version NM_VERSION=nm_version -NM_GIT_SHA=nm_git_sha AC_SUBST(NM_MAJOR_VERSION) AC_SUBST(NM_MINOR_VERSION) AC_SUBST(NM_MICRO_VERSION) AC_SUBST(NM_VERSION) -AC_DEFINE_UNQUOTED(NM_GIT_SHA,"$NM_GIT_SHA",[git commit id of the original source code version]) + +GIT_SHA_RECORD(NM_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 0000000000..e259b39fbd --- /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 +]) |