--- /dev/null
+diff -up joe-3.7/configure.selinux joe-3.7/configure
+--- joe-3.7/configure.selinux 2008-10-30 04:07:22.000000000 +0100
++++ joe-3.7/configure 2009-02-02 11:13:50.000000000 +0100
+@@ -6531,7 +6531,7 @@ if test "$ac_cv_header_selinux_selinux_h
+ cat >>confdefs.h <<\_ACEOF
+ #define HAVE_SELINUX 1
+ _ACEOF
+-
++LIBS="$LIBS -lselinux"
+ fi
+
+ # Checks for typedefs, structures, and compiler characteristics.
+diff -up joe-3.7/selinux.c.selinux joe-3.7/selinux.c
+--- joe-3.7/selinux.c.selinux 2006-05-22 06:15:41.000000000 +0200
++++ joe-3.7/selinux.c 2009-02-02 11:13:50.000000000 +0100
+@@ -4,7 +4,9 @@
+ */
+ #include "types.h"
+
+-#ifdef WITH_SELINUX
++#include "config.h"
++
++#ifdef HAVE_SELINUX
+ #include <selinux/selinux.h>
+ static int selinux_enabled = -1;
+ #endif
+@@ -13,7 +15,7 @@ int
+ copy_security_context(const char *from_file, const char *to_file)
+ {
+ int status = 0;
+-#ifdef WITH_SELINUX
++#ifdef HAVE_SELINUX
+ security_context_t from_context;
+ security_context_t to_context;
+
+@@ -38,9 +40,7 @@ copy_security_context(const char *from_f
+ }
+
+ if (getfilecon(to_file, &to_context) < 0) {
+- MSG_PUTS(_(joe_gettext(_("\nCould not get security context for "))));
+- msg_outtrans(to_file);
+- msg_putchar('\n');
++ error(0, errno, "Could not get security context for %s", to_file);
+ freecon(from_context);
+ return 1;
+ }
+@@ -63,7 +63,7 @@ copy_security_context(const char *from_f
+ int
+ match_default_security_context(const char *from_file)
+ {
+-#ifdef WITH_SELINUX
++#ifdef HAVE_SELINUX
+ security_context_t scontext;
+
+ if (selinux_enabled == -1)
+@@ -102,7 +102,7 @@ match_default_security_context(const cha
+ int
+ reset_default_security_context()
+ {
+-#ifdef WITH_SELINUX
++#ifdef HAVE_SELINUX
+ if (selinux_enabled == -1)
+ selinux_enabled = (is_selinux_enabled() > 0);
+
+@@ -121,7 +121,7 @@ reset_default_security_context()
+ int
+ output_security_context(char *from_file)
+ {
+-#ifdef WITH_SELINUX
++#ifdef HAVE_SELINUX
+ security_context_t scontext;
+
+ if (selinux_enabled == -1)
+@@ -153,7 +153,7 @@ output_security_context(char *from_file)
+
+ /*
+ Test program compile using the following command
+- cc -o t t.c -DWITH_SELINUX -DTEST -lselinux
++ cc -o t t.c -DHAVE_SELINUX -DTEST -lselinux
+ */
+
+ #include <stdio.h>
+diff -up joe-3.7/ufile.c.selinux joe-3.7/ufile.c
+--- joe-3.7/ufile.c.selinux 2008-11-02 21:39:52.000000000 +0100
++++ joe-3.7/ufile.c 2009-02-02 11:13:50.000000000 +0100
+@@ -15,7 +15,7 @@
+ #endif
+ #endif
+
+-#ifdef WITH_SELINUX
++#ifdef HAVE_SELINUX
+ int copy_security_context(const char *from_file, const char *to_file);
+ #endif
+
+@@ -157,7 +157,7 @@ static int cp(unsigned char *from, unsig
+ utime((char *)to, &utbuf);
+ #endif
+
+-#ifdef WITH_SELINUX
++#ifdef HAVE_SELINUX
+ copy_security_context(from,to);
+ #endif
+