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