acinclude.m4 3.0 KB

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