wasm: force TCL select() notifier (Emscripten has no working epoll)

TCL 9.1's configure defines NOTIFIER_EPOLL whenever <sys/epoll.h> is
present (unix/configure.ac:342).  Emscripten's sysroot ships that header
and the epoll_* symbols, so TCL picked the epoll notifier — but epoll
does not work under WASM at runtime and the event loop hangs.

Hide the header/functions from TCL's configure via autoconf cache vars
(ac_cv_header_sys_epoll_h=no + epoll_create/epoll_create1=no) so the
select()-based notifier is selected instead.

Verified with emsdk 6.0.3: NOTIFIER_EPOLL is absent from DEFS, the
tclEpollNotfy.o/tclKqueueNotfy.o objects are empty stubs (333 B) and
tclSelectNotfy.o is the live notifier (~9.9 KB); the tcl WASM variant
links (magic.js + magic.wasm) via npm/build.sh out-of-source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Darryl L. Miles 2026-07-22 14:47:26 +00:00 committed by R. Timothy Edwards
parent c2df97576a
commit c21f4a96db
1 changed files with 8 additions and 0 deletions

View File

@ -107,7 +107,15 @@ cd "$OUT"
# patching the read-only TCL source tree.
if [ ! -f Makefile ]; then
echo "=== emconfigure ==="
# Force the select()-based notifier: Emscripten exposes <sys/epoll.h> and the
# epoll_* symbols in its sysroot, so TCL's configure would pick the epoll
# notifier — but epoll does not work under WASM at runtime and the event loop
# hangs. Hide the header/functions from configure (autoconf cache vars) so
# TCL falls back to select(), which Emscripten does support.
CFLAGS="-O2 -sUSE_ZLIB=1" \
ac_cv_header_sys_epoll_h=no \
ac_cv_func_epoll_create=no \
ac_cv_func_epoll_create1=no \
emconfigure "$TCL_SRC/unix/configure" \
--disable-shared \
--disable-load \