Просмотр исходного кода

build: Use pkg-config m4 macros to detect selinux library

Use PKG_PROG_PKG_CONFIG to detect and allow overriding the pkg-config
binary to use, for example in case of cross-compilation.

Suggested-by: Tollef Fog Heen <tfheen@err.no>
Guillem Jover лет назад: 16
Родитель
Сommit
76044b0057
2 измененных файлов с 10 добавлено и 7 удалено
  1. 2 0
      debian/changelog
  2. 8 7
      m4/dpkg-libs.m4

+ 2 - 0
debian/changelog

@@ -32,6 +32,8 @@ dpkg (1.15.5) UNRELEASED; urgency=low
   * Generate the autoconf version from git to make it easier to see when a
     snapshot version is being used.
   * Add infrastructure for doxygen, for now not installed anywhere.
+  * Allow overriding the pkg-config path to ease cross-compilation.
+    Suggested by Tollef Fog Heen <tfheen@err.no>.
 
   [ Raphaël Hertzog ]
   * Add versioned dependency on base-files (>= 5.0.0) to dpkg-dev to ensure

+ 8 - 7
m4/dpkg-libs.m4

@@ -61,8 +61,9 @@ fi
 # DPKG_LIB_SELINUX
 # ----------------
 # Check for selinux library.
-AC_DEFUN([DPKG_LIB_SELINUX],
-[AC_ARG_VAR([SELINUX_LIBS], [linker flags for selinux library])dnl
+AC_DEFUN([DPKG_LIB_SELINUX], [
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+AC_ARG_VAR([SELINUX_LIBS], [linker flags for selinux library])dnl
 AC_ARG_WITH(selinux,
 	AS_HELP_STRING([--with-selinux],
 		       [use selinux library to set security contexts]))
@@ -70,19 +71,19 @@ 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 $(pkg-config --exists libselinux); then
+		PKG_CHECK_EXISTS([libselinux], [
 			if test "x$with_selinux" = "xstatic"; then
-				dpkg_selinux_libs="-Wl,-Bstatic "$(pkg-config --static --libs libselinux)" -Wl,-Bdynamic"
+				dpkg_selinux_libs="-Wl,-Bstatic "$($PKG_CONFIG --static --libs libselinux)" -Wl,-Bdynamic"
 			else
-				dpkg_selinux_libs=$(pkg-config --libs libselinux)
+				dpkg_selinux_libs=$($PKG_CONFIG --libs libselinux)
 			fi
-		 else
+		], [
 			if test "x$with_selinux" = "xstatic"; then
 				dpkg_selinux_libs="-Wl,-Bstatic -lselinux -lsepol -Wl,-Bdynamic"
 			else
 				dpkg_selinux_libs="-lselinux"
 			fi
-		 fi
+		])
 		 SELINUX_LIBS="${SELINUX_LIBS:+$SELINUX_LIBS }$dpkg_selinux_libs"
 		 with_selinux="yes"],
 		[if test -n "$with_selinux"; then