* configure.ac: Define detailed version numbers.
[cacao.git] / m4 / version.m4
diff --git a/m4/version.m4 b/m4/version.m4
new file mode 100644 (file)
index 0000000..ba7c0e4
--- /dev/null
@@ -0,0 +1,56 @@
+dnl m4/version.m4
+dnl
+dnl Copyright (C) 2009
+dnl CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+dnl
+dnl This file is part of CACAO.
+dnl
+dnl This program is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 2, or (at
+dnl your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+dnl 02110-1301, USA.
+
+
+dnl define detailed version numbers
+
+AC_DEFUN([AC_VERSION_DETAIL],[
+version="$PACKAGE_VERSION"
+if test x`echo "$version" | $SED -e 's/[[0-9a-z+]]*//g'` = "x..";
+then
+    major=`echo "$version" | $SED -e 's/\.[[0-9a-z.+]]*$//'`
+    minor=`echo "$version" | $SED -e 's/^[[0-9]]*\.//' -e 's/\.[[0-9a-z.+]]*$//'`
+    micro=`echo "$version" | $SED -e 's/^[[0-9]]*\.[[0-9]]*\.//' -e 's/[[a-z.+]]*$//'`
+    extra=`echo "$version" | $SED -e 's/^[[0-9]]*\.[[0-9]]*\.[[0-9]]*//'`
+else
+    major=`echo "$version" | $SED -e 's/\.[[0-9a-z.+]]*$//'`
+    minor=`echo "$version" | $SED -e 's/^[[0-9]]*\.//' -e 's/[[a-z.+]]*$//'`
+    micro=0
+    extra=`echo "$version" | $SED -e 's/^[[0-9]]*\.[[0-9]]*//'`
+fi
+
+AC_DEFINE_UNQUOTED(VERSION_MAJOR, $major, [major version number])
+AC_DEFINE_UNQUOTED(VERSION_MINOR, $minor, [minor version number])
+AC_DEFINE_UNQUOTED(VERSION_MICRO, $micro, [micro version number])
+AC_DEFINE_UNQUOTED(VERSION_EXTRA, "$extra", [extra version info])
+])
+
+
+dnl define some stuff required for -XX:+PrintConfig
+
+AC_DEFUN([AC_VERSION_CONFIG],[
+AC_DEFINE_UNQUOTED(VERSION_CONFIGURE_ARGS, "$ac_configure_args", [configure arguments])
+AC_DEFINE_UNQUOTED(VERSION_CC, "$CC", [CC used])
+AC_DEFINE_UNQUOTED(VERSION_CXX, "$CXX", [CXX used])
+AC_DEFINE_UNQUOTED(VERSION_CFLAGS, "$OPT_CFLAGS $ARCH_CFLAGS $CC_FLAGS $CPPFLAGS", [CFLAGS used])
+AC_DEFINE_UNQUOTED(VERSION_CXXFLAGS, "$OPT_CXXFLAGS $ARCH_CXXFLAGS $CXX_FLAGS $CPPFLAGS", [CXXFLAGS used])
+])