Skip to content

Commit 7b895d7

Browse files
committed
Improve consecutive configuration phases
1 parent 2dd65e1 commit 7b895d7

18 files changed

+136
-54
lines changed

cmake/Zend/cmake/CheckGlobalRegisterVariables.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ include_guard(GLOBAL)
1919
include(CheckSourceCompiles)
2020
include(CMakePushCheckState)
2121

22+
# Skip in consecutive configuration phases.
23+
if(DEFINED HAVE_GCC_GLOBAL_REGS)
24+
return()
25+
endif()
26+
2227
message(CHECK_START "Checking for global register variables support")
2328

2429
cmake_push_check_state(RESET)

cmake/Zend/cmake/CheckStackDirection.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ include_guard(GLOBAL)
1515
include(CheckSourceRuns)
1616
include(CMakePushCheckState)
1717

18+
# Skip in consecutive configuration phases.
19+
if(DEFINED ZEND_CHECK_STACK_LIMIT)
20+
return()
21+
endif()
22+
1823
message(CHECK_START "Checking whether the stack grows downwards")
1924

2025
cmake_push_check_state(RESET)

cmake/Zend/cmake/Fibers.cmake

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,32 @@ include(CMakePushCheckState)
3535
add_library(zend_fibers INTERFACE)
3636
add_library(Zend::Fibers ALIAS zend_fibers)
3737

38-
message(CHECK_START "Whether syscall to create shadow stack exists")
39-
cmake_push_check_state(RESET)
40-
set(CMAKE_REQUIRED_QUIET TRUE)
41-
42-
check_source_runs(C [[
43-
#include <unistd.h>
44-
#include <sys/mman.h>
45-
int main(void)
46-
{
47-
void* base = (void *)syscall(451, 0, 0x20000, 0x1);
48-
if (base != (void*)-1) {
49-
munmap(base, 0x20000);
50-
return 0;
38+
if(NOT DEFINED SHADOW_STACK_SYSCALL)
39+
message(CHECK_START "Whether syscall to create shadow stack exists")
40+
cmake_push_check_state(RESET)
41+
set(CMAKE_REQUIRED_QUIET TRUE)
42+
43+
check_source_runs(C [[
44+
#include <unistd.h>
45+
#include <sys/mman.h>
46+
int main(void)
47+
{
48+
void* base = (void *)syscall(451, 0, 0x20000, 0x1);
49+
if (base != (void*)-1) {
50+
munmap(base, 0x20000);
51+
return 0;
52+
}
53+
return 1;
5154
}
52-
return 1;
53-
}
54-
]] SHADOW_STACK_SYSCALL)
55-
cmake_pop_check_state()
56-
if(SHADOW_STACK_SYSCALL)
57-
message(CHECK_PASS "yes")
58-
else()
59-
# If the syscall doesn't exist, we may block the final ELF from
60-
# __PROPERTY_SHSTK via redefine macro as "-D__CET__=1".
61-
message(CHECK_FAIL "no")
55+
]] SHADOW_STACK_SYSCALL)
56+
cmake_pop_check_state()
57+
if(SHADOW_STACK_SYSCALL)
58+
message(CHECK_PASS "yes")
59+
else()
60+
# If the syscall doesn't exist, we may block the final ELF from
61+
# __PROPERTY_SHSTK via redefine macro as "-D__CET__=1".
62+
message(CHECK_FAIL "no")
63+
endif()
6264
endif()
6365

6466
block()

cmake/Zend/cmake/MaxExecutionTimers.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Check whether to enable Zend max execution timers.
1616
* `ZEND_MAX_EXECUTION_TIMERS`
1717
1818
A local variable based on the cache variable and thread safety to be able to
19-
run consecutive configuration runs. When `ZEND_MAX_EXECUTION_TIMERS` cache
19+
run consecutive configuration phases. When `ZEND_MAX_EXECUTION_TIMERS` cache
2020
variable is set to 'auto', local variable default value is set to the
2121
`PHP_THREAD_SAFETY` value.
2222

cmake/cmake/ConfigureChecks.cmake

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -455,22 +455,24 @@ else()
455455
check_symbol_exists(alloca "stdlib.h" HAVE_ALLOCA)
456456
endif()
457457

458-
message(CHECK_START "Checking whether the compiler supports __alignof__")
459-
cmake_push_check_state(RESET)
460-
set(CMAKE_REQUIRED_QUIET TRUE)
461-
check_source_compiles(C [[
462-
int main(void)
463-
{
464-
int align = __alignof__(int);
465-
(void)align;
466-
return 0;
467-
}
468-
]] HAVE_ALIGNOF)
469-
cmake_pop_check_state()
470-
if(HAVE_ALIGNOF)
471-
message(CHECK_PASS "yes")
472-
else()
473-
message(CHECK_FAIL "no")
458+
if(NOT DEFINED HAVE_ALIGNOF)
459+
message(CHECK_START "Checking whether the compiler supports __alignof__")
460+
cmake_push_check_state(RESET)
461+
set(CMAKE_REQUIRED_QUIET TRUE)
462+
check_source_compiles(C [[
463+
int main(void)
464+
{
465+
int align = __alignof__(int);
466+
(void)align;
467+
return 0;
468+
}
469+
]] HAVE_ALIGNOF)
470+
cmake_pop_check_state()
471+
if(HAVE_ALIGNOF)
472+
message(CHECK_PASS "yes")
473+
else()
474+
message(CHECK_FAIL "no")
475+
endif()
474476
endif()
475477

476478
# Check for GCC function attributes on all systems except ones without glibc.

cmake/cmake/modules/PHP/Bison.cmake

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ function(php_bison name input output)
288288

289289
_php_bison_config()
290290

291+
# Skip consecutive find_package() calls when:
292+
# - project calls php_bison() multiple times and Bison will be downloaded
293+
# - the outer find_package() was called prior to php_bison()
294+
# - running consecutive configuration phases and Bison will be downloaded
291295
if(
292-
# Skip consecutive find_package() calls when:
293-
# - project calls php_bison() multiple times and Bison will be downloaded:
294296
NOT TARGET Bison::Bison
295-
# - the outer find_package() was called prior to php_bison():
296297
AND NOT DEFINED BISON_FOUND
297-
# - running consecutive configuration phases:
298-
AND NOT BISON_EXECUTABLE
298+
AND NOT _PHP_BISON_DOWNLOAD
299299
)
300300
find_package(BISON ${PHP_BISON_VERSION} ${quiet})
301301
endif()
@@ -650,5 +650,10 @@ function(_php_bison_download)
650650
get_property(packagesFound GLOBAL PROPERTY PACKAGES_FOUND)
651651
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND BISON)
652652

