2729 |
19 Apr 12 |
peter |
## $Id$ |
2729 |
19 Apr 12 |
peter |
2 |
# |
3229 |
20 May 14 |
peter |
# Copyright (C) 2012, 2014 Peter Johansson |
2729 |
19 Apr 12 |
peter |
4 |
# |
2729 |
19 Apr 12 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
2729 |
19 Apr 12 |
peter |
6 |
# |
2729 |
19 Apr 12 |
peter |
# The yat library is free software; you can redistribute it |
2729 |
19 Apr 12 |
peter |
# and/or modify it under the terms of the GNU General Public License as |
2729 |
19 Apr 12 |
peter |
# published by the Free Software Foundation; either version 3 of the |
2729 |
19 Apr 12 |
peter |
# License, or (at your option) any later version. |
2729 |
19 Apr 12 |
peter |
11 |
# |
2729 |
19 Apr 12 |
peter |
# The yat library is distributed in the hope that it will be useful, |
2729 |
19 Apr 12 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2729 |
19 Apr 12 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2729 |
19 Apr 12 |
peter |
# General Public License for more details. |
2729 |
19 Apr 12 |
peter |
16 |
# |
2729 |
19 Apr 12 |
peter |
# You should have received a copy of the GNU General Public License |
2729 |
19 Apr 12 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
2729 |
19 Apr 12 |
peter |
19 |
# |
2729 |
19 Apr 12 |
peter |
20 |
|
3256 |
09 Jun 14 |
peter |
# serial 2 (yat 0.13) |
2729 |
19 Apr 12 |
peter |
22 |
|
2729 |
19 Apr 12 |
peter |
# How to use this file |
2729 |
19 Apr 12 |
peter |
24 |
# ==================== |
3229 |
20 May 14 |
peter |
25 |
# |
3229 |
20 May 14 |
peter |
# Copy this file to your project, e.g. directory 'm4/'. Aclocal will |
3230 |
20 May 14 |
peter |
# not do that due to limitations. In 'configure.ac', include this file |
3229 |
20 May 14 |
peter |
# and call 'MY_VERSION_early' before 'AC_INIT'. After AC_INIT you can |
3229 |
20 May 14 |
peter |
# call MY_VERSION in order to AC_SUBST and AC_DEFINE variables |
3229 |
20 May 14 |
peter |
# FOO_MAJOR_VERSION, FOO_MINOR_VERSION etc., where FOO has been |
3229 |
20 May 14 |
peter |
# replaced with PACKAGE_NAME after appropriate translation (to suit a |
3229 |
20 May 14 |
peter |
# Make variable or PP #define): |
3229 |
20 May 14 |
peter |
33 |
# |
3229 |
20 May 14 |
peter |
# m4_include([m4/my_version.m4]) |
2729 |
19 Apr 12 |
peter |
# MY_VERSION_early([3],[1],[4],[true]) |
2729 |
19 Apr 12 |
peter |
# AC_INIT([foo], [my_VERSION]) |
2729 |
19 Apr 12 |
peter |
# MY_VERSION |
2729 |
19 Apr 12 |
peter |
38 |
|
2729 |
19 Apr 12 |
peter |
39 |
|
2729 |
19 Apr 12 |
peter |
# MY_VERSION_early(major, minor, patch, dev) |
2729 |
19 Apr 12 |
peter |
41 |
# ========== |
2729 |
19 Apr 12 |
peter |
42 |
m4_define([MY_VERSION_early], |
2729 |
19 Apr 12 |
peter |
43 |
[ |
2729 |
19 Apr 12 |
peter |
44 |
m4_define([my_MAJOR_VERSION], [$1]) |
2729 |
19 Apr 12 |
peter |
45 |
m4_define([my_MINOR_VERSION], [$2]) |
2729 |
19 Apr 12 |
peter |
46 |
m4_define([my_PATCH_VERSION], [$3]) |
2729 |
19 Apr 12 |
peter |
47 |
m4_define([my_DEV_BUILD], [$4]) |
2853 |
23 Sep 12 |
peter |
48 |
m4_define([my_VERSION],[$1.$2m4_if([$3],[0],,[.$3])m4_if([$4],[true],[pre])]) |
2729 |
19 Apr 12 |
peter |
49 |
]) # my_version |
2729 |
19 Apr 12 |
peter |
50 |
|
2729 |
19 Apr 12 |
peter |
51 |
|
2729 |
19 Apr 12 |
peter |
# MY_VERSION |
2729 |
19 Apr 12 |
peter |
53 |
# ========== |
2729 |
19 Apr 12 |
peter |
# AC_SUBST and AC_DEFINE variables set in MY_VERSION_early |
2729 |
19 Apr 12 |
peter |
55 |
m4_define([MY_VERSION], |
2729 |
19 Apr 12 |
peter |
56 |
[ |
2729 |
19 Apr 12 |
peter |
57 |
m4_ifndef([my_VERSION], |
2729 |
19 Apr 12 |
peter |
58 |
[m4_fatal([MY_VERSION_early must be expanded before MY_VERSION])]) |
2729 |
19 Apr 12 |
peter |
59 |
|
3229 |
20 May 14 |
peter |
60 |
AS_VAR_PUSHDEF([my_PACKAGE_SH], [m4_toupper(AC_PACKAGE_NAME)]) |
3229 |
20 May 14 |
peter |
61 |
AC_SUBST(my_PACKAGE_SH[_MAJOR_VERSION], [my_MAJOR_VERSION]) |
3229 |
20 May 14 |
peter |
62 |
AC_SUBST(my_PACKAGE_SH[_MINOR_VERSION], [my_MINOR_VERSION]) |
3229 |
20 May 14 |
peter |
63 |
AC_SUBST(my_PACKAGE_SH[_PATCH_VERSION], [my_PATCH_VERSION]) |
3229 |
20 May 14 |
peter |
64 |
AS_VAR_POPDEF([my_PACKAGE_SH]) |
3229 |
20 May 14 |
peter |
65 |
|
3229 |
20 May 14 |
peter |
66 |
m4_pushdef([my_PACKAGE_CPP], [AS_TR_CPP([m4_toupper(AC_PACKAGE_NAME)])]) |
3256 |
09 Jun 14 |
peter |
67 |
AC_DEFINE(my_PACKAGE_CPP[_DEV_BUILD],[my_DEV_BUILD], |
2729 |
19 Apr 12 |
peter |
68 |
[true if dev build (version ends with pre)]) |
3229 |
20 May 14 |
peter |
69 |
AC_DEFINE(my_PACKAGE_CPP[_MAJOR_VERSION], [my_MAJOR_VERSION], |
2729 |
19 Apr 12 |
peter |
70 |
[Define to major version]) |
3229 |
20 May 14 |
peter |
71 |
AC_DEFINE(my_PACKAGE_CPP[_MINOR_VERSION], [my_MINOR_VERSION], |
2729 |
19 Apr 12 |
peter |
72 |
[Define to minor version]) |
3229 |
20 May 14 |
peter |
73 |
AC_DEFINE(my_PACKAGE_CPP[_PATCH_VERSION], [my_PATCH_VERSION], |
2729 |
19 Apr 12 |
peter |
74 |
[Define to patch version]) |
3229 |
20 May 14 |
peter |
75 |
m4_popdef([my_PACKAGE_CPP]) |
2729 |
19 Apr 12 |
peter |
76 |
]) # MY_VERSION |