source: trunk/m4/my_version.m4 @ 1511

Last change on this file since 1511 was 1511, checked in by Peter Johansson, 8 years ago

update version macro from yat

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 2.3 KB
Line 
1## $Id: my_version.m4 1511 2012-09-16 23:23:58Z peter $
2#
3# Copyright (C) 2012 Peter Johansson
4#
5# This file is part of the yat library, http://dev.thep.lu.se/yat
6#
7# The yat library is free software; you can redistribute it
8# and/or modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 3 of the
10# License, or (at your option) any later version.
11#
12# The yat library is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with yat. If not, see <http://www.gnu.org/licenses/>.
19#
20
21# serial 0
22
23# How to use this file
24# ====================
25# In 'configure.ac', include this file and call 'MY_VERSION_early'
26# before 'AC_INIT'.  After AC_INIT you can call MY_VERSION in order to
27# AC_SUBST and AC_DEFINE variables MAJOR_VERSION, MINOR_VERSION etc.
28#   m4_include([m4/version.m4])
29#   MY_VERSION_early([3],[1],[4],[true])
30#   AC_INIT([foo], [my_VERSION])
31#   MY_VERSION
32
33
34# MY_VERSION_early(major, minor, patch, dev)
35# ==========
36m4_define([MY_VERSION_early],
37[
38m4_define([my_MAJOR_VERSION], [$1])
39m4_define([my_MINOR_VERSION], [$2])
40m4_define([my_PATCH_VERSION], [$3])
41m4_define([my_DEV_BUILD], [$4])
42m4_define([my_VERSION],[$1.$2m4_if([$3],[0],,[.$3])m4_if([$4],[true],[pre])])
43]) # my_version
44
45
46# MY_VERSION
47# ==========
48# AC_SUBST and AC_DEFINE variables set in MY_VERSION_early
49m4_define([MY_VERSION],
50[
51m4_ifndef([my_VERSION],
52          [m4_fatal([MY_VERSION_early must be expanded before MY_VERSION])])
53AC_SUBST(m4_toupper(AC_PACKAGE_NAME)[_MAJOR_VERSION], [my_MAJOR_VERSION])
54AC_SUBST(m4_toupper(AC_PACKAGE_NAME)[_MINOR_VERSION], [my_MINOR_VERSION])
55AC_SUBST(m4_toupper(AC_PACKAGE_NAME)[_PATCH_VERSION], [my_PATCH_VERSION])
56
57AC_DEFINE([DEV_BUILD],[my_DEV_BUILD],
58          [true if dev build (version ends with pre)])
59AC_DEFINE(m4_toupper(AC_PACKAGE_NAME)[_MAJOR_VERSION], [my_MAJOR_VERSION],
60                    [Define to major version])
61AC_DEFINE(m4_toupper(AC_PACKAGE_NAME)[_MINOR_VERSION], [my_MINOR_VERSION],
62                    [Define to minor version])
63AC_DEFINE(m4_toupper(AC_PACKAGE_NAME)[_PATCH_VERSION], [my_PATCH_VERSION],
64                    [Define to patch version])
65]) # MY_VERSION
Note: See TracBrowser for help on using the repository browser.