Skip to content

Commit 8afc674

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents a0a0057 + b29006d commit 8afc674

File tree

2 files changed

+44
-34
lines changed

2 files changed

+44
-34
lines changed

cmake/cmake/checks/CheckReentrantFunctions.cmake

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ Result variables:
2020
* MISSING_LOCALTIME_R_DECL - Whether localtime_r() is not declared.
2121
* MISSING_STRTOK_R_DECL - Whether `strtok_r()` is not declared.
2222
23-
Also the type of reentrant time-related functions are checked. Type can be irix,
24-
hpux or POSIX. This check is obsolete as it is relevant for obsolete systems.
23+
Also the type of reentrant time-related functions are checked. Type can be IRIX,
24+
HP-UX or POSIX style. This check is obsolete as it is relevant only for obsolete
25+
systems.
2526
2627
Cache variables:
2728
2829
* PHP_HPUX_TIME_R - Whether HP-UX 10.x is used.
29-
* PHP_IRIX_TIME_R - Whether IRIX-style functions are used.
30+
* PHP_IRIX_TIME_R - Whether IRIX-style functions are used (e.g., Solaris <= 11.3
31+
and illumos without _POSIX_PTHREAD_SEMANTICS defined).
3032
#]=============================================================================]
3133

3234
include_guard(GLOBAL)
3335

3436
include(CheckFunctionExists)
3537
include(CheckSourceRuns)
3638
include(CheckSymbolExists)
39+
include(CMakePushCheckState)
40+
include(PHP/SystemExtensions)
3741

3842
# Define HAVE_<symbol> if linker sees the function, and MISSING_<symbol>_DECL if
3943
# function is not declared by checking the required header and test body.
@@ -95,46 +99,52 @@ endif()
9599

96100
message(CHECK_START "Checking type of reentrant time-related functions")
97101

98-
check_source_runs(C [[
99-
#include <time.h>
102+
cmake_push_check_state(RESET)
103+
# To get the POSIX standard conforming *_r functions declarations:
104+
# - _POSIX_PTHREAD_SEMANTICS is needed on Solaris <= 11.3 and illumos
105+
set(CMAKE_REQUIRED_LIBRARIES PHP::SystemExtensions)
100106

101-
int main(void)
102-
{
103-
char buf[27];
104-
struct tm t;
105-
time_t old = 0;
106-
int r, s;
107-
108-
s = gmtime_r(&old, &t);
109-
r = (int) asctime_r(&t, buf, 26);
110-
if (r == s && s == 0) {
111-
return 0;
112-
}
113-
114-
return 1;
115-
}
116-
]] PHP_HPUX_TIME_R)
117-
118-
if(NOT PHP_HPUX_TIME_R)
119107
check_source_runs(C [[
120108
#include <time.h>
121109
122110
int main(void)
123111
{
124-
struct tm t, *s;
112+
char buf[27];
113+
struct tm t;
125114
time_t old = 0;
126-
char buf[27], *p;
115+
int r, s;
127116
128-
s = gmtime_r(&old, &t);
129-
p = asctime_r(&t, buf, 26);
130-
if (p == buf && s == &t) {
117+
s = (int) gmtime_r(&old, &t);
118+
r = (int) asctime_r(&t, buf, 26);
119+
if (r == s && s == 0) {
131120
return 0;
132121
}
133122
134123
return 1;
135124
}
136-
]] PHP_IRIX_TIME_R)
137-
endif()
125+
]] PHP_HPUX_TIME_R)
126+
127+
if(NOT PHP_HPUX_TIME_R)
128+
check_source_runs(C [[
129+
#include <time.h>
130+
131+
int main(void)
132+
{
133+
struct tm t, *s;
134+
time_t old = 0;
135+
char buf[27], *p;
136+
137+
s = gmtime_r(&old, &t);
138+
p = asctime_r(&t, buf, 26);
139+
if (p == buf && s == &t) {
140+
return 0;
141+
}
142+
143+
return 1;
144+
}
145+
]] PHP_IRIX_TIME_R)
146+
endif()
147+
cmake_pop_check_state()
138148

139149
if(PHP_HPUX_TIME_R)
140150
message(CHECK_PASS "HP-UX")

cmake/cmake/modules/PHP/SystemExtensions.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Conditionally defined preprocessor macros:
2828
2929
As of Solaris 11.4, the `_POSIX_PTHREAD_SEMANTICS` is obsolete and according
3030
to documentation no header utilizes this anymore. For illumos-based systems,
31-
it's unclear where it is still needed, so at the time of writing, this is
32-
enabled unconditionally for all Solaris and illumos-based systems as enabling
33-
it doesn't cause issues. For other systems, this is irrelevant.
31+
it is still needed at the time of writing, so it is enabled unconditionally
32+
for all Solaris and illumos-based systems as enabling it on Solaris 11.4
33+
doesn't cause issues. For other systems, this is irrelevant.
3434
3535
## Result variables
3636
@@ -255,7 +255,7 @@ set(PHP_SYSTEM_EXTENSIONS_CODE [[
255255
#ifndef _OPENBSD_SOURCE
256256
# define _OPENBSD_SOURCE 1
257257
#endif
258-
/* Enable POSIX-compatible threading on Solaris. */
258+
/* Enable POSIX-compatible threading on Solaris <= 11.3 and illumos. */
259259
#ifndef _POSIX_PTHREAD_SEMANTICS
260260
# cmakedefine _POSIX_PTHREAD_SEMANTICS
261261
#endif

0 commit comments

Comments
 (0)