Skip to content

Commit a1d9741

Browse files
committed
Sync booleans
- CMake variables (TRUE/FALSE/ON/OFF) - Preprocessor macros simplified where possible - option() default value is OFF - Missing ZEND_ENABLE_STATIC_TSRMLS_CACHE added to phpdbg shared module - FindSendmail refactored also for Windows usage - Some cache variables converted to regular/local/directory variables
1 parent d12b4d8 commit a1d9741

File tree

95 files changed

+322
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+322
-323
lines changed

bin/php.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ function(php_check_url url result)
184184
)
185185

186186
if(status EQUAL 0)
187-
set(${result} 1)
187+
set(${result} TRUE)
188188
else()
189-
set(${result} 0)
189+
set(${result} FALSE)
190190
endif()
191191

192192
return(PROPAGATE ${result})

cmake/Zend/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ target_include_directories(
310310
target_compile_definitions(
311311
zend
312312
PRIVATE
313-
ZEND_ENABLE_STATIC_TSRMLS_CACHE=1
313+
ZEND_ENABLE_STATIC_TSRMLS_CACHE
314314
PUBLIC
315315
$<$<PLATFORM_ID:Windows>:LIBZEND_EXPORTS>
316316
)

cmake/Zend/cmake/CheckDlsym.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ check_include_file(dlfcn.h HAVE_DLFCN_H)
3030

3131
block()
3232
if(HAVE_DLFCN_H)
33-
set(definitions "-DHAVE_DLFCN_H=1")
33+
set(definitions "-DHAVE_DLFCN_H")
3434
endif()
3535

3636
try_run(

cmake/cmake/CMakeDefaults.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,23 @@ set(CMAKE_SHARED_MODULE_PREFIX_CXX "")
3535
set(CMAKE_STATIC_LIBRARY_PREFIX_CXX "")
3636

3737
# Whether to enable verbose output from Makefile builds.
38-
option(CMAKE_VERBOSE_MAKEFILE "Enable verbose output from Makefile builds" OFF)
38+
option(CMAKE_VERBOSE_MAKEFILE "Enable verbose output from Makefile builds")
3939
mark_as_advanced(CMAKE_VERBOSE_MAKEFILE)
4040

4141
# Whether to show message context in configuration log.
4242
option(
4343
CMAKE_MESSAGE_CONTEXT_SHOW
4444
"Show message context in configuration log, where possible"
45-
OFF
4645
)
4746
mark_as_advanced(CMAKE_MESSAGE_CONTEXT_SHOW)
4847

4948
# Whether to build all libraries as shared.
50-
option(BUILD_SHARED_LIBS "Build enabled PHP extensions as shared libraries" OFF)
49+
option(BUILD_SHARED_LIBS "Build enabled PHP extensions as shared libraries")
5150

5251
# Treat all compile warnings as errors at the build phase, if compiler supports
5352
# such compile option, like -Werror, /WX, or similar.
5453
option(
5554
CMAKE_COMPILE_WARNING_AS_ERROR
5655
"Treat all compile warnings as errors at the build phase"
57-
OFF
5856
)
5957
mark_as_advanced(CMAKE_COMPILE_WARNING_AS_ERROR)

cmake/cmake/Configuration.cmake

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ mark_as_advanced(PHP_PROGRAM_PREFIX)
9292
set(PHP_PROGRAM_SUFFIX "" CACHE STRING "Append suffix to the program names")
9393
mark_as_advanced(PHP_PROGRAM_SUFFIX)
9494

95-
option(PHP_RE2C_CGOTO "Enable computed goto GCC extension with re2c" OFF)
95+
option(PHP_RE2C_CGOTO "Enable computed goto GCC extension with re2c")
9696
mark_as_advanced(PHP_RE2C_CGOTO)
9797

98-
option(PHP_THREAD_SAFETY "Enable thread safety (ZTS)" OFF)
98+
option(PHP_THREAD_SAFETY "Enable thread safety (ZTS)")
9999

100100
cmake_dependent_option(
101101
PHP_USE_RTLD_NOW
@@ -127,10 +127,10 @@ mark_as_advanced(PHP_DEFAULT_SHORT_OPEN_TAG)
127127
option(PHP_IPV6 "Enable IPv6 support" ON)
128128
mark_as_advanced(PHP_IPV6)
129129

130-
option(PHP_DMALLOC "Enable the Dmalloc memory debugger library" OFF)
130+
option(PHP_DMALLOC "Enable the Dmalloc memory debugger library")
131131
mark_as_advanced(PHP_DMALLOC)
132132

133-
option(PHP_DTRACE "Enable DTrace support" OFF)
133+
option(PHP_DTRACE "Enable DTrace support")
134134
mark_as_advanced(PHP_DTRACE)
135135

136136
set(PHP_FD_SETSIZE "" CACHE STRING "Size of file descriptor sets")
@@ -139,30 +139,25 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND PHP_FD_SETSIZE STREQUAL "")
139139
endif()
140140
mark_as_advanced(PHP_FD_SETSIZE)
141141

142-
option(PHP_VALGRIND "Enable the Valgrind support" OFF)
142+
option(PHP_VALGRIND "Enable the Valgrind support")
143143
mark_as_advanced(PHP_VALGRIND)
144144

145145
option(
146146
PHP_MEMORY_SANITIZER
147147
"Enable the memory sanitizer compiler options (Clang only)"
148-
OFF
149148
)
150149
mark_as_advanced(PHP_MEMORY_SANITIZER)
151150

152-
option(PHP_ADDRESS_SANITIZER "Enable the address sanitizer compiler option" OFF)
151+
option(PHP_ADDRESS_SANITIZER "Enable the address sanitizer compiler option")
153152
mark_as_advanced(PHP_ADDRESS_SANITIZER)
154153

155-
option(
156-
PHP_UNDEFINED_SANITIZER
157-
"Enable the undefined sanitizer compiler option"
158-
OFF
159-
)
154+
option(PHP_UNDEFINED_SANITIZER "Enable the undefined sanitizer compiler option")
160155
mark_as_advanced(PHP_UNDEFINED_SANITIZER)
161156

162-
option(PHP_GCOV "Enable GCOV code coverage and include GCOV symbols" OFF)
157+
option(PHP_GCOV "Enable GCOV code coverage and include GCOV symbols")
163158
mark_as_advanced(PHP_GCOV)
164159

165-
option(PHP_LIBGCC "Explicitly link against libgcc" OFF)
160+
option(PHP_LIBGCC "Explicitly link against libgcc")
166161
mark_as_advanced(PHP_LIBGCC)
167162

168163
option(PHP_CCACHE "Use ccache if available on the system" ON)

cmake/cmake/ConfigureChecks.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ if(SIZEOF_PTRDIFF_T STREQUAL "")
189189
"Couldn't determine the ptrdiff_t size, setting it to ${SIZEOF_PTRDIFF_T}."
190190
)
191191
endif()
192-
set(HAVE_PTRDIFF_T 1)
192+
set(HAVE_PTRDIFF_T TRUE)
193193

194194
check_type_size("size_t" SIZEOF_SIZE_T)
195195
if(SIZEOF_SIZE_T STREQUAL "")
@@ -391,7 +391,7 @@ include(PHP/CheckFopencookie)
391391
# component of the path has execute but not read permissions.
392392
message(CHECK_START "Checking for broken getcwd()")
393393
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
394-
set(HAVE_BROKEN_GETCWD 1 CACHE INTERNAL "Define if system has broken getcwd")
394+
set(HAVE_BROKEN_GETCWD TRUE)
395395
message(CHECK_PASS "yes")
396396
else()
397397
message(CHECK_FAIL "no")
@@ -814,8 +814,8 @@ if(PHP_GCOV)
814814

815815
if(TARGET Gcov::Gcov)
816816
target_link_libraries(php_configuration INTERFACE Gcov::Gcov)
817-
818817
gcov_generate_report()
818+
set(HAVE_GCOV TRUE)
819819
endif()
820820
endif()
821821

@@ -830,7 +830,7 @@ if(PHP_VALGRIND)
830830
)
831831

