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
23
configure.ac
23
configure.ac
|
@ -1211,7 +1211,7 @@ GUILE_UNISTRING_ICONVEH_VALUES
|
||||||
#
|
#
|
||||||
# Which way does the stack grow?
|
# 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
|
# macro (/usr/share/autoconf/autoconf/functions.m4). Gnulib has
|
||||||
# very similar code, so in future we could look at using that.
|
# 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_RUN_IFELSE([AC_LANG_SOURCE(
|
||||||
[AC_INCLUDES_DEFAULT
|
[AC_INCLUDES_DEFAULT
|
||||||
int
|
int
|
||||||
find_stack_direction ()
|
find_stack_direction (int *addr, int depth)
|
||||||
{
|
{
|
||||||
static char *addr = 0;
|
int dir, dummy = 0;
|
||||||
auto char dummy;
|
if (! addr)
|
||||||
if (addr == 0)
|
addr = &dummy;
|
||||||
{
|
*addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
|
||||||
addr = &dummy;
|
dir = depth ? find_stack_direction (addr, depth - 1) : 0;
|
||||||
return find_stack_direction ();
|
return dir + dummy;
|
||||||
}
|
|
||||||
else
|
|
||||||
return (&dummy > addr) ? 1 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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],
|
[SCM_I_GSC_STACK_GROWS_UP=1],
|
||||||
[],
|
[],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue