force pkg-config to only use --prefix when cross-compiling

The current pkg-config setup has no sense of whether it is cross-compiling,
so it will detect things on the build system that are not present or are
wrong for the host system.  This forces the cross-compiling build to only
look for pkg-config .pc files in --prefix.

A version of this has been the setup for many years with the Android builds.

Fixes #32191

Signed-off-by: Hans-Christoph Steiner <hans@eds.org>
This commit is contained in:
Hans-Christoph Steiner 2019-10-29 21:13:56 +01:00 committed by teor
parent 2395800d3e
commit 2a349006b9
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
2 changed files with 13 additions and 0 deletions

3
changes/ticket32191 Normal file
View File

@ -0,0 +1,3 @@
o Minor features (build system):
- force pkg-config to only use --prefix when cross-compiling.
Closes ticket 32191.

View File

@ -37,6 +37,16 @@ else
pkg_config_user_action="check the PKG_CONFIG_PATH environment variable" pkg_config_user_action="check the PKG_CONFIG_PATH environment variable"
fi fi
if test "x$PKG_CONFIG_PATH" = "x" && test "x$prefix" != "xNONE" && test "$host" != "$build"; then
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
AC_MSG_NOTICE([set PKG_CONFIG_PATH=$PKG_CONFIG_PATH to support cross-compiling])
if test -f "$PKG_CONFIG_PATH/libevent.pc"; then
echo "checking for $PKG_CONFIG_PATH/libevent.pc... yes"
else
AC_MSG_ERROR([$PKG_CONFIG_PATH/libevent.pc not found!])
fi
fi
AC_ARG_ENABLE(openbsd-malloc, AC_ARG_ENABLE(openbsd-malloc,
AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD. Linux only. Deprecated: see --with-malloc])) AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD. Linux only. Deprecated: see --with-malloc]))
AC_ARG_ENABLE(static-openssl, AC_ARG_ENABLE(static-openssl,