diff options
Diffstat (limited to 'scripts/phpize.m4')
-rw-r--r-- | scripts/phpize.m4 | 81 |
1 files changed, 75 insertions, 6 deletions
diff --git a/scripts/phpize.m4 b/scripts/phpize.m4 index c8a810294..ba668c889 100644 --- a/scripts/phpize.m4 +++ b/scripts/phpize.m4 @@ -21,6 +21,7 @@ abs_srcdir=`(cd $srcdir && pwd)` abs_builddir=`pwd` AC_PROG_CC +PHP_DETECT_ICC AC_PROG_CC_C_O dnl Support systems with system libraries in e.g. /usr/lib64 @@ -58,25 +59,91 @@ AC_MSG_RESULT([$EXTENSION_DIR]) AC_MSG_CHECKING([for PHP installed headers prefix]) AC_MSG_RESULT([$phpincludedir]) +dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS +AC_MSG_CHECKING([if debug is enabled]) +old_CPPFLAGS=$CPPFLAGS +CPPFLAGS="-I$phpincludedir" +AC_EGREP_CPP(php_debug_is_enabled,[ +#include <main/php_config.h> +#if ZEND_DEBUG +php_debug_is_enabled +#endif +],[ + PHP_DEBUG=yes +],[ + PHP_DEBUG=no +]) +AC_MSG_RESULT([$PHP_DEBUG]) + +AC_MSG_CHECKING([if zts is enabled]) +old_CPPFLAGS=$CPPFLAGS +CPPFLAGS="-I$phpincludedir" +AC_EGREP_CPP(php_zts_is_enabled,[ +#include <main/php_config.h> +#if ZTS +php_zts_is_enabled +#endif +],[ + PHP_THREAD_SAFETY=yes +],[ + PHP_THREAD_SAFETY=no +]) +CPPFLAGS=$old_CPPFLAGS +AC_MSG_RESULT([$PHP_DEBUG]) + +dnl Support for building and testing Zend extensions +if test "$PHP_DEBUG" = "yes" && test "$PHP_THREAD_SAFETY" = "yes; then + ZEND_EXT_TYPE="zend_extension_debug_ts" +elif test "$PHP_DEBUG" = "yes"; then + ZEND_EXT_TYPE="zend_extension_debug" +elif test "$PHP_THREAD_SAFETY" = "yes; then + ZEND_EXT_TYPE="zend_extension_ts" +else + ZEND_EXT_TYPE="zend_extension" +fi +PHP_SUBST(ZEND_EXT_TYPE) + +dnl Discard optimization flags when debugging is enabled +if test "$PHP_DEBUG" = "yes"; then + PHP_DEBUG=1 + ZEND_DEBUG=yes + changequote({,}) + CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'` + CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'` + changequote([,]) + dnl add -O0 only if GCC or ICC is used + if test "$GCC" = "yes" || test "$ICC" = "yes"; then + CFLAGS="$CFLAGS -O0" + CXXFLAGS="$CXXFLAGS -O0" + fi +else + PHP_DEBUG=0 + ZEND_DEBUG=no +fi + dnl Always shared PHP_BUILD_SHARED dnl Required programs PHP_PROG_RE2C PHP_PROG_AWK - + sinclude(config.m4) enable_static=no enable_shared=yes -dnl Only allow AC_PROG_CXX if it's explicitly called (by PHP_REQUIRE_CXX) -dnl otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler -AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [AC_PROG_CXX], [undefine([AC_PROG_CXX]) -AC_DEFUN([AC_PROG_CXX], [])]) +dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX). +dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler. +AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [ + undefine([AC_PROG_CXX]) + AC_DEFUN([AC_PROG_CXX], []) + undefine([AC_PROG_CXXCPP]) + AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled]) +]) AC_PROG_LIBTOOL -all_targets='$(PHP_MODULES)' +all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)' install_targets="install-modules install-headers" phplibdir="`pwd`/modules" CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H" @@ -87,6 +154,8 @@ test "$prefix" = "NONE" && prefix="/usr/local" test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)' PHP_SUBST(PHP_MODULES) +PHP_SUBST(PHP_ZEND_EX) + PHP_SUBST(all_targets) PHP_SUBST(install_targets) |