fedora 42 doesn't have awk: how to deal with autoconf subst?

Simon Josefsson via Bug reports for autoconf <[email protected]> Thu, 17 Apr 2025 08:31:08 +0200
Newsgroups gmane.comp.sysutils.autoconf.bugs,gmane.comp.lib.gnulib.bugs
Message-ID <[email protected]>
Hi

I got a CI/CD build failure [1] for libidn on the new release fedora 42.

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating csharpcomp.sh
./config.status: line 2711: awk: command not found
config.status: error: could not create csharpcomp.sh

This is building from a "make dist" tarball and not from git, so the
installed dependencies are minimal:

dnf -y install make gcc diffutils valgrind

This used to work fine with Fedora 41.  But Fedora 42 doesn't have awk
by default any more:

jas@kaka:~$ podman run -it --rm fedora:41
[root@0a7731017978 /]# awk --version|head -1
GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)
[root@0a7731017978 /]# 
exit
jas@kaka:~$ podman run -it --rm fedora:42
[root@8e2093893358 /]# awk --version
bash: awk: command not found
[root@8e2093893358 /]# 

Looking at the config.status [2] line 2711:

eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5

That is looking like normal autoconf stuff?!  Not gnulib or csharpcomp
related.  Autoconf 2.72e lib/autoconf/status.m4 has this line:

eval sed \"\$ac_sed_extra\" "$ac_file_inputs" m4_defn([_AC_SUBST_CMDS]) \
  >$ac_tmp/out || AC_MSG_ERROR([could not create $ac_file])

And AC_SUBST_CMDS looks like this:

dnl Define the pipe that does the substitution.
m4_ifdef([_AC_SUBST_FILES],
[m4_define([_AC_SUBST_CMDS], [|
if $ac_cs_awk_getline; then
  $AWK -f "$ac_tmp/subs.awk"
else
  $AWK -f "$ac_tmp/subs.awk" | $SHELL
fi])],
[m4_define([_AC_SUBST_CMDS],
[| $AWK -f "$ac_tmp/subs.awk"])])dnl

So awk is pretty much required by autoconf here, unless I'm missing
something else that overrides this or AWK.

I tried reading through the autoconf manual to see if 'awk' is a
run-time dependency for running generated ./configure scripts, but as
far as I can tell it looks like awk is treated the same like other
non-required tools like ar, yacc, etc.  Is awk required for running
Autoconf-generated ./configure or not?

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html

I'm not sure what the next step is.  Ideas?  Some of mine include:

0) Modify autoconf to continue to work in this situation without awk,
   replacing it with more POSIX shell or something else?

1) Autoconf truly require awk and then this should be documented and I
   need to document it as a build-time dependency for libidn.

2) Autoconf require awk only for certain kind of usages (substitions?),
   and then this should be documented to clarify which autoconf
   functionality requires awk, and I need to document for libidn.

3) It was actually gnulib somehow that led to this situation, and this
   is really a gnulib problem.

4) If 2) is true and gnulib uses the necessary features from autoconf
   that brings in awk, could gnulib be modified to not use those
   features so that building on systems without awk works?

/Simon

[1] https://gitlab.com/libidn/libidn/-/jobs/9750009545
[2] https://gitlab.com/libidn/libidn/-/jobs/9750009545/artifacts/raw/config.status
signature.asc (application/pgp-signature, 1.2 KB)
-----BEGIN PGP SIGNATURE-----

iQNoBAEWCAMQFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAmgAoCwUHHNpbW9uQGpv
c2Vmc3Nvbi5vcmfCHCYAmDMEXJLOtBYJKwYBBAHaRw8BAQdACIcrZIvhrxDBkK9f
V+QlTmXxo2naObDuGtw58YaxlOu0JVNpbW9uIEpvc2Vmc3NvbiA8c2ltb25Aam9z
ZWZzc29uLm9yZz6IlgQTFggAPgIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgBYh
BLHSvRN1vst4TPT4xNc89jjFPAa+BQJn0XQkBQkNZGbwAAoJENc89jjFPAa+BtIA
/iR73CfBurG9y8pASh3cbGOMHpDZfMAtosu6jbpO69GHAP4p7l57d+iVty2VQMsx
+3TCSAvZkpr4P/FuTzZ8JZe8BrgzBFySz4EWCSsGAQQB2kcPAQEHQOxTCIOaeXAx
I2hIX4HK9bQTpNVei708oNr1Klm8qCGKiPUEGBYIACY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