[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem using AC_LANG_PROGRAM with AC_EGREP_CPP
From: |
Eric Blake |
Subject: |
Re: Problem using AC_LANG_PROGRAM with AC_EGREP_CPP |
Date: |
Mon, 30 Mar 2009 11:08:30 -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 Allan Caffee on 3/30/2009 8:12 AM:
>>>> My invocation of AC_EGREP_CPP looks like this:
>>>>
>>>> AC_EGREP_CPP([HAVE_GL_GLU_H], [AC_LANG_PROGRAM([[foo]], [[bar]])],
>>>> [OPENVRML_HAVE_GL_GLU_H=1],
>>>> [OPENVRML_HAVE_GL_GLU_H=0])
>>> In isolation, I don't see any quoting problems with this example. But I'm
>>> almost certain you didn't copy and paste from your configure.ac, so maybe
>>> in the rewrite for this email, you changed the quoting?
>
> AC_EGREP_CPP([HAVE_GL_GLU_H], AC_LANG_PROGRAM([[foo]], [[bar]]),
> [OPENVRML_HAVE_GL_GLU_H=1],
> [OPENVRML_HAVE_GL_GLU_H=0])
>
> I'm no Autoconf expert but isn't the way it was presented before
> overquoted? IIRC one layer of quoting is removed for each macro
> expansion. Doesn't this mean that quoting AC_LANG_PROGRAM would cause
> it to be passed to AC_EGREP_CPP literally? Perhaps I'm
> misunderstanding.
Ouch. AC_EGREP_CPP double-quotes its arguments, putting it in the same
category as other macros like AC_TRY_COMPILE which have been marked
obsolete because double-quoting is a bad default. AC_PREPROC_IFELSE has
saner semantics, but the source code reveals that indeed, you have to
underquote your second argument to AC_EGREP_CPP since AC_EGREP_CPP
overquotes it under the hood. I'm not sure what to do about this besides
improving the documentation, marking AC_EGREP_CPP as obsolete, and
providing a better replacement that doesn't need quite as much effort as
AC_PREPROC_IFELSE to make grepping preprocessor output easy.
- --
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
iEYEARECAAYFAknQ/I0ACgkQ84KuGfSFAYAJkgCgglH1r/2+kE/mI/r8YiOHL5a7
5EEAoLkrM5m5+xIcpkDRMWTRUtIKIC9m
=ZRr/
-----END PGP SIGNATURE-----