From: Hartmut Holzgraefe Date: Sun, 29 May 2005 18:04:35 +0000 (+0000) Subject: avoid code duplication in bison version test X-Git-Tag: php-5.0.1b1~145 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af14bbe455980e13caaabe311a235157daf2354e;p=php avoid code duplication in bison version test --- diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 83619bc62c..233fe683c9 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -4,25 +4,6 @@ dnl dnl This file contains Zend specific autoconf functions. dnl -AC_DEFUN([LIBZEND_BISON_CHECK],[ - if test "$YACC" = "bison -y"; then - AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ - set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /' | tr -d 'a-z'` - if test "${1}" = "1" -a "${2}" -lt "28"; then - php_cv_bison_version=invalid - else - php_cv_bison_version="${1}.${2} (ok)" - fi - ]) - fi - case $php_cv_bison_version in - ""|invalid[)] - AC_MSG_WARN([You will need bison 1.28, 1.35, 1.75 or 1.875 if you want to regenerate the Zend parsers (found ${1}.${2}).]) - YACC="exit 0;" - ;; - esac -]) - AC_DEFUN([LIBZEND_CHECK_INT_TYPE],[ AC_MSG_CHECKING(for $1) AC_TRY_COMPILE([ diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 480e24e0b1..aa78edc7c6 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -2,6 +2,31 @@ dnl $Id$ dnl dnl This file contains local autoconf functions. +AC_DEFUN([LIBZEND_BISON_CHECK],[ + # we only support certain bison versions + bison_version_list="1.28 1.35 1.75 2.0" + + if test "$YACC" = "bison -y"; then + AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ + set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /'|tr -d a-z` + bison_version="${1}.${2}" + php_cv_bison_version=invalid + 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)" + fi + done + ]) + 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)." + AC_MSG_WARN([$bison_msg]) + YACC="exit 0;" + ;; + esac +]) + AC_DEFUN([ZEND_FP_EXCEPT],[ AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[ AC_TRY_COMPILE([ diff --git a/acinclude.m4 b/acinclude.m4 index 82def04b9f..3af01d0b0e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1941,22 +1941,7 @@ dnl Search for bison and check it's version dnl AC_DEFUN([PHP_PROG_BISON], [ AC_PROG_YACC - if test "$YACC" = "bison -y"; then - AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ - set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /'|tr -d a-z` - if test "(" "${1}" = "1" -a "(" "${2}" = "28" -o "${2}" = "35" -o "${2}" = "75" -o "${2}" = "875" ")" ")" -o "(" "${1}" = "2" -a "(" "${2}" = "0" ")" ")"; then - php_cv_bison_version="${1}.${2} (ok)" - else - php_cv_bison_version=invalid - fi - ]) - fi - case $php_cv_bison_version in - ""|invalid[)] - AC_MSG_WARN([You will need bison 1.28, 1.35, 1.75, 1.875 or 2.0 if you want to regenerate the Zend/PHP parsers (found ${1}.${2}).]) - YACC="exit 0;" - ;; - esac + LIBZEND_BISON_CHECK PHP_SUBST(YACC) ]) diff --git a/configure.in b/configure.in index 2e30c41d3d..1a4acbc68a 100644 --- a/configure.in +++ b/configure.in @@ -23,6 +23,9 @@ dnl ## In diversion 5 we check which extensions should be compiled. dnl ## All of these are normally in the extension directories. dnl ## Diversion 5 is the last one. Here we generate files and clean up. +dnl include Zend specific macro definitions first +dnl ------------------------------------------------------------------------- +sinclude(Zend/acinclude.m4) dnl Basic autoconf + automake initialization, generation of config.nice. dnl ------------------------------------------------------------------------- @@ -192,7 +195,6 @@ esac dnl Include Zend and TSRM configurations. dnl ------------------------------------------------------------------------- -sinclude(Zend/acinclude.m4) sinclude(Zend/Zend.m4) sinclude(TSRM/tsrm.m4)