From a5b340e20b3544475c7341e67efda97300676c22 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sat, 21 May 2016 08:40:04 -0700 Subject: [PATCH] timepng: fix builds in certain 1.7 configs Libpng 1.7 supports read without PNG de-interlace, however this means the old checks on whether contrib/libtests/timepng.c (just checking for sequential read) are inadequate. 1.7 also provides macros to explicitly turn off png_read_png and png_read_image, so use these instead. Signed-off-by: John Bowler --- contrib/libtests/timepng.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/contrib/libtests/timepng.c b/contrib/libtests/timepng.c index 1aa11e2f5..689da7c26 100644 --- a/contrib/libtests/timepng.c +++ b/contrib/libtests/timepng.c @@ -44,9 +44,19 @@ # define voidcast(type, value) (value) #endif /* __cplusplus */ -#if defined (CLOCK_PROCESS_CPUTIME_ID) && \ - defined (PNG_SEQUENTIAL_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) \ - && defined(PNG_EASY_ACCESS_SUPPORTED) && defined(PNG_INFO_IMAGE_SUPPORTED) +/* 'CLOCK_PROCESS_CPUTIME_ID' is one of the clock timers for clock_gettime. It + * need not be supported even when clock_gettime is available. It returns the + * 'CPU' time the process has consumed. 'CPU' time is assumed to include time + * when the CPU is actually blocked by a pending cache fill but not time + * waiting for page faults. The attempt is to get a measure of the actual time + * the implementation takes to read a PNG ignoring the potentially very large IO + * overhead. + */ +#if defined (CLOCK_PROCESS_CPUTIME_ID) && defined(PNG_STDIO_SUPPORTED) &&\ + defined(PNG_EASY_ACCESS_SUPPORTED) &&\ + (PNG_LIBPNG_VER >= 10700 ? defined(PNG_READ_PNG_SUPPORTED) :\ + defined (PNG_SEQUENTIAL_READ_SUPPORTED) &&\ + defined(PNG_INFO_IMAGE_SUPPORTED)) typedef struct {