vorbis.m4 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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,AC_HELP_STRING([--with-vorbis=PFX],[Prefix where libvorbis is installed (optional)]), vorbis_prefix="$withval", vorbis_prefix="")
  13. AC_ARG_WITH(vorbis-libraries,AC_HELP_STRING([--with-vorbis-libraries=DIR],[Directory where libvorbis library is installed (optional)]), vorbis_libraries="$withval", vorbis_libraries="")
  14. AC_ARG_WITH(vorbis-includes,AC_HELP_STRING([--with-vorbis-includes=DIR],[Directory where libvorbis header files are installed (optional)]), vorbis_includes="$withval", vorbis_includes="")
  15. AC_ARG_ENABLE(vorbistest,AC_HELP_STRING([--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" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
  19. VORBIS_LIBS=""
  20. elif test "x$vorbis_prefix" != "x" ; then
  21. VORBIS_LIBS="-L$vorbis_prefix/lib"
  22. elif test "x$prefix" != "xNONE"; then
  23. VORBIS_LIBS="-L$prefix/lib"
  24. fi
  25. if test "x$vorbis_prefix" != "xno" ; then
  26. VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
  27. fi
  28. VORBISFILE_LIBS="-lvorbisfile"
  29. VORBISENC_LIBS="-lvorbisenc"
  30. if test "x$vorbis_includes" != "x" ; then
  31. VORBIS_CFLAGS="-I$vorbis_includes"
  32. elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
  33. VORBIS_CFLAGS=""
  34. elif test "x$vorbis_prefix" != "x" ; then
  35. VORBIS_CFLAGS="-I$vorbis_prefix/include"
  36. elif test "x$prefix" != "xNONE"; then
  37. VORBIS_CFLAGS="-I$prefix/include"
  38. fi
  39. AC_MSG_CHECKING(for Vorbis)
  40. if test "x$vorbis_prefix" = "xno" ; then
  41. no_vorbis="disabled"
  42. enable_vorbistest="no"
  43. else
  44. no_vorbis=""
  45. fi
  46. if test "x$enable_vorbistest" = "xyes" ; then
  47. ac_save_CFLAGS="$CFLAGS"
  48. ac_save_LIBS="$LIBS"
  49. CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
  50. LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
  51. dnl
  52. dnl Now check if the installed Vorbis is sufficiently new.
  53. dnl
  54. rm -f conf.vorbistest
  55. AC_TRY_RUN([
  56. #include <stdio.h>
  57. #include <stdlib.h>
  58. #include <string.h>
  59. #include <vorbis/codec.h>
  60. #include <vorbis/vorbisenc.h>
  61. int main ()
  62. {
  63. vorbis_block vb;
  64. vorbis_dsp_state vd;
  65. vorbis_info vi;
  66. vorbis_info_init (&vi);
  67. vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
  68. vorbis_analysis_init (&vd, &vi);
  69. vorbis_block_init (&vd, &vb);
  70. /* this function was added in 1.0rc3, so this is what we're testing for */
  71. vorbis_bitrate_addblock (&vb);
  72. system("touch conf.vorbistest");
  73. return 0;
  74. }
  75. ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  76. CFLAGS="$ac_save_CFLAGS"
  77. LIBS="$ac_save_LIBS"
  78. fi
  79. if test "x$no_vorbis" = "xdisabled" ; then
  80. AC_MSG_RESULT(no)
  81. ifelse([$2], , :, [$2])
  82. elif test "x$no_vorbis" = "x" ; then
  83. AC_MSG_RESULT(yes)
  84. ifelse([$1], , :, [$1])
  85. else
  86. AC_MSG_RESULT(no)
  87. if test -f conf.vorbistest ; then
  88. :
  89. else
  90. echo "*** Could not run Vorbis test program, checking why..."
  91. CFLAGS="$CFLAGS $VORBIS_CFLAGS"
  92. LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
  93. AC_TRY_LINK([
  94. #include <stdio.h>
  95. #include <vorbis/codec.h>
  96. ], [ return 0; ],
  97. [ echo "*** The test program compiled, but did not run. This usually means"
  98. echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
  99. echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
  100. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  101. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  102. echo "*** is required on your system"
  103. echo "***"
  104. echo "*** If you have an old version installed, it is best to remove it, although"
  105. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  106. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  107. echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
  108. echo "*** or that you have moved Vorbis since it was installed." ])
  109. CFLAGS="$ac_save_CFLAGS"
  110. LIBS="$ac_save_LIBS"
  111. fi
  112. VORBIS_CFLAGS=""
  113. VORBIS_LIBS=""
  114. VORBISFILE_LIBS=""
  115. VORBISENC_LIBS=""
  116. ifelse([$2], , :, [$2])
  117. fi
  118. AC_SUBST(VORBIS_CFLAGS)
  119. AC_SUBST(VORBIS_LIBS)
  120. AC_SUBST(VORBISFILE_LIBS)
  121. AC_SUBST(VORBISENC_LIBS)
  122. rm -f conf.vorbistest
  123. ])