[PATCH 17/29] Convert cap-ng check to use LIBVIRT_CHECK_LIB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 configure.ac     | 47 ++---------------------------------------------
 m4/virt-capng.m4 |  9 +++++++++
 2 files changed, 11 insertions(+), 45 deletions(-)
 create mode 100644 m4/virt-capng.m4

diff --git a/configure.ac b/configure.ac
index 3ef0c7c..2232c5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,6 +150,7 @@ LIBVIRT_COMPILE_WARNINGS
 
 LIBVIRT_CHECK_APPARMOR
 LIBVIRT_CHECK_AUDIT
+LIBVIRT_CHECK_CAPNG
 LIBVIRT_CHECK_LIBATTR
 LIBVIRT_CHECK_NUMACTL
 LIBVIRT_CHECK_SANLOCK
@@ -1431,46 +1432,6 @@ AM_CONDITIONAL([HAVE_LIBSSH2], [test "$with_libssh2_transport" = "yes"])
 AC_SUBST([LIBSSH2_CFLAGS])
 AC_SUBST([LIBSSH2_LIBS])
 
-dnl libcap-ng
-AC_ARG_WITH([capng],
-  AC_HELP_STRING([--with-capng], [use libcap-ng to reduce libvirtd privileges @<:@default=check@:>@]),
-  [],
-  [with_capng=check])
-
-dnl
-dnl This check looks for 'capng_updatev' since that was
-dnl introduced in 0.4.0 release which need as minimum
-dnl
-CAPNG_CFLAGS=
-CAPNG_LIBS=
-if test "$with_qemu" = "yes" && test "$with_capng" != "no"; then
-  old_cflags="$CFLAGS"
-  old_libs="$LIBS"
-  if test "$with_capng" = "check"; then
-    AC_CHECK_HEADER([cap-ng.h],[],[with_capng=no])
-    AC_CHECK_LIB([cap-ng], [capng_updatev],[],[with_capng=no])
-    if test "$with_capng" != "no"; then
-      with_capng="yes"
-    fi
-  else
-    fail=0
-    AC_CHECK_HEADER([cap-ng.h],[],[fail=1])
-    AC_CHECK_LIB([cap-ng], [capng_updatev],[],[fail=1])
-    test $fail = 1 &&
-      AC_MSG_ERROR([You must install the capng >= 0.4.0 development package in order to compile and run libvirt])
-  fi
-  CFLAGS="$old_cflags"
-  LIBS="$old_libs"
-fi
-if test "$with_capng" = "yes"; then
-  CAPNG_LIBS="-lcap-ng"
-  AC_DEFINE_UNQUOTED([WITH_CAPNG], 1, [whether capng is available for privilege reduction])
-fi
-AM_CONDITIONAL([WITH_CAPNG], [test "$with_capng" != "no"])
-AC_SUBST([CAPNG_CFLAGS])
-AC_SUBST([CAPNG_LIBS])
-
-
 
 dnl virsh libraries
 AC_CHECK_HEADERS([readline/readline.h])
@@ -2706,6 +2667,7 @@ AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([])
 LIBVIRT_RESULT_APPARMOR
 LIBVIRT_RESULT_AUDIT
+LIBVIRT_RESULT_CAPNG
 LIBVIRT_RESULT_LIBATTR
 LIBVIRT_RESULT_NUMACTL
 LIBVIRT_RESULT_SANLOCK
@@ -2745,11 +2707,6 @@ fi
 else
 AC_MSG_NOTICE([  polkit: no])
 fi
-if test "$with_capng" = "yes" ; then
-AC_MSG_NOTICE([   capng: $CAPNG_CFLAGS $CAPNG_LIBS])
-else
-AC_MSG_NOTICE([   capng: no])
-fi
 if test "$with_xen" = "yes" ; then
 AC_MSG_NOTICE([     xen: $XEN_CFLAGS $XEN_LIBS])
 else
diff --git a/m4/virt-capng.m4 b/m4/virt-capng.m4
new file mode 100644
index 0000000..bac894d
--- /dev/null
+++ b/m4/virt-capng.m4
@@ -0,0 +1,9 @@
+dnl The libcapng.so library
+
+AC_DEFUN([LIBVIRT_CHECK_CAPNG],[
+  LIBVIRT_CHECK_LIB([CAPNG], [capng], [cap-ng], [capng_updatev], [cap-ng.h])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_CAPNG],[
+  LIBVIRT_RESULT_LIB([CAPNG], [capng])
+])
-- 
1.7.11.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]