summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2008-07-30 23:56:05 (GMT)
committerJani Taskinen <jani@php.net>2008-07-30 23:56:05 (GMT)
commit87acbd26397f8c538c4cd635f89f337ec01a463b (patch)
treeba15f4ddcf4d4a007f2c7487693214e4b6a0a5e8 /scripts
parentf92026e0ac6a11ad961e4318e1ea971bb31d9bee (diff)
downloadphp-87acbd26397f8c538c4cd635f89f337ec01a463b.tar.gz
MFH:- Detect whether debugging was enabled in PHP and drop optimizing flags if so (merge from configure.in)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/phpize.m435
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/phpize.m4 b/scripts/phpize.m4
index f99a367..3e16be3 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,6 +59,40 @@ AC_MSG_RESULT([$EXTENSION_DIR])
AC_MSG_CHECKING([for PHP installed headers prefix])
AC_MSG_RESULT([$phpincludedir])
+dnl Check for PHP_DEBUG / ZEND_DEBUG
+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
+])
+CPPFLAGS=$old_CPPFLAGS
+AC_MSG_RESULT([$PHP_DEBUG])
+
+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