Debian Codegraph @

macros/as-version.m4

raw
1 dnl as-version.m4 0.1.0
2
3 dnl autostars m4 macro for versioning
4
5 dnl Thomas Vander Stichele <thomas at apestaart dot org>
6
7 dnl $Id$
8
9 dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO,
10 dnl ACTION-IF-NO-NANO, [ACTION-IF-NANO])
11
12 dnl example
13 dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,)
14 dnl for a 0.3.2 release version
15
16 dnl this macro
17 dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO
18 dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode
19 dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE
20 dnl - executes the relevant action
21 dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE
22 dnl as well as the little ones
23 dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
24 dnl maintainer mode from running ok
25 dnl
26 dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h
27 dnl if you use acconfig.h
28
29 AC_DEFUN([AS_VERSION],
30 [
31 PACKAGE=[$1]
32 [$2]_MAJOR=[$3]
33 [$2]_MINOR=[$4]
34 [$2]_MICRO=[$5]
35 NANO=[$6]
36 [$2]_NANO=$NANO
37 if test "x$NANO" = "x" || test "x$NANO" = "x0";
38 then
39 AC_MSG_NOTICE(configuring [$1] for release)
40 VERSION=[$3].[$4].[$5]
41 [$2]_RELEASE=1
42 dnl execute action
43 ifelse([$7], , :, [$7])
44 else
45 AC_MSG_NOTICE(configuring [$1] for development with nano $NANO)
46 VERSION=[$3].[$4].[$5].$NANO
47 [$2]_RELEASE=0.`date +%Y%m%d.%H%M%S`
48 dnl execute action
49 ifelse([$8], , :, [$8])
50 fi
51
52 [$2]=$VERSION
53 AC_DEFINE_UNQUOTED([$2], "$[$2]", [Define the version])
54 AC_SUBST([$2])
55 AC_DEFINE_UNQUOTED([$2]_RELEASE, "$[$2]_RELEASE", [Define the release version])
56 AC_SUBST([$2]_RELEASE)
57
58 AC_SUBST([$2]_MAJOR)
59 AC_SUBST([$2]_MINOR)
60 AC_SUBST([$2]_MICRO)
61 AC_SUBST([$2]_NANO)
62 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name])
63 AC_SUBST(PACKAGE)
64 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version])
65 AC_SUBST(VERSION)
66 ])