From 2bf1efd58bb67cb3b0fbb95522d1a67db7b74df6 Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Sun, 19 May 2013 14:02:29 +0000 Subject: [PATCH] [CONFIGURATION] * NEW: The TRUNK_VERSION macro is now defined to the overall SVN repository revision if Gambas is compiled from inside a repository. The value is detected by the Makefiles and passed as a command line definition to gcc. [INTERPRETER] * NEW: --version also prints the SVN revision number when gbx3 was compiled from a SVN repository. git-svn-id: svn://localhost/gambas/trunk@5662 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- acinclude.m4 | 8 ++++++++ main/gbx/gbx.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 64b465f34..181711dad 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -86,6 +86,14 @@ AC_DEFUN([GB_INIT_AUTOMAKE], AC_DEFINE(GAMBAS_PCODE_VERSION, 0x03050000, [Gambas bytecode version]) AC_DEFINE(GAMBAS_PCODE_VERSION_MIN, 0x03000000, [Minimum Gambas bytecode version]) + IN_REPO=$(svn info >/dev/null 2>&1 && echo yes) + if test -n "$IN_REPO"; then + ## These will go into the Makefiles. Quoting is a mess. + TRUNK_VERSION='$(shell svn info 2>/dev/null | grep Revision | egrep -wo "[[0-9]]+$$")' + AC_SUBST(TRUNK_VERSION) + export CPPFLAGS=$CPPFLAGS\ '-DTRUNK_VERSION=$(TRUNK_VERSION)' + fi + GB_CLEAR_MESSAGES ]) diff --git a/main/gbx/gbx.c b/main/gbx/gbx.c index f122da94e..e19926965 100644 --- a/main/gbx/gbx.c +++ b/main/gbx/gbx.c @@ -242,7 +242,13 @@ int main(int argc, char *argv[]) } else if (is_long_option(argv[1], 'V', "version")) { +#define xstr(m) #m +#define stringify(m) xstr(m) +#ifdef TRUNK_VERSION + printf(VERSION " #" stringify(TRUNK_VERSION) "\n"); +#else printf(VERSION "\n"); +#endif my_exit(0); } else if (is_long_option(argv[1], 'L', "license"))