autoconf
[Top][All Lists]
Advanced

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

Re: ${prefix} expansion in configure.ac ?


From: Philippe Trottier
Subject: Re: ${prefix} expansion in configure.ac ?
Date: Tue, 08 Feb 2005 12:44:46 +0200
User-agent: Mozilla Thunderbird 1.0 (X11/20050114)

Stepan Kasal wrote:

Hi,

On Mon, Feb 07, 2005 at 03:40:02PM +0200, Philippe Trottier wrote:
here is something I have noticed, exec_prefix is set to NONE until the end of the config script... now I am thinking to see if it is set at NONE and if it is then set exec_prefix to ${prefix}, and put it back to NONE afterward ... does that make any sense ?

if it's set to NONE, it means it hasn't been given on the command line.
Perhaps a macro below will execute

        test $exec_prefix = NONE
Yes that I noticed...

to see whether a value was given or not.  I don't want to destroy this
information, so I restore the previous state.

It would be also possible to do something like:

test "x$prefix" = xNONE &&  prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
eval eval ac_define_dir="\"\\\"$1\\\"\""
test -d "$ac_define_dir" dnl

or even:

test "x$prefix" = xNONE &&  prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
eval eval test -d "\"\\\"$1\\\"\"" dnl

But please note that I had to change the value assigned to exec_prefix,
and I had to add one more `eval' on that account.
But why is it not set at the beginning just like ${prefix} is a good question ...

The reason is that in the generated Makefiles, you should see:

        exec_prefix = ${prefix}

not the value of $prefix.  This subtle difference enables the following:

        make prefix=...

which should change both prefix and exec_prefix variables.

To sum up, I think the solution with restoring NONEs is the cleanest way.
setting the exec_prefix in the beginning of configure.ac would still allow the exec_prefix to be set at make stage (I think ?) any other reasons why it should be left to NONE till the end ? non- Unix platforms maybe ?

The other solution is not to touch it at all, but I do not know if with my clumsy use of sed is dangerous or not... then I have been trying to understand the disable and enable trouble in this case, it does seem to work very nicely, at least for me ...

    AC_MSG_CHECKING([Library directory at])
    if test "${exec_prefix}" = "NONE" ; then
        eval test -d `echo $libdir | sed 's,exec_prefix,prefix,'` &&
eval LDFLAGS="-L`echo $libdir | sed 's,exec_prefix,prefix,'` $LDFLAGS" &&
   else
        eval test -d $libdir &&
        eval LDFLAGS="-L$libdir $LDFLAGS" &&
   fi
   AC_MSG_RESULT($libdir)


I know I should rebraket everything to make it clean again ... I know I am not the only one trying to do the same thing, so I'll keep it complete ...

Phil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]