about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-16 23:54:21 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-16 23:54:21 +0000
commit2fff3d93b552dbddc406c41786ecfd0a1074b564 (patch)
tree2faa0955ba83375bc55c84b9ac00ceff5e55f90a
parentae9e6b36d2e03cea249de3a6c592bbab1be01174 (diff)
downloadglibc-2fff3d93b552dbddc406c41786ecfd0a1074b564.tar.gz
glibc-2fff3d93b552dbddc406c41786ecfd0a1074b564.tar.xz
glibc-2fff3d93b552dbddc406c41786ecfd0a1074b564.zip
Add test for required SELinux features.
-rw-r--r--configure.in41
1 files changed, 41 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 22f726e3bb..235b6d222c 100644
--- a/configure.in
+++ b/configure.in
@@ -81,6 +81,11 @@ AC_ARG_WITH([elf],
                            [if using the ELF object format]),
 	    [elf=$withval],
 	    [elf=no])
+AC_ARG_WITH([selinux],
+            AC_HELP_STRING([--with-selinux],
+                           [if building with SELinux support]),
+	    [with_selinux=$withval],
+	    [with_selinux=auto])
 AC_ARG_WITH([xcoff],
             AC_HELP_STRING([--with-xcoff],
                            [if using the XCOFF object format]),
@@ -1954,6 +1959,42 @@ fi
 AC_MSG_RESULT($LIBGD)
 AC_SUBST(LIBGD)
 
+# SELinux detection
+if test x$with_selinux = xno ; then
+  have_selinux=no;
+else
+  # See if we have the SELinux library
+  AC_CHECK_LIB(selinux, is_selinux_enabled,
+	       have_selinux=yes, have_selinux=no)
+  # See if we have the SELinux header with the NSCD permissions in it.
+  if test x$have_selinux = xyes ; then
+    AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
+    AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
+		    [#ifdef NSCD__SHMEMHOST
+		     return 0;
+		     #else
+		     #error NSCD__SHMEMHOST not defined
+		     #endif],
+		    have_selinux=yes, have_selinux=no)
+    AC_MSG_RESULT($have_selinux)
+  fi
+
+  if test x$with_selinux = xauto ; then
+    if test x$have_selinux = xno ; then
+      AC_MSG_WARN([Sufficiently new SELinux library not found])
+    fi
+  else
+    if test x$have_selinux = xno ; then
+      AC_MSG_ERROR([SELinux explicitly required, and SELinux library not found])
+    fi
+  fi
+fi
+# Check if we're building with SELinux support.
+if test "x$have_selinux" = xyes; then
+  AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
+fi
+AC_SUBST(have_selinux)
+
 dnl check for the size of 'long double'.
 AC_CHECK_SIZEOF(long double, 0)
 sizeof_long_double=$ac_cv_sizeof_long_double