On Tue, Oct 20, 2020 at 4:57 PM Nick Bowler <nbow...@draconx.ca> wrote: > On 2020-10-20, Sergei Trofimovich <sly...@gentoo.org> wrote: > > Initial bug is reported as autoconf failure on ghc-8.8.4: > > https://bugs.gentoo.org/750191 > > There autconf 2.69 works, 2.69c does not. ... > > $ cat configure.ac > > AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.1.0], > > [glasgow-haskell-b...@haskell.org], [ghc-AC_PACKAGE_VERSION]) > > > > echo "$PACKAGE_VERSION" > > > > AC_OUTPUT
If I understand correctly, the intention is to have $PACKAGE_VERSION set to "9.1.0" and $PACKAGE_TARNAME set to "ghc-9.1.0"? > Note: the change you report is introduced by Zack's fix for related > AC_INIT quoting regressions. This patch is not included in 2.69c (or > even on git master), but does seem to be applied by the Gentoo package. Yeah, this is a "can't have it both ways" kind of thing. We can reliably round-trip "unusual" characters (like the ones that appear all the time in URLs and email addresses) through AC_INIT's arguments, or we can expand macros in those arguments even when they're quoted on input; I don't think there's any way to do both. This only works by accident in 2.69, incidentally. AC_PACKAGE_VERSION is defined *after* AC_PACKAGE_TARNAME (see _AC_INIT_PACKAGE, lines 235-261 of $prefix/share/autoconf/general.m4) so both old and new autoconf set AC_PACKAGE_TARNAME to the literal string "ghc-AC_PACKAGE_VERSION". The value undergoes an extra round of expansion when it's used to set the shell variable PACKAGE_TARNAME (lines 416-428 of the same file). This extra round of expansion is undesirable in general. You can fix this in configure.ac without repeating the version number by defining an extra M4 macro and using it in both arguments: m4_define([ghc_VERSION], [9.1.0]) AC_INIT([The Glorious Glasgow Haskell Compilation System], m4_defn([ghc_VERSION]), [glasgow-haskell-b...@haskell.org], [ghc-]m4_defn([ghc_VERSION])) I'm being extra careful with quotation here; `ghc_VERSION` and `m4_defn([ghc_VERSION])` both expand to the definition of ghc_VERSION, but the latter quotes its output. This would matter if the value of ghc_VERSION could contain more M4 macros, which it *currently* doesn't... (If you don't mind, I think I might add this to the manual as an example of computing the arguments to AC_INIT, with all the GHC-specific terms removed, of course.) We *could* add a special case in AC_INIT where, if any of the third, fourth, or fifth arguments contain the literal strings `AC_PACKAGE_NAME` or `AC_PACKAGE_VERSION`, those are replaced with the values of the first and second argument, respectively. This would keep the GHC code working as-is. I'm not sure whether that's a good idea; cc:ing Paul and Eric for their thoughts. zw