autoconf
[Top][All Lists]
Advanced

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

Re: ac_cv_prog_gcc


From: Akim Demaille
Subject: Re: ac_cv_prog_gcc
Date: 08 Nov 2000 11:05:17 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

| On Nov  7, 2000, Pavel Roskin <address@hidden> wrote:
| > Hello, Akim!
| >> > $ac_cv_c_compiler_gnu() = yes;
| >> 
| Akim> Heck.  Thanks for noticing :(
| >> 
| >> I'm checking in the fix, thanks!
| >> 
| >> * aclang.m4 (ac_cv_prog_gcc, ac_cv_prog_gxx, ac_cv_prog_g77):
| >> Be AU_DEFUN'd, not AU_ALIAS'd.
| 
| > I'm afraid you are fixing the symptoms, not the cause.
| 
| I agree.  When $# is 0, we shouldn't add parentheses.

If we do this, we expose ourselves to new problems.  Don't forget that
these parens are separators, and if we don't force them, we might have
unexpected results, hard to track down.

For instance if for some reason the user had

AC_CANONICAL_SYSTEM([This macro computes $host])(echo "$host)

then autoupdate with parens (the current one) will produce

AC_CANONICAL_TARGET([])(echo "$host)

which is correct, while without parens you'd produce this:

AC_CANONICAL_TARGET(echo "$host)

which is wrong.

This is why it is important to distinguish mappings from macros to
macros (AU_ALIAS), from the other kinds of redefinition.

Yes, I agree my example is very uncommon and was made to demonstrate
my point, but in my M4 experience I have found this problem several
times (having a macro understand a pair of parens that was not meant
for it just because some () or [] was not separating them.  Of course
there are several macros invocations in between).

So the question, IMHO, is more like should we struggle for
AC_CANONICAL_TARGET() instead of AC_CANONICAL_TARGET([])?  I don't
think so (but it is true I'm never really happy to go and play again
with the autoupdate system).  It is not bad style to write ([]).  I
agree in the case of AC_CANONICAL_TARGET it is surprising, but think
of all the other macros which do take an optional argument.

And also, remember that this pair of parens is added *only* when
autoupdate really updates, it will not add them to macro invocations
without arguments:

| /tmp % cat configure.in                    
| AC_INIT                                    
| AC_CANONICAL_SYSTEM                        
| /tmp % $ace/autoupdate -A $ace             
| autoupdate: `configure.in' is updated      
| /tmp % cat configure.in                    
| AC_INIT                                    
| AC_CANONICAL_TARGET([])                    

Here it does add the ``parets''.  But below, since AC_CANONICAL_TARGET
is not AU'ed the three times ```configure.in' is unchanged''.

| /tmp % cat configure.in                    
| AC_INIT                                    
| AC_CANONICAL_TARGET([])                    
| /tmp % $ace/autoupdate -A $ace             
| autoupdate: `configure.in' is unchanged    

| /tmp % cat configure.in                    
| AC_INIT                                    
| AC_CANONICAL_TARGET()                      
| /tmp % $ace/autoupdate -A $ace             
| autoupdate: `configure.in' is unchanged    

| /tmp % cat configure.in                    
| AC_INIT                                    
| AC_CANONICAL_TARGET                        
| /tmp % $ace/autoupdate -A $ace             
| autoupdate: `configure.in' is unchanged



reply via email to

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