Hi,

This patch series allows to run the following commands in the root directory of 
the repository and it should do something reasonable:
```
mkdir -p build
cd build
../configure
make all
make check
```

Using these commands, generated headers should be used to build the CRT. And 
the built CRT should be used in the tests.

I only did some cursory tests with it because jon_y on IRC wrote that these 
changes are likely to not be accepted.
I figured I'd share them anyway because it might make development a bit easier.

I'm uncertain about the third patch. Mostly because I don't understand why the 
complex checks are duplicated.

I hope someone will find this useful.

Markus
From 9d82b0886989837192dc122c4158b6d4d122a214 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <[email protected]>
Date: Thu, 18 Jan 2026 13:14:09 +0100
Subject: [PATCH 1/3] Generate header in build tree in correct relative
 location.

The header `_mingw_ddk.h` is includes as `sdks/_mingw_ddk.h` from
`_mingw.h`. Generate it in the correct relative location to that
header.
---
 mingw-w64-headers/Makefile.am | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/Makefile.am b/mingw-w64-headers/Makefile.am
index 6ebeda477..f15292a11 100644
--- a/mingw-w64-headers/Makefile.am
+++ b/mingw-w64-headers/Makefile.am
@@ -21,7 +21,7 @@ gdiplushead_HEADERS = @GDIPLUSHEAD_LIST@
 wrlhead_HEADERS = @WRLHEAD_LIST@
 wrlwrappershead_HEADERS = @WRLWRAPPERSHEAD_LIST@
 mingwhelperhead_HEADERS = @MINGWHELPERHEAD_LIST@
-nodist_sdkshead_HEADERS = _mingw_ddk.h
+nodist_sdkshead_HEADERS = crt/sdks/_mingw_ddk.h
 noinst_HEADERS = crt/sdks/_mingw_ddk.h.in
 
 ddkheaddir = $(baseheaddir)/ddk
@@ -414,5 +414,6 @@ include/wincrypt.h: ;
 
 endif
 
-_mingw_ddk.h: $(srcdir)/crt/sdks/_mingw_ddk.h.in
+crt/sdks/_mingw_ddk.h: $(srcdir)/crt/sdks/_mingw_ddk.h.in
+       ([ -z $(@D) ] || mkdir -p $(@D)) && \
        $(SED) s/MINGW_HAS_DDK$$/@MINGW_HAS_DDK@/ $< > $@
-- 
2.51.0.windows.2

From e36e69d80651210b531e3554bae804e0ab1fd885 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <[email protected]>
Date: Thu, 18 Jan 2026 13:17:10 +0100
Subject: [PATCH 2/3] Prefer headers in the source tree and generated headers
 over installed ones

Add `-I` flags to the preprocessor flags that prefer headers in the source
tree or headers the have been generated over ones that are installed.
---
 mingw-w64-crt/Makefile.am | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index c8bce98e4..4525d10e5 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -12,12 +12,13 @@
 #AUTOMAKE_OPTIONS = color-tests
 
 if WITHSYSROOT
-  sysincludes="-I@TARGET_SYSTEM_ROOT@/include"
+  sysincludes2="-I@TARGET_SYSTEM_ROOT@/include"
   withsys="--with-sysroot=@TARGET_SYSTEM_ROOT@"
 else
-  sysincludes=
+  sysincludes2=
   withsys=
 endif
+sysincludes=-I$(top_srcdir)/../mingw-w64-headers/include 
-I$(top_srcdir)/../mingw-w64-headers/crt 
-I$(top_builddir)/../mingw-w64-headers/crt $(sysincludes2)
 
 AM_CPPFLAGS=$(sysincludes)
 AM_CFLAGS=-pipe -std=gnu99 -fno-builtin -D_CRTBLD -D_WIN32_WINNT=0x0f00 
-D__MSVCRT_VERSION__=0x600 -D__USE_MINGW_ANSI_STDIO=0 @IMAGEBASE_CFLAGS@ 
@CFGUARD_CFLAGS@ @ADD_C_CXX_WARNING_FLAGS@ @ADD_C_ONLY_WARNING_FLAGS@
-- 
2.51.0.windows.2

