Don't run the checks unless `_CFLAGS` or `_LIBS` is non-empty (either because they were specified manually or `pkg-config` found the package).
This fixes an issue seen on macOS: PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH were set empty to prevent pkg-config from using any system-installed packages, but FFmpeg was installed in /usr/local and AC_CHECK_HEADERS/LIBS succeeded despite FFMPEG_CFLAGS/LIBS being empty. configure printed "FFmpeg development files not found.", but HAVE_FFMPEG was still set. The winedmo files compiled, but failed to link because FFMPEG_LIBS was empty. This should also speed up configure slightly, by skipping header checks for not-installed packages.
From: Brendan Shanks bshanks@codeweavers.com
--- aclocal.m4 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4 index 0597c37ece2..6f5994bce17 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -113,10 +113,12 @@ if test -s conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $ac_cflags" -$6 -CPPFLAGS=$ac_save_CPPFLAGS +AS_IF( + [test "x$ac_cflags" != "x" -o "x$ac_libs" != "x"], + [ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $ac_cflags" + $6 + CPPFLAGS=$ac_save_CPPFLAGS]) AS_VAR_POPDEF([ac_libs])dnl AS_VAR_POPDEF([ac_cflags])])dnl
@@ -135,10 +137,12 @@ AS_VAR_IF([ac_libs],[], [AS_VAR_SET_IF([MINGW_PKG_CONFIG], [ac_libs=`$MINGW_PKG_CONFIG --libs [$2] 2>/dev/null`])]) m4_ifval([$3],[ac_libs=[$]{ac_libs:-"$3"}]) -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $ac_cflags" -$4 -CPPFLAGS=$ac_save_CPPFLAGS +AS_IF( + [test "x$ac_cflags" != "x" -o "x$ac_libs" != "x"], + [ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $ac_cflags" + $4 + CPPFLAGS=$ac_save_CPPFLAGS]) AS_VAR_POPDEF([ac_libs])dnl AS_VAR_POPDEF([ac_cflags])])dnl