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-10 17:57:27 +08:00
ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +
"The only recommended and supported toolset for production use " +
"is Visual Studio. Use others at your own risk.", "vs");
2014-11-07 18:48:03 +08:00
toolset_option_handle();
2014-11-07 03:44:57 +08:00
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
2014-11-07 18:48:03 +08:00
toolset_setup_compiler();
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();
2014-11-12 18:14:56 +08:00
toolset_setup_arch();
2007-04-10 14:22:28 +08:00
2014-11-07 18:48:03 +08:00
toolset_setup_linker();
toolset_setup_project_tools();
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', '');
2014-11-11 07:38:37 +08:00
object_out_dir_option_handle();
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
2014-11-07 20:48:29 +08:00
toolset_setup_common_cflags();
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
2014-11-07 20:48:29 +08:00
toolset_setup_common_ldlags();
2003-12-03 07:17:04 +08:00
// General libs
2014-11-11 06:28:03 +08:00
toolset_setup_common_libs();
2003-12-03 07:17:04 +08:00
// Set some debug/release specific options
2014-11-11 06:28:03 +08:00
toolset_setup_build_mode();
2003-12-03 07:17:04 +08:00
2014-11-11 22:22:06 +08:00
setup_zts_stuff();
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');
2014-11-11 22:28:20 +08:00
php_build_option_handle();
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
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 18:48:03 +08:00
/* XXX inspect this for other toolsets */
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-08 02:24:17 +08:00
if (VS_TOOLSET && VCVERS >= 1400 || ICC_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