melunko@38: dnl version.m4 0.0.5 melunko@38: dnl autostars m4 macro for versioning melunko@38: dnl thomas@apestaart.org melunko@38: dnl melunko@38: dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO, ACTION_IF_NO_NANO, ACTION_IF_NANO) melunko@38: dnl example melunko@38: dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,) melunko@38: dnl for a 0.3.2 release version melunko@38: dnl melunko@38: dnl this macro melunko@38: dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO melunko@38: dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode melunko@38: dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE melunko@38: dnl - executes the relevant action melunko@38: dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE melunko@38: dnl as well as the little ones melunko@38: dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents melunko@38: dnl maintainer mode from running ok melunko@38: dnl melunko@38: dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h melunko@38: melunko@38: AC_DEFUN([AS_VERSION], melunko@38: [ melunko@38: PACKAGE=[$1] melunko@38: [$2]_MAJOR_VERSION=[$3] melunko@38: [$2]_MINOR_VERSION=[$4] melunko@38: [$2]_MICRO_VERSION=[$5] melunko@38: NANO=[$6] melunko@38: [$2]_NANO_VERSION=$NANO melunko@38: if test "x$NANO" = "x" || test "x$NANO" = "x0"; melunko@38: then melunko@38: AC_MSG_NOTICE(configuring [$1] for release) melunko@38: VERSION=[$3].[$4].[$5] melunko@38: [$2]_RELEASE=1 melunko@38: dnl execute action melunko@38: ifelse([$7], , :, [$7]) melunko@38: else melunko@38: AC_MSG_NOTICE(configuring [$1] for development with nano $NANO) melunko@38: VERSION=[$3].[$4].[$5].$NANO melunko@38: [$2]_RELEASE=`date +%Y%m%d_%H%M%S` melunko@38: dnl execute action melunko@38: ifelse([$8], , :, [$8]) melunko@38: fi melunko@38: melunko@38: [$2]_VERSION=$VERSION melunko@38: AC_DEFINE_UNQUOTED([$2]_VERSION, "$[$2]_VERSION", [Define the version]) melunko@38: AC_SUBST([$2]_VERSION) melunko@38: melunko@38: AC_SUBST([$2]_RELEASE) melunko@38: melunko@38: AC_SUBST([$2]_MAJOR_VERSION) melunko@38: AC_SUBST([$2]_MINOR_VERSION) melunko@38: AC_SUBST([$2]_MICRO_VERSION) melunko@38: AC_SUBST([$2]_NANO_VERSION) melunko@38: AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name]) melunko@38: AC_SUBST(PACKAGE) melunko@38: AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version]) melunko@38: AC_SUBST(VERSION) melunko@38: ])