Import boehm-gc snapshot, taken from
[official-gcc.git] / boehm-gc / m4 / gc_set_version.m4
blobe805a7a3de7b4ae10fd047e4d6e60f5fe2e5f2e9
2 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
3 # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
5 # Permission is hereby granted to use or copy this program
6 # for any purpose,  provided the above notices are retained on all copies.
7 # Permission to modify the code and to distribute modified code is granted,
8 # provided the above notices are retained, and a notice that the code was
9 # modified is included with the above copyright notice.
11 # GC_SET_VERSION
12 # sets and AC_DEFINEs GC_VERSION_MAJOR, GC_VERSION_MINOR and GC_ALPHA_VERSION
13 # based on the contents of PACKAGE_VERSION; PACKAGE_VERSION must conform to
14 # [0-9]+[.][0-9]+(alpha[0.9]+)?
15 # in lex syntax; if there is no alpha number, GC_ALPHA_VERSION is empty
17 AC_DEFUN([GC_SET_VERSION], [
18   AC_MSG_CHECKING(GC version numbers)
19   GC_VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\([[0-9]][[0-9]]*\)[[.]].*$/\1/g'`
20   GC_VERSION_MINOR=`echo $PACKAGE_VERSION | sed 's/^[[^.]]*[[.]]\([[0-9]][[0-9]]*\).*$/\1/g'`
21   GC_ALPHA_VERSION=`echo $PACKAGE_VERSION | sed 's/^[[^.]]*[[.]][[0-9]]*//'`
23   case "$GC_ALPHA_VERSION" in
24     alpha*)
25       GC_ALPHA_VERSION=`echo $GC_ALPHA_VERSION \
26       | sed 's/alpha\([[0-9]][[0-9]]*\)/\1/'` ;;
27     *)  GC_ALPHA_MAJOR='' ;;
28   esac
30   if test :$GC_VERSION_MAJOR: = :: \
31      -o   :$GC_VERSION_MINOR: = :: ;
32   then
33     AC_MSG_RESULT(invalid)
34     AC_MSG_ERROR([nonconforming PACKAGE_VERSION='$PACKAGE_VERSION'])
35   fi
37   AC_DEFINE_UNQUOTED([GC_VERSION_MAJOR], $GC_VERSION_MAJOR,
38                      [The major version number of this GC release.])
39   AC_DEFINE_UNQUOTED([GC_VERSION_MINOR], $GC_VERSION_MINOR,
40                      [The minor version number of this GC release.])
41   if test :$GC_ALPHA_VERSION: != :: ; then
42     AC_DEFINE_UNQUOTED([GC_ALPHA_VERSION], $GC_ALPHA_VERSION,
43                        [The alpha version number, if applicable.])
44   fi
45   AC_MSG_RESULT(major=$GC_VERSION_MAJOR minor=$GC_VERSION_MINOR \
46 ${GC_ALPHA_VERSION:+alpha=}$GC_ALPHA_VERSION)
49 sinclude(libtool.m4)