ogg.m4 3.4 KB

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