Skip to content

Commit 966d2c9

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 8afc674 + f8502ad commit 966d2c9

File tree

8 files changed

+115
-161
lines changed

8 files changed

+115
-161
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ include(CheckTypeSize)
1919
include(CMakePushCheckState)
2020
include(FeatureSummary)
2121
include(PHP/CheckAttribute)
22+
include(PHP/CheckBuiltin)
2223
include(PHP/SearchLibraries)
2324

2425
################################################################################
@@ -235,9 +236,6 @@ cmake_pop_check_state()
235236
# Check builtins.
236237
################################################################################
237238

238-
# Import builtins checker function.
239-
include(PHP/CheckBuiltin)
240-
241239
php_check_builtin(__builtin_clz PHP_HAVE_BUILTIN_CLZ)
242240
php_check_builtin(__builtin_clzl PHP_HAVE_BUILTIN_CLZL)
243241
php_check_builtin(__builtin_clzll PHP_HAVE_BUILTIN_CLZLL)
@@ -256,13 +254,6 @@ php_check_builtin(__builtin_ssubll_overflow PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW)
256254
php_check_builtin(__builtin_unreachable PHP_HAVE_BUILTIN_UNREACHABLE)
257255
php_check_builtin(__builtin_usub_overflow PHP_HAVE_BUILTIN_USUB_OVERFLOW)
258256

259-
################################################################################
260-
# Check compiler characteristics.
261-
################################################################################
262-
263-
# Check AVX-512 extensions.
264-
include(PHP/CheckAVX512)
265-
266257
################################################################################
267258
# Check functions.
268259
################################################################################
@@ -397,12 +388,6 @@ check_symbol_exists(strlcat string.h HAVE_STRLCAT)
397388
check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
398389
check_symbol_exists(explicit_bzero string.h HAVE_EXPLICIT_BZERO)
399390

400-
# Check reentrant functions.
401-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckReentrantFunctions.cmake)
402-
403-
# Check fopencookie.
404-
include(PHP/CheckFopencookie)
405-
406391
# Some systems, notably Solaris, cause getcwd() or realpath to fail if a
407392
# component of the path has execute but not read permissions.
408393
message(CHECK_START "Checking for broken getcwd()")
@@ -419,16 +404,18 @@ if(TARGET PHP::CheckGetaddrinfoLibrary)
419404
target_link_libraries(php_config INTERFACE PHP::CheckGetaddrinfoLibrary)
420405
endif()
421406

422-
# Check copy_file_range().
423-
include(PHP/CheckCopyFileRange)
424-
425-
# Check whether writing to stdout works.
426-
include(PHP/CheckWrite)
427-
428407
################################################################################
429408
# Miscellaneous checks.
430409
################################################################################
431410

411+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckAVX512.cmake)
412+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckCopyFileRange.cmake)
413+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFlushIo.cmake)
414+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFopencookie.cmake)
415+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckIPv6.cmake)
416+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckReentrantFunctions.cmake)
417+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckWrite.cmake)
418+
432419
# Checking file descriptor sets.
433420
message(CHECK_START "Checking file descriptor sets size")
434421
if(PHP_FD_SETSIZE MATCHES "^[0-9]+$" AND PHP_FD_SETSIZE GREATER 0)
@@ -448,12 +435,6 @@ else()
448435
message(CHECK_PASS "using system default")
449436
endif()
450437

451-
# Check for IPv6 support.
452-
include(PHP/CheckIPv6)
453-
454-
# Check how flush should be called.
455-
include(PHP/CheckFlushIo)
456-
457438
if(HAVE_ALLOCA_H)
458439
# Most *.nix systems.
459440
check_symbol_exists(alloca alloca.h HAVE_ALLOCA)

