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"
19 elif test "x$prefix" != "xNONE"; then
20 vorbis_args="$vorbis_args --prefix=$prefix"
21 VORBIS_CFLAGS="-I$prefix/include"
22 VORBIS_LIBDIR="-L$prefix/lib"
25 VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
26 VORBISFILE_LIBS="-lvorbisfile"
27 VORBISENC_LIBS="-lvorbisenc"
29 AC_MSG_CHECKING(for Vorbis)
33 if test "x$enable_vorbistest" = "xyes" ; then
34 ac_save_CFLAGS="$CFLAGS"
36 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
37 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
39 dnl Now check if the installed Vorbis is sufficiently new.
46 #include <vorbis/codec.h>
50 system("touch conf.vorbistest");
54 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
55 CFLAGS="$ac_save_CFLAGS"
59 if test "x$no_vorbis" = "x" ; then
61 ifelse([$1], , :, [$1])
64 if test -f conf.vorbistest ; then
67 echo "*** Could not run Vorbis test program, checking why..."
68 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
69 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
72 #include <vorbis/codec.h>
74 [ echo "*** The test program compiled, but did not run. This usually means"
75 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
76 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
77 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
78 echo "*** to the installed location Also, make sure you have run ldconfig if that"
79 echo "*** is required on your system"
81 echo "*** If you have an old version installed, it is best to remove it, although"
82 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
83 [ echo "*** The test program failed to compile or link. See the file config.log for the"
84 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
85 echo "*** or that you have moved Vorbis since it was installed." ])
86 CFLAGS="$ac_save_CFLAGS"
93 ifelse([$2], , :, [$2])
95 AC_SUBST(VORBIS_CFLAGS)
97 AC_SUBST(VORBISFILE_LIBS)
98 AC_SUBST(VORBISENC_LIBS)