Explorar o código

build: Fix and update libselinux check

Require libselinux 2.0.99, which introduced the selinux_status_* API.
Switch to use the pkg-config file unconditionally, introduced in
libselinux 2.0.89. Remove the static linking support. Perform refinement
checks only if libselinux is available.
Guillem Jover %!s(int64=9) %!d(string=hai) anos
pai
achega
a65b903c5b
Modificáronse 2 ficheiros con 15 adicións e 26 borrados
  1. 3 0
      debian/changelog
  2. 12 26
      m4/dpkg-libs.m4

+ 3 - 0
debian/changelog

@@ -19,6 +19,9 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     - Add support for running the test suite in parallel.
     - Specify exec argument for TAP::Harness to gracefully handle non-perl
       executables with older versions of the module.
+    - Require libselinux 2.0.99 for baseline API, remove static linking
+      support, use pkg-config unconditionally, and perform refinement checks
+      only if available.
 
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).

+ 12 - 26
m4/dpkg-libs.m4

@@ -97,42 +97,28 @@ AC_DEFUN([DPKG_LIB_SELINUX], [
     [AS_HELP_STRING([--with-libselinux],
       [use selinux library to set security contexts])],
     [], [with_libselinux=check])
+  SELINUX_MIN_VERSION=2.0.99
   have_libselinux="no"
   AS_IF([test "x$with_libselinux" != "xno"], [
-    AC_CHECK_LIB([selinux], [is_selinux_enabled], [
-      AC_DEFINE([WITH_LIBSELINUX], [1],
-        [Define to 1 to compile in SELinux support])
-      PKG_CHECK_EXISTS([libselinux], [
-        AS_IF([test "x$with_libselinux" = "xstatic"], [
-          dpkg_selinux_libs="-Wl,-Bstatic "$($PKG_CONFIG --static --libs libselinux)" -Wl,-Bdynamic"
-        ], [
-          dpkg_selinux_libs=$($PKG_CONFIG --libs libselinux)
-        ])
+    PKG_CHECK_MODULES([SELINUX], [libselinux >= $SELINUX_MIN_VERSION], [
+      AC_CHECK_HEADER([selinux/selinux.h], [
+        AC_DEFINE([WITH_LIBSELINUX], [1],
+          [Define to 1 to compile in SELinux support])
+        have_libselinux="yes"
       ], [
-        AS_IF([test "x$with_libselinux" = "xstatic"], [
-          dpkg_selinux_libs="-Wl,-Bstatic -lselinux -lsepol -Wl,-Bdynamic"
-        ], [
-          dpkg_selinux_libs="-lselinux"
-        ])
-      ])
-      SELINUX_LIBS="${SELINUX_LIBS:+$SELINUX_LIBS }$dpkg_selinux_libs"
-
-      AC_CHECK_HEADER([selinux/selinux.h], [], [
         AS_IF([test "x$with_libselinux" != "xcheck"], [
-          AC_MSG_FAILURE([selinux header not found])
+          AC_MSG_FAILURE([libselinux header not found])
         ])
       ])
-
-      have_libselinux="yes"
+      AC_CHECK_LIB([selinux], [setexecfilecon], [
+        AC_DEFINE([HAVE_SETEXECFILECON], [1],
+          [Define to 1 if SELinux setexecfilecon is present])
+      ])
     ], [
       AS_IF([test "x$with_libselinux" != "xcheck"], [
-        AC_MSG_FAILURE([selinux library not found])
+        AC_MSG_FAILURE([libselinux at least $SELINUX_MIN_VERSION not found])
       ])
     ])
-    AC_CHECK_LIB([selinux], [setexecfilecon], [
-      AC_DEFINE([HAVE_SETEXECFILECON], [1],
-                [Define to 1 if SELinux setexecfilecon is present])
-    ])
   ])
   AM_CONDITIONAL([WITH_LIBSELINUX], [test "x$have_libselinux" = "xyes"])
   AM_CONDITIONAL([HAVE_SETEXECFILECON],