speex.m4 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Configure paths for libspeex
  2. # Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
  3. # Shamelessly stolen from:
  4. # Jack Moffitt <jack@icecast.org> 10-21-2000
  5. # Shamelessly stolen from Owen Taylor and Manish Singh
  6. dnl XIPH_PATH_SPEEX([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  7. dnl Test for libspeex, and define SPEEX_CFLAGS and SPEEX_LIBS
  8. dnl
  9. AC_DEFUN([XIPH_PATH_SPEEX],
  10. [dnl
  11. dnl Get the cflags and libraries
  12. dnl
  13. AC_ARG_WITH(speex,[ --with-speex=PFX Prefix where libspeex is installed (optional)], speex_prefix="$withval", speex_prefix="")
  14. AC_ARG_WITH(speex-libraries,[ --with-speex-libraries=DIR Directory where libspeex library is installed (optional)], speex_libraries="$withval", speex_libraries="")
  15. AC_ARG_WITH(speex-includes,[ --with-speex-includes=DIR Directory where libspeex header files are installed (optional)], speex_includes="$withval", speex_includes="")
  16. AC_ARG_ENABLE(speextest, [ --disable-speextest Do not try to compile and run a test Speex program],, enable_speextest=yes)
  17. if test "x$speex_libraries" != "x" ; then
  18. SPEEX_LIBS="-L$speex_libraries"
  19. elif test "x$speex_prefix" = "xno" || test "x$speex_prefix" = "xyes" ; then
  20. SPEEX_LIBS=""
  21. elif test "x$speex_prefix" != "x" ; then
  22. SPEEX_LIBS="-L$speex_prefix/lib"
  23. elif test "x$prefix" != "xNONE" ; then
  24. SPEEX_LIBS="-L$prefix/lib"
  25. fi
  26. if test "x$speex_prefix" != "xno" ; then
  27. SPEEX_LIBS="$SPEEX_LIBS -lspeex"
  28. fi
  29. if test "x$speex_includes" != "x" ; then
  30. SPEEX_CFLAGS="-I$speex_includes"
  31. elif test "x$speex_prefix" = "xno" || test "x$speex_prefix" = "xyes" ; then
  32. SPEEX_CFLAGS=""
  33. elif test "x$speex_prefix" != "x" ; then
  34. SPEEX_CFLAGS="-I$speex_prefix/include"
  35. elif test "x$prefix" != "xNONE"; then
  36. SPEEX_CFLAGS="-I$prefix/include"
  37. fi
  38. AC_MSG_CHECKING(for Speex)
  39. if test "x$speex_prefix" = "xno" ; then
  40. no_speex="disabled"
  41. enable_speextest="no"
  42. else
  43. no_speex=""
  44. fi
  45. if test "x$enable_speextest" = "xyes" ; then
  46. ac_save_CFLAGS="$CFLAGS"
  47. ac_save_LIBS="$LIBS"
  48. CFLAGS="$CFLAGS $SPEEX_CFLAGS"
  49. LIBS="$LIBS $SPEEX_LIBS"
  50. dnl
  51. dnl Now check if the installed Speex is sufficiently new.
  52. dnl
  53. rm -f conf.speextest
  54. AC_TRY_RUN([
  55. #include <stdio.h>
  56. #include <stdlib.h>
  57. #include <string.h>
  58. #include <speex/speex.h>
  59. int main (void)
  60. {
  61. system("touch conf.speextest");
  62. return 0;
  63. }
  64. ],, no_speex=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_speex" = "xdisabled" ; then
  69. AC_MSG_RESULT(no)
  70. ifelse([$2], , :, [$2])
  71. elif test "x$no_speex" = "x" ; then
  72. AC_MSG_RESULT(yes)
  73. ifelse([$1], , :, [$1])
  74. else
  75. AC_MSG_RESULT(no)
  76. if test -f conf.speextest ; then
  77. :
  78. else
  79. echo "*** Could not run Speex test program, checking why..."
  80. CFLAGS="$CFLAGS $SPEEX_CFLAGS"
  81. LIBS="$LIBS $SPEEX_LIBS"
  82. AC_TRY_LINK([
  83. #include <stdio.h>
  84. #include <speex/speex.h>
  85. ], [ return 0; ],
  86. [ echo "*** The test program compiled, but did not run. This usually means"
  87. echo "*** that the run-time linker is not finding Speex or finding the wrong"
  88. echo "*** version of Speex. If it is not finding Speex, you'll need to set your"
  89. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  90. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  91. echo "*** is required on your system"
  92. echo "***"
  93. echo "*** If you have an old version installed, it is best to remove it, although"
  94. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  95. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  96. echo "*** exact error that occurred. This usually means Speex was incorrectly installed"
  97. echo "*** or that you have moved Speex since it was installed." ])
  98. CFLAGS="$ac_save_CFLAGS"
  99. LIBS="$ac_save_LIBS"
  100. fi
  101. SPEEX_CFLAGS=""
  102. SPEEX_LIBS=""
  103. ifelse([$2], , :, [$2])
  104. fi
  105. AC_SUBST(SPEEX_CFLAGS)
  106. AC_SUBST(SPEEX_LIBS)
  107. rm -f conf.speextest
  108. ])