]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
enosys: only build if AUDIT_ARCH_NATIVE is defined
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 22 May 2023 15:58:17 +0000 (17:58 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Tue, 23 May 2023 15:24:01 +0000 (17:24 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
configure.ac
meson.build

index 1f6158e7f76304fb7ee0c3089da5a0499f2524ad..341c2d765f97502d966187fa2725e3dc806e3151 100644 (file)
@@ -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])
index 5eb6acb9dfbe631ebbc750f196cec63fa99f485e..af9add4575d66f6178ea535a5aab0e32bc7ede47 100644 (file)
@@ -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
 
 ############################################################