From 978d334ac1d2c9a75309294d4c62060ef9ecdad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <[email protected]>
Date: Thu, 18 Jan 2026 13:31:53 +0100
Subject: [PATCH 3/3] Use in-tree and generated headers and built libraries in
 tests.

---
 mingw-w64-crt/testcases/Makefile.am         | 29 +++++++++++++++++++--
 mingw-w64-crt/testcases/complex/Makefile.am |  6 +++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/testcases/Makefile.am 
b/mingw-w64-crt/testcases/Makefile.am
index 45a61d6dc..e6fae7546 100644
--- a/mingw-w64-crt/testcases/Makefile.am
+++ b/mingw-w64-crt/testcases/Makefile.am
@@ -1,6 +1,31 @@
+if WITHSYSROOT
+  sysincludes2="-I@TARGET_SYSTEM_ROOT@/include"
+  withsys="--with-sysroot=@TARGET_SYSTEM_ROOT@"
+else
+  sysincludes2=
+  withsys=
+endif
+sysincludes=-I$(top_srcdir)/../mingw-w64-headers/include 
-I$(top_srcdir)/../mingw-w64-headers/crt 
-I$(top_builddir)/../mingw-w64-headers/crt $(sysincludes2)
+
 TEST_CFLAGS=-Wno-format -Wno-unused-parameter -Wno-error=unused-function
-AM_CFLAGS=@ADD_C_CXX_WARNING_FLAGS@ @ADD_C_ONLY_WARNING_FLAGS@ $(TEST_CFLAGS) 
-Wno-missing-prototypes
-AM_CXXFLAGS=@ADD_C_CXX_WARNING_FLAGS@ @ADD_CXX_ONLY_WARNING_FLAGS@ 
$(TEST_CFLAGS)
+AM_CFLAGS=$(sysincludes) @ADD_C_CXX_WARNING_FLAGS@ @ADD_C_ONLY_WARNING_FLAGS@ 
$(TEST_CFLAGS) -Wno-missing-prototypes
+AM_CXXFLAGS=$(sysincludes) @ADD_C_CXX_WARNING_FLAGS@ 
@ADD_CXX_ONLY_WARNING_FLAGS@ $(TEST_CFLAGS)
+if LIB64
+AM_LDFLAGS=-L$(top_builddir)/lib64
+else
+if LIB32
+AM_LDFLAGS=-L$(top_builddir)/lib32
+else
+if LIBARM64
+AM_LDFLAGS=-L$(top_builddir)/libarm64
+else
+if LIBARM32
+AM_LDFLAGS=-L$(top_builddir)/libarm32
+endif
+endif
+endif
+endif
+
 
 # Testsuite options
 #
diff --git a/mingw-w64-crt/testcases/complex/Makefile.am 
b/mingw-w64-crt/testcases/complex/Makefile.am
index 013758e22..173259dbe 100644
--- a/mingw-w64-crt/testcases/complex/Makefile.am
+++ b/mingw-w64-crt/testcases/complex/Makefile.am
@@ -46,6 +46,11 @@
 # Due to automake limitations, references are relative to the top level,
 # and not the subdirectory in which this resides.
 
+CPPFLAGS32 ?= $(AM_CPPFLAGS)
+CPPFLAGS64 ?= $(AM_CPPFLAGS)
+LDFLAGS32 ?= $(AM_LDFLAGS)
+LDFLAGS64 ?= $(AM_LDFLAGS)
+
 # Complex library check sources.
 check_complex_lib_sources = \
   complex/complex_test.h \
@@ -244,6 +249,7 @@ endif LIB32
 # 64 bit tests.
 if LIB64
 
+
 # Complex library support libs.
 newcomplex_test_lib64 = \
   tests64/libnewcomplextestsf.a \
-- 
2.51.0.windows.2

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to