@@ -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
@@ -3010,7 +3015,26 @@ function toolset_setup_project_tools()
3010
3015
// we don't want to define LIB, as that will override the default library path
3011
3016
// that is set in that env var
3012
3017
PATH_PROG ( 'lib' , null , 'MAKE_LIB' ) ;
3013
- if ( ! PATH_PROG ( 'bison' ) ) {
3018
+
3019
+ var BISON = PATH_PROG ( 'bison' ) ;
3020
+ if ( BISON ) {
3021
+ var BISONVERS = probe_binary ( BISON , "longversion" ) ;
3022
+ STDOUT . WriteLine ( ' Detected bison version ' + BISONVERS ) ;
3023
+
3024
+ if ( BISONVERS . match ( / ^ \d + .\d + $ / ) ) {
3025
+ BISONVERS += ".0" ;
3026
+ }
3027
+
3028
+ var hm = BISONVERS . match ( / ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
3029
+ var nm = MINBISON . match ( / ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
3030
+
3031
+ var intvers = ( hm [ 1 ] - 0 ) * 10000 + ( hm [ 2 ] - 0 ) * 100 + ( hm [ 3 ] - 0 ) ;
3032
+ var intmin = ( nm [ 1 ] - 0 ) * 10000 + ( nm [ 2 ] - 0 ) * 100 + ( nm [ 3 ] - 0 ) ;
3033
+
3034
+ if ( intvers < intmin ) {
3035
+ ERROR ( 'The minimum bison version requirement is ' + MINBISON ) ;
3036
+ }
3037
+ } else {
3014
3038
ERROR ( 'bison is required' )
3015
3039
}
3016
3040
0 commit comments