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