Unless I'm mistaken, I think we should forbid the placement of
non-makefiles in configure.in's AC_OUTPUT. I've already started
fixing this in the process of making the changes described below, but
let me explain why I think we need to do this so you can see if I've
overlooked something.
The problem:
============
The key problem is recursive expansion (or the lack thereof). As an
example, consider GNC_CONFIGDIR. It's defined in configure.in like
this:
GNC_CONFIGDIR=${sysconfdir}/gnucash
But little do you know that sysconfdir is defined in terms of prefix
so that after this assignment GNC_CONFIGDIR is set to
${prefix}/gnucash. Now, if you put something like
src/reports/pathconfig.h.in into AC_OUTPUT and you use @GNC_CONFIGDIR@
there, you'll get a pathconfig.h containing unexpanded ${prefix}
values.
Take as another example LOCALE_DIR, which we now sometimes set like this
LOCALE_DIR="$prefix/share/locale"
This is fine because $prefix will be expanded in this assignment, but
say someone comes along later and changes it to
LOCALE_DIR="$sharedstatedir/locale"
which (I think) is what it ought to be. Now gnucash is broken because
the C files using LOCALE_DIR will have ${prefix} rather than its
expansion embedded in them.
The reason that it's fine to put Makefiles into AC_OUTPUT, and that
they don't suffer from this problem is that Makefiles recursively
expand their variables. As a result, having anything other than
makefiles in AC_OUTPUT seems a bit too fragile to me.
The solution:
=============
Don't put anything but makefiles and makefile snippets into AC_OUTPUT.
Instead, handle the non-makefile expansions manually from the relevant
makefile.ins. For example, instead of putting
src/scm/bootstrap.scm.in into AC_OUTPUT, I've modified
src/scm/Makefile.in to conatain this:
default: bootstrap.scm
# We have to have a makefile dependency here to catch reconfigures.
bootstrap.scm: bootstrap.scm.in Makefile
perl -p \
-e "s|\@GNC_SHAREDIR\@|${GNC_SHAREDIR}|o;" \
-e "s|\@GNC_CONFIGDIR\@|${GNC_CONFIGDIR}|o" \
< $< > $@
TRASH += bootstrap.scm
Now make will handle the expansion and replacement and everything will
work the way it's supposed to.
Unless someone has a good objection or better alternative, I'll go
ahead and handle changing all the stuff we have now to follow this
model.
The reason all this came up is that I'm in the process of re-working
our configure setup to get rid of that little "Makefile.finish" bit at
the end. The reason it's there is because we wanted to be able to
allow you to configure with one --prefix and install "make prefix=foo
install" with another. This is important for packaging systems.
However, I'm changing us to use the X DESTDIR trick which simplifies
the process. The only user visible change is that you'll say "make
DESTDIR=foo install" to install in a different directory than
--prefix.
--
Rob Browning <[EMAIL PROTECTED]> PGP=E80E0D04F521A094 532B97F5D64E3930
--
Gnucash Developer's List
To unsubscribe send empty email to: [EMAIL PROTECTED]