--- configure.in.old	Tue Feb 26 13:36:26 2002
+++ configure.in	Tue Feb 26 13:44:19 2002
@@ -384,20 +384,26 @@
 
 # getrlimit is needed for TclpCheckStackSpace
 AC_CHECK_FUNCS(getrlimit)
-
-AC_TRY_RUN([
-foo(p) 
-    char *p;
-{
-    char there;
-    return (&there > p);
-}
-int main()
-{
-    char here;
-    exit(foo(&here));
-}
-], AC_DEFINE(CSTACK_DOWN), AC_DEFINE(CSTACK_UP))
+AC_MSG_CHECKING([which way C stack grows])
+AC_CACHE_VAL(tcl_cv_stack_direction,
+    AC_TRY_RUN([
+	#include <stdlib.h>
+	foo(p) char *p; {
+	    char there;
+	    return (&there > p);
+	}
+	int main() {
+	    char here;
+	    exit(foo(&here));
+	}
+    ], tcl_cv_stack_direction=down,
+    tcl_cv_stack_direction=up,
+    tcl_cv_stack_direction="cross-compiling"))
+AC_MSG_RESULT($tcl_cv_stack_direction)
+case "$tcl_cv_stack_direction" in
+    down) AC_DEFINE(CSTACK_DOWN);;
+    up)   AC_DEFINE(CSTACK_UP);;
+esac
 
 #--------------------------------------------------------------------
 # The statements below define a collection of compile flags.  This
