3
3
// "Master" config file; think of it as a configure.in
4
4
// equivalent.
5
5
6
+ ARG_WITH ( "toolset" , "Toolset to use for the compilation, supported: vs, clang, intel" , "vs" ) ;
7
+ toolset_option_handle ( )
8
+
6
9
var PHP_CYGWIN = "notset" ;
7
- PHP_CL = PATH_PROG ( 'cl' , null , 'PHP_CL' ) ;
8
- if ( ! PHP_CL ) {
9
- ERROR ( "MS C++ compiler is required" ) ;
10
- }
11
- /* For the record here: */
12
- // 1200 is VC6
13
- // 1300 is vs.net 2002
14
- // 1310 is vs.net 2003
15
- // 1400 is vs.net 2005
16
- // 1500 is vs.net 2008
17
- // 1600 is vs.net 2010
18
- // Which version of the compiler do we have?
19
- VCVERS = probe_binary ( PHP_CL ) . substr ( 0 , 5 ) . replace ( '.' , '' ) ;
20
- STDOUT . WriteLine ( " Detected compiler " + VC_VERSIONS [ VCVERS ] ) ;
21
-
22
- if ( VCVERS < 1500 ) {
23
- ERROR ( "Unsupported MS C++ Compiler, VC9 (2008) minimum is required" ) ;
24
- }
25
10
26
- AC_DEFINE ( 'COMPILER' , VC_VERSIONS [ VCVERS ] , "Detected compiler version" ) ;
27
- DEFINE ( "PHP_COMPILER_SHORT" , VC_VERSIONS_SHORT [ VCVERS ] ) ;
28
- AC_DEFINE ( 'PHP_COMPILER_ID' , VC_VERSIONS_SHORT [ VCVERS ] , "Compiler compatibility ID" ) ;
11
+ toolset_setup_compiler ( ) ;
29
12
30
13
// do we use x64 or 80x86 version of compiler?
31
- X64 = probe_binary ( PHP_CL , 64 , null , 'PHP_CL' ) ;
14
+ X64 = toolset_is_64 ( ) ;
32
15
if ( X64 ) {
33
16
STDOUT . WriteLine ( " Detected 64-bit compiler" ) ;
34
17
} else {
@@ -37,52 +20,8 @@ if (X64) {
37
20
AC_DEFINE ( 'ARCHITECTURE' , X64 ? 'x64' : 'x86' , "Detected compiler architecture" ) ;
38
21
DEFINE ( "PHP_ARCHITECTURE" , X64 ? 'x64' : 'x86' ) ;
39
22
40
- // cygwin now ships with link.exe. Avoid searching the cygwin path
41
- // for this, as we want the MS linker, not the fileutil
42
- PATH_PROG ( 'link' , WshShell . Environment ( "Process" ) . Item ( "PATH" ) ) ;
43
- PATH_PROG ( 'nmake' ) ;
44
-
45
- // we don't want to define LIB, as that will override the default library path
46
- // that is set in that env var
47
- PATH_PROG ( 'lib' , null , 'MAKE_LIB' ) ;
48
- if ( ! PATH_PROG ( 'bison' ) ) {
49
- ERROR ( 'bison is required' )
50
- }
51
-
52
- // There's a minimum requirement for re2c..
53
- MINRE2C = "0.13.4" ;
54
-
55
- RE2C = PATH_PROG ( 're2c' ) ;
56
- if ( RE2C ) {
57
- var intvers , intmin ;
58
- var pattern = / \. / g;
59
-
60
- RE2CVERS = probe_binary ( RE2C , "version" ) ;
61
- STDOUT . WriteLine ( ' Detected re2c version ' + RE2CVERS ) ;
62
-
63
- intvers = RE2CVERS . replace ( pattern , '' ) - 0 ;
64
- intmin = MINRE2C . replace ( pattern , '' ) - 0 ;
65
-
66
- if ( intvers < intmin ) {
67
- STDOUT . WriteLine ( 'WARNING: The minimum RE2C version requirement is ' + MINRE2C ) ;
68
- STDOUT . WriteLine ( 'Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c' ) ;
69
- DEFINE ( 'RE2C' , '' ) ;
70
- } else {
71
- DEFINE ( 'RE2C_FLAGS' , '' ) ;
72
- }
73
- } else {
74
- STDOUT . WriteLine ( 'Parsers will not be regenerated' ) ;
75
- }
76
- PATH_PROG ( 'zip' ) ;
77
- PATH_PROG ( 'lemon' ) ;
78
-
79
- // avoid picking up midnight commander from cygwin
80
- PATH_PROG ( 'mc' , WshShell . Environment ( "Process" ) . Item ( "PATH" ) ) ;
81
-
82
- // Try locating manifest tool
83
- if ( VCVERS > 1200 ) {
84
- PATH_PROG ( 'mt' , WshShell . Environment ( "Process" ) . Item ( "PATH" ) ) ;
85
- }
23
+ toolset_setup_linker ( ) ;
24
+ toolset_setup_project_tools ( ) ;
86
25
87
26
// stick objects somewhere outside of the source tree
88
27
ARG_ENABLE ( 'object-out-dir' , 'Alternate location for binary objects during build' , '' ) ;
@@ -121,10 +60,13 @@ DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
121
60
DEFINE ( 'CFLAGS_PHP_OBJ' , '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)' ) ;
122
61
123
62
// General CFLAGS for building objects
124
- DEFINE ( "CFLAGS" , "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
63
+ DEFINE ( "CFLAGS" , "/nologo $(BASE_INCLUDES) /D _WINDOWS \
125
64
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 " ) ;
65
+ if ( VS_TOOLSET ) {
66
+ ADD_FLAG ( "CFLAGS" , " /FD " ) ;
67
+ }
126
68
127
- if ( VCVERS < 1400 ) {
69
+ if ( VS_TOOLSET && VCVERS < 1400 ) {
128
70
// Enable automatic precompiled headers
129
71
ADD_FLAG ( 'CFLAGS' , ' /YX ' ) ;
130
72
@@ -134,7 +76,7 @@ if (VCVERS < 1400) {
134
76
}
135
77
}
136
78
137
- if ( VCVERS >= 1400 ) {
79
+ if ( VS_TOOLSET && VCVERS >= 1400 ) {
138
80
// fun stuff: MS deprecated ANSI stdio and similar functions
139
81
// disable annoying warnings. In addition, time_t defaults
140
82
// to 64-bit. Ask for 32-bit.
@@ -153,7 +95,7 @@ if (VCVERS >= 1400) {
153
95
ARG_WITH ( 'prefix' , 'PHP installation prefix' , '' ) ;
154
96
ARG_WITH ( 'mp' , 'Tell Visual Studio use up to [n,auto,disable] processes for compilation' , 'auto' ) ;
155
97
var PHP_MP_DISABLED = true ;
156
- if ( VCVERS >= 1500 && PHP_MP != 'disable' ) {
98
+ if ( VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable' ) {
157
99
// no from disable-all
158
100
if ( PHP_MP == 'auto' || PHP_MP == 'no' ) {
159
101
ADD_FLAG ( 'CFLAGS' , ' /MP ' ) ;
@@ -334,11 +276,12 @@ STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
334
276
STDOUT . WriteLine ( "PHP Core: " + get_define ( 'PHPDLL' ) + " and " + get_define ( 'PHPLIB' ) ) ;
335
277
336
278
337
- if ( VCVERS == 1200 ) {
279
+ /* XXX inspect this for other toolsets */
280
+ if ( VS_TOOLSET && VCVERS == 1200 ) {
338
281
AC_DEFINE ( 'ZEND_DVAL_TO_LVAL_CAST_OK' , 1 ) ;
339
282
}
340
283
341
- if ( VCVERS >= 1400 ) {
284
+ if ( INTEL_TOOLSET || VS_TOOLSET && VCVERS >= 1400 ) {
342
285
AC_DEFINE ( 'HAVE_STRNLEN' , 1 ) ;
343
286
}
344
287
0 commit comments