From: Thomas Weißschuh Date: Tue, 16 Apr 2024 07:26:22 +0000 (+0200) Subject: all_syscalls: don't hardcode AWK invocation X-Git-Tag: v2.40.1-rc1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f37ffe68790d997e7327656a169cea8e8c5b2e7;p=thirdparty%2Futil-linux.git all_syscalls: don't hardcode AWK invocation Use the buildsystem to find a usable awk implementation and use that. Reported-by: Firas Khalil Khana Link: https://github.com/util-linux/util-linux/pull/2949 Reported-by: John Paul Adrian Glaubitz https://lore.kernel.org/util-linux/31ccace2e5912ffc428e065cd66764088c625c4d.camel@physik.fu-berlin.de/ Signed-off-by: Thomas Weißschuh (cherry picked from commit 543f991f62659b9a3ff67f9cda3456b2a5bb3f98) --- diff --git a/configure.ac b/configure.ac index c3387496c..ef85a7ade 100644 --- a/configure.ac +++ b/configure.ac @@ -132,6 +132,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_MKDIR_P AC_PROG_YACC +AC_PROG_AWK # Don't use autotools integrated LEX/YACC support for libsmartcols AC_PATH_PROG([FLEX], [flex]) diff --git a/meson.build b/meson.build index 21751e3b0..844cde141 100644 --- a/meson.build +++ b/meson.build @@ -895,6 +895,7 @@ conf.set('USE_TTY_GROUP', have ? 1 : false) bison = find_program('bison') flex = find_program('flex') +awk = find_program('gawk', 'mawk', 'nawk', 'awk') build_hwclock = not get_option('build-hwclock').disabled() bison_gen = generator( @@ -3034,7 +3035,8 @@ endif syscalls_h = custom_target('syscalls.h', input : 'tools/all_syscalls', output : 'syscalls.h', - command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')] + command : ['tools/all_syscalls', awk.full_path(), + cc.cmd_array(), get_option('c_args')], ) if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE') diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am index 0720dda0a..3763fa9c2 100644 --- a/misc-utils/Makemodule.am +++ b/misc-utils/Makemodule.am @@ -326,7 +326,7 @@ misc-utils/enosys.c: syscalls.h syscalls.h: $(top_srcdir)/tools/all_syscalls @echo ' GEN $@' - @$(top_srcdir)/tools/all_syscalls $(CC) $(CFLAGS) + @$(top_srcdir)/tools/all_syscalls "$(AWK)" $(CC) $(CFLAGS) -include syscalls.h.deps CLEANFILES += syscalls.h syscalls.h.deps diff --git a/tools/all_syscalls b/tools/all_syscalls index f2f91b3ae..15984e528 100755 --- a/tools/all_syscalls +++ b/tools/all_syscalls @@ -3,6 +3,8 @@ set -e set -o pipefail +AWK="$1" +shift OUTPUT=syscalls.h SYSCALL_INCLUDES=" #include @@ -11,6 +13,6 @@ SYSCALL_INCLUDES=" trap 'rm -f $OUTPUT $OUTPUT.deps' ERR "$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \ - | gawk 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \ + | "$AWK" 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \ | sort \ > "$OUTPUT"