Skip to content

Commit 65340b0

Browse files
committed
configure: fix broken cross-compilation detection
Assume the build is 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, that assumption in this case is consistent with GNU autotools behaviour.
1 parent 20bb598 commit 65340b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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 is 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 is 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)