com php-src: Add bison version check to configure: win32/build/confutils.js
| From: | Christoph Michael Becker | Date: | Mon, 18 Mar 2019 14:02:52 +0000 |
| Subject: | com php-src: Add bison version check to configure: win32/build/confutils.js | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105217@lists.php.net to get a copy of this message | ||
Commit: f21c0549030762f8403f57eef375af9f946133e7
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 18 Mar 2019 12:27:29 +0100
Parents: e072537e7f7dfd1de0a10172b80dba79a525dc72
Branches: PHP-7.2 PHP-7..3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f21c0549030762f8403f57eef375af9f946133e7
Log:
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.
Changed paths:
M win32/build/confutils.js
Diff:
diff --git a/win32/build/confutils.js b/win32/build/confutils..js
index d943453..1158303 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -52,6 +52,9 @@ var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32";
and manifest. */
var WINVER = "0x0601"; /* 7/2008r2 */
+// There's a minimum requirement for bison.
+var MINBISON = "3.0.0";
+
// There's a minimum requirement for re2c..
var MINRE2C = "0.13.4";
@@ -176,6 +179,8 @@ function probe_binary(EXE, what)
var command = 'cmd /c ""' + EXE;
if (what == "version") {
command = command + '" -v"';
+ } else if (what == "longversion") {
+ command = command + '" --version"';
}
var version = execute(command + '" 2>&1"');
@@ -2903,7 +2908,26 @@ function toolset_setup_project_tools()
// we don't want to define LIB, as that will override the default library path
// that is set in that env var
PATH_PROG('lib', null, 'MAKE_LIB');
- if (!PATH_PROG('bison')) {
+
+ var BISON = PATH_PROG('bison');
+ if (BISON) {
+ var BISONVERS = probe_binary(BISON, "longversion");
+ STDOUT.WriteLine(' Detected bison version ' + BISONVERS);
+
+ if (BISONVERS.match(/^\d+.\d+$/)) {
+ BISONVERS += ".0";
+ }
+
+ var hm = BISONVERS.match(/(\d+)\..(\d+)\.(\d+)/);
+ var nm = MINBISON.match(/(\d+)\.(\d+)\.(\d+)/);
+
+ var intvers = (hm[1]-0)*10000 + (hm[2]-0)*100 + (hm[3]-0);
+ var intmin = (nm[1]-0)*10000 + (nm[2]-0)*100 + (nm[3]-0);
+
+ if (intvers < intmin) {
+ ERROR('The minimum bison version requirement is ' + MINBISON);
+ }
+ } else {
ERROR('bison is required')
}