@@ -77,9 +77,9 @@ project(
7777 LANGUAGES C
7878)
7979
80- include (CheckLibraryExists)
8180include (CheckSourceCompiles)
8281include (CheckSourceRuns)
82+ include (CheckSymbolExists)
8383include (CMakeDependentOption)
8484include (CMakePushCheckState)
8585include (FeatureSummary)
@@ -441,11 +441,11 @@ if(NOT PHP_EXT_GD_EXTERNAL)
441441 check_source_compiles(
442442 C
443443 [[int main(void) { return 0; }]]
444- _GD_SANITY_CHECK_COMPILES
444+ _PHP_GD_SANITY_CHECK_COMPILES
445445 )
446446 cmake_pop_check_state()
447447
448- if (NOT _GD_SANITY_CHECK_COMPILES )
448+ if (NOT _PHP_GD_SANITY_CHECK_COMPILES )
449449 message (FATAL_ERROR "GD sanity check failed." )
450450 endif ()
451451 endif ()
@@ -465,7 +465,10 @@ else()
465465
466466 if (TARGET GD::GD)
467467 # Sanity check.
468- check_library_exists(GD::GD gdImageCreate "" HAVE_LIBGD)
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()
469472
470473 if (NOT HAVE_LIBGD)
471474 message (
@@ -533,14 +536,17 @@ else()
533536 php_ext_gd_check_format(Bmp HAVE_GD_BMP)
534537 php_ext_gd_check_format(Tga HAVE_GD_TGA)
535538
536- check_library_exists(GD::GD gdFontCacheShutdown "" HAVE_GD_FREETYPE)
537- check_library_exists(GD::GD gdVersionString "" HAVE_GD_LIBVERSION)
538- check_library_exists(
539- GD::GD
540- gdImageGetInterpolationMethod
541- ""
542- HAVE_GD_GET_INTERPOLATION
543- )
539+ cmake_push_check_state(RESET)
540+ set (CMAKE_REQUIRED_LIBRARIES GD::GD)
541+
542+ check_symbol_exists(gdFontCacheShutdown gd.h HAVE_GD_FREETYPE)
543+ check_symbol_exists(gdVersionString gd.h HAVE_GD_LIBVERSION)
544+ check_symbol_exists(
545+ gdImageGetInterpolationMethod
546+ gd.h
547+ HAVE_GD_GET_INTERPOLATION
548+ )
549+ cmake_pop_check_state()
544550 endif ()
545551endif ()
546552
0 commit comments