From abe95c195c24b96ca60b4d26324a00544790c895 Mon Sep 17 00:00:00 2001 From: krcroft Date: Mon, 9 Mar 2020 11:18:32 -0700 Subject: [PATCH] Prevent env:OPUSFILE_LIBS from enabling Opus In the current code, we assess the --disable-opus-cdda argument, and if it's not present we run pkg-config to get the Opus CFLAGS and LIBS. If it finds them, it sets the OPUSFILE_CFLAGS and OPUSFILE_LIBS variables. We finally check for the presense of one of these before actually enabling Opus. However, if the user directly sets OPUSFILE_LIBS, then this final check will become true regardless if the user passed --disable-opus-cdda to configure. The obvious fix is to move the final Opus check inside the prior checks (for example, moving AM_CONDITIONAL(USE_OPUS) inside AS_IF(..), however that results in the OPUS_USE conditional not existing if the AS_IF test fails its check. Therefore, we set a new variable HAVE_OPUS, if the pkg-config check passes, and look for that instead of OPUSFILE_LIBS. (Of course, the user could export HAVE_OPUS=yes in their environment as well, but at that point they're deliberately circumenting configure, in which case they can have at it!). --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9273417f..ef178720 100644 --- a/configure.ac +++ b/configure.ac @@ -486,9 +486,9 @@ AC_ARG_ENABLE(opus-cdda, AS_IF([test "x${enable_opus_cdda}" != "xno"], [PKG_CHECK_MODULES([OPUSFILE], [opusfile], - [LIBS="$LIBS $OPUSFILE_LIBS"])]) -AM_CONDITIONAL([USE_OPUS], - [test "x${OPUSFILE_LIBS}" != "x"]) + [LIBS="$LIBS $OPUSFILE_LIBS" HAVE_OPUS=yes])]) + +AM_CONDITIONAL(USE_OPUS, test "${HAVE_OPUS}" = "yes") AH_TEMPLATE(C_OPENGL,[Define to 1 to use opengl display output support]) AC_CHECK_LIB(GL, main, have_gl_lib=yes, have_gl_lib=no , )