From ec8fcb4af2dbcc505c7221f6784c713cbbbebdd5 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sun, 26 Jan 2020 10:51:12 -0800 Subject: [PATCH] Fix autoconf nuances with AM_CONDITIONAL --- configure.ac | 21 ++++++++++++--------- src/libs/decoders/Makefile.am | 11 +++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 0f8389ef..7956c66b 100644 --- a/configure.ac +++ b/configure.ac @@ -462,20 +462,23 @@ fi dnl Ogg Opus handling dnl ----------------- dnl We want Opus tracks supported by default, and we also want the user -dnl to be aware if there's a problem finding the Opus dependencies. -dnl If there's a problem, we want the user to either a) install the opus -dnl library or b) explicitly disable Opus. +dnl to be aware if there's a problem finding the Opus dependencies so +dnl they can either a) install the opusfile library or b) explicitly +dnl disable Opus. dnl To achieve this, we provide a --disable-opus-cdda configure option dnl but by default we look for Opus and fail if we can't find it. dnl We only skip supporting Opus if the user explicitly passes the dnl --disable-opus-cdda argument. - -AC_ARG_ENABLE([opus-cdda], AS_HELP_STRING([--disable-opus-cdda], - [Disable support for Opus-compressed CD-Audio tracks])) -AS_IF([test "x$enable_opus_cdda" != "xno"], - [PKG_CHECK_MODULES([OPUSFILE], [opusfile], [HAVE_OPUSFILE=1])]) -AM_CONDITIONAL([USE_OPUS], [test "$HAVE_OPUSFILE" == "1"]) +AC_ARG_ENABLE(opus-cdda, + AS_HELP_STRING([--disable-opus-cdda], + [Disable Opus CD audio track support])) +AS_IF([test "x${enable_opus_cdda}" != "xno"], + [PKG_CHECK_MODULES([OPUSFILE], + [opusfile], + [LIBS+=" $OPUSFILE_LIBS"])]) +AM_CONDITIONAL([USE_OPUS], + [test "x${OPUSFILE_LIBS}" != "x"]) 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 , ) diff --git a/src/libs/decoders/Makefile.am b/src/libs/decoders/Makefile.am index 5f180767..adba928e 100644 --- a/src/libs/decoders/Makefile.am +++ b/src/libs/decoders/Makefile.am @@ -20,12 +20,6 @@ libdecoders_a_SOURCES = \ xxhash.c \ xxhash.h -if USE_OPUS - libdecoders_a_SOURCES += opus.c - AM_CFLAGS += -DUSE_OPUS $(OPUSFILE_CFLAGS) - LDADD += $(OPUSFILE_LIBS) -endif - libdecoders_a_CXXFLAGS = \ $(AM_CXXFLAGS) \ $(CXXFLAGS) \ @@ -37,3 +31,8 @@ libdecoders_a_CFLAGS = \ $(CFLAGS) \ -Wpedantic \ -Wall + +if USE_OPUS +libdecoders_a_SOURCES += opus.c +libdecoders_a_CFLAGS += -DUSE_OPUS $(OPUSFILE_CFLAGS) +endif