xref: /PHP-7.4/win32/build/config.w32 (revision 744f9016)
105b9b20eSWez Furlong// vim:ft=javascript
22fe9208eSBrian Evans// "Master" config file; think of it as a configure.ac
305b9b20eSWez Furlong// equivalent.
405b9b20eSWez Furlong
5978cef04SAnatol BelskiARG_WITH("verbosity", "Output verbosity, 0-2.", "1");
6978cef04SAnatol Belskisetup_verbosity();
7978cef04SAnatol Belski
8744fb452SAnatol BelskiARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +
9744fb452SAnatol Belski		"The only recommended and supported toolset for production use " +
10744fb452SAnatol Belski		"is Visual Studio. Use others at your own risk.", "vs");
114d8c28afSAnatol Belskitoolset_option_handle();
12e22ec182SSteph Fox
13a3075773SWez FurlongARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
1448073dd7SPierre Joye
154d8c28afSAnatol Belskitoolset_setup_compiler();
16bd4c0cedSScott MacVicar
1708daab9dSDmitry Stogov// do we use x64 or 80x86 version of compiler?
18876c7c45SAnatol BelskiX64 = toolset_is_64();
1979c61c71SAnatol Belskitoolset_setup_arch();
20766b6b60SSteph Fox
214d8c28afSAnatol Belskitoolset_setup_linker();
224d8c28afSAnatol Belskitoolset_setup_project_tools();
237e77d79bSEdin Kadribasic
24664faf84SWez Furlong// stick objects somewhere outside of the source tree
25664faf84SWez FurlongARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
26d509e79dSAnatol Belskiobject_out_dir_option_handle();
272a8107ceSWez Furlong
2805b9b20eSWez FurlongARG_ENABLE('debug', 'Compile with debugging symbols', "no");
29dec1c86aSEdin KadribasicARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
30dec1c86aSEdin Kadribasicif (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
31dec1c86aSEdin Kadribasic	ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
32dec1c86aSEdin Kadribasic}
33612e73b0SPierre Joye
34be2111e0SKalle Sommer Nielsenif (PHP_DEBUG == "yes") {
35be2111e0SKalle Sommer Nielsen	ADD_FLAG("CFLAGS"," /Wall ");
36be2111e0SKalle Sommer Nielsen	ADD_FLAG("LDFLAGS", " /verbose ");
37be2111e0SKalle Sommer Nielsen}
38be2111e0SKalle Sommer Nielsen
39612e73b0SPierre JoyeARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no');
40612e73b0SPierre JoyeARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no');
41612e73b0SPierre Joyeif (PHP_PGI == "yes" || PHP_PGO != "no") {
42612e73b0SPierre Joye	PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH"));
43612e73b0SPierre Joye	if (!PGOMGR) {
44612e73b0SPierre Joye		ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present.");
45612e73b0SPierre Joye	}
46612e73b0SPierre Joye	if (PHP_PGI == "yes" && PHP_PGO != "no") {
47612e73b0SPierre Joye		ERROR("Use of both --enable-pgi and --with-pgo not allowed.");
48612e73b0SPierre Joye	}
49612e73b0SPierre Joye}
50612e73b0SPierre Joye
5105b9b20eSWez FurlongARG_ENABLE('zts', 'Thread safety', 'yes');
5205b9b20eSWez Furlong// Configures the hard-coded installation dir
53ff60a987SPierre JoyeARG_WITH('prefix', 'where PHP will be installed', '');
54b8978cadSWez Furlongif (PHP_PREFIX == '') {
55d687186bSPierre Joye	PHP_PREFIX = "C:\\php";
56b8978cadSWez Furlong	if (PHP_DEBUG == "yes")
57b8978cadSWez Furlong		PHP_PREFIX += "\\debug";
58835f6beaSFrank M. Kromann}
59835f6beaSFrank M. KromannDEFINE('PHP_PREFIX', PHP_PREFIX);
6005b9b20eSWez Furlong
61aa3eee1dSJani TaskinenDEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
6205b9b20eSWez Furlong
63b155ba21SAnatol Belskitoolset_setup_common_cflags();
64812c1e04SWez Furlong
65a8b6d50dSKalle Sommer Nielsenif (VS_TOOLSET) {
66a8b6d50dSKalle Sommer Nielsen	ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
67a8b6d50dSKalle Sommer Nielsen	var PHP_MP_DISABLED = true;
68a8b6d50dSKalle Sommer Nielsen
69a8b6d50dSKalle Sommer Nielsen	if (PHP_MP != 'disable') {
70a8b6d50dSKalle Sommer Nielsen		if(PHP_DEBUG == 'yes') {
71a8b6d50dSKalle Sommer Nielsen			STDOUT.WriteLine('WARNING: Debug builds cannot be built using multi processing');
72375bbd49SPierre Joye		} else {
733362620bSPeter Kokot			// no from disable-all
74a8b6d50dSKalle Sommer Nielsen			if(PHP_MP == 'auto' || PHP_MP == 'no') {
75a8b6d50dSKalle Sommer Nielsen				ADD_FLAG('CFLAGS', ' /MP ');
76892efcfcSAnatol Belski				PHP_MP_DISABLED = false;
77f4c90952SPierre Joye			} else {
78a8b6d50dSKalle Sommer Nielsen				if(parseInt(PHP_MP) != 0) {
79a8b6d50dSKalle Sommer Nielsen					ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
80a8b6d50dSKalle Sommer Nielsen					PHP_MP_DISABLED = false;
81a8b6d50dSKalle Sommer Nielsen				} else {
82a8b6d50dSKalle Sommer Nielsen					STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
83a8b6d50dSKalle Sommer Nielsen				}
84f4c90952SPierre Joye			}
85375bbd49SPierre Joye		}
86a402d0bdSKalle Sommer Nielsen	}
87c83e0d50SPierre Joye
88a8b6d50dSKalle Sommer Nielsen	if (!PHP_MP_DISABLED) {
89a8b6d50dSKalle Sommer Nielsen		STDOUT.WriteLine('Enabling multi process build');
90a8b6d50dSKalle Sommer Nielsen	}
91c0b56232SKalle Sommer Nielsen}
92c0b56232SKalle Sommer Nielsen
9305b9b20eSWez Furlong// General link flags
94b155ba21SAnatol Belskitoolset_setup_common_ldlags();
9505b9b20eSWez Furlong
9605b9b20eSWez Furlong// General libs
9764c081f3SAnatol Belskitoolset_setup_common_libs();
9805b9b20eSWez Furlong
9905b9b20eSWez Furlong// Set some debug/release specific options
10064c081f3SAnatol Belskitoolset_setup_build_mode();
101bd4c0cedSScott MacVicar
102c0db5cd9SAnatol Belskisetup_zts_stuff();
10305b9b20eSWez Furlong
104612e73b0SPierre Joye// CFLAGS, LDFLAGS and BUILD_DIR are defined
105612e73b0SPierre Joye// Add compiler and link flags if PGO options are selected
106612e73b0SPierre Joyeif (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
1076612e1baSAnatol Belski	ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
108612e73b0SPierre Joye	DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
109612e73b0SPierre Joye}
110612e73b0SPierre Joyeelse if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
1116612e1baSAnatol Belski	ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
112612e73b0SPierre Joye	DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
113612e73b0SPierre Joye}
114612e73b0SPierre Joye
11505b9b20eSWez Furlong// Find the php_build dir - it contains headers and libraries
11605b9b20eSWez Furlong// that we need
117b593dfa3SPierre JoyeARG_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');
1189757d9adSAnatol Belskiphp_build_option_handle();
1196201a560SWez Furlong
120883815a9SWez FurlongARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
121883815a9SWez FurlongARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
122883815a9SWez Furlong
123b593dfa3SPierre Joyevar php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
124b593dfa3SPierre Joyevar php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
125b593dfa3SPierre Joye
126b593dfa3SPierre JoyeADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
127f093c7dbSMoriyoshi KoizumiADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
128ad1967deSAnatol BelskiADD_FLAG("ARFLAGS", '/nologo /libpath:"' + php_usual_lib_suspects + '" ');
129883815a9SWez Furlong
13034df2ae2SWez Furlongprobe_basic_headers();
131883815a9SWez Furlongadd_extra_dirs();
13234df2ae2SWez Furlong
13334df2ae2SWez Furlong//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
13405b9b20eSWez Furlong
135b8f75e75SAnatol BelskiARG_WITH("analyzer", "Enable static analyzer. Pass vs for Visual Studio, clang for clang, cppcheck for Cppcheck, pvs for PVS-Studio", "no");
136b8f75e75SAnatol Belskiif (PHP_ANALYZER == "vs") {
137b8f75e75SAnatol Belski	ADD_FLAG("CFLAGS", " /analyze ");
138b8f75e75SAnatol Belski	ADD_FLAG("CFLAGS", " /wd6308 ");
139b8f75e75SAnatol Belski} else if (PHP_ANALYZER == "clang") {
140b8f75e75SAnatol Belski	var clang_cl = false;
141b8f75e75SAnatol Belski
142b8f75e75SAnatol Belski	if (FSO.FileExists(PROGRAM_FILES + "\\LLVM\\bin\\clang-cl.exe")) {
143b8f75e75SAnatol Belski		clang_cl = PROGRAM_FILES + "\\LLVM\\bin\\clang-cl.exe";
144b8f75e75SAnatol Belski	} else if (FSO.FileExists(PROGRAM_FILESx86 + "\\LLVM\\bin\\clang-cl.exe")) {
145b8f75e75SAnatol Belski		clang_cl = PROGRAM_FILESx86 + "\\LLVM\\bin\\clang-cl.exe";
146b8f75e75SAnatol Belski	}
147b8f75e75SAnatol Belski
148b8f75e75SAnatol Belski	if (!clang_cl) {
149b8f75e75SAnatol Belski		if (false == PATH_PROG('clang-cl', null, 'CLANG_CL')) {
150b8f75e75SAnatol Belski			WARNING("Couldn't find clang binaries, static analyze was disabled");
151b8f75e75SAnatol Belski			PHP_ANALYZER = "no";
152b8f75e75SAnatol Belski		}
153b8f75e75SAnatol Belski	} else {
154b8f75e75SAnatol Belski		DEFINE("CLANG_CL", clang_cl);
155b8f75e75SAnatol Belski	}
156b8f75e75SAnatol Belski} else if (PHP_ANALYZER == "cppcheck") {
157b8f75e75SAnatol Belski
158b8f75e75SAnatol Belski	var cppcheck = false;
159b8f75e75SAnatol Belski
160b8f75e75SAnatol Belski	if (FSO.FileExists(PROGRAM_FILES + "\\Cppcheck\\cppcheck.exe")) {
161b8f75e75SAnatol Belski		cppcheck = PROGRAM_FILES + "\\Cppcheck\\cppcheck.exe";
162b8f75e75SAnatol Belski	} else if (FSO.FileExists(PROGRAM_FILESx86 + "\\Cppcheck\\cppcheck.exe")) {
163b8f75e75SAnatol Belski		cppcheck = PROGRAM_FILESx86 + "\\Cppcheck\\cppcheck.exe";
164b8f75e75SAnatol Belski	}
165b8f75e75SAnatol Belski	if (!cppcheck) {
166b8f75e75SAnatol Belski		if (false == PATH_PROG('cppcheck', null, 'CPPCHECK')) {
167b8f75e75SAnatol Belski			WARNING("Couldn't find Cppcheck binaries, static analyze was disabled");
168b8f75e75SAnatol Belski			PHP_ANALYZER = "no";
169b8f75e75SAnatol Belski		} else {
170b8f75e75SAnatol Belski			cppcheck = get_define("CPPCHECK");
171b8f75e75SAnatol Belski		}
172b8f75e75SAnatol Belski	} else {
173b8f75e75SAnatol Belski		DEFINE("CPPCHECK", cppcheck);
174b8f75e75SAnatol Belski	}
175b8f75e75SAnatol Belski
176b8f75e75SAnatol Belski	if (cppcheck) {
177b8f75e75SAnatol Belski		var _tmp = execute(cppcheck + " --version").split(/ /)[1];
178b8f75e75SAnatol Belski		var cppcheck_ver = [
179b8f75e75SAnatol Belski			parseInt(_tmp.split(".")[0]),
180b8f75e75SAnatol Belski			parseInt(_tmp.split(".")[1]),
181b8f75e75SAnatol Belski		];
182b8f75e75SAnatol Belski		if (cppcheck_ver[0] > 1 || cppcheck_ver[0] == 1 && cppcheck_ver[1] >= 77) {
183b8f75e75SAnatol Belski			var build_dir = get_define("BUILD_DIR");
184b8f75e75SAnatol Belski			var cppcheck_build_dir = build_dir + "\\cppcheck_build";
185b8f75e75SAnatol Belski			if (!FSO.FolderExists(cppcheck_build_dir)) {
186b8f75e75SAnatol Belski				FSO.CreateFolder(cppcheck_build_dir);
187b8f75e75SAnatol Belski			}
188b8f75e75SAnatol Belski			DEFINE("CPPCHECK_BUILD_DIR", cppcheck_build_dir);
189b8f75e75SAnatol Belski		}
190b8f75e75SAnatol Belski	}
191b8f75e75SAnatol Belski
192b8f75e75SAnatol Belski} else if (PHP_ANALYZER == "pvs") {
193b8f75e75SAnatol Belski	var pvs_studio = false;
194b8f75e75SAnatol Belski
195b8f75e75SAnatol Belski	if (FSO.FileExists(PROGRAM_FILES + "\\PVS-Studio\\x64\\PVS-Studio.exe")) {
196b8f75e75SAnatol Belski		pvs_studio = PROGRAM_FILES + "\\PVS-Studio\\x86\\PVS-Studio.exe";
197b8f75e75SAnatol Belski	} else if (FSO.FileExists(PROGRAM_FILESx86 + "\\PVS-Studio\\x64\\PVS-Studio.exe")) {
198b8f75e75SAnatol Belski		pvs_studio = PROGRAM_FILESx86 + "\\PVS-Studio\\x64\\PVS-Studio.exe";
199b8f75e75SAnatol Belski	}
200b8f75e75SAnatol Belski
201b8f75e75SAnatol Belski	if (!pvs_studio) {
202b8f75e75SAnatol Belski		WARNING("Couldn't find PVS-Studio binaries, static analyze was disabled");
203b8f75e75SAnatol Belski		PHP_ANALYZER = "no";
204b8f75e75SAnatol Belski	} else {
205b8f75e75SAnatol Belski		var pvscfg = FSO.CreateTextFile("PVS-Studio.conf", true);
206b8f75e75SAnatol Belski		DEFINE("PVS_STUDIO", pvs_studio);
207b8f75e75SAnatol Belski
208b8f75e75SAnatol Belski		pvscfg.WriteLine("exclude-path = " + VCINSTALLDIR);
209b8f75e75SAnatol Belski		if (FSO.FolderExists(PROGRAM_FILESx86 + "\\windows kits\\")) {
210b8f75e75SAnatol Belski			pvscfg.WriteLine("exclude-path = " + PROGRAM_FILESx86 + "\\windows kits\\");
211b8f75e75SAnatol Belski		} else if (FSO.FolderExists(PROGRAM_FILES + "\\windows kits\\")) {
212b8f75e75SAnatol Belski			pvscfg.WriteLine("exclude-path = " + PROGRAM_FILES + "\\windows kits\\");
213b8f75e75SAnatol Belski		}
214b8f75e75SAnatol Belski		pvscfg.WriteLine("vcinstalldir = " + VCINSTALLDIR);
215b8f75e75SAnatol Belski		pvscfg.WriteLine("platform = " + (X64 ? 'x64' : 'Win32'));
216b8f75e75SAnatol Belski		pvscfg.WriteLine("preprocessor = visualcpp");
217b8f75e75SAnatol Belski		pvscfg.WriteLine("language = C");
218*744f9016SChristoph M. Becker		pvscfg.WriteLine("skip-cl-exe = no");
219b8f75e75SAnatol Belski	}
220b8f75e75SAnatol Belski} else {
221b8f75e75SAnatol Belski	PHP_ANALYZER = "no"
222b8f75e75SAnatol Belski}
223b8f75e75SAnatol Belski
22405b9b20eSWez FurlongSTDOUT.WriteBlankLines(1);
22505b9b20eSWez FurlongSTDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
22605b9b20eSWez FurlongSTDOUT.WriteLine("PHP Core:  " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
22705b9b20eSWez Furlong
22805b9b20eSWez FurlongADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
22905b9b20eSWez Furlong	zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
230982f02afSNikita Popov	zend_constants.c zend_exceptions.c \
2315979799dSEdin Kadribasic	zend_execute_API.c zend_highlight.c \
23297bf2543SBob Weinand	zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
23305b9b20eSWez Furlong	zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
2348153286eSKalle Sommer Nielsen	zend_hash.c zend_list.c zend_builtin_functions.c \
2352193de0dSXinchen Hui	zend_ini.c zend_sort.c zend_multibyte.c zend_ts_hash.c \
23605b9b20eSWez Furlong	zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
23705b9b20eSWez Furlong	zend_object_handlers.c zend_objects_API.c \
23831c0af24SDmitry Stogov	zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c zend_weakrefs.c \
2392700e248SAnatol Belski	zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
2403a3e0493SXinchen Hui	zend_inheritance.c zend_smart_str.c zend_cpuinfo.c");
24105b9b20eSWez Furlong
24276081df1SAnatol BelskiADD_FLAG("CFLAGS_BD_ZEND", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
24376081df1SAnatol Belskiif (VS_TOOLSET && VCVERS >= 1914) {
2444d8c28afSAnatol Belski	ADD_FLAG("CFLAGS_BD_ZEND", "/d2FuncCache1");
245a7b4f325SKalle Sommer Nielsen}
246b907aa43SMatt Wilmas
247dd8e59daSKalle Sommer Nielsen/* XXX inspect this for other toolsets */
24805b9b20eSWez Furlong//AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
24905b9b20eSWez Furlong
250a1f3a010SPhilip PrindevilleADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
251a1f3a010SPhilip Prindeville	php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
2528aeffdd7SAnatol Belski	strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
25305b9b20eSWez Furlong	php_open_temporary_file.c output.c internal_functions.c \
254a7b4f325SKalle Sommer Nielsen	php_syslog.c");
25516bda080SPierre JoyeADD_FLAG("CFLAGS_BD_MAIN", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
25605b9b20eSWez Furlongif (VS_TOOLSET && VCVERS >= 1914) {
257186e34c8SStanislav Malyshev	ADD_FLAG("CFLAGS_BD_MAIN", "/d2FuncCache1");
2588aeffdd7SAnatol Belski}
25905b9b20eSWez Furlong
26006332e67SAnatol BelskiAC_DEFINE('HAVE_STRNLEN', 1);
2612dc0ce2fSAnatol Belski
26263869d94SKalle Sommer NielsenADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
26333301d5bSMichele Locati	userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c");
26405b9b20eSWez FurlongADD_FLAG("CFLAGS_BD_MAIN_STREAMS", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
2658aeffdd7SAnatol Belskiif (VS_TOOLSET && VCVERS >= 1914) {
2668aeffdd7SAnatol Belski	ADD_FLAG("CFLAGS_BD_MAIN_STREAMS", "/d2FuncCache1");
2674df03c1dSPierre Joye}
268ff60a987SPierre Joye
26905b9b20eSWez FurlongADD_SOURCES("win32", "dllmain.c glob.c readdir.c \
27005b9b20eSWez Furlong	registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c \
271f9c61024SPierre Joye	getrusage.c ftok.c ioutil.c codepage.c nice.c \
272dbb152b9SWez Furlong	inet.c fnmatch.c sockets.c console.c signal.c");
273dbb152b9SWez Furlong
274dbb152b9SWez FurlongADD_FLAG("CFLAGS_BD_WIN32", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
275dbb152b9SWez Furlongif (VS_TOOLSET && VCVERS >= 1914) {
276dbb152b9SWez Furlong	ADD_FLAG("CFLAGS_BD_WIN32", "/d2FuncCache1");
2776b679cd6SWez Furlong}
278dbb152b9SWez Furlong
279dbb152b9SWez FurlongPHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
280dbb152b9SWez Furlong
281dbb152b9SWez FurlongSTDOUT.WriteBlankLines(1);
282dbb152b9SWez Furlong
283dbb152b9SWez Furlong
284dbb152b9SWez Furlong/* Can we build with IPv6 support? */
285dbb152b9SWez FurlongARG_ENABLE("ipv6", "Disable IPv6 support (default is turn it on if available)", "yes");
28699e290f8SWez Furlong
28799e290f8SWez Furlongvar main_network_has_ipv6 = 0;
28899e290f8SWez Furlongif (PHP_IPV6 == "yes") {
289ff4e970fSWez Furlong	main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0;
29099e290f8SWez Furlong}
2918085f485SWez Furlongif (main_network_has_ipv6) {
29299e290f8SWez Furlong	STDOUT.WriteLine("Enabling IPv6 support");
2938085f485SWez Furlong}
2943be2b8d7SWez FurlongAC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6);
2953be2b8d7SWez FurlongAC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6);
2963be2b8d7SWez FurlongAC_DEFINE('HAVE_IPV6', main_network_has_ipv6);
2973be2b8d7SWez Furlong
2983be2b8d7SWez Furlong/* this allows up to 256 sockets to be select()ed in a single
2993be2b8d7SWez Furlong * call to select(), instead of the usual 64 */
30008daab9dSDmitry StogovARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
30108daab9dSDmitry StogovADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
30208daab9dSDmitry Stogov
3033be2b8d7SWez Furlong/* For snapshot builders, where can we find the additional
3043be2b8d7SWez Furlong * files that make up the snapshot template? */
3053be2b8d7SWez FurlongARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
3063be2b8d7SWez Furlong
3073be2b8d7SWez Furlongif (PHP_SNAPSHOT_TEMPLATE == "no") {
308e22ec182SSteph Fox	/* default is as a sibling of the php_build dir */
309f9c61024SPierre Joye	if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
310f3a4bfeeSPierre Joye		PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
311f3a4bfeeSPierre Joye	} else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
312f3a4bfeeSPierre Joye		PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
313eda798fdSPierre Joye	}
3149b19f516SAnatol Belski}
3159b19f516SAnatol Belski
3169b19f516SAnatol BelskiDEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
317d53978bdSAnatol Belski
318d53978bdSAnatol BelskiARG_ENABLE("security-flags", "Disable the compiler security flags", "yes");
319d53978bdSAnatol Belskiif (PHP_SECURITY_FLAGS == "yes") {
3209b19f516SAnatol Belski	ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
321731cb8a8SAnatol Belski}
322731cb8a8SAnatol Belski
323731cb8a8SAnatol Belskiif (CLANG_TOOLSET) {
324731cb8a8SAnatol Belski	ARG_WITH("uncritical-warn-choke", "Disable some uncritical warnings", "yes");
325731cb8a8SAnatol Belski	if (PHP_UNCRITICAL_WARN_CHOKE != "no") {
326731cb8a8SAnatol Belski		ADD_FLAG("CFLAGS", "-Wno-ignored-attributes -Wno-deprecated-declarations -Wno-missing-braces " +
327731cb8a8SAnatol Belski		"-Wno-logical-op-parentheses -Wno-msvc-include -Wno-invalid-source-encoding -Wno-unknown-pragmas " +
328731cb8a8SAnatol Belski		"-Wno-unused-command-line-argument -Wno-unused-function -Wno-ignored-pragma-optimize");
3299b19f516SAnatol Belski	}
3309b19f516SAnatol Belski
331d9994ff7SAnatol Belski	ARG_ENABLE("sanitizer", "Enable ASan and UBSan extensions", "no");
33200ac1ae5SAnatol Belski	if (PHP_SANITIZER == "yes") {
33300ac1ae5SAnatol Belski		if (COMPILER_NUMERIC_VERSION < 500) {
334f195870aSAnatol Belski			ERROR("Clang at least 5.0.0 required for sanitation plugins");
335f195870aSAnatol Belski		}
3360ffd0a02SKalle Sommer Nielsen		add_asan_opts("CFLAGS", "LIBS", "LDFLAGS");
3370ffd0a02SKalle Sommer Nielsen	}
3380ffd0a02SKalle Sommer Nielsen}
33960d847a0SKalle Sommer Nielsen
34033301d5bSMichele LocatiARG_WITH("codegen-arch", "Architecture for code generation: ia32. Use --enable-native-intrinsics to enable SIMD optimizations.", "no");
3419112e298SAnatol Belskitoolset_setup_codegen_arch();
3425b04a218SAnatol Belski
3435b04a218SAnatol BelskiARG_WITH("all-shared", "Force all the non obligatory extensions to be shared", "no");
3445b04a218SAnatol Belski
3455b04a218SAnatol Belski// Config profiles (--with-config-profile=<name>) will save a certain config to php-src/config.<name>.bat
3465b04a218SAnatol Belski// so that it can be executed like: cofig.<name> instead of a long list of parameters
3475b04a218SAnatol Belski//
348acbd3489SAnatol Belski// Note, nice as a name is disallowed and will generate a warning and skip saving
3491648bfa3SAnatol BelskiARG_WITH('config-profile', 'Name of the configuration profile to save this to in php-src/config.name.bat', 'no');
3501648bfa3SAnatol Belski
3511648bfa3SAnatol BelskiARG_ENABLE("test-ini", "Enable automatic php.ini generation. The test.ini will be put \
3521648bfa3SAnatol Belski		into the build dir and used to automatically load the shared extensions.", "yes");
353d9994ff7SAnatol Belski
354acbd3489SAnatol BelskiARG_WITH("test-ini-ext-exclude", "Comma separated list of shared extensions to \
355		be excluded from the test.ini", "no");
356
357ARG_ENABLE("native-intrinsics", "Comma separated list of intrinsic optimizations to enable. \
358	Available instruction set names are sse, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2. \
359	SSE and SSE2 are enabled by default. The best instruction set specified will \
360	automatically enable all the older instruction sets. Note, that the produced binary \
361	might not work properly, if the chosen instruction sets are not available on the target \
362	processor.", "no");
363toolset_setup_intrinsic_cflags();
364