Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions cmake/Zend/cmake/CheckDlsym.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ Some non-ELF platforms, such as OpenBSD, FreeBSD, NetBSD, Mac OSX (~10.3),
needed underscore character (`_`) prefix for symbols, when using `dlsym()`. This
module is obsolete on current platforms.

## Result variables
## Cache variables

* `DLSYM_NEEDS_UNDERSCORE`

Whether `dlsym()` requires a leading underscore in symbol names.
#]=============================================================================]

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED DLSYM_NEEDS_UNDERSCORE)
return()
endif()

include(CheckIncludeFile)

message(
Expand Down Expand Up @@ -112,9 +115,17 @@ block()
)
endblock()

set(
DLSYM_NEEDS_UNDERSCORE
""
CACHE INTERNAL
"Whether 'dlsym()' requires a leading underscore in symbol names."
)

if(DLSYM_NEEDS_UNDERSCORE_COMPILED AND DLSYM_NEEDS_UNDERSCORE_EXITCODE EQUAL 2)
set(DLSYM_NEEDS_UNDERSCORE TRUE)
set_property(CACHE DLSYM_NEEDS_UNDERSCORE PROPERTY VALUE TRUE)
message(CHECK_PASS "yes")
else()
set_property(CACHE DLSYM_NEEDS_UNDERSCORE PROPERTY VALUE FALSE)
message(CHECK_FAIL "no")
endif()
5 changes: 5 additions & 0 deletions cmake/Zend/cmake/CheckGlobalRegisterVariables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ See also: [GCC global register variables](https://gcc.gnu.org/onlinedocs/gcc/Glo

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED HAVE_GCC_GLOBAL_REGS)
return()
endif()

include(CheckSourceCompiles)
include(CMakePushCheckState)

Expand Down
5 changes: 5 additions & 0 deletions cmake/Zend/cmake/CheckStackDirection.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Check whether the stack grows downwards. Assumes contiguous stack.

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED ZEND_CHECK_STACK_LIMIT)
return()
endif()

include(CheckSourceRuns)
include(CMakePushCheckState)

Expand Down
48 changes: 25 additions & 23 deletions cmake/Zend/cmake/Fibers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,32 @@ include(CMakePushCheckState)
add_library(zend_fibers INTERFACE)
add_library(Zend::Fibers ALIAS zend_fibers)

message(CHECK_START "Whether syscall to create shadow stack exists")
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_QUIET TRUE)

check_source_runs(C [[
#include <unistd.h>
#include <sys/mman.h>
int main(void)
{
void* base = (void *)syscall(451, 0, 0x20000, 0x1);
if (base != (void*)-1) {
munmap(base, 0x20000);
return 0;
if(NOT DEFINED SHADOW_STACK_SYSCALL)
message(CHECK_START "Whether syscall to create shadow stack exists")
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_QUIET TRUE)

check_source_runs(C [[
#include <unistd.h>
#include <sys/mman.h>
int main(void)
{
void* base = (void *)syscall(451, 0, 0x20000, 0x1);
if (base != (void*)-1) {
munmap(base, 0x20000);
return 0;
}
return 1;
}
return 1;
}
]] SHADOW_STACK_SYSCALL)
cmake_pop_check_state()
if(SHADOW_STACK_SYSCALL)
message(CHECK_PASS "yes")
else()
# If the syscall doesn't exist, we may block the final ELF from
# __PROPERTY_SHSTK via redefine macro as "-D__CET__=1".
message(CHECK_FAIL "no")
]] SHADOW_STACK_SYSCALL)
cmake_pop_check_state()
if(SHADOW_STACK_SYSCALL)
message(CHECK_PASS "yes")
else()
# If the syscall doesn't exist, we may block the final ELF from
# __PROPERTY_SHSTK via redefine macro as "-D__CET__=1".
message(CHECK_FAIL "no")
endif()
endif()

block()
Expand Down
2 changes: 1 addition & 1 deletion cmake/Zend/cmake/MaxExecutionTimers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Check whether to enable Zend max execution timers.
* `ZEND_MAX_EXECUTION_TIMERS`

A local variable based on the cache variable and thread safety to be able to
run consecutive configuration runs. When `ZEND_MAX_EXECUTION_TIMERS` cache
run consecutive configuration phases. When `ZEND_MAX_EXECUTION_TIMERS` cache
variable is set to 'auto', local variable default value is set to the
`PHP_THREAD_SAFETY` value.

Expand Down
16 changes: 9 additions & 7 deletions cmake/cmake/ConfigureChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ cmake_pop_check_state()
check_type_size("gid_t" SIZEOF_GID_T)
if(NOT HAVE_SIZEOF_GID_T)
set(
gid_t int
CACHE INTERNAL "Define as 'int' if <sys/types.h> doesn't define."
gid_t
int
CACHE INTERNAL
"Define as 'int' if not defined in <sys/types.h>."
)
endif()

Expand Down Expand Up @@ -204,8 +206,10 @@ endif()
check_type_size("uid_t" SIZEOF_UID_T)
if(NOT HAVE_SIZEOF_UID_T)
set(
uid_t int
CACHE INTERNAL "Define as 'int' if <sys/types.h> doesn't define."
uid_t
int
CACHE INTERNAL
"Define as 'int' if not defined in <sys/types.h>."
)
endif()

Expand Down Expand Up @@ -438,9 +442,7 @@ endif()
include(PHP/CheckByteOrder)

# Check for IPv6 support.
if(PHP_IPV6)
include(PHP/CheckIPv6)
endif()
include(PHP/CheckIPv6)

