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,
13 AC_HELP_STRING([--with-vorbis-prefix=PFX],
14 [prefix where libvorbis is installed (optional)]),
15 vorbis_prefix="$withval", vorbis_prefix="")
17 AC_ARG_ENABLE(vorbistest,
18 AC_HELP_STRING([--disable-vorbistest],
19 [do not try to compile and run a test Vorbis program]),
20 , enable_vorbistest=yes)
22 if test "x$vorbis_prefix" != "xNONE" ; then
23 vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
24 VORBIS_CFLAGS="-I$vorbis_prefix/include"
25 VORBIS_LIBDIR="-L$vorbis_prefix/lib"
26 elif test "$prefix" != ""; then
27 vorbis_args="$vorbis_args --prefix=$prefix"
28 VORBIS_CFLAGS="-I$prefix/include"
29 VORBIS_LIBDIR="-L$prefix/lib"
32 VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
33 VORBISFILE_LIBS="-lvorbisfile"
34 VORBISENC_LIBS="-lvorbisenc"
36 AC_MSG_CHECKING(for Vorbis)
40 if test "x$enable_vorbistest" = "xyes" ; then
41 ac_save_CFLAGS="$CFLAGS"
43 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
44 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
46 dnl Now check if the installed Vorbis is sufficiently new.
53 #include <vorbis/codec.h>
57 system("touch conf.vorbistest");
61 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
62 CFLAGS="$ac_save_CFLAGS"
66 if test "x$no_vorbis" = "x" ; then
68 ifelse([$1], , :, [$1])
71 if test -f conf.vorbistest ; then
74 echo "*** Could not run Vorbis test program, checking why..."
75 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
76 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
79 #include <vorbis/codec.h>
81 [ echo "*** The test program compiled, but did not run. This usually means"
82 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
83 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
84 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
85 echo "*** to the installed location Also, make sure you have run ldconfig if that"
86 echo "*** is required on your system"
88 echo "*** If you have an old version installed, it is best to remove it, although"
89 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
90 [ echo "*** The test program failed to compile or link. See the file config.log for the"
91 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
92 echo "*** or that you have moved Vorbis since it was installed." ])
93 CFLAGS="$ac_save_CFLAGS"
100 ifelse([$2], , :, [$2])
102 AC_SUBST(VORBIS_CFLAGS)
103 AC_SUBST(VORBIS_LIBS)
104 AC_SUBST(VORBISFILE_LIBS)
105 AC_SUBST(VORBISENC_LIBS)
106 rm -f conf.vorbistest