@@ -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)
@@ -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 ()
534540endif ()
535541
0 commit comments