Skip to content

Commit f21c054

Browse files
committed
Add bison version check to configure
Since we're already checking for the minimum required re2c version, also checking for the minimum required bison version is sensible.
1 parent e072537 commit f21c054

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
@@ -52,6 +52,9 @@ var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32";
5252
and manifest. */
5353
var WINVER = "0x0601"; /* 7/2008r2 */
5454

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

@@ -176,6 +179,8 @@ function probe_binary(EXE, what)
176179
var command = 'cmd /c ""' + EXE;
177180
if (what == "version") {
178181
command = command + '" -v"';
182+
} else if (what == "longversion") {
183+
command = command + '" --version"';
179184
}
180185
var version = execute(command + '" 2>&1"');
181186

@@ -2903,7 +2908,26 @@ function toolset_setup_project_tools()
29032908
// we don't want to define LIB, as that will override the default library path
29042909
// that is set in that env var
29052910
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 {
29072931
ERROR('bison is required')
29082932
}
29092933

0 commit comments

Comments
 (0)