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