| I have run into something that seems really strange to me.
| Autoconf will subst @prefix@ and @exec_prefix@ into a
| Makefile, but while ./configure is actually running they
| are not set. Here is a minimal example.
|
| % cat configure.in
| AC_INIT(foo.c)
|
| AC_PROG_CC
|
| echo "prefix is \"$prefix\""
| echo "exec_prefix is \"$exec_prefix\""
|
| AC_OUTPUT([Makefile])
|
| % cat Makefile.in
| prefix = @prefix@
| exec_prefix = @exec_prefix@
|
| Running this produces the following results:
|
| % ./configure
| checking for gcc... gcc
| ...
| prefix is "NONE"
| exec_prefix is "NONE"
| creating ./config.status
| creating Makefile
|
| % cat Makefile
| prefix = /usr/local
| exec_prefix = ${prefix}
|
| Does anyone else find that rather odd? I would like to
| be able to set vars that I am going to subst based on
| ${prefix} and ${exec_prefix}, but it seems that nasty
| hacks like the following are required in my configure.in.
"" is a valid value for those variables, we need something else to
know they have no value.
| if test "${prefix}" = "NONE"; then
| prefix=/usr/local
| fi
| if test "${exec_prefix}" = "NONE"; then
| exec_prefix=$prefix
| fi
Yep, this sucks, but I think we have to leave with that.
Anyway, you are not supposed to depend on those variables but from the
Makefile, which will handle all the evaluations. If you need to, see
AC_EXPAND_DIRNAME or so, from Alexandre, in the Autoconf Macro
Archive, but keep in mind this goes against the GNU Std: they say you
can change your mind between configure and make:
./configure prefix=toto
make prefix=/usr/local
This sucks too :( IMHO, it should not be possible, and maybe it is
now obsoleted by DESTDIR?