add configure test for png_set_chunk_malloc_max

This commit is contained in:
John Cupitt 2019-04-20 06:07:18 +01:00
parent 8d7e03237a
commit ee854d43c4
2 changed files with 14 additions and 0 deletions

View File

@ -1276,6 +1276,18 @@ if test x"$with_png" != x"no"; then
)
fi
if test x"$with_png" != x"no"; then
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PNG_LIBS $LIBS"
CFLAGS="$PNG_INCLUDES $CFLAGS"
AC_CHECK_FUNCS(png_set_chunk_malloc_max,
AC_DEFINE(HAVE_PNG_SET_CHUNK_MALLOC_MAX,1,
[define if your libpng has png_set_chunk_malloc_max.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# look for libimagequant with pkg-config (only if libpng is enabled)
AC_ARG_WITH([imagequant],
AS_HELP_STRING([--without-imagequant], [build without imagequant (default: test)]))

View File

@ -268,7 +268,9 @@ read_new_filename( VipsImage *out, const char *name, gboolean fail )
* check.
*/
png_init_io( read->pPng, read->fp );
#ifdef HAVE_PNG_SET_CHUNK_MALLOC_MAX
png_set_chunk_malloc_max( read->pPng, 0 );
#endif /*HAVE_PNG_SET_CHUNK_MALLOC_MAX*/
png_read_info( read->pPng, read->pInfo );
return( read );