mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-06 12:10:28 +02:00
Improve stack direction test
* configure.in: Update stack direction test to be like that in Autoconf _AC_LIBOBJ_ALLOCA and Gnulib; specifically in involving a function calling itself.
This commit is contained in:
parent
4ff3575c77
commit
9143131b27
2 changed files with 36 additions and 6 deletions
1
NEWS
1
NEWS
|
@ -20,6 +20,7 @@ application code.
|
||||||
|
|
||||||
** `guile-config link' now prints `-L$libdir' before `-lguile'
|
** `guile-config link' now prints `-L$libdir' before `-lguile'
|
||||||
** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro)
|
** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro)
|
||||||
|
** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction)
|
||||||
|
|
||||||
|
|
||||||
Changes in 1.8.5 (since 1.8.4)
|
Changes in 1.8.5 (since 1.8.4)
|
||||||
|
|
41
configure.in
41
configure.in
|
@ -1118,15 +1118,44 @@ GUILE_STRUCT_UTIMBUF
|
||||||
#
|
#
|
||||||
# Which way does the stack grow?
|
# Which way does the stack grow?
|
||||||
#
|
#
|
||||||
|
# Following code comes from Autoconf 2.61'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.
|
||||||
|
#
|
||||||
|
# An important detail is that the code involves find_stack_direction
|
||||||
|
# calling _itself_ - which means that find_stack_direction (or at
|
||||||
|
# least the second find_stack_direction() call) cannot be inlined.
|
||||||
|
# If the code could be inlined, that might cause the test to give
|
||||||
|
# an incorrect answer.
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
SCM_I_GSC_STACK_GROWS_UP=0
|
SCM_I_GSC_STACK_GROWS_UP=0
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[aux (l) unsigned long l;
|
AC_CACHE_CHECK([stack direction],
|
||||||
{ int x; exit (l >= ((unsigned long)&x)); }
|
[SCM_I_GSC_STACK_GROWS_UP],
|
||||||
main () { int q; aux((unsigned long)&q); }]])],
|
[AC_RUN_IFELSE([AC_LANG_SOURCE(
|
||||||
[SCM_I_GSC_STACK_GROWS_UP=1],
|
[AC_INCLUDES_DEFAULT
|
||||||
[],
|
int
|
||||||
[AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h)])
|
find_stack_direction ()
|
||||||
|
{
|
||||||
|
static char *addr = 0;
|
||||||
|
auto char dummy;
|
||||||
|
if (addr == 0)
|
||||||
|
{
|
||||||
|
addr = &dummy;
|
||||||
|
return find_stack_direction ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (&dummy > addr) ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return find_stack_direction () < 0;
|
||||||
|
}])],
|
||||||
|
[SCM_I_GSC_STACK_GROWS_UP=1],
|
||||||
|
[],
|
||||||
|
[AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h)])])
|
||||||
|
|
||||||
AC_CHECK_SIZEOF(float)
|
AC_CHECK_SIZEOF(float)
|
||||||
if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
|
if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue