With an old version of libpng that does not support pkg-config, configure cannot find libpng even if the png_CFLAGS and png_LIBS overrides are used. If both png_CFLAGS and png_LIBS are set, configure should ignore pkg-config and just do a compile-and-link test. Currently, it ignores png_CFLAGS and png_LIBS (does not compile anything to test), contrary to what "configure --help" says. On another hand, if the pkgconfig-enabled version of libpng is mandatory due to new functions or security fixes, configure still should report that in the error message, instead of just saying "not found".
Hmm, currently we do have a verbose warning if we cannot find a pkg-config libpng. The message itself might be slightly opaque, but I cannot currently think of a better way to phrase it. The second part of this is just a misleading pkg-config help statement. Your suggestion of how to handle png_LIBS and png_CFLAGS sounds like a good improvement as a means for the user to totally circumvent pkg-config.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.