Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl27 (2.7.0-36) unstable; urgency=medium
 .
   * Version_2_7_0pre39
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2025-03-25

--- gcl27-2.7.0.orig/RELEASE-2.5.1
+++ gcl27-2.7.0/RELEASE-2.5.1
@@ -133,6 +133,6 @@ TO DO:
 	1) Full ANSI compliance
 	2) Native optimized blas support
 	3) Integrate MPI support
-	4) GCL as a suported GCC front end.
+	4) GCL as a supported GCC front end.
 	5) Performance/memory optimization
 
--- gcl27-2.7.0.orig/ansi-tests/ensure-directories-exist.lsp
+++ gcl27-2.7.0/ansi-tests/ensure-directories-exist.lsp
@@ -108,7 +108,7 @@
 
 ;;; Case where directory shouldn't exist
 
-;; The directort ansi-tests/scratch must not exist before this
+;; The directory ansi-tests/scratch must not exist before this
 ;; test is run
 (deftest ensure-directories-exist.8
   (let* ((subdir (make-pathname :directory '(:relative "scratch")
--- gcl27-2.7.0.orig/ansi-tests/iteration.lsp
+++ gcl27-2.7.0/ansi-tests/iteration.lsp
@@ -121,7 +121,7 @@
 	(%f))))
   45)
 
-;;; Confirm that the variables in succesive iterations are
+;;; Confirm that the variables in successive iterations are
 ;;; identical
 (deftest do.15
   (mapcar #'funcall
@@ -240,7 +240,7 @@
 	(%f))))
   45)
 
-;;; Confirm that the variables in succesive iterations are
+;;; Confirm that the variables in successive iterations are
 ;;; identical
 (deftest do*.15
   (mapcar #'funcall
--- gcl27-2.7.0.orig/ansi-tests/loop1.lsp
+++ gcl27-2.7.0/ansi-tests/loop1.lsp
@@ -211,7 +211,7 @@
   (loop for x from 1 to 5 do nil finally (return x))
   5)
 
-;;; Test that the index variable acheives the exclusive
+;;; Test that the index variable achieves the exclusive
 ;;; upper bound, but does not exceed it.
 (deftest loop.1.41
   (loop for x from 1 below 5 do nil finally (return x))
--- /dev/null
+++ gcl27-2.7.0/bin/gcl.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+EXT=@EXT@
+VERS=@VERS@
+
+if [ -e /etc/default/gcl$EXT ] ; then . /etc/default/gcl$EXT ; fi
+if ! set | grep -q -w GCL_ANSI ; then GCL_ANSI=$DEFAULT_GCL_ANSI ; fi
+if ! set | grep -q -w GCL_PROF ; then GCL_PROF=$DEFAULT_GCL_PROF ; fi
+
+DIR=/usr/lib/gcl-$VERS;
+
+if [ "$GCL_ANSI" = "" ] ; then
+    if [ "$GCL_PROF" = "" ] ; then
+	EXE=saved_gcl;
+    else
+	EXE=saved_gcl_gprof;
+    fi
+else
+    if [ "$GCL_PROF" = "" ] ; then
+	EXE=saved_ansi_gcl;
+    else
+	EXE=saved_ansi_gcl_gprof;
+    fi
+fi
+SYS=$DIR/unixport
+
+exec $SYS/$EXE -dir $SYS/ -libdir $DIR/ \
+   -eval '(setq si::*allow-gzipped-file* t)' \
+   -eval '(setq si::*tk-library* "/usr/lib/tk@TKVERS@")' \
+   -eval '(setq si::*default-info-files* (list "gcl@EXT@-si.info" "gcl@EXT@-tk.info" "gcl@EXT@.info"))' \
+   "$@"
--- gcl27-2.7.0.orig/cmpnew/gcl_cmpinline.lsp
+++ gcl27-2.7.0/cmpnew/gcl_cmpinline.lsp
@@ -834,7 +834,7 @@
 (defun coerce-loc (loc type)
   (let ((tmp (car (rassoc (promoted-c-type type) *box-alist*))))
     (if tmp (list 'gen-loc tmp loc)
-      (let ((tl (cdr (assoc (promoted-c-type type) +coersion-alist+))))
+      (let ((tl (cdr (assoc (promoted-c-type type) +coersion-alist+))));FIXME never reached
 	(if tl (list tl loc) loc)))))
 
 ;; (defun coerce-loc (loc type)
--- gcl27-2.7.0.orig/cmpnew/gcl_cmpopt.lsp
+++ gcl27-2.7.0/cmpnew/gcl_cmpopt.lsp
@@ -931,10 +931,10 @@
  (push '((t) boolean #.(flags rfa) "(compiled_functionp(#0))")
    (get 'compiled-function-p 'inline-always))
 
-;;WRITE-CHAR
-(push '((t) t #.(flags set)
- "@0;(writec_stream(char_code(#0),sLAstandard_outputA->s.s_dbind),(#0))")
-  (get 'write-char 'inline-unsafe))
+;; ;;WRITE-CHAR
+;; (push '((t) t #.(flags set)
+;;  "@0;(writec_stream(char_code(#0),sLAstandard_outputA->s.s_dbind),(#0))")
+;;   (get 'write-char 'inline-unsafe))
 
 ;;CMOD
  (push '((t) t #.(flags) "cmod(#0)")
--- gcl27-2.7.0.orig/configure
+++ gcl27-2.7.0/configure
@@ -787,12 +787,11 @@ enable_debug
 enable_static
 enable_pic
 enable_gprof
-enable_dynsysgmp
 with_x
 enable_xdr
 enable_immfix
 enable_fastimmfix
-enable_cstackmax
+enable_min_pagewidth
 enable_pargcl
 with_mpicc
 enable_ansi
@@ -1458,11 +1457,10 @@ Optional Features:
   --enable-static will link your GCL against static as opposed to shared system libraries
   --enable-pic builds gcl with -fPIC in CFLAGS
   --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof
-  --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source
   --enable-xdr=yes will compile in support for XDR
   --enable-immfix will enable an immediate fixnum table above the C stack
   --enable-fastimmfix=XXXX will reject low immediate fixnums unless 2^XXX can be attained
-  --enable-cstackmax=xxxx will ensure that the cstack begins below xxxx or fail
+ --enable-min_pagewidth=xxx sets 1<<xxx byte pages
  --enable-pargcl        enables ParGCL (for parallel computing),
 			 including subset of MPI (see pargcl/doc/)
   --enable-ansi builds a large gcl aiming for ansi compliance
@@ -2082,6 +2080,58 @@ rm -f conftest.val
 
 } # ac_fn_c_compute_int
 
+# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR
+# ------------------------------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.
+ac_fn_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+printf %s "checking whether $as_decl_name is declared... " >&6; }
+if eval test \${$3+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  eval ac_save_FLAGS=\$$6
+  as_fn_append $6 " $5"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main (void)
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  eval "$3=yes"
+else $as_nop
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+  eval $6=\$ac_save_FLAGS
+
+fi
+eval ac_res=\$$3
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_check_decl
+
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -3136,7 +3186,6 @@ printf "%s\n" "use=$use" >&6; }
 def_dlopen="no"
 def_statsysbfd="no"
 def_custreloc="yes"
-def_oldgmp="no"
 def_pic="no";
 def_static="no";
 def_debug="no";
@@ -5748,15 +5797,16 @@ fi
 
 if test "$GPROF" != "" ; then
    case $use in
-       powerpc*) if test "$host_cpu" = "powerpc64le" ; then GPROF=""; fi;;
-       s390*) GPROF="";;#mcount smashes float args in make_shortfloat 20180313
+#       powerpc*) if test "$host_cpu" = "powerpc64le" ; then GPROF=""; fi;;
+#       s390*) GPROF="";;#mcount smashes float args in make_shortfloat 20180313
        sh4*)  GPROF="";;
        m68k*) GPROF="";;
        ia64*) GPROF="";;
-       hppa*) GPROF="";;
-       arm*)  if echo $canonical |grep -q hf$; then GPROF=""; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
-       aarch64*) GPROF="";;#unreproducible buildd bug 20170824
-       *gnu)  GPROF="";;
+#       hppa*) GPROF="";;
+       gnuwin95*) GPROF="";;
+#       arm*)  if echo $canonical |grep -q hf$; then GPROF=""; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
+#       aarch64*) GPROF="";;#unreproducible buildd bug 20170824
+#       *gnu)  GPROF="";;
    esac
    OLD_CFLAGS=$CFLAGS
    if ! add_arg_to_cflags -pg ; then GPROF="" ; fi
@@ -5802,9 +5852,6 @@ case $use in
 		assert_arg_to_cflags -mlong-calls
 		TLIBS="$TLIBS -lgcc_s" # workaround hppa __moddi3 local func symbols with default linker flags
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O2" ; TFPFLAG=""; fi #FIXME needed asof gcc 4.8.1
-
-printf "%s\n" "#define SET_STACK_POINTER \"copy %0,%%sp\\n\\t\"" >>confdefs.h
-
 		;;
 	    mips*)
 		case $canonical in
@@ -5817,13 +5864,6 @@ printf "%s\n" "#define SET_STACK_POINTER
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
 		;;
 	    arm*)
-
-printf "%s\n" "#define SET_STACK_POINTER \"mov %%sp,%0\\n\\t\"" >>confdefs.h
-
-		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to set stack pointer" >&5
-printf %s "checking how to set stack pointer... " >&6; }
-		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5
-printf "%s\n" "done" >&6; }
 		assert_arg_to_cflags -fdollars-in-identifiers
 		assert_arg_to_cflags -g #?
 		;;
@@ -6174,15 +6214,7 @@ done
 
 rm -f makedefsafter
 
-# Check whether --enable-dynsysgmp was given.
-if test ${enable_dynsysgmp+y}
-then :
-  enableval=$enable_dynsysgmp;
-fi
-
-
-if test "$enable_dynsysgmp" != "no" ; then
-           for ac_header in gmp.h
+       for ac_header in gmp.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
 if test "x$ac_cv_header_gmp_h" = xyes
@@ -6227,7 +6259,7 @@ if test "x$ac_cv_lib_gmp___gmpz_init" =
 then :
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for external gmp version" >&5
 printf %s "checking for external gmp version... " >&6; }
-		 if test "$cross_compiling" = yes
+	 if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -6237,17 +6269,17 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-				 #include <gmp.h>
+			 #include <gmp.h>
 
 int
 main (void)
 {
 
-				 #if __GNU_MP_VERSION > 3
-				 return 0;
-				 #else
-				 return -1;
-				 #endif
+			 #if __GNU_MP_VERSION > 3
+			 return 0;
+			 #else
+			 return -1;
+			 #endif
 
   ;
   return 0;
@@ -6257,11 +6289,11 @@ if ac_fn_c_try_run "$LINENO"
 then :
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: good" >&5
 printf "%s\n" "good" >&6; }
-		      TLIBS="$TLIBS -lgmp"
-		      echo "#include \"gmp.h\"" >foo.c
-		      echo "int main() {return 0;}" >>foo.c
-		      MP_INCLUDE=`$CC -E foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
-		      rm -f foo.c
+	      TLIBS="$TLIBS -lgmp"
+	      echo "#include \"gmp.h\"" >foo.c
+	      echo "int main() {return 0;}" >>foo.c
+	      MP_INCLUDE=`$CC -E foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
+	      rm -f foo.c
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -6273,48 +6305,11 @@ fi
 
 done
 
-    if test "$MP_INCLUDE" = "" ; then
-	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Cannot use dynamic gmp lib" >&5
-printf "%s\n" "Cannot use dynamic gmp lib" >&6; }
-    fi
-
-fi
-
-
 if test "$MP_INCLUDE" = "" ; then
-
-    GMPDIR=gmp4
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking doing configure in gmp directory" >&5
-printf %s "checking doing configure in gmp directory... " >&6; }
-    echo
-    echo "#"
-    echo "#"
-    echo "# -------------------"
-    echo "# Subconfigure of GMP"
-    echo "#"
-    echo "#"
-
-    if test "$use_common_binary" = "yes"; then
-	cd $GMPDIR && ./configure --build=$host && cd ..
-    else
-	cd $GMPDIR && ./configure --host=$host --build=$build && cd ..
-    fi
-    #MY_SUBDIRS="$MY_SUBDIRS $GMPDIR"
-
-    echo "#"
-    echo "#"
-    echo "#"
-    echo "# Subconfigure of GMP done"
-    echo "# ------------------------"
-    echo "#"
-
-    if test "$MP_INCLUDE" = "" ; then
-	cp $GMPDIR/gmp.h h/gmp.h
-	MP_INCLUDE=h/gmp.h
-	MPFILES=gmp_all
-    fi
+	as_fn_error $? "Cannot use dynamic gmp lib" "$LINENO" 5
 fi
 
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for leading underscore in object symbols" >&5
 printf %s "checking for leading underscore in object symbols... " >&6; }
 cat>foo.c <<EOFF
@@ -7750,13 +7745,179 @@ fi
 
 
 
