Re: AC_CHECK_HEADER/AC_CHECK_DECL 2.69->2.69c probably changed quoting, breaks gimp as "...: ${+y}: bad substitution"

Sergei Trofimovich <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <20201025195520.591c8a2b@sf>
On Sun, 25 Oct 2020 09:54:42 -0400
Zack Weinberg <[email protected]> wrote:

> On Sun, Oct 25, 2020 at 9:13 AM Sergei Trofimovich <[email protected]> wrote:
> ...
> > gimp's use of macros looks underquoted  
> 
> Yes, this is an underquotation problem, and also a "macros that use
> AC_REQUIRE internally are not safe to use inside hand-coded shell
> conditionals" problem.  This particular example is so badly broken
> that I'm amazed it worked at all with 2.69.
> 
> The AC_ARG_WITH part is fine (although it could be improved by using
> AS_HELP_STRING) but the actual check should be done like this:
> 
> have_linux_input="no (linux input support disabled)"
> AS_IF([test "x$with_linux_input" != "xno"],
>   [AC_CHECK_HEADER([linux/input.h],
>     [AC_CHECK_DECL([KEY_OK],
>                    [have_linux_input=yes],
>                    [have_linux_input="no (needs Linux 2.6)"],
>                    [#include <linux/input.h>])])])
> 
> This kind of correction is, regrettably, beyond the power of autoupdate.
> 
> > but I would expect
> > behavior to be roughly the same between 2.69 and 2.69c.  
> 
> Unfortunately no.  There have been major changes since 2.69 in the way
> AC_CHECK_HEADER and AC_CHECK_DECL work, and this breakage appears to
> have been a consequence.  Looking at the diffs between the generated
> configure scripts, the underquoted version has shell function
> definitions intertwined with top-level control flow, because
> AC_CHECK_DECL was expanded first and then treated as *multiple
> arguments* to AC_CHECK_HEADER.  Plus, code that needs to be executed
> unconditionally was emitted inside the "if" block.

I was afraid of that. Looks like gimp's configure.ac will require a lot more
quotation cleanup. Meanwhile proposed your fix for 'linux-input' handling
fix as https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/357

Thank you!

-- 

  Sergei
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.