[Top][All Lists]

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

Re: Fix chdir-long.m4 caching

From: Stepan Kasal
Subject: Re: Fix chdir-long.m4 caching
Date: Fri, 29 Sep 2006 16:46:55 +0200
User-agent: Mutt/


On Wed, Sep 27, 2006 at 07:29:45PM +0200, I proposed:
> ``The right way'' first.
> 1a)
> I think that it would be best for consistency to write:
>   AC_CACHE_CHECK([for $1], [ac_var], ...
> and then remove the [] quotes from the definition of AC_CACHE_CHECK.

ie. using  AS_LITERAL_IF($1, [...], [...]) .

But this proposal was not radical enough.  Actually, AS_LITERAL_IF
should be responsible for the expansion, not the caller.

So the definition of AS_LITERAL_IF should not contain

        m4_bmatch([$1], ...
        m4_bmatch($1, ...

Or there is a safer way:

        m4_bmatch(m4_quote($1), ...

(It helps if the expansionof $1 contains a comma, for example.)

With this change, we can quote the parameters passed to AS_VAR_* or
AC_CACHE_CHECK.  There is no longer any need to expand the parameter
before passing it.

OTOH, as I said previously, if the parameter is passed expanded, the
extra expansion is harmless in almost all cases.

So I did the one line change to AS_LITERAL_IF, did many changes in
the indirect callers of it, and wrote a test case.

The resulting patch is attached here.

Can this bring some backward compatibility problems?
As I said before, I hope the problems should be rare.
After a consultation with Ralf Cautious Wildenhues, I tested the
patch with libtool (details below).  And I verified that my patch
passes the test suites of Autoconf and Automake.

So I believe the patch is safe.  OK to commit?

Details about the libtool testing:

I checked out the CVS HEAD version of libtool and run bootstrap
there, both vith the CVS version of Autoconf and with the patched
version of Autoconf.  Then I verified that the generated top-level
configure scripts are identical.

Then I did the same with branch-1-5 and with release-1-5-22
checkouts.  Again, my patch did not introduce any change to the
generated configure scripts.

(Actually, this all seemed too nice to be true, so I decided to
perform an experiment: I modified the second parameter of an
AC_CACHE_CHECK call in libltdl/m4/libtool.m4 this way:

AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1, ``)],

and ran the two bootstraps.  Indeed, this time the generated
configure scripts differed, as the unpatched autoconf thought that
the parameter is not literal.)

Have a nice day,

Attachment: autoconf-20060929-as-literal.patch
Description: Text document

reply via email to

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