Skip to content

Commit 708cb0e

Browse files
author
Jani Taskinen
committed
MFH:- Applied the missing parts to phpize.m4 for zend extension builds
1 parent 97400c6 commit 708cb0e

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

scripts/phpize.m4

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ AC_MSG_RESULT([$EXTENSION_DIR])
5959
AC_MSG_CHECKING([for PHP installed headers prefix])
6060
AC_MSG_RESULT([$phpincludedir])
6161

62-
dnl Check for PHP_DEBUG / ZEND_DEBUG
62+
dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS
6363
AC_MSG_CHECKING([if debug is enabled])
6464
old_CPPFLAGS=$CPPFLAGS
6565
CPPFLAGS="-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+
])
7691
CPPFLAGS=$old_CPPFLAGS
7792
AC_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
79107
if test "$PHP_DEBUG" = "yes"; then
80108
PHP_DEBUG=1
81109
ZEND_DEBUG=yes
@@ -115,7 +143,7 @@ AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
115143
])
116144
AC_PROG_LIBTOOL
117145

118-
all_targets='$(PHP_MODULES)'
146+
all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
119147
install_targets="install-modules install-headers"
120148
phplibdir="`pwd`/modules"
121149
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
@@ -126,6 +154,8 @@ test "$prefix" = "NONE" && prefix="/usr/local"
126154
test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
127155

128156
PHP_SUBST(PHP_MODULES)
157+
PHP_SUBST(PHP_ZEND_EX)
158+
129159
PHP_SUBST(all_targets)
130160
PHP_SUBST(install_targets)
131161

0 commit comments

Comments
 (0)