@@ -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
2627Cache 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
3234include_guard (GLOBAL )
3335
3436include (CheckFunctionExists)
3537include (CheckSourceRuns)
3638include (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
96100message (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
139149if (PHP_HPUX_TIME_R)
140150 message (CHECK_PASS "HP-UX" )
0 commit comments