+
 # pagewidth
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pagewidth" >&5
-printf %s "checking for pagewidth... " >&6; }
 case $use in
     mips*) min_pagewidth=14;;
     *) min_pagewidth=12;;
 esac
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hugepagewidth" >&5
+printf %s "checking for hugepagewidth... " >&6; }
+j=""
+if test -e /proc/meminfo ; then
+   j=`awk '/^Hugepagesize:/ {if ($3!="kB") next;j=1;for (i=0;i<20 && j!=$2;i++) j=j*2;if (j==$2) printf("%d\n",i+10)}'  /proc/meminfo`
+fi
+if test "$j" != "" ; then
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $j" >&5
+printf "%s\n" "$j" >&6; }
+
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
+printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
+if test ${ac_cv_c_undeclared_builtin_options+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_save_CFLAGS=$CFLAGS
+   ac_cv_c_undeclared_builtin_options='cannot detect'
+   for ac_arg in '' -fno-builtin; do
+     CFLAGS="$ac_save_CFLAGS $ac_arg"
+     # This test program should *not* compile successfully.
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+(void) strchr;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else $as_nop
+  # This test program should compile successfully.
+        # No library function is consistently available on
+        # freestanding implementations, so test against a dummy
+        # declaration.  Include always-available headers on the
+        # off chance that they somehow elicit warnings.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <float.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stddef.h>
+extern void ac_decl (int, char *);
+
+int
+main (void)
+{
+(void) ac_decl (0, (char *) 0);
+  (void) ac_decl;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  if test x"$ac_arg" = x
+then :
+  ac_cv_c_undeclared_builtin_options='none needed'
+else $as_nop
+  ac_cv_c_undeclared_builtin_options=$ac_arg
+fi
+          break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+    done
+    CFLAGS=$ac_save_CFLAGS
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5
+printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; }
+  case $ac_cv_c_undeclared_builtin_options in #(
+  'cannot detect') :
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot make $CC report undeclared builtins
+See \`config.log' for more details" "$LINENO" 5; } ;; #(
+  'none needed') :
+    ac_c_undeclared_builtin_options='' ;; #(
+  *) :
+    ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;;
+esac
+
+ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_mman_h" = xyes
+then :
+  ac_fn_c_check_func "$LINENO" "madvise" "ac_cv_func_madvise"
+if test "x$ac_cv_func_madvise" = xyes
+then :
+  ac_fn_check_decl "$LINENO" "MADV_HUGEPAGE" "ac_cv_have_decl_MADV_HUGEPAGE" "#include <sys/mman.h>
+" "$ac_c_undeclared_builtin_options" "CFLAGS"
+if test "x$ac_cv_have_decl_MADV_HUGEPAGE" = xyes
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking madvise works" >&5
+printf %s "checking madvise works... " >&6; }
+	     if test "$cross_compiling" = yes
+then :
+  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else $as_nop
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+			#include <sys/mman.h>
+			#include <stdlib.h>
+
+int
+main (void)
+{
+
+	    		unsigned long k=(1UL<<$j);
+			void *p=malloc(2*k);
+			int i;
+			p=(void *)((((unsigned long)p)+k-1)&~(k-1));
+			i=madvise(p,k,MADV_HUGEPAGE);
+			return i;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+
+printf "%s\n" "#define HAVE_MADVISE_HUGEPAGE 1" >>confdefs.h
+
+		 if test $min_pagewidth -lt $j ; then min_pagewidth=$j ; fi
+else $as_nop
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+fi
+
+fi
+
+else
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+printf "%s\n" "not found" >&6; }
+fi
+
+# Check whether --enable-min_pagewidth was given.
+if test ${enable_min_pagewidth+y}
+then :
+  enableval=$enable_min_pagewidth; min_pagewidth=$enableval
+fi
+
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pagewidth" >&5
+printf %s "checking for pagewidth... " >&6; }
 if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -7986,58 +8147,10 @@ printf "%s\n" "$sizeof_contblock" >&6; }
 printf "%s\n" "#define SIZEOF_CONTBLOCK $sizeof_contblock" >>confdefs.h
 
 
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sbrk" >&5
-printf %s "checking for sbrk... " >&6; }
-HAVE_SBRK=""
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking CSTACK_DIRECTION" >&5
+printf %s "checking CSTACK_DIRECTION... " >&6; }
 if test "$cross_compiling" = yes
 then :
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no: WARNING you must be able to emulate sbrk: as on mingw or macosx" >&5
-printf "%s\n" "no: WARNING you must be able to emulate sbrk: as on mingw or macosx" >&6; }
-else $as_nop
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-		#include <unistd.h>
-		#include <stdio.h>
-
-int
-main (void)
-{
-
-		FILE *f;
-		if (!(f=fopen("conftest1","w")))
-		   return -1;
-		   fprintf(f,"%p",sbrk(0));
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"
-then :
-  HAVE_SBRK=1;{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-else $as_nop
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no: WARNING you must be able to emulate sbrk: as on mingw or macosx" >&5
-printf "%s\n" "no: WARNING you must be able to emulate sbrk: as on mingw or macosx" >&6; }
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-if test "$use" = "386-macosx" ; then
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: emulating sbrk for mac" >&5
-printf "%s\n" "emulating sbrk for mac" >&6; };
-    HAVE_SBRK=0
-fi
-
-if test "$HAVE_SBRK" = "1" ; then
-
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ADDR_NO_RANDOMIZE constant" >&5
-printf %s "checking for ADDR_NO_RANDOMIZE constant... " >&6; }
-    if test "$cross_compiling" = yes
-then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -8046,87 +8159,36 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		    #include <sys/personality.h>
- 		    #include <stdio.h>
-
-int
-main (void)
-{
-
-		    FILE *f;
-		    if (!(f=fopen("conftest1","w"))) return -1;
-		       fprintf(f,"%x",ADDR_NO_RANDOMIZE);
-
-  ;
-  return 0;
-}
+                #include <unistd.h>
+		#include <stdio.h>
+		#include <stdlib.h>
+		int main(int argc,char **argv,char **envp) {
+		    FILE *fp = fopen("conftest1","w");
+		    fprintf(fp,"%d",(alloca(sizeof(void *))>alloca(sizeof(void *))) ? -1 : 1);
+		    fclose(fp);
+		    return 0;
+		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
 then :
-  ADDR_NO_RANDOMIZE=`cat conftest1`
-	 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_NO_RANDOMIZE" >&5
-printf "%s\n" "yes $ADDR_NO_RANDOMIZE" >&6; }
+  cstack_direction=`cat conftest1`
 else $as_nop
-  ADDR_NO_RANDOMIZE=0
-	 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no assuming 0x40000" >&5
-printf "%s\n" "no assuming 0x40000" >&6; }
-
-printf "%s\n" "#define ADDR_NO_RANDOMIZE 0x40000" >>confdefs.h
-
+  cstack_direction=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ADDR_COMPAT_LAYOUT constant" >&5
-printf %s "checking for ADDR_COMPAT_LAYOUT constant... " >&6; }
-    if test "$cross_compiling" = yes
-then :
-  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else $as_nop
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-		    #include <sys/personality.h>
- 		    #include <stdio.h>
-
-int
-main (void)
-{
-
-		    FILE *f;
-		    if (!(f=fopen("conftest1","w"))) return -1;
-		       fprintf(f,"%x",ADDR_COMPAT_LAYOUT);
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"
-then :
-  ADDR_COMPAT_LAYOUT=`cat conftest1`
-	 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_COMPAT_LAYOUT" >&5
-printf "%s\n" "yes $ADDR_COMPAT_LAYOUT" >&6; }
-else $as_nop
-  ADDR_COMPAT_LAYOUT=0
-	 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-
-printf "%s\n" "#define ADDR_COMPAT_LAYOUT 0" >>confdefs.h
+printf "%s\n" "#define CSTACK_DIRECTION $cstack_direction" >>confdefs.h
 
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_direction" >&5
+printf "%s\n" "$cstack_direction" >&6; }
 
 
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ADDR_LIMIT_3GB constant" >&5
-printf %s "checking for ADDR_LIMIT_3GB constant... " >&6; }
-    if test "$cross_compiling" = yes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking finding CSTACK_ALIGNMENT" >&5
+printf %s "checking finding CSTACK_ALIGNMENT... " >&6; }
+if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -8136,80 +8198,43 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		    #include <sys/personality.h>
- 		    #include <stdio.h>
-
-int
-main (void)
-{
-
-		    FILE *f;
-		    if (!(f=fopen("conftest1","w"))) return -1;
-		       fprintf(f,"%x",ADDR_LIMIT_3GB);
-
-  ;
-  return 0;
-}
+                #include <unistd.h>
+		#include <stdio.h>
+		#include <stdlib.h>
+		int main(int argc,char **argv,char **envp) {
+		    void *b,*c;
+		    FILE *fp = fopen("conftest1","w");
+		    long n;
+		    b=alloca(sizeof(b));
+		    c=alloca(sizeof(c));
+		    n=b>c ? b-c : c-b;
+		    n=n>sizeof(c) ? n : 1;
+		    fprintf(fp,"%ld",n);
+		    fclose(fp);
+		    return 0;
+		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
 then :
-  ADDR_LIMIT_3GB=`cat conftest1`
-	 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_LIMIT_3GB" >&5
-printf "%s\n" "yes $ADDR_LIMIT_3GB" >&6; }
+  cstack_alignment=`cat conftest1`
 else $as_nop
-  ADDR_LIMIT_3GB=0
-	 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-
-printf "%s\n" "#define ADDR_LIMIT_3GB 0" >>confdefs.h
-
+  cstack_alignment=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for personality(ADDR_NO_RANDOMIZE) support" >&5
-printf %s "checking for personality(ADDR_NO_RANDOMIZE) support... " >&6; }
-    if test "$cross_compiling" = yes
-then :
-  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else $as_nop
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-                    #include <unistd.h>
-		    #include <stdio.h>
-		    #include <stdlib.h>
-		    int main(int argc,char *argv[],char *envp[]) {
-			#include "h/unrandomize.h"
-			return 0;
-		    }
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"
-then :
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-
-printf "%s\n" "#define CAN_UNRANDOMIZE_SBRK 1" >>confdefs.h
+printf "%s\n" "#define CSTACK_ALIGNMENT $cstack_alignment" >>confdefs.h
 
-else $as_nop
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_alignment" >&5
+printf "%s\n" "$cstack_alignment" >&6; }
 
+if test $cstack_direction -eq 1 ; then
 
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that sbrk is (now) non-random" >&5
-printf %s "checking that sbrk is (now) non-random... " >&6; }
-    SBRK=0
-    if test "$cross_compiling" = yes
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking CSTACK_TOP" >&5
+printf %s "checking CSTACK_TOP... " >&6; }
+   if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -8219,86 +8244,41 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                    #include <unistd.h>
-		    #include <stdio.h>
-		    #include <stdlib.h>
-		    int main(int argc,char * argv[],char * envp[]) {
-			FILE *f;
-			#ifdef CAN_UNRANDOMIZE_SBRK
-			#include "h/unrandomize.h"
-			#endif
-			if (!(f=fopen("conftest1","w")))
-			   return -1;
-			   fprintf(f,"%p",sbrk(0));
-			   return 0;
-		    }
-
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <unistd.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w"),*f=fopen("/proc/self/maps","r");
+   		    unsigned long i,j;
+		    char b[4096];
+   		    i=(unsigned long)alloca(sizeof(void *));
+		    for (j=0;j<i && fgets(b,sizeof(b),f);)
+		    	sscanf(b,"%x-",&j);
+		    j-=1;
+		    if (j<i) j=-1;
+		    fclose(f);
+   		    fprintf(fp,"0x%lx",j);
+   		    fclose(fp);
+   		    return 0;
+   		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
 then :
-  SBRK=`cat conftest1`
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-    if test "$SBRK" = "0" ; then
-	as_fn_error $? "cannot trap sbrk" "$LINENO" 5
-    fi
-
-    SBRK1=0
-    if test "$cross_compiling" = yes
-then :
-  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+  cstack_top=`cat conftest1`
 else $as_nop
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-                    #include <unistd.h>
-		    #include <stdio.h>
-		    #include <stdlib.h>
-		    int main(int argc,char * argv[],char * envp[]) {
-			FILE *f;
-			#ifdef CAN_UNRANDOMIZE_SBRK
-			#include "h/unrandomize.h"
-			#endif
-			if (!(f=fopen("conftest1","w"))) return -1;
-			   fprintf(f,"%p",sbrk(0));
-			   return 0;
-		    }
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"
-then :
-  SBRK1=`cat conftest1`
+  cstack_top=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-    if test "$SBRK1" = "0" ; then
-	as_fn_error $? "cannot trap sbrk" "$LINENO" 5
-    fi
-    if test "$SBRK" = "$SBRK1" ; then
-	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-    else
-	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-	echo "Cannot build with randomized sbrk. Your options:"
-	echo " - upgrade to a kernel/libc that knows about personality(ADDR_NO_RANDOMIZE)"
-	echo " - recompile your kernel with CONFIG_COMPAT_BRK (if it has that option)"
-	echo " - run sysctl kernel.randomize_va_space=0 before using gcl"
-	as_fn_error $? "exiting" "$LINENO" 5
-    fi
-fi
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_top" >&5
+printf "%s\n" "$cstack_top" >&6; }
 
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking CSTACK_DIRECTION" >&5
-printf %s "checking CSTACK_DIRECTION... " >&6; }
-if test "$cross_compiling" = yes
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking relocated CSTACK_TOP" >&5
+printf %s "checking relocated CSTACK_TOP... " >&6; }
+   if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -8308,38 +8288,46 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                #include <unistd.h>
-		#include <stdio.h>
-		#include <stdlib.h>
-		int main(int argc,char **argv,char **envp) {
-		    FILE *fp = fopen("conftest1","w");
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    fprintf(fp,"%d",(alloca(sizeof(void *))>alloca(sizeof(void *))) ? -1 : 1);
-		    fclose(fp);
-		    return 0;
-		}
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <sys/mman.h>
+   		#include <unistd.h>
+   		#include <errno.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w"),*f=fopen("/proc/self/maps","r");
+   		    unsigned long i,j;
+		    char b[4096],*stack_map_base;
+		    #include "h/cstack.h"
+   		    i=(unsigned long)alloca(sizeof(void *));
+		    for (j=0;j<i && fgets(b,sizeof(b),f);)
+		    	sscanf(b,"%x-",&j);
+		    j-=1;
+		    if (j<i) j=-1;
+		    fclose(f);
+   		    fprintf(fp,"0x%lx",j);
+   		    fclose(fp);
+   		    return 0;
+   		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
 then :
-  cstack_direction=`cat conftest1`
+  cstack_top=`cat conftest1`
 else $as_nop
-  cstack_direction=0
+  cstack_top=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_top" >&5
+printf "%s\n" "$cstack_top" >&6; }
 
-printf "%s\n" "#define CSTACK_DIRECTION $cstack_direction" >>confdefs.h
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_direction" >&5
-printf "%s\n" "$cstack_direction" >&6; }
+else
 
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking finding CSTACK_ALIGNMENT" >&5
-printf %s "checking finding CSTACK_ALIGNMENT... " >&6; }
-if test "$cross_compiling" = yes
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking CSTACK_TOP" >&5
+printf %s "checking CSTACK_TOP... " >&6; }
+   if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -8349,58 +8337,39 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                #include <unistd.h>
-		#include <stdio.h>
-		#include <stdlib.h>
-		int main(int argc,char **argv,char **envp) {
-		    void *b,*c;
-		    FILE *fp = fopen("conftest1","w");
-		    long n;
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    b=alloca(sizeof(b));
-		    c=alloca(sizeof(c));
-		    n=b>c ? b-c : c-b;
-		    n=n>sizeof(c) ? n : 1;
-		    fprintf(fp,"%ld",n);
-		    fclose(fp);
-		    return 0;
-		}
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <unistd.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w");
+   		    unsigned long i,j;
+   		    j=getpagesize();
+   		    i=(unsigned long)alloca(sizeof(void *));
+   		    j--;
+   		    i+=j;
+   		    i&=~j;
+   		    fprintf(fp,"0x%lx",i-1);
+   		    fclose(fp);
+   		    return 0;
+   		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
 then :
-  cstack_alignment=`cat conftest1`
+  cstack_top=`cat conftest1`
 else $as_nop
-  cstack_alignment=0
+  cstack_top=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_top" >&5
+printf "%s\n" "$cstack_top" >&6; }
 
-printf "%s\n" "#define CSTACK_ALIGNMENT $cstack_alignment" >>confdefs.h
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_alignment" >&5
-printf "%s\n" "$cstack_alignment" >&6; }
-
-cstack_max=-1;
-# Check whether --enable-cstackmax was given.
-if test ${enable_cstackmax+y}
-then :
-  enableval=$enable_cstackmax; if test "$enableval" != "" ; then
-	         cstack_max=$enableval;
-
-printf "%s\n" "#define CSTACKMAX $enableval" >>confdefs.h
-
-	       fi
-fi
-
-
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking CSTACK_ADDRESS" >&5
-printf %s "checking CSTACK_ADDRESS... " >&6; }
-if test "$cross_compiling" = yes
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking relocated CSTACK_TOP" >&5
+printf %s "checking relocated CSTACK_TOP... " >&6; }
+   if test "$cross_compiling" = yes
 then :
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -8410,44 +8379,41 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		#include <stdio.h>
-		#include <stdlib.h>
-		int
-		main(int argc,char **argv,char **envp) {
-		    FILE *fp = fopen("conftest1","w");
-		    unsigned long i,j;
-
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    j=1;
-		    j<<=$PAGEWIDTH;
-		    j<<=16;
-		    i=(unsigned long)alloca(sizeof(void *));
-		    if ($cstack_direction==1) i-=j;
-		    j--;
-		    i+=j;
-		    i&=~j;
-		    fprintf(fp,"0x%lx",i-1);
-		    fclose(fp);
-		    return 0;
-		}
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <sys/mman.h>
+   		#include <unistd.h>
+   		#include <errno.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w");
+   		    unsigned long i,j;
+		    char *stack_map_base;
+   		    #include "h/cstack.h"
+   		    j=getpagesize();
+   		    i=(unsigned long)alloca(sizeof(void *));
+   		    j--;
+   		    i+=j;
+   		    i&=~j;
+   		    fprintf(fp,"0x%lx",i-1);
+   		    fclose(fp);
+   		    return 0;
+   		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
 then :
-  cstack_address=`cat conftest1`
+  cstack_top=`cat conftest1`
 else $as_nop
-  cstack_address=0
+  cstack_top=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_top" >&5
+printf "%s\n" "$cstack_top" >&6; }
 
-printf "%s\n" "#define CSTACK_ADDRESS $cstack_address" >>confdefs.h
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_address" >&5
-printf "%s\n" "$cstack_address" >&6; }
+fi
 
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking cstack bits" >&5
 printf %s "checking cstack bits... " >&6; }
@@ -8463,20 +8429,18 @@ else $as_nop
 
 		#include <stdio.h>
 		#include <stdlib.h>
+		#include <unistd.h>
+		#include <sys/mman.h>
+		#include <unistd.h>
+		#include <errno.h>
 		int
 		main(int argc,char **argv,char **envp) {
-		    void *v ;
 		    FILE *fp = fopen("conftest1","w");
 		    long i,j;
-
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    j=1;
-		    j<<=$PAGEWIDTH;
-		    j<<=16;
-		    i=(long)&v;
-		    if ($cstack_direction==1) i-=j;
+		    char *stack_map_base;
+		    #include "h/cstack.h"
+		    j=getpagesize();
+		    i=$cstack_top;
 		    j--;
 		    i+=j;
 		    i&=~j;
@@ -8496,12 +8460,10 @@ rm -f core *.core core.conftest.* gmon.o
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
-printf "%s\n" "#define CSTACK_BITS $cstack_bits" >>confdefs.h
-
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cstack_bits" >&5
 printf "%s\n" "$cstack_bits" >&6; }
 
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking NEG_CSTACK_ADDRESS" >&5
 printf %s "checking NEG_CSTACK_ADDRESS... " >&6; }
 if test "$cross_compiling" = yes
@@ -8516,12 +8478,15 @@ else $as_nop
 
 		#include <stdio.h>
 		#include <stdlib.h>
+		#include <unistd.h>
+		#include <sys/mman.h>
+		#include <unistd.h>
+		#include <errno.h>
 		int
 		main(int argc,char **argv,char **envp) {
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    return (long)$cstack_address<0 ? 0 : -1;
+	            char *stack_map_base;
+		    #include "h/cstack.h"
+		    return (long)$cstack_top<0 ? 0 : -1;
 		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"
@@ -8529,9 +8494,6 @@ then :
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }
      neg_cstack_address=1
-
-printf "%s\n" "#define NEG_CSTACK_ADDRESS 1" >>confdefs.h
-
 else $as_nop
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
@@ -8542,6 +8504,7 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
+
 # Check whether --enable-immfix was given.
 if test ${enable_immfix+y}
 then :
@@ -8558,18 +8521,15 @@ else $as_nop
 fi
 
 
-
-if test "$use" != "386-gnu" ; then #hurd can push .data below C stack, but sbrk(0) remains above, foiling unexec
-
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking finding default linker script" >&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking finding default linker script" >&5
 printf %s "checking finding default linker script... " >&6; }
-    touch unixport/gcl.script
-    echo "int main() {return 0;}" >foo.c
-    $CC $LDFLAGS -Wl,--verbose foo.c -o foo 2>&1 | \
+touch unixport/gcl.script
+echo "int main() {return 0;}" >foo.c
+$CC $LDFLAGS -Wl,--verbose foo.c -o foo 2>&1 | \
 	$AWK '/==================================================/ {i=1-i;next} {if (i) print}' >gcl.script
-    rm -rf foo.c foo
+rm -rf foo.c foo
 
-    if test "`cat gcl.script | wc -l`" != "0" ; then
+if test "`cat gcl.script | wc -l`" != "0" ; then
 	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: got it" >&5
 printf "%s\n" "got it" >&6; }
 
@@ -8580,20 +8540,21 @@ printf %s "checking output_arch... " >&6
 
 printf "%s\n" "#define OUTPUT_ARCH bfd_arch_${output_arch}" >>confdefs.h
 
-     	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: bfd_arch_${output_arch}" >&5
+ 	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: bfd_arch_${output_arch}" >&5
 printf "%s\n" "bfd_arch_${output_arch}" >&6; }
 	else
-     	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ 	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 printf "%s\n" "not found" >&6; }
 	fi
 	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking output_mach" >&5
 printf %s "checking output_mach... " >&6; }
 	output_mach=`cat gcl.script |grep OUTPUT_ARCH|head -n 1|sed 's,.*(\(.*\)).*,\1:,1'|cut -f2 -d:|tr '-' '_'|tr -d '.'`;
-        if test "$output_mach" = "common" ; then
+
+    if test "$output_mach" = "common" ; then #FIXME
 	   output_mach=""
 	fi
 	defaulted=""
-        if test "$output_mach" = "" ; then
+    if test "$output_mach" = "" ; then
 		if test "$output_arch" = "i386" ; then
 		   output_mach="i386_i386";
 		   defaulted="(defaulted)"
@@ -8603,10 +8564,10 @@ printf %s "checking output_mach... " >&6
 
 printf "%s\n" "#define OUTPUT_MACH bfd_mach_${output_mach}" >>confdefs.h
 
-     	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $defaulted bfd_mach_${output_mach}" >&5
+ 	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $defaulted bfd_mach_${output_mach}" >&5
 printf "%s\n" "$defaulted bfd_mach_${output_mach}" >&6; }
 	else
-     	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ 	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 printf "%s\n" "not found" >&6; }
 	fi
 
@@ -8620,12 +8581,12 @@ printf "%s\n" "$as_me: trying to adjust
 	max=0;
 	min=$lim;
 	while test $n -lt $lim ; do
-            j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$n </dev/null`
-            cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[0-9]*","0x" j,$0);} {print}' j=$j >gcl.script
+        j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$n </dev/null`
+        cat gcl.script.def | $AWK '/SEGMENT_START/ {gsub("0x[0-9]*","0x" j,$0);} {print}' j=$j >gcl.script
 	    #        diff -u gcl.script.def gcl.script
-            echo "int main() {return 0;}" >foo.c
-            if ( $CC $LDFLAGS -Wl,-T gcl.script foo.c -o foo >/dev/null 2>&1 && ./foo >/dev/null 2>&1 ) >/dev/null 2>&1 ; then
-		if test $n -lt $min ; then min=$n; fi;
+        echo "int main() {return 0;}" >foo.c
+        if ( $CC $LDFLAGS -Wl,-T gcl.script foo.c -o foo >/dev/null 2>&1 && ./foo >/dev/null 2>&1 ) >/dev/null 2>&1 ; then
+		if test $n -lt $min; then min=$n; fi;
 		if test $n -gt $max; then max=$n; fi;
 	    elif test $max -gt 0 ; then
 	    	# Workaround for false island of acceptability on riscv64, 20240716
@@ -8635,8 +8596,8 @@ printf "%s\n" "$as_me: trying to adjust
 		   min=$lim
 		   max=0;
 		fi
-            fi;
-            n=`$AWK 'END {print n+1}' n=$n </dev/null`
+        fi;
+        n=`$AWK 'END {print n+1}' n=$n </dev/null`
 	done
 
 	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: min log text start $min" >&5
@@ -8645,22 +8606,37 @@ printf "%s\n" "$as_me: min log text star
 printf "%s\n" "$as_me: max log text start $max" >&6;}
 
 	if test $neg_cstack_address -eq 1 ; then #FIXME test this
-      	    if test $cstack_bits -lt $max ; then
+  	    if test $cstack_bits -lt $max ; then
 		max=$cstack_bits;
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: max log text start reduced to $max considering c stack address" >&5
 printf "%s\n" "$as_me: max log text start reduced to $max considering c stack address" >&6;}
 	    fi
 	fi
 
+	# Need to get over default cstack and related maps between 0x1000000 and 0x2000000
+	if test "$use" == "386-gnu" || test "$use" == "amd64-gnu" ; then
+	   if test "$use" == "386-gnu" ; then
+	      q=24;
+	   else
+	      q=23;
+	   fi
+	   if test $min -lt $q && test $q -lt $max && test $q -lt 30; then
+	      min=$q
+	      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: min log text start increased to $min over c stack address" >&5
+printf "%s\n" "$as_me: min log text start increased to $min over c stack address" >&6;}
+	   fi
+	fi
+
+
 	j=-1;
 	low_shft="";
 	if test $min -le $max ; then
-            if test $max -ge $enable_fastimmfix && test "$enable_immfix" != "no" ; then
+        if test $max -ge $enable_fastimmfix && test "$enable_immfix" != "no" ; then
 	        j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$max </dev/null`
 		low_shft=`$AWK 'END {print n+1}' n=$max </dev/null`;
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: raising log text to 0x$j for a $max bit wide low immfix table" >&5
 printf "%s\n" "$as_me: raising log text to 0x$j for a $max bit wide low immfix table" >&6;}
