+ dnl libpng version 0.9 is known to not work, if an even newer
+ dnl version is required, just bump it up in the test below
+ AC_CACHE_CHECK([for png.h > 0.90], ac_cv_header_png_h,
+ AC_TRY_RUN(
+ [
+ dnl png.h defines PNG_LIBPNG_VER=number
+ #include <png.h>
+ #include <stdio.h>
+
+ int main()
+ {
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%s",
+ PNG_LIBPNG_VER > 90 ? "yes" : "no");
+ exit(0);
+ }
+ ],
+ ac_cv_header_png_h=`cat conftestval`,
+ ac_cv_header_png_h=no,
+ dnl cross-compiling: test if we have any png.h
+ AC_CHECK_HEADER(png.h)
+ )
+ )
+
+ if test "$ac_cv_header_png_h" = "yes"; then
+ AC_CHECK_LIB(png, png_check_sig, PNG_LINK=" -lpng", , [-lz -lm])
+ fi