[PATCH 77/89] configure: move AppArmor secdriver check to its own file

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac                  | 27 ++++-------------------
 m4/virt-secdriver-apparmor.m4 | 50 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 23 deletions(-)
 create mode 100644 m4/virt-secdriver-apparmor.m4

diff --git a/configure.ac b/configure.ac
index 924647e124..8fdd388bf0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -538,29 +538,10 @@ PKG_PROG_PKG_CONFIG
 
 dnl Security driver checks
 LIBVIRT_SECDRIVER_ARG_SELINUX
-LIBVIRT_SECDRIVER_CHECK_SELINUX
-
-
-LIBVIRT_ARG_WITH_ALT([SECDRIVER_APPARMOR], [use AppArmor security driver], [check])
+LIBVIRT_SECDRIVER_ARG_APPARMOR
 
-if test "$with_apparmor" != "yes" ; then
-  if test "$with_secdriver_apparmor" = "check" ; then
-    with_secdriver_apparmor=no
-  fi
-  if test "$with_secdriver_apparmor" != "no" ; then
-    AC_MSG_ERROR([You must install the AppArmor development package in order to compile libvirt])
-  fi
-elif test "with_secdriver_apparmor" != "no" ; then
-  with_secdriver_apparmor=yes
-  AC_DEFINE_UNQUOTED([WITH_SECDRIVER_APPARMOR], 1, [whether AppArmor security driver is available])
-fi
-AM_CONDITIONAL([WITH_SECDRIVER_APPARMOR], [test "$with_secdriver_apparmor" != "no"])
-
-LIBVIRT_ARG_WITH_ALT([APPARMOR_PROFILES], [install apparmor profiles], [no])
-if test "$with_apparmor" = "no"; then
-  with_apparmor_profiles="no"
-fi
-AM_CONDITIONAL([WITH_APPARMOR_PROFILES], [test "$with_apparmor_profiles" != "no"])
+LIBVIRT_SECDRIVER_CHECK_SELINUX
+LIBVIRT_SECDRIVER_CHECK_APPARMOR
 
 
 LIBVIRT_ARG_WITH([SECRETS], [local secrets management driver], [yes])
@@ -1222,7 +1203,7 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Security Drivers])
 AC_MSG_NOTICE([])
 LIBVIRT_SECDRIVER_RESULT_SELINUX
-AC_MSG_NOTICE([AppArmor: $with_secdriver_apparmor (install profiles: $with_apparmor_profiles)])
+LIBVIRT_SECDRIVER_RESULT_APPARMOR
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Driver Loadable Modules])
 AC_MSG_NOTICE([])
diff --git a/m4/virt-secdriver-apparmor.m4 b/m4/virt-secdriver-apparmor.m4
new file mode 100644
index 0000000000..d3d96ec7e2
--- /dev/null
+++ b/m4/virt-secdriver-apparmor.m4
@@ -0,0 +1,50 @@
+dnl The AppArmor security driver
+dnl
+dnl Copyright (C) 2016 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_SECDRIVER_ARG_APPARMOR], [
+  LIBVIRT_ARG_WITH_ALT([SECDRIVER_APPARMOR], [use AppArmor security driver], [check])
+])
+
+AC_DEFUN([LIBVIRT_SECDRIVER_CHECK_APPARMOR], [
+  AC_REQUIRE([LIBVIRT_CHECK_APPARMOR])
+
+  if test "$with_apparmor" != "yes" ; then
+    if test "$with_secdriver_apparmor" = "check" ; then
+      with_secdriver_apparmor=no
+    fi
+    if test "$with_secdriver_apparmor" != "no" ; then
+      AC_MSG_ERROR([You must install the AppArmor development package in order to compile libvirt])
+    fi
+  elif test "with_secdriver_apparmor" != "no" ; then
+    with_secdriver_apparmor=yes
+    AC_DEFINE_UNQUOTED([WITH_SECDRIVER_APPARMOR], 1, [whether AppArmor security driver is available])
+  fi
+  AM_CONDITIONAL([WITH_SECDRIVER_APPARMOR], [test "$with_secdriver_apparmor" != "no"])
+
+  LIBVIRT_ARG_WITH_ALT([APPARMOR_PROFILES], [install apparmor profiles], [no])
+  if test "$with_apparmor" = "no"; then
+    with_apparmor_profiles="no"
+  fi
+  AM_CONDITIONAL([WITH_APPARMOR_PROFILES], [test "$with_apparmor_profiles" != "no"])
+])
+
+AC_DEFUN([LIBVIRT_SECDRIVER_RESULT_APPARMOR], [
+  LIBVIRT_RESULT([AppArmor], [$with_secdriver_apparmor],
+                 [install profiles: $with_apparmor_profiles])
+])
-- 
2.11.0

--
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]
  Powered by Linux