653+
set(
654+
_PHP_BISON_DOWNLOAD TRUE
655+
CACHE INTERNAL "Internal marker whether the Bison will be downloaded"
656+
)
657+
653658
return(PROPAGATE BISON_FOUND BISON_VERSION)
654659
endfunction()

cmake/cmake/modules/PHP/CheckAVX512.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ include_guard(GLOBAL)
2323
include(CheckSourceCompiles)
2424
include(CMakePushCheckState)
2525

26+
# Skip in consecutive configuration phases.
27+
if(DEFINED PHP_HAVE_AVX512_SUPPORTS AND DEFINED PHP_HAVE_AVX512_VBMI_SUPPORTS)
28+
return()
29+
endif()
30+
2631
message(CHECK_START "Checking for AVX-512 extensions support")
2732

2833
cmake_push_check_state(RESET)

cmake/cmake/modules/PHP/CheckAttribute.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ function(_php_check_attribute what attribute result)
103103
message(FATAL_ERROR "Wrong argument passed: ${what}")
104104
endif()
105105

106+
# Skip in consecutive configuration phases.
107+
if(DEFINED ${result})
108+
return()
109+
endif()
110+
106111
message(CHECK_START "Checking for ${what} attribute ${attribute}")
107112

108113
cmake_push_check_state(RESET)

cmake/cmake/modules/PHP/CheckBrokenGccStrlenOpt.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ include_guard(GLOBAL)
1818
include(CheckSourceRuns)
1919
include(CMakePushCheckState)
2020

21+
# Skip in consecutive configuration phases.
22+
if(DEFINED PHP_HAVE_BROKEN_OPTIMIZE_STRLEN)
23+
return()
24+
endif()
25+
2126
if(
2227
NOT CMAKE_C_COMPILER_ID STREQUAL "GNU"
2328
OR (

cmake/cmake/modules/PHP/CheckBuiltin.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ include(CheckSourceCompiles)
2727
include(CMakePushCheckState)
2828

2929
function(php_check_builtin builtin result)
30+
# Skip in consecutive configuration phases.
31+
if(DEFINED ${result})
32+
return()
33+
endif()
34+
3035
message(CHECK_START "Checking for ${builtin}")
3136

3237
if(builtin STREQUAL "__builtin_clz")

0 commit comments

Comments
 (0)