diff --git a/Tools/wasm/config.site-wasm32-wasi b/Tools/wasm/config.site-wasm32-wasi index be26c46a148..255e99c279a 100644 --- a/Tools/wasm/config.site-wasm32-wasi +++ b/Tools/wasm/config.site-wasm32-wasi @@ -1,8 +1,6 @@ # config.site override for cross compiling to wasm32-wasi platform # # Written by Christian Heimes -# Partly based on pyodide's pyconfig.undefs.h file. - # cannot be detected in cross builds ac_cv_buggy_getaddrinfo=no @@ -14,4 +12,8 @@ ac_cv_file__dev_ptc=no # dummy readelf, WASI build does not need readelf. ac_cv_prog_ac_ct_READELF=true +# get/setrlimit are not supported +ac_cv_header_sys_resource_h=no + +# undefined symbols / unsupported features ac_cv_func_eventfd=no diff --git a/configure b/configure index 5ebcadd6423..128e36a8006 100755 --- a/configure +++ b/configure @@ -7758,7 +7758,13 @@ case $ac_sys_system/$ac_sys_emscripten_target in #( $as_echo "#define _WASI_EMULATED_SIGNAL 1" >>confdefs.h - LIBS="$LIBS -lwasi-emulated-signal" + +$as_echo "#define _WASI_EMULATED_GETPID 1" >>confdefs.h + + +$as_echo "#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 ;; #( @@ -20549,6 +20555,8 @@ else case $ac_sys_system in #( Emscripten) : with_ensurepip=no ;; #( + WASI) : + with_ensurepip=no ;; #( *) : with_ensurepip=upgrade ;; @@ -21460,6 +21468,28 @@ case $ac_sys_system/$ac_sys_emscripten_target in #( py_cv_module_syslog=n/a py_cv_module_=n/a + ;; #( + WASI/*) : + + + + py_cv_module__ctypes=n/a + py_cv_module__ctypes_test=n/a + py_cv_module__curses=n/a + py_cv_module__curses_panel=n/a + py_cv_module__dbm=n/a + py_cv_module__gdbm=n/a + py_cv_module__scproxy=n/a + py_cv_module__tkinter=n/a + py_cv_module__xxsubinterpreters=n/a + py_cv_module_grp=n/a + py_cv_module_nis=n/a + py_cv_module_ossaudiodev=n/a + py_cv_module_pwd=n/a + py_cv_module_spwd=n/a + py_cv_module_syslog=n/a + py_cv_module_=n/a + ;; #( *) : diff --git a/configure.ac b/configure.ac index 4afc898e81d..6fd95f7704a 100644 --- a/configure.ac +++ b/configure.ac @@ -1898,7 +1898,9 @@ AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], ], [WASI/*], [ AC_DEFINE([_WASI_EMULATED_SIGNAL], [1], [Define to 1 if you want to emulate signals on WASI]) - LIBS="$LIBS -lwasi-emulated-signal" + AC_DEFINE([_WASI_EMULATED_GETPID], [1], [Define to 1 if you want to emulate getpid() on WASI]) + AC_DEFINE([_WASI_EMULATED_PROCESS_CLOCKS], [1], [Define to 1 if you want to emulate process clocks on WASI]) + LIBS="$LIBS -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks" echo "#define _WASI_EMULATED_SIGNAL 1" >> confdefs.h ] ) @@ -6078,6 +6080,7 @@ AC_ARG_WITH(ensurepip, [ AS_CASE([$ac_sys_system], [Emscripten], [with_ensurepip=no], + [WASI], [with_ensurepip=no], [with_ensurepip=upgrade] ) ]) @@ -6468,6 +6471,25 @@ AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], [syslog], ) ], + [WASI/*], [ + PY_STDLIB_MOD_SET_NA( + [_ctypes], + [_ctypes_test], + [_curses], + [_curses_panel], + [_dbm], + [_gdbm], + [_scproxy], + [_tkinter], + [_xxsubinterpreters], + [grp], + [nis], + [ossaudiodev], + [pwd], + [spwd], + [syslog], + ) + ], [PY_STDLIB_MOD_SET_NA([_scproxy])] ) diff --git a/pyconfig.h.in b/pyconfig.h.in index 40952883853..ccbf90041d1 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1728,6 +1728,12 @@ /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT +/* Define to 1 if you want to emulate getpid() on WASI */ +#undef _WASI_EMULATED_GETPID + +/* Define to 1 if you want to emulate process clocks on WASI */ +#undef _WASI_EMULATED_PROCESS_CLOCKS + /* Define to 1 if you want to emulate signals on WASI */ #undef _WASI_EMULATED_SIGNAL