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