Add --disable-git-version to configure
authorDavid Goulet <dgoulet@efficios.com>
Tue, 29 Jul 2014 15:28:51 +0000 (11:28 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 29 Jul 2014 15:54:17 +0000 (11:54 -0400)
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 <dgoulet@efficios.com>
configure.ac
include/Makefile.am
include/version.h.tmpl
src/bin/lttng/commands/version.c

index 21cfab070411d22ea1c4a79e957594c6df1c61a2..bd49df7ba12a20cc13a0a1f2e72b6d8d711ae77b 100644 (file)
@@ -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
index 89b084d01b45a62bcbd59ce62e04292dfcae5cbd..d2061f1e05ea75bb7db8fd542dc683d19253bdca 100644 (file)
@@ -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)
index 861a477bca44b14154ab25ab31cc0199f233ecba..e2ce531d4a24ff5a80d32fbf2a51f9128691fb8b 100644 (file)
 #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 */
index 768ebb5e14c030825de7a1d5226bc883b8716658..4e46d724f10941400be812e7582aa4d60750a869 100644 (file)
@@ -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);
This page took 0.027684 seconds and 4 git commands to generate.