]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Add build-enosys option
authorJordan Williams <jordan@jwillikers.com>
Tue, 23 Apr 2024 12:43:00 +0000 (07:43 -0500)
committerJordan Williams <jordan@jwillikers.com>
Thu, 25 Apr 2024 12:31:43 +0000 (07:31 -0500)
Add a check to ensure that the linux/audit.h header exists for enosys.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
(cherry picked from commit 0f2dd62ed106af8291e91364e992bc9eb65cab55)

meson.build
meson_options.txt

index 0af96127d969bdf41a902be8319af10e13bfc84e..04ed1218860abcbcc41dd79a417126308650547e 100644 (file)
@@ -3106,19 +3106,22 @@ syscalls_h = custom_target('syscalls.h',
              cc.cmd_array(), get_option('c_args')],
 )
 
-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
+have_linux_audit_h = cc.has_header('linux/audit.h')
+have_audit_arch_native = cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
+
+opt = get_option('build-enosys').require(have_linux_audit_h and have_audit_arch_native).allowed()
+exe = executable(
+  'enosys',
+  'misc-utils/enosys.c', syscalls_h,
+  include_directories : includes,
+  link_with : [lib_common],
+  install_dir : usrbin_exec_dir,
+  install : opt,
+  build_by_default : opt)
+if opt and not is_disabler(exe)
+  exes += exe
+  manadocs += ['misc-utils/enosys.1.adoc']
+  bashcompletions += ['enosys']
 endif
 
 exe = executable(
index 1850d1d174c8bbf629b8af8bf6585758906b221e..9f09f3220cbd671884af539f9465dfa4a83240bd 100644 (file)
@@ -203,6 +203,8 @@ option('build-pipesz', type : 'feature',
        description : 'build pipesz')
 option('build-fadvise', type : 'feature',
        description : 'build fadvise')
+option('build-enosys', type : 'feature',
+       description : 'build enosys')
 option('build-setterm', type : 'feature',
        description : 'build setterm')
 option('build-schedutils', type : 'feature',