xref: /php-src/ext/opcache/config.w32 (revision e44b7625)
1ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes");
2ARG_ENABLE("opcache-jit", "whether to enable JIT (not supported for ARM64)", "yes");
3
4
5if (PHP_OPCACHE != "no") {
6
7	ZEND_EXTENSION('opcache', "\
8		ZendAccelerator.c \
9		zend_accelerator_blacklist.c \
10		zend_accelerator_debug.c \
11		zend_accelerator_hash.c \
12		zend_accelerator_module.c \
13		zend_accelerator_util_funcs.c \
14		zend_persist.c \
15		zend_persist_calc.c \
16		zend_file_cache.c \
17		zend_shared_alloc.c \
18		shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
19
20	ADD_EXTENSION_DEP('opcache', 'date');
21	ADD_EXTENSION_DEP('opcache', 'hash');
22	ADD_EXTENSION_DEP('opcache', 'pcre');
23
24	if (PHP_OPCACHE_JIT == "yes") {
25		if (TARGET_ARCH == 'arm64') {
26			WARNING("JIT not enabled; not yet supported for ARM64");
27		} else if (CHECK_HEADER_ADD_INCLUDE("ir/ir.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
28			var dasm_flags = (X64 ? "-D X64=1" : "") + (X64 ? " -D X64WIN=1" : "") + " -D WIN=1";
29			var ir_target = (X64 ? "IR_TARGET_X64" : "IR_TARGET_X86");
30			var ir_src = "ir_strtab.c ir_cfg.c ir_sccp.c ir_gcm.c ir_ra.c ir_save.c \
31				 ir_dump.c ir_check.c ir_patch.c";
32
33			DEFINE("IR_TARGET", ir_target);
34			DEFINE("DASM_FLAGS", dasm_flags);
35			DEFINE("DASM_ARCH", "x86");
36
37			AC_DEFINE('HAVE_JIT', 1, 'Define to 1 to enable JIT.');
38
39			ADD_FLAG("CFLAGS_OPCACHE", "/I \"ext\\opcache\\jit\\ir\" /D "+ir_target+" /D IR_PHP");
40			if (PHP_DEBUG == "yes") {
41				ADD_FLAG("CFLAGS_OPCACHE", "/D IR_DEBUG");
42			}
43
44			if (CHECK_HEADER_ADD_INCLUDE("capstone\\capstone.h", "CFLAGS_OPCACHE", PHP_OPCACHE+ ";" + PHP_PHP_BUILD + "\\include") &&
45				CHECK_LIB("capstone.lib", "opcache", PHP_OPCACHE)) {
46				AC_DEFINE('HAVE_CAPSTONE', 1, 'Define to 1 if Capstone is available.');
47				ir_src += " ir_disasm.c";
48			}
49
50			ADD_MAKEFILE_FRAGMENT(configure_module_dirname + "\\jit\\Makefile.frag.w32");
51
52			ADD_SOURCES(configure_module_dirname + "\\jit",
53				"zend_jit.c zend_jit_vm_helpers.c",
54				"opcache", "ext\\opcache\\jit");
55			ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
56				"ir.c", "opcache", "ext\\opcache\\jit\\ir");
57			ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
58				"ir_emit.c", "opcache", "ext\\opcache\\jit\\ir");
59			ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
60				ir_src, "opcache", "ext\\opcache\\jit\\ir");
61		} else {
62			WARNING("JIT not enabled, headers not found");
63		}
64	}
65
66	ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname);
67
68}
69
70