diff --git a/pngrutil.c b/pngrutil.c index aad1cc42a..81195578e 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -22,14 +22,23 @@ /* Check if zlib's inflateValidate can be used. */ # if ZLIB_VERNUM >= 0x1290 && \ defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) - /* Determine at compile-time whether inflateValidate is available by - * minimal supported OS version. - */ -# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ - MAC_OS_X_VERSION_MIN_REQUIRED < 101300 - /* Don't use if targeting pre-macOS 10.13. */ -# define PNG_USE_ZLIB_INFLATE_VALIDATE 0 -# endif +# if defined(__APPLE__) && defined(__MACH__) + /* Determine at compile-time whether inflateValidate is available by + * minimal supported OS version. + */ + + /* For MAC_OS_X_VERSION_MIN_REQUIRED. + * Not using the preferred because it was introduced + * during the 10.5 SDK while this header has been available with Xcode + * since 1.0 (10.3 SDK). + */ +# include +# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ + MAC_OS_X_VERSION_MIN_REQUIRED < 101300 + /* Don't use if targeting pre-macOS 10.13. */ +# define PNG_USE_ZLIB_INFLATE_VALIDATE 0 +# endif +# endif /* __APPLE__ && __MACH__ */ # else # define PNG_USE_ZLIB_INFLATE_VALIDATE 0 # endif /* ZLIB_VERNUM && PNG_SET_OPTION_SUPPORTED && PNG_IGNORE_ADLER32 */