1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
// vim:ft=javascript
// $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $
// "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()
var PHP_CYGWIN="notset";
toolset_setup_compiler();
// do we use x64 or 80x86 version of compiler?
X64 = toolset_is_64();
if (X64) {
STDOUT.WriteLine(" Detected 64-bit compiler");
} else {
STDOUT.WriteLine(" Detected 32-bit compiler");
}
AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
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_PREFIX == '') {
PHP_PREFIX = "C:\\php";
if (PHP_DEBUG == "yes")
PHP_PREFIX += "\\debug";
}
DEFINE('PHP_PREFIX', PHP_PREFIX);
DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
toolset_setup_common_cflags();
ARG_WITH('prefix', 'PHP installation prefix', '');
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
var PHP_MP_DISABLED = true;
if (VS_TOOLSET && VCVERS >= 1500 && 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);
}
}
}
/* 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");
// General link flags
toolset_setup_common_ldlags();
// General libs
toolset_setup_common_libs();
// Set some debug/release specific options
toolset_setup_build_mode();
if (PHP_ZTS == "yes") {
ADD_FLAG("CFLAGS", "/D ZTS=1");
}
DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
// set up the build dir and DLL name
if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
if (!MODE_PHPIZE) {
DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
}
} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
if (!MODE_PHPIZE) {
DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
}
} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
if (!MODE_PHPIZE) {
DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
}
} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
if (!MODE_PHPIZE) {
DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
}
}
if (MODE_PHPIZE) {
DEFINE("PHPDLL", PHP_DLL);
DEFINE("PHPLIB", PHP_DLL_LIB);
}
// 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');
if (PHP_PHP_BUILD == 'no') {
if (FSO.FolderExists("..\\deps")) {
PHP_PHP_BUILD = "..\\deps";
} else {
if (FSO.FolderExists("..\\php_build")) {
PHP_PHP_BUILD = "..\\php_build";
} else {
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";
}
}
}
}
PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
}
DEFINE("PHP_BUILD", PHP_PHP_BUILD);
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 + '\\"" ');
// 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";
}
}
function add_extra_dirs()
{
var path, i, f;
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 + '" ');
}
}
}
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)) {
if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
} else {
ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
}
}
}
}
}
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'));
/* XXX inspect this for other toolsets */
if (VS_TOOLSET && VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
}
if (ICC_TOOLSET || VS_TOOLSET && VCVERS >= 1400) {
AC_DEFINE('HAVE_STRNLEN', 1);
}
STDOUT.WriteBlankLines(1);
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);
AC_DEFINE("PHP_DIR", PHP_DIR);
DEFINE("PHP_DIR", PHP_DIR);
|