config.w32 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. // vim:ft=javascript
  2. // $Id$
  3. // "Master" config file; think of it as a configure.in
  4. // equivalent.
  5. ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
  6. PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
  7. if (!PHP_CL) {
  8. ERROR("MS C++ compiler is required");
  9. }
  10. /* For the record here: */
  11. // 1200 is VC6
  12. // 1300 is vs.net 2002
  13. // 1310 is vs.net 2003
  14. // 1400 is vs.net 2005
  15. // 1500 is vs.net 2008
  16. // 1600 is vs.net 2010
  17. // Which version of the compiler do we have?
  18. VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
  19. STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);
  20. if (VCVERS < 1500) {
  21. ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
  22. }
  23. AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
  24. DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
  25. AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
  26. // do we use x64 or 80x86 version of compiler?
  27. X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
  28. if (X64) {
  29. STDOUT.WriteLine(" Detected 64-bit compiler");
  30. } else {
  31. STDOUT.WriteLine(" Detected 32-bit compiler");
  32. }
  33. AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
  34. DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
  35. // cygwin now ships with link.exe. Avoid searching the cygwin path
  36. // for this, as we want the MS linker, not the fileutil
  37. PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
  38. PATH_PROG('nmake');
  39. // we don't want to define LIB, as that will override the default library path
  40. // that is set in that env var
  41. PATH_PROG('lib', null, 'MAKE_LIB');
  42. if (!PATH_PROG('bison')) {
  43. ERROR('bison is required')
  44. }
  45. // There's a minimum requirement for re2c..
  46. MINRE2C = "0.13.4";
  47. RE2C = PATH_PROG('re2c');
  48. if (RE2C) {
  49. var intvers, intmin;
  50. var pattern = /\./g;
  51. RE2CVERS = probe_binary(RE2C, "version");
  52. STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
  53. intvers = RE2CVERS.replace(pattern, '') - 0;
  54. intmin = MINRE2C.replace(pattern, '') - 0;
  55. if (intvers < intmin) {
  56. STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
  57. STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
  58. DEFINE('RE2C', '');
  59. } else {
  60. DEFINE('RE2C_FLAGS', '');
  61. }
  62. } else {
  63. STDOUT.WriteLine('Parsers will not be regenerated');
  64. }
  65. PATH_PROG('zip');
  66. PATH_PROG('lemon');
  67. // avoid picking up midnight commander from cygwin
  68. PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
  69. // Try locating manifest tool
  70. if (VCVERS > 1200) {
  71. PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
  72. }
  73. // stick objects somewhere outside of the source tree
  74. ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
  75. if (PHP_OBJECT_OUT_DIR.length) {
  76. PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
  77. if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
  78. ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
  79. }
  80. PHP_OBJECT_OUT_DIR += '\\';
  81. } else if (X64) {
  82. if (!FSO.FolderExists("x64")) {
  83. FSO.CreateFolder("x64");
  84. }
  85. PHP_OBJECT_OUT_DIR = 'x64\\';
  86. }
  87. ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
  88. ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
  89. if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
  90. ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
  91. }
  92. ARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no');
  93. ARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no');
  94. if (PHP_PGI == "yes" || PHP_PGO != "no") {
  95. PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH"));
  96. if (!PGOMGR) {
  97. ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present.");
  98. }
  99. if (PHP_PGI == "yes" && PHP_PGO != "no") {
  100. ERROR("Use of both --enable-pgi and --with-pgo not allowed.");
  101. }
  102. }
  103. ARG_ENABLE('zts', 'Thread safety', 'yes');
  104. // Configures the hard-coded installation dir
  105. ARG_WITH('prefix', 'where PHP will be installed', '');
  106. if (PHP_PREFIX == '') {
  107. PHP_PREFIX = "C:\\php";
  108. if (PHP_DEBUG == "yes")
  109. PHP_PREFIX += "\\debug";
  110. }
  111. DEFINE('PHP_PREFIX', PHP_PREFIX);
  112. DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
  113. // CFLAGS for building the PHP dll
  114. DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
  115. /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
  116. DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
  117. // General CFLAGS for building objects
  118. DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
  119. /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
  120. if (VCVERS < 1400) {
  121. // Enable automatic precompiled headers
  122. ADD_FLAG('CFLAGS', ' /YX ');
  123. if (PHP_DEBUG == "yes") {
  124. // Set some debug/release specific options
  125. ADD_FLAG('CFLAGS', ' /GZ ');
  126. }
  127. }
  128. if (VCVERS >= 1400) {
  129. // fun stuff: MS deprecated ANSI stdio and similar functions
  130. // disable annoying warnings. In addition, time_t defaults
  131. // to 64-bit. Ask for 32-bit.
  132. if (X64) {
  133. ADD_FLAG('CFLAGS', ' /wd4996 ');
  134. } else {
  135. ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
  136. }
  137. if (PHP_DEBUG == "yes") {
  138. // Set some debug/release specific options
  139. ADD_FLAG('CFLAGS', ' /RTC1 ');
  140. }
  141. }
  142. ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
  143. if (VCVERS >= 1500 && PHP_MP != 'disable') {
  144. // no from disable-all
  145. if(PHP_MP == 'auto' || PHP_MP == 'no') {
  146. ADD_FLAG('CFLAGS', ' /MP ');
  147. } else {
  148. if(parseInt(PHP_MP) != 0) {
  149. ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
  150. } else {
  151. STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
  152. }
  153. }
  154. }
  155. // General link flags
  156. if (VCVERS >= 1700) {
  157. DEFINE("LDFLAGS", "/nologo ");
  158. } else {
  159. DEFINE("LDFLAGS", "/nologo /version:" +
  160. PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
  161. }
  162. // General DLL link flags
  163. DEFINE("DLL_LDFLAGS", "/dll ");
  164. // PHP DLL link flags
  165. DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
  166. // General libs
  167. // urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
  168. DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
  169. // Set some debug/release specific options
  170. if (PHP_DEBUG == "yes") {
  171. ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
  172. (X64?"/Zi":"/ZI"));
  173. ADD_FLAG("LDFLAGS", "/debug");
  174. // Avoid problems when linking to release libraries that use the release
  175. // version of the libc
  176. ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
  177. } else {
  178. // Generate external debug files when --enable-debug-pack is specified
  179. if (PHP_DEBUG_PACK == "yes") {
  180. ADD_FLAG("CFLAGS", "/Zi");
  181. ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
  182. }
  183. // Equivalent to Release_TSInline build -> best optimization
  184. ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
  185. // if you have VS.Net /GS hardens the binary against buffer overruns
  186. // ADD_FLAG("CFLAGS", "/GS");
  187. }
  188. if (PHP_ZTS == "yes") {
  189. ADD_FLAG("CFLAGS", "/D ZTS=1");
  190. ADD_FLAG("ZTS", "1");
  191. } else {
  192. ADD_FLAG("ZTS", "0");
  193. }
  194. DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
  195. // we want msvcrt in the PHP DLL
  196. ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
  197. // set up the build dir and DLL name
  198. if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
  199. DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
  200. DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
  201. DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
  202. } else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
  203. DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
  204. DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
  205. DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
  206. } else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
  207. DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
  208. DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
  209. DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
  210. } else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
  211. DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
  212. DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
  213. DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
  214. }
  215. // CFLAGS, LDFLAGS and BUILD_DIR are defined
  216. // Add compiler and link flags if PGO options are selected
  217. if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
  218. ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
  219. DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
  220. }
  221. else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
  222. ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
  223. DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
  224. }
  225. // Find the php_build dir - it contains headers and libraries
  226. // that we need
  227. ARG_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');
  228. if (PHP_PHP_BUILD == 'no') {
  229. if (FSO.FolderExists("..\\deps")) {
  230. PHP_PHP_BUILD = "..\\deps";
  231. } else {
  232. if (FSO.FolderExists("..\\php_build")) {
  233. PHP_PHP_BUILD = "..\\php_build";
  234. } else {
  235. if (X64) {
  236. if (FSO.FolderExists("..\\win64build")) {
  237. PHP_PHP_BUILD = "..\\win64build";
  238. } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
  239. PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
  240. }
  241. } else {
  242. if (FSO.FolderExists("..\\win32build")) {
  243. PHP_PHP_BUILD = "..\\win32build";
  244. } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
  245. PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
  246. }
  247. }
  248. }
  249. }
  250. PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
  251. }
  252. DEFINE("PHP_BUILD", PHP_PHP_BUILD);
  253. ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
  254. ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
  255. var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
  256. var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
  257. ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
  258. ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
  259. // Poke around for some headers
  260. function probe_basic_headers()
  261. {
  262. var p;
  263. if (PHP_PHP_BUILD != "no") {
  264. php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
  265. php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
  266. }
  267. }
  268. function add_extra_dirs()
  269. {
  270. var path, i, f;
  271. if (PHP_EXTRA_INCLUDES.length) {
  272. path = PHP_EXTRA_INCLUDES.split(';');
  273. for (i = 0; i < path.length; i++) {
  274. f = FSO.GetAbsolutePathName(path[i]);
  275. if (FSO.FolderExists(f)) {
  276. ADD_FLAG("CFLAGS", '/I "' + f + '" ');
  277. }
  278. }
  279. }
  280. if (PHP_EXTRA_LIBS.length) {
  281. path = PHP_EXTRA_LIBS.split(';');
  282. for (i = 0; i < path.length; i++) {
  283. f = FSO.GetAbsolutePathName(path[i]);
  284. if (FSO.FolderExists(f)) {
  285. if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
  286. ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
  287. } else {
  288. ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
  289. }
  290. }
  291. }
  292. }
  293. }
  294. probe_basic_headers();
  295. add_extra_dirs();
  296. //DEFINE("PHP_BUILD", PHP_PHP_BUILD);
  297. STDOUT.WriteBlankLines(1);
  298. STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
  299. STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
  300. ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
  301. zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
  302. zend_constants.c zend_dynamic_array.c zend_exceptions.c \
  303. zend_execute_API.c zend_highlight.c \
  304. zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
  305. zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
  306. zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \
  307. zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
  308. zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
  309. zend_object_handlers.c zend_objects_API.c \
  310. zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
  311. zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c");
  312. if (VCVERS == 1200) {
  313. AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
  314. }
  315. ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
  316. php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
  317. strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
  318. php_open_temporary_file.c output.c internal_functions.c php_sprintf.c");
  319. ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
  320. // Newer versions have it
  321. if (VCVERS <= 1300) {
  322. ADD_SOURCES("win32", "strtoi64.c");
  323. }
  324. if (VCVERS >= 1400) {
  325. AC_DEFINE('HAVE_STRNLEN', 1);
  326. }
  327. ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
  328. userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c");
  329. ADD_SOURCES("win32", "glob.c readdir.c \
  330. registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c");
  331. PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
  332. STDOUT.WriteBlankLines(1);
  333. /* Can we build with IPv6 support? */
  334. ARG_ENABLE("ipv6", "Disable IPv6 support (default is turn it on if available)", "yes");
  335. var main_network_has_ipv6 = 0;
  336. if (PHP_IPV6 == "yes") {
  337. main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0;
  338. }
  339. if (main_network_has_ipv6) {
  340. STDOUT.WriteLine("Enabling IPv6 support");
  341. }
  342. AC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6);
  343. AC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6);
  344. AC_DEFINE('HAVE_IPV6', main_network_has_ipv6);
  345. /* this allows up to 256 sockets to be select()ed in a single
  346. * call to select(), instead of the usual 64 */
  347. ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
  348. ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
  349. AC_DEFINE('HAVE_USLEEP', 1);
  350. AC_DEFINE('HAVE_STRCOLL', 1);
  351. /* For snapshot builders, where can we find the additional
  352. * files that make up the snapshot template? */
  353. ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
  354. if (PHP_SNAPSHOT_TEMPLATE == "no") {
  355. /* default is as a sibling of the php_build dir */
  356. if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
  357. PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
  358. } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
  359. PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
  360. }
  361. }
  362. DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
  363. if (PHP_DSP != "no") {
  364. if (FSO.FolderExists("tmp")) {
  365. FSO.DeleteFolder("tmp");
  366. }
  367. FSO.CreateFolder("tmp");
  368. }
  369. ARG_ENABLE("security-flags", "Disable the compiler security flags", "yes");
  370. if (PHP_SECURITY_FLAGS == "yes") {
  371. ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
  372. }
  373. /* XXX add and implement clang keyword for clang analyzer */
  374. ARG_WITH("analyzer", "Enable static analyzer. Pass vs for Visual Studio, pvs for PVS-Studio", "no");
  375. if (PHP_ANALYZER == "vs") {
  376. ADD_FLAG("CFLAGS", " /analyze ");
  377. ADD_FLAG("CFLAGS", " /wd6308 ");
  378. } else if (PHP_ANALYZER == "pvs") {
  379. var pvs_studio = false;
  380. if (FSO.FileExists(PROGRAM_FILES + "\\PVS-Studio\\x64\\PVS-Studio.exe")) {
  381. pvs_studio = PROGRAM_FILES + "\\PVS-Studio\\x86\\PVS-Studio.exe";
  382. } else if (FSO.FileExists(PROGRAM_FILESx86 + "\\PVS-Studio\\x64\\PVS-Studio.exe")) {
  383. pvs_studio = PROGRAM_FILESx86 + "\\PVS-Studio\\x64\\PVS-Studio.exe";
  384. }
  385. if (!pvs_studio) {
  386. WARNING("Couldn't find PVS-Studio binaries, static analyze was disabled");
  387. PHP_ANALYZER = "no";
  388. } else {
  389. var pvscfg = FSO.CreateTextFile("PVS-Studio.conf", true);
  390. DEFINE("PVS_STUDIO", pvs_studio);
  391. pvscfg.WriteLine("exclude-path = " + VCINSTALLDIR);
  392. if (FSO.FolderExists(PROGRAM_FILESx86 + "\\windows kits\\")) {
  393. pvscfg.WriteLine("exclude-path = " + PROGRAM_FILESx86 + "\\windows kits\\");
  394. } else if (FSO.FolderExists(PROGRAM_FILES + "\\windows kits\\")) {
  395. pvscfg.WriteLine("exclude-path = " + PROGRAM_FILES + "\\windows kits\\");
  396. }
  397. pvscfg.WriteLine("vcinstalldir = " + VCINSTALLDIR);
  398. pvscfg.WriteLine("platform = " + (X64 ? 'x64' : 'Win32'));
  399. pvscfg.WriteLine("preprocessor = visualcpp");
  400. pvscfg.WriteLine("language = C");
  401. }
  402. } else {
  403. PHP_ANALYZER = "no"
  404. }