]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
configure: move AppArmor secdriver check to its own file
authorPavel Hrdina <phrdina@redhat.com>
Thu, 1 Dec 2016 11:08:20 +0000 (12:08 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 21 Dec 2016 14:39:42 +0000 (15:39 +0100)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
configure.ac
m4/virt-secdriver-apparmor.m4 [new file with mode: 0644]

index d6f5b43b1e742cd44c59a9efcf4dadac9e57d511..d0b48ff73603db3838a817682af653bccb8bb417 100644 (file)
@@ -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 (file)
index 0000000..d3d96ec
--- /dev/null
@@ -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])
+])