@@ -20,20 +20,24 @@ Result variables:
20
20
* MISSING_LOCALTIME_R_DECL - Whether localtime_r() is not declared.
21
21
* MISSING_STRTOK_R_DECL - Whether `strtok_r()` is not declared.
22
22
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.
25
26
26
27
Cache variables:
27
28
28
29
* 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).
30
32
#]=============================================================================]
31
33
32
34
include_guard (GLOBAL )
33
35
34
36
include (CheckFunctionExists )
35
37
include (CheckSourceRuns )
36
38
include (CheckSymbolExists )
39
+ include (CMakePushCheckState )
40
+ include (PHP/SystemExtensions )
37
41
38
42
# Define HAVE_<symbol> if linker sees the function, and MISSING_<symbol>_DECL if
39
43
# function is not declared by checking the required header and test body.
@@ -95,46 +99,52 @@ endif()
95
99
96
100
message (CHECK_START "Checking type of reentrant time-related functions" )
97
101
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 )
100
106
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 )
119
107
check_source_runs (C [[
120
108
#include <time.h>
121
109
122
110
int main(void)
123
111
{
124
- struct tm t, *s;
112
+ char buf[27];
113
+ struct tm t;
125
114
time_t old = 0;
126
- char buf[27], *p ;
115
+ int r, s ;
127
116
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 ) {
131
120
return 0;
132
121
}
133
122
134
123
return 1;
135
124
}
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 ()
138
148
139
149
if (PHP_HPUX_TIME_R )
140
150
message (CHECK_PASS "HP-UX" )
0 commit comments