Hi, I see that currently SDL2 only builds without threads when building for emscripten/wasm.
Considering threads weren’t in the wasm MVP and support for the thread extension usually requires special deployment setups in browsers for security reasons, and because modules built without threads can’t be linked with modules built with threads, this is probably the right move for default build options.
But skimming through configure.ac I see that the option to enable threads isn’t even there. Emscripten implements pthreads so adding support for threads should be as trivial as adding the same pthreads check for the Emscripten build as exists for Linux/BSD/etc builds, except for only when it’s explicitly requested, plus adding -pthread to both the compiler and linker options.
On a related note emscripten also has atomics now, and the SDK provides functions for them, which should only be enabled along with pthreads because until recently the extension proposal prohibited atomics when not building with threads support (and really why would you use atomics if you can’t make threads?)
More on enabling pthreads with emcc: https://emscripten.org/docs/porting/pthreads.html
(s -PROXY_TO_PTHREAD might be a good idea too, but I’m not sure if libraries need this, or just the main application)
I’m really not familiar with autotools or shell scripting and can’t even seem to get autoconf to work on my Windows machine or I’d just write up the patch myself, but having an option to enable threads when building the Emscripten port seems like a reasonable request that should be easy to fulfill.