2df93aeb8ab5eeb8968c2b5eb68cd9b70576c158
[cacao.git] / m4 / version.m4
1 dnl m4/version.m4
2 dnl
3 dnl Copyright (C) 2009
4 dnl CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 dnl
6 dnl This file is part of CACAO.
7 dnl
8 dnl This program is free software; you can redistribute it and/or
9 dnl modify it under the terms of the GNU General Public License as
10 dnl published by the Free Software Foundation; either version 2, or (at
11 dnl your option) any later version.
12 dnl
13 dnl This program is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 dnl General Public License for more details.
17 dnl
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this program; if not, write to the Free Software
20 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 dnl 02110-1301, USA.
22
23
24 dnl define detailed version numbers
25
26 AC_DEFUN([AC_VERSION_DETAIL],[
27 version="$PACKAGE_VERSION"
28 if test x`echo "$version" | $SED -e 's/[[0-9a-z+]]*//g'` = "x..";
29 then
30     major=`echo "$version" | $SED -e 's/\.[[0-9a-z.+]]*$//'`
31     minor=`echo "$version" | $SED -e 's/^[[0-9]]*\.//' -e 's/\.[[0-9a-z.+]]*$//'`
32     micro=`echo "$version" | $SED -r -e 's/^[[0-9]]*\.[[0-9]]*\.([[0-9]]*).*/\1/'`
33     extra=`echo "$version" | $SED -e 's/^[[0-9]]*\.[[0-9]]*\.[[0-9]]*//'`
34 else
35     major=`echo "$version" | $SED -e 's/\.[[0-9a-z.+]]*$//'`
36     minor=`echo "$version" | $SED -e 's/^[[0-9]]*\.//' -e 's/[[a-z.+]]*$//'`
37     micro=0
38     extra=`echo "$version" | $SED -e 's/^[[0-9]]*\.[[0-9]]*//'`
39 fi
40
41 AC_DEFINE_UNQUOTED(VERSION_MAJOR, $major, [major version number])
42 AC_DEFINE_UNQUOTED(VERSION_MINOR, $minor, [minor version number])
43 AC_DEFINE_UNQUOTED(VERSION_MICRO, $micro, [micro version number])
44 AC_DEFINE_UNQUOTED(VERSION_EXTRA, "$extra", [extra version info])
45 ])
46
47
48 dnl define some stuff required for -XX:+PrintConfig
49
50 AC_DEFUN([AC_VERSION_CONFIG],[
51 AC_DEFINE_UNQUOTED(VERSION_CONFIGURE_ARGS, "$ac_configure_args", [configure arguments])
52 AC_DEFINE_UNQUOTED(VERSION_CC, "$CC", [CC used])
53 AC_DEFINE_UNQUOTED(VERSION_CXX, "$CXX", [CXX used])
54 AC_DEFINE_UNQUOTED(VERSION_CFLAGS, "$OPT_CFLAGS $ARCH_CFLAGS $CC_FLAGS $CPPFLAGS", [CFLAGS used])
55 AC_DEFINE_UNQUOTED(VERSION_CXXFLAGS, "$OPT_CXXFLAGS $ARCH_CXXFLAGS $CXX_FLAGS $CPPFLAGS", [CXXFLAGS used])
56 ])