autoconf
[Top][All Lists]
Advanced

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

Re: $sysconfdir substitution


From: Kip Warner
Subject: Re: $sysconfdir substitution
Date: Fri, 10 Jun 2016 14:09:11 -0700

On Fri, 2016-06-10 at 20:30 +0100, Gavin Smith wrote:
> On 10 June 2016 at 08:05, Peter Johansson <address@hidden> wrote:
> > Hi Kip,
> > 
> > I have the following rule in my Makefile.am to generate a C header
> > file.
> > 
> > configmake.h: Makefile
> >     $(AM_V_GEN)echo '#define BINDIR "$(bindir)"' > $@
> > 
> > You could have a similar rule to generate a file suitable to source
> > into
> > your script.
> 
> This works because the variable "bindir" is completely expanded in
> the
> Makefile rules.
> 
> The Texinfo project has similar code to substitute for variables in a
> AC_CONFIG_FILE-like way in an output file:
> 
> do_subst = sed \
>   -e 's,address@hidden@],$(PACKAGE_VERSION),g' \
>   -e 's,address@hidden@],$(PACKAGE_NAME),g' \
>   -e 's,address@hidden@],$(PACKAGE_URL),g' \
>   -e 's,address@hidden@],$(sysconfdir),g' \
>   -e 's,address@hidden@],$(prefix),g' \
>   -e 's,address@hidden@],$(datarootdir),g' \
>   -e 's,address@hidden@],$(datadir),g' \
>   -e 's,address@hidden@],$(pkglibdir),g' \
>   -e 's,address@hidden@],$(PACKAGE),g' \
>   -e 's,address@hidden@],$(USE_EXTERNAL_LIBINTL),g' \
>   -e
> 's,address@hidden@],$(USE_EXTERNAL_EASTASIANWIDTH),g
> ' \
>   -e 's,address@hidden@],$(USE_EXTERNAL_UNIDECODE),g' \
>   -e 's,address@hidden@],$(TEXINFO_DTD_VERSION),g' \
>   -e 's,address@hidden@],$(enable_xs),g' \
>   -e '1 s,/usr/bin/env perl,$(PERL),g'
> 
> texi2any: texi2any.pl $(top_builddir)/config.status
>         $(do_subst) $(srcdir)/texi2any.pl >$@
>         chmod a+x $@
> 
> The gist of this is that it's using sed to generate one file from
> another, substituting in the values of some Makefile variables. I
> don't know if it's possible or advisable to use this in combination
> with AC_CONFIG_FILES, but using it instead of AC_CONFIG_FILES would
> certainly work.

Thanks Gavin. I think this is a good recipe to use if I end up having
regrets later about the solution I just proposed to Peter Johansson.

-- 
Kip Warner -- Senior Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

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


reply via email to

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