vorbis.m4 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Configure paths for libvorbis
  2. # Jack Moffitt <jack@icecast.org> 10-21-2000
  3. # Shamelessly stolen from Owen Taylor and Manish Singh
  4. # thomasvs added check for vorbis_bitrate_addblock which is new in rc3
  5. dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  6. dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
  7. dnl
  8. AC_DEFUN([XIPH_PATH_VORBIS],
  9. [dnl
  10. dnl Get the cflags and libraries
  11. dnl
  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)
  16. if test "x$vorbis_libraries" != "x" ; then
  17. VORBIS_LIBS="-L$vorbis_libraries"
  18. elif test "x$vorbis_prefix" != "x" ; then
  19. VORBIS_LIBS="-L$vorbis_prefix/lib"
  20. elif test "x$prefix" != "xNONE"; then
  21. VORBIS_LIBS="-L$prefix/lib"
  22. fi
  23. VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
  24. VORBISFILE_LIBS="-lvorbisfile"
  25. VORBISENC_LIBS="-lvorbisenc"
  26. if test "x$vorbis_includes" != "x" ; then
  27. VORBIS_CFLAGS="-I$vorbis_includes"
  28. elif test "x$vorbis_prefix" != "x" ; then
  29. VORBIS_CFLAGS="-I$vorbis_prefix/include"
  30. elif test "x$prefix" != "xNONE"; then
  31. VORBIS_CFLAGS="-I$prefix/include"
  32. fi
  33. AC_MSG_CHECKING(for Vorbis)
  34. no_vorbis=""
  35. if test "x$enable_vorbistest" = "xyes" ; then
  36. ac_save_CFLAGS="$CFLAGS"
  37. ac_save_LIBS="$LIBS"
  38. CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
  39. LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
  40. dnl
  41. dnl Now check if the installed Vorbis is sufficiently new.
  42. dnl
  43. rm -f conf.vorbistest
  44. AC_TRY_RUN([
  45. #include <stdio.h>
  46. #include <stdlib.h>
  47. #include <string.h>
  48. #include <vorbis/codec.h>
  49. #include <vorbis/vorbisenc.h>
  50. int main ()
  51. {
  52. vorbis_block vb;
  53. vorbis_dsp_state vd;
  54. vorbis_info vi;
  55. vorbis_info_init (&vi);
  56. vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
  57. vorbis_analysis_init (&vd, &vi);
  58. vorbis_block_init (&vd, &vb);
  59. /* this function was added in 1.0rc3, so this is what we're testing for */
  60. vorbis_bitrate_addblock (&vb);
  61. system("touch conf.vorbistest");
  62. return 0;
  63. }
  64. ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  65. CFLAGS="$ac_save_CFLAGS"
  66. LIBS="$ac_save_LIBS"
  67. fi
  68. if test "x$no_vorbis" = "x" ; then
  69. AC_MSG_RESULT(yes)
  70. ifelse([$1], , :, [$1])
  71. else
  72. AC_MSG_RESULT(no)
  73. if test -f conf.vorbistest ; then
  74. :
  75. else
  76. echo "*** Could not run Vorbis test program, checking why..."
  77. CFLAGS="$CFLAGS $VORBIS_CFLAGS"
  78. LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
  79. AC_TRY_LINK([
  80. #include <stdio.h>
  81. #include <vorbis/codec.h>
  82. ], [ return 0; ],
  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"
  89. echo "***"
  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"
  96. LIBS="$ac_save_LIBS"
  97. fi
  98. VORBIS_CFLAGS=""
  99. VORBIS_LIBS=""
  100. VORBISFILE_LIBS=""
  101. VORBISENC_LIBS=""
  102. ifelse([$2], , :, [$2])
  103. fi
  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
  109. ])