Bug report
In configure.ac we have several fallbacks when pkg-config is missing or a package does not provide a .pc file. The fallbacks do not take custom cflags into account. For example the block for zlib does AC_CHECK_HEADERS([zlib.h]) and AC_CHECK_LIB([z]) without setting CFLAGS="$CFLAGS $ZLIB_CFLAGS" first.