From: Robert Schwebel Subject: libtheora: fix configure.ac to work with cross scenario for libvorbis This is https://trac.xiph.org/ticket/1465 The current test in configure.ac mixes up two different methods (hand written plus pkg-config). This patch changes the mechanics towards proper pkg-config usage. In return, we get a cleaned up cross scenario with no build-system leakage. This patch fixes the vorbis test. Signed-off-by: Robert Schwebel --- configure.ac | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) Index: libtheora-1.0/configure.ac =================================================================== --- libtheora-1.0.orig/configure.ac +++ libtheora-1.0/configure.ac @@ -288,23 +288,28 @@ fi dnl check for Vorbis -HAVE_VORBIS=no - -dnl first check through pkg-config since it's more flexible - -if test "x$HAVE_PKG_CONFIG" = "xyes" -then - PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no) - dnl also set VORBISENC_LIBS since an examples needs it - dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS, - dnl so we do the same here. - VORBISENC_LIBS="-lvorbisenc" - AC_SUBST(VORBISENC_LIBS) -fi -if test "x$HAVE_VORBIS" = "xno" -then - dnl fall back to the old school test - XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no) +AC_MSG_CHECKING([for vorbis]) +AC_ARG_ENABLE(vorbis, + AS_HELP_STRING([--enable-vorbis], [enable vorbis @<:@default=yes@:>@]), + [case "$enableval" in + y | yes) HAVE_VORBIS=yes ;; + *) HAVE_VORBIS=no ;; + esac], + [HAVE_VORBIS=yes]) +AC_MSG_RESULT([${HAVE_VORBIS}]) +AM_CONDITIONAL(HAVE_VORBIS, [test "$HAVE_VORBIS" = "yes"]) +if test "${HAVE_VORBIS}" = "yes"; then + AC_DEFINE(HAVE_VORBIS, 1, [vorbis]) + + REQUIRES_VORBIS="vorbis >= 1.0.1" + AC_SUBST(REQUIRES_VORBIS) + PKG_CHECK_MODULES([VORBIS], + [${REQUIRES_VORBIS}], + [], + [AC_MSG_ERROR([*** ${REQUIRES_VORBIS} not found by pkg-config on your system])] + ) + AC_SUBST(VORBIS_CFLAGS) + AC_SUBST(VORBIS_LIBS) fi dnl check for SDL