theora.m4 1.88 KB
Newer Older
Karl Heyes's avatar
Karl Heyes committed
1
2
3
4
5
6
7
8
9
# Configure paths for libtheora
# Karl Heyes 02-Feb-2004

dnl XIPH_PATH_THEORA([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libtheora, and define THEORA_CFLAGS THEORA_LIBS
dnl

AC_DEFUN([XIPH_PATH_THEORA],
[
Karl Heyes's avatar
Karl Heyes committed
10
AC_REQUIRE([XIPH_PATH_OGG])
Karl Heyes's avatar
Karl Heyes committed
11
12
13
14
15
16
17
18
19
20

dnl Get the cflags and libraries for theora
dnl
AC_ARG_VAR([THEORA],[path to theora installation])
AC_ARG_WITH(theora,
    AC_HELP_STRING([--with-theora=PREFIX],
        [Prefix where libtheora is installed (optional)]),
    theora_prefix="$withval",
    theora_prefix="$THEORA_PREFIX"
    )
21
22
23
24
25
26

if test "x$with_theora" = "xno"
then
  AC_MSG_RESULT([Theora support disabled by request])
else
  if test "x$theora_prefix" = "x"; then
Karl Heyes's avatar
Karl Heyes committed
27
28
29
30
31
    if test "x$prefix" = "xNONE"; then
        theora_prefix="/usr/local"
    else
        theora_prefix="$prefix"
    fi
32
  fi
Karl Heyes's avatar
Karl Heyes committed
33

34
35
36
37
38
39
40
41
  THEORA_CFLAGS="$OGG_CFLAGS"
  THEORA_LDFLAGS="$OGG_LDFLAGS"
  if test "x$theora_prefix" != "x$ogg_prefix"; then
      XIPH_GCC_WARNING(-I"$theora_prefix/include",,
              [THEORA_CFLAGS="$THEORA_CFLAGS -I$theora_prefix/include"
              THEORA_LDFLAGS="-L$theora_prefix/lib $THEORA_LDFLAGS"
              ])
  fi
Karl Heyes's avatar
Karl Heyes committed
42

Karl Heyes's avatar
Karl Heyes committed
43
  THEORA_LIBS="-ltheora -logg"
Karl Heyes's avatar
Karl Heyes committed
44

45
46
47
48
49
  ac_save_LIBS="$LIBS"
  ac_save_LDFLAGS="$LDFLAGS"
  LDFLAGS="$LDFLAGS $THEORA_LDFLAGS"
  LIBS="$LIBS $THEORA_LIBS"
  AC_MSG_CHECKING([for libtheora])
Karl Heyes's avatar
Karl Heyes committed
50
51
52
53
  AC_TRY_LINK_FUNC(theora_decode_header, [xt_have_theora="yes"],
          [xt_have_theora="Not found"])
  AC_TRY_LINK_FUNC(theora_decode_header, [xt_have_theora="yes"],
          [xt_have_theora="old version"])
Karl Heyes's avatar
Karl Heyes committed
54

55
56
  LIBS="$ac_save_LIBS"
  LDFLAGS="$ac_save_LDFLAGS"
Karl Heyes's avatar
Karl Heyes committed
57

58
59
  if test "x$xt_have_theora" = "xyes"
  then
Karl Heyes's avatar
Karl Heyes committed
60
61
    AC_MSG_RESULT([ok])
    AC_DEFINE([HAVE_THEORA],[1],[Define if Theora support is available])
Karl Heyes's avatar
Karl Heyes committed
62
    $1
63
  else
Karl Heyes's avatar
Karl Heyes committed
64
65
66
    THEORA_CFLAGS=""
    THEORA_LDFLAGS=""
    THEORA_LIBS=""
Karl Heyes's avatar
Karl Heyes committed
67
68
    AC_MSG_WARN([$xt_have_theora])
    $2
69
  fi
Karl Heyes's avatar
Karl Heyes committed
70
fi
Karl Heyes's avatar
Karl Heyes committed
71
72
73
AC_SUBST(THEORA_CFLAGS)
AC_SUBST(THEORA_LDFLAGS)
AC_SUBST(THEORA_LIBS)
Karl Heyes's avatar
Karl Heyes committed
74
])