7fc6c88
--- acconfig.h.orig	2009-02-23 12:39:42.000000000 -0700
7fc6c88
+++ acconfig.h	2010-12-30 10:24:39.000000000 -0700
7fc6c88
@@ -53,11 +53,10 @@ SGC is enabled.  */
e6a2505
 #undef HAVE_ALLOCA 
e6a2505
 #endif
e6a2505
 
e6a2505
-
e6a2505
 /* define if need alloca.h */
e6a2505
-#undef NEED_ALLOCA_H
e6a2505
+#undef HAVE_ALLOCA_H
e6a2505
 
e6a2505
-#ifdef NEED_ALLOCA_H
e6a2505
+#ifdef HAVE_ALLOCA_H
e6a2505
 #include <alloca.h>
e6a2505
 #endif
e6a2505
 
7fc6c88
--- configure.in.orig	2010-12-29 13:49:09.000000000 -0700
7fc6c88
+++ configure.in	2010-12-30 10:25:19.000000000 -0700
7fc6c88
@@ -1874,33 +1874,7 @@ AC_SUBST(NOTIFY)
7fc6c88
 
7fc6c88
 # alloca
7fc6c88
 
7fc6c88
-AC_MSG_CHECKING([for alloca])
7fc6c88
-AC_RUN_IFELSE([AC_LANG_PROGRAM([],[[exit(alloca(500) != NULL ? 0 : 1);]])]
7fc6c88
-  ,gcl_ok=yes, gcl_ok=no,gcl_ok=no)
7fc6c88
-if test $gcl_ok = yes ; then
7fc6c88
-    AC_MSG_RESULT(yes)
7fc6c88
-    AC_DEFINE(HAVE_ALLOCA)
7fc6c88
-else
7fc6c88
-  AC_RUN_IFELSE([AC_LANG_PROGRAM([[
7fc6c88
-  #include <alloca.h>
7fc6c88
-  ]],[[exit(alloca(500) != NULL ? 0 : 1);]])]
7fc6c88
-  ,gcl_ok=yes, gcl_ok=no,gcl_ok=no)
7fc6c88
- if test $gcl_ok = yes ; then
7fc6c88
-    AC_MSG_RESULT(yes)
7fc6c88
-    AC_DEFINE(HAVE_ALLOCA)
7fc6c88
-    AC_DEFINE(NEED_ALLOCA_H)
7fc6c88
- fi
7fc6c88
-fi
7fc6c88
-if test $gcl_ok = no ; then     AC_MSG_RESULT(no) ; fi
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
-
7fc6c88
+AC_FUNC_ALLOCA
7fc6c88
 
7fc6c88
 # dlopen etc
7fc6c88
 # idea make it so you do something dlopen(libX.so,RTLD_GLOBAL)
7fc6c88
--- configure.orig	2010-12-29 13:49:15.000000000 -0700
7fc6c88
+++ configure	2010-12-30 10:52:29.000000000 -0700
7fc6c88
@@ -609,6 +609,7 @@ O3FLAGS
e6a2505
 NIFLAGS
e6a2505
 FINAL_CFLAGS
e6a2505
 BROKEN_O4_OPT
e6a2505
+ALLOCA
e6a2505
 NOTIFY
e6a2505
 TCL_LIBS
e6a2505
 TCL_DL_LIBS
7fc6c88
@@ -2046,6 +2047,60 @@ $as_echo "$ac_res" >&6; }
7fc6c88
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
7fc6c88
 
7fc6c88
 } # ac_fn_c_check_func
7fc6c88
+
7fc6c88
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
7fc6c88
+# -------------------------------------------
7fc6c88
+# Tests whether TYPE exists after having included INCLUDES, setting cache
7fc6c88
+# variable VAR accordingly.
7fc6c88
+ac_fn_c_check_type ()
7fc6c88
+{
7fc6c88
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
7fc6c88
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
7fc6c88
+$as_echo_n "checking for $2... " >&6; }
7fc6c88
+if eval \${$3+:} false; then :
7fc6c88
+  $as_echo_n "(cached) " >&6
7fc6c88
+else
7fc6c88
+  eval "$3=no"
7fc6c88
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7fc6c88
+/* end confdefs.h.  */
7fc6c88
+$4
7fc6c88
+int
7fc6c88
+main ()
7fc6c88
+{
7fc6c88
+if (sizeof ($2))
7fc6c88
+	 return 0;
7fc6c88
+  ;
7fc6c88
+  return 0;
7fc6c88
+}
7fc6c88
+_ACEOF
7fc6c88
+if ac_fn_c_try_compile "$LINENO"; then :
7fc6c88
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7fc6c88
+/* end confdefs.h.  */
7fc6c88
+$4
7fc6c88
+int
7fc6c88
+main ()
7fc6c88
+{
7fc6c88
+if (sizeof (($2)))
7fc6c88
+	    return 0;
7fc6c88
+  ;
7fc6c88
+  return 0;
7fc6c88
+}
7fc6c88
+_ACEOF
7fc6c88
+if ac_fn_c_try_compile "$LINENO"; then :
7fc6c88
+
7fc6c88
+else
7fc6c88
+  eval "$3=yes"
7fc6c88
+fi
7fc6c88
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7fc6c88
+fi
7fc6c88
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7fc6c88
+fi
7fc6c88
+eval ac_res=\$$3
7fc6c88
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
7fc6c88
+$as_echo "$ac_res" >&6; }
7fc6c88
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
7fc6c88
+
7fc6c88
+} # ac_fn_c_check_type
7fc6c88
 cat >config.log <<_ACEOF
