ogg.m4 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 AM_PATH_OGG([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  5. dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
  6. dnl
  7. AC_DEFUN(AM_PATH_OGG,
  8. [dnl
  9. dnl Get the cflags and libraries from the ogg-config script
  10. dnl
  11. AC_ARG_WITH(ogg-prefix,[ --with-ogg-prefix=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
  12. AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
  13. if test x$ogg_prefix != x ; then
  14. ogg_args="$ogg_args --prefix=$ogg_prefix"
  15. if test x${OGG_CONFIG+set} != xset ; then
  16. OGG_CONFIG=$ogg_prefix/bin/ogg-config
  17. fi
  18. fi
  19. AC_PATH_PROG(OGG_CONFIG, ogg-config, no)
  20. min_ogg_version=ifelse([$1], ,1.0.0,$1)
  21. AC_MSG_CHECKING(for Ogg - version >= $min_ogg_version)
  22. no_ogg=""
  23. if test "$OGG_CONFIG" = "no" ; then
  24. no_esd=yes
  25. else
  26. OGG_CFLAGS=`$OGG_CONFIG $oggconf_args --cflags`
  27. OGG_LIBS=`$OGG_CONFIG $oggconf_args --libs`
  28. ogg_major_version=`$OGG_CONFIG $ogg_args --version | \
  29. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  30. ogg_minor_version=`$OGG_CONFIG $ogg_args --version | \
  31. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  32. ogg_micro_version=`$OGG_CONFIG $ogg_config_args --version | \
  33. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  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. (Also sanity
  41. dnl checks the results of ogg-config to some extent
  42. dnl
  43. rm -f conf.oggtest
  44. AC_TRY_RUN([
  45. #include <stdio.h>
  46. #include <stdlib.h>
  47. #include <string.h>
  48. #include <ogg/ogg.h>
  49. int main ()
  50. {
  51. system("touch conf.oggtest");
  52. return 0;
  53. }
  54. ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  55. CFLAGS="$ac_save_CFLAGS"
  56. LIBS="$ac_save_LIBS"
  57. fi
  58. fi
  59. if test "x$no_ogg" = x ; then
  60. AC_MSG_RESULT(yes)
  61. ifelse([$2], , :, [$2])
  62. else
  63. AC_MSG_RESULT(no)
  64. if test "$OGG_CONFIG" = "no" ; then
  65. echo "*** The ogg-config script installed by Ogg could not be found"
  66. echo "*** If Ogg was installed in PREFIX, make sure PREFIX/bin is in"
  67. echo "*** your path, or set the OGG_CONFIG environment variable to the"
  68. echo "*** full path to ogg-config."
  69. else
  70. if test -f conf.oggtest ; then
  71. :
  72. else
  73. echo "*** Could not run Ogg test program, checking why..."
  74. CFLAGS="$CFLAGS $OGG_CFLAGS"
  75. LIBS="$LIBS $OGG_LIBS"
  76. AC_TRY_LINK([
  77. #include <stdio.h>
  78. #include <ogg/ogg.h>
  79. ], [ return 0; ],
  80. [ echo "*** The test program compiled, but did not run. This usually means"
  81. echo "*** that the run-time linker is not finding Ogg or finding the wrong"
  82. echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
  83. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  84. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  85. echo "*** is required on your system"
  86. echo "***"
  87. echo "*** If you have an old version installed, it is best to remove it, although"
  88. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  89. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  90. echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
  91. echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
  92. echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
  93. CFLAGS="$ac_save_CFLAGS"
  94. LIBS="$ac_save_LIBS"
  95. fi
  96. fi
  97. OGG_CFLAGS=""
  98. OGG_LIBS=""
  99. ifelse([$3], , :, [$3])
  100. fi
  101. AC_SUBST(OGG_CFLAGS)
  102. AC_SUBST(OGG_LIBS)
  103. rm -f conf.oggtest
  104. ])