autoconf
[Top][All Lists]
Advanced

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

Re: why doesn't this macro work!?


From: Eric Blake
Subject: Re: why doesn't this macro work!?
Date: Sun, 08 Mar 2009 08:40:31 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666

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

Please don't top-post on technical lists.

According to John Wohlbier on 3/8/2009 12:42 AM:
>> but other variations give me
>> -DDBC=\$withval
>> -DDBC=\$DBC
>>
>>                 AC_MSG_NOTICE([setting level of DBC to $withval])
>>                 AC_DEFINE(DBC, $withval)

> Of course I figured it out the minute after I sent the mail.
> AC_DEFINE_UNQUOTED.
> I can't claim to understand exactly why, but it works.

AC_DEFINE behaves as if it is part of a quoted shell here-doc (cat
<<\EOF), hence things such as $ are taken literally.  AC_DEFINE_UNQUOTED
behaves as if it is part of an unquoted shell her-doc (cat <<EOF), so
variable expansions can occur.  Thus, any time you want shell expansions,
you are correct that you have to use the alternate macro.

Meanwhile, you are missing recommended m4 quoting; the better way to write
this would be:

AC_DEFINE_UNQUOTED([DBC], [$withval])

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

iEYEARECAAYFAkmz2N8ACgkQ84KuGfSFAYDpRACguJMHck6fzOvl9Obx9xHvk7lC
3T0An1CvOamTTZWBPl8CdRWRK4Sk+vm1
=837D
-----END PGP SIGNATURE-----




reply via email to

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