forked from crazyxman/simdjson_php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
43 lines (33 loc) · 1.57 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
dnl config.m4 for extension simdjson
PHP_ARG_ENABLE(simdjson, whether to enable simdjson, [ --enable-simdjson Enable simdjson])
if test "$PHP_SIMDJSON" != "no"; then
PHP_REQUIRE_CXX()
AC_MSG_CHECKING([PHP version])
if test -z "$PHP_CONFIG"; then
AC_MSG_ERROR([php-config not found])
fi
php_version=`$PHP_CONFIG --vernum`
if test -z "$php_version"; then
AC_MSG_ERROR([failed to detect PHP version, please report])
fi
if test "$php_version" -lt "70000"; then
AC_MSG_ERROR([You need at least PHP 7.0.0 to be able to use this version of simdjson. PHP $php_version found])
else
AC_MSG_RESULT([$php_version, ok])
fi
dnl Mark symbols hidden by default if the compiler (for example, gcc >= 4)
dnl supports it. This can help reduce the binary size and startup time.
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
[CXXFLAGS="$CXXFLAGS -fvisibility=hidden"])
AC_DEFINE(HAVE_SIMDJSON, 1, [whether simdjson is enabled])
dnl Disable exceptions because PHP is written in C and loads this C++ module, handle errors manually.
dnl Disable development checks of C simdjson library in php debug builds (can manually override)
PHP_NEW_EXTENSION(simdjson, [
php_simdjson.cpp \
src/simdjson_bindings.cpp \
src/simdjson.cpp],
$ext_shared,, "-std=c++17 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DSIMDJSON_EXCEPTIONS=0 -DSIMDJSON_DEVELOPMENT_CHECKS=0", cxx)
PHP_INSTALL_HEADERS([ext/simdjson], [php_simdjson.h src/simdjson_bindings_defs.h])
PHP_ADD_MAKEFILE_FRAGMENT
PHP_ADD_BUILD_DIR(src, 1)
fi