summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@midokura.com>2023-06-22 18:26:10 (GMT)
committerGitHub <noreply@github.com>2023-06-22 18:26:10 (GMT)
commitd8f87cdf94a6533c5cf2d25e09e6fa3eb06720b9 (patch)
tree9f7ed8410b45c165ef8d930890d863fd9a252110 /configure
parent13237a2da846efef9ce9b93fd4bcfebd49933568 (diff)
downloadcpython-d8f87cdf94a6533c5cf2d25e09e6fa3eb06720b9.zip
cpython-d8f87cdf94a6533c5cf2d25e09e6fa3eb06720b9.tar.gz
cpython-d8f87cdf94a6533c5cf2d25e09e6fa3eb06720b9.tar.bz2
gh-101538: Add experimental wasi-threads build (#101537)
Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure21
1 files changed, 20 insertions, 1 deletions
diff --git a/configure b/configure
index fdc7c22..e33bf77 100755
--- a/configure
+++ b/configure
@@ -6874,7 +6874,11 @@ cat > conftest.c <<EOF
# if defined(__EMSCRIPTEN__)
wasm32-emscripten
# elif defined(__wasi__)
+# if defined(_REENTRANT)
+ wasm32-wasi-threads
+# else
wasm32-wasi
+# endif
# else
# error unknown wasm32 platform
# endif
@@ -7160,7 +7164,7 @@ then :
Emscripten) :
;; #(
WASI) :
- as_fn_error $? "WASI threading is not implemented yet." "$LINENO" 5 ;; #(
+ ;; #(
*) :
as_fn_error $? "--enable-wasm-pthreads only applies to Emscripten and WASI" "$LINENO" 5
;;
@@ -9394,6 +9398,21 @@ printf "%s\n" "#define _WASI_EMULATED_PROCESS_CLOCKS 1" >>confdefs.h
LIBS="$LIBS -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks"
echo "#define _WASI_EMULATED_SIGNAL 1" >> confdefs.h
+ if test "x$enable_wasm_pthreads" = xyes
+then :
+
+ # Note: update CFLAGS because ac_compile/ac_link needs this too.
+ # without this, configure fails to find pthread_create, sem_init,
+ # etc because they are only available in the sysroot for
+ # wasm32-wasi-threads.
+ as_fn_append CFLAGS " -target wasm32-wasi-threads -pthread"
+ as_fn_append CFLAGS_NODIST " -target wasm32-wasi-threads -pthread"
+ as_fn_append LDFLAGS_NODIST " -target wasm32-wasi-threads -pthread"
+ as_fn_append LDFLAGS_NODIST " -Wl,--import-memory"
+ as_fn_append LDFLAGS_NODIST " -Wl,--max-memory=10485760"
+
+fi
+
as_fn_append LDFLAGS_NODIST " -z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=10485760"
;; #(