Преглед на файлове

libcompat: Only build the compatibility selinux code if requested

If we are not using libselinux, then we cannot build the selinux
compatibility code as it requires the library. Also fixes build failures
on non-Linux systems, where the library is not available.

Closes: #757637
Guillem Jover преди 12 години
родител
ревизия
464ebf59ed
променени са 3 файла, в които са добавени 14 реда и са изтрити 3 реда
  1. 5 0
      debian/changelog
  2. 6 1
      lib/compat/Makefile.am
  3. 3 2
      m4/dpkg-libs.m4

+ 5 - 0
debian/changelog

@@ -1,5 +1,10 @@
 dpkg (1.17.12) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Only build the compatibility selinux code if libselinux is available or
+    the user requested it. Also fixes build failures on non-Linux systems.
+    Closes: #757637
+
   [ Updated programs translations ]
   * German (Sven Joachim).
 

+ 6 - 1
lib/compat/Makefile.am

@@ -10,7 +10,6 @@ noinst_LTLIBRARIES = libcompat-test.la libcompat.la
 libcompat_test_la_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_LIBCOMPAT=1
 libcompat_test_la_SOURCES = \
 	compat.h \
-	selinux.c \
 	strnlen.c \
 	strndup.c \
 	strerror.c \
@@ -21,6 +20,10 @@ libcompat_test_la_SOURCES = \
 	scandir.c \
 	unsetenv.c
 
+if WITH_SELINUX
+libcompat_test_la_SOURCES += selinux.c
+endif
+
 libcompat_la_SOURCES = \
 	empty.c \
 	compat.h \
@@ -57,9 +60,11 @@ if !HAVE_STRSIGNAL
 libcompat_la_SOURCES += strsignal.c
 endif
 
+if WITH_SELINUX
 if !HAVE_SETEXECFILECON
 libcompat_la_SOURCES += selinux.c
 endif
+endif
 
 if !HAVE_C99_SNPRINTF
 libcompat_la_SOURCES += snprintf.c vsnprintf.c

+ 3 - 2
m4/dpkg-libs.m4

@@ -92,14 +92,15 @@ if test "x$with_selinux" != "xno"; then
 		[AC_DEFINE([HAVE_SETEXECFILECON], [1],
 		           [Define to 1 if SELinux setexecfilecon is present])
 	])
-	AM_CONDITIONAL(HAVE_SETEXECFILECON,
-	               [test "x$ac_cv_lib_selinux_setexecfilecon" = "xyes"])
 
 	AC_CHECK_HEADER([selinux/selinux.h],,
 		[if test -n "$with_selinux"; then
 			AC_MSG_FAILURE([selinux header not found])
 		 fi])
 fi
+AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = "xyes"])
+AM_CONDITIONAL(HAVE_SETEXECFILECON,
+               [test "x$ac_cv_lib_selinux_setexecfilecon" = "xyes"])
 ])# DPKG_LIB_SELINUX
 
 # _DPKG_CHECK_LIB_CURSES_NARROW