Ver código fonte

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 anos atrás
pai
commit
464ebf59ed
3 arquivos alterados com 14 adições e 3 exclusões
  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
 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 ]
   [ Updated programs translations ]
   * German (Sven Joachim).
   * 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_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_LIBCOMPAT=1
 libcompat_test_la_SOURCES = \
 libcompat_test_la_SOURCES = \
 	compat.h \
 	compat.h \
-	selinux.c \
 	strnlen.c \
 	strnlen.c \
 	strndup.c \
 	strndup.c \
 	strerror.c \
 	strerror.c \
@@ -21,6 +20,10 @@ libcompat_test_la_SOURCES = \
 	scandir.c \
 	scandir.c \
 	unsetenv.c
 	unsetenv.c
 
 
+if WITH_SELINUX
+libcompat_test_la_SOURCES += selinux.c
+endif
+
 libcompat_la_SOURCES = \
 libcompat_la_SOURCES = \
 	empty.c \
 	empty.c \
 	compat.h \
 	compat.h \
@@ -57,9 +60,11 @@ if !HAVE_STRSIGNAL
 libcompat_la_SOURCES += strsignal.c
 libcompat_la_SOURCES += strsignal.c
 endif
 endif
 
 
+if WITH_SELINUX
 if !HAVE_SETEXECFILECON
 if !HAVE_SETEXECFILECON
 libcompat_la_SOURCES += selinux.c
 libcompat_la_SOURCES += selinux.c
 endif
 endif
+endif
 
 
 if !HAVE_C99_SNPRINTF
 if !HAVE_C99_SNPRINTF
 libcompat_la_SOURCES += snprintf.c vsnprintf.c
 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],
 		[AC_DEFINE([HAVE_SETEXECFILECON], [1],
 		           [Define to 1 if SELinux setexecfilecon is present])
 		           [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],,
 	AC_CHECK_HEADER([selinux/selinux.h],,
 		[if test -n "$with_selinux"; then
 		[if test -n "$with_selinux"; then
 			AC_MSG_FAILURE([selinux header not found])
 			AC_MSG_FAILURE([selinux header not found])
 		 fi])
 		 fi])
 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_LIB_SELINUX
 
 
 # _DPKG_CHECK_LIB_CURSES_NARROW
 # _DPKG_CHECK_LIB_CURSES_NARROW