[Top][All Lists]

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

Re: Feature suggestion: Option to generate a Makefile include file conta

From: Nick Bowler
Subject: Re: Feature suggestion: Option to generate a Makefile include file containing assignments for all of the output variables
Date: Mon, 1 Apr 2013 10:23:16 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On 2013-03-30 14:56 +0000, Gavin Smith wrote:
> autoconf-generated configure scripts substitute strings like @var@ in files
> like for the value of output variables set in the configure script. Most of
> the time, these will only be used in lines like
> var = @var@
> in The may have many of these lines. In fact,
> automake scans for use of the AC_SUBST macro and automatically
> adds such lines to the generated
> It can be confusing to try to understand what it means for variables to
> copied from one level of the build system to another. If a user writes
> by hand, they will have to write out all these lines manually.
> Also, it's hard to read's because of such lines.
> My suggestion would provide a simpler way which would work for most use
> cases. It would be to generate a file (called, say, "") which
> contained all these assignments automatically. I.e., would
> contain lines like
> CC = cc
> CXX = g++
> and so on. Then in the Makefile, have a line "include". The
> output variables would be referred to in the Makefile as ordinary
> environment variable (e.g. $(CC)).

To be honest, most Autoconf-using packages use Automake, and it's
unclear that Automake would be able to make use of this feature.  In
particular, Automake needs to suppress these definitions for assignments
that are explicitly written into  More importantly, a
package can have more than one file, some of which have
explicit assignments and others do not.  So I'm not sure if this
feature would be useful to very many packages.

But the good news is that Autoconf can already be used for something
very close to what you are asking.  Totally untested, but you could add
something like the following (perhaps with more error checking) to your
bootstrap script:

  % autoconf --trace 'AC_SUBST:$1' | sed 's/.*/& = @&@/' >

then add AC_CONFIG_FILES([]) to

Note also that just because something is AC_SUBSTed does not mean that
it is syntactically valid to stick in a Makefile like this.  Automake
also provides AM_SUBST_NOTMAKE to suppress the automatic
assignment, and you may want something similar.

Nick Bowler, Elliptic Technologies (

reply via email to

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