7fc6c88
 This file contains any messages produced by compilers while
7fc6c88
 running configure, to aid debugging if configure makes a mistake.
7fc6c88
@@ -7776,83 +7831,205 @@ NOTIFY=$enable_notify
e6a2505
 
e6a2505
 # alloca
e6a2505
 
7fc6c88
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
e6a2505
-$as_echo_n "checking for alloca... " >&6; }
7fc6c88
-if test "$cross_compiling" = yes; then :
e6a2505
-  gcl_ok=no
7fc6c88
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
7fc6c88
+if test "x$ac_cv_type_size_t" = xyes; then :
7fc6c88
+
7fc6c88
+else
7fc6c88
+
7fc6c88
+cat >>confdefs.h <<_ACEOF
7fc6c88
+#define size_t unsigned int
7fc6c88
+_ACEOF
7fc6c88
+
7fc6c88
+fi
7fc6c88
+
e6a2505
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
e6a2505
+# for constant arguments.  Useless!
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
e6a2505
+$as_echo_n "checking for working alloca.h... " >&6; }
7fc6c88
+if ${ac_cv_working_alloca_h+:} false; then :
e6a2505
+  $as_echo_n "(cached) " >&6
e6a2505
 else
7fc6c88
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
e6a2505
 /* end confdefs.h.  */
e6a2505
-
e6a2505
+#include <alloca.h>
e6a2505
 int
e6a2505
 main ()
e6a2505
 {
e6a2505
-exit(alloca(500) != NULL ? 0 : 1);
e6a2505
+char *p = (char *) alloca (2 * sizeof (int));
e6a2505
+			  if (p) return 0;
e6a2505
   ;
e6a2505
   return 0;
e6a2505
 }
7fc6c88
-
e6a2505
 _ACEOF
7fc6c88
-if ac_fn_c_try_run "$LINENO"; then :
7fc6c88
-  gcl_ok=yes
7fc6c88
+if ac_fn_c_try_link "$LINENO"; then :
e6a2505
+  ac_cv_working_alloca_h=yes
7fc6c88
 else
7fc6c88
-  gcl_ok=no
7fc6c88
+  ac_cv_working_alloca_h=no
7fc6c88
 fi
7fc6c88
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
7fc6c88
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
7fc6c88
+rm -f core conftest.err conftest.$ac_objext \
7fc6c88
+    conftest$ac_exeext conftest.$ac_ext
7fc6c88
 fi
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
e6a2505
+$as_echo "$ac_cv_working_alloca_h" >&6; }
e6a2505
+if test $ac_cv_working_alloca_h = yes; then
7fc6c88
 
7fc6c88
-if test $gcl_ok = yes ; then
7fc6c88
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
7fc6c88
-$as_echo "yes" >&6; }
7fc6c88
-    $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
7fc6c88
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
7fc6c88
 
7fc6c88
-else
7fc6c88
-  if test "$cross_compiling" = yes; then :
7fc6c88
-  gcl_ok=no
e6a2505
+fi
e6a2505
+
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
e6a2505
+$as_echo_n "checking for alloca... " >&6; }
7fc6c88
+if ${ac_cv_func_alloca_works+:} false; then :
e6a2505
+  $as_echo_n "(cached) " >&6
7fc6c88
 else
7fc6c88
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7fc6c88
 /* end confdefs.h.  */
