1- PHP_ARG_ENABLE([ opcache] ,
2- [ whether to enable Zend OPcache support] ,
3- [ AS_HELP_STRING ( [ --disable-opcache] ,
4- [ Disable Zend OPcache support] ) ] ,
5- [ yes] )
6-
71PHP_ARG_ENABLE([ huge-code-pages] ,
82 [ whether to enable copying PHP CODE pages into HUGE PAGES] ,
93 [ AS_HELP_STRING ( [ --disable-huge-code-pages] ,
@@ -25,89 +19,85 @@ PHP_ARG_WITH([capstone],
2519 [ no] ,
2620 [ no] )
2721
28- if test "$PHP_OPCACHE" != "no"; then
29- dnl Always build as shared extension.
30- ext_shared=yes
22+ AS_VAR_IF ( [ PHP_HUGE_CODE_PAGES ] , [ yes ] ,
23+ [ AC_DEFINE ( [ HAVE_HUGE_CODE_PAGES ] , [ 1 ] ,
24+ [ Define to 1 to enable copying PHP CODE pages into HUGE PAGES. ] ) ] )
3125
32- AS_VAR_IF ( [ PHP_HUGE_CODE_PAGES] , [ yes] ,
33- [ AC_DEFINE ( [ HAVE_HUGE_CODE_PAGES] , [ 1] ,
34- [ Define to 1 to enable copying PHP CODE pages into HUGE PAGES.] ) ] )
26+ AS_VAR_IF ( [ PHP_OPCACHE_JIT] , [ yes] , [
27+ AS_CASE ( [ $host_cpu] ,
28+ [ [ i[ 34567] 86*|x86*|aarch64|amd64] ] , [ ] ,
29+ [
30+ AC_MSG_WARN ( [ JIT not supported by host architecture] )
31+ PHP_OPCACHE_JIT=no
32+ ] )
3533
36- AS_VAR_IF ( [ PHP_OPCACHE_JIT] , [ yes] , [
37- AS_CASE ( [ $host_cpu] ,
38- [ [ i[ 34567] 86*|x86*|aarch64|amd64] ] , [ ] ,
39- [
40- AC_MSG_WARN ( [ JIT not supported by host architecture] )
41- PHP_OPCACHE_JIT=no
42- ] )
34+ if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then
35+ AC_MSG_WARN ( [ JIT not supported on Apple Silicon with ZTS] )
36+ PHP_OPCACHE_JIT=no
37+ fi
38+ ] )
39+
40+ AS_VAR_IF ( [ PHP_OPCACHE_JIT] , [ yes] , [
41+ AC_DEFINE ( [ HAVE_JIT] , [ 1] , [ Define to 1 to enable JIT.] )
42+ ZEND_JIT_SRC=m4_normalize ( [ "
43+ jit/ir/ir_cfg.c
44+ jit/ir/ir_check.c
45+ jit/ir/ir_dump.c
46+ jit/ir/ir_emit.c
47+ jit/ir/ir_gcm.c
48+ jit/ir/ir_gdb.c
49+ jit/ir/ir_patch.c
50+ jit/ir/ir_perf.c
51+ jit/ir/ir_ra.c
52+ jit/ir/ir_save.c
53+ jit/ir/ir_sccp.c
54+ jit/ir/ir_strtab.c
55+ jit/ir/ir.c
56+ jit/zend_jit_vm_helpers.c
57+ jit/zend_jit.c
58+ "] )
59+
60+ dnl Find out which ABI we are using.
61+ AS_CASE ( [ $host_alias] ,
62+ [ x86_64-*-darwin*] , [
63+ IR_TARGET=IR_TARGET_X64
64+ DASM_FLAGS="-D X64APPLE=1 -D X64=1"
65+ DASM_ARCH="x86"
66+ ] ,
67+ [ *x86_64*|amd64-*-freebsd*] , [
68+ IR_TARGET=IR_TARGET_X64
69+ DASM_FLAGS="-D X64=1"
70+ DASM_ARCH="x86"
71+ ] ,
72+ [ [ i[ 34567] 86*|x86*] ] , [
73+ IR_TARGET=IR_TARGET_X86
74+ DASM_ARCH="x86"
75+ ] ,
76+ [ aarch64*] , [
77+ IR_TARGET=IR_TARGET_AARCH64
78+ DASM_ARCH="aarch64"
79+ ] )
4380
44- if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then
45- AC_MSG_WARN ( [ JIT not supported on Apple Silicon with ZTS] )
46- PHP_OPCACHE_JIT=no
47- fi
48- ] )
81+ AS_VAR_IF ( [ PHP_CAPSTONE] , [ yes] ,
82+ [ PKG_CHECK_MODULES([ CAPSTONE] , [ capstone >= 3.0.0] , [
83+ AC_DEFINE ( [ HAVE_CAPSTONE] , [ 1] , [ Define to 1 if Capstone is available.] )
84+ PHP_EVAL_LIBLINE([ $CAPSTONE_LIBS] , [ OPCACHE_SHARED_LIBADD] )
85+ PHP_EVAL_INCLINE([ $CAPSTONE_CFLAGS] )
86+ ZEND_JIT_SRC="$ZEND_JIT_SRC jit/ir/ir_disasm.c"
87+ ] )] )
4988
50- AS_VAR_IF ( [ PHP_OPCACHE_JIT] , [ yes] , [
51- AC_DEFINE ( [ HAVE_JIT] , [ 1] , [ Define to 1 to enable JIT.] )
52- ZEND_JIT_SRC=m4_normalize ( [ "
53- jit/ir/ir_cfg.c
54- jit/ir/ir_check.c
55- jit/ir/ir_dump.c
56- jit/ir/ir_emit.c
57- jit/ir/ir_gcm.c
58- jit/ir/ir_gdb.c
59- jit/ir/ir_patch.c
60- jit/ir/ir_perf.c
61- jit/ir/ir_ra.c
62- jit/ir/ir_save.c
63- jit/ir/ir_sccp.c
64- jit/ir/ir_strtab.c
65- jit/ir/ir.c
66- jit/zend_jit_vm_helpers.c
67- jit/zend_jit.c
68- "] )
69-
70- dnl Find out which ABI we are using.
71- AS_CASE ( [ $host_alias] ,
72- [ x86_64-*-darwin*] , [
73- IR_TARGET=IR_TARGET_X64
74- DASM_FLAGS="-D X64APPLE=1 -D X64=1"
75- DASM_ARCH="x86"
76- ] ,
77- [ *x86_64*|amd64-*-freebsd*] , [
78- IR_TARGET=IR_TARGET_X64
79- DASM_FLAGS="-D X64=1"
80- DASM_ARCH="x86"
81- ] ,
82- [ [ i[ 34567] 86*|x86*] ] , [
83- IR_TARGET=IR_TARGET_X86
84- DASM_ARCH="x86"
85- ] ,
86- [ aarch64*] , [
87- IR_TARGET=IR_TARGET_AARCH64
88- DASM_ARCH="aarch64"
89- ] )
90-
91- AS_VAR_IF ( [ PHP_CAPSTONE] , [ yes] ,
92- [ PKG_CHECK_MODULES([ CAPSTONE] , [ capstone >= 3.0.0] , [
93- AC_DEFINE ( [ HAVE_CAPSTONE] , [ 1] , [ Define to 1 if Capstone is available.] )
94- PHP_EVAL_LIBLINE([ $CAPSTONE_LIBS] , [ OPCACHE_SHARED_LIBADD] )
95- PHP_EVAL_INCLINE([ $CAPSTONE_CFLAGS] )
96- ZEND_JIT_SRC="$ZEND_JIT_SRC jit/ir/ir_disasm.c"
97- ] )] )
98-
99- PHP_SUBST([ IR_TARGET] )
100- PHP_SUBST([ DASM_FLAGS] )
101- PHP_SUBST([ DASM_ARCH] )
102-
103- JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
104- AS_VAR_IF ( [ ZEND_DEBUG] , [ yes] , [ JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"] )
105- ] )
89+ PHP_SUBST([ IR_TARGET] )
90+ PHP_SUBST([ DASM_FLAGS] )
91+ PHP_SUBST([ DASM_ARCH] )
10692
107- AC_CHECK_FUNCS ( [ mprotect shm_create_largepage] )
93+ JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
94+ AS_VAR_IF ( [ ZEND_DEBUG] , [ yes] , [ JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"] )
95+ ] )
10896
109- AC_CACHE_CHECK ( [ for sysvipc shared memory support] , [ php_cv_shm_ipc] ,
110- [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
97+ AC_CHECK_FUNCS ( [ mprotect shm_create_largepage] )
98+
99+ AC_CACHE_CHECK ( [ for sysvipc shared memory support] , [ php_cv_shm_ipc] ,
100+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
111101#include <sys/types.h>
112102#include <sys/wait.h>
113103#include <sys/ipc.h>
@@ -309,56 +299,55 @@ int main(void) {
309299 }
310300 return 0;
311301}] ] ) ] ,
312- [ php_cv_shm_mmap_posix=yes] ,
313- [ php_cv_shm_mmap_posix=no] ,
314- [ php_cv_shm_mmap_posix=no] )
315- ] )
302+ [ php_cv_shm_mmap_posix=yes] ,
303+ [ php_cv_shm_mmap_posix=no] ,
304+ [ php_cv_shm_mmap_posix=no] )
316305 ] )
317- LIBS=$LIBS_save
306+ ] )
307+ LIBS=$LIBS_save
308+
309+ AS_VAR_IF ( [ php_cv_shm_mmap_posix] , [ yes] , [
310+ AC_DEFINE ( [ HAVE_SHM_MMAP_POSIX] , [ 1] ,
311+ [ Define to 1 if you have the POSIX mmap() SHM support.] )
312+ AS_CASE ( [ $ac_cv_search_shm_open] , [ "none required"|no] , [ ] ,
313+ [ PHP_EVAL_LIBLINE([ $ac_cv_search_shm_open] , [ OPCACHE_SHARED_LIBADD] )] )
314+ ] )
315+
316+ PHP_NEW_EXTENSION([ opcache] , m4_normalize ( [
317+ shared_alloc_mmap.c
318+ shared_alloc_posix.c
319+ shared_alloc_shm.c
320+ zend_accelerator_blacklist.c
321+ zend_accelerator_debug.c
322+ zend_accelerator_hash.c
323+ zend_accelerator_module.c
324+ zend_accelerator_util_funcs.c
325+ zend_file_cache.c
326+ zend_persist_calc.c
327+ zend_persist.c
328+ zend_shared_alloc.c
329+ ZendAccelerator.c
330+ $ZEND_JIT_SRC
331+ ] ) ,
332+ [ $ext_shared] ,,
333+ [ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $JIT_CFLAGS] ,,
334+ [ yes] )
318335
319- AS_VAR_IF ( [ php_cv_shm_mmap_posix] , [ yes] , [
320- AC_DEFINE ( [ HAVE_SHM_MMAP_POSIX] , [ 1] ,
321- [ Define to 1 if you have the POSIX mmap() SHM support.] )
322- AS_CASE ( [ $ac_cv_search_shm_open] , [ "none required"|no] , [ ] ,
323- [ PHP_EVAL_LIBLINE([ $ac_cv_search_shm_open] , [ OPCACHE_SHARED_LIBADD] )] )
324- ] )
336+ PHP_ADD_EXTENSION_DEP(opcache, date)
337+ PHP_ADD_EXTENSION_DEP(opcache, pcre)
325338
326- PHP_NEW_EXTENSION([ opcache] , m4_normalize ( [
327- shared_alloc_mmap.c
328- shared_alloc_posix.c
329- shared_alloc_shm.c
330- zend_accelerator_blacklist.c
331- zend_accelerator_debug.c
332- zend_accelerator_hash.c
333- zend_accelerator_module.c
334- zend_accelerator_util_funcs.c
335- zend_file_cache.c
336- zend_persist_calc.c
337- zend_persist.c
338- zend_shared_alloc.c
339- ZendAccelerator.c
340- $ZEND_JIT_SRC
341- ] ) ,
342- [ $ext_shared] ,,
343- [ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $JIT_CFLAGS] ,,
344- [ yes] )
345-
346- PHP_ADD_EXTENSION_DEP(opcache, date)
347- PHP_ADD_EXTENSION_DEP(opcache, pcre)
348-
349- if test "$php_cv_shm_ipc" != "yes" && test "$php_cv_shm_mmap_posix" != "yes" && test "$php_cv_shm_mmap_anon" != "yes"; then
350- AC_MSG_FAILURE ( m4_text_wrap ( [
351- No supported shared memory caching support was found when configuring
352- opcache.
353- ] ) )
354- fi
339+ if test "$php_cv_shm_ipc" != "yes" && test "$php_cv_shm_mmap_posix" != "yes" && test "$php_cv_shm_mmap_anon" != "yes"; then
340+ AC_MSG_FAILURE ( m4_text_wrap ( [
341+ No supported shared memory caching support was found when configuring
342+ opcache.
343+ ] ) )
344+ fi
355345
356- AS_VAR_IF ( [ PHP_OPCACHE_JIT] , [ yes] , [
357- PHP_ADD_BUILD_DIR([
358- $ext_builddir/jit
359- $ext_builddir/jit/ir
360- ] )
361- PHP_ADD_MAKEFILE_FRAGMENT([ $ext_srcdir/jit/Makefile.frag] )
346+ AS_VAR_IF ( [ PHP_OPCACHE_JIT] , [ yes] , [
347+ PHP_ADD_BUILD_DIR([
348+ $ext_builddir/jit
349+ $ext_builddir/jit/ir
362350 ] )
363- PHP_SUBST([ OPCACHE_SHARED_LIBADD] )
364- fi
351+ PHP_ADD_MAKEFILE_FRAGMENT([ $ext_srcdir/jit/Makefile.frag] )
352+ ] )
353+ PHP_SUBST([ OPCACHE_SHARED_LIBADD] )
0 commit comments