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