cmake/cmake/modules/PHP/CheckAVX512.cmake renamed to cmake/cmake/checks/CheckAVX512.cmake

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,29 @@
11
#[=============================================================================[
2-
# PHP/CheckAVX512
3-
42
Check whether compiler supports AVX-512 extensions. Note that this is a compiler
53
check, not a runtime check where further adjustments are done in the php-src C
64
code to use these extensions.
75
8-
TODO: Adjust checks for MSVC.
9-
10-
## Cache variables
11-
12-
* `PHP_HAVE_AVX512_SUPPORTS`
13-
14-
Whether compiler supports AVX-512.
15-
16-
* `PHP_HAVE_AVX512_VBMI_SUPPORTS`
17-
18-
Whether compiler supports AVX-512 VBMI.
19-
20-
## Usage
6+
Cache variables:
217
22-
```cmake
23-
# CMakeLists.txt
24-
include(PHP/CheckAVX512)
25-
```
8+
* PHP_HAVE_AVX512_SUPPORTS - Whether compiler supports AVX-512.
9+
* PHP_HAVE_AVX512_VBMI_SUPPORTS - Whether compiler supports AVX-512 VBMI.
2610
#]=============================================================================]
2711

2812
include_guard(GLOBAL)
2913

14+
include(CheckSourceCompiles)
15+
include(CMakePushCheckState)
16+
3017
# Skip in consecutive configuration phases.
3118
if(DEFINED PHP_HAVE_AVX512_SUPPORTS AND DEFINED PHP_HAVE_AVX512_VBMI_SUPPORTS)
3219
return()
3320
endif()
3421

35-
include(CheckSourceCompiles)
36-
include(CMakePushCheckState)
22+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
23+
set(PHP_HAVE_AVX512_SUPPORTS FALSE)
24+
set(PHP_HAVE_AVX512_VBMI_SUPPORTS FALSE)
25+
return()
26+
endif()
3727

3828
message(CHECK_START "Checking for AVX-512 extensions support")
3929

cmake/cmake/modules/PHP/CheckCopyFileRange.cmake renamed to cmake/cmake/checks/CheckCopyFileRange.cmake

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
#[=============================================================================[
2-
# PHP/CheckCopyFileRange
2+
Check copy_file_range().
33
4-
On FreeBSD, `copy_file_range()` works only with the undocumented flag
5-
`0x01000000`. Until the problem is fixed properly, `copy_file_range()` is used
4+
On FreeBSD, copy_file_range() works only with the undocumented flag
5+
'0x01000000'. Until the problem is fixed properly, 'copy_file_range()' is used
66
only on Linux.
77
8-
## Cache variables
8+
Result variables:
99
10-
* `HAVE_COPY_FILE_RANGE`
10+
* HAVE_COPY_FILE_RANGE - Whether 'copy_file_range()' is supported.
11+
#]=============================================================================]
1112

12-
Whether `copy_file_range()` is supported.
13+
include_guard(GLOBAL)
1314

14-
## Usage
15+
include(CheckSourceCompiles)
16+
include(CMakePushCheckState)
1517

16-
```cmake
17-
# CMakeLists.txt
18-
include(PHP/CheckCopyFileRange)
19-
```
20-
#]=============================================================================]
18+
set(HAVE_COPY_FILE_RANGE FALSE)
2119

22-
include_guard(GLOBAL)
20+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
21+
return()
22+
endif()
2323

2424
# Skip in consecutive configuration phases.
25-
if(DEFINED HAVE_COPY_FILE_RANGE)
25+
if(DEFINED PHP_HAS_COPY_FILE_RANGE)
26+
if(PHP_HAS_COPY_FILE_RANGE)
27+
set(HAVE_COPY_FILE_RANGE TRUE)
28+
endif()
29+
2630
return()
2731
endif()
2832

29-
include(CheckSourceCompiles)
30-
include(CMakePushCheckState)
31-
3233
message(CHECK_START "Checking for copy_file_range")
3334

3435
cmake_push_check_state(RESET)
@@ -53,10 +54,11 @@ cmake_push_check_state(RESET)
5354
(void)copy_file_range(-1, 0, -1, 0, 0, 0);
5455
return 0;
5556
}
56-
]] HAVE_COPY_FILE_RANGE)
57+
]] PHP_HAS_COPY_FILE_RANGE)
5758
cmake_pop_check_state()
5859

59-
if(HAVE_COPY_FILE_RANGE)
60+
if(PHP_HAS_COPY_FILE_RANGE)
61+
set(HAVE_COPY_FILE_RANGE TRUE)
6062
message(CHECK_PASS "yes")
6163
else()
6264
message(CHECK_FAIL "no")

cmake/cmake/modules/PHP/CheckFlushIo.cmake renamed to cmake/cmake/checks/CheckFlushIo.cmake

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,37 @@
11
#[=============================================================================[
2-
# PHP/CheckFlushIo
3-
42
Check if flush should be called explicitly after buffered io.
53
6-
## Cache variables
7-
8-
* `HAVE_FLUSHIO`
9-
10-
## Usage
4+
Result variables:
115
12-
```cmake
13-
# CMakeLists.txt
14-
include(PHP/CheckFlushIo)
15-
```
6+
* HAVE_FLUSHIO
167
#]=============================================================================]
178

189
include_guard(GLOBAL)
1910

20-
# Skip in consecutive configuration phases.
21-
if(DEFINED HAVE_FLUSHIO)
22-
return()
23-
endif()
24-
2511
include(CheckIncludeFiles)
2612
include(CheckSourceRuns)
2713
include(CMakePushCheckState)
2814

29-
message(CHECK_START
30-
"Checking whether flush should be called explicitly after a buffered io"
31-
)
15+
set(HAVE_FLUSHIO FALSE)
3216

3317
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
34-
message(CHECK_FAIL "no")
35-
set(
36-
HAVE_FLUSHIO
37-
FALSE
38-
CACHE INTERNAL
39-
"Whether flush should be called explicitly after a buffered io."
40-
)
4118
return()
4219
endif()
4320

21+
# Skip in consecutive configuration phases.
22+
if(DEFINED PHP_HAS_FLUSHIO)
23+
if(PHP_HAS_FLUSHIO)
24+
set(HAVE_FLUSHIO TRUE)
25+
endif()
26+
27+
return()
28+
endif()
29+
30+
message(
31+
CHECK_START
32+
"Checking whether flush should be called explicitly after a buffered io"
33+
)
34+
4435
cmake_push_check_state(RESET)
4536
set(CMAKE_REQUIRED_QUIET TRUE)
4637

@@ -108,10 +99,11 @@ cmake_push_check_state(RESET)
10899
109100
return result;
110101
}
111-
]] HAVE_FLUSHIO)
102+
]] PHP_HAS_FLUSHIO)
112103
cmake_pop_check_state()
113104

114-
if(HAVE_FLUSHIO)
105+
if(PHP_HAS_FLUSHIO)
106+
set(HAVE_FLUSHIO TRUE)
115107
message(CHECK_PASS "yes")
116108
else()
117109
message(CHECK_FAIL "no")

cmake/cmake/modules/PHP/CheckFopencookie.cmake renamed to cmake/cmake/checks/CheckFopencookie.cmake

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
11
#[=============================================================================[
2-
# PHP/CheckFopencookie
2+
Check if 'fopencookie()' works as expected.
33
4-
Check if `fopencookie()` works as expected.
4+
Module first checks if 'fopencookie()' and type 'cookie_io_functions_t' are
5+
available. Then it checks whether the 'fopencookie' seeker uses type 'off64_t'.
6+
Since 'off64_t' is non-standard and obsolescent, the standard 'off_t' type can
7+
be used on both 64-bit and 32-bit systems, where the '_FILE_OFFSET_BITS=64' can
8+
make it behave like 'off64_t' on 32-bit. Since code is in the transition process
9+
to use 'off_t' only, check is left here when using glibc.
510
6-
Module first checks if `fopencookie()` and type `cookie_io_functions_t` are
7-
available. Then it checks whether the fopencookie seeker uses type `off64_t`.
8-
Since `off64_t` is non-standard and obsolescent, the standard `off_t` type can
9-
be used on both 64-bit and 32-bit systems, where the `_FILE_OFFSET_BITS=64` can
10-
make it behave like `off64_t` on 32-bit. Since code is in the transition process
11-
to use `off_t` only, check is left here when using glibc.
11+
Result variables:
1212
13-
## Cache variables
14-
15-
* `HAVE_FOPENCOOKIE`
16-
17-
Whether `fopencookie()` and `cookie_io_functions_t` are available.
18-
19-
* `COOKIE_SEEKER_USES_OFF64_T`
20-
21-
Whether `fopencookie` seeker uses the `off64_t` type.
22-
23-
## Usage
24-
25-
```cmake
26-
# CMakeLists.txt
27-
include(PHP/CheckFopencookie)
28-
```
13+
* HAVE_FOPENCOOKIE - Whether 'fopencookie()' and 'cookie_io_functions_t' are
14+
available.
15+
* COOKIE_SEEKER_USES_OFF64_T - Whether 'fopencookie' seeker uses the 'off64_t'
16+
type.
2917
#]=============================================================================]
3018

3119
include_guard(GLOBAL)
@@ -35,6 +23,13 @@ include(CheckSymbolExists)
3523
include(CheckTypeSize)
3624
include(CMakePushCheckState)
3725

26+
set(COOKIE_SEEKER_USES_OFF64_T FALSE)
27+
set(HAVE_FOPENCOOKIE FALSE)
28+
29+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
30+
return()
31+
endif()
32+
3833
cmake_push_check_state(RESET)
3934
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
4035
check_symbol_exists(fopencookie stdio.h PHP_HAS_FOPENCOOKIE)
@@ -47,29 +42,34 @@ endif()
4742
cmake_push_check_state(RESET)
4843
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
4944
set(CMAKE_EXTRA_INCLUDE_FILES "stdio.h")
50-
check_type_size("cookie_io_functions_t" FOPENCOOKIE)
45+
check_type_size("cookie_io_functions_t" PHP_COOKIE_IO_FUNCTIONS_T)
5146
cmake_pop_check_state()
5247

53-
if(NOT HAVE_FOPENCOOKIE)
48+
if(NOT HAVE_PHP_COOKIE_IO_FUNCTIONS_T)
5449
return()
5550
endif()
5651

52+
set(HAVE_FOPENCOOKIE TRUE)
53+
5754
# Skip in consecutive configuration phases.
58-
if(DEFINED COOKIE_SEEKER_USES_OFF64_T)
55+
if(DEFINED PHP_HAS_COOKIE_SEEKER_OFF64_T)
56+
if(PHP_HAS_COOKIE_SEEKER_OFF64_T)
57+
set(COOKIE_SEEKER_USES_OFF64_T TRUE)
58+
endif()
5959
return()
6060
endif()
6161

6262
# GNU C library can have a different seeker definition using off64_t.
6363
message(CHECK_START "Checking whether fopencookie seeker uses off64_t")
6464

6565
if(
66-
NOT DEFINED COOKIE_SEEKER_USES_OFF64_T_EXITCODE
66+
NOT DEFINED PHP_HAS_COOKIE_SEEKER_OFF64_T_EXITCODE
6767
AND CMAKE_CROSSCOMPILING
6868
AND NOT CMAKE_CROSSCOMPILING_EMULATOR
6969
AND CMAKE_SYSTEM_NAME STREQUAL "Linux"
7070
AND PHP_C_STANDARD_LIBRARY STREQUAL "glibc"
7171
)
72-
set(COOKIE_SEEKER_USES_OFF64_T_EXITCODE 0)
72+
set(PHP_HAS_COOKIE_SEEKER_OFF64_T_EXITCODE 0)
7373
endif()
7474

7575
cmake_push_check_state(RESET)
@@ -123,10 +123,11 @@ cmake_push_check_state(RESET)
123123
124124
return 1;
125125
}
126-
]] COOKIE_SEEKER_USES_OFF64_T)
126+
]] PHP_HAS_COOKIE_SEEKER_OFF64_T)
127127
cmake_pop_check_state()
128128

129-
if(COOKIE_SEEKER_USES_OFF64_T)
129+
if(PHP_HAS_COOKIE_SEEKER_OFF64_T)
130+
set(COOKIE_SEEKER_USES_OFF64_T TRUE)
130131
message(CHECK_PASS "yes")
131132
else()
132133
message(CHECK_FAIL "no")

0 commit comments

Comments
 (0)