Skip to content

Commit 7ef2fa6

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Add bison version check to configure
2 parents ab8782d + f21c054 commit 7ef2fa6

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

win32/build/confutils.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32";
5353
and manifest. */
5454
var WINVER = "0x0601"; /* 7/2008r2 */
5555

56+
// There's a minimum requirement for bison.
57+
var MINBISON = "3.0.0";
58+
5659
// There's a minimum requirement for re2c..
5760
var MINRE2C = "0.13.4";
5861

@@ -180,6 +183,8 @@ function probe_binary(EXE, what)
180183
var command = 'cmd /c ""' + EXE;
181184
if (what == "version") {
182185
command = command + '" -v"';
186+
} else if (what == "longversion") {
187+
command = command + '" --version"';
183188
}
184189
var version = execute(command + '" 2>&1"');
185190

@@ -2985,7 +2990,26 @@ function toolset_setup_project_tools()
29852990
// we don't want to define LIB, as that will override the default library path
29862991
// that is set in that env var
29872992
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 {
29893013
ERROR('bison is required')
29903014
}
29913015

0 commit comments

Comments
 (0)