configure: move AppArmor secdriver check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-12-01 12:08:20 +01:00
parent 2caf4d6cdf
commit 2700764acc
2 changed files with 54 additions and 23 deletions

View File

@ -538,29 +538,10 @@ PKG_PROG_PKG_CONFIG
dnl Security driver checks dnl Security driver checks
LIBVIRT_SECDRIVER_ARG_SELINUX LIBVIRT_SECDRIVER_ARG_SELINUX
LIBVIRT_SECDRIVER_ARG_APPARMOR
LIBVIRT_SECDRIVER_CHECK_SELINUX LIBVIRT_SECDRIVER_CHECK_SELINUX
LIBVIRT_SECDRIVER_CHECK_APPARMOR
LIBVIRT_ARG_WITH_ALT([SECDRIVER_APPARMOR], [use AppArmor security driver], [check])
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_ARG_WITH([SECRETS], [local secrets management driver], [yes]) LIBVIRT_ARG_WITH([SECRETS], [local secrets management driver], [yes])
@ -1222,7 +1203,7 @@ AC_MSG_NOTICE([])
AC_MSG_NOTICE([Security Drivers]) AC_MSG_NOTICE([Security Drivers])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])
LIBVIRT_SECDRIVER_RESULT_SELINUX 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([])
AC_MSG_NOTICE([Driver Loadable Modules]) AC_MSG_NOTICE([Driver Loadable Modules])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])

View File

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