0e3136
diff --git a/configure.in b/configure.in
0e3136
index c8f9aa2..cb43246 100644
0e3136
--- a/configure.in
0e3136
+++ b/configure.in
0e3136
@@ -484,6 +484,11 @@ getloadavg
0e3136
 dnl confirm that a void pointer is large enough to store a long integer
0e3136
 APACHE_CHECK_VOID_PTR_LEN
0e3136
 
0e3136
+AC_CHECK_LIB(selinux, is_selinux_enabled, [
0e3136
+   AC_DEFINE(HAVE_SELINUX, 1, [Defined if SELinux is supported])
0e3136
+   APR_ADDTO(HTTPD_LIBS, [-lselinux])
0e3136
+])
0e3136
+
0e3136
 AC_CACHE_CHECK([for gettid()], ac_cv_gettid,
0e3136
 [AC_TRY_RUN(#define _GNU_SOURCE
0e3136
 #include <unistd.h>
0e3136
diff --git a/server/core.c b/server/core.c
0e3136
index dc0f17a..7ed9527 100644
0e3136
--- a/server/core.c
0e3136
+++ b/server/core.c
0e3136
@@ -59,6 +59,10 @@
0e3136
 #include <unistd.h>
0e3136
 #endif
0e3136
 
0e3136
+#ifdef HAVE_SELINUX
0e3136
+#include <selinux/selinux.h>
0e3136
+#endif
0e3136
+
0e3136
 /* LimitRequestBody handling */
0e3136
 #define AP_LIMIT_REQ_BODY_UNSET         ((apr_off_t) -1)
0e3136
 #define AP_DEFAULT_LIMIT_REQ_BODY       ((apr_off_t) 0)
0e3136
@@ -5015,6 +5019,28 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
0e3136
     }
0e3136
 #endif
0e3136
 
0e3136
+#ifdef HAVE_SELINUX
0e3136
+    {
0e3136
+        static int already_warned = 0;
0e3136
+        int is_enabled = is_selinux_enabled() > 0;
0e3136
+        
0e3136
+        if (is_enabled && !already_warned) {
0e3136
+            security_context_t con;
0e3136
+            
0e3136
+            if (getcon(&con) == 0) {
0e3136
+                
0e3136
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
0e3136
+                             "SELinux policy enabled; "
0e3136
+                             "httpd running as context %s", con);
0e3136
+                
0e3136
+                already_warned = 1;
0e3136
+                
0e3136
+                freecon(con);
0e3136
+            }
0e3136
+        }
0e3136
+    }
0e3136
+#endif
0e3136
+
0e3136
     return OK;
0e3136
 }
0e3136