@@ -52,6 +52,9 @@ var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32";
52
52
and manifest. */
53
53
var WINVER = "0x0601" ; /* 7/2008r2 */
54
54
55
+ // There's a minimum requirement for bison.
56
+ var MINBISON = "3.0.0" ;
57
+
55
58
// There's a minimum requirement for re2c..
56
59
var MINRE2C = "0.13.4" ;
57
60
@@ -176,6 +179,8 @@ function probe_binary(EXE, what)
176
179
var command = 'cmd /c ""' + EXE ;
177
180
if ( what == "version" ) {
178
181
command = command + '" -v"' ;
182
+ } else if ( what == "longversion" ) {
183
+ command = command + '" --version"' ;
179
184
}
180
185
var version = execute ( command + '" 2>&1"' ) ;
181
186
@@ -2903,7 +2908,26 @@ function toolset_setup_project_tools()
2903
2908
// we don't want to define LIB, as that will override the default library path
2904
2909
// that is set in that env var
2905
2910
PATH_PROG ( 'lib' , null , 'MAKE_LIB' ) ;
2906
- if ( ! PATH_PROG ( 'bison' ) ) {
2911
+
2912
+ var BISON = PATH_PROG ( 'bison' ) ;
2913
+ if ( BISON ) {
2914
+ var BISONVERS = probe_binary ( BISON , "longversion" ) ;
2915
+ STDOUT . WriteLine ( ' Detected bison version ' + BISONVERS ) ;
2916
+
2917
+ if ( BISONVERS . match ( / ^ \d + .\d + $ / ) ) {
2918
+ BISONVERS += ".0" ;
2919
+ }
2920
+
2921
+ var hm = BISONVERS . match ( / ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
2922
+ var nm = MINBISON . match ( / ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
2923
+
2924
+ var intvers = ( hm [ 1 ] - 0 ) * 10000 + ( hm [ 2 ] - 0 ) * 100 + ( hm [ 3 ] - 0 ) ;
2925
+ var intmin = ( nm [ 1 ] - 0 ) * 10000 + ( nm [ 2 ] - 0 ) * 100 + ( nm [ 3 ] - 0 ) ;
2926
+
2927
+ if ( intvers < intmin ) {
2928
+ ERROR ( 'The minimum bison version requirement is ' + MINBISON ) ;
2929
+ }
2930
+ } else {
2907
2931
ERROR ( 'bison is required' )
2908
2932
}
2909
2933
0 commit comments