Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 22a039d7f3
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 35 lines (33 sloc) 1.256 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
AC_DEFUN([AX_STACK_GROWS_DOWNWARD],[
    AC_CACHE_CHECK(
        [stack growth direction],
        [ac_cv_c_stack_grows_downward],
        [AC_RUN_IFELSE(
     [AC_LANG_SOURCE(
                [
AC_INCLUDES_DEFAULT
                    int find_stack_direction () {
                        static char *addr = 0;
                        auto char dummy;
                        if (addr == 0) {
                            addr = &dummy;
                            return find_stack_direction ();
                        } else return (&dummy > addr) ? 0 : 1;
                    }

                    int main () {
                        return find_stack_direction () < 0;
                    }
               ]
            )],
            [ac_cv_c_stack_grows_downward=0],
            [ac_cv_c_stack_grows_downward=1],
            [AC_ERROR([Unable to determine the direction of stack growth])
        ])
])
AH_VERBATIM([STACK_GROWS_DOWNWARD],
[/* Define if you know the direction of stack growth for your system
STACK_GROWS_DOWNWARD = 0 grows toward higher addresses
STACK_GROWS_DOWNWARD = 1 grows toward lower addresses */
@%:@undef STACK_GROWS_DOWNWARD])dnl
AC_DEFINE_UNQUOTED(STACK_GROWS_DOWNWARD, $ac_cv_c_stack_grows_downward)
])
Something went wrong with that request. Please try again.