summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-03-22 10:04:36 (GMT)
committerGitHub <noreply@github.com>2022-03-22 10:04:36 (GMT)
commitdeeaac49e267285158264643799624623f4a7b29 (patch)
tree27f409d7d43cf169451aa892a2363f1cac85f7df /configure.ac
parenta25a985535ccbb7df8caddc0017550ff4eae5855 (diff)
downloadcpython-deeaac49e267285158264643799624623f4a7b29.zip
cpython-deeaac49e267285158264643799624623f4a7b29.tar.gz
cpython-deeaac49e267285158264643799624623f4a7b29.tar.bz2
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests - Skip extension import tests if dlopen is not available - Don't assume that _testcapi is a shared extension - Skip a lot of socket tests that don't work on Emscripten - Skip mmap tests, mmap emulation is incomplete - venv does not work yet - Cannot get libc from executable The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac42
1 files changed, 40 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 7a37ad2..4afc898 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1659,6 +1659,13 @@ if test "$Py_LTO" = 'true' ; then
;;
esac
;;
+ *emcc*)
+ if test "$Py_LTO_POLICY" != "default"; then
+ AC_MSG_ERROR([emcc supports only default lto.])
+ fi
+ LTOFLAGS="-flto"
+ LTOCFLAGS="-flto"
+ ;;
*gcc*)
if test $Py_LTO_POLICY = thin
then
@@ -1861,15 +1868,33 @@ then
fi
# WASM flags
+# TODO: Add -s MAIN_MODULE=2 for dlopen() support.
+# The option disables code elimination, which increases code size of main
+# binary. All objects must be built with -fPIC.
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[Emscripten/browser], [
- LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --preload-file \$(WASM_ASSETS_DIR)"
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1"
+ LINKFORSHARED="--preload-file \$(WASM_ASSETS_DIR)"
WASM_ASSETS_DIR=".\$(prefix)"
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
+ dnl separate-dwarf does not seem to work in Chrome DevTools Support.
+ if test "$Py_DEBUG" = 'true'; then
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
+ LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
+ else
+ LINKFORSHARED="$LINKFORSHARED -O2 -g0"
+ fi
],
[Emscripten/node], [
- LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s EXIT_RUNTIME=1 -s USE_PTHREADS -s PROXY_TO_PTHREAD"
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s USE_PTHREADS=1"
+ LINKFORSHARED="-s PROXY_TO_PTHREAD=1 -s EXIT_RUNTIME=1"
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
+ if test "$Py_DEBUG" = 'true'; then
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
+ LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
+ else
+ LINKFORSHARED="$LINKFORSHARED -O2 -gseparate-dwarf"
+ fi
],
[WASI/*], [
AC_DEFINE([_WASI_EMULATED_SIGNAL], [1], [Define to 1 if you want to emulate signals on WASI])
@@ -2880,6 +2905,10 @@ then
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
+ Emscripten*)
+ LDSHARED='$(CC) -shared -s SIDE_MODULE=1'
+ LDCXXSHARED='$(CXX) -shared -s SIDE_MODULE=1'
+ ;;
FreeBSD*)
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
then
@@ -4354,6 +4383,10 @@ PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [
], [have_zlib=no])
])
+if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
+ ZLIB_LIBS="-s USE_ZLIB=1"
+fi
+
dnl binascii can use zlib for optimized crc32.
AS_VAR_IF([have_zlib], [yes], [
BINASCII_CFLAGS="-DUSE_ZLIB_CRC32 $ZLIB_CFLAGS"
@@ -4372,6 +4405,11 @@ PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
], [have_bzip2=no])
])
+if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
+ BZIP2_LIBS="-s USE_BZIP2=1"
+fi
+
+
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
AC_CHECK_HEADERS([lzma.h], [
WITH_SAVE_ENV([