1 dnl The libselinux.so library
3 dnl Copyright (C) 2012-2014, 2016 Red Hat, Inc.
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Lesser General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2.1 of the License, or (at your option) any later version.
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 dnl Lesser General Public License for more details.
15 dnl You should have received a copy of the GNU Lesser General Public
16 dnl License along with this library. If not, see
17 dnl <http://www.gnu.org/licenses/>.
20 AC_DEFUN([LIBVIRT_ARG_SELINUX],[
21 LIBVIRT_ARG_WITH_FEATURE([SELINUX], [SELinux], [check])
22 LIBVIRT_ARG_WITH([SELINUX_MOUNT], [set SELinux mount point], [check])
25 AC_DEFUN([LIBVIRT_CHECK_SELINUX],[
26 LIBVIRT_CHECK_LIB([SELINUX], [selinux],
27 [fgetfilecon_raw], [selinux/selinux.h])
29 if test "$with_selinux" = "yes"; then
30 # libselinux changed signatures between 2.2 and 2.3
31 AC_CACHE_CHECK([for selinux setcon parameter type], [lv_cv_setcon_const],
35 #include <selinux/selinux.h>
36 int setcon(char *context);
38 [lv_cv_setcon_const=''],
39 [lv_cv_setcon_const='const'])])
40 AC_DEFINE_UNQUOTED([VIR_SELINUX_CTX_CONST], [$lv_cv_setcon_const],
41 [Define to empty or 'const' depending on how SELinux qualifies its
42 security context parameters])
43 # ...and again for 2.5
44 AC_CACHE_CHECK([for selinux selabel_open parameter type],
45 [lv_cv_selabel_open_const],
49 #include <selinux/selinux.h>
50 #include <selinux/label.h>
51 struct selabel_handle *selabel_open(unsigned, struct selinux_opt *, unsigned);
53 [lv_cv_selabel_open_const=''],
54 [lv_cv_selabel_open_const='const'])])
55 AC_DEFINE_UNQUOTED([VIR_SELINUX_OPEN_CONST], [$lv_cv_selabel_open_const],
56 [Define to empty or 'const' depending on how SELinux qualifies its
57 selabel_open parameter])
59 AC_MSG_CHECKING([SELinux mount point])
60 if test "$with_selinux_mount" = "check" || test -z "$with_selinux_mount"; then
61 if test -d /sys/fs/selinux ; then
62 SELINUX_MOUNT=/sys/fs/selinux
64 SELINUX_MOUNT=/selinux
67 SELINUX_MOUNT=$with_selinux_mount
69 AC_MSG_RESULT([$SELINUX_MOUNT])
70 AC_DEFINE_UNQUOTED([SELINUX_MOUNT], ["$SELINUX_MOUNT"], [SELinux mount point])
72 dnl We prefer to use <selinux/label.h> and selabel_open, but can fall
73 dnl back to matchpathcon for the sake of RHEL 5's version of libselinux.
74 AC_CHECK_HEADERS([selinux/label.h])
78 AC_DEFUN([LIBVIRT_RESULT_SELINUX],[
79 LIBVIRT_RESULT_LIB([SELINUX])