Skip to content

Commit b64924e

Browse files
committed
Merge branch 'PHP-8.4'
2 parents d614bb5 + 7a53694 commit b64924e

File tree

8 files changed

+144
-109
lines changed

8 files changed

+144
-109
lines changed

cmake/cmake/modules/FindTidy.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ if(Tidy_INCLUDE_DIR)
8686
cmake_push_check_state(RESET)
8787
set(CMAKE_REQUIRED_INCLUDES ${Tidy_INCLUDE_DIR})
8888

89-
# Check for tidybuffio.h (as opposed to simply buffio.h) which indicates
89+
# Check for tidybuffio.h (as opposed to the legacy buffio.h) which indicates
9090
# that the found library is tidy-html5 and not the legacy htmltidy. The two
91-
# are compatible, except the legacy doesn't have this header.
91+
# are compatible, except the legacy doesn't have the tidybuffio.h header.
9292
check_include_files(tidybuffio.h HAVE_TIDYBUFFIO_H)
9393

9494
check_include_files(tidy.h HAVE_TIDY_H)

cmake/ext/bz2/CMakeLists.txt

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ project(
2828
LANGUAGES C
2929
)
3030

31-
include(CheckLibraryExists)
31+
include(CheckSymbolExists)
3232
include(CMakeDependentOption)
33+
include(CMakePushCheckState)
3334
include(FeatureSummary)
3435

