]> granicus.if.org Git - php/commitdiff
avoid code duplication in bison version test
authorHartmut Holzgraefe <hholzgra@php.net>
Sun, 29 May 2005 18:04:35 +0000 (18:04 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Sun, 29 May 2005 18:04:35 +0000 (18:04 +0000)
Zend/Zend.m4
Zend/acinclude.m4
acinclude.m4
configure.in

index 83619bc62cf3b9a765a935bfebcd2e2cbec46420..233fe683c996604af95d51dbafc18d4663c7c04a 100644 (file)
@@ -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([
index 480e24e0b11ed9bf5baeb25b2277c630ef8f4107..aa78edc7c67ee5042dd917755b2862354bfa8029 100644 (file)
@@ -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([
index 82def04b9f22ec98ec9e17d3b4ac2935439cde55..3af01d0b0e7b1a6488dbc8e838f662bcaef1d1b7 100644 (file)
@@ -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)
 ])
 
index 2e30c41d3d802347399f7100c1e70e029543dbc9..1a4acbc68af769bc0da47eacf106d835ae1c8d4a 100644 (file)
@@ -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)