mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00

The particular need on this is because of the current situation with determining the background functionality for the gettimeofday. DllMain allows to initialize stuff before the DLL can be actually used. Thus, we use different time API on win7 and win8 and later, so the function pointer needs to be initialized before anything in the DLL could even demand it. The change also opens the door for the further optimizations, as now we're able to do the very basic initializations for the whole DLL before it could ever start to live. Fe on this way the TLS initialization could be done, when utilizing the DLL_THREAD_ATTACH/DETACH case. Whether it's really usable in portable way should be synced with other platforms. Be aware that it's dangerous as it possibly causes dead locks. So to use with care. One willing to add items to DllMain should better read the documentation twice and even then try to defer the necessary action.
262 lines
9.6 KiB
JavaScript
262 lines
9.6 KiB
JavaScript
// vim:ft=javascript
|
|
// $Id$
|
|
// "Master" config file; think of it as a configure.in
|
|
// equivalent.
|
|
|
|
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");
|
|
toolset_option_handle();
|
|
|
|
ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
|
|
|
|
toolset_setup_compiler();
|
|
|
|
// do we use x64 or 80x86 version of compiler?
|
|
X64 = toolset_is_64();
|
|
toolset_setup_arch();
|
|
|
|
toolset_setup_linker();
|
|
toolset_setup_project_tools();
|
|
|
|
// stick objects somewhere outside of the source tree
|
|
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
|
|
object_out_dir_option_handle();
|
|
|
|
ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
|
|
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.");
|
|
}
|
|
|
|
if (PHP_DEBUG == "yes") {
|
|
ADD_FLAG("CFLAGS"," /Wall ");
|
|
ADD_FLAG("LDFLAGS", " /verbose ");
|
|
}
|
|
|
|
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.");
|
|
}
|
|
}
|
|
|
|
ARG_ENABLE('zts', 'Thread safety', 'yes');
|
|
// Configures the hard-coded installation dir
|
|
ARG_WITH('prefix', 'where PHP will be installed', '');
|
|
if (PHP_PREFIX == '') {
|
|
PHP_PREFIX = "C:\\php";
|
|
if (PHP_DEBUG == "yes")
|
|
PHP_PREFIX += "\\debug";
|
|
}
|
|
DEFINE('PHP_PREFIX', PHP_PREFIX);
|
|
|
|
DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
|
|
|
|
toolset_setup_common_cflags();
|
|
|
|
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
|
|
var PHP_MP_DISABLED = true;
|
|
if (VS_TOOLSET && PHP_MP != 'disable') {
|
|
// no from disable-all
|
|
if(PHP_MP == 'auto' || PHP_MP == 'no') {
|
|
ADD_FLAG('CFLAGS', ' /MP ');
|
|
PHP_MP_DISABLED = false;
|
|
} else {
|
|
if(parseInt(PHP_MP) != 0) {
|
|
ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
|
|
PHP_MP_DISABLED = false;
|
|
} else {
|
|
STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!PHP_MP_DISABLED) {
|
|
STDOUT.WriteLine('Enabling multi process build');
|
|
}
|
|
|
|
// General link flags
|
|
toolset_setup_common_ldlags();
|
|
|
|
// General libs
|
|
toolset_setup_common_libs();
|
|
|
|
// Set some debug/release specific options
|
|
toolset_setup_build_mode();
|
|
|
|
setup_zts_stuff();
|
|
|
|
// CFLAGS, LDFLAGS and BUILD_DIR are defined
|
|
// Add compiler and link flags if PGO options are selected
|
|
if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
|
|
ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
|
|
DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
|
|
}
|
|
else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
|
|
ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
|
|
DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
|
|
}
|
|
|
|
// Find the php_build dir - it contains headers and libraries
|
|
// that we need
|
|
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');
|
|
php_build_option_handle();
|
|
|
|
ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
|
|
ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
|
|
|
|
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 + '" ');
|
|
ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
|
|
ADD_FLAG("ARFLAGS", '/nologo /libpath:"' + php_usual_lib_suspects + '" ');
|
|
|
|
probe_basic_headers();
|
|
add_extra_dirs();
|
|
|
|
//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
|
|
|
|
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 \
|
|
zend_constants.c zend_exceptions.c \
|
|
zend_execute_API.c zend_highlight.c \
|
|
zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
|
|
zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
|
|
zend_hash.c zend_list.c zend_builtin_functions.c \
|
|
zend_sprintf.c zend_ini.c zend_sort.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 \
|
|
zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
|
|
zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
|
|
zend_inheritance.c zend_smart_str.c");
|
|
|
|
ADD_FLAG("CFLAGS_BD_ZEND", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
|
|
/* XXX inspect this for other toolsets */
|
|
//AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
|
|
|
|
ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
|
|
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 \
|
|
php_open_temporary_file.c output.c internal_functions.c php_sprintf.c");
|
|
ADD_FLAG("CFLAGS_BD_MAIN", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
|
|
|
|
AC_DEFINE('HAVE_STRNLEN', 1);
|
|
|
|
ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
|
|
userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c");
|
|
ADD_FLAG("CFLAGS_BD_MAIN_STREAMS", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
|
|
ADD_SOURCES("win32", "dllmain.c glob.c readdir.c \
|
|
registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c getrusage.c");
|
|
|
|
ADD_FLAG("CFLAGS_BD_WIN32", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
|
|
PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
|
|
|
|
STDOUT.WriteBlankLines(1);
|
|
|
|
|
|
/* 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") {
|
|
main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0;
|
|
}
|
|
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);
|
|
|
|
/* 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");
|
|
ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
|
|
|
|
AC_DEFINE('HAVE_USLEEP', 1);
|
|
AC_DEFINE('HAVE_STRCOLL', 1);
|
|
|
|
/* 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 */
|
|
if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
|
|
PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
|
|
} else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
|
|
PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
|
|
}
|
|
}
|
|
|
|
DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
|
|
|
|
ARG_ENABLE("security-flags", "Disable the compiler security flags", "yes");
|
|
if (PHP_SECURITY_FLAGS == "yes") {
|
|
ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
|
|
}
|
|
|
|
/* 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") {
|
|
ADD_FLAG("CFLAGS", " /analyze ");
|
|
ADD_FLAG("CFLAGS", " /wd6308 ");
|
|
} 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");
|
|
}
|
|
} else {
|
|
PHP_ANALYZER = "no"
|
|
}
|
|
|
|
if (CLANG_TOOLSET) {
|
|
ARG_WITH("uncritical-warn-choke", "Disable some uncritical warnings", "yes");
|
|
if (PHP_UNCRITICAL_WARN_CHOKE != "no") {
|
|
ADD_FLAG("CFLAGS", "-Wno-ignored-attributes -Wno-deprecated-declarations -Wno-missing-braces \
|
|
-Wno-logical-op-parentheses -Wno-msvc-include -Wno-invalid-source-encoding -Wno-unknown-pragmas");
|
|
}
|
|
}
|
|
|
|
ARG_WITH("codegen-arch", "Architecture for code generation: ia32, sse, sse2, avx, avx2", "no");
|
|
toolset_setup_codegen_arch();
|
|
|
|
ARG_WITH("all-shared", "Force all the non obligatory extensions to be shared", "no");
|
|
|