From: Christian Brauner Date: Mon, 13 Sep 2021 07:54:17 +0000 (+0200) Subject: build: use dependency() where possible X-Git-Tag: lxc-5.0.0~92^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4384f1cbb8ec2fc742459d279afdc7014283dae;p=thirdparty%2Flxc.git build: use dependency() where possible Signed-off-by: Christian Brauner --- diff --git a/meson.build b/meson.build index c44f6d71e..6e476c3e3 100644 --- a/meson.build +++ b/meson.build @@ -235,22 +235,23 @@ foreach ident : [ endforeach threads = dependency('threads') -libseccomp = cc.find_library('seccomp', required : false) +libseccomp = dependency('libseccomp') if libseccomp.found() conf.set10('HAVE_SECCOMP', libseccomp.found()) - seccomp_headers = ''' - #include - ''' - - if cc.has_function('seccomp_notify_fd', prefix : seccomp_headers, args : '-D_GNU_SOURCE', dependencies: libseccomp) - conf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', true) + if libseccomp.version().version_compare('>=2.5.0') + # https://github.com/seccomp/libseccomp/commit/dead12bc788b259b148cc4d93b970ef0bd602b1a + conf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', true) endif - if cc.has_function('seccomp_syscall_resolve_name_arch', prefix : seccomp_headers, args : '-D_GNU_SOURCE', dependencies: libseccomp) - conf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', true) + if libseccomp.version().version_compare('>=2.0.0') + # https://github.com/seccomp/libseccomp/commit/6220c8c0fc479d97b6d3e3166a4e46fbfe25a3c0 + conf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', true) endif + seccomp_headers = ''' + #include + ''' foreach decl : [ 'scmp_filter_ctx', 'struct seccomp_notif_sizes', @@ -266,12 +267,12 @@ if libseccomp.found() endforeach endif -libselinux = cc.find_library('selinux', required : false) +libselinux = dependency('libselinux', required : false) if libselinux.found() conf.set10('HAVE_SELINUX', libselinux.found()) endif -libapparmor = cc.find_library('apparmor', required : false) +libapparmor = dependency('libapparmor', required : false) if libapparmor.found() conf.set10('HAVE_APPARMOR', libapparmor.found()) endif