Skip to content

Commit 4c57084

Browse files
committed
Simplify sanity checks
These checks are redundant.
1 parent 4eae5ac commit 4c57084

File tree

6 files changed

+11
-72
lines changed

6 files changed

+11
-72
lines changed

cmake/ext/curl/CMakeLists.txt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ project(
2929

3030
include(CheckIncludeFiles)
3131
include(CheckSourceRuns)
32-
include(CheckSymbolExists)
3332
include(CMakeDependentOption)
3433
include(CMakePushCheckState)
3534
include(FeatureSummary)
@@ -172,26 +171,6 @@ if(PHP_THREAD_SAFETY AND CURL_SSL_FOUND)
172171
endif()
173172
endif()
174173

175-
# Sanity check.
176-
if(TARGET CURL::libcurl)
177-
cmake_push_check_state(RESET)
178-
set(CMAKE_REQUIRED_LIBRARIES CURL::libcurl)
179-
180-
check_symbol_exists(
181-
curl_easy_perform
182-
curl/curl.h
183-
_PHP_HAVE_CURL_EASY_PERFORM
184-
)
185-
cmake_pop_check_state()
186-
187-
if(NOT _PHP_HAVE_CURL_EASY_PERFORM)
188-
message(
189-
FATAL_ERROR
190-
"ext/curl sanity check failed: 'curl_easy_perform()' could not be found."
191-
)
192-
endif()
193-
endif()
194-
195174
set(HAVE_CURL TRUE)
196175

197176
configure_file(cmake/config.h.in config.h)

cmake/ext/gd/CMakeLists.txt

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ project(
7777
LANGUAGES C
7878
)
7979

80-
include(CheckSourceCompiles)
8180
include(CheckSourceRuns)
8281
include(CheckSymbolExists)
8382
include(CMakeDependentOption)
@@ -422,34 +421,6 @@ if(NOT PHP_EXT_GD_EXTERNAL)
422421
set(JISX0208 TRUE)
423422
set(USE_GD_JISX0208 TRUE)
424423
endif()
425-
426-
# Do sanity check when all required packages are found.
427-
block()
428-
get_target_property(libraries php_ext_gd LINK_LIBRARIES)
429-
set(doSanityCheck TRUE)
430-
foreach(library ${libraries})
431-
if(library MATCHES "^.+::.+$" AND NOT TARGET ${library})
432-
set(doSanityCheck FALSE)
433-
break()
434-
endif()
435-
endforeach()
436-
437-
if(doSanityCheck)
438-
cmake_push_check_state(RESET)
439-
set(CMAKE_REQUIRED_LIBRARIES ${libraries})
440-
441-
check_source_compiles(
442-
C
443-
[[int main(void) { return 0; }]]
444-
_PHP_GD_SANITY_CHECK_COMPILES
445-
)
446-
cmake_pop_check_state()
447-
448-
if(NOT _PHP_GD_SANITY_CHECK_COMPILES)
449-
message(FATAL_ERROR "GD sanity check failed.")
450-
endif()
451-
endif()
452-
endblock()
453424
else()
454425
find_package(GD 2.1.0)
455426
set_package_properties(
@@ -464,18 +435,7 @@ else()
464435
target_sources(php_ext_gd PRIVATE gd_compat.c)
465436

466437
if(TARGET GD::GD)
467-
# Sanity check.
468-
cmake_push_check_state(RESET)
469-
set(CMAKE_REQUIRED_LIBRARIES GD::GD)
470-
check_symbol_exists(gdImageCreate gd.h HAVE_LIBGD)
471-
cmake_pop_check_state()
472-
473-
if(NOT HAVE_LIBGD)
474-
message(
475-
FATAL_ERROR
476-
"GD sanity check failed: 'gdImageCreate()' could not be found in libgd."
477-
)
478-
endif()
438+
set(HAVE_LIBGD TRUE)
479439

480440
# Build and run a program to determine if GD has support for the given
481441
# format. The first argument is the proper-noun-capitalized name of the

cmake/ext/gettext/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ if(TARGET Intl::Intl)
8383
set(CMAKE_REQUIRED_LIBRARIES Intl::Intl)
8484

8585
# Sanity check.
86-
check_symbol_exists(bindtextdomain libintl.h _PHP_HAVE_BINDTEXTDOMAIN)
87-
if(NOT _PHP_HAVE_BINDTEXTDOMAIN)
86+
check_symbol_exists(bindtextdomain libintl.h PHP_EXT_GETTEXT_SANITY_CHECK)
87+
if(NOT PHP_EXT_GETTEXT_SANITY_CHECK)
8888
message(
8989
FATAL_ERROR
9090
"The ext/gettext sanity check for intl library failed: The "

cmake/ext/ldap/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ if(TARGET LDAP::LDAP)
9999
set(CMAKE_REQUIRED_LIBRARIES LDAP::LDAP)
100100

101101
# Sanity check.
102-
check_symbol_exists(ldap_sasl_bind_s ldap.h _PHP_HAVE_LDAP_SASL_BIND_S)
103-
if(NOT _PHP_HAVE_LDAP_SASL_BIND_S)
102+
check_symbol_exists(ldap_sasl_bind_s ldap.h PHP_EXT_LDAP_HAS_LDAP_SASL_BIND_S)
103+
if(NOT PHP_EXT_LDAP_HAS_LDAP_SASL_BIND_S)
104104
# Fallback to deprecated ldap_simple_bind_s().
105-
check_symbol_exists(ldap_simple_bind_s ldap.h _PHP_HAVE_LDAP_SIMPLE_BIND_S)
105+
check_symbol_exists(ldap_simple_bind_s ldap.h PHP_HAS_LDAP_SIMPLE_BIND_S)
106106
endif()
107-
if(NOT _PHP_HAVE_LDAP_SASL_BIND_S AND NOT _PHP_HAVE_LDAP_SIMPLE_BIND_S)
107+
if(NOT PHP_EXT_LDAP_HAS_LDAP_SASL_BIND_S AND NOT PHP_HAS_LDAP_SIMPLE_BIND_S)
108108
message(
109109
FATAL_ERROR
110110
"LDAP sanity check failed: neither 'ldap_sasl_bind_s()' nor "

cmake/ext/pdo_firebird/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ if(TARGET Firebird::Firebird)
9191
check_symbol_exists(
9292
isc_detach_database
9393
ibase.h
94-
_PHP_EXT_PDO_FIREBIRD_SANITY_CHECK
94+
PHP_EXT_PDO_FIREBIRD_SANITY_CHECK
9595
)
9696
cmake_pop_check_state()
9797

98-
if(NOT _PHP_EXT_PDO_FIREBIRD_SANITY_CHECK)
98+
if(NOT PHP_EXT_PDO_FIREBIRD_SANITY_CHECK)
9999
message(
100100
FATAL_ERROR
101101
"Firebird sanity check failed: 'isc_detach_database()' not found."

cmake/ext/pspell/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ endif()
104104
if(TARGET ASPELL::ASPELL)
105105
cmake_push_check_state(RESET)
106106
set(CMAKE_REQUIRED_LIBRARIES ASPELL::ASPELL)
107-
check_symbol_exists(new_aspell_config aspell.h _PHP_EXT_PSPELL_CHECK)
107+
check_symbol_exists(new_aspell_config aspell.h PHP_EXT_PSPELL_SANITY_CHECK)
108108
cmake_pop_check_state()
109109

110-
if(NOT _PHP_EXT_PSPELL_CHECK)
110+
if(NOT PHP_EXT_PSPELL_SANITY_CHECK)
111111
message(
112112
FATAL_ERROR
113113
"Aspell sanity check failed: new_aspell_config() not found in aspell.h. "

0 commit comments

Comments
 (0)