automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My project can't use `silent-rules'


From: Robert Collins
Subject: Re: My project can't use `silent-rules'
Date: Mon, 18 May 2009 07:58:26 +1000

On Sun, 2009-05-17 at 15:43 -0500, Bob Friesenhahn wrote:

> The reason why my package can not use AC_INIT is that the package 
> version information is (often) computed by shell script code based on 
> the last entry in the project ChangeLog or other information.  It is 
> (apparently) not possible for user-provided script code to be executed 
> prior to AC_INIT and it is not clear if AC_INIT would allow passing a 
> shell variable in order to obtain the package version value.

This isn't necessarily an answer, but its a step towards one. I've
recently started using the following consistently in my projects - I got
tired of repeating version numbers as hard coded strings in multiple
places.

AC_DEFUN([FOO_MAJOR_VERSION], [0])
AC_DEFUN([FOO_MINOR_VERSION], [0])
AC_DEFUN([FOO_MICRO_VERSION], [1])
AC_DEFUN([FOO_VERSION],
[FOO_MAJOR_VERSION.FOO_MINOR_VERSION.FOO_MICRO_VERSION])
AC_PREREQ([2.59])
AC_INIT([libfoo], [FOO_VERSION], address@hidden)
AC_CONFIG_SRCDIR([foo/foo.h.in])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
[FOO_MAJOR_VERSION]=FOO_MAJOR_VERSION
[FOO_MINOR_VERSION]=FOO_MINOR_VERSION
[FOO_MICRO_VERSION]=FOO_MICRO_VERSION
[FOO_VERSION]=FOO_VERSION
AC_SUBST([FOO_MAJOR_VERSION])
AC_SUBST([FOO_MINOR_VERSION])
AC_SUBST([FOO_MICRO_VERSION])
AC_SUBST([FOO_VERSION])

Its pretty verbose, when I get some more time to fiddle with build
systems rather than writing code I'm going to look at reducing the
redundancy - it should be one line for each FOO_VARIABLE.

Anyhow, the key thing is that defining FOO_VARIABLE as a function lets
you do pretty much what you want.

-Rob

-- 

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]