libopusenc.m4 4.5 KB

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