automake and ./configure (was: installation paths, option definition)

Christian Stimming stimming at
Sat Sep 3 16:39:11 EDT 2005

Just to finish that other automake/configure discussion:

Am Freitag, 2. September 2005 18:19 schrieb Neil Williams:
> > (And just one nitpicking remark: The auto-generation of a header from a
> > file is done by "./configure", not by "automake" -- automake
> > basically only creates a "" from a "", but the
> > processing of the *.in files is always done by ./configure.)
> Not in this case, nor in lots of cases within GnuCash. We use a Guile
> convention in lots of areas that does no substitution during configure,
> only in the using a customised sed routine.
> qsf-dir.h:
>         rm -f $@.tmp
>         sed < $< > $@.tmp \
>                 -e 's:@-QSF_SCHEMA_DIR-@:${QSF_SCHEMA_DIR}:g'
>         mv $@.tmp $@
> That has been in place for schema validation for some months and also
> passes an installation path by a header file. No problems with that one.
> It's actually more flexible because the output can be updated without a
> complete ./

Ahh, okay, didn't know that. However, it is still not "automake" that will 
generate the file qsf-dir.h. Instead, you now added a manual "creation rule" 
to the which will appear unchanged in the Makefile. This creation 
rule will then be executed when you run "make". So what happens here is that 
"make" will create the qsf-dir.h according to this manuale creation rule 
which is defined in the It is not automake that creates your 
header but make. 

You can reach exactly the same effect but without the manual creation rule if  
you do the following steps: 

1. Make sure all your desired substitution variables (e.g. QSF_SCHEMA_DIR) are 
listed in the file as AC_SUBST [e.g. AC_SUBST(QSF_SCHEMA_DIR) ]
2. In your file, list these variables with surrounding @...@ but 
not @-...-@ (e.g. #define blabla @QSF_SCHEMA_DIR@)
3. Add the input file in your file to the long list in AC_OUTPUT 
(e.g. src/bla/bla/
4. Add the resulting *output* file in that directory's to any  
variable that ensures that this file is distributed, e.g. 
noinst_HEADERS=qsf-dir.h and probably also BUILT_SOURCES=qsf-dir.h

This way, you gain the following: 1. You don't need to add the multi-line 
manual creation rule to the anymore, and 2. ./configure will make 
sure that you have all AC_SUBST variables available. And 3. the rule won't 
fail if "sed" happens to be called in some weird unusual way which we don't 
know but ./configure on that platform will know.

I don't quite understand why the manual rule was added in the first place. 
Maybe there was a reason, maybe not. In any case such installation paths 
change if and only if ./configure has been run, so having the resulting path 
created only by ./configure is just the exact right thing to do. The file 
gnucash.keys is surely one that can direcly be added to And 
unless you have a very specific reason to go for a manual rule, you should  
simply add those files as AC_OUTPUT to


More information about the gnucash-devel mailing list