autoconf's AC_PROG_GNU_M4 macro (from m4.m4) and the --gnu flag to gm4

Eric Gallager <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <CAMfHzOsSXp-Fww945gguwhnrNnhen4E5FNYUeQa4ezhN-Ceg-A@mail.gmail.com>
Hi, I'm writing because I will occasionally see messages like the
following from CI systems (specifically GitHub Actions' macOS runners)
when they attempt to run autoconf:

/Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/gm4:
unrecognized option `--gnu'
Try `/Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/gm4
--help' for more information.
autom4te: error: gm4 failed with exit status: 1

My first attempt at fixing this was hacking in support for the `--gnu`
flag for Apple's copy of gm4, but since the apple-oss-distributions
organization has pull requests turned off, there isn't much I can
really do there to get Apple to upstream it:
https://github.com/apple-oss-distributions/gm4/compare/main...cooljeanius:apple-gm4:gnu_flag

My second attempt at fixing this was to figure out why autoconf was
passing the `--gnu` flag to m4 in the first place, and it seems that
it comes from the AC_PROG_GNU_M4 macro in m4.m4 (which seems
generally-useful, btw, and like something that autoconf should
probably ship to users). I think what is happening here is that
[g]m4's support for the `--gnu` flag gets detected at autoconf's
configure time, but then when the user overrides the M4 variable to
point to a different [g]m4, the M4_GNU variable stays set to whatever
it was first detected as, which might not match up with what the new
[g]m4 supports. I'm wondering if there's some way that autoconf could
shift around the timing of these checks so that it doesn't try passing
`--gnu` to an installation of [g]m4 that doesn't support it?

Please let me know if there's a different mailing list I should send
this request to instead.
Thanks,
Eric Gallager
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.