source: trunk/m4/my_version.m4

Last change on this file was 3256, checked in by Peter, 7 years ago

prefix DEV_BUILD with YAT_ (or uppercase(PACKAGE_) in general case, so it matches config_public.h.in

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 2.7 KB
Line 
1## $Id: my_version.m4 3256 2014-06-09 13:18:22Z peter $
2#
3# Copyright (C) 2012, 2014 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 2 (yat 0.13)
22
23# How to use this file
24# ====================
25#
26# Copy this file to your project, e.g. directory 'm4/'. Aclocal will
27# not do that due to limitations.  In 'configure.ac', include this file
28# and call 'MY_VERSION_early' before 'AC_INIT'.  After AC_INIT you can
29# call MY_VERSION in order to AC_SUBST and AC_DEFINE variables
30# FOO_MAJOR_VERSION, FOO_MINOR_VERSION etc., where FOO has been
31# replaced with PACKAGE_NAME after appropriate translation (to suit a
32# Make variable or PP #define):
33#
34#   m4_include([m4/my_version.m4])
35#   MY_VERSION_early([3],[1],[4],[true])
36#   AC_INIT([foo], [my_VERSION])
37#   MY_VERSION
38
39
40# MY_VERSION_early(major, minor, patch, dev)
41# ==========
42m4_define([MY_VERSION_early],
43[
44m4_define([my_MAJOR_VERSION], [$1])
45m4_define([my_MINOR_VERSION], [$2])
46m4_define([my_PATCH_VERSION], [$3])
47m4_define([my_DEV_BUILD], [$4])
48m4_define([my_VERSION],[$1.$2m4_if([$3],[0],,[.$3])m4_if([$4],[true],[pre])])
49]) # my_version
50
51
52# MY_VERSION
53# ==========
54# AC_SUBST and AC_DEFINE variables set in MY_VERSION_early
55m4_define([MY_VERSION],
56[
57m4_ifndef([my_VERSION],
58          [m4_fatal([MY_VERSION_early must be expanded before MY_VERSION])])
59
60AS_VAR_PUSHDEF([my_PACKAGE_SH], [m4_toupper(AC_PACKAGE_NAME)])
61AC_SUBST(my_PACKAGE_SH[_MAJOR_VERSION], [my_MAJOR_VERSION])
62AC_SUBST(my_PACKAGE_SH[_MINOR_VERSION], [my_MINOR_VERSION])
63AC_SUBST(my_PACKAGE_SH[_PATCH_VERSION], [my_PATCH_VERSION])
64AS_VAR_POPDEF([my_PACKAGE_SH])
65
66m4_pushdef([my_PACKAGE_CPP], [AS_TR_CPP([m4_toupper(AC_PACKAGE_NAME)])])
67AC_DEFINE(my_PACKAGE_CPP[_DEV_BUILD],[my_DEV_BUILD],
68          [true if dev build (version ends with pre)])
69AC_DEFINE(my_PACKAGE_CPP[_MAJOR_VERSION], [my_MAJOR_VERSION],
70                    [Define to major version])
71AC_DEFINE(my_PACKAGE_CPP[_MINOR_VERSION], [my_MINOR_VERSION],
72                    [Define to minor version])
73AC_DEFINE(my_PACKAGE_CPP[_PATCH_VERSION], [my_PATCH_VERSION],
74                    [Define to patch version])
75m4_popdef([my_PACKAGE_CPP])
76]) # MY_VERSION
Note: See TracBrowser for help on using the repository browser.