🛠️🐜 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.

173 lines
6.5 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. dnl echo "*** The esd-config script installed by ESD could not be found"
  100. dnl echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
  101. dnl echo "*** your path, or set the ESD_CONFIG environment variable to the"
  102. dnl echo "*** full path to esd-config."
  103. :
  104. else
  105. if test -f conf.esdtest ; then
  106. :
  107. else
  108. echo "*** Could not run ESD test program, checking why..."
  109. CFLAGS="$CFLAGS $ESD_CFLAGS"
  110. LIBS="$LIBS $ESD_LIBS"
  111. AC_LANG_PUSH([C])
  112. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  113. #include <stdio.h>
  114. #include <esd.h>
  115. ]], [[ return 0; ]])],
  116. [ echo "*** The test program compiled, but did not run. This usually means"
  117. echo "*** that the run-time linker is not finding ESD or finding the wrong"
  118. echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
  119. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  120. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  121. echo "*** is required on your system"
  122. echo "***"
  123. echo "*** If you have an old version installed, it is best to remove it, although"
  124. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
  125. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  126. echo "*** exact error that occured. This usually means ESD was incorrectly installed"
  127. echo "*** or that you have moved ESD since it was installed. In the latter case, you"
  128. echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
  129. CFLAGS="$ac_save_CFLAGS"
  130. LIBS="$ac_save_LIBS"
  131. AC_LANG_POP([C])
  132. fi
  133. fi
  134. ESD_CFLAGS=""
  135. ESD_LIBS=""
  136. ifelse([$3], , :, [$3])
  137. fi
  138. AC_SUBST(ESD_CFLAGS)
  139. AC_SUBST(ESD_LIBS)
  140. rm -f conf.esdtest
  141. ])
  142. dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
  143. dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
  144. dnl
  145. AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
  146. [dnl
  147. AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
  148. ac_save_ESD_CFLAGS="$ESD_CFLAGS"
  149. ac_save_ESD_LIBS="$ESD_LIBS"
  150. AM_PATH_ESD(0.2.21,
  151. ifelse([$1], , [
  152. AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
  153. AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
  154. [Define if you have esound with support of multiple recording clients.])],
  155. [$1]),
  156. ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
  157. if test "x$ac_save_ESD_CFLAGS" != x ; then
  158. ESD_CFLAGS="$ac_save_ESD_CFLAGS"
  159. fi
  160. if test "x$ac_save_ESD_LIBS" != x ; then
  161. ESD_LIBS="$ac_save_ESD_LIBS"
  162. fi
  163. )
  164. ])