Skip to content

Commit be365ff

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents d7a9a96 + e57f408 commit be365ff

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ endif()
4343
# Check headers.
4444
################################################################################
4545

46-
check_include_files(alloca.h HAVE_ALLOCA_H)
4746
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
4847
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
4948

@@ -407,20 +406,17 @@ else()
407406
endif()
408407

409408
################################################################################
410-
# Miscellaneous checks.
409+
# Run all checks from cmake/checks.
411410
################################################################################
412411

413-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckAVX512.cmake)
414-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckCopyFileRange.cmake)
415-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFlushIo.cmake)
416-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFnmatch.cmake)
417-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFopencookie.cmake)
418-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGetaddrinfo.cmake)
419-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGethostbynameR.cmake)
420-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGetifaddrs.cmake)
421-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckIPv6.cmake)
422-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckReentrantFunctions.cmake)
423-
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckWrite.cmake)
412+
file(GLOB checks ${CMAKE_CURRENT_LIST_DIR}/checks/Check*.cmake)
413+
foreach(check IN LISTS checks)
414+
include(${check})
415+
endforeach()
416+
417+
################################################################################
418+
# Miscellaneous checks.
419+
################################################################################
424420

425421
# Checking file descriptor sets.
426422
message(CHECK_START "Checking file descriptor sets size")
@@ -441,16 +437,6 @@ else()
441437
message(CHECK_PASS "using system default")
442438
endif()
443439

444-
if(HAVE_ALLOCA_H)
445-
# Most *.nix systems.
446-
check_symbol_exists(alloca alloca.h HAVE_ALLOCA)
447-
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
448-
check_symbol_exists(alloca malloc.h HAVE_ALLOCA)
449-
else()
450-
# BSD-based systems.
451-
check_symbol_exists(alloca stdlib.h HAVE_ALLOCA)
452-
endif()
453-
454440
message(CHECK_START "Checking whether the compiler supports __alignof__")
455441
cmake_push_check_state(RESET)
456442
set(CMAKE_REQUIRED_QUIET TRUE)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#[=============================================================================[
2+
This check determines whether the system supports alloca() and follows the
3+
behavior of Autoconf's AC_FUNC_ALLOCA macro, with some adjustments for obsolete
4+
systems:
5+
6+
* Autoconf also checks whether <alloca.h> works on certain obsolete systems.
7+
* Autoconf provides variable substitution to integrate a custom alloca.c
8+
implementation if alloca() is not available on the system. However, PHP
9+
doesn't use this feature.
10+
11+
Result variables:
12+
13+
* HAVE_ALLOCA
14+
* HAVE_ALLOCA_H
15+
#]=============================================================================]
16+
17+
include(CheckIncludeFiles)
18+
include(CheckSymbolExists)
19+
20+
# On Windows, alloca is defined in malloc.h as _alloca. Cache variables are
21+
# overridden to speed up the check and commands used for documentation purposes.
22+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
23+
set(PHP_HAS_ALLOCA_H FALSE)
24+
set(PHP_HAS_ALLOCA TRUE)
25+
check_symbol_exists(alloca malloc.h PHP_HAS_ALLOCA)
26+
else()
27+
check_include_files(alloca.h PHP_HAS_ALLOCA_H)
28+
29+
if(PHP_HAS_ALLOCA_H)
30+
# Most *.nix systems (Linux, macOS, Solaris/illumos, Haiku).
31+
check_symbol_exists(alloca alloca.h PHP_HAS_ALLOCA)
32+
else()
33+
# BSD-based systems, old Linux.
34+
check_symbol_exists(alloca stdlib.h PHP_HAS_ALLOCA)
35+
endif()
36+
endif()
37+
38+
set(HAVE_ALLOCA ${PHP_HAS_ALLOCA})
39+
set(HAVE_ALLOCA_H ${PHP_HAS_ALLOCA_H})

cmake/cmake/platforms/Windows.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
5555
##############################################################################
5656

5757
set(HAVE_ALIGNOF FALSE)
58-
set(HAVE_ALLOCA TRUE)
59-
set(HAVE_ALLOCA_H FALSE)
6058
set(HAVE_ALPHASORT FALSE)
6159
set(HAVE_ARC4RANDOM_BUF FALSE)
6260
set(HAVE_ARPA_INET_H FALSE)

0 commit comments

Comments
 (0)