autoconf
[Top][All Lists]
Advanced

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

Re: possible autoconf bug


From: Eric Blake
Subject: Re: possible autoconf bug
Date: Mon, 23 Mar 2009 18:08:56 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

> 
> 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

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknIJJgACgkQ84KuGfSFAYB0pACfRksTPMfMhfSE0DnbPx1mJn0i
dXwAnibDTCsglizp2VKIqUvXZAEya0TN
=mrWb
-----END PGP SIGNATURE-----




reply via email to

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