1
AC_DEFUN([DRIZZLE_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)
52
AC_MSG_RESULT("Skipped alloca tests")