From: David Goulet Date: Tue, 29 Jul 2014 15:28:51 +0000 (-0400) Subject: Add --disable-git-version to configure X-Git-Tag: v2.6.0-rc1~93 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ceb6ba5100c73f6a2b39475c89f3317d64fc9b48;p=lttng-tools.git Add --disable-git-version to configure By default, GIT_SOURCE variable is defined to 1. The disable option makes the configure to NOT define it. This way, anyone not wanting the git version like for instance packager building from the git repository, it can be used to remove it. Signed-off-by: David Goulet --- diff --git a/configure.ac b/configure.ac index 21cfab070..bd49df7ba 100644 --- a/configure.ac +++ b/configure.ac @@ -259,6 +259,15 @@ AC_CHECK_LIB([c], [open_memstream], ] ) +AC_ARG_ENABLE([git-version], + [AC_HELP_STRING([--disable-git-version], + [Do not use the git version for the build])], + [disable_git_version=yes], [disable_git_version=no] +) +if test "x${disable_git_version:-no}" = xno; then + AC_DEFINE_UNQUOTED([GIT_SOURCE], 1, [Disable git version.]) +fi + # For Python # SWIG version needed or newer: swig_version=2.0.0 diff --git a/include/Makefile.am b/include/Makefile.am index 89b084d01..d2061f1e0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -46,8 +46,8 @@ version.h: ## as the one currently in the file (if there is one), as we ## don't want to update the file if it is already up to date ## - if [ $$(grep -cE "^#define GIT_VERSION \"?$${git_version}\"?$$" "$${version_h}") -eq 0 ]; then \ - sed -i "s'^#define GIT_VERSION.*$$'#define GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \ + if [ $$(grep -cE "^#define GIT_VERSION_SED \"?$${git_version}\"?$$" "$${version_h}") -eq 0 ]; then \ + sed -i "s'^#define GIT_VERSION_SED.*$$'#define GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \ fi; \ fi; \ fi) diff --git a/include/version.h.tmpl b/include/version.h.tmpl index 861a477bc..e2ce531d4 100644 --- a/include/version.h.tmpl +++ b/include/version.h.tmpl @@ -20,6 +20,12 @@ #ifndef VERSION_H #define VERSION_H +#ifdef GIT_SOURCE +#define GIT_VERSION_PREFIX " - " +#define GIT_VERSION_SED "" +#else +#define GIT_VERSION_PREFIX "" #define GIT_VERSION "" +#endif #endif /* VERSION_H */ diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index 768ebb5e1..4e46d724f 100644 --- a/src/bin/lttng/commands/version.c +++ b/src/bin/lttng/commands/version.c @@ -164,7 +164,7 @@ int cmd_version(int argc, const char **argv) if (lttng_opt_mi) { ret = print_mi(); } else { - MSG("lttng version " VERSION " - " VERSION_NAME " - " GIT_VERSION); + MSG("lttng version " VERSION " - " VERSION_NAME GIT_VERSION_PREFIX GIT_VERSION); MSG("\n" VERSION_DESCRIPTION "\n"); MSG("Web site: http://lttng.org"); MSG("\n%s", lttng_license);