From: Robert Schwebel Subject: libtheora: fix configure.ac to work with cross scenario for ogg This is https://trac.xiph.org/ticket/1467 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 libogg test. Signed-off-by: Robert Schwebel --- configure.ac | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) Index: libtheora-1.0/configure.ac =================================================================== --- libtheora-1.0.orig/configure.ac +++ libtheora-1.0/configure.ac @@ -256,34 +256,32 @@ dnl ------------------------------------ dnl Checks for support libraries and headers dnl -------------------------------------------------- -dnl check for Ogg -HAVE_OGG=no -dnl first check through pkg-config since it's more flexible -dnl check for pkg-config itself so we don't try the m4 macro without pkg-config -AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes) -if test "x$HAVE_PKG_CONFIG" = "xyes" -then - PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no) -fi -if test "x$HAVE_OGG" = "xno" -then - dnl fall back to the old school test - XIPH_PATH_OGG(, AC_MSG_ERROR([ - libogg is required to build this package! - please see http://www.xiph.org/ for how to - obtain a copy. - ])) - cflags_save=$CFLAGS - libs_save=$LIBS - CFLAGS="$CFLAGS $OGG_CFLAGS" - LIBS="$LIBS $OGG_LIBS" - AC_CHECK_FUNC(oggpackB_read, , [ - AC_MSG_ERROR([newer libogg version (1.1 or later) required]) - ]) - CFLAGS=$cflags_save - LIBS=$libs_save + +dnl check for Ogg +AC_MSG_CHECKING([for ogg]) +AC_ARG_ENABLE(ogg, + AS_HELP_STRING([--enable-ogg], [enable ogg @<:@default=yes@:>@]), + [case "$enableval" in + y | yes) HAVE_OGG=yes ;; + *) HAVE_OGG=no ;; + esac], + [HAVE_OGG=yes]) +AC_MSG_RESULT([${HAVE_OGG}]) +AM_CONDITIONAL(HAVE_OGG, [test "$HAVE_OGG" = "yes"]) +if test "${HAVE_OGG}" = "yes"; then + AC_DEFINE(HAVE_OGG, 1, [ogg]) + + REQUIRES_OGG="ogg >= 1.1" + AC_SUBST(REQUIRES_OGG) + PKG_CHECK_MODULES([OGG], + [${REQUIRES_OGG}], + [], + [AC_MSG_ERROR([*** ${REQUIRES_OGG} not found by pkg-config on your system])] + ) + AC_SUBST(OGG_CFLAGS) + AC_SUBST(OGG_LIBS) fi