7fc6c88
-
7fc6c88
-  #include <alloca.h>
e6a2505
+#ifdef __GNUC__
e6a2505
+# define alloca __builtin_alloca
e6a2505
+#else
e6a2505
+# ifdef _MSC_VER
e6a2505
+#  include <malloc.h>
e6a2505
+#  define alloca _alloca
e6a2505
+# else
e6a2505
+#  ifdef HAVE_ALLOCA_H
e6a2505
+#   include <alloca.h>
e6a2505
+#  else
e6a2505
+#   ifdef _AIX
e6a2505
+ #pragma alloca
e6a2505
+#   else
e6a2505
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
7fc6c88
+void *alloca (size_t);
e6a2505
+#    endif
e6a2505
+#   endif
e6a2505
+#  endif
e6a2505
+# endif
e6a2505
+#endif
7fc6c88
 
7fc6c88
 int
7fc6c88
 main ()
7fc6c88
 {
7fc6c88
-exit(alloca(500) != NULL ? 0 : 1);
e6a2505
+char *p = (char *) alloca (1);
e6a2505
+				    if (p) return 0;
7fc6c88
   ;
7fc6c88
   return 0;
7fc6c88
 }
7fc6c88
-
7fc6c88
 _ACEOF
7fc6c88
-if ac_fn_c_try_run "$LINENO"; then :
7fc6c88
-  gcl_ok=yes
7fc6c88
+if ac_fn_c_try_link "$LINENO"; then :
e6a2505
+  ac_cv_func_alloca_works=yes
e6a2505
 else
7fc6c88
-  gcl_ok=no
7fc6c88
+  ac_cv_func_alloca_works=no
e6a2505
 fi
7fc6c88
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
7fc6c88
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
7fc6c88
+rm -f core conftest.err conftest.$ac_objext \
7fc6c88
+    conftest$ac_exeext conftest.$ac_ext
e6a2505
 fi
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
e6a2505
+$as_echo "$ac_cv_func_alloca_works" >&6; }
e6a2505
 
7fc6c88
- if test $gcl_ok = yes ; then
7fc6c88
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
7fc6c88
-$as_echo "yes" >&6; }
7fc6c88
-    $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
e6a2505
+if test $ac_cv_func_alloca_works = yes; then
e6a2505
 
7fc6c88
-    $as_echo "#define NEED_ALLOCA_H 1" >>confdefs.h
7fc6c88
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
e6a2505
 
7fc6c88
- fi
7fc6c88
+else
e6a2505
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
e6a2505
+# that cause trouble.  Some versions do not even contain alloca or
e6a2505
+# contain a buggy version.  If you still want to use their alloca,
e6a2505
+# use ar to extract alloca.o from them instead of compiling alloca.c.
e6a2505
+
e6a2505
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
e6a2505
+
7fc6c88
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
e6a2505
+
e6a2505
+
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
e6a2505
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
7fc6c88
+if ${ac_cv_os_cray+:} false; then :
e6a2505
+  $as_echo_n "(cached) " >&6
7fc6c88
+else
7fc6c88
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7fc6c88
+/* end confdefs.h.  */
e6a2505
+#if defined CRAY && ! defined CRAY2
e6a2505
+webecray
e6a2505
+#else
e6a2505
+wenotbecray
e6a2505
+#endif
7fc6c88
+
e6a2505
+_ACEOF
e6a2505
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
7fc6c88
+  $EGREP "webecray" >/dev/null 2>&1; then :
e6a2505
+  ac_cv_os_cray=yes
e6a2505
+else
e6a2505
+  ac_cv_os_cray=no
7fc6c88
 fi
7fc6c88
-if test $gcl_ok = no ; then     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
7fc6c88
-$as_echo "no" >&6; } ; fi
e6a2505
+rm -f conftest*
7fc6c88
 
e6a2505
+fi
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
e6a2505
+$as_echo "$ac_cv_os_cray" >&6; }
e6a2505
+if test $ac_cv_os_cray = yes; then
e6a2505
+  for ac_func in _getb67 GETB67 getb67; do
e6a2505
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
7fc6c88
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
7fc6c88
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
e6a2505
 
e6a2505
+cat >>confdefs.h <<_ACEOF
e6a2505
+#define CRAY_STACKSEG_END $ac_func
e6a2505
+_ACEOF
7fc6c88
 
e6a2505
+    break
e6a2505
+fi
7fc6c88
 
