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

168 lines
5.8 KiB

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