Skip to content

Commit 7cdb232

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Add bison version check to configure
2 parents 9ca9394 + 7ef2fa6 commit 7cdb232

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

@@ -3010,7 +3015,26 @@ function toolset_setup_project_tools()
30103015
// we don't want to define LIB, as that will override the default library path
30113016
// that is set in that env var
30123017
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 {
30143038
ERROR('bison is required')
30153039
}
30163040

0 commit comments

Comments
 (0)