e6a2505
+  done
e6a2505
+fi
e6a2505
+
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
e6a2505
+$as_echo_n "checking stack direction for C alloca... " >&6; }
7fc6c88
+if ${ac_cv_c_stack_direction+:} false; then :
e6a2505
+  $as_echo_n "(cached) " >&6
e6a2505
+else
7fc6c88
+  if test "$cross_compiling" = yes; then :
e6a2505
+  ac_cv_c_stack_direction=0
e6a2505
+else
7fc6c88
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
e6a2505
+/* end confdefs.h.  */
e6a2505
+$ac_includes_default
e6a2505
+int
e6a2505
+find_stack_direction ()
e6a2505
+{
e6a2505
+  static char *addr = 0;
e6a2505
+  auto char dummy;
e6a2505
+  if (addr == 0)
e6a2505
+    {
e6a2505
+      addr = &dummy;
e6a2505
+      return find_stack_direction ();
e6a2505
+    }
e6a2505
+  else
e6a2505
+    return (&dummy > addr) ? 1 : -1;
e6a2505
+}
7fc6c88
 
e6a2505
+int
e6a2505
+main ()
e6a2505
+{
e6a2505
+  return find_stack_direction () < 0;
e6a2505
+}
e6a2505
+_ACEOF
7fc6c88
+if ac_fn_c_try_run "$LINENO"; then :
e6a2505
+  ac_cv_c_stack_direction=1
7fc6c88
+else
7fc6c88
+  ac_cv_c_stack_direction=-1
7fc6c88
+fi
7fc6c88
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
7fc6c88
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
7fc6c88
+fi
e6a2505
 
7fc6c88
+fi
7fc6c88
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
e6a2505
+$as_echo "$ac_cv_c_stack_direction" >&6; }
e6a2505
+cat >>confdefs.h <<_ACEOF
e6a2505
+#define STACK_DIRECTION $ac_cv_c_stack_direction
e6a2505
+_ACEOF
e6a2505
 
e6a2505
 
e6a2505
+fi
e6a2505
 
e6a2505
 
e6a2505
 # dlopen etc
7fc6c88
--- h/gclincl.h.in.orig	2010-08-04 15:44:24.000000000 -0600
7fc6c88
+++ h/gclincl.h.in	2010-12-30 10:52:29.000000000 -0700
7fc6c88
@@ -54,11 +54,10 @@ SGC is enabled.  */
e6a2505
 #undef HAVE_ALLOCA 
e6a2505
 #endif
e6a2505
 
e6a2505
-
e6a2505
 /* define if need alloca.h */
e6a2505
-#undef NEED_ALLOCA_H
e6a2505
+#undef HAVE_ALLOCA_H
e6a2505
 
e6a2505
-#ifdef NEED_ALLOCA_H
e6a2505
+#ifdef HAVE_ALLOCA_H
e6a2505
 #include <alloca.h>
e6a2505
 #endif
e6a2505
 
7fc6c88
@@ -260,6 +259,21 @@ SGC is enabled.  */
e6a2505
 #undef HAVE_OBJC_MALLOC_H
4b8f337
 #undef HAVE_OUTPUT_BFD
e6a2505
 
e6a2505
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
e6a2505
+   systems. This function is required for `alloca.c' support on those systems.
e6a2505
+   */
e6a2505
+#undef CRAY_STACKSEG_END
e6a2505
+
e6a2505
+/* Define to 1 if using `alloca.c'. */
e6a2505
+#undef C_ALLOCA
e6a2505
+
e6a2505
+/* Define to 1 if you have `alloca', as a function or macro. */
e6a2505
+#undef HAVE_ALLOCA
e6a2505
+
e6a2505
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
e6a2505
+   */
e6a2505
+#undef HAVE_ALLOCA_H
e6a2505
+
e6a2505
 /* Define to 1 if you have the <asm/sigcontext.h> header file. */
e6a2505
 #undef HAVE_ASM_SIGCONTEXT_H
e6a2505
 
7fc6c88
@@ -365,8 +379,19 @@ SGC is enabled.  */
e6a2505
 /* The size of `long', as computed by sizeof. */
e6a2505
 #undef SIZEOF_LONG
e6a2505
 
e6a2505
+/* If using the C implementation of alloca, define if you know the
e6a2505
+   direction of stack growth for your system; otherwise it will be
e6a2505
+   automatically deduced at runtime.
e6a2505
+	STACK_DIRECTION > 0 => grows toward higher addresses
e6a2505
+	STACK_DIRECTION < 0 => grows toward lower addresses
e6a2505
+	STACK_DIRECTION = 0 => direction of growth unknown */
e6a2505
+#undef STACK_DIRECTION
e6a2505
+
7fc6c88
 /* staticly linked images */
7fc6c88
 #undef STATIC_LINKING
7fc6c88
 
e6a2505
 /* Define to 1 if you have the ANSI C header files. */
e6a2505
 #undef STDC_HEADERS
7fc6c88
+
7fc6c88
+/* Define to `unsigned int' if <sys/types.h> does not define. */
7fc6c88
+#undef size_t