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