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.

68 lines
2.0 KiB

  1. AC_DEFUN([MYSQL_FUNC_ALLOCA],
  2. [
  3. # Since we have heard that alloca fails on IRIX never define it on a
  4. # SGI machine
  5. if test ! "$host_vendor" = "sgi"
  6. then
  7. AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
  8. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  9. # for constant arguments. Useless!
  10. AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h,
  11. [AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
  12. ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])
  13. if test "$ac_cv_header_alloca_h" = "yes"
  14. then
  15. AC_DEFINE(HAVE_ALLOCA, 1)
  16. fi
  17. AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
  18. [AC_TRY_LINK([
  19. #ifdef __GNUC__
  20. # define alloca __builtin_alloca
  21. #else
  22. # if HAVE_ALLOCA_H
  23. # include <alloca.h>
  24. # else
  25. # ifdef _AIX
  26. #pragma alloca
  27. # else
  28. # ifndef alloca /* predefined by HP cc +Olibcalls */
  29. char *alloca ();
  30. # endif
  31. # endif
  32. # endif
  33. #endif
  34. ], [char *p = (char *) alloca(1);],
  35. ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
  36. if test "$ac_cv_func_alloca_works" = "yes"; then
  37. AC_DEFINE([HAVE_ALLOCA], [1], [If we have a working alloca() implementation])
  38. fi
  39. if test "$ac_cv_func_alloca_works" = "no"; then
  40. # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  41. # that cause trouble. Some versions do not even contain alloca or
  42. # contain a buggy version. If you still want to use their alloca,
  43. # use ar to extract alloca.o from them instead of compiling alloca.c.
  44. ALLOCA=alloca.o
  45. AC_DEFINE(C_ALLOCA, 1)
  46. AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
  47. [AC_EGREP_CPP(webecray,
  48. [#if defined(CRAY) && ! defined(CRAY2)
  49. webecray
  50. #else
  51. wenotbecray
  52. #endif
  53. ], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
  54. if test "$ac_cv_os_cray" = "yes"; then
  55. for ac_func in _getb67 GETB67 getb67; do
  56. AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func)
  57. break])
  58. done
  59. fi
  60. fi
  61. AC_SUBST(ALLOCA)dnl
  62. else
  63. AC_MSG_RESULT("Skipped alloca tests")
  64. fi
  65. ])