Skip to content

Commit 3472e9f

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 410503e + 782019f commit 3472e9f

File tree

2 files changed

+78
-29
lines changed

2 files changed

+78
-29
lines changed

cmake/ext/standard/CMakeLists.txt

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -284,41 +284,15 @@ endif()
284284
# Configuration checks.
285285
################################################################################
286286

287+
# Check for ARM CRC32 API.
288+
include(cmake/CheckArmCrc32.cmake)
289+
287290
# Check for fnmatch() implementation.
288291
include(cmake/CheckFnmatch.cmake)
289292

290293
# Check strptime().
291294
include(cmake/CheckStrptime.cmake)
292295

293-
# Check for aarch64 CRC32 API.
294-
message(CHECK_START "Checking for aarch64 CRC32 API availability")
295-
cmake_push_check_state(RESET)
296-
set(CMAKE_REQUIRED_QUIET TRUE)
297-
check_source_compiles(C [[
298-
#include <arm_acle.h>
299-
#if defined(__GNUC__)
300-
# if !defined(__clang__)
301-
# pragma GCC push_options
302-
# pragma GCC target ("+nothing+crc")
303-
# elif defined(__APPLE__)
304-
# pragma clang attribute push(__attribute__((target("crc"))), apply_to=function)
305-
# else
306-
# pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function)
307-
# endif
308-
#endif
309-
int main(void)
310-
{
311-
__crc32d(0, 0);
312-
return 0;
313-
}
314-
]] HAVE_AARCH64_CRC32)
315-
cmake_pop_check_state()
316-
if(HAVE_AARCH64_CRC32)
317-
message(CHECK_PASS "yes")
318-
else()
319-
message(CHECK_FAIL "no")
320-
endif()
321-
322296
# Check if there is a support means of creating a new process and defining which
323297
# handles it receives.
324298
message(CHECK_START "Checking if OS can spawn processes with inherited handles")
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#[=============================================================================[
2+
Check whether CRC32 API is supported on ARM architecture.
3+
4+
Result variables:
5+
6+
* HAVE_AARCH64_CRC32
7+
#]=============================================================================]
8+
9+
if(DEFINED PHP_EXT_STANDARD_HAS_ARM_CRC32)
10+
set(HAVE_AARCH64_CRC32 FALSE)
11+
12+
if(PHP_EXT_STANDARD_HAS_ARM_CRC32)
13+
set(HAVE_AARCH64_CRC32 TRUE)
14+
endif()
15+
16+
return()
17+
endif()
18+
19+
include(CheckSourceCompiles)
20+
include(CMakePushCheckState)
21+
22+
include_guard(GLOBAL)
23+
24+
function(_php_ext_standard_check_arm_crc32 result)
25+
message(CHECK_START "Checking for ARM CRC32 API availability")
26+
27+
set(${result} FALSE)
28+
29+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
30+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
31+
set(${result} TRUE)
32+
endif()
33+
34+
set(
35+
PHP_EXT_STANDARD_HAS_ARM_CRC32
36+
${${result}}
37+
CACHE INTERNAL
38+
"Whether ARM has CRC32."
39+
)
40+
endif()
41+
42+
cmake_push_check_state(RESET)
43+
set(CMAKE_REQUIRED_QUIET TRUE)
44+
45+
check_source_compiles(C [[
46+
#include <arm_acle.h>
47+
#ifdef __GNUC__
48+
# ifndef __clang__
49+
# pragma GCC push_options
50+
# pragma GCC target ("+nothing+crc")
51+
# elif defined(__APPLE__)
52+
# pragma clang attribute push(__attribute__((target("crc"))), apply_to=function)
53+
# else
54+
# pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function)
55+
# endif
56+
#endif
57+
int main(void)
58+
{
59+
__crc32d(0, 0);
60+
return 0;
61+
}
62+
]] PHP_EXT_STANDARD_HAS_ARM_CRC32)
63+
cmake_pop_check_state()
64+
65+
if(PHP_EXT_STANDARD_HAS_ARM_CRC32)
66+
message(CHECK_PASS "yes")
67+
set(${result} TRUE)
68+
else()
69+
message(CHECK_FAIL "no")
70+
endif()
71+
72+
return(PROPAGATE ${result})
73+
endfunction()
74+
75+
_php_ext_standard_check_arm_crc32(HAVE_AARCH64_CRC32)

0 commit comments

Comments
 (0)