build: refactor GR_GIT and GR_VERSION
[debian/gnuradio] / config / gr_version.m4
1 dnl Copyright 2009,2010 Free Software Foundation, Inc.
2 dnl 
3 dnl This file is part of GNU Radio
4 dnl 
5 dnl GNU Radio is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3, or (at your option)
8 dnl any later version.
9 dnl 
10 dnl GNU Radio is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl 
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with GNU Radio; see the file COPYING.  If not, write to
17 dnl the Free Software Foundation, Inc., 51 Franklin Street,
18 dnl Boston, MA 02110-1301, USA.
19
20 AC_DEFUN([GR_VERSION],[
21   dnl Computed version based on version.sh
22   dnl Does not force recompile on rev change
23   dnl
24   dnl Source the variables describing the release version
25   dnl 
26   dnl MAJOR_VERSION          Major release generation (2.x, 3.x, etc.)
27   dnl API_COMPAT             API compatibility version (3.2.x, 3.3.x, etc.)
28   dnl MINOR_VERSION          Minor release version (3.3.0, 3.3.1, etc.)
29   dnl MAINT_VERSION          Pure bugfix additions to make maintenance release
30   dnl
31   dnl The last two fields can have 'git' instead of a number to indicate
32   dnl that this branch is between versions.
33   . $srcdir/version.sh
34   
35   dnl Get git version if available
36   GR_GIT
37
38   dnl Test if we should use git version
39   if test "$MINOR_VERSION" == "git"; then
40     dnl RELEASE: 3.3git-xxx-gxxxxxxxx
41     dnl DOCVER:  3.3git
42     dnl LIBVER:  3.3git
43     RELEASE=$GIT_DESCRIBE
44     DOCVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
45     LIBVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
46   else
47     if test "$MAINT_VERSION" == "git" ; then
48       dnl RELEASE: 3.3.1git-xxx-gxxxxxxxx
49       dnl DOCVER:  3.3.1git
50       dnl LIBVER:  3.3.1git
51       RELEASE=$GIT_DESCRIBE
52       DOCVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
53       LIBVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
54     else
55       dnl This is a numbered release.
56       dnl RELEASE: 3.3.1{.x}
57       dnl DOCVER:  3.3.1{.x}
58       dnl LIBVER:  3.3.1{.x}
59       RELEASE=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION
60       if test "$MAINT_VERSION" != "0"; then
61         RELEASE=$RELEASE.$MAINT_VERSION
62       fi
63
64       DOCVER=$RELEASE
65       LIBVER=$RELEASE
66     fi
67   fi
68
69   AC_MSG_NOTICE([GNU Radio Release $RELEASE])
70   AC_SUBST(RELEASE)
71   AC_SUBST(DOCVER)
72   AC_SUBST(LIBVER)
73 ])