diff options
Diffstat (limited to 'ext/opcache/config.m4')
-rw-r--r-- | ext/opcache/config.m4 | 102 |
1 files changed, 95 insertions, 7 deletions
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 6c40cafc1c..08a39e2f63 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -11,6 +11,13 @@ PHP_ARG_ENABLE([huge-code-pages], [yes], [no]) +PHP_ARG_ENABLE([opcache-jit], + [whether to enable JIT], + [AS_HELP_STRING([--disable-opcache-jit], + [Disable JIT])], + [yes], + [no]) + if test "$PHP_OPCACHE" != "no"; then dnl Always build as shared extension @@ -20,6 +27,77 @@ if test "$PHP_OPCACHE" != "no"; then AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)]) fi + if test "$PHP_OPCACHE_JIT" = "yes"; then + case $host_cpu in + x86*) + ;; + *) + AC_MSG_WARN([JIT not supported by host architecture]) + PHP_OPCACHE_JIT=no + ;; + esac + fi + + if test "$PHP_OPCACHE_JIT" = "yes"; then + AC_DEFINE(HAVE_JIT, 1, [Define to enable JIT]) + ZEND_JIT_SRC="jit/zend_jit.c jit/zend_jit_vm_helpers.c" + + dnl Find out which ABI we are using. + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + int main(void) { + return sizeof(void*) == 4; + } + ]])],[ + ac_cv_32bit_build=no + ],[ + ac_cv_32bit_build=yes + ],[ + ac_cv_32bit_build=no + ]) + + if test "$ac_cv_32bit_build" = "no"; then + case $host_alias in + *x86_64-*-darwin*) + DASM_FLAGS="-D X64APPLE=1 -D X64=1" + ;; + *x86_64*) + DASM_FLAGS="-D X64=1" + ;; + esac + fi + + if test "$enable_zts" = "yes"; then + DASM_FLAGS="$DASM_FLAGS -D ZTS=1" + fi + + PHP_SUBST(DASM_FLAGS) + + AC_MSG_CHECKING(for opagent in default path) + for i in /usr/local /usr; do + if test -r $i/include/opagent.h; then + OPAGENT_DIR=$i + AC_MSG_RESULT(found in $i) + break + fi + done + if test -z "$OPAGENT_DIR"; then + AC_MSG_RESULT(not found) + else + PHP_CHECK_LIBRARY(opagent, op_write_native_code, + [ + AC_DEFINE(HAVE_OPROFILE,1,[ ]) + PHP_ADD_INCLUDE($OPAGENT_DIR/include) + PHP_ADD_LIBRARY_WITH_PATH(opagent, $OPAGENT_DIR/$PHP_LIBDIR/oprofile, OPCACHE_SHARED_LIBADD) + PHP_SUBST(OPCACHE_SHARED_LIBADD) + ],[ + AC_MSG_RESULT(not found) + ],[ + -L$OPAGENT_DIR/$PHP_LIBDIR/oprofile + ]) + fi + + fi + AC_CHECK_FUNCS([mprotect]) AC_MSG_CHECKING(for sysvipc shared memory support) @@ -89,8 +167,8 @@ int main() { } ]])],[dnl AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) - msg=yes],[msg=no],[msg=no]) - AC_MSG_RESULT([$msg]) + have_shm_ipc=yes],[have_shm_ipc=no],[have_shm_ipc=no]) + AC_MSG_RESULT([$have_shm_ipc]) AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -141,8 +219,8 @@ int main() { } ]])],[dnl AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) - msg=yes],[msg=no],[msg=no]) - AC_MSG_RESULT([$msg]) + have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[have_shm_mmap_anon=no]) + AC_MSG_RESULT([$have_shm_mmap_anon=yes]) PHP_CHECK_FUNC_LIB(shm_open, rt) AC_MSG_CHECKING(for mmap() using shm_open() shared memory support) @@ -212,6 +290,7 @@ int main() { ]])],[dnl AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) AC_MSG_RESULT([yes]) + have_shm_mmap_posix=yes PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) ],[ AC_MSG_RESULT([no]) @@ -234,8 +313,7 @@ int main() { shared_alloc_mmap.c \ shared_alloc_posix.c \ Optimizer/zend_optimizer.c \ - Optimizer/pass1_5.c \ - Optimizer/pass2.c \ + Optimizer/pass1.c \ Optimizer/pass3.c \ Optimizer/optimize_func_calls.c \ Optimizer/block_pass.c \ @@ -254,10 +332,20 @@ int main() { Optimizer/dce.c \ Optimizer/escape_analysis.c \ Optimizer/compact_vars.c \ - Optimizer/zend_dump.c, + Optimizer/zend_dump.c \ + $ZEND_JIT_SRC, shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes) PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1) PHP_ADD_EXTENSION_DEP(opcache, pcre) + + if test "$have_shm_ipc" != "yes" && test "$have_shm_mmap_posix" != "yes" && test "$have_shm_mmap_anon" != "yes"; then + AC_MSG_ERROR([No supported shared memory caching support was found when configuring opcache. Check config.log for any errors or missing dependencies.]) + fi + + if test "$PHP_OPCACHE_JIT" = "yes"; then + PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1) + PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag) + fi PHP_SUBST(OPCACHE_SHARED_LIBADD) fi |