Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 3 additions & 36 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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 <<EOF
#if !defined(__IO_MANAGER_WINIO__) || __IO_MANAGER_WINIO__ < 2
#error __IO_MANAGER_WINIO__ < 2
#endif
module Main where
main :: IO ()
main = return ()
EOF
if "$HC" -c -cpp -fforce-recomp 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 <<EOF

test-suite spec
ghc-options: $WINIO_GHC_OPTIONS
EOF
])

AC_OUTPUT
9 changes: 9 additions & 0 deletions network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ test-suite spec

default-language: Haskell2010
ghc-options: -Wall -threaded

-- Run the test suite under WinIO wherever the compiler supports it, that
-- is wherever __IO_MANAGER_WINIO__ >= 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,
Expand Down
Loading