xref: /PHP-7.4/win32/build/config.w32.phpize.in (revision 1ad08256)
1// vim:ft=javascript
2// "Master" config file; think of it as a configure.ac
3// equivalent.
4
5ARG_WITH("verbosity", "Output verbosity, 0-2.", "1");
6setup_verbosity();
7
8ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +
9		"The only recommended and supported toolset for production use " +
10		"is Visual Studio. Use others at your own risk.", "vs");
11toolset_option_handle()
12
13var PHP_CYGWIN="notset";
14
15toolset_setup_compiler();
16
17// do we use x64 or 80x86 version of compiler?
18X64 = toolset_is_64();
19toolset_setup_arch();
20
21toolset_setup_linker();
22toolset_setup_project_tools();
23
24// stick objects somewhere outside of the source tree
25ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
26object_out_dir_option_handle();
27
28ARG_ENABLE('debug', 'Compile with debugging symbols', PHP_DEBUG);
29ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
30if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
31	ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
32}
33
34if (PHP_PREFIX == '') {
35	PHP_PREFIX = "C:\\php";
36	if (PHP_DEBUG == "yes")
37		PHP_PREFIX += "\\debug";
38}
39DEFINE('PHP_PREFIX', PHP_PREFIX);
40
41DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
42
43toolset_setup_common_cflags();
44
45ARG_WITH('prefix', 'PHP installation prefix', PHP_PREFIX);
46ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
47var PHP_MP_DISABLED = true;
48if (VS_TOOLSET && PHP_MP != 'disable') {
49		// no from disable-all
50		if(PHP_MP == 'auto' || PHP_MP == 'no') {
51			 ADD_FLAG('CFLAGS', ' /MP ');
52			PHP_MP_DISABLED = false;
53		} else {
54			if(parseInt(PHP_MP) != 0) {
55				ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
56				PHP_MP_DISABLED = false;
57			} else {
58				STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
59			}
60		}
61}
62
63/* For snapshot builders, where can we find the additional
64 * files that make up the snapshot template? */
65ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
66
67// General link flags
68toolset_setup_common_ldlags();
69
70// General libs
71toolset_setup_common_libs();
72
73// Set some debug/release specific options
74toolset_setup_build_mode();
75
76setup_zts_stuff();
77
78if (MODE_PHPIZE) {
79	DEFINE("PHPDLL", PHP_DLL);
80	DEFINE("PHPLIB", PHP_DLL_LIB);
81}
82
83// Find the php_build dir - it contains headers and libraries
84// that we need
85ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');
86php_build_option_handle();
87
88ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
89ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
90
91var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
92var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
93
94ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
95ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
96ADD_FLAG("ARFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
97
98probe_basic_headers();
99add_extra_dirs();
100
101//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
102
103STDOUT.WriteBlankLines(1);
104STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
105STDOUT.WriteLine("PHP Core:  " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
106
107/* XXX inspect this for other toolsets */
108//AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
109
110AC_DEFINE('HAVE_STRNLEN', 1);
111
112STDOUT.WriteBlankLines(1);
113
114if (PHP_SNAPSHOT_TEMPLATE == "no") {
115	/* default is as a sibling of the php_build dir */
116	if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
117		PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
118	} else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
119		PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
120	}
121}
122
123DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
124
125AC_DEFINE("PHP_DIR", PHP_DIR);
126DEFINE("PHP_DIR", PHP_DIR);
127
128ARG_WITH("codegen-arch", "Architecture for code generation", "no");
129toolset_setup_codegen_arch();
130
131ARG_ENABLE("native-intrinsics", "Comma separated list of intrinsic optimizations to enable. \
132	Available optimization names are sse, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2. \
133	SSE and SSE2 are enabled by default. The best optimization specified will \
134	automatically enable all the older optimizations. Note, that the produced binary \
135	might not work properly, if the optimizations are not available on the target \
136	processor.", "no");
137toolset_setup_intrinsic_cflags();
138