Branch: Tag:

2001-02-17

2001-02-17 15:49:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Detection and workaround of the ecl _chkstk => __chkstk bug.

Rev: src/acconfig.h:1.78
Rev: src/configure.in:1.488
Rev: src/port.c:1.39

1: - AC_REVISION("$Id: configure.in,v 1.487 2001/02/16 16:59:32 grubba Exp $") + AC_REVISION("$Id: configure.in,v 1.488 2001/02/17 15:49:20 grubba Exp $")   AC_INIT(interpret.c)   AC_CONFIG_HEADER(machine.h)   
1523:      #############################################################################    + AC_MSG_CHECKING(if we can allocate large auto variables) + AC_CACHE_VAL(pike_cv_C_supports_large_auto, [ +  AC_TRY_LINK([ + #include <stdio.h> +  int eat_stack(int foo) +  { +  char large_array[131072] = ""; +  int i, sum = 0; +  +  for (i = 0; i < foo; i++) { +  /* Make sure the compiler doesn't optimize away the array. */ +  large_array[i] = sum; +  sum += foo; +  } +  for (i = 0; i < foo; i++) { +  sum += large_array[i] - large_array[foo-1-i]; +  } +  return sum; +  } +  ], [ +  return !eat_stack(4711); +  ], [ +  pike_cv_C_supports_large_auto=yes +  ], [ +  pike_cv_C_supports_large_auto=no +  ]) + ]) + if test "$pike_cv_C_supports_large_auto" = "yes"; then +  AC_MSG_RESULT([yes - good]) + else +  AC_MSG_RESULT([no]) +  AC_MSG_CHECKING([if we can make a workaround by defining _chkstk to call __chkstk]) +  AC_CACHE_VAL([pike_cv_kludge__chkstk], +  [ +  AC_TRY_LINK([ + #include <stdio.h> +  int eat_stack(int foo) +  { +  char large_array[131072] = ""; +  int i, sum = 0; +  +  for (i = 0; i < foo; i++) { +  /* Make sure the compiler doesn't optimize away the array. */ +  large_array[i] = sum; +  sum += foo; +  } +  for (i = 0; i < foo; i++) { +  sum += large_array[i] - large_array[foo-1-i]; +  } +  return sum; +  } +  +  extern size_t __chkstk(); +  size_t _chkstk() { return __chkstk(); } +  +  ], [ +  return !eat_stack(4711); +  ], [ +  pike_cv_kludge__chkstk=yes +  ], [ +  pike_cv_kludge__chkstk=no +  ]) +  ]) +  if test "$pike_cv_kludge__chkstk" = "yes"; then +  AC_MSG_RESULT([yes - applying workaround]) +  AC_DEFINE(HAVE_BROKEN_CHKSTK) +  else +  AC_MSG_RESULT([no]) +  AC_ERROR([Your C compiler does not link code that uses large auto variables. +  + Please check config.log, and fix the problem.]) +  exit 1 +  fi + fi +  + ############################################################################# +    AC_MSG_CHECKING(for yacc clone that handles %pure_parser)   AC_CACHE_VAL(pike_cv_prog_working_yacc,   [