vorbis.m4 2.42 KB
Newer Older
1
2
# Configure paths for libvorbis
# Jack Moffitt <jack@icecast.org> 10-21-2000
3
# updated by Karl Heyes 31-Mar-2003
4
5
6
# Shamelessly stolen from Owen Taylor and Manish Singh

dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7
8
dnl Test for libvorbis, and define VORBIS_CFLAGS VORBIS_LIBS
dnl VORBIS_VORBISENC_LIBS VORBIS_VORBISFILE_LIBS VORBIS_LDFLAGS
9
10
dnl

11
AC_DEFUN([XIPH_PATH_VORBIS],
Karl Heyes's avatar
Karl Heyes committed
12
13
[dnl
AC_REQUIRE([XIPH_PATH_OGG])
14

15
dnl Get the cflags and libraries for vorbis
16
dnl
17
18
19
20
21
22
23
24
25
26
27
28
29
30
AC_ARG_VAR([VORBIS_PREFIX],[path to vorbis installation])
AC_ARG_WITH(vorbis,
    AC_HELP_STRING([--with-vorbis=PREFIX],
        [Prefix where libvorbis is installed (optional)]),
    vorbis_prefix="$withval",
    vorbis_prefix="$VORBIS_PREFIX"
    )
if test "x$vorbis_prefix" = "x"; then
    if test "x$prefix" = "xNONE"; then
        vorbis_prefix="/usr/local"
    else
        vorbis_prefix="$prefix"
    fi
fi
31

32
33
34
VORBIS_CFLAGS="$OGG_CFLAGS"
VORBIS_LDFLAGS="$OGG_LDFLAGS"
if test "x$vorbis_prefix" != "x$ogg_prefix"; then
35
    XIPH_GCC_WARNING(-I"$vorbis_prefix/include",,
36
37
38
39
            [VORBIS_CFLAGS="$VORBIS_CFLAGS -I$vorbis_prefix/include"
            VORBIS_LDFLAGS="-L$vorbis_prefix/lib $VORBIS_LDFLAGS"
            ])
fi
40

41
42
43
VORBIS_LIBS="-lvorbis"
VORBISFILE_LIBS="-lvorbisfile"
VORBISENC_LIBS="-lvorbisenc"
44

Karl Heyes's avatar
Karl Heyes committed
45
46
47
48
xt_save_LIBS="$LIBS"
xt_save_LDFLAGS="$LDFLAGS"
xt_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $VORBIS_CFLAGS"
49
50
LDFLAGS="$LDFLAGS $VORBIS_LDFLAGS"
LIBS="$LIBS $VORBIS_LIBS"
Karl Heyes's avatar
Karl Heyes committed
51
xt_lib_vorbis="not found"
brendan's avatar
brendan committed
52
AC_MSG_CHECKING([for libvorbis])
Karl Heyes's avatar
Karl Heyes committed
53
AC_TRY_LINK_FUNC(ogg_stream_init, [xt_lib_vorbis=ok],
54
55
        [LIBS="$LIBS $OGG_LIBS -lm"
        AC_TRY_LINK_FUNC(vorbis_info_init,
Karl Heyes's avatar
Karl Heyes committed
56
            [xt_lib_vorbis=ok
57
            VORBIS_LIBS="$VORBIS_LIBS $OGG_LIBS -lm"],
Karl Heyes's avatar
Karl Heyes committed
58
            )
59
        ])
60

Karl Heyes's avatar
Karl Heyes committed
61
62
AC_MSG_RESULT([$xt_lib_vorbis])
if test "x$xt_lib_vorbis" = "xok"; then
63
64
65
#
# Now check if the installed Vorbis is sufficiently new.
#
Karl Heyes's avatar
Karl Heyes committed
66
67
AC_CHECK_TYPES([struct ovectl_ratemanage_arg],,
        [xt_lib_vorbis="old version found"], [
68
#include <vorbis/codec.h>
69
70
#include <vorbis/vorbisenc.h>
        ])
Karl Heyes's avatar
Karl Heyes committed
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
fi
CPPFLAGS="$xt_save_CPPFLAGS"
LIBS="$xt_save_LIBS"
LDFLAGS="$xt_save_LDFLAGS"

if test "x$xt_lib_vorbis" = "xok"; then
    ifelse([$1], ,[:], [$1])
else
    VORBIS_CFLAGS=""
    VORBIS_LDFLAGS=""
    VORBIS_LIBS=""
    VORBISFILE_LIBS=""
    VORBISENC_LIBS=""
    ifelse([$2], ,, [$2])
fi
86
87
88
89
90
AC_SUBST(VORBIS_CFLAGS)
AC_SUBST(VORBIS_LDFLAGS)
AC_SUBST(VORBIS_LIBS)
AC_SUBST(VORBISFILE_LIBS)
AC_SUBST(VORBISENC_LIBS)
91
])