@@ -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)
@@ -431,11 +431,11 @@ if(NOT PHP_EXT_GD_EXTERNAL)
431431 check_source_compiles(
432432 C
433433 [[int main(void) { return 0; }]]
434- _GD_SANITY_CHECK_COMPILES
434+ _PHP_GD_SANITY_CHECK_COMPILES
435435 )
436436 cmake_pop_check_state()
437437
438- if (NOT _GD_SANITY_CHECK_COMPILES )
438+ if (NOT _PHP_GD_SANITY_CHECK_COMPILES )
439439 message (FATAL_ERROR "GD sanity check failed." )
440440 endif ()
441441 endif ()
@@ -455,7 +455,10 @@ else()
455455
456456 if (TARGET GD::GD)
457457 # Sanity check.
458- check_library_exists(GD::GD gdImageCreate "" HAVE_LIBGD)
458+ cmake_push_check_state(RESET)
459+ set (CMAKE_REQUIRED_LIBRARIES GD::GD)
460+ check_symbol_exists(gdImageCreate gd.h HAVE_LIBGD)
461+ cmake_pop_check_state()
459462
460463 if (NOT HAVE_LIBGD)
461464 message (
@@ -523,14 +526,17 @@ else()
523526 php_ext_gd_check_format(Bmp HAVE_GD_BMP)
524527 php_ext_gd_check_format(Tga HAVE_GD_TGA)
525528
526- check_library_exists(GD::GD gdFontCacheShutdown "" HAVE_GD_FREETYPE)
527- check_library_exists(GD::GD gdVersionString "" HAVE_GD_LIBVERSION)
528- check_library_exists(
529- GD::GD
530- gdImageGetInterpolationMethod
531- ""
532- HAVE_GD_GET_INTERPOLATION
533- )
529+ cmake_push_check_state(RESET)
530+ set (CMAKE_REQUIRED_LIBRARIES GD::GD)
531+
532+ check_symbol_exists(gdFontCacheShutdown gd.h HAVE_GD_FREETYPE)
533+ check_symbol_exists(gdVersionString gd.h HAVE_GD_LIBVERSION)
534+ check_symbol_exists(
535+ gdImageGetInterpolationMethod
536+ gd.h
537+ HAVE_GD_GET_INTERPOLATION
538+ )
539+ cmake_pop_check_state()
534540 endif ()
535541endif ()
536542
0 commit comments