2003-12-03 07:17:04 +08:00
// vim:ft=javascript
// $Id$
// "Master" config file; think of it as a configure.in
// equivalent.
2014-11-07 06:04:53 +08:00
ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, intel", "vs");
2014-11-07 03:44:57 +08:00
if ("clang" == PHP_TOOLSET) {
VS_TOOLSET = false;
CLANG_TOOLSET = true;
INTEL_TOOLSET = false;
2014-11-07 06:04:53 +08:00
} else if ("intel" == PHP_TOOLSET) {
VS_TOOLSET = false;
CLANG_TOOLSET = false;
INTEL_TOOLSET = true;
2014-11-07 03:44:57 +08:00
} else {
/* Visual Studio is the default toolset. */
PHP_TOOLSET = "no" == PHP_TOOLSET ? "vs" : PHP_TOOLSET;
if (!!PHP_TOOLSET && "vs" != PHP_TOOLSET) {
ERROR("Unsupported toolset name '" + PHP_TOOLSET + "'");
}
VS_TOOLSET = true;
CLANG_TOOLSET = false;
INTEL_TOOLSET = false;
}
2003-12-19 20:50:11 +08:00
ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
2014-11-07 03:44:57 +08:00
PHP_CL = toolset_get_compiler();
2010-08-15 21:54:03 +08:00
if (!PHP_CL) {
2005-08-13 04:08:14 +08:00
ERROR("MS C++ compiler is required");
}
2008-07-07 09:23:56 +08:00
2014-11-07 03:44:57 +08:00
COMPILER_NUMERIC_VERSION = toolset_get_compiler_version();
COMPILER_NAME = toolset_get_compiler_name();
if (VS_TOOLSET) {
/* For the record here: */
// 1200 is VC6
// 1300 is vs.net 2002
// 1310 is vs.net 2003
// 1400 is vs.net 2005
// 1500 is vs.net 2008
// 1600 is vs.net 2010
// Which version of the compiler do we have?
VCVERS = COMPILER_NUMERIC_VERSION;
if (VCVERS < 1500) {
ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
}
2010-04-29 16:13:15 +08:00
2014-11-07 03:44:57 +08:00
AC_DEFINE('COMPILER', COMPILER_NAME, "Detected compiler version");
DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
} else if (CLANG_TOOLSET) {
CLANGVERS = COMPILER_NUMERIC_VERSION;
AC_DEFINE('COMPILER', COMPILER_NAME, "Detected compiler version");
DEFINE("PHP_COMPILER_SHORT", "clang");
AC_DEFINE('PHP_COMPILER_ID', "clang"); /* XXX something better were to write here */
} else if (INTEL_TOOLSET) {
2014-11-07 06:04:53 +08:00
INTELVERS = COMPILER_NUMERIC_VERSION;
AC_DEFINE('COMPILER', COMPILER_NAME, "Detected compiler version");
DEFINE("PHP_COMPILER_SHORT", "icc");
AC_DEFINE('PHP_COMPILER_ID', "icc"); /* XXX something better were to write here */
2014-11-07 03:44:57 +08:00
}
STDOUT.WriteLine(" Detected compiler " + COMPILER_NAME);
2008-03-18 01:06:51 +08:00
2007-04-10 14:22:28 +08:00
// do we use x64 or 80x86 version of compiler?
2014-11-07 03:44:57 +08:00
X64 = toolset_is_64();
2007-04-10 14:22:28 +08:00
if (X64) {
2008-07-07 09:23:56 +08:00
STDOUT.WriteLine(" Detected 64-bit compiler");
2007-04-10 14:22:28 +08:00
} else {
2008-07-07 09:23:56 +08:00
STDOUT.WriteLine(" Detected 32-bit compiler");
2007-04-10 14:22:28 +08:00
}
2008-07-07 09:23:56 +08:00
AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
2008-09-25 23:00:59 +08:00
DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
2007-04-10 14:22:28 +08:00
2005-06-05 09:39:07 +08:00
// cygwin now ships with link.exe. Avoid searching the cygwin path
// for this, as we want the MS linker, not the fileutil
2014-11-07 03:44:57 +08:00
toolset_get_linker();
2003-12-03 07:17:04 +08:00
PATH_PROG('nmake');
2005-06-05 09:39:07 +08:00
2003-12-20 04:39:04 +08:00
// we don't want to define LIB, as that will override the default library path
// that is set in that env var
PATH_PROG('lib', null, 'MAKE_LIB');
2005-06-05 09:39:07 +08:00
if (!PATH_PROG('bison')) {
ERROR('bison is required')
}
2008-03-18 11:12:42 +08:00
// There's a minimum requirement for re2c..
2008-04-25 00:04:59 +08:00
MINRE2C = "0.13.4";
2008-03-18 11:12:42 +08:00
RE2C = PATH_PROG('re2c');
if (RE2C) {
var intvers, intmin;
var pattern = /\./g;
2008-07-07 09:23:56 +08:00
RE2CVERS = probe_binary(RE2C, "version");
STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
2008-03-18 11:12:42 +08:00
intvers = RE2CVERS.replace(pattern, '') - 0;
intmin = MINRE2C.replace(pattern, '') - 0;
if (intvers < intmin) {
2008-07-07 09:23:56 +08:00
STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
2008-03-18 11:12:42 +08:00
STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
DEFINE('RE2C', '');
} else {
DEFINE('RE2C_FLAGS', '');
}
} else {
STDOUT.WriteLine('Parsers will not be regenerated');
2008-03-17 07:54:06 +08:00
}
2003-12-19 20:50:11 +08:00
PATH_PROG('zip');
PATH_PROG('lemon');
2005-06-05 09:39:07 +08:00
// avoid picking up midnight commander from cygwin
2004-08-03 09:03:32 +08:00
PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
2003-12-03 07:17:04 +08:00
2006-12-19 18:26:01 +08:00
// Try locating manifest tool
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET && VCVERS > 1200) {
2008-07-07 09:23:56 +08:00
PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
}
2006-12-19 18:26:01 +08:00
2005-06-05 09:57:03 +08:00
// stick objects somewhere outside of the source tree
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
if (PHP_OBJECT_OUT_DIR.length) {
2009-08-24 22:18:19 +08:00
PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
2005-06-05 09:57:03 +08:00
if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
}
PHP_OBJECT_OUT_DIR += '\\';
2007-04-10 14:22:28 +08:00
} else if (X64) {
if (!FSO.FolderExists("x64")) {
FSO.CreateFolder("x64");
}
PHP_OBJECT_OUT_DIR = 'x64\\';
2005-06-05 09:57:03 +08:00
}
2005-06-05 09:39:07 +08:00
2003-12-03 07:17:04 +08:00
ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
2005-02-25 08:20:19 +08:00
ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
}
2012-01-11 23:46:45 +08:00
ARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no');
ARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no');
if (PHP_PGI == "yes" || PHP_PGO != "no") {
PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH"));
if (!PGOMGR) {
ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present.");
}
if (PHP_PGI == "yes" && PHP_PGO != "no") {
ERROR("Use of both --enable-pgi and --with-pgo not allowed.");
}
}
2003-12-03 07:17:04 +08:00
ARG_ENABLE('zts', 'Thread safety', 'yes');
// Configures the hard-coded installation dir
2010-12-11 00:10:08 +08:00
ARG_WITH('prefix', 'where PHP will be installed', '');
2003-12-23 20:40:41 +08:00
if (PHP_PREFIX == '') {
2010-12-03 07:23:14 +08:00
PHP_PREFIX = "C:\\php";
2003-12-23 20:40:41 +08:00
if (PHP_DEBUG == "yes")
PHP_PREFIX += "\\debug";
2003-12-23 13:43:19 +08:00
}
DEFINE('PHP_PREFIX', PHP_PREFIX);
2003-12-03 07:17:04 +08:00
2007-10-05 23:00:09 +08:00
DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
2003-12-03 07:17:04 +08:00
// CFLAGS for building the PHP dll
2014-09-20 16:01:44 +08:00
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
2009-10-30 22:20:15 +08:00
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
2003-12-03 07:17:04 +08:00
2003-12-04 06:59:48 +08:00
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
2003-12-03 07:17:04 +08:00
// General CFLAGS for building objects
2014-11-07 03:44:57 +08:00
DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS \
2009-09-30 19:53:29 +08:00
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
2014-11-07 03:44:57 +08:00
if (CLANG_TOOLSET) {
if (X64) {
ADD_FLAG('CFLAGS', ' -m64 ');
} else {
ADD_FLAG('CFLAGS', ' -m32 ');
}
}
2003-12-03 07:17:04 +08:00
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET && VCVERS < 1400) {
2005-08-13 04:08:14 +08:00
// Enable automatic precompiled headers
ADD_FLAG('CFLAGS', ' /YX ');
2005-11-21 01:03:14 +08:00
2005-11-22 08:29:56 +08:00
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /GZ ');
}
2005-08-13 04:08:14 +08:00
}
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET && VCVERS >= 1400) {
2005-08-13 04:08:14 +08:00
// fun stuff: MS deprecated ANSI stdio and similar functions
2005-12-14 10:01:13 +08:00
// disable annoying warnings. In addition, time_t defaults
// to 64-bit. Ask for 32-bit.
2007-04-10 14:22:28 +08:00
if (X64) {
2013-08-28 21:10:05 +08:00
ADD_FLAG('CFLAGS', ' /wd4996 ');
2007-04-10 14:22:28 +08:00
} else {
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
}
2005-11-21 01:03:14 +08:00
2005-11-22 08:29:56 +08:00
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /RTC1 ');
}
2005-08-13 04:08:14 +08:00
}
2014-10-08 15:01:46 +08:00
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
2014-10-08 16:59:15 +08:00
var PHP_MP_DISABLED = true;
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable') {
2009-04-24 23:18:37 +08:00
// no from disable-all
if(PHP_MP == 'auto' || PHP_MP == 'no') {
2009-04-24 04:19:06 +08:00
ADD_FLAG('CFLAGS', ' /MP ');
2014-10-08 16:59:15 +08:00
PHP_MP_DISABLED = false;
2009-04-24 04:19:06 +08:00
} else {
2009-04-24 19:34:38 +08:00
if(parseInt(PHP_MP) != 0) {
ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
2014-10-08 16:59:15 +08:00
PHP_MP_DISABLED = false;
2009-04-24 19:34:38 +08:00
} else {
STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
}
2009-04-24 04:19:06 +08:00
}
2009-01-07 04:50:57 +08:00
}
2003-12-03 07:17:04 +08:00
// General link flags
2012-09-09 00:46:33 +08:00
2014-11-07 07:58:02 +08:00
if (VS_TOOLSET || CLANG_TOOLSET) {
if (VCVERS >= 1700 || CLANG_TOOLSET) {
2014-11-07 03:44:57 +08:00
DEFINE("LDFLAGS", "/nologo ");
} else {
DEFINE("LDFLAGS", "/nologo /version:" +
PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
}
2012-09-09 00:46:33 +08:00
}
2003-12-03 07:17:04 +08:00
// General DLL link flags
2003-12-19 20:50:11 +08:00
DEFINE("DLL_LDFLAGS", "/dll ");
2003-12-03 07:17:04 +08:00
// PHP DLL link flags
DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
// General libs
2008-03-18 01:06:51 +08:00
// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
2009-01-07 04:46:36 +08:00
DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
2003-12-03 07:17:04 +08:00
// Set some debug/release specific options
if (PHP_DEBUG == "yes") {
2009-09-30 19:53:29 +08:00
ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
2007-04-10 14:22:28 +08:00
(X64?"/Zi":"/ZI"));
2003-12-03 07:17:04 +08:00
ADD_FLAG("LDFLAGS", "/debug");
// Avoid problems when linking to release libraries that use the release
// version of the libc
ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
} else {
2005-02-25 08:20:19 +08:00
// Generate external debug files when --enable-debug-pack is specified
if (PHP_DEBUG_PACK == "yes") {
ADD_FLAG("CFLAGS", "/Zi");
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
}
2003-12-03 07:17:04 +08:00
// Equivalent to Release_TSInline build -> best optimization
2008-12-25 08:08:51 +08:00
ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
2003-12-03 09:10:03 +08:00
// if you have VS.Net /GS hardens the binary against buffer overruns
// ADD_FLAG("CFLAGS", "/GS");
2003-12-03 07:17:04 +08:00
}
if (PHP_ZTS == "yes") {
ADD_FLAG("CFLAGS", "/D ZTS=1");
2010-12-14 04:55:13 +08:00
ADD_FLAG("ZTS", "1");
} else {
ADD_FLAG("ZTS", "0");
2003-12-03 07:17:04 +08:00
}
2008-03-18 01:06:51 +08:00
2008-09-26 21:29:11 +08:00
DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
2003-12-03 07:17:04 +08:00
// we want msvcrt in the PHP DLL
ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
// set up the build dir and DLL name
if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
2005-06-05 09:57:03 +08:00
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
2008-07-03 04:49:12 +08:00
DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
2003-12-03 07:17:04 +08:00
} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
2005-06-05 09:57:03 +08:00
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
2008-07-03 04:49:12 +08:00
DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
2003-12-03 07:17:04 +08:00
} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
2005-06-05 09:57:03 +08:00
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
2008-07-03 04:49:12 +08:00
DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
2003-12-03 07:17:04 +08:00
} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
2005-06-05 09:57:03 +08:00
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
2008-07-03 04:49:12 +08:00
DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
2003-12-03 07:17:04 +08:00
}
2012-01-11 23:46:45 +08:00
// CFLAGS, LDFLAGS and BUILD_DIR are defined
// Add compiler and link flags if PGO options are selected
if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
2014-03-25 02:15:02 +08:00
ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
2012-01-11 23:46:45 +08:00
DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
}
else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
2014-03-25 02:15:02 +08:00
ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
2012-01-11 23:46:45 +08:00
DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
}
2003-12-03 07:17:04 +08:00
// Find the php_build dir - it contains headers and libraries
// that we need
2008-12-26 22:11:44 +08:00
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');
2003-12-03 07:17:04 +08:00
2003-12-05 10:41:00 +08:00
if (PHP_PHP_BUILD == 'no') {
2008-08-01 19:25:42 +08:00
if (FSO.FolderExists("..\\deps")) {
PHP_PHP_BUILD = "..\\deps";
2007-04-10 14:22:28 +08:00
} else {
2008-08-01 19:25:42 +08:00
if (FSO.FolderExists("..\\php_build")) {
PHP_PHP_BUILD = "..\\php_build";
2007-04-10 14:22:28 +08:00
} else {
2008-08-01 19:25:42 +08:00
if (X64) {
if (FSO.FolderExists("..\\win64build")) {
PHP_PHP_BUILD = "..\\win64build";
} else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
}
} else {
if (FSO.FolderExists("..\\win32build")) {
PHP_PHP_BUILD = "..\\win32build";
} else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
}
2007-04-10 14:22:28 +08:00
}
}
2003-12-05 10:41:00 +08:00
}
2009-10-20 03:02:12 +08:00
PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
2003-12-05 10:41:00 +08:00
}
2008-11-21 22:18:27 +08:00
DEFINE("PHP_BUILD", PHP_PHP_BUILD);
2003-12-05 10:41:00 +08:00
2003-12-04 02:31:04 +08:00
ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
2008-12-26 22:11:44 +08:00
var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
2011-03-02 13:22:22 +08:00
ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
2003-12-03 10:47:45 +08:00
// Poke around for some headers
function probe_basic_headers()
{
var p;
if (PHP_PHP_BUILD != "no") {
php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
2003-12-03 07:17:04 +08:00
}
}
2003-12-04 02:31:04 +08:00
function add_extra_dirs()
{
var path, i, f;
2003-12-19 20:50:11 +08:00
if (PHP_EXTRA_INCLUDES.length) {
path = PHP_EXTRA_INCLUDES.split(';');
for (i = 0; i < path.length; i++) {
f = FSO.GetAbsolutePathName(path[i]);
if (FSO.FolderExists(f)) {
ADD_FLAG("CFLAGS", '/I "' + f + '" ');
}
2003-12-04 02:31:04 +08:00
}
2003-12-19 20:50:11 +08:00
}
if (PHP_EXTRA_LIBS.length) {
path = PHP_EXTRA_LIBS.split(';');
for (i = 0; i < path.length; i++) {
f = FSO.GetAbsolutePathName(path[i]);
if (FSO.FolderExists(f)) {
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET) {
if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
} else {
ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
}
2006-11-14 22:10:53 +08:00
}
2003-12-19 20:50:11 +08:00
}
2003-12-04 02:31:04 +08:00
}
2003-12-19 20:50:11 +08:00
}
2003-12-04 02:31:04 +08:00
}
2003-12-03 10:47:45 +08:00
probe_basic_headers();
2003-12-04 02:31:04 +08:00
add_extra_dirs();
2003-12-03 10:47:45 +08:00
//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
2003-12-03 07:17:04 +08:00
STDOUT.WriteBlankLines(1);
STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
2014-09-23 05:39:07 +08:00
zend_constants.c zend_exceptions.c \
2004-02-12 18:53:08 +08:00
zend_execute_API.c zend_highlight.c \
2013-12-22 07:52:05 +08:00
zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
2003-12-03 07:17:04 +08:00
zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \
zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
zend_object_handlers.c zend_objects_API.c \
2009-03-18 18:18:10 +08:00
zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
2014-09-20 05:21:03 +08:00
zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
zend_inheritance.c");
2003-12-03 07:17:04 +08:00
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET && VCVERS == 1200) {
2009-06-05 02:20:45 +08:00
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
}
2010-04-27 07:53:30 +08:00
ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
2003-12-03 07:17:04 +08:00
php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
2012-07-15 04:44:21 +08:00
php_open_temporary_file.c output.c internal_functions.c php_sprintf.c");
2009-01-23 23:49:49 +08:00
ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
2003-12-03 07:17:04 +08:00
2008-10-20 22:47:33 +08:00
// Newer versions have it
2014-11-07 03:44:57 +08:00
if (VS_TOOLSET && VCVERS <= 1300) {
2008-10-20 22:47:33 +08:00
ADD_SOURCES("win32", "strtoi64.c");
}
2014-11-07 06:04:53 +08:00
if (VS_TOOLSET && VCVERS >= 1400 || INTEL_TOOLSET) {
2008-12-13 19:47:06 +08:00
AC_DEFINE('HAVE_STRNLEN', 1);
}
2008-10-20 22:47:33 +08:00
2003-12-03 07:17:04 +08:00
ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
2007-11-08 03:47:38 +08:00
userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c");
2003-12-03 07:17:04 +08:00
2008-07-28 19:50:35 +08:00
ADD_SOURCES("win32", "glob.c readdir.c \
2010-09-12 03:07:43 +08:00
registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c");
2003-12-03 07:17:04 +08:00
2010-12-14 04:55:13 +08:00
PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
2010-12-11 00:10:08 +08:00
2003-12-03 07:17:04 +08:00
STDOUT.WriteBlankLines(1);
2011-01-11 05:04:50 +08:00
2003-12-06 08:00:31 +08:00
/* Can we build with IPv6 support? */
ARG_ENABLE("ipv6", "Disable IPv6 support (default is turn it on if available)", "yes");
var main_network_has_ipv6 = 0;
if (PHP_IPV6 == "yes") {
2003-12-06 18:32:35 +08:00
main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0;
2003-12-06 08:00:31 +08:00
}
if (main_network_has_ipv6) {
STDOUT.WriteLine("Enabling IPv6 support");
}
AC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6);
AC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6);
AC_DEFINE('HAVE_IPV6', main_network_has_ipv6);
2004-09-17 20:44:56 +08:00
/* this allows up to 256 sockets to be select()ed in a single
* call to select(), instead of the usual 64 */
ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
2004-09-17 22:36:55 +08:00
ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
2004-09-17 20:44:56 +08:00
2004-08-01 08:29:50 +08:00
AC_DEFINE('HAVE_USLEEP', 1);
2004-09-17 20:44:56 +08:00
AC_DEFINE('HAVE_STRCOLL', 1);
2004-08-01 08:29:50 +08:00
2003-12-07 00:14:03 +08:00
/* For snapshot builders, where can we find the additional
* files that make up the snapshot template? */
ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
if (PHP_SNAPSHOT_TEMPLATE == "no") {
/* default is as a sibling of the php_build dir */
2007-04-10 14:22:28 +08:00
if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
} else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
2003-12-07 00:14:03 +08:00
PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
}
}
DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
2008-07-07 09:23:56 +08:00
2011-01-11 05:04:50 +08:00
ARG_ENABLE("security-flags", "Disable the compiler security flags", "yes");
2011-01-08 04:50:33 +08:00
if (PHP_SECURITY_FLAGS == "yes") {
ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
}
2011-01-10 05:38:46 +08:00
2014-03-02 03:15:10 +08:00
/* XXX add and implement clang keyword for clang analyzer */
ARG_WITH("analyzer", "Enable static analyzer. Pass vs for Visual Studio, pvs for PVS-Studio", "no");
if (PHP_ANALYZER == "vs") {
2011-01-10 05:38:46 +08:00
ADD_FLAG("CFLAGS", " /analyze ");
2011-02-07 18:17:14 +08:00
ADD_FLAG("CFLAGS", " /wd6308 ");
2014-03-02 03:15:10 +08:00
} else if (PHP_ANALYZER == "pvs") {
var pvs_studio = false;
if (FSO.FileExists(PROGRAM_FILES + "\\PVS-Studio\\x64\\PVS-Studio.exe")) {
pvs_studio = PROGRAM_FILES + "\\PVS-Studio\\x86\\PVS-Studio.exe";
} else if (FSO.FileExists(PROGRAM_FILESx86 + "\\PVS-Studio\\x64\\PVS-Studio.exe")) {
pvs_studio = PROGRAM_FILESx86 + "\\PVS-Studio\\x64\\PVS-Studio.exe";
}
if (!pvs_studio) {
WARNING("Couldn't find PVS-Studio binaries, static analyze was disabled");
PHP_ANALYZER = "no";
} else {
var pvscfg = FSO.CreateTextFile("PVS-Studio.conf", true);
DEFINE("PVS_STUDIO", pvs_studio);
pvscfg.WriteLine("exclude-path = " + VCINSTALLDIR);
if (FSO.FolderExists(PROGRAM_FILESx86 + "\\windows kits\\")) {
pvscfg.WriteLine("exclude-path = " + PROGRAM_FILESx86 + "\\windows kits\\");
} else if (FSO.FolderExists(PROGRAM_FILES + "\\windows kits\\")) {
pvscfg.WriteLine("exclude-path = " + PROGRAM_FILES + "\\windows kits\\");
}
pvscfg.WriteLine("vcinstalldir = " + VCINSTALLDIR);
pvscfg.WriteLine("platform = " + (X64 ? 'x64' : 'Win32'));
pvscfg.WriteLine("preprocessor = visualcpp");
pvscfg.WriteLine("language = C");
}
2014-07-10 21:20:34 +08:00
} else {
PHP_ANALYZER = "no"
2011-01-10 05:38:46 +08:00
}
2014-03-02 03:15:10 +08:00