Browse Source

avoid code duplication in bison version test

PHP-5.1
Hartmut Holzgraefe 21 years ago
parent
commit
af14bbe455
  1. 19
      Zend/Zend.m4
  2. 25
      Zend/acinclude.m4
  3. 17
      acinclude.m4
  4. 4
      configure.in

19
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([

25
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([

17
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)
])

4
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)

Loading…
Cancel
Save