From 4633e70ab1d03cbbfdb166a3c1912d2277c02882 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 24 Nov 2020 15:52:41 +0100 Subject: [PATCH] Fixed bug #80377 Make sure the $PHP_THREAD_SAFETY variable is always available when configuring extensions. It was previously available for phpized extensions, but for in-tree builds it was being set too late. Then, use $PHP_THREAD_SAFETY instead of $enable_zts to check for ZTS in bundled extensions, which makes sure these checks also work for phpize builds. --- NEWS | 1 + Zend/Zend.m4 | 6 ------ configure.ac | 20 +++++++++++++------- ext/opcache/config.m4 | 2 +- ext/session/config.m4 | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 1e2478cef9..095c0efce8 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ PHP NEWS - Opcache: . Fixed bug #80404 (Incorrect range inference result when division results in float). (Nikita) + . Fixed bug #80377 (Opcache misses executor_globals). (Nikita) - Standard: . Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb) diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 7261885974..781e51d3e4 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -190,12 +190,6 @@ dnl LIBZEND_OTHER_CHECKS dnl AC_DEFUN([LIBZEND_OTHER_CHECKS],[ -AC_ARG_ENABLE([zts], - [AS_HELP_STRING([--enable-zts], - [Enable thread safety])], - [ZEND_ZTS=$enableval], - [ZEND_ZTS=no]) - AC_MSG_CHECKING(whether to enable thread-safety) AC_MSG_RESULT($ZEND_ZTS) diff --git a/configure.ac b/configure.ac index 8d6e922fa9..e07a75d19a 100644 --- a/configure.ac +++ b/configure.ac @@ -797,6 +797,19 @@ if test "$PHP_DEBUG_ASSERTIONS" = "yes"; then ZEND_DEBUG=yes fi +AC_ARG_ENABLE([zts], + [AS_HELP_STRING([--enable-zts], + [Enable thread safety])], + [ZEND_ZTS=$enableval], + [ZEND_ZTS=no]) + +if test "$ZEND_ZTS" = "yes"; then + AC_DEFINE(ZTS, 1,[ ]) + PHP_THREAD_SAFETY=yes +else + PHP_THREAD_SAFETY=no +fi + PHP_ARG_ENABLE([rtld-now], [whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY], [AS_HELP_STRING([--enable-rtld-now], @@ -1136,13 +1149,6 @@ LIBZEND_BASIC_CHECKS LIBZEND_DLSYM_CHECK LIBZEND_OTHER_CHECKS -if test "$ZEND_ZTS" = "yes"; then - AC_DEFINE(ZTS,1,[ ]) - PHP_THREAD_SAFETY=yes -else - PHP_THREAD_SAFETY=no -fi - INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM" INCLUDES="$INCLUDES -I\$(top_builddir)/Zend" diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 054cd28c02..93d72fb73d 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -66,7 +66,7 @@ if test "$PHP_OPCACHE" != "no"; then esac fi - if test "$enable_zts" = "yes"; then + if test "$PHP_THREAD_SAFETY" = "yes"; then DASM_FLAGS="$DASM_FLAGS -D ZTS=1" fi diff --git a/ext/session/config.m4 b/ext/session/config.m4 index 7abc8813b7..da31bbde86 100644 --- a/ext/session/config.m4 +++ b/ext/session/config.m4 @@ -31,7 +31,7 @@ if test "$PHP_MM" != "no"; then AC_MSG_ERROR(cannot find mm library) fi - if test "$enable_zts" = "yes"; then + if test "$PHP_THREAD_SAFETY" = "yes"; then dnl The mm library is not thread-safe, and mod_mm.c refuses to compile. AC_MSG_ERROR(--with-mm cannot be combined with --enable-zts) fi -- 2.40.0