@@ -59,7 +59,7 @@ AC_MSG_RESULT([$EXTENSION_DIR])
5959AC_MSG_CHECKING ( [ for PHP installed headers prefix] )
6060AC_MSG_RESULT ( [ $phpincludedir] )
6161
62- dnl Check for PHP_DEBUG / ZEND_DEBUG
62+ dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS
6363AC_MSG_CHECKING ( [ if debug is enabled] )
6464old_CPPFLAGS=$CPPFLAGS
6565CPPFLAGS="-I$phpincludedir"
@@ -73,9 +73,37 @@ php_debug_is_enabled
7373] ,[
7474 PHP_DEBUG=no
7575] )
76+ AC_MSG_RESULT ( [ $PHP_DEBUG] )
77+
78+ AC_MSG_CHECKING ( [ if zts is enabled] )
79+ old_CPPFLAGS=$CPPFLAGS
80+ CPPFLAGS="-I$phpincludedir"
81+ AC_EGREP_CPP ( php_zts_is_enabled ,[
82+ #include <main/php_config.h>
83+ #if ZTS
84+ php_zts_is_enabled
85+ #endif
86+ ] ,[
87+ PHP_THREAD_SAFETY=yes
88+ ] ,[
89+ PHP_THREAD_SAFETY=no
90+ ] )
7691CPPFLAGS=$old_CPPFLAGS
7792AC_MSG_RESULT ( [ $PHP_DEBUG] )
7893
94+ dnl Support for building and testing Zend extensions
95+ if test "$PHP_DEBUG" = "yes" && test "$PHP_THREAD_SAFETY" = "yes; then
96+ ZEND_EXT_TYPE="zend_extension_debug_ts"
97+ elif test "$PHP_DEBUG" = "yes"; then
98+ ZEND_EXT_TYPE="zend_extension_debug"
99+ elif test "$PHP_THREAD_SAFETY" = "yes; then
100+ ZEND_EXT_TYPE="zend_extension_ts"
101+ else
102+ ZEND_EXT_TYPE="zend_extension"
103+ fi
104+ PHP_SUBST(ZEND_EXT_TYPE)
105+
106+ dnl Discard optimization flags when debugging is enabled
79107if test "$PHP_DEBUG" = "yes"; then
80108 PHP_DEBUG=1
81109 ZEND_DEBUG=yes
@@ -115,7 +143,7 @@ AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
115143] )
116144AC_PROG_LIBTOOL
117145
118- all_targets='$(PHP_MODULES)'
146+ all_targets='$(PHP_MODULES) $(PHP_ZEND_EX) '
119147install_targets="install-modules install-headers"
120148phplibdir="`pwd`/modules"
121149CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
@@ -126,6 +154,8 @@ test "$prefix" = "NONE" && prefix="/usr/local"
126154test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
127155
128156PHP_SUBST(PHP_MODULES)
157+ PHP_SUBST(PHP_ZEND_EX)
158+
129159PHP_SUBST(all_targets)
130160PHP_SUBST(install_targets)
131161
0 commit comments