[Spice-devel] [spice-gtk 1/2] build-sys: Enable ACL support on FreeBSD

Christophe Fergeau cfergeau at redhat.com
Mon Jan 8 11:29:47 UTC 2018


From: Ting-Wei Lan <lantw at src.gnome.org>

sys/acl.h works on both FreeBSD and Linux, so we should use it instead
of acl/libacl.h, which only works on Linux.

FreeBSD puts ACL functions in libc, so we should check whether ACL
functions are available in libc before doing the check with -lacl.

https://bugs.freedesktop.org/show_bug.cgi?id=104525
---
 configure.ac                           | 5 +++--
 src/spice-client-glib-usb-acl-helper.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8fd525bd..6101c220 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,8 +383,9 @@ if test "x$have_usbredir" = "xyes" && test "x$enable_polkit" != "xno"; then
   PKG_CHECK_MODULES([POLKIT], [polkit-gobject-1 >= 0.96],
                               [have_polkit=yes],
                               [have_polkit=no])
-  AC_CHECK_HEADER([acl/libacl.h], [], [have_polkit=no])
-  AC_CHECK_LIB([acl], [acl_get_file], [ACL_LIBS=-lacl], [have_polkit=no])
+  AC_CHECK_HEADER([sys/acl.h], [], [have_polkit=no])
+  AC_CHECK_LIB([c], [acl_get_file], [ACL_LIBS=""], [
+    AC_CHECK_LIB([acl], [acl_get_file], [ACL_LIBS=-lacl], [have_polkit=no])])
   if test "x$enable_polkit" = "xyes" && test "x$have_polkit" = "xno"; then
     AC_MSG_ERROR([PolicyKit support explicitly requested, but some required packages are not available])
   fi
diff --git a/src/spice-client-glib-usb-acl-helper.c b/src/spice-client-glib-usb-acl-helper.c
index 80cdceda..f75e0fcc 100644
--- a/src/spice-client-glib-usb-acl-helper.c
+++ b/src/spice-client-glib-usb-acl-helper.c
@@ -32,7 +32,7 @@
 #include <sys/stat.h>
 #include <gio/gunixinputstream.h>
 #include <polkit/polkit.h>
-#include <acl/libacl.h>
+#include <sys/acl.h>
 
 #define FATAL_ERROR(...) \
     do { \
-- 
2.14.3



More information about the Spice-devel mailing list