Re-re-enable using pkg-config when targeting Linux systems
The change of7899850496(Do use host-specific pkg-config when cross-compiling, 2022-12-15) should have been done in addition to the previous logic instead of replacing it, as it has resulted in not using pkg-config any more when targeting Linux systems, which wasn't the intention. So re-apply the changes ofd6ddfe87e1(Disable build system pkg-config when cross-compiling to non-Linux, 2022-11-30) to handle cross-compiling to Linux specially. This makes the logic even uglier than before, but it still seems like the most pragmatic solution and the original intention was always to do this and not the wrongly simplified version that was actually applied. See #22886, #23037, #23171.
This commit is contained in:
parent
997d20e0b2
commit
b0056f8ce5
2 changed files with 40 additions and 23 deletions
22
configure
vendored
22
configure
vendored
|
|
@ -24989,20 +24989,28 @@ $as_echo "no" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$build" != "$host"; then
|
if test "$build" != "$host"; then
|
||||||
case "$PKG_CONFIG" in
|
case "${host}" in
|
||||||
*/$host-pkg-config )
|
*-linux-*)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not using native pkg-config when cross-compiling." >&5
|
case "$PKG_CONFIG" in
|
||||||
|
*/$host-pkg-config )
|
||||||
|
;;
|
||||||
|
|
||||||
|
* )
|
||||||
|
{ $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;}
|
$as_echo "$as_me: WARNING: Not using native pkg-config when cross-compiling." >&2;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if test -z "$PKG_CONFIG_LIBDIR"; then
|
if test -z "$PKG_CONFIG_LIBDIR"; then
|
||||||
PKG_CONFIG_LIBDIR=/dev/null
|
PKG_CONFIG_LIBDIR=/dev/null
|
||||||
export PKG_CONFIG_LIBDIR
|
export PKG_CONFIG_LIBDIR
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
41
configure.in
41
configure.in
|
|
@ -2095,28 +2095,37 @@ dnl When cross-compiling for another system from Linux, don't use .pc files on
|
||||||
dnl the build system, they are at best useless and can be harmful (e.g. they
|
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 may define options inappropriate for the cross-build, resulting in the
|
||||||
dnl failure of all the subsequent tests).
|
dnl failure of all the subsequent tests).
|
||||||
dnl
|
|
||||||
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
|
if test "$build" != "$host"; then
|
||||||
case "$PKG_CONFIG" in
|
dnl Assume that using pkg-config does work when cross-compiling to another
|
||||||
*/$host-pkg-config )
|
dnl Linux system, e.g. when targeting ARM Linux from x86_64 system.
|
||||||
|
case "${host}" in
|
||||||
|
*-linux-*)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
AC_MSG_WARN([Not using native pkg-config when cross-compiling.])
|
dnl But otherwise only do it if a host-specific pkg-config is
|
||||||
|
dnl available as using the build system one is not going to work.
|
||||||
|
case "$PKG_CONFIG" in
|
||||||
|
*/$host-pkg-config )
|
||||||
|
;;
|
||||||
|
|
||||||
dnl pkg.m4 forbids the use of PKG_XXX, so undo it here to avoid autoconf
|
* )
|
||||||
dnl errors.
|
AC_MSG_WARN([Not using native pkg-config when cross-compiling.])
|
||||||
m4_pattern_allow([PKG_CONFIG_LIBDIR])
|
|
||||||
|
|
||||||
dnl If pkg-config libdir is already defined, we suppose that they know what
|
dnl pkg.m4 forbids the use of PKG_XXX, so undo it here to avoid autoconf
|
||||||
dnl they're doing and leave it alone, but if not, set it to a path in which
|
dnl errors.
|
||||||
dnl no .pc files will be found.
|
m4_pattern_allow([PKG_CONFIG_LIBDIR])
|
||||||
if test -z "$PKG_CONFIG_LIBDIR"; then
|
|
||||||
PKG_CONFIG_LIBDIR=/dev/null
|
dnl If pkg-config libdir is already defined, we suppose that they know what
|
||||||
export PKG_CONFIG_LIBDIR
|
dnl they're doing and leave it alone, but if not, set it to a path in which
|
||||||
fi
|
dnl no .pc files will be found.
|
||||||
|
if test -z "$PKG_CONFIG_LIBDIR"; then
|
||||||
|
PKG_CONFIG_LIBDIR=/dev/null
|
||||||
|
export PKG_CONFIG_LIBDIR
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue