diff --git a/configure.ac b/configure.ac index 599619a8cc..3964be956a 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ 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]) dnl dnl Checks for typedefs, structures, and compiler characteristics. diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 4b284cfefd..e5a49d74b1 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -36,6 +36,7 @@ #include "nm-setting-private.h" #include "crypto.h" #include "gsystem-local-alloc.h" +#include "nm-utils-internal.h" #include "nm-setting-bond.h" #include "nm-setting-bridge.h" @@ -46,6 +47,9 @@ #include "nm-setting-wired.h" #include "nm-setting-wireless.h" +/* Embed the commit id in the build binary */ +static const char *const __nm_git_sha = STRLEN (NM_GIT_SHA) > 0 ? "NM_GIT_SHA:"NM_GIT_SHA : ""; + /** * SECTION:nm-utils * @short_description: Utility functions @@ -221,6 +225,8 @@ _nm_utils_init (void) GModule *self; gpointer func; + (void) __nm_git_sha; + if (initialized) return; initialized = TRUE; diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index b5bbfbd349..b6a9dc3004 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -37,6 +37,10 @@ #include "nm-dbus-glib-types.h" #include "nm-setting-private.h" #include "crypto.h" +#include "nm-utils-internal.h" + +/* Embed the commit id in the build binary */ +static const char *const __nm_git_sha = STRLEN (NM_GIT_SHA) > 0 ? "NM_GIT_SHA:"NM_GIT_SHA : ""; /** * SECTION:nm-utils @@ -232,6 +236,8 @@ static gboolean initialized = FALSE; gboolean nm_utils_init (GError **error) { + (void) __nm_git_sha; + if (!initialized) { initialized = TRUE;