summaryrefslogtreecommitdiffstats
path: root/patches/libtheora-1.0/libtheora-1.0beta3-configure-ogg.diff
blob: ded27261779e3afe8b0aafbb6c67303429fd00ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From: Robert Schwebel <r.schwebel@pengutronix.de>
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 <r.schwebel@pengutronix.de>

---
 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