~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to config/ac-macros/alloca.m4

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
18
 AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
 
19
 [AC_TRY_LINK([
 
20
 #ifdef __GNUC__
 
21
 # define alloca __builtin_alloca
 
22
 #else
 
23
 # if HAVE_ALLOCA_H
 
24
 #  include <alloca.h>
 
25
 # else
 
26
 #  ifdef _AIX
 
27
  #pragma alloca
 
28
 #  else
 
29
 #   ifndef alloca /* predefined by HP cc +Olibcalls */
 
30
 char *alloca ();
 
31
 #   endif
 
32
 #  endif
 
33
 # endif
 
34
 #endif
 
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])
 
39
 fi
 
40
 
 
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.
 
46
   ALLOCA=alloca.o
 
47
   AC_DEFINE(C_ALLOCA, 1)
 
48
 
 
49
 AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
 
50
 [AC_EGREP_CPP(webecray,
 
51
 [#if defined(CRAY) && ! defined(CRAY2)
 
52
 webecray
 
53
 #else
 
54
 wenotbecray
 
55
 #endif
 
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)
 
60
   break])
 
61
 done
 
62
 fi
 
63
 fi
 
64
 AC_SUBST(ALLOCA)dnl
 
65
else
 
66
 AC_MSG_RESULT("Skipped alloca tests")
 
67
fi
 
68
])