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"))