@@ -53,6 +53,9 @@ var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32";
53
53
and manifest. */
54
54
var WINVER = "0x0601" ; /* 7/2008r2 */
55
55
56
+ // There's a minimum requirement for bison.
57
+ var MINBISON = "3.0.0" ;
58
+
56
59
// There's a minimum requirement for re2c..
57
60
var MINRE2C = "0.13.4" ;
58
61
@@ -180,6 +183,8 @@ function probe_binary(EXE, what)
180
183
var command = 'cmd /c ""' + EXE ;
181
184
if ( what == "version" ) {
182
185
command = command + '" -v"' ;
186
+ } else if ( what == "longversion" ) {
187
+ command = command + '" --version"' ;
183
188
}
184
189
var version = execute ( command + '" 2>&1"' ) ;
185
190
@@ -2985,7 +2990,26 @@ function toolset_setup_project_tools()
2985
2990
// we don't want to define LIB, as that will override the default library path
2986
2991
// that is set in that env var
2987
2992
PATH_PROG ( 'lib' , null , 'MAKE_LIB' ) ;
2988
- if ( ! PATH_PROG ( 'bison' ) ) {
2993
+
2994
+ var BISON = PATH_PROG ( 'bison' ) ;
2995
+ if ( BISON ) {
2996
+ var BISONVERS = probe_binary ( BISON , "longversion" ) ;
2997
+ STDOUT . WriteLine ( ' Detected bison version ' + BISONVERS ) ;
2998
+
2999
+ if ( BISONVERS . match ( / ^ \d + .\d + $ / ) ) {
3000
+ BISONVERS += ".0" ;
3001
+ }
3002
+
3003
+ var hm = BISONVERS . match ( / ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
3004
+ var nm = MINBISON . match ( / ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
3005
+
3006
+ var intvers = ( hm [ 1 ] - 0 ) * 10000 + ( hm [ 2 ] - 0 ) * 100 + ( hm [ 3 ] - 0 ) ;
3007
+ var intmin = ( nm [ 1 ] - 0 ) * 10000 + ( nm [ 2 ] - 0 ) * 100 + ( nm [ 3 ] - 0 ) ;
3008
+
3009
+ if ( intvers < intmin ) {
3010
+ ERROR ( 'The minimum bison version requirement is ' + MINBISON ) ;
3011
+ }
3012
+ } else {
2989
3013
ERROR ( 'bison is required' )
2990
3014
}
2991
3015
0 commit comments