Do use host-specific pkg-config when cross-compiling

This re-enables the use of $host-pkg-config after it was disabled again
by d6ddfe87e1 (Disable build system pkg-config when cross-compiling to
non-Linux, 2022-11-30).

Closes #23037.
This commit is contained in:
Vadim Zeitlin 2022-12-15 01:47:11 +01:00
parent cf661f9293
commit 7899850496
2 changed files with 30 additions and 36 deletions

12
configure vendored
View file

@ -25052,23 +25052,21 @@ $as_echo "no" >&6; }
fi
if test "$build" != "$host"; then
case "${host}" in
*-linux-*)
case "$PKG_CONFIG" in
*/$host-pkg-config )
;;
* )
disable_build_system_pkg_config=1
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not using native pkg-config when cross-compiling." >&5
$as_echo "$as_me: WARNING: Not using native pkg-config when cross-compiling." >&2;}
if test "$disable_build_system_pkg_config" = 1; then
if test -z "$PKG_CONFIG_LIBDIR"; then
PKG_CONFIG_LIBDIR=/dev/null
export PKG_CONFIG_LIBDIR
fi
esac
fi

View file

@ -2098,21 +2098,16 @@ dnl the build system, they are at best useless and can be harmful (e.g. they
dnl may define options inappropriate for the cross-build, resulting in the
dnl failure of all the subsequent tests).
dnl
dnl Note that we only do it in this particular case because in other cases we
dnl may want to use .pc files on the build system, e.g. it's common to have
dnl them when cross-compiling from x86_64 Linux to ARM Linux.
dnl However do use .pc files for the host libraries that can be found by the
dnl host-specific pkg-config if it was found by PKG_PROG_PKG_CONFIG above.
if test "$build" != "$host"; then
case "${host}" in
*-linux-*)
case "$PKG_CONFIG" in
*/$host-pkg-config )
;;
* )
disable_build_system_pkg_config=1
;;
esac
fi
AC_MSG_WARN([Not using native pkg-config when cross-compiling.])
if test "$disable_build_system_pkg_config" = 1; then
dnl pkg.m4 forbids the use of PKG_XXX, so undo it here to avoid autoconf
dnl errors.
m4_pattern_allow([PKG_CONFIG_LIBDIR])
@ -2124,6 +2119,7 @@ if test "$disable_build_system_pkg_config" = 1; then
PKG_CONFIG_LIBDIR=/dev/null
export PKG_CONFIG_LIBDIR
fi
esac
fi
dnl ---------------------------------------------------------------------------