832832
if(Valgrind_FOUND)
833-
set(HAVE_VALGRIND 1)
833+
set(HAVE_VALGRIND TRUE)
834834
endif()
835835

836836
target_link_libraries(php_configuration INTERFACE Valgrind::Valgrind)

cmake/cmake/Requirements.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ if(
118118
endif()
119119

120120
################################################################################
121-
# Find sendmail binary.
121+
# Find mailer.
122122
################################################################################
123123
find_package(Sendmail)
124124

cmake/cmake/modules/FindGcov.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Module defines the following `IMPORTED` target(s):
1616
* `Gcov_GCOVR_EXECUTABLE` - The gcovr program executable.
1717
* `Gcov_GENHTML_EXECUTABLE` - The genhtml program executable.
1818
* `Gcov_LCOV_EXECUTABLE` - The lcov program executable.
19-
* `HAVE_GCOV` - Whether the Gcov is available.
2019
2120
## Macros provided by this module
2221
@@ -88,8 +87,6 @@ find_package_handle_standard_args(
8887
unset(_reason)
8988

9089
if(Gcov_FOUND AND NOT TARGET Gcov::Gcov)
91-
set(HAVE_GCOV 1 CACHE INTERNAL "Whether GCOV is available.")
92-
9390
add_library(Gcov::Gcov INTERFACE IMPORTED)
9491

9592
set_target_properties(
Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
#[=============================================================================[
22
# FindSendmail
33
4-
Find the `sendmail` program.
4+
This module finds mailer program for PHP and sets sensible defaults based on the
5+
target system. On Windows, PHP has built-in mailer (sendmail.c), on *nix systems
6+
either `sendmail` is used if found, or a general default value is set to
7+
`/usr/sbin/sendmail`.
58
69
## Result variables
710
8-
* `Sendmail_FOUND` - Whether sendmail has been found.
11+
* `Sendmail_FOUND` - Whether mailer has been found.
12+
* `PROG_SENDMAIL` - Path to the sendmail executable program, either found by
13+
the module or set to a sensible default value.
914
1015
## Cache variables
1116
12-
* `Sendmail_EXECUTABLE` - Path to the sendmail executable, if found.
13-
* `PROG_SENDMAIL` - Path to the sendmail program.
17+
* `Sendmail_EXECUTABLE` - Path to the sendmail executable program, if found.
1418
#]=============================================================================]
1519

1620
include(FeatureSummary)
@@ -23,29 +27,40 @@ set_package_properties(
2327
DESCRIPTION "Mail Transport Agent"
2428
)
2529

26-
find_program(
27-
Sendmail_EXECUTABLE
28-
NAMES sendmail
29-
DOC "The path to the sendmail executable"
30-
)
30+
set(_reason)
3131

32-
if(Sendmail_EXECUTABLE)
33-
set(_sendmail ${Sendmail_EXECUTABLE})
32+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
33+
set(_sendmailIsBuiltInMsg "PHP built-in mailer (Windows)")
34+
set(_sendmailRequiredVars _sendmailIsBuiltInMsg)
3435
else()
35-
set(_sendmail "/usr/sbin/sendmail")
36-
endif()
36+
find_program(
37+
Sendmail_EXECUTABLE
38+
NAMES sendmail
39+
DOC "The path to the sendmail executable"
40+
)
41+
mark_as_advanced(Sendmail_EXECUTABLE)
3742

38-
# TODO: Should this be result variable?
39-
set(PROG_SENDMAIL "${_sendmail}" CACHE INTERNAL "Path to sendmail executable")
43+
set(_sendmailRequiredVars Sendmail_EXECUTABLE)
4044

41-
mark_as_advanced(Sendmail_EXECUTABLE)
45+
if(Sendmail_EXECUTABLE)
46+
set(PROG_SENDMAIL ${Sendmail_EXECUTABLE})
47+
else()
48+
set(PROG_SENDMAIL "/usr/sbin/sendmail")
49+
endif()
50+
51+
set(
52+
_reason
53+
"sendmail not found. Default set to ${PROG_SENDMAIL}.
54+
It can be overridden with 'sendmail_path' php.ini directive."
55+
)
56+
endif()
4257

4358
find_package_handle_standard_args(
4459
Sendmail
45-
REQUIRED_VARS Sendmail_EXECUTABLE
46-
REASON_FAILURE_MESSAGE
47-
"sendmail not found, setting default to ${_sendmail}.
48-
It can be overridden in php.ini with sendmail_path directive."
60+
REQUIRED_VARS ${_sendmailRequiredVars}
61+
REASON_FAILURE_MESSAGE "${_reason}"
4962
)
5063

51-
unset(_sendmail)
64+
unset(_reason)
65+
unset(_sendmailIsBuiltInMsg)
66+
unset(_sendmailRequiredVars)

cmake/cmake/modules/PHP/CheckWrite.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cmake_push_check_state(RESET)
3232
check_include_file(unistd.h HAVE_UNISTD_H)
3333

3434
if(HAVE_UNISTD_H)
35-
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_UNISTD_H=1)
35+
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_UNISTD_H)
3636
endif()
3737

3838
check_source_runs(C [[

0 commit comments

Comments
 (0)