#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
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])
libdl="-ldl"
;;
esac
+
+# WASM hack
+fi
+
AC_MSG_RESULT(ok)
if test x$need_link_unlink = xyes; then
boehm_supported=true
BTLS_SUPPORTED=no
BTLS_PLATFORM=
+
+if test "x$enable_wasm" = "xyes"; then
+TARGET=WASM
+HOST=WASM
+arch_target=wasm
+AC_DEFINE(TARGET_WASM, 1, [Target wasm])
+BTLS_SUPPORTED=no
+with_tls=pthread
+target_mach=no
+
+else
+
case "$host" in
mips*)
TARGET=MIPS;
;;
esac
+#WASM hack
+fi
dnl *************
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)