Re: fedora 42 doesn't have awk: how to deal with autoconf subst?
Paul Eggert <[email protected]> Sun, 20 Apr 2025 11:00:13 -0700
| Newsgroups | gmane.comp.sysutils.autoconf.bugs |
|---|---|
| Organization | UCLA Computer Science Department |
| Message-ID | <[email protected]> |
On 2025-04-20 04:47, James Cloos wrote: > the whole point of this thread is that fedora removed awk from its base > set. > >>>>>> "PH" == Perry Hutchison <[email protected]> writes: > PH> But why should we go to that extra trouble *only* for awk? > > obviously if it adds such support it should be in general, not only for > one command. but fedora has made awk an important one. I see little need to support "busybox X" for all X, since we don't have distros that do that. Also, adding such support would be a real pain. However, there is a need for "busybox X" on stripped-down Fedora 42; we have a user bug report about it. Also, adding support for busybox awk in minimal 'configure' scripts is a trivial (one-line) change. So let's do that. I installed the attached. Of course many packages won't build even with this change, because they use 'awk' directly instead of using $AWK. That's OK; if they care about stripped-down Fedora 42 they can make the effort, and if not then it's no big deal as there are easy workarounds for those who want to build on that platform: symlink busybox to awk, install gawk, configure with AWK='busybox awk', etc., etc.
0001-Fall-back-on-busybox-awk.patch
(text/x-patch, 2.6 KB)
From fa76d00401519123a782af1963b7d7ba677347b3 Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Sun, 20 Apr 2025 10:36:19 -0700 Subject: [PATCH] Fall back on busybox awk * lib/autoconf/programs.m4 (AC_PROG_AWK): Fall back 'busybox awk' of none of the other awks work. --- NEWS | 2 ++ doc/autoconf.texi | 13 +++++++++---- lib/autoconf/programs.m4 | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 0899de5f..1e4e513e 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,8 @@ GNU Autoconf NEWS - User visible changes. The autom4te, autoscan and ifnames programs now recognize the two preprocessor directives, which were introduced in C23 and C++23. +*** AC_PROG_AWK now also checks for busybox awk. + *** AC_USE_SYSTEM_EXTENSIONS now defines _COSMO_SOURCE for Cosmopolitan Libc. ** Notable bug fixes diff --git a/doc/autoconf.texi b/doc/autoconf.texi index fd16d5fb..7b156b82 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -4162,14 +4162,19 @@ otherwise to @samp{:} (do nothing). @acindex{PROG_AWK} @ovindex AWK @caindex prog_AWK -Check for @code{gawk}, @code{mawk}, @code{nawk}, and @code{awk}, in that +Check for the commands @command{gawk}, @command{mawk}, +@command{nawk}, @command{awk}, and @code{busybox awk}, in that order, and set output variable @code{AWK} to the first one that is found. -It tries @code{gawk} first because that is reported to be the +Try @code{gawk} first because that is reported to be the best implementation. The result can be overridden by setting the variable @code{AWK} or the cache variable @code{ac_cv_prog_AWK}. -Using this macro is sufficient to avoid the pitfalls of traditional -@command{awk} (@pxref{awk, , Limitations of Usual Tools}). +Using this macro avoids some pitfalls of older systems that have both +traditional @command{awk} (@pxref{awk, , Limitations of Usual Tools}) +and better alternatives like @command{gawk}. +It also can help port to stripped-down systems that have only +@code{busybox awk}, although these systems could well have problems +with other build components that use plain @command{awk}. @end defmac @defmac AC_PROG_GREP diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4 index 1d44bbf3..d8b8b8b1 100644 --- a/lib/autoconf/programs.m4 +++ b/lib/autoconf/programs.m4 @@ -357,7 +357,7 @@ AN_PROGRAM([gawk], [AC_PROG_AWK]) AN_PROGRAM([mawk], [AC_PROG_AWK]) AN_PROGRAM([nawk], [AC_PROG_AWK]) AC_DEFUN([AC_PROG_AWK], -[AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )]) +[AC_CHECK_PROGS([AWK], [gawk mawk nawk awk 'busybox awk'])]) # AC_PROG_EGREP -- 2.48.1