1
AC_DEFUN([MYSQL_FUNC_ALLOCA],
3
# Since we have heard that alloca fails on IRIX never define it on a
5
if test ! "$host_vendor" = "sgi"
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"
15
AC_DEFINE(HAVE_ALLOCA, 1)
18
AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
21
# define alloca __builtin_alloca
29
# ifndef alloca /* predefined by HP cc +Olibcalls */
35
], [char *p = (char *) alloca(1);],
36
ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
37
if test "$ac_cv_func_alloca_works" = "yes"; then
38
AC_DEFINE([HAVE_ALLOCA], [1], [If we have a working alloca() implementation])
41
if test "$ac_cv_func_alloca_works" = "no"; then
42
# The SVR3 libPW and SVR4 libucb both contain incompatible functions
43
# that cause trouble. Some versions do not even contain alloca or
44
# contain a buggy version. If you still want to use their alloca,
45
# use ar to extract alloca.o from them instead of compiling alloca.c.
47
AC_DEFINE(C_ALLOCA, 1)
49
AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
50
[AC_EGREP_CPP(webecray,
51
[#if defined(CRAY) && ! defined(CRAY2)
56
], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
57
if test "$ac_cv_os_cray" = "yes"; then
58
for ac_func in _getb67 GETB67 getb67; do
59
AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func)
66
AC_MSG_RESULT("Skipped alloca tests")