From 3e0bbb1222139df70a01c31c5036a9569df4e0b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Mon, 22 May 2023 17:58:17 +0200 Subject: [PATCH] enosys: only build if AUDIT_ARCH_NATIVE is defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- configure.ac | 9 +++++++++ meson.build | 25 ++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 1f6158e7f7..341c2d765f 100644 --- a/configure.ac +++ b/configure.ac @@ -1861,6 +1861,15 @@ AM_CONDITIONAL([BUILD_WAITPID], [test "x$build_waitpid" = xyes]) UL_BUILD_INIT([enosys], [check]) UL_REQUIRES_LINUX([enosys]) +AS_IF([test "x$build_enosys" = xyes], [ + AC_MSG_CHECKING([for valid audit arch]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include "${srcdir}/include/audit-arch.h"]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + build_enosys=no + ]) +]) AM_CONDITIONAL([BUILD_ENOSYS], [test "x$build_enosys" = xyes]) UL_BUILD_INIT([getopt], [yes]) diff --git a/meson.build b/meson.build index 5eb6acb9df..af9add4575 100644 --- a/meson.build +++ b/meson.build @@ -3,6 +3,7 @@ project('util-linux', 'c', meson_version: '>=0.57.0', license : 'GPLv2+') +fs = import('fs') pkgconfig = import('pkgconfig') libblkid_version = '1.1.0' @@ -2868,17 +2869,19 @@ syscalls_h = custom_target('syscalls.h', command : ['bash', '@INPUT@', cc.cmd_array()], ) -exe = executable( - 'enosys', - 'misc-utils/enosys.c', syscalls_h, - include_directories : includes, - link_with : [lib_common], - install_dir : usrbin_exec_dir, - install : true) -if not is_disabler(exe) - exes += exe - manadocs += ['misc-utils/enosys.1.adoc'] - bashcompletions += ['enosys'] +if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE') + exe = executable( + 'enosys', + 'misc-utils/enosys.c', syscalls_h, + include_directories : includes, + link_with : [lib_common], + install_dir : usrbin_exec_dir, + install : true) + if not is_disabler(exe) + exes += exe + manadocs += ['misc-utils/enosys.1.adoc'] + bashcompletions += ['enosys'] + endif endif ############################################################ -- 2.47.3