xmms.m4 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. # CFLAGS and library paths for XMMS
  2. # written 15 December 1999 by Ben Gertzfield <che@debian.org>
  3. dnl Usage:
  4. dnl AM_PATH_XMMS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  5. dnl
  6. dnl Example:
  7. dnl AM_PATH_XMMS(0.9.5.1, , AC_MSG_ERROR([*** XMMS >= 0.9.5.1 not installed - please install first ***]))
  8. dnl
  9. dnl Defines XMMS_CFLAGS, XMMS_LIBS, XMMS_DATA_DIR, XMMS_PLUGIN_DIR,
  10. dnl XMMS_VISUALIZATION_PLUGIN_DIR, XMMS_INPUT_PLUGIN_DIR,
  11. dnl XMMS_OUTPUT_PLUGIN_DIR, XMMS_GENERAL_PLUGIN_DIR, XMMS_EFFECT_PLUGIN_DIR,
  12. dnl and XMMS_VERSION for your plugin pleasure.
  13. dnl
  14. dnl XMMS_TEST_VERSION(AVAILABLE-VERSION, NEEDED-VERSION [, ACTION-IF-OKAY [, ACTION-IF-NOT-OKAY]])
  15. AC_DEFUN([XMMS_TEST_VERSION], [
  16. # Determine which version number is greater. Prints 2 to stdout if
  17. # the second number is greater, 1 if the first number is greater,
  18. # 0 if the numbers are equal.
  19. # Written 15 December 1999 by Ben Gertzfield <che@debian.org>
  20. # Revised 15 December 1999 by Jim Monty <monty@primenet.com>
  21. AC_PROG_AWK
  22. xmms_got_version=[` $AWK ' \
  23. BEGIN { \
  24. print vercmp(ARGV[1], ARGV[2]); \
  25. } \
  26. \
  27. function vercmp(ver1, ver2, ver1arr, ver2arr, \
  28. ver1len, ver2len, \
  29. ver1int, ver2int, len, i, p) { \
  30. \
  31. ver1len = split(ver1, ver1arr, /\./); \
  32. ver2len = split(ver2, ver2arr, /\./); \
  33. \
  34. len = ver1len > ver2len ? ver1len : ver2len; \
  35. \
  36. for (i = 1; i <= len; i++) { \
  37. p = 1000 ^ (len - i); \
  38. ver1int += ver1arr[i] * p; \
  39. ver2int += ver2arr[i] * p; \
  40. } \
  41. \
  42. if (ver1int < ver2int) \
  43. return 2; \
  44. else if (ver1int > ver2int) \
  45. return 1; \
  46. else \
  47. return 0; \
  48. }' $1 $2`]
  49. if test $xmms_got_version -eq 2; then # failure
  50. ifelse([$4], , :, $4)
  51. else # success!
  52. ifelse([$3], , :, $3)
  53. fi
  54. ])
  55. AC_DEFUN([AM_PATH_XMMS],
  56. [
  57. AC_ARG_WITH(xmms-prefix,[ --with-xmms-prefix=PFX Prefix where XMMS is installed (optional)],
  58. xmms_config_prefix="$withval", xmms_config_prefix="")
  59. AC_ARG_WITH(xmms-exec-prefix,[ --with-xmms-exec-prefix=PFX Exec prefix where XMMS is installed (optional)],
  60. xmms_config_exec_prefix="$withval", xmms_config_exec_prefix="")
  61. if test x$xmms_config_exec_prefix != x; then
  62. xmms_config_args="$xmms_config_args --exec-prefix=$xmms_config_exec_prefix"
  63. if test x${XMMS_CONFIG+set} != xset; then
  64. XMMS_CONFIG=$xmms_config_exec_prefix/bin/xmms-config
  65. fi
  66. fi
  67. if test x$xmms_config_prefix != x; then
  68. xmms_config_args="$xmms_config_args --prefix=$xmms_config_prefix"
  69. if test x${XMMS_CONFIG+set} != xset; then
  70. XMMS_CONFIG=$xmms_config_prefix/bin/xmms-config
  71. fi
  72. fi
  73. AC_PATH_PROG(XMMS_CONFIG, xmms-config, no)
  74. min_xmms_version=ifelse([$1], ,0.9.5.1, $1)
  75. if test "$XMMS_CONFIG" = "no"; then
  76. no_xmms=yes
  77. else
  78. XMMS_CFLAGS=`$XMMS_CONFIG $xmms_config_args --cflags`
  79. XMMS_LIBS=`$XMMS_CONFIG $xmms_config_args --libs`
  80. XMMS_VERSION=`$XMMS_CONFIG $xmms_config_args --version`
  81. XMMS_DATA_DIR=`$XMMS_CONFIG $xmms_config_args --data-dir`
  82. XMMS_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --plugin-dir`
  83. XMMS_VISUALIZATION_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args \
  84. --visualization-plugin-dir`
  85. XMMS_INPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --input-plugin-dir`
  86. XMMS_OUTPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --output-plugin-dir`
  87. XMMS_EFFECT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --effect-plugin-dir`
  88. XMMS_GENERAL_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --general-plugin-dir`
  89. XMMS_TEST_VERSION($XMMS_VERSION, $min_xmms_version, ,no_xmms=version)
  90. fi
  91. AC_MSG_CHECKING(for XMMS - version >= $min_xmms_version)
  92. if test "x$no_xmms" = x; then
  93. AC_MSG_RESULT(yes)
  94. ifelse([$2], , :, [$2])
  95. else
  96. AC_MSG_RESULT(no)
  97. if test "$XMMS_CONFIG" = "no" ; then
  98. echo "*** The xmms-config script installed by XMMS could not be found."
  99. echo "*** If XMMS was installed in PREFIX, make sure PREFIX/bin is in"
  100. echo "*** your path, or set the XMMS_CONFIG environment variable to the"
  101. echo "*** full path to xmms-config."
  102. else
  103. if test "$no_xmms" = "version"; then
  104. echo "*** An old version of XMMS, $XMMS_VERSION, was found."
  105. echo "*** You need a version of XMMS newer than $min_xmms_version."
  106. echo "*** The latest version of XMMS is always available from"
  107. echo "*** http://www.xmms.org/"
  108. echo "***"
  109. echo "*** If you have already installed a sufficiently new version, this error"
  110. echo "*** probably means that the wrong copy of the xmms-config shell script is"
  111. echo "*** being found. The easiest way to fix this is to remove the old version"
  112. echo "*** of XMMS, but you can also set the XMMS_CONFIG environment to point to the"
  113. echo "*** correct copy of xmms-config. (In this case, you will have to"
  114. echo "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf"
  115. echo "*** so that the correct libraries are found at run-time)"
  116. fi
  117. fi
  118. XMMS_CFLAGS=""
  119. XMMS_LIBS=""
  120. ifelse([$3], , :, [$3])
  121. fi
  122. AC_SUBST(XMMS_CFLAGS)
  123. AC_SUBST(XMMS_LIBS)
  124. AC_SUBST(XMMS_VERSION)
  125. AC_SUBST(XMMS_DATA_DIR)
  126. AC_SUBST(XMMS_PLUGIN_DIR)
  127. AC_SUBST(XMMS_VISUALIZATION_PLUGIN_DIR)
  128. AC_SUBST(XMMS_INPUT_PLUGIN_DIR)
  129. AC_SUBST(XMMS_OUTPUT_PLUGIN_DIR)
  130. AC_SUBST(XMMS_GENERAL_PLUGIN_DIR)
  131. AC_SUBST(XMMS_EFFECT_PLUGIN_DIR)
  132. ])