summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-05-17 19:16:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-19 04:59:39 -0400
commit35bdab1cb97f0be0ebea7cc93b977759f51d976c (patch)
treee29e88e11e74e75006c511c840224fc6dfc35218 /m4
parent02d1633466733f154753753c8d9e94062d334b1a (diff)
downloadhaskell-35bdab1cb97f0be0ebea7cc93b977759f51d976c.tar.gz
configure: Check CC_STAGE0 for --target support
We previously only checked the stage 1/2 compiler for --target support. We got away with this for quite a while but it eventually caught up with us in #21579, where `bytestring`'s new NEON implementation was unbuildable on Darwin due to Rosetta's seemingly random logic for determining which executable image to execute. This lead to a confusing failure to build `bytestring`'s cbits, when `clang` tried to compile NEON builtins while targetting x86-64. Fix this by checking CC_STAGE0 for --target support. Fixes #21579.
Diffstat (limited to 'm4')
-rw-r--r--m4/fp_cc_supports_target.m419
1 files changed, 10 insertions, 9 deletions
diff --git a/m4/fp_cc_supports_target.m4 b/m4/fp_cc_supports_target.m4
index e8710b8ffc..6021361256 100644
--- a/m4/fp_cc_supports_target.m4
+++ b/m4/fp_cc_supports_target.m4
@@ -6,13 +6,17 @@
#
# The primary effect of this is updating CONF_CC_OPTS_STAGE[12] to
# explicitly ask the compiler to generate code for the $TargetPlatform.
+#
+# $1 = CC
+# $2 = CC_OPTS variable
+# $3 = CXX_OPTS variable
+# $4 = GCC_LINK_OPTS variable
AC_DEFUN([FP_CC_SUPPORTS_TARGET],
[
- AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([GHC_LLVM_TARGET_SET_VAR])
- AC_MSG_CHECKING([whether $1 CC supports --target])
+ AC_MSG_CHECKING([whether $1 supports --target])
echo 'int main() { return 0; }' > conftest.c
- if $CC --target=$LlvmTarget -Werror conftest.c > /dev/null 2>&1 ; then
+ if $1 --target=$LlvmTarget -Werror conftest.c > /dev/null 2>&1 ; then
CONF_CC_SUPPORTS_TARGET=YES
AC_MSG_RESULT([yes])
else
@@ -22,12 +26,9 @@ AC_DEFUN([FP_CC_SUPPORTS_TARGET],
rm -f conftest.c conftest
if test $CONF_CC_SUPPORTS_TARGET = YES ; then
- CONF_CC_OPTS_STAGE1="--target=$LlvmTarget $CONF_CC_OPTS_STAGE1"
- CONF_CC_OPTS_STAGE2="--target=$LlvmTarget $CONF_CC_OPTS_STAGE2"
- CONF_CXX_OPTS_STAGE1="--target=$LlvmTarget $CONF_CXX_OPTS_STAGE1"
- CONF_CXX_OPTS_STAGE2="--target=$LlvmTarget $CONF_CXX_OPTS_STAGE2"
- CONF_GCC_LINKER_OPTS_STAGE1="--target=$LlvmTarget $CONF_GCC_LINKER_OPTS_STAGE1"
- CONF_GCC_LINKER_OPTS_STAGE2="--target=$LlvmTarget $CONF_GCC_LINKER_OPTS_STAGE2"
+ $2="--target=$LlvmTarget $$2"
+ $3="--target=$LlvmTarget $$3"
+ $4="--target=$LlvmTarget $$4"
fi
])