summaryrefslogtreecommitdiff
path: root/lib/autoconf/functions.m4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/autoconf/functions.m4')
-rw-r--r--lib/autoconf/functions.m415
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 31568872..cbc34135 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -325,17 +325,20 @@ AC_CACHE_CHECK([stack direction for C alloca],
[AC_RUN_IFELSE([AC_LANG_SOURCE(
[AC_INCLUDES_DEFAULT
int
-find_stack_direction (char *addr)
+find_stack_direction (int *addr, int depth)
{
- char dummy;
- return (! addr ? find_stack_direction (&dummy)
- : addr < &dummy ? 1 : -1);
+ int dir, dummy = 0;
+ if (! addr)
+ addr = &dummy;
+ *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+ dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+ return dir + dummy;
}
int
-main (void)
+main (int argc, char **argv)
{
- return find_stack_direction (0) < 0;
+ return find_stack_direction (0, argc + !argv + 20) < 0;
}])],
[ac_cv_c_stack_direction=1],
[ac_cv_c_stack_direction=-1],