1 # Configure paths for libvorbis
2 # Jack Moffitt <jack@icecast.org> 10-21-2000
3 # Shamelessly stolen from Owen Taylor and Manish Singh
4 # thomasvs added check for vorbis_bitrate_addblock which is new in rc3
5 # thomasvs added check for OV_ECTL_RATEMANAGE_SET which is new in 1.0 final
7 dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
8 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
10 AC_DEFUN([XIPH_PATH_VORBIS],
12 dnl Get the cflags and libraries
14 AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
15 AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
16 AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
17 AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
19 if test "x$vorbis_libraries" != "x" ; then
20 VORBIS_LIBS="-L$vorbis_libraries"
21 elif test "x$vorbis_prefix" != "x" ; then
22 VORBIS_LIBS="-L$vorbis_prefix/lib"
23 elif test "x$prefix" != "xNONE"; then
24 VORBIS_LIBS="-L$prefix/lib"
27 VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
28 VORBISFILE_LIBS="-lvorbisfile"
29 VORBISENC_LIBS="-lvorbisenc"
31 if test "x$vorbis_includes" != "x" ; then
32 VORBIS_CFLAGS="-I$vorbis_includes"
33 elif test "x$vorbis_prefix" != "x" ; then
34 VORBIS_CFLAGS="-I$vorbis_prefix/include"
35 elif test "x$prefix" != "xNONE"; then
36 VORBIS_CFLAGS="-I$prefix/include"
40 AC_MSG_CHECKING(for Vorbis)
44 if test "x$enable_vorbistest" = "xyes" ; then
45 ac_save_CFLAGS="$CFLAGS"
47 CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
48 LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
50 dnl Now check if the installed Vorbis is sufficiently new.
57 #include <vorbis/codec.h>
58 #include <vorbis/vorbisenc.h>
66 vorbis_info_init (&vi);
67 vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
68 vorbis_analysis_init (&vd, &vi);
69 vorbis_block_init (&vd, &vb);
70 /* this function was added in 1.0rc3, so this is what we're testing for */
71 vorbis_bitrate_addblock (&vb);
73 /* this define was added in 1.0 final */
74 #ifdef OV_ECTL_RATEMANAGE_SET
75 system("touch conf.vorbistest");
82 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
83 CFLAGS="$ac_save_CFLAGS"
87 if test "x$no_vorbis" = "x" ; then
89 ifelse([$1], , :, [$1])
92 if test -f conf.vorbistest ; then
95 echo "*** Could not run Vorbis test program, checking why..."
96 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
97 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
100 #include <vorbis/codec.h>
102 [ echo "*** The test program compiled, but did not run. This usually means"
103 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
104 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
105 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
106 echo "*** to the installed location Also, make sure you have run ldconfig if that"
107 echo "*** is required on your system"
109 echo "*** If you have an old version installed, it is best to remove it, although"
110 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
111 [ echo "*** The test program failed to compile or link. See the file config.log for the"
112 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
113 echo "*** or that you have moved Vorbis since it was installed." ])
114 CFLAGS="$ac_save_CFLAGS"
121 ifelse([$2], , :, [$2])
123 AC_SUBST(VORBIS_CFLAGS)
124 AC_SUBST(VORBIS_LIBS)
125 AC_SUBST(VORBISFILE_LIBS)
126 AC_SUBST(VORBISENC_LIBS)
127 rm -f conf.vorbistest