[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AM_CONDITIONAL fails with line break at the end of $2
From: |
Eric Blake |
Subject: |
Re: AM_CONDITIONAL fails with line break at the end of $2 |
Date: |
Thu, 17 Jul 2014 12:54:06 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 07/17/2014 12:44 PM, Dimitrios Apostolou wrote:
> Hi Erik, thank you for forwarding to the appropriate list!
>
> On Thu, 17 Jul 2014, Eric Blake wrote:
>>
>> I don't know if automake should work around your bad syntax, or if you
>> should just fix your configure.ac to use correct syntax to begin with. I
>
> Is my syntax illegal? Can't I put line-breaks there? If I knew I
> wouldn't bother with this patch, it's just that I consumed some time to
> figure out this failure, so I thought it would be helpful to others.
Not illegal (there's no law prohibiting it), but not typical; and the
fact that it is causing a syntax error is a sign that fixing your code
is more likely to bring it in line with other packages, than waiting for
the tools to be taught to work with your usage as a new pattern, and
then waiting for that fix to percolate to the distros you care about.
More typical usage looks like one of these:
AM_CONDITIONAL([HAVE_LIBXML2],
[test "x$with_libxml2" != xno &&
test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes])
or
AM_CONDITIONAL([HAVE_LIBXML2], [
test "x$with_libxml2" != xno &&
test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes]dnl
)
(that is, you'll usually see the close ) flush against the close ], or
you will see a use of 'dnl' to eat any newlines that were used to
visually spot that the closing ) on the start of the next line matches
an earlier line above)
>
>> also wonder if automake could use AS_IF instead of open-coding the if to
>> try and take advantage of autoconf's smarts for trying to sanitize
>> conditions.
>>
>> However, even autoconf's AS_IF current implementation prefers the 'if
>> cond; then' rather than 'if cond $newline then', so it is likewise not
>> robust to conditions ending in a spurious newline. If changing AS_IF to
>> use newline separator does not increase configure size, I could see
>> making that change in autoconf. I'll play with the idea.
>
> Thanks, please keep me posted!
Sure.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature