summaryrefslogtreecommitdiffhomepage
path: root/auto/modules/wasm
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-10-10 20:54:39 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-10-10 20:54:39 +0100
commit8f6449f4e0152d9644b807cf2208e3734a0f8b4d (patch)
tree266081fadb3ca5131e22452e315f6a6dd544d32e /auto/modules/wasm
parent01d185cb52af8879aeeab04765eff439feec664c (diff)
downloadunit-8f6449f4e0152d9644b807cf2208e3734a0f8b4d.tar.gz
unit-8f6449f4e0152d9644b807cf2208e3734a0f8b4d.tar.bz2
[WIP] Wasm: Add a WAMR based language modulewasm
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'auto/modules/wasm')
-rw-r--r--auto/modules/wasm21
1 files changed, 20 insertions, 1 deletions
diff --git a/auto/modules/wasm b/auto/modules/wasm
index 1f388de6..17648b5f 100644
--- a/auto/modules/wasm
+++ b/auto/modules/wasm
@@ -62,6 +62,8 @@ NXT_WASM_LIB_PATH=${NXT_WASM_LIB_PATH=}
NXT_WASM_LDFLAGS=
if [ "$NXT_WASM_RUNTIME" = "wasmtime" ]; then
NXT_WASM_LDFLAGS=-lwasmtime
+elif [ "$NXT_WASM_RUNTIME" = "wamr" ]; then
+ NXT_WASM_LDFLAGS="-lvmlib -lm"
fi
NXT_WASM_ADDITIONAL_FLAGS="-fno-strict-aliasing \
-Wno-missing-field-initializers \
@@ -111,10 +113,25 @@ if [ "$NXT_WASM_RUNTIME" = "wasmtime" ]; then
return 0;
}"
+elif [ "$NXT_WASM_RUNTIME" = "wamr" ]; then
+ nxt_feature="wamr"
+ nxt_feature_name=""
+ nxt_feature_run=no
+ nxt_feature_incs="-I${NXT_WASM_INCLUDE_PATH}"
+ nxt_feature_libs="-L${NXT_WASM_LIB_PATH} $NXT_WASM_LDFLAGS"
+ nxt_feature_test="
+ #include <wasm_export.h>
- . auto/feature
+ int main(void) {
+ if (!wasm_runtime_init())
+ return 1;
+
+ return 0;
+ }"
fi
+. auto/feature
+
if [ $nxt_found = no ]; then
$echo
$echo $0: error: no $NXT_WASM_RUNTIME found.
@@ -143,6 +160,8 @@ NXT_WASM_MODULE_SRCS=" \
if [ "$NXT_WASM_RUNTIME" = "wasmtime" ]; then
NXT_WASM_MODULE_SRCS="$NXT_WASM_MODULE_SRCS src/wasm/nxt_rt_wasmtime.c"
+elif [ "$NXT_WASM_RUNTIME" = "wamr" ]; then
+ NXT_WASM_MODULE_SRCS="$NXT_WASM_MODULE_SRCS src/wasm/nxt_rt_wamr.c"
fi