acinclude.m4 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # acinclude.m4
  2. # all .m4 files needed that might not be installed go here
  3. # Configure paths for libogg
  4. # Jack Moffitt <jack@icecast.org> 10-21-2000
  5. # Shamelessly stolen from Owen Taylor and Manish Singh
  6. dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  7. dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
  8. dnl
  9. AC_DEFUN([XIPH_PATH_OGG],
  10. [dnl
  11. dnl Get the cflags and libraries
  12. dnl
  13. AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
  14. AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
  15. AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
  16. AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
  17. if test "x$ogg_libraries" != "x" ; then
  18. OGG_LIBS="-L$ogg_libraries"
  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. OGG_LIBS="$OGG_LIBS -logg"
  25. if test "x$ogg_includes" != "x" ; then
  26. OGG_CFLAGS="-I$ogg_includes"
  27. elif test "x$ogg_prefix" != "x" ; then
  28. OGG_CFLAGS="-I$ogg_prefix/include"
  29. elif test "x$prefix" != "xNONE"; then
  30. OGG_CFLAGS="-I$prefix/include"
  31. fi
  32. AC_MSG_CHECKING(for Ogg)
  33. no_ogg=""
  34. if test "x$enable_oggtest" = "xyes" ; then
  35. ac_save_CFLAGS="$CFLAGS"
  36. ac_save_LIBS="$LIBS"
  37. CFLAGS="$CFLAGS $OGG_CFLAGS"
  38. LIBS="$LIBS $OGG_LIBS"
  39. dnl
  40. dnl Now check if the installed Ogg is sufficiently new.
  41. dnl
  42. rm -f conf.oggtest
  43. AC_TRY_RUN([
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <ogg/ogg.h>
  48. int main ()
  49. {
  50. system("touch conf.oggtest");
  51. return 0;
  52. }
  53. ],, no_ogg=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_ogg" = "x" ; then
  58. AC_MSG_RESULT(yes)
  59. ifelse([$1], , :, [$1])
  60. else
  61. AC_MSG_RESULT(no)
  62. if test -f conf.oggtest ; then
  63. :
  64. else
  65. echo "*** Could not run Ogg test program, checking why..."
  66. CFLAGS="$CFLAGS $OGG_CFLAGS"
  67. LIBS="$LIBS $OGG_LIBS"
  68. AC_TRY_LINK([
  69. #include <stdio.h>
  70. #include <ogg/ogg.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 Ogg or finding the wrong"
  74. echo "*** version of Ogg. If it is not finding Ogg, 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 Ogg was incorrectly installed"
  83. echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
  84. echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
  85. CFLAGS="$ac_save_CFLAGS"
  86. LIBS="$ac_save_LIBS"
  87. fi
  88. OGG_CFLAGS=""
  89. OGG_LIBS=""
  90. ifelse([$2], , :, [$2])
  91. fi
  92. AC_SUBST(OGG_CFLAGS)
  93. AC_SUBST(OGG_LIBS)
  94. rm -f conf.oggtest
  95. ])