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