diff --git a/configure.ac b/configure.ac index c863ab83b..2d402a429 100644 --- a/configure.ac +++ b/configure.ac @@ -417,6 +417,28 @@ AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext) dnl =========================================================================== +AC_ARG_WITH(wasm, + [AS_HELP_STRING([--with-wasm=@<:@yes/no/auto@:>@], + [Use the wasm-micro-runtime library @<:@default=no@:>@])],, + [with_wasm=no]) +have_wasm=false +if test "x$with_wasm" = "xyes" -o "x$with_wasm" = "xauto"; then + AC_CHECK_HEADERS(wasm_export.h, have_wasm=true) +fi +if test "x$with_wasm" = "xyes" -a "x$have_wasm" != "xtrue"; then + AC_MSG_ERROR([wasm support requested but not found]) +fi +if $have_wasm; then + WASM_CFLAGS= + WASM_LIBS="-liwasm" + AC_SUBST(WASM_CFLAGS) + AC_SUBST(WASM_LIBS) + AC_DEFINE(HAVE_WASM, 1, [Have wasm-micro-runtime library]) +fi +AM_CONDITIONAL(HAVE_WASM, $have_wasm) + +dnl =========================================================================== + AC_CONFIG_FILES([ Makefile src/Makefile @@ -478,6 +500,7 @@ Platform shapers (not normally needed): DirectWrite: ${have_directwrite} GDI: ${have_gdi} Uniscribe: ${have_uniscribe} + WebAssembly: ${have_wasm} Other features: Documentation: ${enable_gtk_doc} diff --git a/src/Makefile.am b/src/Makefile.am index 26e56e5f6..4753bf1d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,6 +114,16 @@ else HB_HAS_CORETEXT_DEF = undef HB_HAS_CORETEXT endif +if HAVE_WASM +HBCFLAGS += $(WASM_CFLAGS) +HBNONPCLIBS += $(WASM_LIBS) +HBSOURCES += $(HB_WASM_sources) +HBHEADERS += $(HB_WASM_headers) +HB_HAS_WASM_DEF = define HB_HAS_WASM 1 +else +HB_HAS_WASM_DEF = undef HB_HAS_WASM +endif + BUILT_SOURCES += \ hb-version.h diff --git a/src/Makefile.sources b/src/Makefile.sources index 4edea33c8..be69f467f 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -255,7 +255,6 @@ HB_BASE_sources = \ hb-unicode.hh \ hb-utf.hh \ hb-vector.hh \ - hb-wasm-shape.cc \ hb-priority-queue.hh \ hb.hh \ $(NULL) @@ -339,10 +338,22 @@ HB_GDI_headers = hb-gdi.h HB_UNISCRIBE_sources = hb-uniscribe.cc HB_UNISCRIBE_headers = hb-uniscribe.h -# Sources for libharfbuzz-gobject and libharfbuzz-icu HB_ICU_sources = hb-icu.cc HB_ICU_headers = hb-icu.h +HB_WASM_sources = \ + hb-wasm-api.cc \ + hb-wasm-api.hh \ + hb-wasm-api-blob.hh \ + hb-wasm-api-buffer.hh \ + hb-wasm-api-common.hh \ + hb-wasm-api-face.hh \ + hb-wasm-api-font.hh \ + hb-wasm-api-shape.hh \ + hb-wasm-shape.cc \ + $(NULL) +HB_WASM_headers = hb-wasm-api.h + # Sources for libharfbuzz-subset HB_SUBSET_sources = \ hb-number.cc \ diff --git a/src/harfbuzz.cc b/src/harfbuzz.cc index 26e2bc145..d7e8a93f3 100644 --- a/src/harfbuzz.cc +++ b/src/harfbuzz.cc @@ -58,5 +58,3 @@ #include "hb-ucd.cc" #include "hb-unicode.cc" #include "hb-uniscribe.cc" -#include "hb-wasm-api.cc" -#include "hb-wasm-shape.cc"