pgsql-fix-sepgsql-build.patch

text/x-patch

Filename: pgsql-fix-sepgsql-build.patch
Type: text/x-patch
Part: 0
Message: Re: [v9.1] sepgsql - userspace access vector cache
 configure.in              |    9 +++++----
 contrib/sepgsql/Makefile  |    2 +-
 contrib/sepgsql/sepgsql.h |    3 +++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/configure.in b/configure.in
index a844afc..cf95a7c 100644
--- a/configure.in
+++ b/configure.in
@@ -963,10 +963,11 @@ if test "$with_libxslt" = yes ; then
 fi
 
 # for contrib/sepgsql
-if test "$with_selinux" = yes; then
-  AC_CHECK_LIB(selinux, selinux_sepgsql_context_path, [],
-               [AC_MSG_ERROR([library 'libselinux', version 2.0.93 or newer, is required for SELinux support])])
-fi
+AC_CHECK_LIB(selinux, selinux_sepgsql_context_path,
+             [AC_DEFINE(HAVE_LIBSELINUX)],
+             [if test "$with_selinux" = yes; then
+                AC_MSG_ERROR([library 'libselinux', version 2.0.93 or newer, is required for SELinux support])
+              fi])
 
 # for contrib/uuid-ossp
 if test "$with_ossp_uuid" = yes ; then
diff --git a/contrib/sepgsql/Makefile b/contrib/sepgsql/Makefile
index 7f997ee..1978ccf 100644
--- a/contrib/sepgsql/Makefile
+++ b/contrib/sepgsql/Makefile
@@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
 
-SHLIB_LINK += $(filter -lselinux, $(LIBS))
+SHLIB_LINK += -lselinux
 REGRESS_OPTS += --launcher $(top_builddir)/contrib/sepgsql/launcher
 
 check_selinux_environment:
diff --git a/contrib/sepgsql/sepgsql.h b/contrib/sepgsql/sepgsql.h
index 71688ab..455b638 100644
--- a/contrib/sepgsql/sepgsql.h
+++ b/contrib/sepgsql/sepgsql.h
@@ -15,6 +15,9 @@
 #include "fmgr.h"
 
 #include <selinux/selinux.h>
+#ifndef HAVE_LIBSELINUX
+#error libselinux is required for SELinux support
+#endif
 
 /*
  * SE-PostgreSQL Label Tag