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