3536
option(PHP_EXT_BZ2 "Enable the bz2 extension")
@@ -83,17 +84,21 @@ set_package_properties(
8384
# Link with PUBLIC scope if include directories are on non-standard places.
8485
target_link_libraries(php_ext_bz2 PUBLIC BZip2::BZip2)
8586

86-
# Sanity check.
87+
# Minimum version sanity check.
8788
if(TARGET BZip2::BZip2)
88-
check_library_exists(BZip2::BZip2 BZ2_bzerror "" _HAVE_BZ2_BZERROR)
89-
90-
if(NOT _HAVE_BZ2_BZERROR)
91-
message(
92-
FATAL_ERROR
93-
"BZip2 package is not working as expected. The bz2 extension requires "
94-
"BZip2 library (libbzip2) version ${PHP_BZIP2_MIN_VERSION} or later."
95-
)
96-
endif()
89+
cmake_push_check_state(RESET)
90+
set(CMAKE_REQUIRED_LIBRARIES BZip2::BZip2)
91+
92+
check_symbol_exists(BZ2_bzerror bzlib.h _PHP_HAVE_BZ2_BZERROR)
93+
94+
if(NOT _PHP_HAVE_BZ2_BZERROR)
95+
message(
96+
FATAL_ERROR
97+
"BZip2 package is not working as expected. The bz2 extension requires "
98+
"BZip2 library (libbzip2) version ${PHP_BZIP2_MIN_VERSION} or later."
99+
)
100+
endif()
101+
cmake_pop_check_state()
97102
endif()
98103

99104
set(HAVE_BZ2 TRUE)

cmake/ext/curl/CMakeLists.txt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ project(
2828
)
2929

3030
include(CheckIncludeFiles)
31-
include(CheckLibraryExists)
3231
include(CheckSourceRuns)
32+
include(CheckSymbolExists)
3333
include(CMakeDependentOption)
3434
include(CMakePushCheckState)
3535
include(FeatureSummary)
@@ -166,15 +166,21 @@ endif()
166166

167167
# Sanity check.
168168
if(TARGET CURL::libcurl)
169-
check_library_exists(
170-
CURL::libcurl
171-
curl_easy_perform
172-
""
173-
HAVE_CURL_EASY_PERFORM
174-
)
175-
176-
if(NOT HAVE_CURL_EASY_PERFORM)
177-
message(FATAL_ERROR "The 'curl_easy_perform()' couldn't be found.")
169+
cmake_push_check_state(RESET)
170+
set(CMAKE_REQUIRED_LIBRARIES CURL::libcurl)
171+
172+
check_symbol_exists(
173+
curl_easy_perform
174+
curl/curl.h
175+
_PHP_HAVE_CURL_EASY_PERFORM
176+
)
177+
cmake_pop_check_state()
178+
179+
if(NOT _PHP_HAVE_CURL_EASY_PERFORM)
180+
message(
181+
FATAL_ERROR
182+
"ext/curl sanity check failed: 'curl_easy_perform()' could not be found."
183+
)
178184
endif()
179185
endif()
180186

cmake/ext/enchant/CMakeLists.txt

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ project(
2727
LANGUAGES C
2828
)
2929

30-
include(CheckLibraryExists)
30+
include(CheckSymbolExists)
3131
include(CMakeDependentOption)
32+
include(CMakePushCheckState)
3233
include(FeatureSummary)
3334

3435
option(PHP_EXT_ENCHANT "Enable the enchant extension")
@@ -73,21 +74,23 @@ set_package_properties(
7374
)
7475

7576
if(TARGET Enchant::Enchant)
76-
# The enchant_get_version() is available since 1.6.0.
77-
check_library_exists(
78-
Enchant::Enchant
79-
enchant_get_version
80-
""
81-
HAVE_ENCHANT_GET_VERSION
82-
)
83-
84-
# The enchant_broker_set_param() is available since 1.5.0 and removed in 2.x.
85-
check_library_exists(
86-
Enchant::Enchant
87-
enchant_broker_set_param
88-
""
89-
HAVE_ENCHANT_BROKER_SET_PARAM
90-
)
77+
cmake_push_check_state(RESET)
78+
set(CMAKE_REQUIRED_LIBRARIES Enchant::Enchant)
79+
80+
# The enchant_get_version() is available since 1.6.0.
81+
check_symbol_exists(
82+
enchant_get_version
83+
enchant.h
84+
HAVE_ENCHANT_GET_VERSION
85+
)
86+
87+
# The enchant_broker_set_param() is available since 1.5.0 and removed in 2.x.
88+
check_symbol_exists(
89+
enchant_broker_set_param
90+
enchant.h
91+
HAVE_ENCHANT_BROKER_SET_PARAM
92+
)
93+
cmake_pop_check_state()
9194
endif()
9295

9396
target_link_libraries(php_ext_enchant PRIVATE Enchant::Enchant)

cmake/ext/gd/CMakeLists.txt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ project(
7777
LANGUAGES C
7878
)
7979

80-
include(CheckLibraryExists)
8180
include(CheckSourceCompiles)
8281
include(CheckSourceRuns)
82+
include(CheckSymbolExists)
8383
include(CMakeDependentOption)
8484
include(CMakePushCheckState)
8585
include(FeatureSummary)
@@ -430,11 +430,11 @@ if(NOT PHP_EXT_GD_EXTERNAL)
430430
check_source_compiles(
431431
C
432432
[[int main(void) { return 0; }]]
433-
_GD_SANITY_CHECK_COMPILES
433+
_PHP_GD_SANITY_CHECK_COMPILES
434434
)
435435
cmake_pop_check_state()
436436

437-
if(NOT _GD_SANITY_CHECK_COMPILES)
437+
if(NOT _PHP_GD_SANITY_CHECK_COMPILES)
438438
message(FATAL_ERROR "GD sanity check failed.")
439439
endif()
440440
endif()
@@ -454,7 +454,10 @@ else()
454454

455455
if(TARGET GD::GD)
456456
# Sanity check.
457-
check_library_exists(GD::GD gdImageCreate "" HAVE_LIBGD)
457+
cmake_push_check_state(RESET)
458+
set(CMAKE_REQUIRED_LIBRARIES GD::GD)
459+
check_symbol_exists(gdImageCreate gd.h HAVE_LIBGD)
460+
cmake_pop_check_state()
458461

459462
if(NOT HAVE_LIBGD)
460463
message(
@@ -522,14 +525,17 @@ else()
522525
php_ext_gd_check_format(Bmp HAVE_GD_BMP)
523526
php_ext_gd_check_format(Tga HAVE_GD_TGA)
524527

525-
check_library_exists(GD::GD gdFontCacheShutdown "" HAVE_GD_FREETYPE)
526-
check_library_exists(GD::GD gdVersionString "" HAVE_GD_LIBVERSION)
527-
check_library_exists(
528-
GD::GD
529-
gdImageGetInterpolationMethod
530-
""
531-
HAVE_GD_GET_INTERPOLATION
532-
)
528+
cmake_push_check_state(RESET)
529+
set(CMAKE_REQUIRED_LIBRARIES GD::GD)
530+
531+
check_symbol_exists(gdFontCacheShutdown gd.h HAVE_GD_FREETYPE)
532+
check_symbol_exists(gdVersionString gd.h HAVE_GD_LIBVERSION)
533+
check_symbol_exists(
534+
gdImageGetInterpolationMethod
535+
gd.h
536+
HAVE_GD_GET_INTERPOLATION
537+
)
538+
cmake_pop_check_state()
533539
endif()
534540
endif()
535541

cmake/ext/tidy/CMakeLists.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ project(
2828
LANGUAGES C
2929
)
3030

31-
include(CheckLibraryExists)
31+
include(CheckSymbolExists)
3232
include(CMakeDependentOption)
33+
include(CMakePushCheckState)
3334
include(FeatureSummary)
3435
include(PHP/CheckCompilerFlag)
3536

@@ -62,7 +63,7 @@ endif()
6263
target_sources(
6364
php_ext_tidy
6465
PRIVATE
65-
php_tidy.def
66+
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<IN_LIST:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>>:php_tidy.def>
6667
tidy.c
6768
tidy.stub.php
6869
)
@@ -73,9 +74,9 @@ if(Tidy_VERSION VERSION_LESS 5.7.20)
7374
php_check_compiler_flag(
7475
C
7576
-Wno-ignored-qualifiers
76-
HAVE_WNO_IGNORED_QUALIFIERS_C
77+
_PHP_HAVE_WNO_IGNORED_QUALIFIERS_C
7778
)
78-
if(HAVE_WNO_IGNORED_QUALIFIERS_C)
79+
if(_PHP_HAVE_WNO_IGNORED_QUALIFIERS_C)
7980
target_compile_options(php_ext_tidy PRIVATE -Wno-ignored-qualifiers)
8081
endif()
8182
endif()
@@ -93,8 +94,19 @@ set_package_properties(
9394
target_link_libraries(php_ext_tidy PRIVATE Tidy::Tidy)
9495

9596
if(TARGET Tidy::Tidy)
96-
check_library_exists(Tidy::Tidy tidyOptGetDoc "" HAVE_TIDYOPTGETDOC)
97-
check_library_exists(Tidy::Tidy tidyReleaseDate "" HAVE_TIDYRELEASEDATE)
97+
cmake_push_check_state(RESET)
98+
set(CMAKE_REQUIRED_LIBRARIES Tidy::Tidy)
99+
100+
set(header "")
101+
if(HAVE_TIDY_H)
102+
set(header tidy.h)
103+
elseif(HAVE_TIDYP_H)
104+
set(header tidyp.h)
105+
endif()
106+
107+
check_symbol_exists(tidyOptGetDoc "${header}" HAVE_TIDYOPTGETDOC)
108+
check_symbol_exists(tidyReleaseDate "${header}" HAVE_TIDYRELEASEDATE)
109+
cmake_pop_check_state()
98110
endif()
99111

100112
set(HAVE_TIDY TRUE)

cmake/ext/zip/CMakeLists.txt

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ project(
2727
LANGUAGES C
2828
)
2929

30-
include(CheckLibraryExists)
30+
include(CheckSymbolExists)
3131
include(CMakeDependentOption)
32+
include(CMakePushCheckState)
3233
include(FeatureSummary)
3334

3435
option(PHP_EXT_ZIP "Enable the zip extension")
@@ -110,55 +111,53 @@ endif()
110111
# required.
111112

112113
if(TARGET libzip::libzip)
113-
check_library_exists(
114-
libzip::libzip
115-
zip_file_set_mtime
116-
""
117-
HAVE_SET_MTIME
118-
)
119-
120-
if(NOT HAVE_SET_MTIME)
121-
message(WARNING "Libzip >= 1.0.0 needed for setting mtime")
122-
endif()
123-
124-
check_library_exists(
125-
libzip::libzip
126-
zip_file_set_encryption
127-
""
128-
HAVE_ENCRYPTION
129-
)
130-
131-
if(NOT HAVE_ENCRYPTION)
132-
message(WARNING "Libzip >= 1.2.0 needed for encryption support")
133-
endif()
134-
135-
check_library_exists(
136-
libzip::libzip
137-
zip_libzip_version
138-
""
139-
HAVE_LIBZIP_VERSION
140-
)
141-
142-
check_library_exists(
143-
libzip::libzip
144-
zip_register_progress_callback_with_state
145-
""
146-
HAVE_PROGRESS_CALLBACK
147-
)
148-
149-
check_library_exists(
150-
libzip::libzip
151-
zip_register_cancel_callback_with_state
152-
""
153-
HAVE_CANCEL_CALLBACK
154-
)
155-
156-
check_library_exists(
157-
libzip::libzip
158-
zip_compression_method_supported
159-
""
160-
HAVE_METHOD_SUPPORTED
161-
)
114+
cmake_push_check_state(RESET)
115+
set(CMAKE_REQUIRED_LIBRARIES libzip::libzip)
116+
117+
check_symbol_exists(zip_file_set_mtime zip.h HAVE_SET_MTIME)
118+
119+
if(NOT HAVE_SET_MTIME)
120+
message(
121+
WARNING
122+
"ext/zip will not have support for setting mtime "
123+
"(Libzip >= 1.0.0 is needed for setting mtime)"
124+
)
125+
endif()
126+
127+
check_symbol_exists(zip_file_set_encryption zip.h HAVE_ENCRYPTION)
128+
129+
if(NOT HAVE_ENCRYPTION)
130+
message(
131+
WARNING
132+
"ext/zip will not have encryption support "
133+
"(Libzip >= 1.2.0 is needed for encryption support)"
134+
)
135+
endif()
136+
137+
check_symbol_exists(
138+
zip_libzip_version
139+
zip.h
140+
HAVE_LIBZIP_VERSION
141+
)
142+
143+
check_symbol_exists(
144+
zip_register_progress_callback_with_state
145+
zip.h
146+
HAVE_PROGRESS_CALLBACK
147+
)
148+
149+
check_symbol_exists(
150+
zip_register_cancel_callback_with_state
151+
zip.h
152+
HAVE_CANCEL_CALLBACK
153+
)
154+
155+
check_symbol_exists(
156+
zip_compression_method_supported
157+
zip.h
158+
HAVE_METHOD_SUPPORTED
159+
)
160+
cmake_pop_check_state()
162161
endif()
163162

164163
set(HAVE_ZIP TRUE)

0 commit comments

Comments
 (0)