acinclude.m4 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. ])
  96. dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
  97. dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
  98. dnl also defines GSTUFF_PKG_ERRORS on error
  99. AC_DEFUN([PKG_CHECK_MODULES], [
  100. succeeded=no
  101. if test -z "$PKG_CONFIG"; then
  102. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  103. fi
  104. if test "$PKG_CONFIG" = "no" ; then
  105. echo "*** The pkg-config script could not be found. Make sure it is"
  106. echo "*** in your path, or set the PKG_CONFIG environment variable"
  107. echo "*** to the full path to pkg-config."
  108. echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
  109. else
  110. PKG_CONFIG_MIN_VERSION=0.9.0
  111. if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
  112. AC_MSG_CHECKING(for $2)
  113. if $PKG_CONFIG --exists "$2" ; then
  114. AC_MSG_RESULT(yes)
  115. succeeded=yes
  116. AC_MSG_CHECKING($1_CFLAGS)
  117. $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
  118. AC_MSG_RESULT($$1_CFLAGS)
  119. AC_MSG_CHECKING($1_LIBS)
  120. $1_LIBS=`$PKG_CONFIG --libs "$2"`
  121. AC_MSG_RESULT($$1_LIBS)
  122. else
  123. $1_CFLAGS=""
  124. $1_LIBS=""
  125. ## If we have a custom action on failure, don't print errors, but
  126. ## do set a variable so people can do so.
  127. $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
  128. ifelse([$4], ,echo $$1_PKG_ERRORS,)
  129. fi
  130. AC_SUBST($1_CFLAGS)
  131. AC_SUBST($1_LIBS)
  132. else
  133. echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
  134. echo "*** See http://www.freedesktop.org/software/pkgconfig"
  135. fi
  136. fi
  137. if test $succeeded = yes; then
  138. ifelse([$3], , :, [$3])
  139. else
  140. ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
  141. fi
  142. ])