Seen with GraphicsMagick 1.3.49, building with configure and MSVC cl through vcpkg (x64-windows).
On MSVC, libpng's CMake build names its import library libpng16.lib (libpng16d.lib in debug), so pkg-config reports:
PNG_LIBS='-L.../lib -llibpng16d'
The loop in configure.ac that takes the library name from PNG_LIBS only matches -lpng*:
for png_libs_arg in $PNG_LIBS ; do
case $png_libs_arg in
-lpng*)
-llibpng16d doesn't match, so pnglibs stays at the default list -lpng17 -lpng16 .... png16 then passes the header-only minor-version test (version 16 has no link test), and -lpng16 gets added to LIBS. That library doesn't exist. Every later AC_CHECK_LIB link test fails with LNK1104, so JPEG, FreeType, WebP and TIFF are all reported as "no -- some components failed test", and the final link of libGraphicsMagick fails.
Suggested fix: also accept the lib prefix.
- -lpng*)
+ -lpng*|-llibpng*)
The later sed expressions handle it already: -llibpng16d gives pnglibbase=libpng16d and libver=16. Linux -lpng16 behaves as before.
Diff:
Addressed by Mercurial changeset 18233:6715475d25a6. Thanks for the bug report and the help.