Skip to content

Commit 8562be9

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 3315ac8 + 54785a5 commit 8562be9

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed
Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
#[=============================================================================[
2-
# CheckStrptime
2+
Check 'strptime()' and its declaration.
33
4-
Check `strptime()` and its declaration.
4+
Note: This module is obsolete. PHP 'strptime()' is deprecated as of PHP 8.1.0
5+
and strptime(), where available, simply needs the _GNU_SOURCE defined or
6+
compiler flag -std=gnuXX appended to be declared in time.h.
57
6-
Note: This module is obsolete. PHP `strptime()` is deprecated as of PHP 8.1.0.
8+
Result variables:
79
8-
## Cache variables
9-
10-
* `HAVE_STRPTIME`
11-
12-
Whether `strptime()` is available.
13-
14-
## Result variables
15-
16-
* `HAVE_DECL_STRPTIME`
17-
18-
Whether `strptime()` is declared.
19-
20-
## Usage
21-
22-
```cmake
23-
# CMakeLists.txt
24-
include(cmake/CheckStrptime.cmake)
25-
```
10+
* HAVE_STRPTIME
11+
* HAVE_DECL_STRPTIME
2612
#]=============================================================================]
2713

2814
include_guard(GLOBAL)
@@ -34,26 +20,33 @@ include(CMakePushCheckState)
3420
if(PHP_VERSION VERSION_GREATER_EQUAL 9.0)
3521
message(
3622
DEPRECATION
37-
"PHP/CheckStrptime module is obsolete and should be removed. PHP "
38-
"'strptime()' function is deprecated as of PHP 8.1.0."
23+
"CheckStrptime module is obsolete and should be removed. PHP 'strptime()' "
24+
"function is deprecated as of PHP 8.1.0."
3925
)
4026
endif()
4127

42-
# Check whether linker sees the strptime and it is declared in time.h.
28+
set(HAVE_STRPTIME FALSE)
29+
set(HAVE_DECL_STRPTIME FALSE)
30+
31+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
32+
return()
33+
endif()
34+
4335
cmake_push_check_state(RESET)
4436
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
45-
check_symbol_exists(strptime time.h HAVE_STRPTIME)
37+
check_symbol_exists(strptime time.h PHP_EXT_STANDARD_HAS_STRPTIME)
4638
cmake_pop_check_state()
4739

48-
if(HAVE_STRPTIME)
40+
if(PHP_EXT_STANDARD_HAS_STRPTIME)
41+
set(HAVE_STRPTIME TRUE)
4942
set(HAVE_DECL_STRPTIME TRUE)
5043
return()
5144
endif()
5245

53-
# The rest of this module is obsolete because strptime(), where available,
54-
# simply needs the _GNU_SOURCE defined or compiler flag -std=gnuXX appended to
55-
# be declared in time.h.
56-
5746
# Check if linker sees the function.
58-
unset(HAVE_STRPTIME CACHE)
59-
check_function_exists(strptime HAVE_STRPTIME)
47+
check_function_exists(strptime PHP_EXT_STANDARD_HAS_STRPTIME_FUNCTION)
48+
49+
if(PHP_EXT_STANDARD_HAS_STRPTIME_FUNCTION)
50+
set(HAVE_STRPTIME TRUE)
51+
return()
52+
endif()

0 commit comments

Comments
 (0)