speex.m4 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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" != "x" ; then
  20. SPEEX_LIBS="-L$speex_prefix/lib"
  21. elif test "x$prefix" != "xNONE" ; then
  22. SPEEX_LIBS="-L$prefix/lib"
  23. fi
  24. SPEEX_LIBS="$SPEEX_LIBS -lspeex"
  25. if test "x$speex_includes" != "x" ; then
  26. SPEEX_CFLAGS="-I$speex_includes"
  27. elif test "x$speex_prefix" != "x" ; then
  28. SPEEX_CFLAGS="-I$speex_prefix/include"
  29. elif test "x$prefix" != "xNONE"; then
  30. SPEEX_CFLAGS="-I$prefix/include"
  31. fi
  32. AC_MSG_CHECKING(for Speex)
  33. no_speex=""
  34. if test "x$enable_speextest" = "xyes" ; then
  35. ac_save_CFLAGS="$CFLAGS"
  36. ac_save_LIBS="$LIBS"
  37. CFLAGS="$CFLAGS $SPEEX_CFLAGS"
  38. LIBS="$LIBS $SPEEX_LIBS"
  39. dnl
  40. dnl Now check if the installed Speex is sufficiently new.
  41. dnl
  42. rm -f conf.speextest
  43. AC_TRY_RUN([
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <speex/speex.h>
  48. int main ()
  49. {
  50. system("touch conf.speextest");
  51. return 0;
  52. }
  53. ],, no_speex=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  54. CFLAGS="$ac_save_CFLAGS"
  55. LIBS="$ac_save_LIBS"
  56. fi
  57. if test "x$no_speex" = "x" ; then
  58. AC_MSG_RESULT(yes)
  59. ifelse([$1], , :, [$1])
  60. else
  61. AC_MSG_RESULT(no)
  62. if test -f conf.speextest ; then
  63. :
  64. else
  65. echo "*** Could not run Speex test program, checking why..."
  66. CFLAGS="$CFLAGS $SPEEX_CFLAGS"
  67. LIBS="$LIBS $SPEEX_LIBS"
  68. AC_TRY_LINK([
  69. #include <stdio.h>
  70. #include <speex/speex.h>
  71. ], [ return 0; ],
  72. [ echo "*** The test program compiled, but did not run. This usually means"
  73. echo "*** that the run-time linker is not finding Speex or finding the wrong"
  74. echo "*** version of Speex. If it is not finding Speex, you'll need to set your"
  75. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  76. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  77. echo "*** is required on your system"
  78. echo "***"
  79. echo "*** If you have an old version installed, it is best to remove it, although"
  80. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  81. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  82. echo "*** exact error that occured. This usually means Speex was incorrectly installed"
  83. echo "*** or that you have moved Speex since it was installed." ])
  84. CFLAGS="$ac_save_CFLAGS"
  85. LIBS="$ac_save_LIBS"
  86. fi
  87. SPEEX_CFLAGS=""
  88. SPEEX_LIBS=""
  89. ifelse([$2], , :, [$2])
  90. fi
  91. AC_SUBST(SPEEX_CFLAGS)
  92. AC_SUBST(SPEEX_LIBS)
  93. rm -f conf.speextest
  94. ])