[PATCH 07/28] 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     | 46 ++--------------------------------------------
 m4/virt-capng.m4 | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 44 deletions(-)
 create mode 100644 m4/virt-capng.m4

diff --git a/configure.ac b/configure.ac
index 2d8d8e9..afcfd8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,7 @@ LIBVIRT_COMPILE_WARNINGS
 
 LIBVIRT_CHECK_APPARMOR
 LIBVIRT_CHECK_AUDIT
+LIBVIRT_CHECK_CAPNG
 LIBVIRT_CHECK_NUMACTL
 LIBVIRT_CHECK_SANLOCK
 LIBVIRT_CHECK_SASL
@@ -1482,45 +1483,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 libfuse
 AC_ARG_WITH([fuse],
@@ -2790,6 +2752,7 @@ AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([])
 LIBVIRT_RESULT_APPARMOR
 LIBVIRT_RESULT_AUDIT
+LIBVIRT_RESULT_CAPNG
 LIBVIRT_RESULT_NUMACTL
 LIBVIRT_RESULT_SANLOCK
 LIBVIRT_RESULT_SASL
@@ -2832,11 +2795,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_fuse" = "yes" ; then
 AC_MSG_NOTICE([    fuse: $FUSE_CFLAGS $FUSE_LIBS])
 else
diff --git a/m4/virt-capng.m4 b/m4/virt-capng.m4
new file mode 100644
index 0000000..ab08321
--- /dev/null
+++ b/m4/virt-capng.m4
@@ -0,0 +1,26 @@
+dnl The libcapng.so library
+dnl
+dnl Copyright (C) 2012-2013 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library.  If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_CAPNG],[
+  LIBVIRT_CHECK_LIB([CAPNG], [cap-ng], [capng_updatev], [cap-ng.h])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_CAPNG],[
+  LIBVIRT_RESULT_LIB([CAPNG])
+])
-- 
1.7.11.7

--
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]