From 3e41201a6fec870f89c1129d1c5b3544fd3f2ac0 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 8 Aug 2013 14:27:32 +0200 Subject: [PATCH 1/5] make the bison version check a blacklist Let the bison version be checked by a blacklist (where no version is blacklisted yet) and require at least bison 2.4 --- Zend/acinclude.m4 | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 454513f68cf8..11cdbf7aea23 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -3,8 +3,9 @@ dnl dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ - # we only support certain bison versions - bison_version_list="2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7" + # we only support certain bison versions, min: 2.4 + bison_version_min="204" + bison_version_exclude="" # for standalone build of Zend Engine test -z "$SED" && SED=sed @@ -12,23 +13,27 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[ bison_version=none if test "$YACC"; then AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ - bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z` + bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z` php_cv_bison_version=invalid if test -n "$bison_version_vars"; then set $bison_version_vars bison_version="${1}.${2}" - for bison_check_version in $bison_version_list; do - if test "$bison_version" = "$bison_check_version"; then - php_cv_bison_version="$bison_check_version (ok)" - break - fi - done + bison_version_num="`expr ${1} \* 100 + ${2}`" + if test $bison_version_num -ge $bison_version_min; then + php_cv_bison_version="$bison_version (ok)" + for bison_check_version in $bison_version_exclude; do + if test "$bison_version" = "$bison_check_version"; then + php_cv_bison_version=invalid + break + fi + done + fi fi ]) fi case $php_cv_bison_version in ""|invalid[)] - bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)." + bison_msg="This bison version is not supported for regeneration of the Zend/PHP parsers (found: $bison_version, min: $bison_version_min, excluded: $bison_version_exclude)." AC_MSG_WARN([$bison_msg]) YACC="exit 0;" ;; From 3903c182da6163e410c1c7692cc6358cab4e02ff Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 8 Aug 2013 21:45:08 +0200 Subject: [PATCH 2/5] add excluded version exmaple --- Zend/acinclude.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 11cdbf7aea23..cec832fccb9f 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -5,6 +5,7 @@ dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ # we only support certain bison versions, min: 2.4 bison_version_min="204" + # non-working versions, e.g. "3.0 3.2" bison_version_exclude="" # for standalone build of Zend Engine From 1e30987a5303be9a3658625fee1527e148600929 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 9 Aug 2013 08:30:50 +0200 Subject: [PATCH 3/5] improve comments and messages as suggested --- Zend/acinclude.m4 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index cec832fccb9f..db6aee2f4af3 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -3,10 +3,13 @@ dnl dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ - # we only support certain bison versions, min: 2.4 + # we only support certain bison versions; + # min: 2.4 (i.e. 204, major * 100 + minor for easier comparison) bison_version_min="204" - # non-working versions, e.g. "3.0 3.2" - bison_version_exclude="" + # non-working versions, e.g. "3.0 3.2"; + # remove "none" when introducing the first incompatible bison version an + # separate any following additions by spaces + bison_version_exclude="none" # for standalone build of Zend Engine test -z "$SED" && SED=sed From 742a0106fefefe5ee1638271a1f59b69fb0ba015 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 9 Aug 2013 08:32:39 +0200 Subject: [PATCH 4/5] use $YACC instead of 'bison' as suggested by Yasuo --- Zend/acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index db6aee2f4af3..fe3ab63beb4c 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -17,7 +17,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[ bison_version=none if test "$YACC"; then AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ - bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z` + bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z` php_cv_bison_version=invalid if test -n "$bison_version_vars"; then set $bison_version_vars From 3419ee95477139dc8f8ae22052b40f03d739b79e Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 9 Aug 2013 22:23:35 +0200 Subject: [PATCH 5/5] bison upgrading notes --- UPGRADING.INTERNALS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index cfc19d515d77..566f31099873 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -48,7 +48,9 @@ UPGRADE NOTES - PHP X.Y ======================== a. Unix build system changes - - + - The bison version check is now a blacklist instead of a whitelist. + - The bison binary can be specified through the YACC environment/configure + variable. Previously `bison` was assumed to be in $PATH. b. Windows build system changes -