ogg.m4 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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,AC_HELP_STRING([--with-ogg=PFX],[Prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="")
  12. AC_ARG_WITH(ogg-libraries,AC_HELP_STRING([--with-ogg-libraries=DIR],[Directory where libogg library is installed (optional)]), ogg_libraries="$withval", ogg_libraries="")
  13. AC_ARG_WITH(ogg-includes,AC_HELP_STRING([--with-ogg-includes=DIR],[Directory where libogg header files are installed (optional)]), ogg_includes="$withval", ogg_includes="")
  14. AC_ARG_ENABLE(oggtest,AC_HELP_STRING([--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" = "xno" || test "x$ogg_prefix" = "xyes" ; then
  18. OGG_LIBS=""
  19. elif test "x$ogg_prefix" != "x" ; then
  20. OGG_LIBS="-L$ogg_prefix/lib"
  21. elif test "x$prefix" != "xNONE" ; then
  22. OGG_LIBS="-L$prefix/lib"
  23. fi
  24. if test "x$ogg_prefix" != "xno" ; then
  25. OGG_LIBS="$OGG_LIBS -logg"
  26. fi
  27. if test "x$ogg_includes" != "x" ; then
  28. OGG_CFLAGS="-I$ogg_includes"
  29. elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
  30. OGG_CFLAGS=""
  31. elif test "x$ogg_prefix" != "x" ; then
  32. OGG_CFLAGS="-I$ogg_prefix/include"
  33. elif test "x$prefix" != "xNONE"; then
  34. OGG_CFLAGS="-I$prefix/include"
  35. fi
  36. AC_MSG_CHECKING(for Ogg)
  37. if test "x$ogg_prefix" = "xno" ; then
  38. no_ogg="disabled"
  39. enable_oggtest="no"
  40. else
  41. no_ogg=""
  42. fi
  43. if test "x$enable_oggtest" = "xyes" ; then
  44. ac_save_CFLAGS="$CFLAGS"
  45. ac_save_LIBS="$LIBS"
  46. CFLAGS="$CFLAGS $OGG_CFLAGS"
  47. LIBS="$LIBS $OGG_LIBS"
  48. dnl
  49. dnl Now check if the installed Ogg is sufficiently new.
  50. dnl
  51. rm -f conf.oggtest
  52. AC_TRY_RUN([
  53. #include <stdio.h>
  54. #include <stdlib.h>
  55. #include <string.h>
  56. #include <ogg/ogg.h>
  57. int main ()
  58. {
  59. system("touch conf.oggtest");
  60. return 0;
  61. }
  62. ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  63. CFLAGS="$ac_save_CFLAGS"
  64. LIBS="$ac_save_LIBS"
  65. fi
  66. if test "x$no_ogg" = "xdisabled" ; then
  67. AC_MSG_RESULT(no)
  68. ifelse([$2], , :, [$2])
  69. elif test "x$no_ogg" = "x" ; then
  70. AC_MSG_RESULT(yes)
  71. ifelse([$1], , :, [$1])
  72. else
  73. AC_MSG_RESULT(no)
  74. if test -f conf.oggtest ; then
  75. :
  76. else
  77. echo "*** Could not run Ogg test program, checking why..."
  78. CFLAGS="$CFLAGS $OGG_CFLAGS"
  79. LIBS="$LIBS $OGG_LIBS"
  80. AC_TRY_LINK([
  81. #include <stdio.h>
  82. #include <ogg/ogg.h>
  83. ], [ return 0; ],
  84. [ echo "*** The test program compiled, but did not run. This usually means"
  85. echo "*** that the run-time linker is not finding Ogg or finding the wrong"
  86. echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
  87. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  88. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  89. echo "*** is required on your system"
  90. echo "***"
  91. echo "*** If you have an old version installed, it is best to remove it, although"
  92. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  93. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  94. echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
  95. echo "*** or that you have moved Ogg since it was installed." ])
  96. CFLAGS="$ac_save_CFLAGS"
  97. LIBS="$ac_save_LIBS"
  98. fi
  99. OGG_CFLAGS=""
  100. OGG_LIBS=""
  101. ifelse([$2], , :, [$2])
  102. fi
  103. AC_SUBST(OGG_CFLAGS)
  104. AC_SUBST(OGG_LIBS)
  105. rm -f conf.oggtest
  106. ])