# Check how flush should be called.
include(PHP/CheckFlushIo)
Expand Down
6 changes: 4 additions & 2 deletions cmake/cmake/modules/FindACL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ if(NOT DEFINED ACL_IS_BUILT_IN)

if(_acl_works)
set(
ACL_IS_BUILT_IN TRUE
CACHE INTERNAL "Whether ACL is a part of the C library"
ACL_IS_BUILT_IN
TRUE
CACHE INTERNAL
"Whether ACL is a part of the C library."
)
else()
set(ACL_IS_BUILT_IN FALSE)
Expand Down
17 changes: 12 additions & 5 deletions cmake/cmake/modules/PHP/Bison.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ function(php_bison name input output)

_php_bison_config()

# Skip consecutive find_package() calls when:
# - project calls php_bison() multiple times and Bison will be downloaded
# - the outer find_package() was called prior to php_bison()
# - running consecutive configuration phases and Bison will be downloaded
if(
# Skip consecutive find_package() calls when:
# - project calls php_bison() multiple times and Bison will be downloaded:
NOT TARGET Bison::Bison
# - the outer find_package() was called prior to php_bison():
AND NOT DEFINED BISON_FOUND
# - running consecutive configuration phases:
AND NOT BISON_EXECUTABLE
AND NOT _PHP_BISON_DOWNLOAD
)
find_package(BISON ${PHP_BISON_VERSION} ${quiet})
endif()
Expand Down Expand Up @@ -650,5 +650,12 @@ function(_php_bison_download)
get_property(packagesFound GLOBAL PROPERTY PACKAGES_FOUND)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND BISON)

set(
_PHP_BISON_DOWNLOAD
TRUE
CACHE INTERNAL
"Internal marker whether the Bison will be downloaded."
)

return(PROPAGATE BISON_FOUND BISON_VERSION)
endfunction()
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckAVX512.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ TODO: Adjust checks for MSVC.

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED PHP_HAVE_AVX512_SUPPORTS AND DEFINED PHP_HAVE_AVX512_VBMI_SUPPORTS)
return()
endif()

include(CheckSourceCompiles)
include(CMakePushCheckState)

Expand Down
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckAttribute.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ function(_php_check_attribute what attribute result)
message(FATAL_ERROR "Wrong argument passed: ${what}")
endif()

# Skip in consecutive configuration phases.
if(DEFINED ${result})
return()
endif()

message(CHECK_START "Checking for ${what} attribute ${attribute}")

cmake_push_check_state(RESET)
Expand Down
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckBrokenGccStrlenOpt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED PHP_HAVE_BROKEN_OPTIMIZE_STRLEN)
return()
endif()

include(CheckSourceRuns)
include(CMakePushCheckState)

Expand Down
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckBuiltin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ include(CheckSourceCompiles)
include(CMakePushCheckState)

function(php_check_builtin builtin result)
# Skip in consecutive configuration phases.
if(DEFINED ${result})
return()
endif()

message(CHECK_START "Checking for ${builtin}")

if(builtin STREQUAL "__builtin_clz")
Expand Down
18 changes: 17 additions & 1 deletion cmake/cmake/modules/PHP/CheckByteOrder.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,30 @@ Check whether system byte ordering is big-endian.

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED WORDS_BIGENDIAN)
return()
endif()

include(CheckSourceRuns)

message(CHECK_START "Checking byte ordering")

if(CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN")
message(CHECK_PASS "big-endian")
set(WORDS_BIGENDIAN TRUE CACHE INTERNAL "Whether byte ordering is big-endian.")
set(
WORDS_BIGENDIAN
TRUE
CACHE INTERNAL
"Whether byte ordering is big-endian."
)
elseif(CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN")
set(
WORDS_BIGENDIAN
FALSE
CACHE INTERNAL
"Whether byte ordering is big-endian."
)
message(CHECK_PASS "little-endian")
else()
if(
Expand Down
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckCompilerFlag.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ function(php_check_compiler_flag lang flag result)
message(FATAL_ERROR "Missing arguments.")
endif()

# Skip in consecutive configuration phases.
if(DEFINED ${result})
return()
endif()

if(NOT CMAKE_REQUIRED_QUIET)
message(CHECK_START "Checking whether the ${lang} compiler accepts ${flag}")
endif()
Expand Down
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckCopyFileRange.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ only on Linux.

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED HAVE_COPY_FILE_RANGE)
return()
endif()

include(CheckSourceCompiles)
include(CMakePushCheckState)

Expand Down
14 changes: 11 additions & 3 deletions cmake/cmake/modules/PHP/CheckFlushIo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ Check if flush should be called explicitly after buffered io.
## Cache variables

* `HAVE_FLUSHIO`

Whether flush should be called explicitly after a buffered io.
#]=============================================================================]

include_guard(GLOBAL)

# Skip in consecutive configuration phases.
if(DEFINED HAVE_FLUSHIO)
return()
endif()

include(CheckIncludeFile)
include(CheckSourceRuns)
include(CMakePushCheckState)
Expand All @@ -22,7 +25,12 @@ message(CHECK_START

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
message(CHECK_FAIL "no")
set(HAVE_FLUSHIO FALSE CACHE INTERNAL "")
set(
HAVE_FLUSHIO
FALSE
CACHE INTERNAL
"Whether flush should be called explicitly after a buffered io."
)
return()
endif()

Expand Down
5 changes: 5 additions & 0 deletions cmake/cmake/modules/PHP/CheckFopencookie.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ if(NOT HAVE_FOPENCOOKIE)
return()
endif()

# Skip in consecutive configuration phases.
if(DEFINED COOKIE_SEEKER_USES_OFF64_T)
return()
endif()

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

Expand Down
Loading
Loading