Skip to content

Commit 3ffefcc

Browse files
committed
Always enable opcache
1 parent 2417094 commit 3ffefcc

File tree

1 file changed

+122
-130
lines changed

1 file changed

+122
-130
lines changed

ext/opcache/config.m4

Lines changed: 122 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
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-
71
PHP_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,86 +19,85 @@ PHP_ARG_WITH([capstone],
2519
[no],
2620
[no])
2721

28-
if test "$PHP_OPCACHE" != "no"; then
29-
AS_VAR_IF([PHP_HUGE_CODE_PAGES], [yes],
30-
[AC_DEFINE([HAVE_HUGE_CODE_PAGES], [1],
31-
[Define to 1 to enable copying PHP CODE pages into HUGE PAGES.])])
32-
33-
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
34-
AS_CASE([$host_cpu],
35-
[[i[34567]86*|x86*|aarch64|amd64]], [],
36-
[
37-
AC_MSG_WARN([JIT not supported by host architecture])
38-
PHP_OPCACHE_JIT=no
39-
])
40-
41-
if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then
42-
AC_MSG_WARN([JIT not supported on Apple Silicon with ZTS])
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.])])
25+
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])
4331
PHP_OPCACHE_JIT=no
44-
fi
45-
])
32+
])
4633
47-
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
48-
AC_DEFINE([HAVE_JIT], [1], [Define to 1 to enable JIT.])
49-
ZEND_JIT_SRC=m4_normalize(["
50-
jit/ir/ir_cfg.c
51-
jit/ir/ir_check.c
52-
jit/ir/ir_dump.c
53-
jit/ir/ir_emit.c
54-
jit/ir/ir_gcm.c
55-
jit/ir/ir_gdb.c
56-
jit/ir/ir_patch.c
57-
jit/ir/ir_perf.c
58-
jit/ir/ir_ra.c
59-
jit/ir/ir_save.c
60-
jit/ir/ir_sccp.c
61-
jit/ir/ir_strtab.c
62-
jit/ir/ir.c
63-
jit/zend_jit_vm_helpers.c
64-
jit/zend_jit.c
65-
"])
66-
67-
dnl Find out which ABI we are using.
68-
AS_CASE([$host_alias],
69-
[x86_64-*-darwin*], [
70-
IR_TARGET=IR_TARGET_X64
71-
DASM_FLAGS="-D X64APPLE=1 -D X64=1"
72-
DASM_ARCH="x86"
73-
],
74-
[*x86_64*|amd64-*-freebsd*], [
75-
IR_TARGET=IR_TARGET_X64
76-
DASM_FLAGS="-D X64=1"
77-
DASM_ARCH="x86"
78-
],
79-
[[i[34567]86*|x86*]], [
80-
IR_TARGET=IR_TARGET_X86
81-
DASM_ARCH="x86"
82-
],
83-
[aarch64*], [
84-
IR_TARGET=IR_TARGET_AARCH64
85-
DASM_ARCH="aarch64"
86-
])
87-
88-
AS_VAR_IF([PHP_CAPSTONE], [yes],
89-
[PKG_CHECK_MODULES([CAPSTONE], [capstone >= 3.0.0], [
90-
AC_DEFINE([HAVE_CAPSTONE], [1], [Define to 1 if Capstone is available.])
91-
PHP_EVAL_LIBLINE([$CAPSTONE_LIBS], [OPCACHE_SHARED_LIBADD])
92-
PHP_EVAL_INCLINE([$CAPSTONE_CFLAGS])
93-
ZEND_JIT_SRC="$ZEND_JIT_SRC jit/ir/ir_disasm.c"
94-
])])
95-
96-
PHP_SUBST([IR_TARGET])
97-
PHP_SUBST([DASM_FLAGS])
98-
PHP_SUBST([DASM_ARCH])
99-
100-
JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
101-
AS_VAR_IF([ZEND_DEBUG], [yes], [JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"])
102-
])
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+
])
80+
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+
])])
88+
89+
PHP_SUBST([IR_TARGET])
90+
PHP_SUBST([DASM_FLAGS])
91+
PHP_SUBST([DASM_ARCH])
10392
104-
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+
])
10596

106-
AC_CACHE_CHECK([for sysvipc shared memory support], [php_cv_shm_ipc],
107-
[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([
108101
#include <sys/types.h>
109102
#include <sys/wait.h>
110103
#include <sys/ipc.h>
@@ -306,56 +299,55 @@ int main(void) {
306299
}
307300
return 0;
308301
}]])],
309-
[php_cv_shm_mmap_posix=yes],
310-
[php_cv_shm_mmap_posix=no],
311-
[php_cv_shm_mmap_posix=no])
312-
])
302+
[php_cv_shm_mmap_posix=yes],
303+
[php_cv_shm_mmap_posix=no],
304+
[php_cv_shm_mmap_posix=no])
313305
])
314-
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])
315335

316-
AS_VAR_IF([php_cv_shm_mmap_posix], [yes], [
317-
AC_DEFINE([HAVE_SHM_MMAP_POSIX], [1],
318-
[Define to 1 if you have the POSIX mmap() SHM support.])
319-
AS_CASE([$ac_cv_search_shm_open], ["none required"|no], [],
320-
[PHP_EVAL_LIBLINE([$ac_cv_search_shm_open], [OPCACHE_SHARED_LIBADD])])
321-
])
336+
PHP_ADD_EXTENSION_DEP(opcache, date)
337+
PHP_ADD_EXTENSION_DEP(opcache, pcre)
322338

323-
PHP_NEW_EXTENSION([opcache], m4_normalize([
324-
shared_alloc_mmap.c
325-
shared_alloc_posix.c
326-
shared_alloc_shm.c
327-
zend_accelerator_blacklist.c
328-
zend_accelerator_debug.c
329-
zend_accelerator_hash.c
330-
zend_accelerator_module.c
331-
zend_accelerator_util_funcs.c
332-
zend_file_cache.c
333-
zend_persist_calc.c
334-
zend_persist.c
335-
zend_shared_alloc.c
336-
ZendAccelerator.c
337-
$ZEND_JIT_SRC
338-
]),
339-
[$ext_shared],,
340-
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $JIT_CFLAGS],,
341-
[yes])
342-
343-
PHP_ADD_EXTENSION_DEP(opcache, date)
344-
PHP_ADD_EXTENSION_DEP(opcache, pcre)
345-
346-
if test "$php_cv_shm_ipc" != "yes" && test "$php_cv_shm_mmap_posix" != "yes" && test "$php_cv_shm_mmap_anon" != "yes"; then
347-
AC_MSG_FAILURE(m4_text_wrap([
348-
No supported shared memory caching support was found when configuring
349-
opcache.
350-
]))
351-
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
352345

353-
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
354-
PHP_ADD_BUILD_DIR([
355-
$ext_builddir/jit
356-
$ext_builddir/jit/ir
357-
])
358-
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
359350
])
360-
PHP_SUBST([OPCACHE_SHARED_LIBADD])
361-
fi
351+
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
352+
])
353+
PHP_SUBST([OPCACHE_SHARED_LIBADD])

0 commit comments

Comments
 (0)