[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 1/2] Fix build when selinux pkg-config is not available



Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 m4/libs.m4 |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/m4/libs.m4 b/m4/libs.m4
index 255a7ef..a99afbe 100644
--- a/m4/libs.m4
+++ b/m4/libs.m4
@@ -70,10 +70,18 @@ if test "x$with_selinux" != "xno"; then
 	AC_CHECK_LIB([selinux], [is_selinux_enabled],
 		[AC_DEFINE(WITH_SELINUX, 1,
 			[Define to 1 to compile in SELinux support])
-		 if test "x$with_selinux" = "xstatic"; then
-			dpkg_selinux_libs="-Wl,-Bstatic "$(pkg-config --static --libs libselinux)" -Wl,-Bdynamic"
+		 if test $(pkg-config --exists libselinux); then
+			if test "x$with_selinux" = "xstatic"; then
+				dpkg_selinux_libs="-Wl,-Bstatic "$(pkg-config --static --libs libselinux)" -Wl,-Bdynamic"
+			else
+				dpkg_selinux_libs=$(pkg-config --libs libselinux)
+			fi
 		 else
-			dpkg_selinux_libs=$(pkg-config --libs libselinux)
+			if test "x$with_selinux" = "xstatic"; then
+				dpkg_selinux_libs="-Wl,-Bstatic -lselinux -Wl,-Bdynamic"
+			else
+				dpkg_selinux_libs="-lselinux"
+			fi
 		 fi
 		 SELINUX_LIBS="${SELINUX_LIBS:+$SELINUX_LIBS }$dpkg_selinux_libs"
 		 with_selinux="yes"],
-- 
1.6.5.1


Reply to: