autoconf
[Top][All Lists]
Advanced

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

Re: possible autoconf bug


From: Matěj Týč
Subject: Re: possible autoconf bug
Date: Tue, 24 Mar 2009 12:20:20 +0100

> According to Matěj Týč on 3/23/2009 5:25 PM:
> > Hello, I have found out that having this in configure.ac is a problem:
> > 
> > AC_DEFUN([foo],
> >      [echo "#" ])
> 
> The bug is in your code - # starts a comment in m4, hence, the ]) is still
> part of the comment, and you haven't finished the AC_DEFUN.
> 
> > However, this is OK:
> > 
> > AC_DEFUN([foo],
> >      [echo "#" dnl
> >       ])
> 
> Yes, but there, the dnl is unexpanded, because it is output as part of the
> comment instead of its normal role of stripping output to the next
> newline.  And that can in turn cause surprises.

You are right with this one. However, the output of echo is '# dnl'. I
would expect "comments" do disappear completely rather then to appear in
the text. 
I have solved the case by adding another line after the line with the
unquoted # and everything seemed to be fine. This was confusing...

Now I understand that the hash only prevents m4 actions...

> > This is not nice since for instance
> > AC_DEFUN([foo],
> >      [echo "#define foo" > $somwhere ]) 
> > fails as well...
> 
> Use proper quoting.  Fully quoted (if there are no other macros):
> 
> AC_DEFUN([foo],
> [[echo "#define foo" > $somewhere]])
> 
> or minimally quoted (so that echo and somewhere can still be replaced by
> macros):
> 
> AC_DEFUN([foo],
> [echo "[#]define foo" > $somewhere])
> 
> or use quadrigraphs:
> 
> AC_DEFUN([foo],
> [echo "@%:@define foo" > $somewhere])
> 
> and reread this section of the manual:
> http://www.gnu.org/software/autoconf/manual/autoconf.html#M4-Quotation
> 
Regarding the manual: I have If you look at the page 158 (AS_TR_CPP
description), there is an unquoted hash (#) used in a configure.ac-like
file without any warning. 
On the other hand, the problem is very well described in the M4
quotation section which I have overlooked..

Thank you very much for your help! 





reply via email to

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