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