summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2022-09-11 13:08:37 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-12 13:29:41 -0400
commit3a815f30bcba5672085e823aeef90863253b0b1a (patch)
tree24a05e2a5283a93d86e0e88014ff3980a457a30c /m4
parenta5f9c35f5831ef5108e87813a96eac62803852ab (diff)
downloadhaskell-3a815f30bcba5672085e823aeef90863253b0b1a.tar.gz
Windows: Always define _UCRT when compiling C code
As seen in #22159, this is required to ensure correct behavior when MinGW-w64 headers are in the `C_INCLUDE_PATH`. Fixes #22159.
Diffstat (limited to 'm4')
-rw-r--r--m4/fp_setup_windows_toolchain.m46
1 files changed, 5 insertions, 1 deletions
diff --git a/m4/fp_setup_windows_toolchain.m4 b/m4/fp_setup_windows_toolchain.m4
index e1a2244c37..1f44a388fe 100644
--- a/m4/fp_setup_windows_toolchain.m4
+++ b/m4/fp_setup_windows_toolchain.m4
@@ -82,7 +82,11 @@ AC_DEFUN([FP_SETUP_WINDOWS_TOOLCHAIN],[
CC="${mingwbin}clang.exe"
CXX="${mingwbin}clang++.exe"
- cflags="--rtlib=compiler-rt"
+
+ # Signal that we are linking against UCRT with the _UCRT macro. This is
+ # necessary to ensure correct behavior when MinGW-w64 headers are in the
+ # header include path (#22159).
+ cflags="--rtlib=compiler-rt -D_UCRT"
CFLAGS="$cflags"
CONF_CC_OPTS_STAGE1="$cflags"
CONF_CC_OPTS_STAGE2="$cflags"