From: Paul Eggert Date: Mon, 20 Jun 2011 05:33:03 +0000 (-0700) Subject: * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Be even smarter. X-Git-Tag: v2.68b~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cd9f12520b0d6f76d3230d7565feba1ecf29497;p=thirdparty%2Fautoconf.git * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Be even smarter. GCC was too smart for the previous patch. See . --- diff --git a/ChangeLog b/ChangeLog index e0e52ce6..466b8a84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-06-19 Paul Eggert + + * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Be even smarter. + GCC was too smart for the previous patch. See + . + 2011-06-18 Paul Eggert * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Try to outsmart GCC. 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],