gmyth-upnp/m4/as-version.m4
author rosfran
Wed Jan 10 20:35:17 2007 +0000 (2007-01-10)
branchtrunk
changeset 253 ef26dbeb7a5b
permissions -rw-r--r--
[svn r254] Added these 2 mandatory directories (m4 and common).
     1 dnl version.m4 0.0.5
     2 dnl autostars m4 macro for versioning
     3 dnl thomas@apestaart.org
     4 dnl
     5 dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO, ACTION_IF_NO_NANO, ACTION_IF_NANO)
     6 dnl example
     7 dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,)
     8 dnl for a 0.3.2 release version
     9 dnl
    10 dnl this macro
    11 dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO
    12 dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode
    13 dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE
    14 dnl - executes the relevant action
    15 dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE
    16 dnl   as well as the little ones
    17 dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
    18 dnl   maintainer mode from running ok
    19 dnl
    20 dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h
    21 
    22 AC_DEFUN([AS_VERSION],
    23 [
    24   PACKAGE=[$1]
    25   [$2]_MAJOR_VERSION=[$3]
    26   [$2]_MINOR_VERSION=[$4]
    27   [$2]_MICRO_VERSION=[$5]
    28   NANO=[$6]
    29   [$2]_NANO_VERSION=$NANO
    30   if test "x$NANO" = "x" || test "x$NANO" = "x0";
    31   then
    32       AC_MSG_NOTICE(configuring [$1] for release)
    33       VERSION=[$3].[$4].[$5]
    34       [$2]_RELEASE=1
    35       dnl execute action
    36       ifelse([$7], , :, [$7])
    37   else
    38       AC_MSG_NOTICE(configuring [$1] for development with nano $NANO)
    39       VERSION=[$3].[$4].[$5].$NANO
    40       [$2]_RELEASE=`date +%Y%m%d_%H%M%S`
    41       dnl execute action
    42       ifelse([$8], , :, [$8])
    43   fi
    44 
    45   [$2]_VERSION=$VERSION
    46   AC_DEFINE_UNQUOTED([$2]_VERSION, "$[$2]_VERSION", [Define the version])
    47   AC_SUBST([$2]_VERSION)
    48   
    49   AC_SUBST([$2]_RELEASE)
    50 
    51   AC_SUBST([$2]_MAJOR_VERSION)
    52   AC_SUBST([$2]_MINOR_VERSION)
    53   AC_SUBST([$2]_MICRO_VERSION)
    54   AC_SUBST([$2]_NANO_VERSION)
    55   AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name])
    56   AC_SUBST(PACKAGE)
    57   AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version])
    58   AC_SUBST(VERSION)
    59 ])