-            else
+        else
 	        j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$min </dev/null`
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: lowering log text to 0x$j to maximize data area" >&5
 printf "%s\n" "$as_me: lowering log text to 0x$j to maximize data area" >&6;}
@@ -8684,7 +8660,7 @@ printf "%s\n" "#define OBJNULL NULL" >>c
 	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking our linker script" >&5
 printf %s "checking our linker script... " >&6; }
 	if test "$j" != "-1" ; then
-            cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[0-9]*","0x" j,$0);} {print}' j=$j >gcl.script
+        cat gcl.script.def | $AWK '/SEGMENT_START/ {gsub("0x[0-9]*","0x" j,$0);} {print}' j=$j >gcl.script
 	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5
 printf "%s\n" "done" >&6; }
 	    rm -f gcl.script.def
@@ -8696,21 +8672,19 @@ printf "%s\n" "none found or not needed"
 	    rm -f gcl.script gcl.script.def
 	fi
 	rm -rf foo.c foo
-    else
+else
 
 printf "%s\n" "#define OBJNULL NULL" >>confdefs.h
 
-	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 printf "%s\n" "not found" >&6; }
-    fi
-
-else
-
+fi
 
-printf "%s\n" "#define OBJNULL NULL" >>confdefs.h
+#else
 
+#    AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
 
-fi
+#fi
 
 printf "%s\n" "#define CSSIZE $enable_cssize" >>confdefs.h
 
@@ -8739,8 +8713,7 @@ main (void)
 		FILE *fp = fopen("conftest1","w");
 
 		for (i=2,k=1;i;k=i,i<<=1);
-		l=$cstack_address;
-		l=$cstack_direction==1 ? (l<k ? k-1 : $cstack_max) : l;
+		l=$cstack_top;
 		for (i=j=k;j && i<l;j>>=1,i|=j);
 		if (j<(k>>3)) i=0;
 		j=1;
@@ -8813,14 +8786,6 @@ fi
 
     { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mem_range" >&5
 printf "%s\n" "$mem_range" >&6; }
-    if test "$mem_range" != "0x0" ; then
-
-printf "%s\n" "#define MEM_TOP $mem_top" >>confdefs.h
-
-
-printf "%s\n" "#define MEM_RANGE $mem_range" >>confdefs.h
-
-    fi
 fi
 
 if test "$enable_immfix" != "no" ; then
@@ -10709,36 +10674,28 @@ fi
 
 
 	if test "${TCLSH}" = "" ; then true ; else
-
-	    rm -f conftest.tcl
-	    cat >> conftest.tcl <<EOF
-
-puts [set tcl_version]
-
-EOF
-
-	    TCL_VERSION=`${TCLSH} < conftest.tcl`
+	    TCL_VERSION=`echo 'puts [set tcl_version]' | ${TCLSH}`
 	fi
 
-	if test -x /usr/lib/tcl$TCL_VERSION/tclConfig.sh ; then
+	if test -e /usr/lib/tcl$TCL_VERSION/tclConfig.sh ; then
 	    TCL_CONFIG_PREFIX=/usr/lib/tcl$TCL_VERSION
 	fi
 
     fi
 
-    if test -f ${TCL_CONFIG_PREFIX}/tclConfig.sh  ; then . ${TCL_CONFIG_PREFIX}/tclConfig.sh ; fi
+    if test -e ${TCL_CONFIG_PREFIX}/tclConfig.sh  ; then . ${TCL_CONFIG_PREFIX}/tclConfig.sh ; fi
 
     if test -d "${TK_CONFIG_PREFIX}"  ; then true ; else
-	if test -f ${TCL_CONFIG_PREFIX}/tkConfig.sh ; then
+	if test -e ${TCL_CONFIG_PREFIX}/tkConfig.sh ; then
 	    TK_CONFIG_PREFIX=${TCL_CONFIG_PREFIX}
 	else
-	    if test -x `echo $TCL_CONFIG_PREFIX | sed 's,tcl,tk,g'`/tkConfig.sh ; then
+	    if test -e `echo $TCL_CONFIG_PREFIX | sed 's,tcl,tk,g'`/tkConfig.sh ; then
 		TK_CONFIG_PREFIX=`echo $TCL_CONFIG_PREFIX | sed 's,tcl,tk,g'`
 	    fi
 	fi
     fi
 
-    if test -f ${TK_CONFIG_PREFIX}/tkConfig.sh  ; then . ${TK_CONFIG_PREFIX}/tkConfig.sh ; fi
+    if test -e ${TK_CONFIG_PREFIX}/tkConfig.sh  ; then . ${TK_CONFIG_PREFIX}/tkConfig.sh ; fi
 
     if test -d ${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION} ; then
 	TCL_LIBRARY=${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION}
@@ -10756,24 +10713,24 @@ EOF
 	fi
     fi
 
-    if test -f ${TCL_CONFIG_PREFIX}/../include/tcl.h ; then
+    if test -e ${TCL_CONFIG_PREFIX}/../include/tcl.h ; then
 	TCL_INCLUDE=-I${TCL_CONFIG_PREFIX}/../include
     else
-	if test -f /usr/include/tcl${TCL_VERSION}/tcl.h ; then
+	if test -e /usr/include/tcl${TCL_VERSION}/tcl.h ; then
 	    TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
 	fi
     fi
 
-    if test -f ${TK_CONFIG_PREFIX}/../include/tk.h ; then
+    if test -e ${TK_CONFIG_PREFIX}/../include/tk.h ; then
 	TK_INCLUDE=-I${TK_CONFIG_PREFIX}/../include
     else
-	if test -f /usr/include/tcl${TCL_VERSION}/tk.h ; then
+	if test -e /usr/include/tcl${TCL_VERSION}/tk.h ; then
 	    TK_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
 	fi
     fi
 
     TCL_VERSION_DOT_FREE=`echo ${TCL_VERSION} | tr -d .`
-    if test -f ${TK_CONFIG_PREFIX}/../bin/tcl${TCL_VERSION_DOT_FREE}.dll  ; then
+    if test -e ${TK_CONFIG_PREFIX}/../bin/tcl${TCL_VERSION_DOT_FREE}.dll  ; then
 	TCL_LIBS="-L${TK_CONFIG_PREFIX}/../bin -ltk${TCL_VERSION_DOT_FREE} -ltcl${TCL_VERSION_DOT_FREE}"
 	TCL_STUB_LIBS="-L${TK_CONFIG_PREFIX}/lib -ltkstub${TCL_VERSION_DOT_FREE} -ltclstub${TCL_VERSION_DOT_FREE}"
     else
--- gcl27-2.7.0.orig/configure.in
+++ gcl27-2.7.0/configure.in
@@ -71,7 +71,6 @@ AC_MSG_RESULT([use=$use])
 def_dlopen="no"
 def_statsysbfd="no"
 def_custreloc="yes"
-def_oldgmp="no"
 def_pic="no";
 def_static="no";
 def_debug="no";
@@ -399,15 +398,16 @@ AC_ARG_ENABLE([gprof],[  --enable-gprof
 
 if test "$GPROF" != "" ; then
    case $use in
-       powerpc*) if test "$host_cpu" = "powerpc64le" ; then GPROF=""; fi;;
-       s390*) GPROF="";;#mcount smashes float args in make_shortfloat 20180313
+#       powerpc*) if test "$host_cpu" = "powerpc64le" ; then GPROF=""; fi;;
+#       s390*) GPROF="";;#mcount smashes float args in make_shortfloat 20180313
        sh4*)  GPROF="";;
        m68k*) GPROF="";;
        ia64*) GPROF="";;
-       hppa*) GPROF="";;
-       arm*)  if echo $canonical |grep -q hf$; then GPROF=""; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
-       aarch64*) GPROF="";;#unreproducible buildd bug 20170824
-       *gnu)  GPROF="";;
+#       hppa*) GPROF="";;
+       gnuwin95*) GPROF="";;
+#       arm*)  if echo $canonical |grep -q hf$; then GPROF=""; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
+#       aarch64*) GPROF="";;#unreproducible buildd bug 20170824
+#       *gnu)  GPROF="";;
    esac
    OLD_CFLAGS=$CFLAGS
    if ! add_arg_to_cflags -pg ; then GPROF="" ; fi
@@ -448,7 +448,6 @@ case $use in
 		assert_arg_to_cflags -mlong-calls
 		TLIBS="$TLIBS -lgcc_s" # workaround hppa __moddi3 local func symbols with default linker flags
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O2" ; TFPFLAG=""; fi #FIXME needed asof gcc 4.8.1
-		AC_DEFINE([SET_STACK_POINTER],["copy %0,%%sp\n\t"],[asm string to set the stack pointer])
 		;;
 	    mips*)
 		case $canonical in
@@ -461,9 +460,6 @@ case $use in
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
 		;;
 	    arm*)
-		AC_DEFINE([SET_STACK_POINTER],["mov %%sp,%0\n\t"],[asm string to set the stack pointer])
-		AC_MSG_CHECKING([how to set stack pointer])
-		AC_MSG_RESULT([done])
 		assert_arg_to_cflags -fdollars-in-identifiers
 		assert_arg_to_cflags -g #?
 		;;
@@ -647,74 +643,33 @@ AC_CHECK_HEADERS(
 
 rm -f makedefsafter
 
-AC_ARG_ENABLE([dynsysgmp],
-	      [  --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source])
-
-if test "$enable_dynsysgmp" != "no" ; then
-    AC_CHECK_HEADERS(
-	[gmp.h],
-	[AC_CHECK_LIB(
-		[gmp],[__gmpz_init],
-		[AC_MSG_CHECKING([for external gmp version])
-		 AC_RUN_IFELSE(
-		     [AC_LANG_PROGRAM(
-			     [[
-				 #include <gmp.h>
-			     ]],
-			     [[
-				 #if __GNU_MP_VERSION > 3
-				 return 0;
-				 #else
-				 return -1;
-				 #endif
-			     ]])],
-		     [AC_MSG_RESULT([good])
-		      TLIBS="$TLIBS -lgmp"
-		      echo "#include \"gmp.h\"" >foo.c
-		      echo "int main() {return 0;}" >>foo.c
-		      MP_INCLUDE=`$CC -E foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
-		      rm -f foo.c])])])
-
-    if test "$MP_INCLUDE" = "" ; then
-	AC_MSG_RESULT([Cannot use dynamic gmp lib])
-    fi
-
-fi
-
+AC_CHECK_HEADERS([gmp.h],
+   [AC_CHECK_LIB([gmp],[__gmpz_init],
+	[AC_MSG_CHECKING([for external gmp version])
+	 AC_RUN_IFELSE(
+	     [AC_LANG_PROGRAM(
+		     [[
+			 #include <gmp.h>
+		     ]],
+		     [[
+			 #if __GNU_MP_VERSION > 3
+			 return 0;
+			 #else
+			 return -1;
+			 #endif
+		     ]])],
+	     [AC_MSG_RESULT([good])
+	      TLIBS="$TLIBS -lgmp"
+	      echo "#include \"gmp.h\"" >foo.c
+	      echo "int main() {return 0;}" >>foo.c
+	      MP_INCLUDE=`$CC -E foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
+	      rm -f foo.c])])])
 
 if test "$MP_INCLUDE" = "" ; then
-
-    GMPDIR=gmp4
-    AC_MSG_CHECKING([doing configure in gmp directory])
-    echo
-    echo "#"
-    echo "#"
-    echo "# -------------------"
-    echo "# Subconfigure of GMP"
-    echo "#"
-    echo "#"
-
-    if test "$use_common_binary" = "yes"; then
-	cd $GMPDIR && ./configure --build=$host && cd ..
-    else
-	cd $GMPDIR && ./configure --host=$host --build=$build && cd ..
-    fi
-    #MY_SUBDIRS="$MY_SUBDIRS $GMPDIR"
-
-    echo "#"
-    echo "#"
-    echo "#"
-    echo "# Subconfigure of GMP done"
-    echo "# ------------------------"
-    echo "#"
-
-    if test "$MP_INCLUDE" = "" ; then
-	cp $GMPDIR/gmp.h h/gmp.h
-	MP_INCLUDE=h/gmp.h
-	MPFILES=gmp_all
-    fi
+	AC_MSG_ERROR([Cannot use dynamic gmp lib])
 fi
 
+
 AC_MSG_CHECKING([for leading underscore in object symbols])
 cat>foo.c <<EOFF
 #include <math.h>
@@ -1065,12 +1020,52 @@ AC_RUN_IFELSE(
      AC_DEFINE(DOUBLE_BIGENDIAN,1,[big endian word order])])
 AC_SUBST(DOUBLE_BIGENDIAN)
 
+
 # pagewidth
-AC_MSG_CHECKING(for pagewidth)
 case $use in
     mips*) min_pagewidth=14;;
     *) min_pagewidth=12;;
 esac
+
+AC_MSG_CHECKING([for hugepagewidth])
+j=""
+if test -e /proc/meminfo ; then
+   j=`awk '/^Hugepagesize:/ {if ($3!="kB") next;j=1;for (i=0;i<20 && j!=$2;i++) j=j*2;if (j==$2) printf("%d\n",i+10)}'  /proc/meminfo`
+fi
+if test "$j" != "" ; then
+   AC_MSG_RESULT([$j])
+
+   AC_CHECK_HEADER([sys/mman.h],
+      [AC_CHECK_FUNC([madvise],
+         [AC_CHECK_DECL([MADV_HUGEPAGE],
+            [AC_MSG_CHECKING([madvise works])
+	     AC_RUN_IFELSE(
+	       [AC_LANG_PROGRAM(
+	   	    [[
+			#include <sys/mman.h>
+			#include <stdlib.h>
+		    ]],
+	    	    [[
+	    		unsigned long k=(1UL<<$j);
+			void *p=malloc(2*k);
+			int i;
+			p=(void *)((((unsigned long)p)+k-1)&~(k-1));
+			i=madvise(p,k,MADV_HUGEPAGE);
+			return i;
+         	    ]])],
+		[AC_MSG_RESULT([yes])
+		 AC_DEFINE(HAVE_MADVISE_HUGEPAGE,[1],[can madvise hugepages])
+		 if test $min_pagewidth -lt $j ; then min_pagewidth=$j ; fi],
+		[AC_MSG_RESULT([no])])]
+	     ,[],[#include <sys/mman.h>])])])
+else
+   AC_MSG_RESULT([not found])
+fi
+
+AC_ARG_ENABLE(min_pagewidth,[ --enable-min_pagewidth=xxx sets 1<<xxx byte pages],
+             [min_pagewidth=$enableval],[])
+
+AC_MSG_CHECKING(for pagewidth)
 AC_RUN_IFELSE(
     [AC_LANG_PROGRAM(
 	    [[
@@ -1170,156 +1165,6 @@ AC_RUN_IFELSE(
 AC_MSG_RESULT($sizeof_contblock)
 AC_DEFINE_UNQUOTED(SIZEOF_CONTBLOCK,$sizeof_contblock,[sizeof linked list for contiguous pages])
 
-AC_MSG_CHECKING([for sbrk])
-HAVE_SBRK=""
-AC_RUN_IFELSE(
-    [AC_LANG_PROGRAM(
-	    [[
-		#include <unistd.h>
-		#include <stdio.h>
-	    ]],
-	    [[
-		FILE *f;
-		if (!(f=fopen("conftest1","w")))
-		   return -1;
-		   fprintf(f,"%p",sbrk(0));
-	    ]])],
-    [HAVE_SBRK=1;AC_MSG_RESULT([yes])],
-    AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]),
-    AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]))
-
-if test "$use" = "386-macosx" ; then
-    AC_MSG_RESULT([emulating sbrk for mac]);
-    HAVE_SBRK=0
-fi
-
-if test "$HAVE_SBRK" = "1" ; then
-
-    AC_MSG_CHECKING([for ADDR_NO_RANDOMIZE constant])
-    AC_RUN_IFELSE(
-	[AC_LANG_PROGRAM(
-		[[
-		    #include <sys/personality.h>
- 		    #include <stdio.h>
-		]],
-		[[
-		    FILE *f;
-		    if (!(f=fopen("conftest1","w"))) return -1;
-		       fprintf(f,"%x",ADDR_NO_RANDOMIZE);
-		]])],
-	[ADDR_NO_RANDOMIZE=`cat conftest1`
-	 AC_MSG_RESULT([yes $ADDR_NO_RANDOMIZE])],
-	[ADDR_NO_RANDOMIZE=0
-	 AC_MSG_RESULT([no assuming 0x40000])
-	 AC_DEFINE_UNQUOTED(ADDR_NO_RANDOMIZE,0x40000,[punt guess for no randomize value])])
-
-    AC_MSG_CHECKING([for ADDR_COMPAT_LAYOUT constant])
-    AC_RUN_IFELSE(
-	[AC_LANG_PROGRAM(
-		[[
-		    #include <sys/personality.h>
- 		    #include <stdio.h>
-		]],
-		[[
-		    FILE *f;
-		    if (!(f=fopen("conftest1","w"))) return -1;
-		       fprintf(f,"%x",ADDR_COMPAT_LAYOUT);
-		]])],
-	[ADDR_COMPAT_LAYOUT=`cat conftest1`
-	 AC_MSG_RESULT([yes $ADDR_COMPAT_LAYOUT])],
-	[ADDR_COMPAT_LAYOUT=0
-	 AC_MSG_RESULT([no])]
-	AC_DEFINE_UNQUOTED(ADDR_COMPAT_LAYOUT,0,[constant to reserve upper 3Gb for C stack]))
-
-    AC_MSG_CHECKING([for ADDR_LIMIT_3GB constant])
-    AC_RUN_IFELSE(
-	[AC_LANG_PROGRAM(
-		[[
-		    #include <sys/personality.h>
- 		    #include <stdio.h>
-		]],
-		[[
-		    FILE *f;
-		    if (!(f=fopen("conftest1","w"))) return -1;
-		       fprintf(f,"%x",ADDR_LIMIT_3GB);
-		]])],
-	[ADDR_LIMIT_3GB=`cat conftest1`
-	 AC_MSG_RESULT([yes $ADDR_LIMIT_3GB])],
-	[ADDR_LIMIT_3GB=0
-	 AC_MSG_RESULT([no])]
-	AC_DEFINE_UNQUOTED(ADDR_LIMIT_3GB,0,[only 3Gb of address space]))
-
-    AC_MSG_CHECKING([for personality(ADDR_NO_RANDOMIZE) support])
-    AC_RUN_IFELSE(
-	[AC_LANG_SOURCE(
-		[[
-                    #include <unistd.h>
-		    #include <stdio.h>
-		    #include <stdlib.h>
-		    int main(int argc,char *argv[],char *envp[]) {
-			#include "h/unrandomize.h"
-			return 0;
-		    }
-		]])],
-	[AC_MSG_RESULT(yes)
-	 AC_DEFINE(CAN_UNRANDOMIZE_SBRK,1,[can prevent sbrk from returning random values])],
-	[AC_MSG_RESULT(no)])
-
-    AC_MSG_CHECKING([that sbrk is (now) non-random])
-    SBRK=0
-    AC_RUN_IFELSE(
-	[AC_LANG_SOURCE(
-		[[
-                    #include <unistd.h>
-		    #include <stdio.h>
-		    #include <stdlib.h>
-		    int main(int argc,char * argv[],char * envp[]) {
-			FILE *f;
-			#ifdef CAN_UNRANDOMIZE_SBRK
-			#include "h/unrandomize.h"
-			#endif
-			if (!(f=fopen("conftest1","w")))
-			   return -1;
-			   fprintf(f,"%p",sbrk(0));
-			   return 0;
-		    }
-		]])],[SBRK=`cat conftest1`])
-    if test "$SBRK" = "0" ; then
-	AC_MSG_ERROR([cannot trap sbrk])
-    fi
-
-    SBRK1=0
-    AC_RUN_IFELSE(
-	[AC_LANG_SOURCE(
-		[[
-                    #include <unistd.h>
-		    #include <stdio.h>
-		    #include <stdlib.h>
-		    int main(int argc,char * argv[],char * envp[]) {
-			FILE *f;
-			#ifdef CAN_UNRANDOMIZE_SBRK
-			#include "h/unrandomize.h"
-			#endif
-			if (!(f=fopen("conftest1","w"))) return -1;
-			   fprintf(f,"%p",sbrk(0));
-			   return 0;
-		    }
-		]])],[SBRK1=`cat conftest1`])
-    if test "$SBRK1" = "0" ; then
-	AC_MSG_ERROR([cannot trap sbrk])
-    fi
-    if test "$SBRK" = "$SBRK1" ; then
-	AC_MSG_RESULT([yes])
-    else
-	AC_MSG_RESULT([no])
-	echo "Cannot build with randomized sbrk. Your options:"
-	echo " - upgrade to a kernel/libc that knows about personality(ADDR_NO_RANDOMIZE)"
-	echo " - recompile your kernel with CONFIG_COMPAT_BRK (if it has that option)"
-	echo " - run sysctl kernel.randomize_va_space=0 before using gcl"
-	AC_MSG_ERROR([exiting])
-    fi
-fi
-
 AC_MSG_CHECKING(CSTACK_DIRECTION)
 AC_RUN_IFELSE(
     [AC_LANG_SOURCE(
@@ -1329,9 +1174,6 @@ AC_RUN_IFELSE(
 		#include <stdlib.h>
 		int main(int argc,char **argv,char **envp) {
 		    FILE *fp = fopen("conftest1","w");
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
 		    fprintf(fp,"%d",(alloca(sizeof(void *))>alloca(sizeof(void *))) ? -1 : 1);
 		    fclose(fp);
 		    return 0;
@@ -1340,6 +1182,7 @@ AC_RUN_IFELSE(
 AC_DEFINE_UNQUOTED(CSTACK_DIRECTION,$cstack_direction,[whether C stack grows up or down])
 AC_MSG_RESULT($cstack_direction)
 
+
 AC_MSG_CHECKING([finding CSTACK_ALIGNMENT])
 AC_RUN_IFELSE(
     [AC_LANG_SOURCE(
@@ -1351,9 +1194,6 @@ AC_RUN_IFELSE(
 		    void *b,*c;
 		    FILE *fp = fopen("conftest1","w");
 		    long n;
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
 		    b=alloca(sizeof(b));
 		    c=alloca(sizeof(c));
 		    n=b>c ? b-c : c-b;
@@ -1366,43 +1206,114 @@ AC_RUN_IFELSE(
 AC_DEFINE_UNQUOTED(CSTACK_ALIGNMENT,$cstack_alignment,[C stack alignment])
 AC_MSG_RESULT($cstack_alignment)
 
-cstack_max=-1;
-AC_ARG_ENABLE([cstackmax],[  --enable-cstackmax=xxxx will ensure that the cstack begins below xxxx or fail],
-	      [if test "$enableval" != "" ; then
-	         cstack_max=$enableval;
-		 AC_DEFINE_UNQUOTED([CSTACKMAX],$enableval,[cstack max])
-	       fi])
+if test $cstack_direction -eq 1 ; then
 
+   AC_MSG_CHECKING(CSTACK_TOP)
+   AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+   	    [[
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <unistd.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w"),*f=fopen("/proc/self/maps","r");
+   		    unsigned long i,j;
+		    char b[4096];
+   		    i=(unsigned long)alloca(sizeof(void *));
+		    for (j=0;j<i && fgets(b,sizeof(b),f);)
+		    	sscanf(b,"%x-",&j);
+		    j-=1;
+		    if (j<i) j=-1;
+		    fclose(f);
+   		    fprintf(fp,"0x%lx",j);
+   		    fclose(fp);
+   		    return 0;
+   		}]])],
+       [cstack_top=`cat conftest1`],[cstack_top=0])
+   AC_MSG_RESULT($cstack_top)
+
+   AC_MSG_CHECKING([relocated CSTACK_TOP])
+   AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+   	    [[
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <sys/mman.h>
+   		#include <unistd.h>
+   		#include <errno.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w"),*f=fopen("/proc/self/maps","r");
+   		    unsigned long i,j;
+		    char b[4096],*stack_map_base;
+		    #include "h/cstack.h"
+   		    i=(unsigned long)alloca(sizeof(void *));
+		    for (j=0;j<i && fgets(b,sizeof(b),f);)
+		    	sscanf(b,"%x-",&j);
+		    j-=1;
+		    if (j<i) j=-1;
+		    fclose(f);
+   		    fprintf(fp,"0x%lx",j);
+   		    fclose(fp);
+   		    return 0;
+   		}]])],
+      [cstack_top=`cat conftest1`],[cstack_top=0])
+   AC_MSG_RESULT($cstack_top)
 
-AC_MSG_CHECKING(CSTACK_ADDRESS)
-AC_RUN_IFELSE(
-    [AC_LANG_SOURCE(
-	    [[
-		#include <stdio.h>
-		#include <stdlib.h>
-		int
-		main(int argc,char **argv,char **envp) {
-		    FILE *fp = fopen("conftest1","w");
-		    unsigned long i,j;
- 
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    j=1;
-		    j<<=$PAGEWIDTH;
-		    j<<=16;
-		    i=(unsigned long)alloca(sizeof(void *));
-		    if ($cstack_direction==1) i-=j;
-		    j--;
-		    i+=j;
-		    i&=~j;
-		    fprintf(fp,"0x%lx",i-1);
-		    fclose(fp);
-		    return 0;
-		}]])],
-    [cstack_address=`cat conftest1`],[cstack_address=0])
-AC_DEFINE_UNQUOTED(CSTACK_ADDRESS,$cstack_address,[starting C stack address])
-AC_MSG_RESULT($cstack_address)
+else
+
+   AC_MSG_CHECKING(CSTACK_TOP)
+   AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+   	    [[
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <unistd.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w");
+   		    unsigned long i,j;
+   		    j=getpagesize();
+   		    i=(unsigned long)alloca(sizeof(void *));
+   		    j--;
+   		    i+=j;
+   		    i&=~j;
+   		    fprintf(fp,"0x%lx",i-1);
+   		    fclose(fp);
+   		    return 0;
+   		}]])],
+       [cstack_top=`cat conftest1`],[cstack_top=0])
+   AC_MSG_RESULT($cstack_top)
+
+   AC_MSG_CHECKING([relocated CSTACK_TOP])
+   AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+   	    [[
+   		#include <stdio.h>
+   		#include <stdlib.h>
+   		#include <sys/mman.h>
+   		#include <unistd.h>
+   		#include <errno.h>
+   		int
+   		main(int argc,char **argv,char **envp) {
+   		    FILE *fp = fopen("conftest1","w");
+   		    unsigned long i,j;
+		    char *stack_map_base;
+   		    #include "h/cstack.h"
+   		    j=getpagesize();
+   		    i=(unsigned long)alloca(sizeof(void *));
+   		    j--;
+   		    i+=j;
+   		    i&=~j;
+   		    fprintf(fp,"0x%lx",i-1);
+   		    fclose(fp);
+   		    return 0;
+   		}]])],
+      [cstack_top=`cat conftest1`],[cstack_top=0])
+   AC_MSG_RESULT($cstack_top)
+
+fi
 
 AC_MSG_CHECKING([cstack bits])
 AC_RUN_IFELSE(
@@ -1410,20 +1321,18 @@ AC_RUN_IFELSE(
 	    [[
 		#include <stdio.h>
 		#include <stdlib.h>
+		#include <unistd.h>
+		#include <sys/mman.h>
+		#include <unistd.h>
+		#include <errno.h>
 		int
 		main(int argc,char **argv,char **envp) {
-		    void *v ;
 		    FILE *fp = fopen("conftest1","w");
 		    long i,j;
- 
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    j=1;
-		    j<<=$PAGEWIDTH;
-		    j<<=16;
-		    i=(long)&v;
-		    if ($cstack_direction==1) i-=j;
+		    char *stack_map_base;
+		    #include "h/cstack.h"
+		    j=getpagesize();
+		    i=$cstack_top;
 		    j--;
 		    i+=j;
 		    i&=~j;
@@ -1433,61 +1342,61 @@ AC_RUN_IFELSE(
 		    return 0;
 		}]])],
     [cstack_bits=`cat conftest1`],[cstack_bits=0])
-AC_DEFINE_UNQUOTED(CSTACK_BITS,$cstack_bits,[log starting C stack address])
 AC_MSG_RESULT($cstack_bits)
 
+
 AC_MSG_CHECKING(NEG_CSTACK_ADDRESS)
 AC_RUN_IFELSE(
     [AC_LANG_SOURCE(
 	    [[
 		#include <stdio.h>
 		#include <stdlib.h>
+		#include <unistd.h>
+		#include <sys/mman.h>
+		#include <unistd.h>
+		#include <errno.h>
 		int
 		main(int argc,char **argv,char **envp) {
-		    #ifdef CAN_UNRANDOMIZE_SBRK
-		    #include "h/unrandomize.h"
-		    #endif
-		    return (long)$cstack_address<0 ? 0 : -1;
+	            char *stack_map_base;
+		    #include "h/cstack.h"
+		    return (long)$cstack_top<0 ? 0 : -1;
 		}]])],
     [AC_MSG_RESULT(yes)
-     neg_cstack_address=1
-     AC_DEFINE(NEG_CSTACK_ADDRESS,1,[C stack address is negative])],
+     neg_cstack_address=1],
     [AC_MSG_RESULT(no)
      neg_cstack_address=0])
 
+
 AC_ARG_ENABLE([immfix],[  --enable-immfix will enable an immediate fixnum table above the C stack])
 
 AC_ARG_ENABLE([fastimmfix],[  --enable-fastimmfix=XXXX will reject low immediate fixnums unless 2^XXX can be attained],,[enable_fastimmfix=64])
 
-
-if test "$use" != "386-gnu" ; then #hurd can push .data below C stack, but sbrk(0) remains above, foiling unexec
-
-    AC_MSG_CHECKING([finding default linker script])
-    touch unixport/gcl.script
-    echo "int main() {return 0;}" >foo.c
-    $CC $LDFLAGS -Wl,--verbose foo.c -o foo 2>&1 | \
+AC_MSG_CHECKING([finding default linker script])
+touch unixport/gcl.script
+echo "int main() {return 0;}" >foo.c
+$CC $LDFLAGS -Wl,--verbose foo.c -o foo 2>&1 | \
 	$AWK '/==================================================/ {i=1-i;next} {if (i) print}' >gcl.script
-    rm -rf foo.c foo
+rm -rf foo.c foo
 
-    if test "`cat gcl.script | wc -l`" != "0" ; then
+if test "`cat gcl.script | wc -l`" != "0" ; then
 	AC_MSG_RESULT(got it)
 
 	AC_MSG_CHECKING([output_arch])
 	output_arch=`cat gcl.script |grep OUTPUT_ARCH|head -n 1|sed 's,.*(\(.*\)).*,\1:,1'|cut -f1 -d:|tr '-' '_'`;
 	if test "$output_arch" != "" ; then
 	    AC_DEFINE_UNQUOTED(OUTPUT_ARCH,bfd_arch_${output_arch},[bfd output arch])
-     	    AC_MSG_RESULT([bfd_arch_${output_arch}])
+ 	    AC_MSG_RESULT([bfd_arch_${output_arch}])
 	else
-     	    AC_MSG_RESULT([not found])
+ 	    AC_MSG_RESULT([not found])
 	fi
 	AC_MSG_CHECKING([output_mach])
 	output_mach=`cat gcl.script |grep OUTPUT_ARCH|head -n 1|sed 's,.*(\(.*\)).*,\1:,1'|cut -f2 -d:|tr '-' '_'|tr -d '.'`;
-dnl     FIXME
-        if test "$output_mach" = "common" ; then
+
+    if test "$output_mach" = "common" ; then #FIXME
 	   output_mach=""
 	fi
 	defaulted=""
-        if test "$output_mach" = "" ; then
+    if test "$output_mach" = "" ; then
 		if test "$output_arch" = "i386" ; then
 		   output_mach="i386_i386";
 		   defaulted="(defaulted)"
@@ -1495,9 +1404,9 @@ dnl     FIXME
 	fi
 	if test "$output_mach" != "" ; then
 	    AC_DEFINE_UNQUOTED(OUTPUT_MACH,bfd_mach_${output_mach},[bfd output mach])
-     	    AC_MSG_RESULT([$defaulted bfd_mach_${output_mach}])
+ 	    AC_MSG_RESULT([$defaulted bfd_mach_${output_mach}])
 	else
-     	    AC_MSG_RESULT([not found])
+ 	    AC_MSG_RESULT([not found])
 	fi
 
 	AC_MSG_NOTICE([trying to adjust text start])
@@ -1509,12 +1418,12 @@ dnl     FIXME
 	max=0;
 	min=$lim;
 	while test $n -lt $lim ; do
-            j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$n </dev/null`
-            cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
+        j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$n </dev/null`
+        cat gcl.script.def | $AWK '/SEGMENT_START/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
 	    #        diff -u gcl.script.def gcl.script
-            echo "int main() {return 0;}" >foo.c
-            if ( $CC $LDFLAGS -Wl,-T gcl.script foo.c -o foo >/dev/null 2>&1 && ./foo >/dev/null 2>&1 ) >/dev/null 2>&1 ; then
-		if test $n -lt $min ; then min=$n; fi;
+        echo "int main() {return 0;}" >foo.c
+        if ( $CC $LDFLAGS -Wl,-T gcl.script foo.c -o foo >/dev/null 2>&1 && ./foo >/dev/null 2>&1 ) >/dev/null 2>&1 ; then
+		if test $n -lt $min; then min=$n; fi;
 		if test $n -gt $max; then max=$n; fi;
 	    elif test $max -gt 0 ; then
 	    	# Workaround for false island of acceptability on riscv64, 20240716
@@ -1524,44 +1433,58 @@ dnl     FIXME
 		   min=$lim
 		   max=0;
 		fi
-            fi;
-            n=`$AWK 'END {print n+1}' n=$n </dev/null`
+        fi;
+        n=`$AWK 'END {print n+1}' n=$n </dev/null`
 	done
 
 	AC_MSG_NOTICE([min log text start $min])
 	AC_MSG_NOTICE([max log text start $max])
 
 	if test $neg_cstack_address -eq 1 ; then #FIXME test this
-      	    if test $cstack_bits -lt $max ; then
+  	    if test $cstack_bits -lt $max ; then
 		max=$cstack_bits;
 		AC_MSG_NOTICE([max log text start reduced to $max considering c stack address])
 	    fi
 	fi
 
+	# Need to get over default cstack and related maps between 0x1000000 and 0x2000000
+	if test "$use" == "386-gnu" || test "$use" == "amd64-gnu" ; then
+	   if test "$use" == "386-gnu" ; then
+	      q=24;
+	   else
+	      q=23;
+	   fi
+	   if test $min -lt $q && test $q -lt $max && test $q -lt 30; then
+	      min=$q
+	      AC_MSG_NOTICE([min log text start increased to $min over c stack address])
+	   fi
+	fi
+
+
 	j=-1;
 	low_shft="";
 	if test $min -le $max ; then
-            if test $max -ge $enable_fastimmfix && test "$enable_immfix" != "no" ; then
+        if test $max -ge $enable_fastimmfix && test "$enable_immfix" != "no" ; then
 	        j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$max </dev/null`
 		low_shft=`$AWK 'END {print n+1}' n=$max </dev/null`;
 		AC_MSG_NOTICE([raising log text to 0x$j for a $max bit wide low immfix table])
-            else					
+        else
 	        j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$min </dev/null`
 		AC_MSG_NOTICE([lowering log text to 0x$j to maximize data area])
 	    fi
 	fi
 
 	if test "$low_shft" != "" ; then
-            AC_DEFINE_UNQUOTED(LOW_SHFT,$low_shft,[upper immediate fixnum bound])      	 
-            AC_DEFINE_UNQUOTED(OBJNULL,(object)0x$j,[lowest address non-object])      	 
+        AC_DEFINE_UNQUOTED(LOW_SHFT,$low_shft,[upper immediate fixnum bound])
+        AC_DEFINE_UNQUOTED(OBJNULL,(object)0x$j,[lowest address non-object])
 	else 
-            AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])      	 
+        AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
 	fi 
 
 	#      echo $j;
 	AC_MSG_CHECKING([our linker script])
 	if test "$j" != "-1" ; then
-            cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
+        cat gcl.script.def | $AWK '/SEGMENT_START/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
 	    AC_MSG_RESULT([done])
 	    rm -f gcl.script.def
 	    assert_arg_to_ldflags -Wl,-T,gcl.script
@@ -1571,16 +1494,16 @@ dnl     FIXME
 	    rm -f gcl.script gcl.script.def
 	fi
 	rm -rf foo.c foo
-    else
-        AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
-	AC_MSG_RESULT([not found])
-    fi
-
 else
-
     AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
-
+    AC_MSG_RESULT([not found])
 fi
+
+#else
+
+#    AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
+
+#fi
 AC_DEFINE_UNQUOTED(CSSIZE,$enable_cssize,[maximum C stack size])
 
 mem_top=0
@@ -1596,8 +1519,7 @@ AC_RUN_IFELSE(
 		FILE *fp = fopen("conftest1","w");
 
 		for (i=2,k=1;i;k=i,i<<=1);
-		l=$cstack_address;
-		l=$cstack_direction==1 ? (l<k ? k-1 : $cstack_max) : l;
+		l=$cstack_top;
 		for (i=j=k;j && i<l;j>>=1,i|=j);
 		if (j<(k>>3)) i=0;
 		j=1;
@@ -1631,10 +1553,6 @@ if test "$mem_top" != "0x0" ; then
 		]])],
 	[mem_range=`cat conftest1`],[mem_range="0x0"])
     AC_MSG_RESULT($mem_range)
-    if test "$mem_range" != "0x0" ; then
-	AC_DEFINE_UNQUOTED(MEM_TOP,$mem_top,[beginning address for immediate fixnum range])
-        AC_DEFINE_UNQUOTED(MEM_RANGE,$mem_range,[size of immediate fixnum address space])
-    fi
 fi
 
 if test "$enable_immfix" != "no" ; then
@@ -2255,36 +2173,28 @@ if test "$enable_tcltk" != "no" ; then
 	AC_CHECK_PROG(TCLSH,tclsh,tclsh,${TCLSH})
 
 	if test "${TCLSH}" = "" ; then true ; else
-
-	    rm -f conftest.tcl
-	    cat >> conftest.tcl <<EOF
-[
-puts [set tcl_version]
-]
-EOF
-
-	    TCL_VERSION=`${TCLSH} < conftest.tcl`
+	    TCL_VERSION=`echo '[puts [set tcl_version]]' | ${TCLSH}`
 	fi
 
-	if test -x /usr/lib/tcl$TCL_VERSION/tclConfig.sh ; then
+	if test -e /usr/lib/tcl$TCL_VERSION/tclConfig.sh ; then
 	    TCL_CONFIG_PREFIX=/usr/lib/tcl$TCL_VERSION
 	fi
 
     fi
 
-    if test -f ${TCL_CONFIG_PREFIX}/tclConfig.sh  ; then . ${TCL_CONFIG_PREFIX}/tclConfig.sh ; fi
+    if test -e ${TCL_CONFIG_PREFIX}/tclConfig.sh  ; then . ${TCL_CONFIG_PREFIX}/tclConfig.sh ; fi
 
     if test -d "${TK_CONFIG_PREFIX}"  ; then true ; else
-	if test -f ${TCL_CONFIG_PREFIX}/tkConfig.sh ; then
+	if test -e ${TCL_CONFIG_PREFIX}/tkConfig.sh ; then
 	    TK_CONFIG_PREFIX=${TCL_CONFIG_PREFIX}
 	else
-	    if test -x `echo $TCL_CONFIG_PREFIX | sed 's,tcl,tk,g'`/tkConfig.sh ; then
+	    if test -e `echo $TCL_CONFIG_PREFIX | sed 's,tcl,tk,g'`/tkConfig.sh ; then
 		TK_CONFIG_PREFIX=`echo $TCL_CONFIG_PREFIX | sed 's,tcl,tk,g'`
 	    fi
 	fi
     fi
 
-    if test -f ${TK_CONFIG_PREFIX}/tkConfig.sh  ; then . ${TK_CONFIG_PREFIX}/tkConfig.sh ; fi
+    if test -e ${TK_CONFIG_PREFIX}/tkConfig.sh  ; then . ${TK_CONFIG_PREFIX}/tkConfig.sh ; fi
 
     if test -d ${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION} ; then
 	TCL_LIBRARY=${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION}
@@ -2302,24 +2212,24 @@ EOF
 	fi
     fi
 
-    if test -f ${TCL_CONFIG_PREFIX}/../include/tcl.h ; then
+    if test -e ${TCL_CONFIG_PREFIX}/../include/tcl.h ; then
 	TCL_INCLUDE=-I${TCL_CONFIG_PREFIX}/../include
     else
-	if test -f /usr/include/tcl${TCL_VERSION}/tcl.h ; then
+	if test -e /usr/include/tcl${TCL_VERSION}/tcl.h ; then
 	    TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
 	fi
     fi
 
-    if test -f ${TK_CONFIG_PREFIX}/../include/tk.h ; then
+    if test -e ${TK_CONFIG_PREFIX}/../include/tk.h ; then
 	TK_INCLUDE=-I${TK_CONFIG_PREFIX}/../include
     else
-	if test -f /usr/include/tcl${TCL_VERSION}/tk.h ; then
+	if test -e /usr/include/tcl${TCL_VERSION}/tk.h ; then
 	    TK_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
 	fi
     fi
 
     TCL_VERSION_DOT_FREE=`echo ${TCL_VERSION} | tr -d .`
-    if test -f ${TK_CONFIG_PREFIX}/../bin/tcl${TCL_VERSION_DOT_FREE}.dll  ; then
+    if test -e ${TK_CONFIG_PREFIX}/../bin/tcl${TCL_VERSION_DOT_FREE}.dll  ; then
 	TCL_LIBS="-L${TK_CONFIG_PREFIX}/../bin -ltk${TCL_VERSION_DOT_FREE} -ltcl${TCL_VERSION_DOT_FREE}"
 	TCL_STUB_LIBS="-L${TK_CONFIG_PREFIX}/lib -ltkstub${TCL_VERSION_DOT_FREE} -ltclstub${TCL_VERSION_DOT_FREE}"
     else
--- gcl27-2.7.0.orig/gcl-tk/comm.c
+++ gcl27-2.7.0/gcl-tk/comm.c
@@ -181,7 +181,7 @@ int m;
     { bcopy(sfd->valid_data,sfd->read_buffer,sfd->valid_data_size);
       sfd->valid_data=sfd->read_buffer;}
    /* there is at least a packet size of space available */   
-  if ((fix(FFN(fScheck_fd_for_input)(sfd->fd,sfd->write_timeout))>0)) {
+  if (((fixnum)(FFN(fScheck_fd_for_input)(sfd->fd,sfd->write_timeout))>0)) {
   again:
     {
       char *start = sfd->valid_data+sfd->valid_data_size;
--- /dev/null
+++ gcl27-2.7.0/gcl.Portfile
@@ -0,0 +1,86 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+PortSystem          1.0
+PortGroup           conflicts_build 1.0
+
+name                gcl
+version             2.6.14
+revision            0
+categories          lang
+license             GPL-2+
+platforms           darwin
+maintainers         nomaintainer
+
+description         GNU Common Lisp
+long_description    GCL is the official Common Lisp for the GNU project. \
+                    Its design makes use of the system's C compiler to \
+                    compile to native object code, providing for both \
+                    good performance and facile portability.
+homepage            https://www.gnu.org/software/gcl
+
+# arm64 requires future works
+# See: https://savannah.gnu.org/bugs/index.php?63875
+# i386/ppc seems to be broken for a while. Seems that only x86_64
+supported_archs     x86_64
+
+depends_lib         port:gettext \
+                    port:gmp \
+                    port:readline
+
+master_sites        gnu
+
+extract.rename      yes
+
+checksums           rmd160  d64bb58a38ce45d6c4cf67cec4dff1dc52197a55 \
+                    sha256  09f3417c512aa1733a638809d3a63ac290eeb9448be82795f5b6681bd307345a \
+                    size    11725385
+
+patchfiles          dont-override-CC-or-MACOSX_DEPLOYMENT_TARGET.patch \
+                    fix-memory-corruption-on-macOS.patch \
+                    old-macOS.patch
+
+
+conflicts_build-append \
+                    ${name}
+
+# checking for required object alignment... configure: error: Cannot find object alignent
+universal_variant   no
+
+configure.args      --disable-notify \
+                    --disable-statsysbfd \
+                    --enable-ansi \
+                    --enable-custreloc \
+                    --enable-emacsdir=${prefix}/share/emacs/site-lisp/gcl \
+                    --enable-infodir=${prefix}/share/info \
+                    --enable-readline \
+                    --without-x \
+                    --disable-xgcl
+
+# prevent it from picking system emacs
+configure.args-append ac_cv_path_EMACS=
+# anyway, we need to provide the right path to default.el
+post-configure {
+    reinplace "s|EMACS_DEFAULT_EL=|EMACS_DEFAULT_EL=${prefix}/etc/default.el|g" makedefs makedefc
+}
+
+# /usr/bin/libtool: object: ... malformed object (unknown load command 1)
+if {${os.platform} eq "darwin" && ${os.major} <= 10} {
+    depends_build-append \
+                    port:cctools
+
+    post-patch {
+        reinplace   "s|/usr/bin/libtool|${prefix}/bin/libtool|g" \
+                    h/386-macosx.defs \
+                    h/powerpc-macosx.defs
+    }
+}
+
+use_parallel_build no
+
+variant x11 {
+    depends_lib-append  port:xorg-libX11
+    configure.args-delete --without-x --disable-xgcl
+    configure.args-append --with-x --enable-xgcl \
+                          --x-includes=${prefix}/include \
+                          --x-libraries=${prefix}/lib
+}
--- /dev/null
+++ gcl27-2.7.0/gcl.cygport
@@ -0,0 +1,124 @@
+<<<<<<< HEAD
+NAME="gcl27"
+VERSION=2.7.0
+RELEASE=1
+HOMEPAGE="https://www.gnu.org/software/gcl/"
+
+PKG_NAMES="${PN} ${PN}-tk ${PN}-doc ${PN}-tk-doc elpa-${PN}"
+
+SRC_URI="git://git@git.sv.gnu.org/gcl.git;protocol=ssh;branch=master;"
+=======
+GIT_URI="git://git.sv.gnu.org/gcl.git"
+GIT_BRANCH="Version_2_6_15pre"
+inherit git.cygclass
+
+
+NAME="gcl"
+VERSION=2.6.15
+RELEASE=1
+HOMEPAGE="https://www.gnu.org/software/gcl/"
+
+PKG_NAMES="${PN}"
+
+#SRC_URI="git://git@git.sv.gnu.org/gcl.git;protocol=ssh;branch=master;"
+SRC_DIR=gcl/gcl"
+>>>>>>> sbrk_mmap_test
+
+# HG_URI="http://hg.code.sf.net/p/clisp/clisp"
+# HG_REV=16678
+# inherit hg
+
+# The following was sent upstream but not applied yet.
+# PATCH_URI+=" http://sourceforge.net/p/clisp/patches/39/attachment/04-uuid.patch"
+
+# The following was rejected upstream
+### PATCH_URI+=" http://sourceforge.net/p/clisp/patches/40/attachment/06-gtk_server_cfg.patch"
+
+# The following aren't ready for upstream.
+#PATCH_URI+=" 20170303-update_modules_syscalls_configure.patch"
+### PATCH_URI+=" 2.49+-gtk2_lib_name.patch"
+#PATCH_URI+=" 2.49-no_cygwin_README.patch"
+#PATCH_URI+=" cygwin-no-save-executable.patch"
+#PATCH_URI+=" 20170306-berkeley_db_test.patch"
+#PATCH_URI+=" 20150312-clx_test.patch"
+#PATCH_URI+=" 20150312-excepsit_test.patch"
+#PATCH_URI+=" 20150312-gdbm_test.patch"
+#PATCH_URI+=" 20150312-libsvm_test.patch"
+
+#PATCH_URI+=" 20170324-path_test.patch"
+
+#PATCH_URI+=" 20170306-rawsock_test.patch"
+#PATCH_URI+=" 20150312-postgresql_test.patch"
+#PATCH_URI+=" 20170306-socket_test.patch"
+#PATCH_URI+=" 20170306-syscalls_test.patch"
+
+#PATCH_URI+=" 20170306-berkeley_db_txn_recover.patch"
+#PATCH_URI+=" 2.49.92-fix_dllimport.patch"
+#PATCH_URI+=" 2.49.92-my_realpath.patch"
+
+# The following works around the clx build problem reported here:
+# https://sourceforge.net/p/clisp/mailman/clisp-devel/thread/8b7ee413-fa96-d0ef-004c-4079be6939c9%40cornell.edu/#msg35700257
+#PATCH_URI+=" 2.49.92-clx.patch"
+
+gcl_CATEGORY="Devel Interpreters Math Shells"
+gcl_SUMMARY="A Common Lisp implementation"
+gcl_DESCRIPTION="GNU Common Lisp (GCL) is a Common Lisp compiler and interpreter
+ implemented in C, and complying both with the ANSI standard and with the standard set 
+ forth in the book "Common Lisp, the Language I".  It attempts
+ to strike a useful middle ground in performance and portability
+ from its design around C."
+gcl27_CONTENTS="
+usr
+"
+
+MAKEOPTS+=" -j1"
+
+DEPEND="
+	libeditreadline-devel
+	tk8.6-devel
+	libgmp-devel
+	libxmu-devel
+	libxaw7-devel
+	zlib1g-devel
+	libtirpc-devel
+"
+
+# The test suite claims that win32 can't be found.  The testsuite for
+# libsvm takes hours to run, so I don't do it routinely.
+#CHECK_MODULES="rawsock dirkey pcre gdbm berkeley-db postgresql fastcgi zlib gtk2 dbus clx/new-clx"
+#MODULES="${CHECK_MODULES} bindings/win32 libsvm"
+
+WITHMODS="--with-modules=$(echo ${MODULES} | sed -e's, , --with-modules=,g')"
+CYGCONF_ARGS="--mandir=/usr/share/man --enable-infodir=/usr/share/info --enable-emacsdir=/usr/share/emacs/site-lisp"
+
+#LDFLAGS="-Wl,--stack,0x800000"
+#export LDFLAGS
+
+# do not strip for (disassemble)
+#RESTRICT="debuginfo strip"
+
+src_compile() {
+    cd ${S}
+    export CFLAGS="-g -O2"
+    verbose ./configure --prefix=/usr ${CYGCONF_ARGS} \
+	     || error "configure failed"
+    cd ${S}
+    cygmake
+}
+
+src_install() {
+    cd ${S}
+    cyginstall
+}
+
+# clx and dbus tests have to be run under X.  Sometimes the clx test
+# hangs or produces failures and has to be run manually: 'cd ${B};
+# make full-mod-check MODULES=clx/new-clx'.
+
+src_test() {
+    cd ${S}
+#    # find . -name '*.dll' | rebase -OT -
+#    make -k check || true
+#    make -k base-mod-check || true
+#    make -k full-mod-check MODULES="${CHECK_MODULES}"
+}
--- /dev/null
+++ gcl27-2.7.0/gcl27.Portfile
@@ -0,0 +1,86 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+PortSystem          1.0
+PortGroup           conflicts_build 1.0
+
+name                gcl
+version             2.6.14
+revision            0
+categories          lang
+license             GPL-2+
+platforms           darwin
+maintainers         nomaintainer
+
+description         GNU Common Lisp
+long_description    GCL is the official Common Lisp for the GNU project. \
+                    Its design makes use of the system's C compiler to \
+                    compile to native object code, providing for both \
+                    good performance and facile portability.
+homepage            https://www.gnu.org/software/gcl
+
+# arm64 requires future works
+# See: https://savannah.gnu.org/bugs/index.php?63875
+# i386/ppc seems to be broken for a while. Seems that only x86_64
+supported_archs     x86_64
+
+depends_lib         port:gettext \
+                    port:gmp \
+                    port:readline
+
+master_sites        gnu
+
+extract.rename      yes
+
+checksums           rmd160  d64bb58a38ce45d6c4cf67cec4dff1dc52197a55 \
+                    sha256  09f3417c512aa1733a638809d3a63ac290eeb9448be82795f5b6681bd307345a \
+                    size    11725385
+
+patchfiles          dont-override-CC-or-MACOSX_DEPLOYMENT_TARGET.patch \
+                    fix-memory-corruption-on-macOS.patch \
+                    old-macOS.patch
+
+
+conflicts_build-append \
+                    ${name}
+
+# checking for required object alignment... configure: error: Cannot find object alignent
+universal_variant   no
+
+configure.args      --disable-notify \
+                    --disable-statsysbfd \
+                    --enable-ansi \
+                    --enable-custreloc \
+                    --enable-emacsdir=${prefix}/share/emacs/site-lisp/gcl \
+                    --enable-infodir=${prefix}/share/info \
+                    --enable-readline \
+                    --without-x \
+                    --disable-xgcl
+
+# prevent it from picking system emacs
+configure.args-append ac_cv_path_EMACS=
+# anyway, we need to provide the right path to default.el
+post-configure {
+    reinplace "s|EMACS_DEFAULT_EL=|EMACS_DEFAULT_EL=${prefix}/etc/default.el|g" makedefs makedefc
+}
+
+# /usr/bin/libtool: object: ... malformed object (unknown load command 1)
+if {${os.platform} eq "darwin" && ${os.major} <= 10} {
+    depends_build-append \
+                    port:cctools
+
+    post-patch {
+        reinplace   "s|/usr/bin/libtool|${prefix}/bin/libtool|g" \
+                    h/386-macosx.defs \
+                    h/powerpc-macosx.defs
+    }
+}
+
+use_parallel_build no
+
+variant x11 {
+    depends_lib-append  port:xorg-libX11
+    configure.args-delete --without-x --disable-xgcl
+    configure.args-append --with-x --enable-xgcl \
+                          --x-includes=${prefix}/include \
+                          --x-libraries=${prefix}/lib
+}
--- /dev/null
+++ gcl27-2.7.0/gcl27.cygport
@@ -0,0 +1,119 @@
+GIT_URI="git://git.sv.gnu.org/gcl.git"
+GIT_TAG="Version_2_7_0pre39"
+inherit git.cygclass
+
+
+NAME="gcl27"
+VERSION=2.7.0
+RELEASE=1
+HOMEPAGE="https://www.gnu.org/software/gcl/"
+
+PKG_NAMES="${PN}"
+
+#SRC_URI="git://git@git.sv.gnu.org/gcl.git;protocol=ssh;branch=master;"
+SRC_DIR="gcl/gcl"
+
+# HG_URI="http://hg.code.sf.net/p/clisp/clisp"
+# HG_REV=16678
+# inherit hg
+
+# The following was sent upstream but not applied yet.
+# PATCH_URI+=" http://sourceforge.net/p/clisp/patches/39/attachment/04-uuid.patch"
+
+# The following was rejected upstream
+### PATCH_URI+=" http://sourceforge.net/p/clisp/patches/40/attachment/06-gtk_server_cfg.patch"
+
+# The following aren't ready for upstream.
+#PATCH_URI+=" 20170303-update_modules_syscalls_configure.patch"
+### PATCH_URI+=" 2.49+-gtk2_lib_name.patch"
+#PATCH_URI+=" 2.49-no_cygwin_README.patch"
+#PATCH_URI+=" cygwin-no-save-executable.patch"
+#PATCH_URI+=" 20170306-berkeley_db_test.patch"
+#PATCH_URI+=" 20150312-clx_test.patch"
+#PATCH_URI+=" 20150312-excepsit_test.patch"
+#PATCH_URI+=" 20150312-gdbm_test.patch"
+#PATCH_URI+=" 20150312-libsvm_test.patch"
+
+#PATCH_URI+=" 20170324-path_test.patch"
+
+#PATCH_URI+=" 20170306-rawsock_test.patch"
+#PATCH_URI+=" 20150312-postgresql_test.patch"
+#PATCH_URI+=" 20170306-socket_test.patch"
+#PATCH_URI+=" 20170306-syscalls_test.patch"
+
+#PATCH_URI+=" 20170306-berkeley_db_txn_recover.patch"
+#PATCH_URI+=" 2.49.92-fix_dllimport.patch"
+#PATCH_URI+=" 2.49.92-my_realpath.patch"
+
+# The following works around the clx build problem reported here:
+# https://sourceforge.net/p/clisp/mailman/clisp-devel/thread/8b7ee413-fa96-d0ef-004c-4079be6939c9%40cornell.edu/#msg35700257
+#PATCH_URI+=" 2.49.92-clx.patch"
+
+gcl27_CATEGORY="Devel Interpreters Math Shells"
+gcl27_SUMMARY="A Common Lisp implementation"
+gcl27_DESCRIPTION="GNU Common Lisp (GCL) is a Common Lisp compiler and interpreter
+ implemented in C, and complying both with the ANSI standard and with the standard set 
+ forth in the book 'Common Lisp, the Language I'.  It attempts
+ to strike a useful middle ground in performance and portability
+ from its design around C."
+gcl27_CONTENTS="
+usr
+"
+
+MAKEOPTS+=" -j1"
+
+BUILD_REQUIRES="
+	texlive
+	texlive-collection-basic
+	texlive-collection-latex
+	texlive-collection-latexextra
+	texlive-collection-fontsrecommended
+	texinfo
+	libreadline-devel
+	tcl-tk-devel
+	libgmp-devel
+	libXmu-devel
+	libXaw-devel
+	zlib-devel
+	libtirpc-devel
+"
+
+# The test suite claims that win32 can't be found.  The testsuite for
+# libsvm takes hours to run, so I don't do it routinely.
+#CHECK_MODULES="rawsock dirkey pcre gdbm berkeley-db postgresql fastcgi zlib gtk2 dbus clx/new-clx"
+#MODULES="${CHECK_MODULES} bindings/win32 libsvm"
+
+WITHMODS="--with-modules=$(echo ${MODULES} | sed -e's, , --with-modules=,g')"
+CYGCONF_ARGS="--mandir=/usr/share/man --enable-infodir=/usr/share/info --enable-emacsdir=/usr/share/emacs/site-lisp"
+
+#LDFLAGS="-Wl,--stack,0x800000"
+#export LDFLAGS
+
+# do not strip for (disassemble)
+#RESTRICT="debuginfo strip"
+
+src_compile() {
+    cd ${S}
+    export CFLAGS="-g -O2"
+    verbose ./configure --prefix=/usr ${CYGCONF_ARGS} \
+	     || error "configure failed"
+    cd ${S}
+    PEXT=27 cygmake
+}
+
+src_install() {
+    cd ${S}
+    PEXT=27 cyginstall
+}
+
+# clx and dbus tests have to be run under X.  Sometimes the clx test
+# hangs or produces failures and has to be run manually: 'cd ${B};
+# make full-mod-check MODULES=clx/new-clx'.
+
+src_test() {
+    cd ${S}
+#    # find . -name '*.dll' | rebase -OT -
+#    make -k check || true
+#    make -k base-mod-check || true
+#    make -k full-mod-check MODULES="${CHECK_MODULES}"
+}
--- gcl27-2.7.0.orig/git.tag
+++ gcl27-2.7.0/git.tag
@@ -1,2 +1,2 @@
-"Version_2_7_0pre38"
+"Version_2_7_0pre39"
 
--- gcl27-2.7.0.orig/h/386-gnu.h
+++ gcl27-2.7.0/h/386-gnu.h
@@ -63,7 +63,4 @@
 #undef HAVE_D_TYPE /*FIXME defined, but not implemented in readdir*/
 /* #define NO_FILE_LOCKING */ /*FIXME*/
 
-#define INITIALIZE_BRK							\
-  massert(!brk(gcl_alloc_initialized ? core_end :			\
-	       ({extern ufixnum _end;(void *)ROUNDUP((ufixnum)&_end,PAGESIZE);})))
 
--- gcl27-2.7.0.orig/h/amd64-gnu.h
+++ gcl27-2.7.0/h/amd64-gnu.h
@@ -62,7 +62,3 @@
 
 #undef HAVE_D_TYPE /*FIXME defined, but not implemented in readdir*/
 /* #define NO_FILE_LOCKING */ /*FIXME*/
-
-#define INITIALIZE_BRK							\
-  massert(!brk(gcl_alloc_initialized ? core_end :			\
-	       ({extern ufixnum _end;(void *)ROUNDUP((ufixnum)&_end,PAGESIZE);})))
--- /dev/null
+++ gcl27-2.7.0/h/cstack.h
@@ -0,0 +1,54 @@
+#if SIZEOF_LONG == 4
+
+#if defined(__PPC__)
+#define SET_STACK_POINTER "addi %%r1,%0,0\n\t"
+#elif defined(__m68k__)
+#define SET_STACK_POINTER "movel %0,%%sp\n\t"
+#elif defined(__i386__) && !defined(__gnu_hurd__)
+#define SET_STACK_POINTER "mov %0,%%esp\n\t"
+#elif defined(__arm__)
+#define SET_STACK_POINTER "mov %%sp,%0\n\t"
+#elif defined(__hppa__)
+#define SET_STACK_POINTER "copy %0,%%sp\n\t"
+#elif defined(__SH4__)
+#define SET_STACK_POINTER "mov %0,r15\n\t"
+#endif
+
+#define FIXED_STACK (1UL<<23)/*FIXME configure?*/
+#if defined(__SH4__)/*FIXME is this just due to qemu?*/
+#define CTOP (void *)0x80000000
+#define SS FIXED_STACK
+#elif defined(__gnu_hurd__)
+#define CTOP (void *)0xc0000000
+#define SS FIXED_STACK
+#define MAP_GROWSDOWN 0
+#define MAP_STACK 0
+#else
+#define CTOP (void *)0xc0000000/*FIXME configure?*/
+#define SS getpagesize()
+#endif
+
+#ifdef SET_STACK_POINTER
+{
+  void *p,*p1,*b,*s;
+  int a,f=MAP_FIXED|MAP_PRIVATE|MAP_ANON|MAP_STACK;
+
+  p=alloca(1);
+  p1=alloca(1);
+  b=CTOP-(p1<p ? SS : FIXED_STACK);
+  a=p1<p ? p-p1 : p1-p;
+  a<<=2;
+  s=p1<p ? CTOP-a : b+a;
+  if (p1<p) f|=MAP_GROWSDOWN;
+
+  if (p > CTOP || p < b) {
+    if (mmap(b,SS,PROT_READ|PROT_WRITE|PROT_EXEC,f,-1,0)!=(void *)-1) {
+      stack_map_base=b;
+      asm volatile (SET_STACK_POINTER::"r" (s):"memory");
+      if (p1>p)
+	mmap(CTOP,getpagesize(),PROT_NONE,f,-1,0);/*guard page*/
+    }
+  }
+}
+#endif
+#endif
--- gcl27-2.7.0.orig/h/gclincl.h.in
+++ gcl27-2.7.0/h/gclincl.h.in
@@ -1,41 +1,20 @@
 /* h/gclincl.h.in.  Generated from configure.in by autoheader.  */
 
-/* constant to reserve upper 3Gb for C stack */
-#undef ADDR_COMPAT_LAYOUT
-
-/* only 3Gb of address space */
-#undef ADDR_LIMIT_3GB
-
-/* punt guess for no randomize value */
-#undef ADDR_NO_RANDOMIZE
-
 /* binding stack size */
 #undef BDSSIZE
 
 /* sscanf terminates prematurely (Windows XP) */
 #undef BUGGY_MAXIMUM_SSCANF_LENGTH
 
-/* can prevent sbrk from returning random values */
-#undef CAN_UNRANDOMIZE_SBRK
-
 /* running clang compiler */
 #undef CLANG
 
 /* maximum C stack size */
 #undef CSSIZE
 
-/* cstack max */
-#undef CSTACKMAX
-
-/* starting C stack address */
-#undef CSTACK_ADDRESS
-
 /* C stack alignment */
 #undef CSTACK_ALIGNMENT
 
-/* log starting C stack address */
-#undef CSTACK_BITS
-
 /* whether C stack grows up or down */
 #undef CSTACK_DIRECTION
 
@@ -156,6 +135,9 @@
 /* long long is available */
 #undef HAVE_LONG_LONG
 
+/* can madvise hugepages */
+#undef HAVE_MADVISE_HUGEPAGE
+
 /* Define to 1 if you have the <malloc/malloc.h> header file. */
 #undef HAVE_MALLOC_MALLOC_H
 
@@ -291,21 +273,12 @@
 /* upper immediate fixnum bound */
 #undef LOW_SHFT
 
-/* size of immediate fixnum address space */
-#undef MEM_RANGE
-
-/* beginning address for immediate fixnum range */
-#undef MEM_TOP
-
 /* sizeof mp_limb in gmp library */
 #undef MP_LIMB_BYTES
 
 /* binutils requires CONST definition */
 #undef NEED_CONST
 
-/* C stack address is negative */
-#undef NEG_CSTACK_ADDRESS
-
 /* no gettimeofday call */
 #undef NO_GETTOD
 
@@ -372,9 +345,6 @@
 /* rl_readline_name returns type const char */
 #undef RL_READLINE_NAME_TYPE_CONST_CHAR
 
-/* asm string to set the stack pointer */
-#undef SET_STACK_POINTER
-
 /* have sigcontext of signal.h */
 #undef SIGNAL_H_HAS_SIGCONTEXT
 
--- gcl27-2.7.0.orig/h/linux.h
+++ gcl27-2.7.0/h/linux.h
@@ -182,3 +182,7 @@ do { int c = 0; \
 #define FPE_INIT Cnil
 
 #endif
+
+#undef sbrk
+#define sbrk msbrk
+#define INITIALIZE_BRK msbrk_init();
--- gcl27-2.7.0.orig/h/page.h
+++ gcl27-2.7.0/h/page.h
@@ -105,7 +105,7 @@ extern fixnum writable_pages;
 
 
 EXTER long first_data_page,real_maxpage,phys_pages,available_pages;
-EXTER void *data_start,*initial_sbrk;
+EXTER void *data_start;
 
 #if defined(SGC)
 #include "writable.h"
@@ -114,7 +114,7 @@ EXTER void *data_start,*initial_sbrk;
 #define CB_BITS     CPTR_SIZE*CHAR_SIZE
 #define ceil(a_,b_) (((a_)+(b_)-1)/(b_))
 #define npage(m_)   ceil(m_,PAGESIZE)
-#define cpage(m_)   CEI(({ufixnum _m=(m_);ceil(sizeof(struct pageinfo)+_m+2*ceil(_m,(CB_BITS-2)),PAGESIZE);}),256)
+#define cpage(m_)   CEI(({ufixnum _m=(m_);ceil(sizeof(struct pageinfo)+_m+2*ceil(_m,(CB_BITS-2)),PAGESIZE);}),1)
 #define mbytes(p_)  ceil((p_)*PAGESIZE-sizeof(struct pageinfo),CB_BITS)
 #define tpage(tm_,m_) (tm_->tm_type==t_relocatable ? npage(m_-(rb_limit-rb_pointer)+1) : (tm_->tm_type==t_contiguous ? cpage(m_) : npage(m_)))
 
--- gcl27-2.7.0.orig/h/protoize.h
+++ gcl27-2.7.0/h/protoize.h
@@ -1673,3 +1673,6 @@ int is_bigger_fixnum(void *);
 int is_text_addr(void *);
 int seek_to_end_ofile(FILE *);
 void stack_list(void);
+void *msbrk(intptr_t);
+int msbrk_init(void);
+int msbrk_end(void);
--- gcl27-2.7.0.orig/info/c-interface.texi
+++ gcl27-2.7.0/info/c-interface.texi
@@ -5,6 +5,7 @@
 
 @menu
 * Available Symbols::		
+* External Shared Libraries::
 @end menu
 
 @node Available Symbols,  , C Interface, C Interface
@@ -20,8 +21,527 @@ which reference other libraries, but in
 portable.
 
 
+@node External Shared Libraries,  , C Interface, C Interface
+@section External Shared Libraries
 
+@deffn {Macro} DEFDLFUN
+Package:SYSTEM
 
+Syntax:
+@example
+(compile (DEFDLFUN @{RETURN NAME &optional LIBNAME) ARGS*))
+@end example
+
+GCL specific:  Produces an entry function to function NAME in external shared
+library LIBNAME with the specified args/return signature.  This
+function must be compiled to run.  When inlined, the function
+call collapses to a single reference to a pointer which is
+automatically updated to the location of the external function at
+image startup.  The connection to the external library is persistent
+across image saves and re-executions.  The RETURN and ARGS specifiers
+are keywords from the following list corresponding to the accompanying
+C programming types:
+
+    :char :short :int :long :float :double
+
+Unsigned versions available are:
+
+    :uchar :ushort :uint
+
+Complex float and complex double types can be access via:
+
+    :fcomplex :dcomples
+
+Pointers to types available are
+
+     :void* :char* :long* :float* :double*
+
+Example usage:
+
+@example
+
+@verbatim
+
+
+GCL (GNU Common Lisp)  2.7.0 Thu Oct 26 12:00:01 PM EDT 2023  CLtL1    git: Version_2_7_0pre38
+Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
+Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNEXEC)
+Modifications of this banner must retain notice of a compatible license
+Dedicated to the memory of W. Schelter
+
+Use (help) to get some basic information on how to use GCL.
+Temporary directory for compiler files set to /tmp/
+
+>(do-symbols (s :lib) (print s))
+
+LIB:|libm|
+LIB:|libc|
+NIL
+
+>(compile (si::defdlfun (:double "cblas_ddot" "libblas.so") :uint :double* :uint :double* :uint))
+
+;; Compiling /tmp/gazonk_653784_0.lsp.
+;; End of Pass 1.
+;; End of Pass 2.
+OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
+;; Finished compiling /tmp/gazonk_653784_0.o.
+;; Loading #P"/tmp/gazonk_653784_0.o"
+;; start address for /tmp/gazonk_653784_0.o 0x2700860
+;; Finished loading #P"/tmp/gazonk_653784_0.o"
+#<function 0000000001a4a860>
+NIL
+NIL
+
+>(do-symbols (s :lib) (print s))
+
+LIB:|libblas|
+LIB:|libm|
+LIB:|libc|
+NIL
+
+>(do-symbols (s 'lib::|libblas|) (unless (find-symbol (symbol-name s) :user) (print s)))
+
+|libblas|:|cblas_ddot|
+NIL
+NIL
+
+>(setq a (make-array 3 :element-type 'long-float) b (make-array 3 :element-type 'long-float))
+
+#(0.0 0.0 0.0)
+
+>(setf (aref a 1) 1.2 (aref b 1) 2.3)
+
+2.3
+
+>(|libblas|:|cblas_ddot| 3 a 1 b 1)
+
+2.76
+
+>(compile (defun foo (a b) (declare ((vector long-float) a b)) (|libblas|:|cblas_ddot| (length a) a 1 b 1)))
+
+;; Compiling /tmp/gazonk_653784_0.lsp.
+;; End of Pass 1.
+;; End of Pass 2.
+OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
+;; Finished compiling /tmp/gazonk_653784_0.o.
+;; Loading #P"/tmp/gazonk_653784_0.o"
+;; start address for /tmp/gazonk_653784_0.o 0x2715050
+;; Finished loading #P"/tmp/gazonk_653784_0.o"
+#<function 0000000001a62140>
+NIL
+NIL
+
+>(compile (defun bar (a b) (declare (inline |libblas|:|cblas_ddot|) ((vector long-float) a b)) (|libblas|:|cblas_ddot| (length a) a 1 b 1)))
+
+;; Compiling /tmp/gazonk_653784_0.lsp.
+;; End of Pass 1.
+;; End of Pass 2.
+OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
+;; Finished compiling /tmp/gazonk_653784_0.o.
+;; Loading #P"/tmp/gazonk_653784_0.o"
+;; start address for /tmp/gazonk_653784_0.o 0x2729570
+;; Finished loading #P"/tmp/gazonk_653784_0.o"
+#<function 0000000001a62740>
+NIL
+NIL
+
+>(foo a b)
+
+2.76
+
+>(bar a b)
+
+2.76
+
+>(setq compiler::*disassemble-objdump* nil)
+
+NIL
+
+>(disassemble '|libblas|:|cblas_ddot|)
+
+;; Compiling /tmp/gazonk_653784_0.lsp.
+;; End of Pass 1.
+;; End of Pass 2.
+OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
+;; Finished compiling /tmp/gazonk_653784_0.o.
+
+#include "gazonk_653784_0.h"
+void init_code(){do_init((void *)VV);}
+/*	local entry for function libblas::cblas_ddot	*/
+
+static object LI1__cblas_ddot___gazonk_653784_0(fixnum V6,object V7,fixnum V8,object V9,fixnum V10)
+{	 VMB1 VMS1 VMV1
+	if(!(((char)tp0(make_fixnum(V6)))==(1))){
+	goto T8;
+	}
+	if(!((0)<=(V6))){
+	goto T13;
+	}
+	if(!((V6)<=((fixnum)4294967295))){
+	goto T11;
+	}
+	goto T12;
+
+	goto T13;
+T13:;
+	goto T11;
+
+	goto T12;
+T12:;
+	goto T7;
+
+	goto T11;
+T11:;
+	goto T6;
+
+	goto T8;
+T8:;
+	goto T6;
+
+	goto T7;
+T7:;
+	goto T5;
+
+	goto T6;
+T6:;
+	goto T3;
+
+	goto T5;
+T5:;
+	goto T2;
+
+	goto T3;
+T3:;
+	V11= CMPmake_fixnum(V6);
+	V6= fixint((fcall.argd=4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*LnkLI2)(((object)VV[1]),(V11),((object)VV[2]),Cnil)));
+	goto T2;
+T2:;
+	switch(tp6(V7)){
+	case 428:
+	goto T27;
+T27:;
+	case 492:
+	goto T28;
+T28:;
+	goto T25;
+
+	default:
+	goto T29;
+T29:;
+	goto T24;
+
+	goto T24;
+	}
+	goto T24;
+
+	goto T25;
+T25:;
+	goto T23;
+
+	goto T24;
+T24:;
+	goto T22;
+
+	goto T23;
+T23:;
+	goto T21;
+
+	goto T22;
+T22:;
+	goto T19;
+
+	goto T21;
+T21:;
+	goto T18;
+
+	goto T19;
+T19:;
+	V7= (fcall.argd=4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*LnkLI2)(((object)VV[3]),(V7),((object)VV[4]),Cnil));
+	goto T18;
+T18:;
+	if(!(((char)tp0(make_fixnum(V8)))==(1))){
+	goto T39;
+	}
+	if(!((0)<=(V8))){
+	goto T44;
+	}
+	if(!((V8)<=((fixnum)4294967295))){
+	goto T42;
+	}
+	goto T43;
+
+	goto T44;
+T44:;
+	goto T42;
+
+	goto T43;
+T43:;
+	goto T38;
+
+	goto T42;
+T42:;
+	goto T37;
+
+	goto T39;
+T39:;
+	goto T37;
+
+	goto T38;
+T38:;
+	goto T36;
+
+	goto T37;
+T37:;
+	goto T34;
+
+	goto T36;
+T36:;
+	goto T33;
+
+	goto T34;
+T34:;
+	V12= CMPmake_fixnum(V8);
+	V8= fixint((fcall.argd=4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*LnkLI2)(((object)VV[5]),(V12),((object)VV[2]),Cnil)));
+	goto T33;
+T33:;
+	switch(tp6(V9)){
+	case 428:
+	goto T58;
+T58:;
+	case 492:
+	goto T59;
+T59:;
+	goto T56;
+
+	default:
+	goto T60;
+T60:;
+	goto T55;
+
+	goto T55;
+	}
+	goto T55;
+
+	goto T56;
+T56:;
+	goto T54;
+
+	goto T55;
+T55:;
+	goto T53;
+
+	goto T54;
+T54:;
+	goto T52;
+
+	goto T53;
+T53:;
+	goto T50;
+
+	goto T52;
+T52:;
+	goto T49;
+
+	goto T50;
+T50:;
+	V9= (fcall.argd=4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*LnkLI2)(((object)VV[6]),(V9),((object)VV[4]),Cnil));
+	goto T49;
+T49:;
+	if(!(((char)tp0(make_fixnum(V10)))==(1))){
+	goto T70;
+	}
+	if(!((0)<=(V10))){
+	goto T75;
+	}
+	if(!((V10)<=((fixnum)4294967295))){
+	goto T73;
+	}
+	goto T74;
+
+	goto T75;
+T75:;
+	goto T73;
+
+	goto T74;
+T74:;
+	goto T69;
+
+	goto T73;
+T73:;
+	goto T68;
+
+	goto T70;
+T70:;
+	goto T68;
+
+	goto T69;
+T69:;
+	goto T67;
+
+	goto T68;
+T68:;
+	goto T65;
+
+	goto T67;
+T67:;
+	goto T64;
+
+	goto T65;
+T65:;
+	V13= CMPmake_fixnum(V10);
+	V10= fixint((fcall.argd=4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*LnkLI2)(((object)VV[7]),(V13),((object)VV[2]),Cnil)));
+	goto T64;
+T64:;
+	{object V14 = make_longfloat(((double(*)(uint,double*,uint,double*,uint))(dlcblas_ddot))((uint)V6,(double*)V7->v.v_self,(uint)V8,(double*)V9->v.v_self,(uint)V10));
+	VMR1(V14);}
+}
+static object  LnkTLI2(object first,...){object V1;va_list ap;va_start(ap,first);V1=(object )call_proc_new(((object)VV[0]),0,262147,(void **)(void *)&LnkLI2,0,first,ap);va_end(ap);return V1;} /* SYSTEM::CHECK-TYPE-SYMBOL */
+(9 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
+static object LI1__cblas_ddot___gazonk_653784_0(fixnum V6,object V7,fixnum V8,object V9,fixnum V10)
+;
+static void *dlcblas_ddot;
+#define VMB1  object  V13 ,V12 ,V11;
+#define VMS1
+#define VMV1
+#define VMRV1(a_,b_) return((object )a_);
+#define VMR1(a_) VMRV1(a_,0);
+#define VM1 0
+static void * VVi[9]={
+#define Cdata VV[8]
+(void *)(&dlcblas_ddot),
+(void *)(LI1__cblas_ddot___gazonk_653784_0)
+};
+#define VV (VVi)
+static object  LnkTLI2(object,...);
+static object  (*LnkLI2)() = (object (*)()) LnkTLI2;
+NIL
+
+>(disassemble 'foo)
+
+;; Compiling /tmp/gazonk_653784_0.lsp.
+;; End of Pass 1.
+;; End of Pass 2.
+OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
+;; Finished compiling /tmp/gazonk_653784_0.o.
+
+#include "gazonk_653784_0.h"
+void init_code(){do_init((void *)VV);}
+/*	local entry for function COMMON-LISP-USER::FOO	*/
+
+static object LI1__FOO___gazonk_653784_0(object V3,object V4)
+{	 VMB1 VMS1 VMV1
+	if(!(((char)((fixnum)((uchar*)((fixnum)V3))[(fixnum)2]&(fixnum)1))==(0))){
+	goto T5;
+	}
+	goto T2;
+
+	goto T5;
+T5:;
+	V5= ((fixnum)((uint*)((fixnum)V3))[(fixnum)4]&268435455);
+	goto T1;
+
+	goto T2;
+T2:;
+	V5= (((fixnum)((uint*)((fixnum)V3))[(fixnum)1]>>(fixnum)3)&268435455);
+	goto T1;
+T1:;
+	{object V6 = (/* libblas::cblas_ddot */(object )(*LnkLI2)(V5,(V3),(fixnum)1,(V4),(fixnum)1));
+	VMR1(V6);}
+}
+static object  LnkTLI2(object first,...){object V1;va_list ap;va_start(ap,first);V1=(object )call_proc_new(((object)VV[0]),0,5,(void **)(void *)&LnkLI2,1092,first,ap);va_end(ap);return V1;} /* libblas::cblas_ddot */
+(2 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
+static object LI1__FOO___gazonk_653784_0(object V3,object V4)
+;
+#define VMB1  fixnum  V5;
+#define VMS1
+#define VMV1
+#define VMRV1(a_,b_) return((object )a_);
+#define VMR1(a_) VMRV1(a_,0);
+#define VM1 0
+static void * VVi[2]={
+#define Cdata VV[1]
+(void *)(LI1__FOO___gazonk_653784_0)
+};
+#define VV (VVi)
+static object  LnkTLI2(object,...);
+static object  (*LnkLI2)() = (object (*)()) LnkTLI2;
+NIL
+
+>(disassemble 'bar)
+
+;; Compiling /tmp/gazonk_653784_0.lsp.
+;; End of Pass 1.
+;; End of Pass 2.
+OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
+;; Finished compiling /tmp/gazonk_653784_0.o.
+
+#include "gazonk_653784_0.h"
+void init_code(){do_init((void *)VV);}
+/*	local entry for function COMMON-LISP-USER::BAR	*/
+
+static object LI1__BAR___gazonk_653784_0(object V3,object V4)
+{	 VMB1 VMS1 VMV1
+	{fixnum V5;
+	if(!(((char)((fixnum)((uchar*)((fixnum)V3))[(fixnum)2]&(fixnum)1))==(0))){
+	goto T5;
+	}
+	goto T2;
+
+	goto T5;
+T5:;
+	V5= ((fixnum)((uint*)((fixnum)V3))[(fixnum)4]&268435455);
+	goto T1;
+
+	goto T2;
+T2:;
+	V5= (((fixnum)((uint*)((fixnum)V3))[(fixnum)1]>>(fixnum)3)&268435455);
+	goto T1;
+T1:;
+	{object V6 = make_longfloat(((double(*)(uint,double*,uint,double*,uint))(dlcblas_ddot))((uint)V5,(double*)V3->v.v_self,(uint)1,(double*)V4->v.v_self,(uint)1));
+	VMR1(V6);}}
+}
+(2 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
+static object LI1__BAR___gazonk_653784_0(object V3,object V4)
+;
+static void *dlcblas_ddot;
+#define VMB1
+#define VMS1
+#define VMV1
+#define VMRV1(a_,b_) return((object )a_);
+#define VMR1(a_) VMRV1(a_,0);
+#define VM1 0
+static void * VVi[2]={
+#define Cdata VV[1]
+(void *)(&dlcblas_ddot),
+(void *)(LI1__BAR___gazonk_653784_0)
+};
+#define VV (VVi)
+NIL
+
+>(si::save-system "ff")
+$ ./ff
+GCL (GNU Common Lisp)  2.7.0 Thu Oct 26 12:00:01 PM EDT 2023  CLtL1    git: Version_2_7_0pre38
+Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
+Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNEXEC)
+Modifications of this banner must retain notice of a compatible license
+Dedicated to the memory of W. Schelter
+
+Use (help) to get some basic information on how to use GCL.
+Temporary directory for compiler files set to /tmp/
+
+>(foo a b)
+
+2.76
+
+>(bar a b)
+
+2.76
 
+>
 
+@end verbatim
+
+@end example
+
+@end deffn
 
--- gcl27-2.7.0.orig/info/chap-10.texi
+++ gcl27-2.7.0/info/chap-10.texi
@@ -996,7 +996,7 @@ If there is no @i{property} with that @i
 
 @b{setf} of @b{get} may be used to associate a new @i{object}
 with an existing indicator already on the @i{symbol}'s @i{property list},
-or to create a new assocation if none exists.
+or to create a new association if none exists.
 
 If there are multiple @i{properties}_1 with that @i{property indicator},
 @b{setf} of @b{get} associates the @i{new-value} 
--- gcl27-2.7.0.orig/info/chap-14.texi
+++ gcl27-2.7.0/info/chap-14.texi
@@ -160,7 +160,7 @@ and the @i{cdr} is the @i{value} associa
 @w{  assoc  assoc-if-not  rassoc   rassoc-if-not  }
 
 @noindent
-@w{  Figure 14--4: Some defined names related to assocation lists.}
+@w{  Figure 14--4: Some defined names related to association lists.}
 
 @end group
 @end format
@@ -3046,7 +3046,7 @@ If there is no @i{property} with that @i
 
 @b{setf} of @b{getf} may be used to associate a new @i{object}
 with an existing indicator in the @i{property list} held by @i{place},
-or to create a new assocation if none exists.
+or to create a new association if none exists.
 
 If there are multiple @i{properties}_1 with that @i{property indicator},
 @b{setf} of @b{getf} associates the @i{new-value} 
--- gcl27-2.7.0.orig/info/chap-19.texi
+++ gcl27-2.7.0/info/chap-19.texi
@@ -2119,7 +2119,7 @@ is signaled.
 
 @b{translate-logical-pathname} might perform additional translations,
     typically to provide translation of file types to local naming
-    conventions, to accomodate physical file systems with limited length
+    conventions, to accommodate physical file systems with limited length
     names, or to deal with special character requirements such as
     translating hyphens to underscores or uppercase letters to lowercase.
     Any such additional translations are @i{implementation-defined}.  Some
--- gcl27-2.7.0.orig/info/chap-21.texi
+++ gcl27-2.7.0/info/chap-21.texi
@@ -867,9 +867,9 @@ restricted to @b{integer} or a @i{subtyp
 @subsubheading  Examples::
 
 @example
-;; Note that the stream must accomodate at least the specified type,
-;; but might accomodate other types.  Further note that even if it does
-;; accomodate exactly the specified type, the type might be specified in
+;; Note that the stream must accommodate at least the specified type,
+;; but might accommodate other types.  Further note that even if it does
+;; accommodate exactly the specified type, the type might be specified in
 ;; any of several ways.
  (with-open-file (s "test" :element-type '(integer 0 1)
                            :if-exists :error
@@ -2180,7 +2180,7 @@ and some aspects of the @i{file system}
 to define.  A given @i{implementation} might not be able to support all of these options 
 in exactly the manner stated.  An @i{implementation} is required to recognize all of 
 these option keywords and to try to do something ``reasonable'' in the context of the 
-host @i{file system}.  Where necessary to accomodate the @i{file system},
+host @i{file system}.  Where necessary to accommodate the @i{file system},
 an @i{implementation} deviate slightly from the semantics specified here without 
 being disqualified for consideration as a @i{conforming implementation}.
 If it is utterly impossible for an @i{implementation} to handle some option
--- gcl27-2.7.0.orig/info/chap-26.texi
+++ gcl27-2.7.0/info/chap-26.texi
@@ -2218,7 +2218,7 @@ transitive verb
   and that is one of:
       the @i{symbol} @t{:default} 
          (denoting an @i{implementation-dependent} default 
-          @i{external file format} that can accomodate at least
+          @i{external file format} that can accommodate at least
           the @i{base characters}),
       some other @i{object} defined by the @i{implementation} to be
       an @i{external file format designator}
--- gcl27-2.7.0.orig/info/chap-5.texi
+++ gcl27-2.7.0/info/chap-5.texi
@@ -2570,9 +2570,7 @@ The @i{primary value} of each @i{form} i
 
 @subsubheading  Pronunciation::
 
-@b{psetq}: pronounced
-@tex p\=e'set ,ky\"u 
-@end tex
+pronounced p\=e'set ,ky\"u
 
 @subsubheading  Arguments and Values::
 
@@ -3595,7 +3593,7 @@ rather than @b{eql} in a way that cannot
 @subsubheading  Description::
 
 The value of @b{eql} is @i{true} of two objects, @i{x} and
-@i{y}, in the folowing cases:
+@i{y}, in the following cases:
 @table @asis
 
 @item 1.  
--- gcl27-2.7.0.orig/info/chap-9.texi
+++ gcl27-2.7.0/info/chap-9.texi
@@ -681,7 +681,7 @@ the @t{:test} option to @b{restart-case}
 
 A @i{restart} can be ``associated with'' a @i{condition} explicitly
 by @b{with-condition-restarts}, or implicitly by @b{restart-case}.
-Such an assocation has @i{dynamic extent}.
+Such an association has @i{dynamic extent}.
 
 A single @i{restart} may be associated with several @i{conditions} 
 at the same time.
@@ -2075,7 +2075,7 @@ This and the lack of any possibility of
 differences between @b{break} and @b{cerror}.
 
 The user interface aspects of @b{break} and @b{cerror} are
-permitted to vary more widely, in order to accomodate the interface
+permitted to vary more widely, in order to accommodate the interface
 needs of the @i{implementation}. For example, it is permissible for a
 @i{Lisp read-eval-print loop} to be entered by @b{break} rather
 than the conventional debugger.
@@ -3464,7 +3464,7 @@ by the @b{restart-case} clause to receiv
 to @b{invoke-restart}.
 
 By default, @b{invoke-restart-interactively} passes no arguments and
-all arguments must be optional in order to accomodate interactive
+all arguments must be optional in order to accommodate interactive
 restarting.  However, the arguments need not be optional if the
 @t{:interactive} 
 keyword has been used to inform @b{invoke-restart-interactively}
--- gcl27-2.7.0.orig/info/compile.texi
+++ gcl27-2.7.0/info/compile.texi
@@ -261,22 +261,22 @@ GPROF-SET with both argments set to 0.
 
 
 @defvar *DEFAULT-SYSTEM-P*
-Pakcage:COMPILER
+Package:COMPILER
 Specifies the default setting of :SYSTEM-P used by COMPILE.  Defaults to NIL.
 @end defvar
 
 @defvar *DEFAULT-C-FILE*
-Pakcage:COMPILER
+Package:COMPILER
 Specifies the default setting of :C-FILE used by COMPILE.  Defaults to NIL.
 @end defvar
 
 @defvar *DEFAULT-H-FILE*
-Pakcage:COMPILER
+Package:COMPILER
 Specifies the default setting of :H-FILE used by COMPILE.  Defaults to NIL.
 @end defvar
 
 @defvar *DEFAULT-DATA-FILE*
-Pakcage:COMPILER
+Package:COMPILER
 Specifies the default setting of :DATA-FILE used by COMPILE.  Defaults to NIL.
 @end defvar
 
--- gcl27-2.7.0.orig/info/internal.texi
+++ gcl27-2.7.0/info/internal.texi
@@ -139,6 +139,14 @@ language code.  The interpreter ignores
 
 @end deffn
 
+@defun SET-LOG-MAXPAGE-BOUND (positive-integer)
+Package:SYSTEM
+
+GCL specific: Limits the heap to 1<<(positive-integer+1) bytes.  Trumps any limits
+specified in the environment.
+
+@end defun
+
 @defun ALLOCATE (type number &optional (really-allocate nil))
 Package:LISP
 
--- gcl27-2.7.0.orig/info/makefile
+++ gcl27-2.7.0/info/makefile
@@ -1,122 +1,58 @@
 .SUFFIXES:
-.SUFFIXES: .info .dvi  .texi
+.SUFFIXES: .info .dvi .texi
 
 INFO_DIR=${prefix}/lib/info
 
-GCL_DVI=gcl-tk.dvi gcl-si.dvi gcl.dvi
-GCL_PDF=gcl-tk.pdf gcl-si.pdf gcl.pdf
-#GCL_HTML=gcl-si_toc.html gcl-tk_toc.html gcl_toc.html
-GCL_HTML=gcl-si_html/index.html gcl-tk_html/index.html gcl_html/index.html
-#HTML_CMD=texi2html -split_chapter
-HTML_CMD=makeinfo --html 
+PEXT?=
+BN:=gcl$(PEXT) $(addprefix gcl$(PEXT),-si -tk)
+GCL_TEXI:=$(addsuffix .texi,${BN} gcl${PEXT}-si-index)
+GCL_DVI:=$(addsuffix .dvi,${BN})
+GCL_PDF:=$(addsuffix .pdf,${BN})
+GCL_INFO:=$(addsuffix .info,${BN})
+GCL_HTML:=$(addsuffix _html,${BN})
 
 -include ../makedefs
 
-all: gcl-tk.info gcl-si.info gcl.info $(GCL_PDF) $(GCL_HTML) #$(GCL_DVI)
+FILES:=${GCL_TEXI} ${GCL_INFO} $(GCL_PDF) $(GCL_HTML) $(GCL_DVI)
 
-.texi.info:
-	rm -f $*.*gz
-	-$(MAKEINFO) $*.texi
-	- gzip $*.info-*
-
-GCL_SI= number.texi sequence.texi character.texi list.texi io.texi \
-	form.texi compile.texi symbol.texi system.texi structure.texi \
-	iteration.texi user-interface.texi doc.texi type.texi internal.texi \
-	c-interface.texi si-defs.texi debug.texi misc.texi compiler-defs.texi \
-	gcl-si-index.texi
-GCL_TK= general.texi widgets.texi control.texi
-GCL_MAN= chap-1.texi chap-2.texi chap-3.texi chap-4.texi chap-5.texi \
-	 chap-6.texi chap-7.texi chap-8.texi chap-9.texi chap-10.texi chap-11.texi \
-	 chap-12.texi chap-13.texi chap-14.texi chap-15.texi chap-16.texi chap-17.texi \
-	 chap-18.texi chap-19.texi chap-20.texi chap-21.texi chap-22.texi chap-23.texi \
-	 chap-24.texi chap-25.texi chap-26.texi chap-a.texi
-
-%.pdf: %.texi
-	-texi2pdf $<
-	touch $@
-
-gcl-si.dvi: ${GCL_SI} gcl-si.texi
-	TEXINPUTS=.:$$TEXINPUTS tex --interaction nonstopmode gcl-si.texi || true
-
-gcl-si.info: ${GCL_SI} gcl-si.texi
-	-$(MAKEINFO) gcl-si.texi	
-
-gcl-tk.dvi: ${GCL_TK} gcl-tk.texi
-	TEXINPUTS=.:$$TEXINPUTS tex --interaction nonstopmode gcl-tk.texi || true
-
-gcl-tk.info: ${GCL_TK} gcl-tk.texi
-	-$(MAKEINFO) gcl-tk.texi
-
-gcl.dvi: ${GCL_MAN} gcl.texi
-	TEXINPUTS=.:$$TEXINPUTS tex --interaction nonstopmode gcl.texi || true
-
-gcl.info: ${GCL_MAN} gcl.texi
-	-$(MAKEINFO) gcl.texi
-
-#gcl-si_toc.html: ${GCL_SI} gcl-si.texi
-#	$(HTML_CMD) gcl-si.texi
-
-#gcl-tk_toc.html: ${GCL_TK} gcl-tk.texi
-#	$(HTML_CMD) gcl-tk.texi
-
-#gcl_toc.html:
-#	$(HTML_CMD) gcl.texi
-
-gcl-si_html/index.html: ${GCL_SI} gcl-si.texi
-	mkdir -p $(@D)
-	touch $@
-	-$(HTML_CMD) gcl-si.texi
-
-gcl-tk_html/index.html: ${GCL_TK} gcl-tk.texi
-	mkdir -p $(@D)
-	touch $@
-	-$(HTML_CMD) gcl-tk.texi
-
-gcl_html/index.html: gcl.texi
-	mkdir -p $(@D)
-	touch $@
-	-$(HTML_CMD) gcl.texi
+all: ${FILES}
 
-install-html: gcl-tk_toc.html gcl-si_toc.html gcl_toc.html
-	cp *.html /d/www/gcl
+${GCL_TEXI}:
+	cat $$(echo $@ | sed 's,gcl${PEXT},gcl,g') | \
+		sed -e 's,gcl\([:.-]\),gcl${PEXT}\1,g' >$@
 
-install: $(GCL_DVI) $(GCL_HTML)
+%$.info: %.texi
+	$(MAKEINFO) $< --output $@
+
+%.tex: %.texi
+	$(MAKEINFO) --latex $< --output $@
+
+%.pdf: %.tex
+	latex -output-format=pdf $<
+
+%.dvi: %.tex
+	latex $<
+
+%_html: %.texi
+	mkdir -p $@
+	$(MAKEINFO) --html $< --output $@
+
+install: ${FILES}
 	mkdir -p $(DESTDIR)${INFO_DIR}
 	[ -f $(DESTDIR)$(INFO_DIR)/dir ] || touch $(DESTDIR)$(INFO_DIR)/dir
-	grep gcl-si $(DESTDIR)${INFO_DIR}/dir >/dev/null 2>&1 || \
-	echo "* GCL Doc: (gcl-si.info).	GNU Common Lisp specific Documentation." >> $(DESTDIR)${INFO_DIR}/dir
-	grep gcl-tk $(DESTDIR)${INFO_DIR}/dir >/dev/null 2>&1 || \
-	echo "* GCL TK Doc: (gcl-tk.info).	TK window GCL interface." >> $(DESTDIR)${INFO_DIR}/dir
-	grep gcl.info $(DESTDIR)${INFO_DIR}/dir >/dev/null 2>&1 || \
-	echo "* GCL Ansi Doc: (gcl.info).  Ansi Common Lisp Specification." >> $(DESTDIR)${INFO_DIR}/dir
+	grep gcl${PEXT}-si $(DESTDIR)${INFO_DIR}/dir >/dev/null 2>&1 || \
+	echo "* GCL Doc: (gcl${PEXT}-si.info).	GNU Common Lisp specific Documentation." >> $(DESTDIR)${INFO_DIR}/dir
+	grep gcl${PEXT}-tk $(DESTDIR)${INFO_DIR}/dir >/dev/null 2>&1 || \
+	echo "* GCL TK Doc: (gcl${PEXT}-tk.info).	TK window GCL interface." >> $(DESTDIR)${INFO_DIR}/dir
+	grep gcl${PEXT}.info $(DESTDIR)${INFO_DIR}/dir >/dev/null 2>&1 || \
+	echo "* GCL Ansi Doc: (gcl${PEXT}.info).  Ansi Common Lisp Specification." >> $(DESTDIR)${INFO_DIR}/dir
 	cp *.info* $(DESTDIR)${INFO_DIR}/
-#	-mkdir -p $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl.html
-#	-mkdir -p $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl-si.html
-#	-mkdir -p $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl-tk.html
-#	-cp gcl_*html gcl.html $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl.html
-#	-cp gcl-si*html $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl-si.html
-#	-cp gcl-tk*html $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl-tk.html
-#	-cp gcl/* $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl.html
-#	-cp gcl-si/* $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl-si.html
-#	-cp gcl-tk/* $(DESTDIR)$(INFO_DIR)/../doc/gcl-doc/gcl-tk.html
-	mkdir -p $(DESTDIR)$(INFO_DIR)/../doc
-	cp -a gcl-si_html gcl_html gcl-tk_html $(DESTDIR)$(INFO_DIR)/../doc
-#	cp *dvi $(DESTDIR)$(INFO_DIR)/../doc
-
-FILE=gcl-si.texi
-srcs:
-	fgrep '.texi' ${FILE} | sed -e "/@c/d" | \
-	awk '{ i++; printf("%s ",$$2); if ((i%5) == 0) printf("\\\n")}'
-
-tex:
-	TEXINPUTS=.:$$TEXINPUTS tex gcl-si.texi
-	TEXINPUTS=.:$$TEXINPUTS tex gcl-tk.texi
-	TEXINPUTS=.:$$TEXINPUTS tex gcl.texi
-	@echo must do twice to get indices correct...
-	@echo so do '$(MAKE) tex' again
+	mkdir -p $(DESTDIR)$(INFO_DIR)/../doc/gcl${PEXT}
+	cp -a ${GCL_HTML} $(DESTDIR)$(INFO_DIR)/../doc/gcl${PEXT}
 
 clean:
 	rm -f *.info* *.html *.dvi *.cp *.ky *.vr *.tp *.pg *.toc *.aux *.log *.fn
-	rm -rf gcl.IC gcl.IE gcl.IG gcl.IP gcl.IR gcl.IT gcl.fu gcl gcl-si gcl-tk
-	rm -rf gcl-si_html gcl_html gcl-tk_html $(GCL_DVI) $(GCL_PDF)
-	rm -rf gcl-si.fns gcl-si.vrs gcl.ICs gcl.IGs gcl.IPs gcl.IRs gcl.ITs
+	rm -rf *.IC *.IE *.IG *.IP *.IR *.IT *.fu
+	rm -rf $(GCL_DVI) $(GCL_HTML) $(GCL_PDF)
+	rm -rf *.fns *.vrs *.ICs *.IGs *.IPs *.IRs *.ITs
+	[ "${PEXT}" = "" ] || rm -f ${GCL_TEXI}
--- gcl27-2.7.0.orig/info/si-defs.texi
+++ gcl27-2.7.0/info/si-defs.texi
@@ -527,7 +527,7 @@ Faslink does not work on most UNIX syste
 @defun TOP-LEVEL ()
 Package:SI
 
-GCL specific: Starts the standard top-level listner of GCL.  When the GCL
+GCL specific: Starts the standard top-level listener of GCL.  When the GCL
 process is invoked, it calls SI:TOP-LEVEL by (FUNCALL 'SI:TOP-LEVEL).
      To change the top-level of GCL, redefine SI:TOP-LEVEL and save the core
 imange in a file.  When the saved imange is invoked, it will start the
@@ -946,7 +946,7 @@ Non nil means that a string-match should
 Package: SI
 Match regexp PATTERN in STRING starting in string starting at START
 and ending at END.  Return -1 if match not found, otherwise
-return the start index  of the first matchs.  The variable
+return the start index  of the first matches.  The variable
 *MATCH-DATA* will be set to a fixnum array of sufficient size to hold
 the matches, to be obtained with match-beginning and match-end.
 If it already contains such an array, then the contents of it will
--- gcl27-2.7.0.orig/info/system.texi
+++ gcl27-2.7.0/info/system.texi
@@ -6,6 +6,7 @@
 @menu
 * Command Line::                
 * Operating System Definitions::  
+* Environment Variables::
 @end menu
 
 @node Command Line, Operating System Definitions, Operating System, Operating System
@@ -427,3 +428,33 @@ be any non-negative, non-complex number.
 
 
 @end defun
+
+@node Environment Variables, Operating System Definitions, Operating System, Operating System
+@section Environment Variables
+
+Several environment variables affect GCL:
+
+@vtable @code
+@item GCL_MEM_MULTIPLE -- default 1.0
+A positive float indicating the fraction of available memory
+GCL should use.
+@item GCL_MEM_BOUND -- default sizeof(long)-1
+A positive integer bounding GCL's heap to 1<<(n+1) bytes.  Trumps
+GCL_MEM_MULTIPLE.
+@item GCL_GC_ALLOC_MIN -- default 0.05
+A positive float indicating the minimum fraction of heap to be
+allocated between garbage collection (GC) cycles.
+@item GCL_GC_PAGE_MIN -- default 0.5
+A positive float indicating the minimum fraction of heap to be
+allocated before garbage collection (GC) commences.
+@item GCL_GC_PAGE_MAX -- default 0.75
+A positive float indicating the maximum fraction of heap to be
+allocated after which garbage collection (GC) is mandatory.
+@item GCL_MULTIPROCESS_MEMORY_POOL -- default unset
+A string when set indicating a directory in which to place the file
+gcl_pool used for coordinating memory management among multiple GCL
+processes.  This should be a local directory for performance reasons.
+@item GCL_WAIT_ON_ABORT -- default 0
+A non-negative integer indicating how many seconds to sleep before
+aborting on fatal error.
+@end vtable
--- gcl27-2.7.0.orig/lsp/gcl_info.lsp
+++ gcl27-2.7.0/lsp/gcl_info.lsp
@@ -70,7 +70,7 @@
 	(when (eq x tem)
 	  (setq tem 
 		(make-array len :adjustable t
-			    :element-type 'character :fill-pointer 0))
+			    :element-type 'character :fill-pointer i))
 	  (dotimes (j i) (setf (aref tem j) (aref x j))))
 	(vector-push-extend #\\ tem))
       (unless (eq tem x) (vector-push-extend ch tem))
@@ -100,7 +100,7 @@
 	    s
 	    (node-string (car (nth 1 *current-info-data*)))
 	    (node
-	     (and node-string (car (get-nodes "index" node-string)))))
+	     (and node-string (car (get-nodes "Index" node-string)))))
        (when node
 	   (setq s (show-info
 		    node
--- gcl27-2.7.0.orig/lsp/gcl_top.lsp
+++ gcl27-2.7.0/lsp/gcl_top.lsp
@@ -212,6 +212,7 @@
       (cond ((string-equal x "-load") (load (pop args)))
 	    ((string-equal x "-eval") (eval (read-from-string (pop args))))
 	    ((string-equal x "-batch") (setq *top-level-hook* 'bye))
+	    ((or (equal x "-v") (equal x "--version")) (format t "~a~%" (lisp-implementation-version)) (setq *top-level-hook* 'bye))
 	    ((string-equal x "-o-file") (unless (read-from-string (car args))
 				   (push (cons :o-file nil) compile)
 				   (pop args)))
--- gcl27-2.7.0.orig/makefile
+++ gcl27-2.7.0/makefile
@@ -220,19 +220,29 @@ command:
 merge:
 	$(CC) -o merge merge.c
 
-LISP_LIB=cmpnew/gcl_collectfn.o xgcl-2/sysdef.lisp xgcl-2/gcl_dwtest.lsp xgcl-2/gcl_dwtestcases.lsp lsp/gcl_export.lsp lsp/gcl_autoload.lsp cmpnew/gcl_cmpopt.lsp cmpnew/gcl_lfun_list.lsp lsp/gcl_auto_new.lsp h/cmpinclude.h  unixport/init_raw.lsp $(shell ls -1 unixport/*.a) gcl-tk/tk-package.lsp $(TK_LISP_LIB) $(RL_LIB) $(FIRST_FILE) $(LAST_FILE) $(addsuffix /sys-proclaim.lisp,lsp cmpnew pcl clcs xgcl-2) unixport/gcl.script unixport/libboot.so lsp/gcl_defmacro.lsp lsp/gcl_evalmacros.lsp lsp/gcl_top.lsp lsp/gcl_module.lsp xgcl-2/sysdef.lisp pcl/package.lisp clcs/package.lisp
+LISP_LIB=$(shell ls -1 cmpnew/gcl_collectfn.o \
+           xgcl-2/sysdef.lisp xgcl-2/gcl_dwtest.lsp xgcl-2/gcl_dwtestcases.lsp xgcl-2/sysdef.lisp  \
+	   lsp/gcl_export.lsp lsp/gcl_autoload.lsp cmpnew/gcl_cmpopt.lsp \
+	   cmpnew/gcl_lfun_list.lsp lsp/gcl_auto_new.lsp \
+	   h/cmpinclude.h  unixport/init_raw.lsp unixport/libgclp.a \
+	   $(addsuffix .a,$(addprefix unixport/lib,gcl gcl_gprof ansi_gcl ansi_gcl_gprof)) \
+	   $(addsuffix $(EXE),$(addprefix unixport/saved_,gcl gcl_gprof ansi_gcl ansi_gcl_gprof)) \
+	   unixport/libboot.so \
+	   $(shell find $(ODIR) -name "$(FIRST_FILE)") $(shell find $(ODIR) -name "$(LAST_FILE)") \
+	   gcl-tk/tk-package.lsp $(TK_LISP_LIB) \
+	   $(RL_LIB) \
+	   $(addsuffix /sys-proclaim.lisp,lsp cmpnew pcl clcs xgcl-2) \
+	   unixport/gcl.script \
+	   lsp/gcl_defmacro.lsp lsp/gcl_evalmacros.lsp lsp/gcl_top.lsp lsp/gcl_module.lsp \
+	   pcl/package.lisp clcs/package.lisp)
+
+bin/gcl: bin/gcl.sh
+	sed -e "s,@EXT@,$(PEXT),g" \
+	    -e "s,@VERS@,$$(cat majvers).$$(cat minvers),g" \
+	    -e "s,@TKVERS@,$$(echo $(TK_CONFIG_PREFIX) |sed 's,.*/tk,,g'),g" $< >$@
+	chmod a+x $@
 
-install-command:
-	rm -f bin/$(BINSCPT)
-	(echo '#!/bin/sh' ; \
-	echo exec $(BINDIR)/$(FLISP)$(EXE) \\ ; \
-	echo '   -dir' $(INSTALL_LIB_DIR)/unixport/ \\ ; \
-	echo '   -libdir' $(INSTALL_LIB_DIR)/ \\ ; \
-	echo '   -eval '\''(setq si::*allow-gzipped-file* t)'\' \\ ;\
-	! [ -d "$(TK_CONFIG_PREFIX)" ] || echo '   -eval '\''(setq si::*tk-library* '\"$(TK_LIBRARY)\"')'\' \\;\
-	echo '     '\"\$$@\" ) > bin/$(BINSCPT);
-	echo '#' other options: -load "/tmp/foo.o" -load "jo.lsp" -eval '"(joe 3)"' >> bin/$(BINSCPT)
-	chmod a+x bin/$(BINSCPT)
+install-command: bin/gcl
 
 install_windows_command:
 	rm -f $(prefix)/bin/gcl
@@ -284,15 +294,16 @@ install_unix:
 	mkdir -p $(DESTDIR)$(prefix)/lib 
 	mkdir -p $(DESTDIR)$(prefix)/bin
 	mkdir -p $(DESTDIR)$(prefix)/share
-	cp -a man $(DESTDIR)$(prefix)/share/
+	i=$$(find man -name gcl.1); \
+		mkdir -p $(DESTDIR)$(prefix)/share/$$(dirname $$i) ; \
+		sed -e 's,\(\b\)gcl\(\b\),\1gcl$(PEXT)\2,g' $$i \
+			>$(DESTDIR)$(prefix)/share/$$(dirname $$i)/gcl$(PEXT).1
 	mkdir -p $(DESTDIR)$(INSTALL_LIB_DIR)
 	MINSTALL_LIB_DIR=`echo $(INSTALL_LIB_DIR) | sed -e 'sX^\([a-z]\):X/\1Xg'` ; \
 	$(MAKE) install-command "INSTALL_LIB_DIR=$(INSTALL_LIB_DIR)" "prefix=$(prefix)" "DESTDIR=$(DESTDIR)" "BINDIR=$$MINSTALL_LIB_DIR/unixport"
-	cp bin/$(BINSCPT) $(DESTDIR)$(prefix)/bin/
+	cp bin/$(BINSCPT) $(DESTDIR)$(prefix)/bin/gcl$(PEXT)
 	rm -f $(DESTDIR)$(prefix)/bin/gcl.exe
-	tar cf - $$(find $(PORTDIR) -name saved_gcl) $$(find $(PORTDIR) -name saved_ansi_gcl) \
-           $$(find $(PORTDIR) -name saved_gcl_gprof) $$(find $(PORTDIR) -name saved_ansi_gcl_gprof) info/*.info* $(LISP_LIB) \
-	   $(TCL_EXES)  |  (cd $(DESTDIR)$(INSTALL_LIB_DIR) ;tar xf -)
+	tar cf - $(LISP_LIB) $(TCL_EXES)  |  (cd $(DESTDIR)$(INSTALL_LIB_DIR) ;tar xf -)
 	if gcc --version | grep -i mingw >/dev/null 2>&1 ; then if grep -i oncrpc makedefs >/dev/null 2>&1 ; then cp /mingw/bin/oncrpc.dll $(DESTDIR)$(INSTALL_LIB_DIR)/$(PORTDIR); fi ; fi
 	cd $(DESTDIR)$(INSTALL_LIB_DIR)/$(PORTDIR) && \
 		for i in saved_*; do \
@@ -300,20 +311,16 @@ install_unix:
 			mv foo $$i ; \
 		done
 	if [ -e "unixport/rsym$(EXE)" ] ; then cp unixport/rsym$(EXE) $(DESTDIR)$(INSTALL_LIB_DIR)/unixport/ ; fi
-#	ln $(SYMB) $(INSTALL_LIB_DIR)/$(PORTDIR)/$(FLISP)$(EXE) \
-#	 $(DESTDIR)$(prefix)/bin/gcl.exe
 	if [ -d "$(TK_CONFIG_PREFIX)" ] ; then  \
 	cat gcl-tk/gcltksrv$(BAT) | \
 	sed -e "s!GCL_TK_DIR=.*!GCL_TK_DIR=$(INSTALL_LIB_DIR)/gcl-tk!g"  \
 	-e "s!TK_LIBRARY=.*!TK_LIBRARY=$(TK_LIBRARY)!g" > \
 	$(DESTDIR)$(INSTALL_LIB_DIR)/gcl-tk/gcltksrv$(BAT) ; \
 	chmod a+x $(DESTDIR)$(INSTALL_LIB_DIR)/gcl-tk/gcltksrv$(BAT) ; fi
-#	if [ -d "$(TK_CONFIG_PREFIX)" ] ; then  \
-#	(cd $(DESTDIR)$(INSTALL_LIB_DIR)/gcl-tk/demos ; \
-#	echo '(load "../tkl.o")(TK::GET-AUTOLOADS (directory "*.lisp"))' | ../../$(PORTDIR)/$(FLISP)$(EXE)) ; fi
 	if test "$(EMACS_SITE_LISP)" != "" ; then (cd elisp ; $(MAKE) install DESTDIR=$(DESTDIR)) ; fi
 	if test "$(INFO_DIR)" != "unknown"; then (cd info ; $(MAKE) ; $(MAKE) install DESTDIR=$(DESTDIR)) ; fi
 	[ "$(X_LIBS)" == "" ] || if test "$(INFO_DIR)" != "unknown"; then (cd xgcl-2 ; $(MAKE) install LISP=$$(pwd)/../unixport/saved_pre_gcl DESTDIR=$(DESTDIR)) ; fi
+	for i in lsp lisp el tcl; do find $(DESTDIR) -type f -name "*.$$i" -exec chmod ugo-x {} \; ; done
 
 install_windows:
 	mkdir -p $(DESTDIR)$(prefix)/lib 
--- gcl27-2.7.0.orig/o/alloc.c
+++ gcl27-2.7.0/o/alloc.c
@@ -123,8 +123,12 @@ expand_contblock_array(void) {
 static void
 contblock_array_push(void *p) {
 
+  ufixnum f=contblock_array==Cnil ? 0 : contblock_array->v.v_fillp;/*FIXME*/
+
   expand_contblock_array();
-  contblock_array->v.v_self[contblock_array->v.v_fillp]=p;
+  memmove(contblock_array->v.v_self+f+1,contblock_array->v.v_self+f,
+	  (contblock_array->v.v_fillp-f)*sizeof(*contblock_array->v.v_self));
+  contblock_array->v.v_self[f]=p;
   contblock_array->v.v_fillp++;
 
 }
@@ -1198,7 +1202,7 @@ init_tm(enum type t, char *name, int els
    homogenized and integrated into the traditional unix sequence for
    simplicity.  set_maxpage is overloaded, and the positioning of its
    call is too fragile.  20050115 CM*/
-static int gcl_alloc_initialized;
+int gcl_alloc_initialized;
 
 object malloc_list=Cnil;
 
@@ -1303,6 +1307,8 @@ gcl_init_alloc(void *cs_start) {
 
   update_real_maxpage();
 
+  cumulative_allocation=recent_allocation=0;
+
   if (gcl_alloc_initialized) {
     maybe_set_hole_from_maxpages();
     return;
@@ -1312,7 +1318,7 @@ gcl_init_alloc(void *cs_start) {
   INIT_ALLOC;
 #endif  
 
-  initial_sbrk=data_start=heap_end;
+  data_start=heap_end;
   first_data_page=page(data_start);
   
   /* Unused (at present) tm_distinct flag added.  Note that if cons
@@ -1668,10 +1674,6 @@ bool writable_malloc=0;
 static void *
 malloc_internal(size_t size) {
 
-#ifdef CAN_UNRANDOMIZE_SBRK
-  if (core_end && core_end!=sbrk(0))/*malloc before main in saved_image*/
-    return sbrk(size);/*will never get to gcl_init_alloc, so brk point irrelevant*/
-#endif
   if (!gcl_alloc_initialized) {
     static bool recursive_malloc;
     if (recursive_malloc)
--- gcl27-2.7.0.orig/o/cfun.c
+++ gcl27-2.7.0/o/cfun.c
@@ -149,6 +149,8 @@ DEFUN("DLOPEN",object,fSdlopen,SI,1,1,NO
   }
   if ((err=dlerror()))
     FEerror("dlopen failure on ~s: ~s",2,name,make_simple_string(err));
+
+  update_real_maxpage();
   
   RETURN1(make_fixnum((fixnum)v));
 
--- gcl27-2.7.0.orig/o/character.d
+++ gcl27-2.7.0/o/character.d
@@ -537,7 +537,6 @@ gcl_init_character()
 	  x->ch.ch_font = 0;
 	  x->ch.ch_bits = 0;
 	  x->ch.ch_name=y;
-	  y->fw=0;
 	  set_type_of(y,t_simple_string);
 	  y->sst.sst_hasfillp = FALSE;
 	  y->sst.sst_adjustable = FALSE;
--- gcl27-2.7.0.orig/o/gbc.c
+++ gcl27-2.7.0/o/gbc.c
@@ -1248,16 +1248,16 @@ static void
 FFN(siLheap_report)(void) {
 
   int i;
+  extern void *shared_lib_start;
   
   check_arg(0);
   
   vs_check_push(make_fixnum(sizeof(fixnum)*CHAR_SIZE));
   vs_push(make_fixnum(PAGESIZE));
   vs_push(make_fixnum((ufixnum)data_start));
-  vs_push(make_fixnum((ufixnum)data_start+(real_maxpage<<PAGEWIDTH)));
-  vs_push(make_fixnum(0));/*SHARED_LIB_HEAP_CEILING*/
-  i=sizeof(fixnum)*CHAR_SIZE-2;
-  i=1<<i;
+  vs_push(make_fixnum((real_maxpage<<PAGEWIDTH)));
+  vs_push(make_fixnum((ufixnum)shared_lib_start));
+  i=getpagesize();
   vs_push(make_fixnum(((unsigned long)cs_base+i-1)&-i));
   vs_push(make_fixnum(labs(cs_base-cs_org)));
   vs_push(make_fixnum((CSTACK_DIRECTION+1)>>1));
--- gcl27-2.7.0.orig/o/gcl_readline.d
+++ gcl27-2.7.0/o/gcl_readline.d
@@ -105,7 +105,7 @@ rl_completion_words(const char *text, in
       }
     }
     
-    package=package ? package : user_package;
+    package=(package!=OBJNULL && package!=Cnil) ? package : user_package;
     use=package->p.p_uselist;
     internal=temp && temp[1]==':' ? 1 : 0;
     ftext=text;
@@ -113,14 +113,14 @@ rl_completion_words(const char *text, in
     wtext=*wtext==':' ? wtext+1 : wtext;
     len=strlen(wtext);
     tp=package;
-    i=0;
     base=internal ? tp->p.p_internal : tp->p.p_external;
     size=internal ? tp->p.p_internal_size : tp->p.p_external_size;
+    i=0;
     l=base[i];
 
   }
 
-  while (tp && tp != Cnil) {
+  while (tp != OBJNULL && tp != Cnil) {
 
     while (1) {
       while (consp(l)) {
@@ -143,17 +143,17 @@ rl_completion_words(const char *text, in
 	  return c;
 	}
       }
-      if (++i==size)
+      if (++i>=size)
 	break;
       l=base[i];
     }      
 
     tp=use->c.c_car;
     use=use->c.c_cdr;
-    base=internal ? tp->p.p_internal : tp->p.p_external;
-    size=internal ? tp->p.p_internal_size : tp->p.p_external_size;
+    base=tp==Cnil ? NULL : (internal ? tp->p.p_internal : tp->p.p_external);
+    size=tp==Cnil ? 0    : (internal ? tp->p.p_internal_size : tp->p.p_external_size);
     i=0;
-    l=base[i];
+    l=base==NULL ? Cnil : base[i];
 
   }
 
--- gcl27-2.7.0.orig/o/main.c
+++ gcl27-2.7.0/o/main.c
@@ -155,7 +155,8 @@ clear_c_stack(VOL unsigned n) {
 
 }
 
-fixnum log_maxpage_bound=sizeof(fixnum)*8-1;
+static fixnum log_maxpage_bound=sizeof(fixnum)*8-1;
+static fixnum mem_bound=sizeof(fixnum)*8-1;
 
 int
 mbrk(void *v) {
@@ -163,10 +164,6 @@ mbrk(void *v) {
   ufixnum uv=(ufixnum)v,uc=(ufixnum)sbrk(0),ux,um;
   fixnum m=((1UL<<(sizeof(fixnum)*8-1))-1);
 
-#ifdef MAX_BRK /*GNU Hurd fragmentation bug*/
-  if ((ufixnum)v>MAX_BRK) return -1;
-#endif
-
   if (uv<uc) {
     um=uv;
     ux=uc;
@@ -182,12 +179,73 @@ mbrk(void *v) {
 
 }
     
+static char *
+next_line(int l,ufixnum *s) {
+
+  size_t n;
+  ssize_t i;
+  char *p;
+
+  if (*s && (n=strlen(FN1))) {
+    memmove(FN1,FN1+n+1,sizeof(FN1)-(n+1));
+    *s-=n+1;
+  }
+
+  massert(*s<sizeof(FN1));
+  massert((i=read(l,FN1+*s,sizeof(FN1)-*s))>=0);
+  *s+=i;
+
+  if (!(p=memchr(FN1,'\n',*s)))
+    return NULL;
+
+  *p=0;
+  return FN1;
+
+}
+
+static void
+parse_meminfo_decimal(char *c,char *h,ufixnum *t) {
+
+  ufixnum n=strlen(h);
+
+  if (memcmp(h,c,n))
+    return;
+
+  massert(sscanf(c+n,"%ld kB",t)==1);
+  *t<<=10;
+  *t>>=PAGEWIDTH;
+
+}
+
+static void
+parse_proc_meminfo(ufixnum *t,ufixnum *f,ufixnum *st,ufixnum *sf) {
+
+  int l;
+  ufixnum r=0;
+  char *s="/proc/meminfo",*c;
+
+  *t=*f=*st=*sf=0;
+
+  massert((l=open(s,O_RDONLY))>=0);
+
+  for (;(c=next_line(l,&r));) {
+    parse_meminfo_decimal(c,"MemTotal:",t);
+    parse_meminfo_decimal(c,"MemFree:",f);
+    parse_meminfo_decimal(c,"SwapTotal:",st);
+    parse_meminfo_decimal(c,"SwapFree:",sf);
+  }
+
+  massert(!close(l));
+
+}
+
+
 #if defined(__CYGWIN__)||defined(__MINGW32__)
 
 #include <windows.h>
 
 static ufixnum
-get_phys_pages_no_malloc(char n) {
+get_phys_pages_no_malloc(char n,char ramp) {
 
   MEMORYSTATUS m;
 
@@ -202,7 +260,7 @@ get_phys_pages_no_malloc(char n) {
 #include <sys/sysctl.h>
 
 static ufixnum
-get_phys_pages_no_malloc(char n) {
+get_phys_pages_no_malloc(char n,char ramp) {
 
   uint64_t s;
   size_t z=sizeof(s);
@@ -215,10 +273,10 @@ get_phys_pages_no_malloc(char n) {
 
 }
 
-#elif defined(__sun__) || defined(__GNU__)
+#elif defined(__sun__)
 
 static ufixnum
-get_phys_pages_no_malloc(char n) {
+get_phys_pages_no_malloc(char n,char ramp) {
 
   return sysconf(_SC_PHYS_PAGES);
 
@@ -230,7 +288,7 @@ get_phys_pages_no_malloc(char n) {
 #include <sys/sysctl.h>
 
 static ufixnum
-get_phys_pages_no_malloc(char n) {
+get_phys_pages_no_malloc(char n,char ramp) {
 
   size_t i,len=sizeof(i);
 
@@ -240,23 +298,40 @@ get_phys_pages_no_malloc(char n) {
 
 #else /*Linux*/
 
-#include <sys/sysinfo.h>
-
 static ufixnum
-get_phys_pages_no_malloc(char freep) {
+get_phys_pages_no_malloc(char freep,char ramp) {
 
-  struct sysinfo s;
+  ufixnum t,f,st,sf;
 
-  return sysinfo(&s) ? 0 : ((freep ? s.freeram : s.totalram)>>PAGEWIDTH)*s.mem_unit;
+  parse_proc_meminfo(&t,&f,&st,&sf);
+
+  return (freep ? (ramp ? f : f+sf) : (ramp ? t : t+st));
 
 }
 
+
 #endif
 
 static ufixnum
-get_phys_pages1(char freep) {
+get_phys_pages1(char freep,char ramp) {
+
+  ufixnum p=get_phys_pages_no_malloc(freep,ramp);
+#if defined(__GNU__)/*FIXME -- no mmap overcommit as of yet*/
+  p>>=1;
+#endif
+  return p;
+
+}
+
+static int
+acceptable_log_maxpage_bound(ufixnum l) {
+
+  void *end,*dend;
 
-  return get_phys_pages_no_malloc(freep);
+  if (l>sizeof(fixnum)*8-1) return 0;
+  end=data_start+(1L<<l)-PAGESIZE;
+  dend=heap_end+PAGESIZE+CEI(rb_pointer-rb_begin(),PAGESIZE);
+  return end>=dend;
 
 }
 
@@ -271,10 +346,14 @@ get_gc_environ(void) {
     massert(mem_multiple>=0.0);
   }
 
-  log_maxpage_bound=sizeof(fixnum)*8-1;
+  mem_bound=sizeof(fixnum)*8-1;
   if ((e=getenv("GCL_MEM_BOUND"))) {
-    massert(sscanf(e,"%lud",&log_maxpage_bound)==1);
-    mem_multiple=1.0;
+    ufixnum f;
+    massert(sscanf(e,"%lud",&f)==1);
+    if (acceptable_log_maxpage_bound(f)) {
+      mem_bound=f;
+      mem_multiple=1.0;
+    }
   }
 
   gc_alloc_min=0.05;
@@ -327,17 +406,82 @@ setup_maxpages(double scale) {
   resv_pages=available_pages/100;
   available_pages-=resv_pages;
 
-  cumulative_allocation=recent_allocation=0;
+}
+
+
+static void *
+next_shared_lib_map_no_malloc(void)  {
+
+#if !defined(DARWIN) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__)/*FIXME*/
+
+  char *c,rwx[4];
+  ufixnum a,e,s=(ufixnum)sbrk(0),r;
+  int l;
+
+  massert((l=open("/proc/self/maps",O_RDONLY))!=-1);
+
+  for (a=r=0;(a<=s || !memcmp(rwx,"---",3)) && (c=next_line(l,&r));)
+    sscanf(c,"%lx-%lx %3s",&a,&e,rwx);
+
+  massert(!close(l));
 
+  return (void *)(c ? a : -1);
+
+#else
+
+  return (void *)-1;
+
+#endif
 }
 
-void *initial_sbrk=NULL;
+static void *stack_map_base=(void *)-1;
+void *shared_lib_start=(void *)-1;
+
+static int
+set_real_maxpage(void *beg) {
+
+  void *end,*cp;
+  ufixnum mp,sz;
+
+  end=(void *)ROUNDDN((void *)-1,PAGESIZE);
+  mp=page(end-beg);
+
+  mp=ufmin(mp,get_phys_pages1(0,0));
+
+  sz=ufmin(mem_bound,log_maxpage_bound);
+  sz=(1UL<<sz)+((1UL<<sz)-1);
+  mp=ufmin(mp,page(sz));
+
+#if defined(LOW_IM_FIX)
+  cp=(void *)(ufixnum)LOW_IM_FIX;
+#elif defined(IM_FIX_BASE)
+  cp=(void *)IM_FIX_BASE;
+#elif
+  cp=(void *)-1;
+#endif
+  cp=cp<beg ? (void *)-1 : cp;
+  mp=ufmin(mp,page(cp-beg));
+
+  cp=alloca(1);
+  cp=cp<stack_map_base ? cp : stack_map_base;
+  cp=cp<beg ? (void *)-1 : cp;
+  mp=ufmin(mp,page(cp-beg));
+
+  cp=shared_lib_start=next_shared_lib_map_no_malloc();
+  cp=cp<beg ? (void *)-1 : cp;
+  mp=ufmin(mp,page(cp-beg));
+
+  real_maxpage=mp+page(beg);
+
+  return 0;
+
+}
 
 int
 update_real_maxpage(void) {
 
-  ufixnum i,j;
-  void *end,*cur,*beg;
+  void *beg;
+
 #ifdef __MINGW32__
   static fixnum n;
 
@@ -349,21 +493,10 @@ update_real_maxpage(void) {
 
   get_gc_environ();
 
-#ifdef DEFINED_REAL_MAXPAGE
-  real_maxpage=DEFINED_REAL_MAXPAGE;
-#else
-  massert(cur=sbrk(0));
-  beg=data_start ? data_start : cur;
-  for (i=0,j=(1L<<log_maxpage_bound);j>PAGESIZE;j>>=1)
-    if ((end=beg+i+j-PAGESIZE)>cur)
-      if (!mbrk(end)) {
-	real_maxpage=page(end);
-	i+=j;
-      }
-  massert(!mbrk(cur));
-#endif
+  massert(beg=data_start ? data_start : sbrk(0));
+  set_real_maxpage(beg);
 
-  phys_pages=ufmin(get_phys_pages1(0)+page(beg),real_maxpage)-page(beg);
+  phys_pages=ufmin(get_phys_pages1(0,1)+page(beg),real_maxpage)-page(beg);
 
   setup_maxpages(mem_multiple);
 
@@ -395,15 +528,10 @@ minimize_image(void) {
 
 DEFUN("SET-LOG-MAXPAGE-BOUND",object,fSset_log_maxpage_bound,SI,1,1,NONE,II,OO,OO,OO,(fixnum l),"") {
 
-  void *end,*dend;
-  fixnum def=sizeof(fixnum)*8-1;
-
-  l=l<def ? l : def;
-  end=data_start+(1L<<l)-PAGESIZE;
   GBC(t_relocatable);
-  dend=heap_end+PAGESIZE+CEI(rb_pointer-rb_begin(),PAGESIZE);
-  if (end >= dend) {
-    putenv("GCL_MEM_MULTIPLE=1.0");/*invoking this function overrides mem_multiple*/
+  if (acceptable_log_maxpage_bound(l)) {
+    unsetenv("GCL_MEM_MULTIPLE");/*invoking this function overrides mem_multiple*/
+    unsetenv("GCL_MEM_BOUND");/*invoking this function overrides mem_multiple*/
     minimize_image();
     log_maxpage_bound=l;
     update_real_maxpage();
@@ -510,7 +638,7 @@ gcl_cleanup(int gc) {
 
     raw_image=FALSE;
     cs_org=0;
-    initial_sbrk=core_end;
+    msbrk_end();
 
   }
 
@@ -596,17 +724,13 @@ main(int argc, char **argv, char **envp)
   GET_FULL_PATH_SELF(kcl_self);
   *argv=kcl_self;
 
-#ifdef CAN_UNRANDOMIZE_SBRK
-#include <stdio.h>
-#include <stdlib.h>
-#include "unrandomize.h"
-#endif
-
   vs_top = vs_base = vs_org;
   ihs_top = ihs_org-1;
   bds_top = bds_org-1;
   frs_top = frs_org-1;
 
+#include "cstack.h"
+
   gcl_init_alloc(alloca(1));
 
   setbuf(stdin, stdin_buf); 
--- gcl27-2.7.0.orig/o/makefile
+++ gcl27-2.7.0/o/makefile
@@ -22,7 +22,7 @@ OBJS:=$(addsuffix .o,typespec alloc gbc
 	 hash array string regexpr structure toplevel file read backq print format\
 	 pathname unixfsys unixfasl error unixtime unixsys unixsave funlink  fat_string\
 	 run_process nfunlink usig usig2 utils makefun sockets gmp_wrappers clxsocket\
-	 init_pari nsocket new_init prelink sfasl gprof $(RL_OBJS))
+	 init_pari nsocket new_init prelink sfasl gprof msbrk $(RL_OBJS))
 OBJS:=$(OBJS) $(EXTRAS)
 
 INI_FILES=$(patsubst %.o,%.ini,${OBJS})
@@ -88,7 +88,7 @@ boot.h: boot.ini
 	rm $*.c
 
 $(DPP):	../bin/dpp.c
-	${CC} $(CFLAGS) $(LDFLAGS) ${DEFS} -o $@ $<
+	${CC} $(filter-out -pg,$(CFLAGS)) $(LDFLAGS) ${DEFS} -o $@ $<
 
 new_init.c: ${INI_FILES}
 	echo '#include "make-init.h"' > $@
--- /dev/null
+++ gcl27-2.7.0/o/msbrk.c
@@ -0,0 +1,69 @@
+#define _GNU_SOURCE
+#include <sys/mman.h>
+
+#include "include.h"
+
+static void *m;
+static ufixnum sz,mps;
+
+int
+msbrk_end(void) {
+
+  sz+=(ufixnum)m;
+  mps=sz;
+  m=NULL;
+
+  return 0;
+
+}
+
+#if !defined(DARWIN) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__)/*FIXME*/
+
+static void *
+new_map(void *v,ufixnum s) {
+  return mmap(v,s,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_ANON|MAP_FIXED,-1,0);
+}
+
+int
+msbrk_init(void) {
+
+  if (!m) {
+
+    extern int gcl_alloc_initialized;
+    extern fixnum _end;
+    void *v;
+
+    v=gcl_alloc_initialized ? core_end : (void *)ROUNDUP((void *)&_end,getpagesize());
+    m=(void *)ROUNDUP((ufixnum)v,PAGESIZE);
+    massert(!gcl_alloc_initialized || v==m);
+
+    if (v!=m)
+      massert(new_map(v,m-v)!=(void *)-1);
+    mps=sz=0;
+
+  }
+  
+  return 0;
+
+}
+
+void *
+msbrk(intptr_t inc) {
+
+  size_t p2=ROUNDUP(sz+inc,PAGESIZE);
+
+  if (mps<p2) {
+    if (m+mps!=new_map(m+mps,p2-mps))
+      return (void *)-1;
+#ifdef HAVE_MADVISE_HUGEPAGE
+    massert(!madvise(m,p2,MADV_HUGEPAGE));
+#endif
+    mps=p2;
+  }
+
+  sz+=inc;
+  return m+sz-inc;
+
+}
+
+#endif
--- gcl27-2.7.0.orig/pcl/makefile
+++ gcl27-2.7.0/pcl/makefile
@@ -37,6 +37,7 @@ gprof_objs: $(addprefix ../gprof/,$(adds
 
 saved_gcl_pcl: $(LISP)
 	cp ../h/cmpinclude.h .
+	touch sys-proclaim.lisp sys-package.lisp
 	echo $(SETUP) '(pcl::compile-pcl)' | $< 
 	echo $(SETUP) '(pcl::load-pcl)(si::save-system "$@")' | $< $(LISPFLAGS)
 
@@ -44,6 +45,7 @@ $(addsuffix .c,$(AFILES)) $(addsuffix .d
 	$(addsuffix .h,$(AFILES)): \
 	$(addsuffix .lisp,$(FILES))
 	cp ../h/cmpinclude.h .
+	touch sys-proclaim.lisp sys-package.lisp
 	echo ${SETUP} '(pcl::compile-pcl)' ${DINLH}  | $(LISP)
 
 %.o: %.c %.h %.data
@@ -53,13 +55,12 @@ $(addsuffix .c,$(AFILES)) $(addsuffix .d
 clean:
 	rm -f *.o *.fn *.exe *.dll saved_gcl_pcl cmpinclude.h *.c *.h *.data
 
-
 # remake the sys-package.lisp and sys-proclaim.lisp files
 # Those files may be empty on a first build.
 remake-sys-files:
 	$(MAKE) clean
-	rm -f sys-proclaim.lisp
-	touch sys-proclaim.lisp
+	rm -f sys-proclaim.lisp sys-package.lisp
+	touch sys-proclaim.lisp sys-package.lisp
 	$(MAKE)
 	echo $(SETUP) '(pcl::load-pcl)(load "../cmpnew/gcl_collectfn.lsp")(pcl::renew-sys-files)' \
 		| $(LISP) ../unixport/ $(LISPFLAGS)
--- gcl27-2.7.0.orig/readme
+++ gcl27-2.7.0/readme
@@ -160,7 +160,7 @@ A new compiler has been written, which i
 and provides some other benefits.   It will be in a future release.
 We will need people willing to beta test and isolate any bugs.
 
-Additonal work planned or desired:
+Additional work planned or desired:
 
   * Clean up distribution and installation.  Make it easier to link in
 C code such as Novak's window stuff.   Faslink is not portable (since
--- gcl27-2.7.0.orig/unixport/boot.lisp
+++ gcl27-2.7.0/unixport/boot.lisp
@@ -1,5 +1,10 @@
 (in-package :compiler)(cdebug)(setq *compile-print* nil si::*notify-gbc* t *annotate* nil)
-(si::allocate 'structure 200 t)
+
+(room t)
+
+(multiple-value-bind
+ (x ps) (si::heap-report)
+ (si::allocate 'structure (max 1 (truncate (* 4096 200) ps)) t))
 
 #+pre-gcl
 (progn
@@ -60,10 +65,10 @@
   
   (with-open-file (s "../lsp/gcl_recompile.lsp" :direction :output))
   (dolist (l '(recompile callhash assert defmacro defstruct describe evalmacros sc
-			 logical_pathname_translations make_pathname parse_namestring merge_pathnames
-			 pathname_match_p namestring wild_pathname_p translate_pathname truename directory
-			 rename_file restart
-			 iolib mislib module numlib packlib setf top trace sloop debug info serror mnum fpe))
+	       logical_pathname_translations make_pathname parse_namestring merge_pathnames
+	       pathname_match_p namestring wild_pathname_p translate_pathname truename directory
+	       rename_file restart iolib mislib module numlib packlib
+	       setf top trace sloop debug info serror mnum fpe))
     (doitf l "lsp" ld? cmpl?)))
 
 (doit (if (boundp 'noload) 'identity 'load) 'compile-file)
--- gcl27-2.7.0.orig/xgcl-2/Xakcl.paper
+++ gcl27-2.7.0/xgcl-2/Xakcl.paper
@@ -23,7 +23,7 @@
 		B. Creating and Using Windows
 
 			1. Creating Windows 
-			2. Controling Window attributes
+			2. Controlling Window attributes
 			3. Getting Window Geometry
 
 		C. How to Use the Graphics Context
@@ -64,11 +64,11 @@ All rights reserved.  See section G for
 	Xakcl is the basic Xwindows library for Akcl lisp (the C
 header files for the library correspond to Xlib.h, Xutil.h, and X.h).
 Since Xakcl supports only the basic Xwindows library, Xakcl
-programming is intended to be a low level programming aproach to
+programming is intended to be a low level programming approach to
 graphics.  As a consequence, any Xwindows program written in C can
 also be written in Xakcl, with little cost in performance.  The
-primitive operations range from controling minute details in color, to
-creating pixmaps, and configuring windows.  Thus a programer using
+primitive operations range from controlling minute details in color, to
+creating pixmaps, and configuring windows.  Thus a programmer using
 xakcl can exploit both the extensibility of Xwindows graphics
 capabilities and the ease of lisp programming.
 
@@ -80,12 +80,12 @@ library routines and programming convent
 not required.  All X functions in Xakcl begin with the letter 'X' ,
 unless otherwise mentioned.  The Syntax and names of Xakcl functions
 are kept as closely to the X library functions as possible, so that a
-user of the Xwindows' C libary will have no trouble in learning how to
+user of the Xwindows' C library will have no trouble in learning how to
 use Xakcl.  Of course this also makes translation of X programs in C,
 into Lisp easier.  For an introduction to X programming in C 'Xlib
 Programming Manual for version 11' by Adrian Nye is suggested.  Also,
 any reference manual on the X library would be helpful, since the
-names of Xakcl functions are identical to those of the C libararies'
+names of Xakcl functions are identical to those of the C libraries'
 functions.
 
 
@@ -107,7 +107,7 @@ I. Initializing the Display
 
 
 In the X windows system, a display on which graphics is being
-done must be specified.  The display is initilized by calling the X
+done must be specified.  The display is initialised by calling the X
 function XOpenDisplay.  For example,
 
 
@@ -123,7 +123,7 @@ can only handle events for one display a
 
 	Creating many displays could be useful for applications with
 many different windows, but there is a performance cost.  It usually
-takes the X serever some time to return a display ID.
+takes the X server some time to return a display ID.
 
 
 
@@ -144,7 +144,7 @@ commands:
 
 
 The default screen is the screen on which graphics will be
-drawn, and the root window, is the window that the X serever creates
+drawn, and the root window, is the window that the X server creates
 from which all other windows are created.  This is the window that is
 created with the call to xstart, and resides in the background.
 
@@ -187,7 +187,7 @@ on how drawings will be done.  The line
 the graphics context, as well as the color and the way lines join (if
 they join at a rounded edge or at an angle.)  For now, only the
 creation of the graphics context will be of concern.  XDefaultGC will
-get a default grapics context.  For example:
+get a default graphics context.  For example:
 
 
 (setq *default-GC* (XDefaultGC  *default-display*  *default-screen*))
@@ -211,7 +211,7 @@ example, when using XDrawString, X will
 this case, Black in the GC to draw the string.  Also, XDrawImageString
 could be used.  This routine, X draws the string in the foreground
 pixel and fills the background with the background pixel.  If the
-foregorund and background pixels were switched than the string would
+foreground and background pixels were switched than the string would
 be white letters on a black background.  This is an example of
 highlighting text.
 
@@ -226,7 +226,7 @@ colormap allows the user to match pixel
 black pixel created by XBlackPixel is an example of a pixel value.  A
 colormap may or may not have the exact color that is being requested.
 The closest pixel value is given to the user.  In order to get a set
-of specific colors it is necesary to create a unique colormap, however
+of specific colors it is necessary to create a unique colormap, however
 for most applications, the default colormap will do.  An example of
 creating a default colormap is shown below.
 
@@ -296,7 +296,7 @@ structure, and it's initialization.
 
 	Like all Xwindows structures in Xakcl, XSizeHints can be
 created using the function make followed by the type name of the
-struture (note however that unlike Xsizehints, the graphics context is
+structure (note however that unlike Xsizehints, the graphics context is
 created using the X function XCreateGC.  The reason is that X provides
 a means of creating this structure, while the 'make' facility is
 provided to make C's struct in lisp).  The fields in the structure is
@@ -319,7 +319,7 @@ windows in the root window.
 the display, the window being managed, the window name, and the icon
 name.  XSetStandardProperties also expects three other parameters, an
 icon_pixmap, which will represent the window when it is iconized, and
-two arguments coressponding to resource information. Both these
+two arguments corresponding to resource information. Both these
 featrues are beyond the scope of this paper (see 'Xlib Programming
 Manual for version 11' for more information).  After
 XSetStandardProperties tells the window manager what to do, the window
@@ -329,7 +329,7 @@ window on the screen.
 (Xmapwindow *default-display* a-window)
 
 	The above function will map the window.  Only one last
-function needs to be caled for a window to appear on the screen.  This
+function needs to be called for a window to appear on the screen.  This
 function is XFlush.  This function, or another function that affects
 the event queue (discussed later) must be called whenever there is a
 drawing request for the X server.
@@ -344,8 +344,8 @@ scaling measurements.  Like most operati
 to change window attributes.  The attributes could be changed directly
 by calling XChangeWindowAttributes with one of the parameters being a
 C structure, with the new information, and another parameter to
-specifiy which attribute is being changed.  This could be clumbersome
-and inefficeint in lisp, but fortunately X usually provides a
+specify which attribute is being changed.  This could be clumbersome
+and inefficient in lisp, but fortunately X usually provides a
 functional way of doing a task.  Some functions for changing the
 window attributes are listed.  Like most functions in X the names are
 self descriptive of the function.
@@ -362,10 +362,10 @@ XDefineCursor
 
 
 	As can be seen, the regularity in nameing conventions of X
-routines.  Only the function XSelectInput will be discussd in this
+routines.  Only the function XSelectInput will be discussed in this
 report (see section E).  The list shown is meant to demonstrate how X
-names functions, and how X can provid for functional equivalents for
-most operations.  (Ofcourse any function that is not provided by X can
+names functions, and how X can provide for functional equivalents for
+most operations.  (Of course any function that is not provided by X can
 be written in lisp using primitive operations like
 XChangeWindowAttributes.  The same applies for all objects in X.)
 
@@ -386,16 +386,16 @@ is an example of a call to XGetGeometry.
 	*height-return* *border-width-return* *depth-return*) 
 
 	The values that are returned by XGetGeometry is pointed to by
-the parameters that are denoted by teh word 'return'.  A root of a
+the parameters that are denoted by the word 'return'.  A root of a
 window can be extracted, along with it's position, and size. Its
 border width can also be returned, along with it's depth ( a depth
 tells X how many colors can be drawn for a drawble).  This functions
-also demonstrates how poitners are used in Xakcl to return multiple
+also demonstrates how pointers are used in Xakcl to return multiple
 values.  It is necessary to allocate an area of memory in order to
 write into that memory locations.  The functions int-array and
 char-array will create a C array of integers and characters
 respectively.  A pointer to the array is returned. XGetGemoetry
-expects pointers to integers so it is necessary to alocate integer
+expects pointers to integers so it is necessary to allocate integer
 arrays of one element.  For example:
 
 
@@ -449,7 +449,7 @@ i. XSetBackGround and XSetForeGround.
 	XSetForeground and XSetBackground sets the foreground and
 background pixel as mentioned in section A.  In order to Allocate a
 pixel besides black and white, a call to XAllocNamedColor must be
-done.  XAllocNamedColor needs two Xcolor structrues, so they must be
+done.  XAllocNamedColor needs two Xcolor structures, so they must be
 created as well. For example:
 
 (setq pixel-xcolor (make-Xcolor))	
@@ -457,7 +457,7 @@ created as well. For example:
 (XAllocNamedColor display colormap  (get-c-string color) pixel-xcolor exact-rgb)
 
 	The above function will return a pixel value in the structure
-pixel-color.  this informaion can be extracted with (Xcolor-pixel
+pixel-color.  this information can be extracted with (Xcolor-pixel
 pixel-xcolor).  XAllocNamedColo also expects a colormap (the default
 colormap will do), a display, and a String specifying the color (for a
 list of colors see the file rgb.txt in /usr/lib/X11). Thus the
@@ -466,8 +466,8 @@ color.
 
 (Xsetforeground display GC (Xcolor-pixel  pixel-xcolor))
 
-	Similair to Xsetforeground, XSetBackGround will cause all
-drawings needing the background color to use the sepcified pixel
+	Similar to Xsetforeground, XSetBackGround will cause all
+drawings needing the background color to use the specified pixel
 value.
 
 
@@ -486,7 +486,7 @@ the way lines join.  The width is an int
 cap-style and join-style are constants.  The default styles are
 LineSolid, CapButt, and JoinMitter.  This will make lines appear
 solid.  They will join at a sharp angle and the lines will end in a
-flat edge.  See any X refernce manual for the complete options on the
+flat edge.  See any X reference manual for the complete options on the
 line styles.
 
 
@@ -514,7 +514,7 @@ fid).
 
 iv. XSetFunction
 
-	Xwindows draws by applying bit operations on the pixel vlaues
+	Xwindows draws by applying bit operations on the pixel values
 on the screen along with a mask that it creates called the plan_mask.
 Most often only the pixel already on the screen is manipulated.  This
 default logical operation is GXcopy (which is the default).  However
@@ -528,9 +528,9 @@ specified with a call to XSetFunction.
 	The above function will make X draw ghost images in mono color
 screens using the function Xor.  The pixel value on the screen is
 Xored with the pixel value of the plan_mask (which is derived from the
-foregroudn color).  On color screens the foregorund color must be set
+foreground color).  On color screens the foreground color must be set
 to (logxor foreground-pixel background-pixel) in order for ghosting
-effects to occurr.  Below is the complete function for ghosting
+effects to occur.  Below is the complete function for ghosting
 effects.
 
 (Xsetforeground  *default-display* *default-GC* (logxor foreground-pixel background-pixel ))
@@ -541,7 +541,7 @@ II.  Getting Information from the Graphi
 
 	In the above function, the foreground-pixel and
 background-pixel must be extracted from the graphics context.  In
-order to get information from the graphcis context the function
+order to get information from the graphics context the function
 XGetGCVlues must be used.  XGetGCVlues is an example of a X function
 that expects a structure, and a value mask.  Below are functions for
 extracted the foreground color from the graphics context.  Other
@@ -591,7 +591,7 @@ request.
 II. Drawing Rectangles
 
 	Drawing Rectangles is similar to drawing lines.  The only
-difference is that the size of the recatangle must be specified.
+difference is that the size of the rectangle must be specified.
 
 
 	 (XDrawRectangle *default-display* a-window *default-GC* 
@@ -604,7 +604,7 @@ The function expects the x and y positio
 
 II. Drawing Arcs.
 
-	Arcs can form enclosed areas such as elipses or cirlces or
+	Arcs can form enclosed areas such as ellipses or circles or
 they could be a curved line.  The function XDrawArc will draw arcs.
 
 
@@ -613,7 +613,7 @@ they could be a curved line.  The functi
 
 	This function call will draw a circle.  The Arc will be
 bounded by a rectangle.  The points 100 100 correspond to the upper
-left edge of the recatangle. 10 and 10 specifies the width and height
+left edge of the rectangle. 10 and 10 specifies the width and height
 respectively.  The starting and ending position of the arc must also
 be specified.  These two points are in sixty-fourths of a degrees.
 The first angle is relative to the three-o'clock position and the
@@ -630,18 +630,18 @@ III.  Drawing Text
 
 	With the font loaded in the Graphics Context as shown in
 Section C, several functions can be called in order to draw text.
-Only XDrawString will be dicussed here, but the other functions are
+Only XDrawString will be discussed here, but the other functions are
 similar.
 
 (XDrawString  *default-display*   a-window  *default-GC*  10 15 (get-c-string "hello") 4)
 (Xflush *default-display*)
 
 	The above function will draw the string 'hello' at positions
-10, 15 with the font specified in the default grpahics context.
+10, 15 with the font specified in the default graphics context.
 XDrawString also expects the length of the string (in this case 4),
 and the display.
 
-	Often it is necesssary to the size of the string (the
+	Often it is necessary to the size of the string (the
 rectangle that bounds the string). This can be done with a call to
 XTextExtents.
 
@@ -664,9 +664,9 @@ width (an ascent tells how far above a b
 while the descent tells how far below).  After a call to XTextExtents,
 the ascent will be have the maximum ascent of all the characters in
 the string.  Likewise the descent will have the maximum descent of all
-the characters.  The width will be the sum of the characer width of
+the characters.  The width will be the sum of the character width of
 all the characters in the string (thus the width of the string in
-number of pixels).  From this information, the user shouldbe able to
+number of pixels).  From this information, the user should be able to
 position text precisely on the screen.
 
 
@@ -677,15 +677,15 @@ E. Handling Events
 
 	So far only request to the X server to do output on the screen
 have been discussed.  X also has a means of getting information about
-what is inputed by a user as well.  The inputs can range from moving
+what is inputted by a user as well.  The inputs can range from moving
 or clicking the mouse to keys being pressed on the keyboard.  The
-input also encompases events like a window being uncovered or exposed
+input also encompasses events like a window being uncovered or exposed
 by another window, or a window being resized.  
 
 
 I.  Setting the Input
 
-	These inputs are called Events.  The Events themseleves only
+	These inputs are called events.  The events themselves only
 have meaning when they pertain to a window.  In other words, events
 occur in windows.  Thus an attribute of the window must be set.  The
 function XSelectInput must be used.
@@ -698,7 +698,7 @@ Events, PointerMotion Events, and Exposu
 seen this is specified using mask (for other mask see a Xlib manual or
 the file X.lsp or X.h).
 
-	After Specifiying the input, all events that occur in that
+	After specifying the input, all events that occur in that
 will go on the event queue.  The event queue is a queue of what events
 have occurred, the first one being on top.  The client can both get
 information form the queue and manipulate the queue.  
@@ -762,12 +762,12 @@ XSync can be used to do this.  For examp
 
 		F. Conclusion
 
-	With the commands demonstarted in this tutorial, most
+	With the commands demonstrated in this tutorial, most
 applications can be managed.  Windows can be created, and graphics
 operations can be performed.  For more complex applications a widget
 set can be created similar to the X Intrinsics library and the Athena
 Widget Set.  For a lisp like implementation of widgets and an advance
-aplications see the GWM application, in the GWM Manual by Colas
+applications see the GWM application, in the GWM Manual by Colas
 Nahaboo.  GWM is a generic window manager, that is similar to Xakcl.
 It supports objects that are similar to Widgets in most C Xwindows
 libraries.
--- gcl27-2.7.0.orig/xgcl-2/gcl_Xakcl.example.lsp
+++ gcl27-2.7.0/xgcl-2/gcl_Xakcl.example.lsp
@@ -227,7 +227,7 @@
 ;;the drawing goes so fast that you can't see the text invert, so the
 ;;function wiats for for about .2 seconds.  but it would be better to
 ;;keep the text inverted until the button is released this is done by
-;;setting the quit window to have buton release events as well and
+;;setting the quit window to have button release events as well and
 ;;handling it appropriately
 
 			(dotimes (i 1500))
--- gcl27-2.7.0.orig/xgcl-2/gcl_Xinit.lsp
+++ gcl27-2.7.0/xgcl-2/gcl_Xinit.lsp
@@ -28,10 +28,10 @@
 ;;large extent.  it would be beneficial to use a X 11 version 4, manual
 ;;in order to look up functions.  the only unique functions of Xakcl are those
 ;;that involove manipulating C structs. all functions involved in creating
-;;a C struct in X starts with a 'make' followed by the structure name.  all
+;;a C struct in X starts with a 'make' followed by the structure name.  All
 ;;functions involved in getting a field of a C struct strats with the
 ;;name of the C struct followed by the name of the field.  the
-;;parameters it excepts is the variable contaning the structure.  all
+;;parameters it excepts is the variable containing the structure.  All
 ;;functions to set a field of a C struct starts with 'set' followed by
 ;;the C struct name followed by the field name.  these functions accept
 ;;as parameter, the variable containing the struct and the value to be
@@ -103,8 +103,8 @@
 
 
 ;;;;;;;;;;;;;;;;;;;;;;
-;;this is an example of creating a window.  this function takes care of
-;;positioning, size and other attirbutes of the window.
+;;This is an example of creating a window.  This function takes care of
+;;positioning, size and other attributes of the window.
 
 (defun open-window(&key (pos-x  *pos-x* ) (pos-y  *pos-y*) (win-width *win-width*) 
 			(win-height *win-height* ) 
@@ -135,7 +135,7 @@
     (Xmapwindow *default-display* a-window)
 
 ;;the X server needs to have the output buffer sent to it before it can
-;;process requests.  this is acomplished with XFlush or functions that
+;;process requests.  this is accomplished with XFlush or functions that
 ;;read and manipulate the event queue.  remember to do this after
 ;;operations that won't be calling an eventhandling function
 
--- gcl27-2.7.0.orig/xgcl-2/gcl_draw-gates.lsp
+++ gcl27-2.7.0/xgcl-2/gcl_draw-gates.lsp
@@ -67,7 +67,7 @@
 
 (defun draw-xor (w x y)
   (window-draw-arc-xy w (- x 16) (+ y 16) 23 23 315 90)
-  (draw-or w (+ x 6) y)))
+  (draw-or w (+ x 6) y))
 
 (setf (get 'xor 'picmenu-spec)
       '(picmenu-spec  46 32 ((in1 (6 26)) (in2 (6 6)) (out (46 16))) t
@@ -75,7 +75,7 @@
 
 (defun draw-nor (w x y)
   (window-draw-circle-xy w (+ x 44) (+ y 16) 4)
-  (draw-or w x y)))
+  (draw-or w x y))
 
 (setf (get 'nor 'picmenu-spec)
       '(picmenu-spec  48 32 ((in1 (0 26)) (in2 (0 6)) (out (48 16))) t
@@ -85,7 +85,7 @@
 (defun draw-nor2 (w x y)
   (window-draw-circle-xy w (+ x 4) (+ y 6) 4)
   (window-draw-circle-xy w (+ x 4) (+ y 26) 4)
-  (draw-and w (+ x 8) y)))
+  (draw-and w (+ x 8) y))
 
 (setf (get 'nor2 'picmenu-spec)
       '(picmenu-spec  48 32 ((in1 (0 26)) (in2 (0 6)) (out (48 16))) t
@@ -94,7 +94,7 @@
 (defun draw-nand2 (w x y)
   (window-draw-circle-xy w (+ x 4) (+ y 6) 4)
   (window-draw-circle-xy w (+ x 4) (+ y 26) 4)
-  (draw-or w (+ x 4) y)))
+  (draw-or w (+ x 4) y))
 
 (setf (get 'nand2 'picmenu-spec)
       '(picmenu-spec  44 32 ((in1 (0 26)) (in2 (0 6)) (out (44 16))) t
--- gcl27-2.7.0.orig/xgcl-2/gcl_dwtestcases.lsp
+++ gcl27-2.7.0/xgcl-2/gcl_dwtestcases.lsp
@@ -1,11 +1,11 @@
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_dwtrans.lsp")
+;(load "/stage/ftp/pub/novak/xgcl-4/gcl_dwtrans.lsp")
 (use-package 'xlib)
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_drawtrans.lsp")
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_editorstrans.lsp")
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_lispservertrans.lsp")
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_menu-settrans.lsp")
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_dwtest.lsp")
-(load "/stage/ftp/pub/novak/xgcl-4/gcl_draw-gates.lsp")
+(load "../xgcl-2/gcl_drawtrans.lsp")
+(load "../xgcl-2/gcl_editorstrans.lsp")
+(load "../xgcl-2/gcl_lispservertrans.lsp")
+(load "../xgcl-2/gcl_menu-settrans.lsp")
+(load "../xgcl-2/gcl_dwtest.lsp")
+(load "../xgcl-2/gcl_draw-gates.lsp")
 
 (wtesta)
 (wtestb)
--- gcl27-2.7.0.orig/xgcl-2/gcl_sysinit.lsp
+++ gcl27-2.7.0/xgcl-2/gcl_sysinit.lsp
@@ -62,7 +62,7 @@
 
 ;; invoke this to initialize maxima.
 
-;; make this if you dont want the invocation done automatically.
+;; make this if you don't want the invocation done automatically.
 ;(defentry user::user-init () "user_init")
 
 
--- gcl27-2.7.0.orig/xgcl-2/makefile
+++ gcl27-2.7.0/xgcl-2/makefile
@@ -37,7 +37,7 @@ clean:
 	rm -rf dwdoc objects
 
 install: docs
-	-mkdir -p $(DESTDIR)$(INFO_DIR)../doc
-	-cp -r dwdoc $(DESTDIR)$(INFO_DIR)../doc
-	-cp *tex $(DESTDIR)$(INFO_DIR)../doc
-	find -name "*.pdf" -exec cp {} $(DESTDIR)$(INFO_DIR)../doc \;
+	-mkdir -p $(DESTDIR)$(INFO_DIR)../doc/gcl${PEXT}
+	-cp -r dwdoc $(DESTDIR)$(INFO_DIR)../doc/gcl${PEXT}
+	-cp *tex $(DESTDIR)$(INFO_DIR)../doc/gcl${PEXT}
+	find -name "*.pdf" -exec cp {} $(DESTDIR)$(INFO_DIR)../doc/gcl${PEXT} \;
