29 Mar 2009

28Mar09

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], [0]) AC_DEFUN([MINOR], [0]) AC_DEFUN([MICRO], [1]) 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.

About these ads


No Responses Yet to “29 Mar 2009”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 877 other followers

%d bloggers like this: