From 76218a30ef4d90e61ddc6e5a949a58a92db0c80c Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 18 May 2026 18:24:24 +0200 Subject: [PATCH] meson: use pkg-config to find audit The previous checks were wrong, because when building statically, cap-ng would have to be linked for the audit_log_user_avc_message check to succeed. Rather than duplicating this knowledge in dbus, though, let's take advantage of audit.pc. Signed-off-by: Alyssa Ross --- meson.build | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 7281b7ec..b7c88a4f 100644 --- a/meson.build +++ b/meson.build @@ -601,14 +601,9 @@ config.set_quoted('DBUS_CONSOLE_OWNER_FILE', console_owner_file) if get_option('libaudit').disabled() have_libaudit = false else - libaudit = cc.find_library('audit', required: false) - libaudit_ok = cc.has_function('audit_log_user_avc_message', dependencies: libaudit) - cap_ng = cc.find_library('cap-ng', required: false) - cap_ng_ok = cc.has_function('capng_clear', dependencies: cap_ng) - have_libaudit = libaudit_ok and cap_ng_ok - if get_option('libaudit').enabled() and not have_libaudit - error('libaudit support requested but not found') - endif + libaudit = dependency('audit', required: get_option('libaudit')) + cap_ng = dependency('libcap-ng', required: get_option('libaudit')) + have_libaudit = libaudit.found() and cap_ng.found() # For the systemd system unit data_config.set('AMBIENT_CAPS', 'AmbientCapabilities=CAP_AUDIT_WRITE') endif