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.
This commit is contained in:
Peter Kokot 2024-07-07 22:44:44 +02:00 committed by GitHub
parent 9def76ebbc
commit e9254494ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 27 deletions

View File

@ -1,15 +0,0 @@
dnl This file contains TSRM specific autoconf macros.
dnl
dnl TSRM_CHECK_PTHREADS
dnl
AC_DEFUN([TSRM_CHECK_PTHREADS],[
PTHREADS_CHECK
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
fi
AC_MSG_CHECKING(for POSIX threads)
AC_MSG_RESULT(yes)
])

View File

@ -156,6 +156,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
directory anymore.
- M4 macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore.
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and
PGSQL_LIBS environment variables. When a directory argument is provided to

View File

@ -724,12 +724,7 @@ dnl ----------------------------------------------------------------------------
dnl
dnl PHP_BUILD_THREAD_SAFE
dnl
AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
enable_zts=yes
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.])
fi
])
AC_DEFUN([PHP_BUILD_THREAD_SAFE], [enable_zts=yes])
dnl
dnl PHP_REQUIRE_CXX

View File

@ -11,7 +11,6 @@ m4_include([build/php_cxx_compile_stdcxx.m4])
m4_include([build/php.m4])
m4_include([build/pkg.m4])
m4_include([TSRM/threads.m4])
m4_include([TSRM/tsrm.m4])
m4_include([Zend/Zend.m4])
dnl Basic autoconf initialization, generation of config.nice.
@ -871,6 +870,17 @@ else
PHP_THREAD_SAFETY=no
fi
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [
AS_VAR_IF([pthreads_working], [yes], [],
[AC_MSG_ERROR([m4_normalize([
Unable to verify system support for POSIX Threads, which are required for
PHP thread safety (ZTS) build.
])])])
AC_MSG_CHECKING([for POSIX threads])
AC_MSG_RESULT([yes])
])
PHP_ARG_ENABLE([rtld-now],
[whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
[AS_HELP_STRING([--enable-rtld-now],
@ -1337,11 +1347,6 @@ PHP_ADD_INCLUDE([$abs_srcdir/TSRM])
ZEND_EXTRA_LIBS="$LIBS"
unset LIBS
PHP_CONFIGURE_PART(Configuring TSRM)
if test "$PHP_THREAD_SAFETY" = "yes"; then
TSRM_CHECK_PTHREADS
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
EXTRA_LIBS="$EXTRA_LIBS $LIBS"