From bb123c5de8f498dbc32a03f5e93643bd06a15e0c Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Mon, 21 Aug 2017 15:14:43 -0700 Subject: [PATCH] [WASM] Hack configure.ac to support wasm. Use --enable-wasm instead of --host / --target --- configure.ac | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/configure.ac b/configure.ac index aa0111de8ae..4fab4a365f4 100644 --- a/configure.ac +++ b/configure.ac @@ -96,8 +96,15 @@ need_link_unlink=no #Set to extra linker flags to be passed to the runtime binaries (mono /mono-sgen) extra_runtime_ldflags="" + +# Hack for WASM +# Current autotools (v1.15) doesn't have a triplet we can use for wasm so the kludge we do is to +# work around it by using a feature flag instead +AC_ARG_ENABLE(wasm,[ --enable-wasm Hack to set the current runtime to target wasm], enable_wasm=$enableval) + # Thread configuration inspired by sleepycat's db AC_MSG_CHECKING([host platform characteristics]) + libgc_threads=no has_dtrace=no parallel_mark=yes @@ -107,6 +114,16 @@ host_win32=no target_win32=no platform_android=no host_darwin=no + + +if test "x$enable_wasm" = "xyes"; then +CFLAGS="$CFLAGS -D_REENTRANT -D_GNU_SOURCE -DNO_UNALIGNED_ACCESS -s WASM=1 -DWASM -Os" +CPPFLAGS="$CPPFLAGS -D_REENTRANT -DUSE_MMAP -D_GNU_SOURCE -DNO_UNALIGNED_ACCESS -s WASM=1 -DWASM -Os" +libdl="-ldl" +libgc_threads=pthreads + +else + case "$host" in *-mingw*|*-*-cygwin*) AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer]) @@ -350,6 +367,10 @@ case "$host" in libdl="-ldl" ;; esac + +# WASM hack +fi + AC_MSG_RESULT(ok) if test x$need_link_unlink = xyes; then @@ -3038,6 +3059,19 @@ jit_wanted=true boehm_supported=true BTLS_SUPPORTED=no BTLS_PLATFORM= + +if test "x$enable_wasm" = "xyes"; then +TARGET=WASM +HOST=WASM +arch_target=wasm +AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode]) +AC_DEFINE(TARGET_WASM, 1, [Target wasm]) +BTLS_SUPPORTED=no +with_tls=pthread +target_mach=no + +else + case "$host" in mips*) TARGET=MIPS; @@ -3440,6 +3474,8 @@ SPARC64) ;; esac +#WASM hack +fi dnl ************* @@ -4309,6 +4345,8 @@ AM_CONDITIONAL(HOST_X86, test x$HOST = xX86) AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64) AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM) AM_CONDITIONAL(HOST_ARM64, test x$HOST = xARM64) +AM_CONDITIONAL(HOST_WASM, test x$HOST = xWASM) + AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target") AC_SUBST(LIBC) -- 2.25.1