mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
update stack growth direction check
* configure.ac: Pull stack growth direction check from upstream autoconf. See http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00035.html for a discussion.
This commit is contained in:
parent
134fe52a85
commit
236f901b0e
1 changed files with 10 additions and 13 deletions
21
configure.ac
21
configure.ac
|
@ -1211,7 +1211,7 @@ GUILE_UNISTRING_ICONVEH_VALUES
|
|||
#
|
||||
# Which way does the stack grow?
|
||||
#
|
||||
# Following code comes from Autoconf 2.61's internal _AC_LIBOBJ_ALLOCA
|
||||
# Following code comes from Autoconf 2.69's internal _AC_LIBOBJ_ALLOCA
|
||||
# macro (/usr/share/autoconf/autoconf/functions.m4). Gnulib has
|
||||
# very similar code, so in future we could look at using that.
|
||||
#
|
||||
|
@ -1226,23 +1226,20 @@ SCM_I_GSC_STACK_GROWS_UP=0
|
|||
AC_RUN_IFELSE([AC_LANG_SOURCE(
|
||||
[AC_INCLUDES_DEFAULT
|
||||
int
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = 0;
|
||||
auto char dummy;
|
||||
if (addr == 0)
|
||||
find_stack_direction (int *addr, int depth)
|
||||
{
|
||||
int dir, dummy = 0;
|
||||
if (! addr)
|
||||
addr = &dummy;
|
||||
return find_stack_direction ();
|
||||
}
|
||||
else
|
||||
return (&dummy > addr) ? 1 : -1;
|
||||
*addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
|
||||
dir = depth ? find_stack_direction (addr, depth - 1) : 0;
|
||||
return dir + dummy;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
return find_stack_direction () < 0;
|
||||
return find_stack_direction (0, argc + !argv + 20) < 0;
|
||||
}])],
|
||||
[SCM_I_GSC_STACK_GROWS_UP=1],
|
||||
[],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue