]> git.proxmox.com Git - swtpm.git/commitdiff
Make SELinux policy extension support chooseable
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 19 Dec 2014 14:28:47 +0000 (09:28 -0500)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 19 Dec 2014 14:28:47 +0000 (09:28 -0500)
Extend configure.ac to make SELinux policy extension support
chooseable. By default configure will check whether SELinux
support is installed on the local system and will add SELinux
policy extension support if support is found.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
configure.ac
src/Makefile.am

index d51d8bb4842cf2450c2e9cdf73b8bbb503b27e50..3b18d579b452fdc98d567730356a5b9baca98742 100644 (file)
@@ -81,6 +81,37 @@ AC_TYPE_SIGNAL
 AC_PROG_CC
 AC_PROG_INSTALL
 
+AC_ARG_WITH([selinux],
+   AS_HELP_STRING([--with-selinux],
+      [add SELinux policy extensions @<:@default=check@:>@]))
+m4_divert_text([DEFAULTS], [with_selinux=check])
+
+dnl Check for SELinux policy support
+
+if test "$with_selinux" != "no"; then
+    if test "$with_selinux" = "check" || test "$with_selinux" = "yes"; then
+        if ! test -f /usr/share/selinux/devel/Makefile; then
+            if test "$with_selinux" = "yes"; then
+                AC_MSG_ERROR("Is selinux-policy-devel installed?")
+            else
+                with_selinux="no"
+            fi
+        fi
+        AC_PATH_PROG([SEMODULE], semodule)
+        if test "x$SEMODULE" == "x"; then
+            if test "$with_selinux" = "yes"; then
+               AC_MSG_ERROR("Is selinux-policy-devel installed?")
+           else
+               with_selinux="no"
+           fi
+        fi
+        if test "$with_selinux" = "check"; then
+            with_selinux="yes"
+        fi
+    fi
+fi
+AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" == "xyes"])
+
 GLIB_CFLAGS=$(pkg-config --cflags glib-2.0)
 if test $? -ne 0; then
        AC_MSG_ERROR("Is glib-2.0 installed? -- could not get cflags")
@@ -263,7 +294,8 @@ AC_CONFIG_FILES(Makefile                    \
 AC_OUTPUT
 
 echo
-echo "with_gnutls : $with_gnutls   (no = swtpm_cert will NOT be built)"
+printf "with_gnutls : %5s  (no = swtpm_cert will NOT be built)\n" $with_gnutls
+printf "with_selinux: %5s  (no = SELinux policy extenions will NOT be build)\n" $with_selinux
 echo
 echo "CFLAGS=$CFLAGS"
 echo "LDFLAGS=$LDFLAGS"
index ac8b234245fd425222ea370822cc06b590e43685..1df3032207ce1bf4f7059b1f75c195837088f357 100644 (file)
@@ -5,9 +5,13 @@
 #
 
 SUBDIRS = \
-       selinux \
        swtpm \
        swtpm_bios \
        swtpm_cert \
        swtpm_ioctl \
        swtpm_setup
+
+if WITH_SELINUX
+SUBDIRS += \
+       selinux
+endif