]> granicus.if.org Git - php/commitdiff
MFH: sync acinclude.m4 (leave the PHP_PROG_LEX for BC!)
authorJani Taskinen <jani@php.net>
Mon, 21 Jul 2008 10:31:37 +0000 (10:31 +0000)
committerJani Taskinen <jani@php.net>
Mon, 21 Jul 2008 10:31:37 +0000 (10:31 +0000)
acinclude.m4

index 555ac3ba0f4b6da30d24d10cc46483bd2cf5193c..59eaed20174239f61bcda496c554bef07cdba010 100644 (file)
@@ -932,6 +932,8 @@ dnl a dynamically loadable library. Optional parameter "sapi_class" can
 dnl be set to "cli" to mark extension build only with CLI or CGI sapi's.
 dnl "extra-cflags" are passed to the compiler, with 
 dnl @ext_srcdir@ and @ext_builddir@ being substituted.
+dnl "cxx" can be used to indicate that a C++ shared module is desired.
+dnl "zend_ext" indicates a zend extension.
 AC_DEFUN([PHP_NEW_EXTENSION],[
   ext_builddir=[]PHP_EXT_BUILDDIR($1)
   ext_srcdir=[]PHP_EXT_SRCDIR($1)
@@ -2086,6 +2088,64 @@ AC_DEFUN([PHP_PROG_BISON], [
   PHP_SUBST(YACC)
 ])
 
+dnl
+dnl PHP_PROG_LEX
+dnl
+dnl Search for (f)lex and check it's version
+dnl
+AC_DEFUN([PHP_PROG_LEX], [
+dnl we only support certain flex versions
+  flex_version_list="2.5.4"
+   
+  AC_PROG_LEX
+  if test "$LEX" = "flex"; then
+dnl AC_DECL_YYTEXT is obsolete since autoconf 2.50 and merged into AC_PROG_LEX
+dnl this is what causes that annoying "PHP_PROG_LEX is expanded from" warning with autoconf 2.50+
+dnl it should be removed once we drop support of autoconf 2.13 (if ever)
+    AC_DECL_YYTEXT
+    :
+  fi
+  dnl ## Make flex scanners use const if they can, even if __STDC__ is not
+  dnl ## true, for compilers like Sun's that only set __STDC__ true in
+  dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
+  AC_C_CONST
+  if test "$ac_cv_c_const" = "yes" ; then
+    LEX_CFLAGS="-DYY_USE_CONST"
+  fi
+
+  if test "$LEX" = "flex"; then
+    AC_CACHE_CHECK([for flex version], php_cv_flex_version, [
+      flex_version=`$LEX -V -v --version 2>/dev/null | $SED -e 's/^.* //'`
+      php_cv_flex_version=invalid
+      for flex_check_version in $flex_version_list; do
+        if test "$flex_version" = "$flex_check_version"; then
+          php_cv_flex_version="$flex_check_version (ok)"
+        fi
+      done
+    ])
+  else
+    flex_version=none
+  fi
+  
+  case $php_cv_flex_version in
+    ""|invalid[)]
+      if test -f "$abs_srcdir/Zend/zend_language_scanner.c" && test -f "$abs_srcdir/Zend/zend_ini_scanner.c"; then
+        AC_MSG_WARN([flex versions supported for regeneration of the Zend/PHP parsers: $flex_version_list  (found: $flex_version)])
+      else
+        flex_msg="Supported flex versions are: $flex_version_list"
+        if test "$flex_version" = "none"; then
+          flex_msg="flex not found. flex is required to generate the Zend/PHP parsers! $flex_msg"
+        else
+          flex_msg="Found invalid flex version: $flex_version. $flex_msg"
+        fi
+        AC_MSG_ERROR([$flex_msg])
+      fi
+      LEX="exit 0;"
+      ;;
+  esac
+  PHP_SUBST(LEX)
+])
+
 dnl
 dnl PHP_PROG_RE2C
 dnl
@@ -2646,12 +2706,18 @@ AC_DEFUN([PHP_CHECK_CONFIGURE_OPTIONS],[
       with-tsrm-pth | with-tsrm-st | with-tsrm-pthreads[)];;
 
       # Allow certain Zend options
-      with-zend-vm | enable-maintainer-zts | enable-zend-multibyte | enable-inline-optimization[)];;
+      with-zend-vm | enable-maintainer-zts | enable-inline-optimization[)];;
 
       # All the rest must be set using the PHP_ARG_* macros
       # PHP_ARG_* macros set php_enable_<arg_name> or php_with_<arg_name>
       *[)]
         # Options that exist before PHP 6
+        if test "$PHP_MAJOR_VERSION" -lt "6"; then
+          case $arg_name in
+            enable-zend-multibyte[)] continue;;
+          esac 
+        fi
+
         is_arg_set=php_[]`echo [$]arg_name | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-' 'abcdefghijklmnopqrstuvwxyz_'`
         if eval test "x\$$is_arg_set" = "x"; then
           PHP_UNKNOWN_CONFIGURE_OPTIONS="$PHP_UNKNOWN_CONFIGURE_OPTIONS