[libvirt PATCH 17/26] meson: Rewrite libacl check

Andrea Bolognani abologna at redhat.com
Tue Jun 1 08:37:48 UTC 2021


libacl is Linux-only, so we don't need to explicitly check for
either the target platform or header availability, and we can
simply rely on cc.find_library() instead. The corresponding
preprocessor define is renamed to more accurately reflect the
nature of the check.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 meson.build               | 8 +++-----
 src/qemu/qemu_namespace.c | 2 +-
 src/util/virfile.c        | 8 ++++----
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index 0b2e3e062e..301cebab5c 100644
--- a/meson.build
+++ b/meson.build
@@ -844,11 +844,9 @@ endforeach
 
 # generic build dependencies
 
-if host_machine.system() == 'linux' and cc.has_header('sys/acl.h')
-  acl_dep = cc.find_library('acl', required: false)
-  conf.set('WITH_SYS_ACL_H', 1)
-else
-  acl_dep = dependency('', required: false)
+acl_dep = cc.find_library('acl', required: false)
+if acl_dep.found()
+  conf.set('WITH_LIBACL', 1)
 endif
 
 apparmor_dep = dependency('libapparmor', required: get_option('apparmor'))
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index 6a97863d92..98495e8ef8 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -852,7 +852,7 @@ qemuDomainNamespaceAvailable(qemuDomainNamespace ns G_GNUC_UNUSED)
 
     switch (ns) {
     case QEMU_DOMAIN_NS_MOUNT:
-# if !defined(WITH_SYS_ACL_H) || !defined(WITH_SELINUX)
+# if !defined(WITH_LIBACL) || !defined(WITH_SELINUX)
         /* We can't create the exact copy of paths if either of
          * these is not available. */
         return false;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 03a7725dd3..cd63eceb16 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -56,7 +56,7 @@
 #if WITH_SYS_SYSCALL_H
 # include <sys/syscall.h>
 #endif
-#if WITH_SYS_ACL_H
+#if WITH_LIBACL
 # include <sys/acl.h>
 #endif
 #include <sys/file.h>
@@ -3752,7 +3752,7 @@ virFileMoveMount(const char *src G_GNUC_UNUSED,
 #endif /* !defined(__linux__) || !defined(WITH_SYS_MOUNT_H) */
 
 
-#if defined(WITH_SYS_ACL_H)
+#if defined(WITH_LIBACL)
 int
 virFileGetACLs(const char *file,
                void **acl)
@@ -3782,7 +3782,7 @@ virFileFreeACLs(void **acl)
     *acl = NULL;
 }
 
-#else /* !defined(WITH_SYS_ACL_H) */
+#else /* !defined(WITH_LIBACL) */
 
 int
 virFileGetACLs(const char *file G_GNUC_UNUSED,
@@ -3808,7 +3808,7 @@ virFileFreeACLs(void **acl)
     *acl = NULL;
 }
 
-#endif /* !defined(WITH_SYS_ACL_H) */
+#endif /* !defined(WITH_LIBACL) */
 
 int
 virFileCopyACLs(const char *src,
-- 
2.31.1




More information about the libvir-list mailing list