Re: AM_CONDITIONAL fails with line break at the end of $2
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.sysutils.autoconf.patches,gmane.comp.sysutils.automake.patches |
|---|---|
| Organization | Red Hat, Inc. |
| Message-ID | <[email protected]> |
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
(application/pgp-signature, 604 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTyBvOAAoJEKeha0olJ0NqNfkIAJwKpciX9PWY73LHq14Tja9u R3B0OXMmjzqqTYE2aKVafUfBo90SabMv6+q0ExcOTLnoQb+R3O4LClPi3QCOyrYM HKIAz2U3ihQYYsQ8IDvFRrqlqJ9fEyvQyR7MbmH21dgYf6z8+Dy995kRa+FKmD3T Z+RtJc3H4yCv5Bb9sxBuju9OhTdbSEP+hNSf95oOy7AavNOdyfpHO+rNFlIhuQTP NZRQUtj7NVmP84iIKaIK2TccWYuWu5U/0oWbECv/cYRSwqghuQT7zurjRe2efh+g 3iAjpm5Oy3MZYpXziaa2oFA4JjKlM0E5uVNPeu6lPxdbl6XWG0eIIYuVM2u+IIQ= =9OVU -----END PGP SIGNATURE-----