winzik/docker/ext/cryo/config.m4

49 lines
1.7 KiB
Text

dnl config.m4 for ext-cryo
PHP_ARG_ENABLE([cryo],
[whether to enable Cryo (snapshot / restore / sandbox)],
[AS_HELP_STRING([--enable-cryo], [Enable Cryo support])],
[no])
PHP_ARG_ENABLE([cryo-wasm],
[whether to build the WebAssembly backend of Cryo],
[AS_HELP_STRING([--enable-cryo-wasm], [Use the JS host backend (Emscripten builds)])],
[no],
[no])
if test "$PHP_CRYO" != "no"; then
AC_DEFINE(HAVE_CRYO, 1, [Have Cryo])
if test "$PHP_CRYO_WASM" != "no"; then
AC_DEFINE(CRYO_BACKEND_WASM, 1, [Cryo uses the WebAssembly host backend])
else
dnl metrics sampler thread (cryo_metrics.c)
PHP_ADD_LIBRARY(pthread, 1, CRYO_SHARED_LIBADD)
PHP_SUBST(CRYO_SHARED_LIBADD)
fi
dnl zlib (compressed freeze files) and libsodium (encryption): optional
AC_CHECK_HEADER([zlib.h], [
PHP_CHECK_LIBRARY(z, compress2, [
AC_DEFINE(HAVE_CRYO_ZLIB, 1, [Cryo compresses freeze files with zlib])
PHP_ADD_LIBRARY(z, 1, CRYO_SHARED_LIBADD)
])
])
AC_CHECK_HEADER([zstd.h], [
PHP_CHECK_LIBRARY(zstd, ZSTD_compress, [
AC_DEFINE(HAVE_CRYO_ZSTD, 1, [Cryo compresses freeze files with zstd])
PHP_ADD_LIBRARY(zstd, 1, CRYO_SHARED_LIBADD)
])
])
AC_CHECK_HEADER([sodium.h], [
PHP_CHECK_LIBRARY(sodium, crypto_aead_xchacha20poly1305_ietf_encrypt, [
AC_DEFINE(HAVE_CRYO_SODIUM, 1, [Cryo encrypts freeze files with libsodium])
PHP_ADD_LIBRARY(sodium, 1, CRYO_SHARED_LIBADD)
])
])
PHP_SUBST(CRYO_SHARED_LIBADD)
PHP_NEW_EXTENSION(cryo,
cryo.c cryo_graph.c cryo_reader.c cryo_platform.c cryo_freeze.c cryo_process.c cryo_walk.c cryo_host.c cryo_metrics.c cryo_fork.c cryo_engine.c cryo_sandbox.c cryo_crypto.c,
$ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi