Skip to content

Commit 9dd7420

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 966d2c9 + 7b967b2 commit 9dd7420

File tree

5 files changed

+66
-101
lines changed

5 files changed

+66
-101
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,6 @@ else()
398398
message(CHECK_FAIL "no")
399399
endif()
400400

401-
# Check getaddrinfo().
402-
include(PHP/CheckGetaddrinfo)
403-
if(TARGET PHP::CheckGetaddrinfoLibrary)
404-
target_link_libraries(php_config INTERFACE PHP::CheckGetaddrinfoLibrary)
405-
endif()
406-
407401
################################################################################
408402
# Miscellaneous checks.
409403
################################################################################
@@ -412,6 +406,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckAVX512.cmake)
412406
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckCopyFileRange.cmake)
413407
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFlushIo.cmake)
414408
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFopencookie.cmake)
409+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGetaddrinfo.cmake)
410+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGethostbynameR.cmake)
415411
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckIPv6.cmake)
416412
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckReentrantFunctions.cmake)
417413
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckWrite.cmake)
@@ -484,11 +480,6 @@ endif()
484480
# Check for variable __attribute__((aligned)) support in the compiler.
485481
php_check_variable_attribute(aligned HAVE_ATTRIBUTE_ALIGNED)
486482

487-
include(PHP/CheckGethostbynameR)
488-
if(TARGET PHP::CheckGethostbynameR)
489-
target_link_libraries(php_config INTERFACE PHP::CheckGethostbynameR)
490-
endif()
491-
492483
################################################################################
493484
# Check for required libraries.
494485
################################################################################

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

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
#[=============================================================================[
2-
# PHP/CheckGetaddrinfo
2+
Check whether getaddrinfo() function is working as expected.
33
4-
Check for working `getaddrinfo()`.
4+
Result variables:
55
6-
## Cache variables
7-
8-
* `HAVE_GETADDRINFO`
9-
10-
Whether `getaddrinfo()` function is working as expected.
11-
12-
IMPORTED target:
13-
14-
* `PHP::CheckGetaddrinfoLibrary`
15-
16-
If there is additional library to be linked for using `getaddrinfo()`.
17-
18-
## Usage
19-
20-
```cmake
21-
# CMakeLists.txt
22-
include(PHP/CheckGetaddrinfo)
23-
```
6+
* HAVE_GETADDRINFO
247
#]=============================================================================]
258

269
include_guard(GLOBAL)
@@ -29,7 +12,13 @@ include(CheckSourceRuns)
2912
include(CMakePushCheckState)
3013
include(PHP/SearchLibraries)
3114

32-
message(CHECK_START "Checking for getaddrinfo()")
15+
set(HAVE_GETADDRINFO FALSE)
16+
17+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
18+
set(HAVE_GETADDRINFO TRUE)
19+
target_link_libraries(php_config INTERFACE ws2_32)
20+
return()
21+
endif()
3322

3423
# The getaddrinfo() is mostly in C library (Solaris 11.4, illumos...)
3524
php_search_libraries(
@@ -41,38 +30,34 @@ php_search_libraries(
4130
socket # Solaris <= 11.3
4231
network # Haiku
4332
ws2_32 # Windows
44-
LIBRARY_VARIABLE libraryForGetaddrinfo
33+
LIBRARY_VARIABLE library
4534
)
46-
if(libraryForGetaddrinfo)
47-
add_library(PHP::CheckGetaddrinfoLibrary INTERFACE IMPORTED GLOBAL)
48-
49-
target_link_libraries(
50-
PHP::CheckGetaddrinfoLibrary
51-
INTERFACE
52-
${libraryForGetaddrinfo}
53-
)
35+
if(library)
36+
target_link_libraries(php_config INTERFACE ${library})
5437
endif()
5538

56-
# If the variable HAVE_GETADDRINFO has been overridden the module stops here.
57-
# For example, on Windows.
58-
if(HAVE_GETADDRINFO)
59-
message(CHECK_PASS "yes (cached)")
39+
if(DEFINED PHP_HAS_GETADDRINFO)
40+
if(PHP_HAS_GETADDRINFO)
41+
set(HAVE_GETADDRINFO TRUE)
42+
endif()
6043
return()
6144
endif()
6245

46+
message(CHECK_START "Checking whether getaddrinfo() works")
47+
6348
cmake_push_check_state(RESET)
6449
set(CMAKE_REQUIRED_QUIET TRUE)
65-
if(TARGET PHP::CheckGetaddrinfoLibrary)
66-
set(CMAKE_REQUIRED_LIBRARIES PHP::CheckGetaddrinfoLibrary)
50+
if(library)
51+
set(CMAKE_REQUIRED_LIBRARIES ${library})
6752
endif()
6853

6954
if(
70-
NOT DEFINED HAVE_GETADDRINFO_EXITCODE
55+
NOT DEFINED PHP_HAS_GETADDRINFO_EXITCODE
7156
AND CMAKE_CROSSCOMPILING
7257
AND NOT CMAKE_CROSSCOMPILING_EMULATOR
7358
AND CMAKE_SYSTEM_NAME MATCHES "^(Linux|Midipix)$"
7459
)
75-
set(HAVE_GETADDRINFO_EXITCODE 0)
60+
set(PHP_HAS_GETADDRINFO_EXITCODE 0)
7661
endif()
7762

7863
check_source_runs(C [[
@@ -116,10 +101,11 @@ cmake_push_check_state(RESET)
116101
117102
return 0;
118103
}
119-
]] HAVE_GETADDRINFO)
104+
]] PHP_HAS_GETADDRINFO)
120105
cmake_pop_check_state()
121106

122-
if(HAVE_GETADDRINFO)
107+
if(PHP_HAS_GETADDRINFO)
108+
set(HAVE_GETADDRINFO TRUE)
123109
message(CHECK_PASS "yes")
124110
else()
125111
message(CHECK_FAIL "no")

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

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#[=============================================================================[
2-
# PHP/CheckGethostbynameR
2+
Check 'gethostbyname_r()'.
33
4-
Check `gethostbyname_r()`.
5-
6-
The non-standard `gethostbyname_r()` function has different signatures across
4+
The non-standard 'gethostbyname_r()' function has different signatures across
75
systems:
86
97
* Linux, BSD: 6 arguments
@@ -15,38 +13,12 @@ systems:
1513
See also:
1614
https://www.gnu.org/software/autoconf-archive/ax_func_which_gethostbyname_r.html
1715
18-
## Cache variables
19-
20-
* `HAVE_FUNC_GETHOSTBYNAME_R_6`
21-
22-
Whether `gethostbyname_r()` has 6 arguments.
23-
24-
* `HAVE_FUNC_GETHOSTBYNAME_R_5`
25-
26-
Whether `gethostbyname_r()` has 5 arguments.
27-
28-
* `HAVE_FUNC_GETHOSTBYNAME_R_3`
29-
30-
Whether `gethostbyname_r()` has 3 arguments.
31-
32-
## Result variables
33-
34-
* `HAVE_GETHOSTBYNAME_R`
35-
36-
Whether `gethostbyname_r()` is available.
37-
38-
## INTERFACE library
39-
40-
* `PHP::CheckGethostbynameR`
16+
Result variables:
4117
42-
Created when additional system library needs to be linked.
43-
44-
## Usage
45-
46-
```cmake
47-
# CMakeLists.txt
48-
include(PHP/CheckGethostbynameR)
49-
```
18+
* HAVE_FUNC_GETHOSTBYNAME_R_6 - Whether 'gethostbyname_r()' has 6 arguments.
19+
* HAVE_FUNC_GETHOSTBYNAME_R_5 - Whether 'gethostbyname_r()' has 5 arguments.
20+
* HAVE_FUNC_GETHOSTBYNAME_R_3 - Whether 'gethostbyname_r()' has 3 arguments.
21+
* HAVE_GETHOSTBYNAME_R - Whether 'gethostbyname_r()' is available.
5022
#]=============================================================================]
5123

5224
include_guard(GLOBAL)
@@ -55,6 +27,15 @@ include(CheckPrototypeDefinition)
5527
include(CMakePushCheckState)
5628
include(PHP/SearchLibraries)
5729

30+
set(HAVE_FUNC_GETHOSTBYNAME_R_6 FALSE)
31+
set(HAVE_FUNC_GETHOSTBYNAME_R_5 FALSE)
32+
set(HAVE_FUNC_GETHOSTBYNAME_R_3 FALSE)
33+
set(HAVE_GETHOSTBYNAME_R FALSE)
34+
35+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
36+
return()
37+
endif()
38+
5839
function(_php_check_gethostbyname_r)
5940
message(CHECK_START "Checking number of gethostbyname_r() arguments")
6041

@@ -74,9 +55,7 @@ function(_php_check_gethostbyname_r)
7455
endif()
7556

7657
if(library)
77-
add_library(php_check_gethostbyname_r INTERFACE)
78-
add_library(PHP::CheckGethostbynameR ALIAS php_check_gethostbyname_r)
79-
target_link_libraries(php_check_gethostbyname_r INTERFACE ${library})
58+
target_link_libraries(php_config INTERFACE ${library})
8059
endif()
8160

