Skip to content

Commit e925449

Browse files
authored
Autotools: Simplify POSIX Threads check (#14855)
The PTHREADS_CHECK is using cache variables so it is run only once early during the configuration phase, before including SAPI and other M4 files. This removes the TSRM_CHECK_PTHREADS macro and moves the POSIX Threads check after the PHP_THREAD_SAFETY variable is set in configure.ac. The check and error throw in PHP_BUILD_THREAD_SAFE is also joing into this single check. This removes the redundant tsrm.m4 file and PHP_CONFIGURE_PART call for TSRM as it doesn't run any configuration checks anymore.
1 parent 9def76e commit e925449

File tree

4 files changed

+13
-27
lines changed

4 files changed

+13
-27
lines changed

TSRM/tsrm.m4

Lines changed: 0 additions & 15 deletions
This file was deleted.

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
156156
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
157157
directory anymore.
158158
- M4 macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore.
159+
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
159160
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
160161
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and
161162
PGSQL_LIBS environment variables. When a directory argument is provided to

build/php.m4

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,7 @@ dnl ----------------------------------------------------------------------------
724724
dnl
725725
dnl PHP_BUILD_THREAD_SAFE
726726
dnl
727-
AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
728-
enable_zts=yes
729-
if test "$pthreads_working" != "yes"; then
730-
AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.])
731-
fi
732-
])
727+
AC_DEFUN([PHP_BUILD_THREAD_SAFE], [enable_zts=yes])
733728

734729
dnl
735730
dnl PHP_REQUIRE_CXX

configure.ac

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ m4_include([build/php_cxx_compile_stdcxx.m4])
1111
m4_include([build/php.m4])
1212
m4_include([build/pkg.m4])
1313
m4_include([TSRM/threads.m4])
14-
m4_include([TSRM/tsrm.m4])
1514
m4_include([Zend/Zend.m4])
1615

1716
dnl Basic autoconf initialization, generation of config.nice.
@@ -871,6 +870,17 @@ else
871870
PHP_THREAD_SAFETY=no
872871
fi
873872

873+
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [
874+
AS_VAR_IF([pthreads_working], [yes], [],
875+
[AC_MSG_ERROR([m4_normalize([
876+
Unable to verify system support for POSIX Threads, which are required for
877+
PHP thread safety (ZTS) build.
878+
])])])
879+
880+
AC_MSG_CHECKING([for POSIX threads])
881+
AC_MSG_RESULT([yes])
882+
])
883+
874884
PHP_ARG_ENABLE([rtld-now],
875885
[whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
876886
[AS_HELP_STRING([--enable-rtld-now],
@@ -1337,11 +1347,6 @@ PHP_ADD_INCLUDE([$abs_srcdir/TSRM])
13371347
ZEND_EXTRA_LIBS="$LIBS"
13381348
unset LIBS
13391349

1340-
PHP_CONFIGURE_PART(Configuring TSRM)
1341-
if test "$PHP_THREAD_SAFETY" = "yes"; then
1342-
TSRM_CHECK_PTHREADS
1343-
fi
1344-
13451350
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
13461351
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
13471352
EXTRA_LIBS="$EXTRA_LIBS $LIBS"

0 commit comments

Comments
 (0)