🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
6.4 KiB

  1. # Configure paths for ESD
  2. # Manish Singh 98-9-30
  3. # stolen back from Frank Belew
  4. # stolen from Manish Singh
  5. # Shamelessly stolen from Owen Taylor
  6. dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  7. dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
  8. dnl
  9. AC_DEFUN([AM_PATH_ESD],
  10. [dnl
  11. dnl Get the cflags and libraries from the esd-config script
  12. dnl
  13. AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)],
  14. esd_prefix="$withval", esd_prefix="")
  15. AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
  16. esd_exec_prefix="$withval", esd_exec_prefix="")
  17. AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program],
  18. , enable_esdtest=yes)
  19. if test x$esd_exec_prefix != x ; then
  20. esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
  21. if test x${ESD_CONFIG+set} != xset ; then
  22. ESD_CONFIG=$esd_exec_prefix/bin/esd-config
  23. fi
  24. fi
  25. if test x$esd_prefix != x ; then
  26. esd_args="$esd_args --prefix=$esd_prefix"
  27. if test x${ESD_CONFIG+set} != xset ; then
  28. ESD_CONFIG=$esd_prefix/bin/esd-config
  29. fi
  30. fi
  31. AC_PATH_PROG(ESD_CONFIG, esd-config, no)
  32. min_esd_version=ifelse([$1], ,0.2.7,$1)
  33. AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
  34. no_esd=""
  35. if test "$ESD_CONFIG" = "no" ; then
  36. no_esd=yes
  37. else
  38. ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
  39. ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
  40. esd_major_version=`$ESD_CONFIG $esd_args --version | \
  41. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  42. esd_minor_version=`$ESD_CONFIG $esd_args --version | \
  43. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  44. esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
  45. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  46. if test "x$enable_esdtest" = "xyes" ; then
  47. AC_LANG_PUSH([C])
  48. ac_save_CFLAGS="$CFLAGS"
  49. ac_save_LIBS="$LIBS"
  50. CFLAGS="$CFLAGS $ESD_CFLAGS"
  51. LIBS="$LIBS $ESD_LIBS"
  52. dnl
  53. dnl Now check if the installed ESD is sufficiently new. (Also sanity
  54. dnl checks the results of esd-config to some extent
  55. dnl
  56. rm -f conf.esdtest
  57. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  58. #include <stdio.h>
  59. #include <stdlib.h>
  60. #include <esd.h>
  61. int main (void)
  62. {
  63. int major, minor, micro;
  64. FILE *fp = fopen("conf.esdtest", "w");
  65. if (fp) fclose(fp);
  66. if (sscanf("$min_esd_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
  67. printf("%s, bad version string\n", "$min_esd_version");
  68. exit(1);
  69. }
  70. if (($esd_major_version > major) ||
  71. (($esd_major_version == major) && ($esd_minor_version > minor)) ||
  72. (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
  73. {
  74. return 0;
  75. }
  76. else
  77. {
  78. printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
  79. printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
  80. printf("*** best to upgrade to the required version.\n");
  81. printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
  82. printf("*** to point to the correct copy of esd-config, and remove the file\n");
  83. printf("*** config.cache before re-running configure\n");
  84. return 1;
  85. }
  86. }
  87. ]])], [], [no_esd=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
  88. CFLAGS="$ac_save_CFLAGS"
  89. LIBS="$ac_save_LIBS"
  90. AC_LANG_POP([C])
  91. fi
  92. fi
  93. if test "x$no_esd" = x ; then
  94. AC_MSG_RESULT(yes)
  95. ifelse([$2], , :, [$2])
  96. else
  97. AC_MSG_RESULT(no)
  98. if test "$ESD_CONFIG" = "no" ; then
  99. echo "*** The esd-config script installed by ESD could not be found"
  100. echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
  101. echo "*** your path, or set the ESD_CONFIG environment variable to the"
  102. echo "*** full path to esd-config."
  103. else
  104. if test -f conf.esdtest ; then
  105. :
  106. else
  107. echo "*** Could not run ESD test program, checking why..."
  108. CFLAGS="$CFLAGS $ESD_CFLAGS"
  109. LIBS="$LIBS $ESD_LIBS"
  110. AC_LANG_PUSH([C])
  111. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  112. #include <stdio.h>
  113. #include <esd.h>
  114. ]], [[ return 0; ]])],
  115. [ echo "*** The test program compiled, but did not run. This usually means"
  116. echo "*** that the run-time linker is not finding ESD or finding the wrong"
  117. echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
  118. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  119. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  120. echo "*** is required on your system"
  121. echo "***"
  122. echo "*** If you have an old version installed, it is best to remove it, although"
  123. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  124. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  125. echo "*** exact error that occured. This usually means ESD was incorrectly installed"
  126. echo "*** or that you have moved ESD since it was installed. In the latter case, you"
  127. echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
  128. CFLAGS="$ac_save_CFLAGS"
  129. LIBS="$ac_save_LIBS"
  130. AC_LANG_POP([C])
  131. fi
  132. fi
  133. ESD_CFLAGS=""
  134. ESD_LIBS=""
  135. ifelse([$3], , :, [$3])
  136. fi
  137. AC_SUBST(ESD_CFLAGS)
  138. AC_SUBST(ESD_LIBS)
  139. rm -f conf.esdtest
  140. ])
  141. dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
  142. dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
  143. dnl
  144. AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
  145. [dnl
  146. AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
  147. ac_save_ESD_CFLAGS="$ESD_CFLAGS"
  148. ac_save_ESD_LIBS="$ESD_LIBS"
  149. AM_PATH_ESD(0.2.21,
  150. ifelse([$1], , [
  151. AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
  152. AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
  153. [Define if you have esound with support of multiple recording clients.])],
  154. [$1]),
  155. ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
  156. if test "x$ac_save_ESD_CFLAGS" != x ; then
  157. ESD_CFLAGS="$ac_save_ESD_CFLAGS"
  158. fi
  159. if test "x$ac_save_ESD_LIBS" != x ; then
  160. ESD_LIBS="$ac_save_ESD_LIBS"
  161. fi
  162. )
  163. ])