vorbis.m4 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Configure paths for libvorbis
  2. # Jack Moffitt <jack@icecast.org> 10-21-2000
  3. # Shamelessly stolen from Owen Taylor and Manish Singh
  4. dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  5. dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
  6. dnl
  7. AC_DEFUN(AM_PATH_VORBIS,
  8. [dnl
  9. dnl Get the cflags and libraries
  10. dnl
  11. AC_ARG_WITH(vorbis-prefix,[ --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
  12. AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
  13. if test x$vorbis_prefix != x ; then
  14. vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
  15. VORBIS_CFLAGS="-I$vorbis_prefix/include"
  16. VORBIS_LIBDIR="-L$vorbis_prefix/lib"
  17. fi
  18. VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
  19. VORBISFILE_LIBS="-lvorbisfile"
  20. VORBISENC_LIBS="-lvorbisenc"
  21. AC_MSG_CHECKING(for Vorbis)
  22. no_vorbis=""
  23. if test "x$enable_vorbistest" = "xyes" ; then
  24. ac_save_CFLAGS="$CFLAGS"
  25. ac_save_LIBS="$LIBS"
  26. CFLAGS="$CFLAGS $VORBIS_CFLAGS"
  27. LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
  28. dnl
  29. dnl Now check if the installed Vorbis is sufficiently new.
  30. dnl
  31. rm -f conf.vorbistest
  32. AC_TRY_RUN([
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include <string.h>
  36. #include <vorbis/codec.h>
  37. int main ()
  38. {
  39. system("touch conf.vorbistest");
  40. return 0;
  41. }
  42. ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  43. CFLAGS="$ac_save_CFLAGS"
  44. LIBS="$ac_save_LIBS"
  45. fi
  46. if test "x$no_vorbis" = x ; then
  47. AC_MSG_RESULT(yes)
  48. ifelse([$1], , :, [$1])
  49. else
  50. AC_MSG_RESULT(no)
  51. if test -f conf.vorbistest ; then
  52. :
  53. else
  54. echo "*** Could not run Vorbis test program, checking why..."
  55. CFLAGS="$CFLAGS $VORBIS_CFLAGS"
  56. LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
  57. AC_TRY_LINK([
  58. #include <stdio.h>
  59. #include <vorbis/codec.h>
  60. ], [ return 0; ],
  61. [ echo "*** The test program compiled, but did not run. This usually means"
  62. echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
  63. echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
  64. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  65. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  66. echo "*** is required on your system"
  67. echo "***"
  68. echo "*** If you have an old version installed, it is best to remove it, although"
  69. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  70. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  71. echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
  72. echo "*** or that you have moved Vorbis since it was installed." ])
  73. CFLAGS="$ac_save_CFLAGS"
  74. LIBS="$ac_save_LIBS"
  75. fi
  76. VORBIS_CFLAGS=""
  77. VORBIS_LIBS=""
  78. VORBISFILE_LIBS=""
  79. VORBISENC_LIBS=""
  80. ifelse([$2], , :, [$2])
  81. fi
  82. AC_SUBST(VORBIS_CFLAGS)
  83. AC_SUBST(VORBIS_LIBS)
  84. AC_SUBST(VORBISFILE_LIBS)
  85. AC_SUBST(VORBISENC_LIBS)
  86. rm -f conf.vorbistest
  87. ])