From c0fd6157799de590959837ae7da2a70490628f29 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 22 Sep 2026 06:35:34 +0900 Subject: [PATCH] Pick the WinIO test option in the cabal file, not in configure configure.ac probed for __IO_MANAGER_WINIO__ >= 2 and, when it found it, appended a test-suite stanza to network.buildinfo. Neither half worked. The probe sat behind `case "$host_os" in mingw*)`, but cabal runs configure under an MSYS shell on Windows, where config.guess resolves the host to *-pc-msys. The case never matched, so even on Windows config.log said checking whether to use native Windows I/O manager RTS option... no, not Windows and the option was never added. The test suite has therefore always run under MIO, in CI as much as locally. Fixing the host test only exposed the second half. A .buildinfo carries a HookedBuildInfo, which Cabal accepts for the library and for named executables but not for a test-suite, so once the probe started succeeding every Windows build failed with network.buildinfo:3:1: invalid subsection "test-suite" Drop the machinery and say it in the cabal file, where the test-suite can be addressed directly. The compiler versions are spelled out rather than probed: the overlapped I/O exception fix landed on the 9.12 and 9.14 branches in April 2026, after 9.12.4 and 9.14.1 had been released. The lower bounds are exclusive so that release candidates and snapshots of those branches are covered as well. --with-compiler is still accepted, unused, so that cabal passing it does not draw an unrecognized-option warning. Verified on Windows 11 with 9.12.4.20260713: the option now reaches the link line, is embedded in the test binary, and the suite passes five runs out of five with WinIO as the default. Co-Authored-By: Claude Opus 5 (1M context) --- configure.ac | 39 +++------------------------------------ network.cabal | 9 +++++++++ 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index 2e1f4246..4c7c9aa1 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,9 @@ AC_ARG_WITH([cc], [CC=$withval]) AC_PROG_CC() +dnl cabal passes --with-compiler, so keep accepting it even though nothing +dnl here uses $HC any more; otherwise autoconf warns about an unrecognized +dnl option on every configure run. AC_ARG_WITH([compiler], [Haskell compiler], [HC=$withval]) @@ -105,40 +108,4 @@ dnl This is a necessary hack AC_MSG_NOTICE([creating ./network.buildinfo]) echo "install-includes: HsNetworkConfig.h" > network.buildinfo -WINIO_GHC_OPTIONS= -AC_MSG_CHECKING([whether to use native Windows I/O manager RTS option]) -case "$host_os" in -mingw*) - cat > conftest_ghc_cpp.hs </dev/null 2>&1; then - AC_MSG_RESULT([yes]) - WINIO_GHC_OPTIONS="-with-rtsopts=--io-manager=native" - else - AC_MSG_RESULT([no, $HC does not define __IO_MANAGER_WINIO__ >= 2]) - fi - rm -f conftest_ghc_cpp.hi conftest_ghc_cpp.hs conftest_ghc_cpp.o - ;; -*) - AC_MSG_RESULT([no, not Windows]) - ;; -esac - -dnl This is an overlay for the existing test-suite in network.cabal. Cabal -dnl conditionals cannot read values produced by configure, so the probe result -dnl has to be expressed as generated build info. -AS_IF([test -n "$WINIO_GHC_OPTIONS"], - [cat >> network.buildinfo <= 2. That landed on the 9.12 and + -- 9.14 branches in April 2026, after 9.12.4 and 9.14.1 had been released. + -- The lower bounds are exclusive so that release candidates and snapshots + -- of those branches, such as 9.12.4.20260713, are covered as well. + if os(windows) && (impl(ghc > 9.12.4 && < 9.13) || impl(ghc > 9.14.1)) + ghc-options: -with-rtsopts=--io-manager=native + build-depends: base, bytestring,