bug-autoconf
[Top][All Lists]
Advanced

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

Re: Autoheader should ignore m4 "dnl" comments


From: Eric Blake
Subject: Re: Autoheader should ignore m4 "dnl" comments
Date: Thu, 22 Feb 2018 13:59:57 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/21/2018 08:07 PM, Kang-Che Sung wrote:
This bug is a funny one, I think.

In flex (lexer) configure.ac, I use "dnl" comments within
AC_CHECK_FUNCS for inline notes, like this:

     # --------------------------------
     AC_CHECK_FUNCS([dnl
     pow dnl Used only by "examples/manual/expr"
     setlocale dnl Needed only if NLS is enabled
     reallocarr dnl NetBSD function. Use reallocarray if not available.
     reallocarray dnl OpenBSD function. We have replacement if not available.
     ])

Rather than waiting for an updated autoconf with the fix, you could instead workaround it in the meantime, by making it more obvious that your comments are just that:

AC_CHECK_FUNCS(
[pow ]dnl Used only by "examples/manual/expr"
[seclocale ]dnl Needed only if NLS is enabled
[reallocarr ]dnl NetBSD function. Use reallocarray if not available.
[reallocarray ]dnl OpenBSD function. We have replacement if not available.
)

     # --------------------------------

But this syntax will make autoheader generate unneeded HAVE_ macros in
config.h.in:

     /* Define to 1 if you have the `available.' function. */
     #undef HAVE_AVAILABLE_

     /* Define to 1 if you have the `by' function. */
     #undef HAVE_BY

     /* Define to 1 if you have the `dnl' function. */
     #undef HAVE_DNL

The dnl comments should be ignored when generating config.h.in header,
or at least document that users should not add comments from within
AC_CHECK_FUNCS.

Yeah, that's an unfortunate side effect of the current implementation, which treats AC_CHECK_FUNCS as a whitespace separated list of words and does NOT perform macro expansion on that list as you would expect. It may be possible to fix autoconf, but the fix may be hairy; or it might not even be possible to fix, at which point, documentation would be the only thing to improve.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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