8261
# Check for 6 arguments signature.
@@ -86,9 +65,9 @@ function(_php_check_gethostbyname_r)
8665
size_t buflen, struct hostent **result, int *h_errnop)"
8766
"0"
8867
netdb.h
89-
HAVE_FUNC_GETHOSTBYNAME_R_6
68+
PHP_HAS_GETHOSTBYNAME_R_6
9069
)
91-
if(HAVE_FUNC_GETHOSTBYNAME_R_6)
70+
if(PHP_HAS_GETHOSTBYNAME_R_6)
9271
message(CHECK_PASS "six")
9372
return()
9473
endif()
@@ -100,9 +79,9 @@ function(_php_check_gethostbyname_r)
10079
char *buffer, int buflen, int *h_errnop)"
10180
"0"
10281
netdb.h
103-
HAVE_FUNC_GETHOSTBYNAME_R_5
82+
PHP_HAS_GETHOSTBYNAME_R_5
10483
)
105-
if(HAVE_FUNC_GETHOSTBYNAME_R_5)
84+
if(PHP_HAS_GETHOSTBYNAME_R_5)
10685
message(CHECK_PASS "five")
10786
return()
10887
endif()
@@ -114,9 +93,9 @@ function(_php_check_gethostbyname_r)
11493
struct hostent_data *data)"
11594
"0"
11695
netdb.h
117-
HAVE_FUNC_GETHOSTBYNAME_R_3
96+
PHP_HAS_GETHOSTBYNAME_R_3
11897
)
119-
if(HAVE_FUNC_GETHOSTBYNAME_R_3)
98+
if(PHP_HAS_GETHOSTBYNAME_R_3)
12099
message(CHECK_PASS "three")
121100
return()
122101
endif()
@@ -129,6 +108,18 @@ cmake_push_check_state(RESET)
129108
_php_check_gethostbyname_r()
130109
cmake_pop_check_state()
131110

111+
if(PHP_HAS_GETHOSTBYNAME_R_6)
112+
set(HAVE_FUNC_GETHOSTBYNAME_R_6 TRUE)
113+
endif()
114+
115+
if(PHP_HAS_GETHOSTBYNAME_R_5)
116+
set(HAVE_FUNC_GETHOSTBYNAME_R_5 TRUE)
117+
endif()
118+
119+
if(PHP_HAS_GETHOSTBYNAME_R_3)
120+
set(HAVE_FUNC_GETHOSTBYNAME_R_3 TRUE)
121+
endif()
122+
132123
if(
133124
HAVE_FUNC_GETHOSTBYNAME_R_6
134125
OR HAVE_FUNC_GETHOSTBYNAME_R_5

cmake/cmake/platforms/Windows.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
2323
# PHP has ftok() emulation implemented on Windows.
2424
set(HAVE_FTOK TRUE)
2525

26-
# PHP has unconditional getaddrinfo() support on Windows.
27-
set(HAVE_GETADDRINFO TRUE)
28-
2926
# PHP has unconditional support for getcwd() on Windows.
3027
set(HAVE_GETCWD TRUE)
3128

cmake/cmake/toolchains/template.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ set(CMAKE_FIND_ROOT_PATH "")
1919
# Set the exit code for the fopencookie seeker using off64_t check.
2020
set(PHP_HAS_COOKIE_SEEKER_OFF64_T_EXITCODE 0)
2121

22-
# Set the exit code for the getaddrinfo() check.
23-
set(HAVE_GETADDRINFO_EXITCODE 0)
24-
2522
# Set the exit codes for the alignment segments checks.
2623
# See PHP/CheckSegmentsAlignment.cmake
2724
set(PHP_HAS_ALIGNMENT_FLAGS_C_EXITCODE 0)
@@ -32,6 +29,9 @@ set(PHP_HAS_MAX_PAGE_SIZE_CXX_EXITCODE 0)
3229
# Set the exit code if flush should be called explicitly after a buffered io.
3330
set(PHP_HAS_FLUSHIO_EXITCODE 1)
3431

32+
# Set the exit code for the getaddrinfo() check.
33+
set(PHP_HAS_GETADDRINFO_EXITCODE 0)
34+
3535
# Set the exit code to 1 when using Clang 17 or later and -fno-sanitize=function
3636
# needs to be added for the PHP_UNDEFINED_SANITIZER option, otherwise set to 0.
3737
set(PHP_HAS_UBSAN_EXITCODE 0)

0 commit comments

Comments
 (0)