Re: [sabayon] AC_CONFIG_FILES incomplete?



On Wed, 2005-03-02 at 19:11 +0000, Mark McLoughlin wrote:
> On Wed, 2005-03-02 at 13:50 -0500, John Dennis wrote:
> > The macro AC_CONFIG_FILES in sabayon/configure.ac seems rather
> > incomplete. Am I missing something? Shouldn't all the *.in files be
> > listed? I noticed the problem when the various scripts in /bin
> > and /usr/sbin were referring to things in /usr/local/share/sabayon
> > instead of /usr/share/sabayon.
> 
> 	No, the other ones get generated from the Makefiles.

Found it, but why is it being done this way? Usually configure generates
the files. By doing it in the Makefile you've created two problems:

1) There is no dependency in the Makefile for creating things from
the .in files. Once the file is created it will never be regenerated. If
it gets created wrong its stays wrong. Running configure and make again
will not fix it.

2) You're using a hard coded substitution list unique to the Makefile
rather than the full set of substitutions created by configure. What if
a substitution changes or is added? That means the Makefiles have to be
manually edited rather than just having everything be automatically
correct. Seems like a maintenance problem.

Is there is a good reason not to use AC_CONFIG_FILES?

> 
> > That problem occurred (or so I believe) because of the following
> > reasons:
> > 
> > 1) sabayon/autogen.sh does not pass the same prefix to configure as when
> > the rpm is created (--prefix=/usr instead of the default /usr/local).
> > Shouldn't we make autogen.sh match what the rpm is going to do? It's way
> > too easy to end up with two uniquely different installation directories
> > on the same system.
> 
> 	I don't understand - autogen just passes its arguments straight through
> to configure.

Thats the problem :-) When you build an rpm configure is passed a set of
arguments. Take a look in /usr/lib/rpm/macros. One of those arguments is
--prefix=/usr

If you don't pass --prefix the configure.ac is going to do this:

REAL_PREFIX=$ac_default_prefix
prefix=$REAL_PREFIX

guess what ac_default_prefix is? Its /usr/local

This is easy to see, do the following:

% ./autogen.sh
% grep @prefix@ config.status
s,@prefix@,/usr/local,;t t

% ./autogen.sh --prefix=/usr
% grep @prefix@ config.status
s,@prefix@,/usr,;t t

So lets say just for laughs if someone did this (actually its pretty
reasonable thing to expect someone to do):

% ./autogen.sh
% make install

They would be screwed, sabayon would have two installation roots, one
from the rpm and one from the developement tree and no matter how many
times one tried to correct it in the development tree it would never get
fixed because there are no dependencies on the .in's. Ask me how I
discovered this problem :-) :-)


> 	Right, presumably the other generated files just need to depend on
> Makefile or something in Makefile.am.

The lack of a dependency is a problem, I'm not really sure what they
should depend on. It seems just so much easier to use AC_CONFIG_FILES,
which is how I *think* its supposed to work (but I'll admit when it
comes to autotools a lot of it is black magic and my notion of correct
usage may be wildly misinformed ;-)


-- 
John Dennis <jdennis redhat com>




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