Skip to content

Commit 20b03f6

Browse files
committed
Sync Zend configuration options and add few tweaks
- ZEND_GCC_GLOBAL_REGS renamed to ZEND_GLOBAL_REGISTER_VARIABLES - Zend configuration options synced for Windows - Added list of installed PHP SAPIs to php-config script although probably not very convenient to have such list in the configuration script as there are more SAPIs binary targets in some SAPI contexts - Updated docs
1 parent 5a19de4 commit 20b03f6

File tree

6 files changed

+65
-33
lines changed

6 files changed

+65
-33
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,34 @@ endblock()
4848
include(CheckIncludeFile)
4949
include(CheckSourceCompiles)
5050
include(CheckSymbolExists)
51+
include(CMakeDependentOption)
5152
include(CMakePushCheckState)
53+
include(FeatureSummary)
5254
include(PHP/AddCustomCommand)
5355

5456
################################################################################
5557
# Configuration.
5658
################################################################################
5759

58-
option(ZEND_GCC_GLOBAL_REGS "Enable GCC global register variables" ON)
59-
mark_as_advanced(ZEND_GCC_GLOBAL_REGS)
60-
61-
option(ZEND_FIBER_ASM "Enable the use of Boost fiber assembly files" ON)
60+
cmake_dependent_option(
61+
ZEND_FIBER_ASM
62+
"Enable the use of Boost fiber assembly files"
63+
ON
64+
[[NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"]]
65+
ON
66+
)
6267
mark_as_advanced(ZEND_FIBER_ASM)
6368

64-
option(ZEND_SIGNALS "Enable Zend signal handling" ON)
69+
option(ZEND_GLOBAL_REGISTER_VARIABLES "Enable global register variables" ON)
70+
mark_as_advanced(ZEND_GLOBAL_REGISTER_VARIABLES)
71+
72+
cmake_dependent_option(
73+
ZEND_SIGNALS
74+
"Enable Zend signal handling"
75+
ON
76+
[[NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"]]
77+
OFF
78+
)
6579
mark_as_advanced(ZEND_SIGNALS)
6680

6781
################################################################################
@@ -393,13 +407,23 @@ endif()
393407
# Check Zend signals.
394408
message(CHECK_START "Checking whether to enable Zend signal handling")
395409
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
396-
if(NOT HAVE_SIGACTION OR NOT ZEND_SIGNALS)
397-
message(CHECK_FAIL "no")
398-
set_property(CACHE ZEND_SIGNALS PROPERTY VALUE 0)
399-
else()
410+
if(HAVE_SIGACTION AND ZEND_SIGNALS)
400411
message(CHECK_PASS "yes")
401-
set_property(CACHE ZEND_SIGNALS PROPERTY VALUE 1)
412+
413+
set_property(CACHE ZEND_SIGNALS PROPERTY VALUE ON)
414+
415+
# zend_config.h (or its parent php_config.h) isn't included in some zend_*
416+
# files, therefore also compilation definitions are added.
417+
target_compile_definitions(zend PRIVATE ZEND_SIGNALS)
418+
else()
419+
set_property(CACHE ZEND_SIGNALS PROPERTY VALUE OFF)
420+
message(CHECK_FAIL "no")
402421
endif()
422+
add_feature_info(
423+
"Zend signals"
424+
ZEND_SIGNALS
425+
"signals handling within the Zend Engine for performance"
426+
)
403427

404428
# Check Zend max execution timers.
405429
include(Zend/MaxExecutionTimers)
@@ -414,8 +438,8 @@ include(Zend/CheckDlsym)
414438
include(Zend/CheckMMAlignment)
415439

416440
# Check for global register variables.
417-
if(ZEND_GCC_GLOBAL_REGS)
418-
include(Zend/CheckGlobalRegisterVars)
441+
if(ZEND_GLOBAL_REGISTER_VARIABLES)
442+
include(Zend/CheckGlobalRegisterVariables)
419443
endif()
420444

421445
# Check if stack grows downward.
@@ -424,12 +448,6 @@ include(Zend/CheckStackLimit)
424448
# Check float precision.
425449
include(Zend/CheckFloatPrecision)
426450

427-
# zend_config.h (or its parent php_config.h) isn't included in some zend_*
428-
# files, therefore also compilation definitions need to be added.
429-
if(ZEND_SIGNALS)
430-
target_compile_definitions(zend PRIVATE ZEND_SIGNALS)
431-
endif()
432-
433451
################################################################################
434452
# Generate lexers and parsers.
435453
################################################################################

cmake/cmake/modules/Zend/CheckGlobalRegisterVars.cmake renamed to cmake/cmake/modules/Zend/CheckGlobalRegisterVariables.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#[=============================================================================[
2-
Check for global register variables support.
2+
Check whether the compiler and target system support global register variables.
33
4-
Cache variables:
4+
Global register variables are relevant for the GNU C compatible compilers.
5+
6+
See also: [GCC global register variables](https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html)
7+
8+
## Cache variables
59
610
* `HAVE_GCC_GLOBAL_REGS`
7-
Whether the target system has support for global register variables.
11+
12+
Whether global register variables are supported.
813
#]=============================================================================]
914

1015
include_guard(GLOBAL)

cmake/cmake/modules/Zend/Fibers.cmake

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ Check if Fibers can be used.
44
This module adds Boost fiber assembly files support if available for the
55
platform, otherwise it checks if ucontext can be used.
66
7-
Interface library:
7+
## Control variables
88
9-
* `Zend::Fibers`
10-
Library using Boost fiber assembly files if available.
9+
* `ZEND_FIBER_ASM`
1110
12-
Cache variables:
11+
Whether to use Boost fiber assembly files.
12+
13+
## Cache variables
1314
1415
* `ZEND_FIBER_UCONTEXT`
16+
1517
Whether `<ucontext.h>` header file is available and should be used.
1618
17-
Control variables:
19+
## Interface library
1820
19-
* `ZEND_FIBER_ASM`
20-
Whether to use Boost fiber assembly files.
21+
* `Zend::Fibers`
22+
23+
Interface library using Boost fiber assembly files and compile options if
24+
available.
2125
#]=============================================================================]
2226

2327
include_guard(GLOBAL)

cmake/cmake/modules/Zend/MaxExecutionTimers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Check whether to enable Zend max execution timers.
33
44
## Cache variables
55
6-
* [`ZEND_MAX_EXECUTION_TIMERS`](/docs/cmake/ZEND_MAX_EXECUTION_TIMERS.md)
6+
* [`ZEND_MAX_EXECUTION_TIMERS`](/docs/cmake/variables/ZEND_MAX_EXECUTION_TIMERS.md)
77
88
* `HAVE_TIMER_CREATE`
99
@@ -101,7 +101,7 @@ if(libraryForTimerCreate)
101101
endif()
102102

103103
# The configuration header with ZEND_MAX_EXECUTION_TIMERS might not be included
104-
# in some source files, therefore also compilation definitions is added.
104+
# in some source files, therefore also compilation definitions are added.
105105
if(ZEND_MAX_EXECUTION_TIMERS)
106106
target_compile_definitions(
107107
Zend::MaxExecutionTimers

cmake/sapi/phpdbg/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ block()
274274
configure_file(phpdbg.1.in phpdbg.1 @ONLY)
275275
endblock()
276276

277-
# TODO: Add prefix and suffix to installed executable file.
278277
install(
279278
TARGETS php_phpdbg
280279
RUNTIME

cmake/scripts/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ block()
4040

4141
message(STATUS "Creating scripts/php-config")
4242

43+
get_cmake_property(sapis PHP_SAPIS)
44+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
45+
set(sapis "$<JOIN:$<LIST:SORT,${sapis}>, >")
46+
else()
47+
set(sapis "$<JOIN:${sapis}, >")
48+
endif()
49+
4350
# Replace the upstream php-config script hardcoded php include directory to a
4451
# template placeholder.
4552
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/php-config.in" content)
@@ -73,8 +80,7 @@ block()
7380
EXEEXT "${CMAKE_EXECUTABLE_SUFFIX}"
7481
# TODO:
7582
CONFIGURE_OPTIONS ""
76-
# TODO:
77-
PHP_INSTALLED_SAPIS ""
83+
PHP_INSTALLED_SAPIS "${sapis}"
7884
EXPANDED_PHP_CONFIG_FILE_SCAN_DIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,${PHP_CONFIG_FILE_SCAN_DIR},$<INSTALL_PREFIX>>"
7985
EXPANDED_PHP_CONFIG_FILE_PATH "$<PATH:ABSOLUTE_PATH,NORMALIZE,${PHP_CONFIG_FILE_PATH},$<INSTALL_PREFIX>>"
8086
bindir "$<PATH:ABSOLUTE_PATH,NORMALIZE,${CMAKE_INSTALL_BINDIR},$<INSTALL_PREFIX>>"

0 commit comments

Comments
 (0)