29 Mar 2009
This has irritated me for a while in configure.ac. You’ve probably seen this pattern before:
AC_INIT([foo], [0.0.1]) MAJOR=0 MINOR=0 MICRO=1 MY_VERSION=$MAJOR.$MINOR.$MICRO AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(MICRO) AC_SUBST(MY_VERSION)
I finally hit my annoyance threshold for this, and the answer is pretty obvious. (If its not, or you think there is a simpler one, give it a shot – I’d like something more pithy).
AC_DEFUN([MAJOR], ) AC_DEFUN([MINOR], ) AC_DEFUN([MICRO], ) AC_DEFUN([MY_VERSION], [MAJOR.MINOR.MICRO]) AC_INIT([foo], [MY_VERSION]) AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(MICRO) AC_SUBST(MY_VERSION)
Its not a big deal to be duplicating version numbers, but not duplicating at all is nicer.
Filed under: Uncategorized | Leave a Comment