melunko@47: dnl as-version.m4 0.1.0 melunko@47: melunko@47: dnl autostars m4 macro for versioning melunko@47: melunko@47: dnl Thomas Vander Stichele melunko@47: melunko@47: dnl $Id: as-version.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ melunko@47: melunko@47: dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO, melunko@47: dnl ACTION-IF-NO-NANO, [ACTION-IF-NANO]) melunko@47: melunko@47: dnl example melunko@47: dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,) melunko@47: dnl for a 0.3.2 release version melunko@47: melunko@47: dnl this macro melunko@47: dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO melunko@47: dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode melunko@47: dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE melunko@47: dnl - executes the relevant action melunko@47: dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE melunko@47: dnl as well as the little ones melunko@47: dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents melunko@47: dnl maintainer mode from running ok melunko@47: dnl melunko@47: dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h melunko@47: dnl if you use acconfig.h melunko@47: melunko@47: AC_DEFUN([AS_VERSION], melunko@47: [ melunko@47: PACKAGE=[$1] melunko@47: [$2]_MAJOR=[$3] melunko@47: [$2]_MINOR=[$4] melunko@47: [$2]_MICRO=[$5] melunko@47: NANO=[$6] melunko@47: [$2]_NANO=$NANO melunko@47: if test "x$NANO" = "x" || test "x$NANO" = "x0"; melunko@47: then melunko@47: AC_MSG_NOTICE(configuring [$1] for release) melunko@47: VERSION=[$3].[$4].[$5] melunko@47: [$2]_RELEASE=1 melunko@47: dnl execute action melunko@47: ifelse([$7], , :, [$7]) melunko@47: else melunko@47: AC_MSG_NOTICE(configuring [$1] for development with nano $NANO) melunko@47: VERSION=[$3].[$4].[$5].$NANO melunko@47: [$2]_RELEASE=0.`date +%Y%m%d.%H%M%S` melunko@47: dnl execute action melunko@47: ifelse([$8], , :, [$8]) melunko@47: fi melunko@47: melunko@47: [$2]=$VERSION melunko@47: AC_DEFINE_UNQUOTED([$2], "$[$2]", [Define the version]) melunko@47: AC_SUBST([$2]) melunko@47: AC_DEFINE_UNQUOTED([$2]_RELEASE, "$[$2]_RELEASE", [Define the release version]) melunko@47: AC_SUBST([$2]_RELEASE) melunko@47: melunko@47: AC_SUBST([$2]_MAJOR) melunko@47: AC_SUBST([$2]_MINOR) melunko@47: AC_SUBST([$2]_MICRO) melunko@47: AC_SUBST([$2]_NANO) melunko@47: AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name]) melunko@47: AC_SUBST(PACKAGE) melunko@47: AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version]) melunko@47: AC_SUBST(VERSION) melunko@47: ]) melunko@47: