1 # Configure paths for libvorbis
2 # Jack Moffitt <jack@icecast.org> 10-21-2000
3 # Shamelessly stolen from Owen Taylor and Manish Singh
5 dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
6 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
8 AC_DEFUN(AM_PATH_VORBIS,
10 dnl Get the cflags and libraries
12 AC_ARG_WITH(vorbis-prefix,[ --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
13 AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
15 if test x$vorbis_prefix != x ; then
16 vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
17 VORBIS_CFLAGS="-I$vorbis_prefix/include"
18 VORBIS_LIBDIR="-L$vorbis_prefix/lib"
21 VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
22 VORBISFILE_LIBS="-lvorbisfile"
23 VORBISENC_LIBS="-lvorbisenc"
25 AC_MSG_CHECKING(for Vorbis)
29 if test "x$enable_vorbistest" = "xyes" ; then
30 ac_save_CFLAGS="$CFLAGS"
32 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
33 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
35 dnl Now check if the installed Vorbis is sufficiently new.
42 #include <vorbis/codec.h>
46 system("touch conf.vorbistest");
50 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
51 CFLAGS="$ac_save_CFLAGS"
55 if test "x$no_vorbis" = x ; then
57 ifelse([$1], , :, [$1])
60 if test -f conf.vorbistest ; then
63 echo "*** Could not run Vorbis test program, checking why..."
64 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
65 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
68 #include <vorbis/codec.h>
70 [ echo "*** The test program compiled, but did not run. This usually means"
71 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
72 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
73 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
74 echo "*** to the installed location Also, make sure you have run ldconfig if that"
75 echo "*** is required on your system"
77 echo "*** If you have an old version installed, it is best to remove it, although"
78 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
79 [ echo "*** The test program failed to compile or link. See the file config.log for the"
80 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
81 echo "*** or that you have moved Vorbis since it was installed." ])
82 CFLAGS="$ac_save_CFLAGS"
89 ifelse([$2], , :, [$2])
91 AC_SUBST(VORBIS_CFLAGS)
93 AC_SUBST(VORBISFILE_LIBS)
94 AC_SUBST(VORBISENC_LIBS)