~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/stack.m4

  • Committer: Monty Taylor
  • Date: 2009-12-25 08:50:15 UTC
  • mto: This revision was merged to the branch mainline in revision 1255.
  • Revision ID: mordred@inaugust.com-20091225085015-83sux5qsvy312gew
MEM_ROOT == memory::Root

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Brian Aker
2
 
#
3
 
# This file is free software
4
 
# gives unlimited permission to copy and/or distribute it,
5
 
# with or without modifications, as long as this notice is preserved.
6
 
 
7
 
AC_DEFUN([DRIZZLE_STACK_DIRECTION],[
8
 
  AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
9
 
    [AC_RUN_IFELSE(
10
 
       [AC_LANG_PROGRAM(
11
 
          [[
12
 
            #include <stdlib.h>
13
 
 
14
 
 /* Prevent compiler optimization by HP's compiler, see bug#42213 */
15
 
 #if defined(__HP_cc) || defined (__HP_aCC) || defined (__hpux)
16
 
 #pragma noinline
17
 
 #endif
18
 
 
19
 
 int find_stack_direction ()
20
 
 {
21
 
   static char *addr = 0;
22
 
   auto char dummy;
23
 
   if (addr == 0)
24
 
     {
25
 
       addr = &dummy;
26
 
       return find_stack_direction ();
27
 
     }
28
 
   else
29
 
     return (&dummy > addr) ? 1 : -1;
30
 
 }
31
 
          ]],
32
 
          [[
33
 
   exit (find_stack_direction() < 0);
34
 
          ]]
35
 
       )],
36
 
       [ac_cv_c_stack_direction=1],
37
 
       [ac_cv_c_stack_direction=-1],
38
 
       [ac_cv_c_stack_direction=]
39
 
    )]
40
 
  )
41
 
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
42
 
])