// equivalent.
ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, intel", "vs");
-if ("clang" == PHP_TOOLSET) {
- VS_TOOLSET = false;
- CLANG_TOOLSET = true;
- INTEL_TOOLSET = false;
-} else if ("intel" == PHP_TOOLSET) {
- VS_TOOLSET = false;
- CLANG_TOOLSET = false;
- INTEL_TOOLSET = true;
-} 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;
-}
-
+toolset_option_handle();
ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
-PHP_CL = toolset_get_compiler();
-if (!PHP_CL) {
- ERROR("MS C++ compiler is required");
-}
-
-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");
- }
-
- 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) {
- 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 */
-}
-STDOUT.WriteLine(" Detected compiler " + COMPILER_NAME);
+toolset_setup_compiler();
// do we use x64 or 80x86 version of compiler?
X64 = toolset_is_64();
AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
-// cygwin now ships with link.exe. Avoid searching the cygwin path
-// for this, as we want the MS linker, not the fileutil
-toolset_get_linker();
-
-PATH_PROG('nmake');
-
-// 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');
-if (!PATH_PROG('bison')) {
- ERROR('bison is required')
-}
-
-// There's a minimum requirement for re2c..
-MINRE2C = "0.13.4";
-
-RE2C = PATH_PROG('re2c');
-if (RE2C) {
- var intvers, intmin;
- var pattern = /\./g;
-
- RE2CVERS = probe_binary(RE2C, "version");
- STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
-
- intvers = RE2CVERS.replace(pattern, '') - 0;
- intmin = MINRE2C.replace(pattern, '') - 0;
-
- if (intvers < intmin) {
- STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
- 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');
-}
-PATH_PROG('zip');
-PATH_PROG('lemon');
-
-// avoid picking up midnight commander from cygwin
-PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
-
-// Try locating manifest tool
-if (VS_TOOLSET && VCVERS > 1200) {
- PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
-}
+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', '');
// General CFLAGS for building objects
DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS \
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
+if (VS_TOOLSET) {
+ ADD_FLAG("CFLAGS", " /FD ");
+}
+
if (CLANG_TOOLSET) {
if (X64) {
ADD_FLAG('CFLAGS', ' -m64 ');
zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
zend_inheritance.c");
+/* XXX inspect this for other toolsets */
if (VS_TOOLSET && VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
}
// "Master" config file; think of it as a configure.in\r
// equivalent.\r
\r
+ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, intel", "vs");\r
+toolset_option_handle()\r
+\r
var PHP_CYGWIN="notset";\r
-PHP_CL = PATH_PROG('cl', null, 'PHP_CL');\r
-if (!PHP_CL) {\r
- ERROR("MS C++ compiler is required");\r
-}\r
-/* For the record here: */\r
-// 1200 is VC6\r
-// 1300 is vs.net 2002\r
-// 1310 is vs.net 2003\r
-// 1400 is vs.net 2005\r
-// 1500 is vs.net 2008\r
-// 1600 is vs.net 2010\r
-// Which version of the compiler do we have?\r
-VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');\r
-STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);\r
-\r
-if (VCVERS < 1500) {\r
- ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");\r
-}\r
\r
-AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");\r
-DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);\r
-AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");\r
+toolset_setup_compiler();\r
\r
// do we use x64 or 80x86 version of compiler?\r
-X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');\r
+X64 = toolset_is_64();\r
if (X64) {\r
STDOUT.WriteLine(" Detected 64-bit compiler");\r
} else {\r
AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");\r
DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');\r
\r
-// cygwin now ships with link.exe. Avoid searching the cygwin path\r
-// for this, as we want the MS linker, not the fileutil\r
-PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));\r
-PATH_PROG('nmake');\r
-\r
-// we don't want to define LIB, as that will override the default library path\r
-// that is set in that env var\r
-PATH_PROG('lib', null, 'MAKE_LIB');\r
-if (!PATH_PROG('bison')) {\r
- ERROR('bison is required')\r
-}\r
-\r
-// There's a minimum requirement for re2c..\r
-MINRE2C = "0.13.4";\r
-\r
-RE2C = PATH_PROG('re2c');\r
-if (RE2C) {\r
- var intvers, intmin;\r
- var pattern = /\./g;\r
-\r
- RE2CVERS = probe_binary(RE2C, "version");\r
- STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);\r
-\r
- intvers = RE2CVERS.replace(pattern, '') - 0;\r
- intmin = MINRE2C.replace(pattern, '') - 0;\r
-\r
- if (intvers < intmin) {\r
- STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);\r
- STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');\r
- DEFINE('RE2C', '');\r
- } else {\r
- DEFINE('RE2C_FLAGS', '');\r
- }\r
-} else {\r
- STDOUT.WriteLine('Parsers will not be regenerated');\r
-}\r
-PATH_PROG('zip');\r
-PATH_PROG('lemon');\r
-\r
-// avoid picking up midnight commander from cygwin\r
-PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));\r
-\r
-// Try locating manifest tool\r
-if (VCVERS > 1200) {\r
- PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));\r
-}\r
+toolset_setup_linker();\r
+toolset_setup_project_tools();\r
\r
// stick objects somewhere outside of the source tree\r
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');\r
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');\r
\r
// General CFLAGS for building objects\r
-DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \\r
+DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS \\r
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");\r
+if (VS_TOOLSET) {\r
+ ADD_FLAG("CFLAGS", " /FD ");\r
+}\r
\r
-if (VCVERS < 1400) {\r
+if (VS_TOOLSET && VCVERS < 1400) {\r
// Enable automatic precompiled headers\r
ADD_FLAG('CFLAGS', ' /YX ');\r
\r
}\r
}\r
\r
-if (VCVERS >= 1400) {\r
+if (VS_TOOLSET && VCVERS >= 1400) {\r
// fun stuff: MS deprecated ANSI stdio and similar functions\r
// disable annoying warnings. In addition, time_t defaults\r
// to 64-bit. Ask for 32-bit.\r
ARG_WITH('prefix', 'PHP installation prefix', '');\r
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');\r
var PHP_MP_DISABLED = true;\r
-if (VCVERS >= 1500 && PHP_MP != 'disable') {\r
+if (VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable') {\r
// no from disable-all \r
if(PHP_MP == 'auto' || PHP_MP == 'no') {\r
ADD_FLAG('CFLAGS', ' /MP ');\r
STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));\r
\r
\r
-if (VCVERS == 1200) {\r
+/* XXX inspect this for other toolsets */\r
+if (VS_TOOLSET && VCVERS == 1200) {\r
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);\r
}\r
\r
-if (VCVERS >= 1400) {\r
+if (INTEL_TOOLSET || VS_TOOLSET && VCVERS >= 1400) {\r
AC_DEFINE('HAVE_STRNLEN', 1);\r
}\r
\r
var COMPILER_NUMERIC_VERSION = -1;
var COMPILER_NAME = "unknown";
+// There's a minimum requirement for re2c..
+var MINRE2C = "0.13.4";
+
/* Store the enabled extensions (summary + QA check) */
var extensions_enabled = new Array();
ARG_ENABLE('one-shot', 'Optimize for fast build - best for release and snapshot builders, not so hot for edit-and-rebuild hacking', 'no');
}
+
+function toolset_option_handle()
+{
+ if ("clang" == PHP_TOOLSET) {
+ VS_TOOLSET = false;
+ CLANG_TOOLSET = true;
+ INTEL_TOOLSET = false;
+ } else if ("intel" == PHP_TOOLSET) {
+ VS_TOOLSET = false;
+ CLANG_TOOLSET = false;
+ INTEL_TOOLSET = true;
+ } 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;
+ }
+}
+
+function toolset_setup_compiler()
+{
+ PHP_CL = toolset_get_compiler();
+ if (!PHP_CL) {
+ ERROR("Compiler not found");
+ }
+
+ 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");
+ }
+
+ 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) {
+ 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 */
+ }
+ STDOUT.WriteLine(" Detected compiler " + COMPILER_NAME);
+}
+
+function toolset_setup_project_tools()
+{
+ PATH_PROG('nmake');
+
+ // 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');
+ if (!PATH_PROG('bison')) {
+ ERROR('bison is required')
+ }
+
+ RE2C = PATH_PROG('re2c');
+ if (RE2C) {
+ var intvers, intmin;
+ var pattern = /\./g;
+
+ RE2CVERS = probe_binary(RE2C, "version");
+ STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
+
+ intvers = RE2CVERS.replace(pattern, '') - 0;
+ intmin = MINRE2C.replace(pattern, '') - 0;
+
+ if (intvers < intmin) {
+ STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
+ 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');
+ }
+ PATH_PROG('zip');
+ PATH_PROG('lemon');
+
+ // avoid picking up midnight commander from cygwin
+ PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
+
+ // Try locating manifest tool
+ if (VS_TOOLSET && VCVERS > 1200) {
+ PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
+ }
+}
+
function toolset_get_compiler()
{
if (VS_TOOLSET) {
return PATH_PROG('icl', null, 'PHP_CL')
}
- ERROR("Wrong toolset");
+ ERROR("Unsupported toolset");
}
function toolset_get_compiler_version()
}
}
- ERROR("Failed to parse compiler out for compiler version");
+ ERROR("Failed to parse compiler version or unsupported toolset");
}
function toolset_get_compiler_name()
return full.split(/\n/)[0].replace(/\s/g, ' ');
}
- ERROR("Wrong toolset");
+ WARNING("Unsupported toolset");
}
return null != full.match(/Intel\(R\) 64/);
}
- ERROR("Wrong toolset");
+ ERROR("Unsupported toolset");
}
-function toolset_get_linker()
+function toolset_setup_linker()
{
if (VS_TOOLSET) {
return PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
return PATH_PROG('xilink', WshShell.Environment("Process").Item("PATH"), "LINK");
}
- ERROR("Wrong toolset");
+ ERROR("Unsupported toolset");
}
-