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,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
13 AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
14 AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
15 AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
17 if test "x$vorbis_libraries" != "x" ; then
18 VORBIS_LIBS="-L$vorbis_libraries"
19 elif test "x$vorbis_prefix" != "x" ; then
20 VORBIS_LIBS="-L$vorbis_prefix/lib"
21 elif test "x$prefix" != "xNONE"; then
22 VORBIS_LIBS="-L$prefix/lib"
25 VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
26 VORBISFILE_LIBS="-lvorbisfile"
27 VORBISENC_LIBS="-lvorbisenc"
29 if test "x$vorbis_includes" != "x" ; then
30 VORBIS_CFLAGS="-I$vorbis_includes"
31 elif test "x$vorbis_prefix" != "x" ; then
32 VORBIS_CFLAGS="-I$vorbis_prefix/include"
33 elif test "x$prefix" != "xNONE"; then
34 VORBIS_CFLAGS="-I$prefix/include"
38 AC_MSG_CHECKING(for Vorbis)
42 if test "x$enable_vorbistest" = "xyes" ; then
43 ac_save_CFLAGS="$CFLAGS"
45 CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
46 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
48 dnl Now check if the installed Vorbis is sufficiently new.
55 #include <vorbis/codec.h>
59 system("touch conf.vorbistest");
63 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
64 CFLAGS="$ac_save_CFLAGS"
68 if test "x$no_vorbis" = "x" ; then
70 ifelse([$1], , :, [$1])
73 if test -f conf.vorbistest ; then
76 echo "*** Could not run Vorbis test program, checking why..."
77 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
78 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
81 #include <vorbis/codec.h>
83 [ echo "*** The test program compiled, but did not run. This usually means"
84 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
85 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
86 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
87 echo "*** to the installed location Also, make sure you have run ldconfig if that"
88 echo "*** is required on your system"
90 echo "*** If you have an old version installed, it is best to remove it, although"
91 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
92 [ echo "*** The test program failed to compile or link. See the file config.log for the"
93 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
94 echo "*** or that you have moved Vorbis since it was installed." ])
95 CFLAGS="$ac_save_CFLAGS"
102 ifelse([$2], , :, [$2])
104 AC_SUBST(VORBIS_CFLAGS)
105 AC_SUBST(VORBIS_LIBS)
106 AC_SUBST(VORBISFILE_LIBS)
107 AC_SUBST(VORBISENC_LIBS)
108 rm -f conf.vorbistest