Skip to content

Commit 27cfb8d

Browse files
committed
configure: fix broken cross-compilation detection
Assume the build as native if the compiler for the host and the build machine are the same. For example, cbuild (Chimera Linux package builder) defines both the host and the build compiler, regardless of native or cross build. Also, assuming the build as native in this case is consistent with GNU autotools behaviour.
1 parent 20bb598 commit 27cfb8d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,16 @@ for arg in "$@"; do
450450
esac
451451
done
452452

453+
## Assume the build as native if both $CXX and $CXX_FOR_BUILD have the same value.
454+
# We use the value of $CXX_FOR_BUILD to detect cross-build. However, it is fairly common to set
455+
# both variables to the same compiler in a native build. For example, cbuild (Chimera Linux package
456+
# builder) sets both variables regardless of native or cross build. Also, GNU autotools assumes the
457+
# build as native in this case. Unset $CXX_FOR_BUILD now to be consistent with GNU autotools and
458+
# what people expect.
459+
if [ -n "${CXX_FOR_BUILD:-}" ] && [ "$CXX_FOR_BUILD" = "$CXX" ]; then
460+
unset CXX_FOR_BUILD
461+
fi
462+
453463
## Check platform is specified for a cross-build
454464
if [ -n "${CXX_FOR_BUILD:-}" ]; then
455465
if [ -z "${PLATFORM:-}" ]; then

0 commit comments

Comments
 (0)