"Jerome G. Benoit" <[EMAIL PROTECTED]> writes:
> I have the fellowing `config.site': (see automake documentation)
>
> test "$prefix" = NONE && prefix=${HOME}/local
> test "$exec_prefix" = NONE && exec_prefix=${HOME}
OK.
> Autoconf considers as expected the first line,
> BUT NOT the second one, namely:
> `@prefix@' is replaced by `<HOME>/local`
That's right.
> `@bindir@` by `${exec_prefix}/bin`
And, that's also right. You did not change bindir, and, by default
bindir='${exec_prefix}/bin'
i.e., no expansion of $exec_prefix. The contents of the $bindir
(which is substituted into @bindir@) is literally '${exec_prefix}/bin'.
If you need the $exec_prefix to be expanded, you have a few options.
Assuming you have
AC_OUTPUT(foo)
and 'foo' is destined to be a shell script or Makefile or a fragment
thereof, 'foo.in' should have a line somewhere saying
exec_prefix=@exec_prefix@
If not, you can use the following macro:
# AC_EXPAND_DIR(VARNAME, DIR)
# From: Alexandre Oliva <[EMAIL PROTECTED]>
AC_DEFUN([AC_EXPAND_DIR],
[$1=$2
$1=`( test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""[$]$1"\"
)`
])
AC_EXPAND_DIR(my_bindir, $bindir)
AC_SUBST(my_bindir)
and use @my_bindir@ instead of @bindir@. Finally, you can write a
makefile rule:
foo: foo.in
sed 's,@bindir@,$(bindir),' $< > $@
Since 'make' fully expands $(bindir). This last trick is used in
GNOME, but I think Alexandre's macro is pretty cool :-)
- Hari
--
Raja R Harinath ------------------------------ [EMAIL PROTECTED]
"When all else fails, read the instructions." -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing." -- Roy L Ash