Blob Blame Raw
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.
 .
 gcl (2.6.12-41) unstable; urgency=medium
 .
   * pathnames1.4, kfreebsd fix
Author: Camm Maguire <camm@debian.org>

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

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2016-10-26

--- gcl-2.6.12.orig/cmpnew/gcl_cmpmain.lsp
+++ gcl-2.6.12/cmpnew/gcl_cmpmain.lsp
@@ -488,20 +488,6 @@ Cannot compile ~a.~%"
 	  (t (setq dir ".")))
     (setq na  (namestring
 	       (make-pathname :name name :type (pathname-type(first args)))))
-   #+(or dos winnt)
-      (format nil "~a -I~a ~a ~a -c -w ~a -o ~a"
-	      *cc*
-	      (concatenate 'string si::*system-directory* "../h")
-	      (if (and (boundp '*c-debug*) *c-debug*) " -g " "")
-	      (case *speed*
-		    (3 *opt-three* )
-		    (2 *opt-two*) 
-		    (t ""))	
-	      (namestring (make-pathname  :type "c" :defaults (first args)))
-	      (namestring (make-pathname  :type "o" :defaults (first args)))
-	      )
-
-   #-(or dos winnt)
    (format nil  "~a -I~a ~a ~a -c ~a -o ~a ~a"
 	   *cc*
 	   (concatenate 'string si::*system-directory* "../h")
@@ -527,8 +513,8 @@ Cannot compile ~a.~%"
 			 #+expect-unresolved "-expect_unresolved '*'"
 			 na na na))	
 			    
-	     #+bsd ""; "-w"
-	     #-(or aix3 bsd irix3) " 2> /dev/null ")
+	     #+(or winnt bsd) ""; "-w"
+	     #-(or aix3 bsd winnt irix3) " 2> /dev/null ")
 		  
 		 
 	   )
@@ -543,30 +529,14 @@ Cannot compile ~a.~%"
 	  (prep-win-path-acc finish (concatenate 'string acc start "~")))
       (concatenate 'string acc s))))
 
-#+winnt
-(defun no-device (c)
-  (let* ((c (namestring (truename c)))
-	 (p (search ":" c)))
-    (if p (subseq c (1+ p)) c)))
-
-;; #+winnt
-;; (defun prep-win-path (c o)
-;;   (let* ((w si::*wine-detected*)
-;; 	 (c (if w (no-device c) c))
-;; 	 (o (if w (no-device o) o)))
-;;     (prep-win-path-acc (compiler-command c o) "")))
-
 (defun compiler-cc (c-pathname o-pathname)
   (safe-system
    (format
      nil
-     (prog1
-	 #+irix5 (compiler-command c-pathname o-pathname )
-	 #+vax "~a ~@[~*-O ~]-S -I. -w ~a ; as -J -W -o ~A ~A"
-	 #+(or system-v e15 dgux sgi ) "~a ~@[~*-O ~]-c -I. ~a 2> /dev/null"
-	 #+winnt (prep-win-path-acc (compiler-command c-pathname o-pathname) "")
-	 #-winnt (compiler-command c-pathname o-pathname)
-	)
+     #+vax "~a ~@[~*-O ~]-S -I. -w ~a ; as -J -W -o ~A ~A"
+     #+(or system-v e15 dgux sgi ) "~a ~@[~*-O ~]-c -I. ~a 2> /dev/null"
+     #+winnt (prep-win-path-acc (compiler-command c-pathname o-pathname) "")
+     #-(or vax system-v e15 dgux sgi) (compiler-command c-pathname o-pathname)
      *cc*
      (if (or (= *speed* 2) (= *speed* 3)) t nil)
             (namestring c-pathname)
@@ -763,20 +733,9 @@ Cannot compile ~a.~%"
     `(let ((,q (si::string-match ,x ,y ,@(when z (list z)))))
        (if (= ,q -1) (length ,y) ,q)))))
 
-(defun ts (s &optional (r ""))
-  (declare (string s) (ignorable r))
-  #+winnt
-  (if (not si::*wine-detected*) s
-    (let* ((x (sml (fcr #u"[^ \n\t]") s))
-	   (y (sml (fcr #u"[ \n\t]") s x))
-	   (f (subseq s x y))
-	   (l (subseq s y))
-	   (k (when (> (length f) 0) (aref f 0)))
-	   (q (if (eql k #\") (string k) ""))
-	   (f (if (eql k #\") (subseq f 1 (1- (length f))) f))
-	   (f (if (and k (not (eql k #\-))) (namestring (no-device f)) f)))
-      (if k (concatenate 'string r q f q (ts l " ")) "")))
-  #-winnt s)
+(defun ts (s)
+  (declare (string s))
+  s)
 
 (defun mdelete-file (x)
   (delete-file (ts (namestring x))))
@@ -795,8 +754,7 @@ Cannot compile ~a.~%"
 			       raw))
 	 (map (merge-pathnames (make-pathname
 				:name (concatenate 'string (pathname-name raw) "_map")) raw))
-	 #+winnt (raw (merge-pathnames (make-pathname :type "exe") raw))
-	 )
+	 #+winnt (raw (merge-pathnames (make-pathname :type "exe") raw)))
 
     (with-open-file (st (namestring map) :direction :output))
     (safe-system 
--- gcl-2.6.12.orig/configure
+++ gcl-2.6.12/configure
@@ -624,7 +624,6 @@ use
 GNU_LD
 LEADING_UNDERSCORE
 EXTRA_LOBJS
-PRELINK_CHECK
 O2FLAGS
 O3FLAGS
 NIFLAGS
@@ -678,6 +677,7 @@ EGREP
 GREP
 MAKEINFO
 AWK
+GCL_CC
 CPP
 OBJEXT
 EXEEXT
@@ -686,7 +686,7 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
-PROCESSOR_FLAGS
+PRELINK_CHECK
 host_os
 host_vendor
 host_cpu
@@ -738,41 +738,38 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_machine
 enable_widecons
 enable_safecdr
 enable_safecdrdbg
 enable_prelink
-enable_fastimmfix
-enable_holepage
 enable_vssize
 enable_bdssize
 enable_ihssize
 enable_frssize
-enable_machine
-enable_immfix
-enable_notify
-enable_tcltk
-enable_tkconfig
-enable_tclconfig
 enable_infodir
 enable_emacsdir
-enable_common_binary
-enable_japi
-enable_xdr
 enable_xgcl
 enable_dlopen
 enable_statsysbfd
 enable_dynsysbfd
 enable_custreloc
 enable_debug
-enable_gprof
 enable_static
 enable_pic
-enable_oldgmp
+enable_gprof
 enable_dynsysgmp
 with_x
-enable_readline
+enable_xdr
+enable_immfix
+enable_fastimmfix
 enable_ansi
+enable_japi
+enable_readline
+enable_tcltk
+enable_tkconfig
+enable_tclconfig
+enable_notify
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1410,51 +1407,37 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-use a three word cons with simplified typing
-protect cdr from immfix and speed up type processing
-debug safecdr code
---enable-prelink will insist that the produced images may be prelinked
---enable-fastimmfix=XXXX will reject low immediate fixnums unless 1<<XXXX can be attained
- --enable-holepage=XXXX will compile in a XXX-sized hole between the heap and relocatable memory area (eg '--enable-holepage=64*1024' would give 64K pages allowing 256 MB if pages are 4K each)
- --enable-vssize=XXXX will compile in a value stack of size XXX
- --enable-bdssize=XXXX will compile in a binding stack of size XXX
- --enable-ihssize=XXXX will compile in a invocation history stack of size XXX
- --enable-frssize=XXXX will compile in a frame stack of size XXX
- --enable-machine=XXXX will force the use of one of the definitions in h/XXXX.defs
- --enable-immfix        will enable an immediate fixnum table
-                         above the C stack
- --enable-notify=no will disable the automatic notification of gcl maintainers of successful builds/problems
- try to build gcl-tk
- --enable-tkconfig=XXXX will force the use of a TK_CONFIG_PREFIX=XXXXX as place to look for tkConfig.sh and tclConfig.sh
- --enable-tclconfig=XXXX will force the use of a TCL_CONFIG_PREFIX=XXXXX as place to look for tclConfig.sh and tclConfig.sh
- --enable-infodir=XXXX will force the use of a INFO_DIR=XXXXX as place to look for info
- --enable-emacsdir=XXXX will manually specify the location for elisp files
- --enable-common-binary=yes forces use of lowest common denominator instruction sets, (default is =yes)
- --enable-japi=yes will compile in support for the JAPI graphical interface if present on your system
- --enable-xdr=yes will compile in support for XDR
- --enable-xgcl=yes will compile in support for XGCL
- --enable-dlopen uses dlopen for loading objects, which can then not be retained  in saved images
-
- --enable-statsysbfd uses a static sytem bfd library for loading and relocationing object files
-
- --enable-dynsysbfd uses a dynamic shared sytem bfd library for loading and relocationing object files
-
- --enable-custreloc uses custom gcl code if available for loading  and relocationing object files
-
- --enable-debug builds gcl with -g in CFLAGS to enable running under gdb
-
- --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof
-
- --enable-static will link your GCL against static as opposed to shared system libraries
- --enable-pic builds gcl with -fPIC in CFLAGS
-
- --enable-oldgmp will link against gmp2 instead of gmp3
-
- --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source
-
---enable-readline    enables command line completion via the readline library
---enable-ansi builds a large gcl aiming for ansi compliance,
-		    --disable-ansi builds the smaller traditional CLtL1 image
+  --enable-machine=XXXX will force the use of one of the definitions in h/XXXX.defs
+  --enable-widecons will use a three word cons with simplified typing
+  --enable-safecdr will protect cdr from immfix and speed up type processing
+  --enable-safecdrdbg will debug safecdr code
+  --enable-prelink will insist that the produced images may be prelinked
+  --enable-vssize=XXXX will compile in a value stack of size XXX
+  --enable-bdssize=XXXX will compile in a binding stack of size XXX
+  --enable-ihssize=XXXX will compile in a invocation history stack of size XXX
+  --enable-frssize=XXXX will compile in a frame stack of size XXX
+  --enable-infodir=XXXX will force the use of a INFO_DIR=XXXXX as place to look for info
+  --enable-emacsdir=XXXX will manually specify the location for elisp files
+  --enable-xgcl=yes will compile in support for XGCL
+  --enable-dlopen uses dlopen for loading objects, which can then not be retained  in saved images
+  --enable-statsysbfd uses a static sytem bfd library for loading and relocationing object files
+  --enable-dynsysbfd uses a dynamic shared sytem bfd library for loading and relocationing object files
+  --enable-custreloc uses custom gcl code if available for loading  and relocationing object files
+  --enable-debug builds gcl with -g in CFLAGS to enable running under gdb
+  --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-ansi builds a large gcl aiming for ansi compliance
+  --enable-japi=yes will compile in support for the JAPI graphical interface if present on your system
+  --enable-readline    enables command line completion via the readline library
+  --enable-tcltk will try to build gcl-tk
+  --enable-tkconfig=XXXX will force the use of a TK_CONFIG_PREFIX=XXXXX as place to look for tkConfig.sh and tclConfig.sh
+  --enable-tclconfig=XXXX will force the use of a TCL_CONFIG_PREFIX=XXXXX as place to look for tclConfig.sh and tclConfig.sh
+  --enable-notify=no will disable the automatic notification of gcl maintainers of successful builds/problems
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1844,6 +1827,52 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_member
 
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
 # ac_fn_c_check_func LINENO FUNC VAR
 # ----------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -2506,226 +2535,6 @@ ac_config_headers="$ac_config_headers h/
 VERSION=`cat majvers`.`cat minvers`
 
 
-# some parts of this configure script are taken from the tcl configure.in
-
-#
-# Arguments
-#
-
-
-
-
-# Check whether --enable-widecons was given.
-if test "${enable_widecons+set}" = set; then :
-  enableval=$enable_widecons;
-$as_echo "#define WIDE_CONS 1" >>confdefs.h
-
-fi
-
-
-
-# Check whether --enable-safecdr was given.
-if test "${enable_safecdr+set}" = set; then :
-  enableval=$enable_safecdr;
-else
-  enable_safecdr="no"
-fi
-
-if test "$enable_safecdr" = "yes" ; then
-
-$as_echo "#define USE_SAFE_CDR 1" >>confdefs.h
-
-fi
-# Check whether --enable-safecdrdbg was given.
-if test "${enable_safecdrdbg+set}" = set; then :
-  enableval=$enable_safecdrdbg;
-$as_echo "#define DEBUG_SAFE_CDR 1" >>confdefs.h
-
-fi
-
-
-# Check whether --enable-prelink was given.
-if test "${enable_prelink+set}" = set; then :
-  enableval=$enable_prelink; PRELINK_CHECK=t
-else
-  PRELINK_CHECK=
-fi
-
-
-# Check whether --enable-fastimmfix was given.
-if test "${enable_fastimmfix+set}" = set; then :
-  enableval=$enable_fastimmfix;
-else
-  enable_fastimmfix=64
-fi
-
-
-
-# Check whether --enable-holepage was given.
-if test "${enable_holepage+set}" = set; then :
-  enableval=$enable_holepage;
-cat >>confdefs.h <<_ACEOF
-#define HOLEPAGE $enable_holepage
-_ACEOF
-
-fi
-
-
-# Check whether --enable-vssize was given.
-if test "${enable_vssize+set}" = set; then :
-  enableval=$enable_vssize;
-else
-  enable_vssize=262144
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define VSSIZE $enable_vssize
-_ACEOF
-
-
-# Check whether --enable-bdssize was given.
-if test "${enable_bdssize+set}" = set; then :
-  enableval=$enable_bdssize;
-else
-  enable_bdssize=2048
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define BDSSIZE $enable_bdssize
-_ACEOF
-
-
-# Check whether --enable-ihssize was given.
-if test "${enable_ihssize+set}" = set; then :
-  enableval=$enable_ihssize;
-else
-  enable_ihssize=4096
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define IHSSIZE $enable_ihssize
-_ACEOF
-
-
-# Check whether --enable-frssize was given.
-if test "${enable_frssize+set}" = set; then :
-  enableval=$enable_frssize;
-else
-  enable_frssize=4096
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define FRSSIZE $enable_frssize
-_ACEOF
-
-
-# Check whether --enable-machine was given.
-if test "${enable_machine+set}" = set; then :
-  enableval=$enable_machine; enable_machine=$enableval
-else
-  enable_machine=""
-fi
-
-
-# Check whether --enable-immfix was given.
-if test "${enable_immfix+set}" = set; then :
-  enableval=$enable_immfix;
-else
-  enable_immfix=yes
-fi
-
-
-#AC_ARG_ENABLE(gmp,[ --enable-gmp=no will disable use of GMP gnu multiprecision arithmetic, (default is =yes)] ,
-#[use_gmp=$enableval],[use_gmp="yes"])
-
-use_gmp="yes"
-
-# Check whether --enable-notify was given.
-if test "${enable_notify+set}" = set; then :
-  enableval=$enable_notify; enable_notify=$enableval
-else
-  enable_notify="yes"
-fi
-
-
-# Check whether --enable-tcltk was given.
-if test "${enable_tcltk+set}" = set; then :
-  enableval=$enable_tcltk; enable_tcltk=$enableval
-else
-  enable_tcltk="yes"
-fi
-
-
-# Check whether --enable-tkconfig was given.
-if test "${enable_tkconfig+set}" = set; then :
-  enableval=$enable_tkconfig; TK_CONFIG_PREFIX=$enableval
-else
-  TK_CONFIG_PREFIX="unknown"
-fi
-
-
-
-# Check whether --enable-tclconfig was given.
-if test "${enable_tclconfig+set}" = set; then :
-  enableval=$enable_tclconfig; TCL_CONFIG_PREFIX=$enableval
-else
-  TCL_CONFIG_PREFIX="unknown"
-fi
-
-
-# Check whether --enable-infodir was given.
-if test "${enable_infodir+set}" = set; then :
-  enableval=$enable_infodir; INFO_DIR=$enableval
-else
-  INFO_DIR=$prefix/share/info
-fi
-
-INFO_DIR=`eval echo $INFO_DIR/`
-
-# Check whether --enable-emacsdir was given.
-if test "${enable_emacsdir+set}" = set; then :
-  enableval=$enable_emacsdir; EMACS_SITE_LISP=$enableval
-else
-  EMACS_SITE_LISP=$prefix/share/emacs/site-lisp
-fi
-
-EMACS_SITE_LISP=`eval echo $EMACS_SITE_LISP/`
-
-# Check whether --enable-common-binary was given.
-if test "${enable_common_binary+set}" = set; then :
-  enableval=$enable_common_binary; use_common_binary=$enableval
-else
-  use_common_binary="yes"
-fi
-
-
-# Check whether --enable-japi was given.
-if test "${enable_japi+set}" = set; then :
-  enableval=$enable_japi; try_japi=$enableval
-else
-  try_japi="no"
-fi
-
-
-# Check whether --enable-xdr was given.
-if test "${enable_xdr+set}" = set; then :
-  enableval=$enable_xdr; enable_xdr=$enableval
-else
-  enable_xdr="yes"
-fi
-
-
-# Check whether --enable-xgcl was given.
-if test "${enable_xgcl+set}" = set; then :
-  enableval=$enable_xgcl; enable_xgcl=$enableval
-else
-  enable_xgcl="yes"
-fi
-
 
 #
 # Host information
@@ -2856,380 +2665,247 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: host=$host" >&5
 $as_echo "host=$host" >&6; }
 
-PROCESSOR_FLAGS=${PROCESSOR_FLAGS:-""}
-
 use=unknown
-TLDFLAGS=""
 case $canonical in
-     older)
-     use=386-bsd;;
-
-     sh4*linux*)
-	use=sh4-linux;;
-
-     *x86_64*linux*)
-	use=amd64-linux;;
-
-     *x86_64*kfreebsd*)
-	use=amd64-kfreebsd;;
-
-     *86*linux*)
-	use=386-linux;;
-
-     *86*kfreebsd*)
-	use=386-kfreebsd;;
-
-     *86*gnu*)
-	use=386-gnu;;
-
-# m6800 not working with gcc-3.2
-     m68k*linux*)
-       if test "$use_common_binary" = "yes"; then
-         host=m68020-unknown-linux-gnu
-         echo "The host is canonicalised to $host"
-       fi
-     	use=m68k-linux;;
-
-     alpha*linux*)
-     	use=alpha-linux;;
-
-     mips*linux*)
-     	use=mips-linux;;
-
-     mipsel*linux*)
-     	use=mipsel-linux;;
-
-     sparc*linux*)
-     	use=sparc-linux;;
-
-     aarch64*linux*)
-        use=aarch64-linux;;
-
-     arm*linux*)
-     	use=arm-linux;;
-
-     s390*linux*)
-     	use=s390-linux;;
-
-     ia64*linux*)
-     	use=ia64-linux;;
-
-     hppa*linux*)
-     	use=hppa-linux;;
-
-     powerpc*linux*)
-     	use=powerpc-linux;;
-
-     powerpc-*-darwin*)
-     	use=powerpc-macosx;;
-
-     *86*darwin*)
-     	use=386-macosx
-	if test "$build_cpu" = "x86_64" ; then
-	   CFLAGS="-m64 $CFLAGS";
-	   LDFLAGS="-m64 -Wl,-headerpad,72 -Wl,-no_pie $LDFLAGS";
-	else
-	   CFLAGS="-m32 $CFLAGS";
-	   LDFLAGS="-m32  -Wl,-headerpad,56 -Wl,-no_pie $LDFLAGS";
+    sh4*linux*) use=sh4-linux;;
+    *x86_64*linux*) use=amd64-linux;;
+    *x86_64*kfreebsd*)	use=amd64-kfreebsd;;
+    *86*linux*) use=386-linux;;
+    *86*kfreebsd*) use=386-kfreebsd;;
+    *86*gnu*)	use=386-gnu;;
+    m68k*linux*) use=m68k-linux;;
+    alpha*linux*) use=alpha-linux;;
+    mips*linux*) use=mips-linux;;
+    mipsel*linux*) use=mipsel-linux;;
+    sparc*linux*) use=sparc-linux;;
+    aarch64*linux*) use=aarch64-linux;;
+    arm*linux*) use=arm-linux;;
+    s390*linux*) use=s390-linux;;
+    ia64*linux*) use=ia64-linux;;
+    hppa*linux*) use=hppa-linux;;
+    powerpc*linux*) use=powerpc-linux;;
+    powerpc-*-darwin*) use=powerpc-macosx;;
+    *86*darwin*) use=386-macosx;;
+    i*mingw*|i*msys*) use=mingw;;
+    i*cygwin*)
+        if $CC -v 2>&1 | fgrep ming > /dev/null ;
+        then use=mingw
+        else use=gnuwin95
         fi;;
+    *openbsd*) use=FreeBSD;;
+    sparc-sun-solaris*) use=solaris;;
+    i?86-pc-solaris*) use=solaris-i386;;
+esac
 
-     alpha-dec-osf)
-     use=alpha-osf1;;
-
-     mips-dec-ultrix)
-     use=dec3100;;
-
-     old)
-     use=dos-go32;;
-
-     *86*-freebsd*)
-     use=FreeBSD;;
-
-     hp3*-*hpux*)
-     use=hp300;;
-
-     hp3*-*-*bsd*)
-     use=hp300-bsd;;
-
-     hppa*-*hpux*)
-     use=hp800;;
-
-     mips-sgi-irix)
-       case $system in
-           IRIX5*)
-            use=irix5;;
-           IRIX6*)
-            use=irix6;;
-           IRIX3*)
-            use=sgi4d;;
-       esac ;;
-
-
-     m68k-apple-aux*)
-     use=mac2;;
-
-     old)
-     use=mp386;;
+# Check whether --enable-machine was given.
+if test "${enable_machine+set}" = set; then :
+  enableval=$enable_machine; echo enable_machine=$enableval ; use=$enableval
+fi
 
-     *86-ncr-sysv4)
-     use=ncr;;
 
-     *3-986-*netbsd*)
-     use=NetBSD;;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: use=$use" >&5
+$as_echo "use=$use" >&6; }
 
-     old)
-     use=NeXT;;
+def_dlopen="no"
+def_statsysbfd="no"
+def_custreloc="yes"
+def_oldgmp="no"
+def_pic="no";
+def_static="no";
+def_debug="no";
+case $use in
+    *kfreebsd)
+	ln -snf linux.defs h/$use.defs;;
+    *gnu)
+	ln -snf linux.defs h/$use.defs;;
+    *linux)
+	ln -snf linux.defs h/$use.defs;
+	case $use in
+	    ia64*)
+		def_dlopen="yes" ; def_custreloc="no" ;;
+	    hppa*)
+		def_pic="yes" ;;
+	esac;;
+esac
 
-     old)
-     use=NeXT30-m68k;;
+# Check whether --enable-widecons was given.
+if test "${enable_widecons+set}" = set; then :
+  enableval=$enable_widecons; if test "$enableval" = "yes" ; then
+$as_echo "#define WIDE_CONS 1" >>confdefs.h
+ fi
+fi
 
-     *86-*nextstep*)
-     use=NeXT32-i386;;
 
-     *m68*-*nextstep*)
-     use=NeXT32-m68k;;
+# Check whether --enable-safecdr was given.
+if test "${enable_safecdr+set}" = set; then :
+  enableval=$enable_safecdr; if test "$enableval" = "yes" ; then
 
-     *rs6000-*-aix4*)
-     use=rios;;
+$as_echo "#define USE_SAFE_CDR 1" >>confdefs.h
 
-     *rs6000-*-aix3*)
-     use=rios-aix3;;
+		   # Check whether --enable-safecdrdbg was given.
+if test "${enable_safecdrdbg+set}" = set; then :
+  enableval=$enable_safecdrdbg; if test "$enableval" = "yes" ; then
+$as_echo "#define DEBUG_SAFE_CDR 1" >>confdefs.h
+ fi
+fi
 
-     old)
-     use=rt_aix;;
+	       fi
+fi
 
-     old)
-     use=sgi;;
 
-     sparc-sun-solaris*)
-     use=solaris;;
+# Check whether --enable-prelink was given.
+if test "${enable_prelink+set}" = set; then :
+  enableval=$enable_prelink; if test "$enable_prelink" = "yes" ; then PRELINK_CHECK=t; fi
+fi
 
-     i?86-pc-solaris*)
-     use=solaris-i386;;
 
-     old)
-     use=sun2r3;;
 
-     old)
-     use=sun3;;
+# Check whether --enable-vssize was given.
+if test "${enable_vssize+set}" = set; then :
+  enableval=$enable_vssize;
+cat >>confdefs.h <<_ACEOF
+#define VSSIZE $enableval
+_ACEOF
 
-     m68*-sunos*)
-     use=sun3-os4;;
+fi
 
-     old)
-     use=sun386i;;
+# Check whether --enable-bdssize was given.
+if test "${enable_bdssize+set}" = set; then :
+  enableval=$enable_bdssize;
+cat >>confdefs.h <<_ACEOF
+#define BDSSIZE $enableval
+_ACEOF
 
-     sparc*sunos*)
-     use=sun4;;
+fi
 
-     *86-sequent-dynix)
-     use=symmetry;;
+# Check whether --enable-ihssize was given.
+if test "${enable_ihssize+set}" = set; then :
+  enableval=$enable_ihssize;
+cat >>confdefs.h <<_ACEOF
+#define IHSSIZE $enableval
+_ACEOF
 
-     u370*aix)
-     use=u370_aix;;
+fi
 
-     old)
-     use=vax;;
+# Check whether --enable-frssize was given.
+if test "${enable_frssize+set}" = set; then :
+  enableval=$enable_frssize;
+cat >>confdefs.h <<_ACEOF
+#define FRSSIZE $enableval
+_ACEOF
 
-     i*mingw*)
-       if test "$use_common_binary" = "yes"; then
-         host=i386-pc-mingw32
-	 PROCESSOR_FLAGS="-march=i386 "
-         echo "The host is canonicalised to $host"
-       fi
-     use=mingw;;
+fi
 
-     i*cygwin*)
-	if $CC -v 2>&1 | fgrep ming > /dev/null ;
-            then use=mingw
-          else  use=gnuwin95
-        fi;;
 
-     *openbsd*)
-	# 'ld -Z' means disable W^X
-	TLDFLAGS="$TLDFLAGS -Z"
-	use=FreeBSD;;
+# Check whether --enable-infodir was given.
+if test "${enable_infodir+set}" = set; then :
+  enableval=$enable_infodir; INFO_DIR=$enableval
+else
+  INFO_DIR=$prefix/share/info
+fi
 
-esac
+INFO_DIR=`eval echo $INFO_DIR/`
 
+# Check whether --enable-emacsdir was given.
+if test "${enable_emacsdir+set}" = set; then :
+  enableval=$enable_emacsdir; EMACS_SITE_LISP=$enableval
+else
+  EMACS_SITE_LISP=$prefix/share/emacs/site-lisp
+fi
 
+EMACS_SITE_LISP=`eval echo $EMACS_SITE_LISP/`
 
-echo enable_machine=$enable_machine
-if test "x$enable_machine" != "x" ; then
-  use=$enable_machine
+# Check whether --enable-xgcl was given.
+if test "${enable_xgcl+set}" = set; then :
+  enableval=$enable_xgcl;
+else
+  enable_xgcl=yes
 fi
 
-def_dlopen="no"
-def_statsysbfd="no"
-def_custreloc="yes"
-#def_statsysbfd="yes"
-#def_custreloc="no"
-def_locbfd="no"
-def_oldgmp="no"
-def_pic="no";
-def_static="no";
-def_debug="no";
-case $use in
-     *kfreebsd)
-	ln -snf linux.defs h/$use.defs;;
-     *gnu)
-	ln -snf linux.defs h/$use.defs;;
-     *linux)
-	ln -snf linux.defs h/$use.defs;
-	case $use in
-# def_static -- Function descriptors are currently realized at runtime in a non-reproducible fashion
-# on these architectures -- CM
-     	        powerpc*)
-#			if test "$host_cpu" = "powerpc64" ; then def_dlopen="yes" ; def_custreloc="no" ; fi
-			;;
-		ia64*)
-			def_dlopen="yes" ; def_custreloc="no" ;;
-		hppa*)
-			def_pic="yes" ;;
-#			def_dlopen="yes" ; def_custreloc="no" ; def_pic="yes" ;;
-	esac;;
-esac
 
 # Check whether --enable-dlopen was given.
 if test "${enable_dlopen+set}" = set; then :
   enableval=$enable_dlopen;
 else
-  enable_dlopen="$def_dlopen"
+  enable_dlopen=$def_dlopen
 fi
 
 # Check whether --enable-statsysbfd was given.
 if test "${enable_statsysbfd+set}" = set; then :
   enableval=$enable_statsysbfd;
 else
-  enable_statsysbfd="$def_statsysbfd"
+  enable_statsysbfd=$def_statsysbfd
 fi
 
 # Check whether --enable-dynsysbfd was given.
 if test "${enable_dynsysbfd+set}" = set; then :
   enableval=$enable_dynsysbfd;
 else
-  enable_dynsysbfd="no"
+  enable_dynsysbfd=no
 fi
 
-#AC_ARG_ENABLE(locbfd,
-#	[ --enable-locbfd uses a static bfd library built from this source tree for loading and relocationing object files ]
-#	,,enable_locbfd="$def_locbfd")
 # Check whether --enable-custreloc was given.
 if test "${enable_custreloc+set}" = set; then :
   enableval=$enable_custreloc;
 else
-  enable_custreloc="$def_custreloc"
+  enable_custreloc=$def_custreloc
 fi
 
+
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug;
 else
-  enable_debug="$def_debug"
-fi
-
-# Check whether --enable-gprof was given.
-if test "${enable_gprof+set}" = set; then :
-  enableval=$enable_gprof;
-else
-  enable_gprof="no"
+  enable_debug=$def_debug
 fi
 
 # Check whether --enable-static was given.
 if test "${enable_static+set}" = set; then :
-  enableval=$enable_static; enable_static=$enableval
+  enableval=$enable_static;
 else
-  enable_static="$def_static"
+  enable_static=$def_static
 fi
 
 # Check whether --enable-pic was given.
 if test "${enable_pic+set}" = set; then :
   enableval=$enable_pic;
 else
-  enable_pic="$def_pic"
-fi
-
-
-# Check whether --enable-oldgmp was given.
-if test "${enable_oldgmp+set}" = set; then :
-  enableval=$enable_oldgmp;
-else
-  enable_oldgmp="$def_oldgmp"
+  enable_pic=$def_pic
 fi
 
 
-# Check whether --enable-dynsysgmp was given.
-if test "${enable_dynsysgmp+set}" = set; then :
-  enableval=$enable_dynsysgmp;
-else
-  enable_dynsysgmp="yes"
-fi
-
-
-load_opt="0"
+load_opt=0
 if test "$enable_dlopen" = "yes" ; then
-   load_opt=1
+    load_opt=1
 fi
 if test "$enable_statsysbfd" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   esac
+    case $load_opt in
+	0) load_opt=1;;
+	1) load_opt=2;;
+    esac
 fi
 if test "$enable_dynsysbfd" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   2) load_opt=3;;
-   esac
-fi
-if test "$enable_locbfd" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   2) load_opt=3;;
-   3) load_opt=4;;
-   esac
+    case $load_opt in
+	0) load_opt=1;;
+	1) load_opt=2;;
+	2) load_opt=3;;
+    esac
 fi
 if test "$enable_custreloc" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   2) load_opt=3;;
-   3) load_opt=4;;
-   4) load_opt=5;;
-   esac
+    case $load_opt in
+	0) load_opt=1;;
+	1) load_opt=2;;
+	2) load_opt=3;;
+	3) load_opt=4;;
+	4) load_opt=5;;
+    esac
 fi
 
 if test "$load_opt" != "1" ; then
-	echo "Exactly one loader option must be chosen: dlopen=$enable_dlopen statsysbfd=$enable_statsysbfd dynsysbfd=$enable_dynsysbfd locbfd=$enable_locbfd custreloc=$enable_custreloc"
-	exit 1
+    echo "Exactly one loader option must be chosen: dlopen=$enable_dlopen statsysbfd=$enable_statsysbfd dynsysbfd=$enable_dynsysbfd custreloc=$enable_custreloc"
+    as_fn_error $? "loader option failure" "$LINENO" 5
 fi
 
-TLDFLAGS=""
-if test "$enable_static" = "yes" ; then
-   TLDFLAGS="-static -Wl,-zmuldefs $TLDFLAGS"; #FIXME should be in unixport/makefile
-
-$as_echo "#define STATIC_LINKING 1" >>confdefs.h
-
-fi
-case $use in
-     *gnuwin*)
-	TLDFLAGS="$TLDFLAGS -Wl,--stack,8000000";;
-esac
-
-## finally warn if we did not find a recognized machine.s
-##
-#if test "$use" = "unknown" ; then
-#types=`echo h/*.defs` | sed -e "s:h/::g" -e "s:\.defs:g"`
-#echo got canonical=$canonical, but was not recognized.
-#echo Unable to guess type to use.  Try one of
-#exit(1)
-#fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: use=$use" >&5
-$as_echo "use=$use" >&6; }
-
 
 #
 # System programs
@@ -3238,10 +2914,10 @@ $as_echo "use=$use" >&6; }
 # We set the default CFLAGS below, and don't want the autoconf default
 # CM 20040106
 if test "$CFLAGS" = "" ; then
-	CFLAGS=" "
+    CFLAGS=" "
 fi
 if test "$LDFLAGS" = "" ; then
-	LDFLAGS=" "
+    LDFLAGS=" "
 fi
 
 ac_ext=c
@@ -4171,74 +3847,90 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+GCL_CC=`basename $CC`
+if echo $GCL_CC |grep gcc |grep -q win; then
+    GCL_CC=gcc
+fi
 
 
-# can only test for numbers -- CM
-# if test "${GCC}" -eq "yes" ; then
-#if [[ "${GCC}" = "yes" ]] ; then
-# Allog for environment variable overrides on compiler selection -- CM
-#GCC=$CC
-#else
-#GCC=""
-#fi
-# subst GCC not only under 386-linux, but where available -- CM
-
-TCFLAGS="-fsigned-char -fno-builtin-malloc -fno-builtin-free"
-
-if test "$GCC" = "yes" ; then
-
-   TCFLAGS="$TCFLAGS -Wall"
+add_arg_to_tcflags() {
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang" >&5
-$as_echo_n "checking for clang... " >&6; }
+    local i=1
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAG $1" >&5
+$as_echo_n "checking for CFLAG $1... " >&6; }
+    CFLAGS_ORI=$CFLAGS
+    CFLAGS="$CFLAGS -Werror $1 `echo $1|sed 's,-Wno-,-W,1'`"
 
 if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$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; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+int
+main ()
+{
 
-		int main() {
-		return
-		#ifdef __clang__
-		0
-		#else
-		1
-		#endif
-		;}
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	 clang="yes"
-	 TCFLAGS="$TCFLAGS -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign"
-
-$as_echo "#define CLANG 1" >>confdefs.h
-
+  TCFLAGS="$TCFLAGS $1";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; };i=0
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	 #FIXME -Wno-unused-but-set-variable when time
-	 TMPF=-Wno-unused-but-set-variable
-	 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAG $TMPF" >&5
-$as_echo_n "checking for CFLAG $TMPF... " >&6; }
-	 CFLAGS_ORI=$CFLAGS
-	 CFLAGS="$CFLAGS $TMPF"
-	 if test "$cross_compiling" = yes; then :
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+    CFLAGS=$CFLAGS_ORI
+    return $i
+
+}
+
+assert_arg_to_tcflags() {
+    if ! add_arg_to_tcflags $1 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot add $1 to CFLAGS" >&5
+$as_echo "cannot add $1 to CFLAGS" >&6; }; exit 1 ; fi
+    return 0
+}
+
+add_args_to_tcflags() {
+
+    while test "$#" -ge 1 ; do
+  	add_arg_to_tcflags $1
+	shift
+    done
+}
+
+add_arg_to_tldflags() {
+
+    local i=1
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LDFLAG $1" >&5
+$as_echo_n "checking for LDFLAG $1... " >&6; }
+    LDFLAGS_ORI=$LDFLAGS
+    LDFLAGS="$LDFLAGS -Werror $1"
+    if test "$cross_compiling" = yes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int main() {return 0;}
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
-  TCFLAGS="$TCFLAGS $TMPF";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+  TLDFLAGS="$TLDFLAGS $1";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; };i=0
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -4247,48 +3939,136 @@ rm -f core *.core core.conftest.* gmon.o
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-	 CFLAGS=$CFLAGS_ORI
+    LDFLAGS=$LDFLAGS_ORI
+    return $i
+
+}
+
+assert_arg_to_tldflags() {
+    if ! add_arg_to_tldflags $1 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot add $1 to LDFLAGS" >&5
+$as_echo "cannot add $1 to LDFLAGS" >&6; }; exit 1 ; fi
+    return 0
+}
+
+add_args_to_tldflags() {
+
+    while test "$#" -ge 1 ; do
+  	add_arg_to_tldflags $1
+	shift
+    done
+}
+
+remove_arg_from_ldflags() {
+
+    NEW_LDFLAGS=""
+    for i in $LDFLAGS; do
+	if ! test "$i" = "$1" ; then
+      	    NEW_LDFLAGS="$NEW_LDFLAGS $i"
+	else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: removing $1 from LDFLAGS" >&5
+$as_echo "removing $1 from LDFLAGS" >&6; }
+	fi
+    done
+    LDFLAGS=$NEW_LDFLAGS
+
+    return 0
+
+}
+
+TCFLAGS=""
+add_args_to_tcflags -fsigned-char -pipe \
+                    -fno-builtin-malloc -fno-builtin-free \
+                    -fno-PIE -fno-pie -fno-PIC -fno-pic \
+	            -Wall \
+	            -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign \
+	            -Wno-unused-but-set-variable -Wno-misleading-indentation
+
+TLDFLAGS=""
+add_args_to_tldflags -Wl,-no_pie -no-pie -Wl,-z,lazy
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang" >&5
+$as_echo_n "checking for clang... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+			 #ifdef __clang__
+			 #define RET 0
+			 #else
+			 #define RET 1
+			 #endif
+
+int
+main ()
+{
+
+			 return RET;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+     clang="yes"
+     remove_arg_from_ldflags -pie
+
+$as_echo "#define CLANG 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "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
 
-if test "$GCC" = "yes" ; then
-	TCFLAGS="$TCFLAGS -pipe"
-	case $use in
-	     *mingw*)
-#	        echo "WARNING: Remove -fno-zero-initialized-in-bss from makedefs if gcc less than 3.3.1."
-#	        echo "         It is otherwise needed for the Unexec stuff to work."
-#		if test "$enable_debug" = "yes" ; then TCFLAGS="$TCFLAGS -gstabs" ; fi
-		TCFLAGS="$TCFLAGS -fno-zero-initialized-in-bss -mms-bitfields";;
-	     *gnuwin*)
-#	        echo "WARNING: Remove -fno-zero-initialized-in-bss from makedefs if gcc less than 3.3.1."
-#	        echo "         It is otherwise needed for the Unexec stuff to work."
-#		if test "$enable_debug" = "yes" ; then TCFLAGS="$TCFLAGS -gstabs" ; fi
-		TCFLAGS="$TCFLAGS -fno-zero-initialized-in-bss -mms-bitfields";;
-        esac
-fi
-#if test -f /proc/sys/kernel/exec-shield ; then
-#	exec_stat=`cat /proc/sys/kernel/exec-shield`
-#	if test "$exec_stat" != "0" ; then
-#		# CFLAGS here to hopefully cover the DBEGIN routine below
-#		CFLAGS="$CFLAGS -Wa,--execstack"
-#	fi
-#fi
+case $use in
+    *mingw*)
+	assert_arg_to_tcflags -fno-zero-initialized-in-bss
+	assert_arg_to_tcflags -mms-bitfields;;
+    *gnuwin*)
+	assert_arg_to_tcflags -fno-zero-initialized-in-bss
+	assert_arg_to_tcflags -mms-bitfields
+        assert_arg_to_tldflags -Wl,--stack,8000000;;
+    386-macosx)
+	assert_arg_to_tldflags -Wl,-no_pie
+	if test "$build_cpu" = "x86_64" ; then
+	    assert_arg_to_tcflags -m64
+	    assert_arg_to_tldflags -m64
+	    assert_arg_to_tldflags -Wl,-headerpad,72
+        else
+	    assert_arg_to_tcflags -m32
+	    assert_arg_to_tldflags -m32
+	    assert_arg_to_tldflags -Wl,-headerpad,56
+        fi;;
+    FreeBSD) assert_arg_to_tldflags -Z;;
+esac
+
+if test "$enable_static" = "yes" ; then
+    assert_arg_to_tldflags -static
+    assert_arg_to_tldflags -Wl,-zmuldefs
+
+$as_echo "#define STATIC_LINKING 1" >>confdefs.h
+
+fi
 
 TO3FLAGS=""
 TO2FLAGS=""
 
-#TFPFLAG="-fomit-frame-pointer"
-# FIXME -- remove when mingw compiler issues are fixed
 case "$use" in
-  *mingw*)
+    *mingw*)
   	TFPFLAG="";;
-  m68k*)#FIXME gcc 4.x bug workaround
+    m68k*)#FIXME gcc 4.x bug workaround
 	TFPFLAG="";;
-  *)
+    *)
 	TFPFLAG="-fomit-frame-pointer";;
 esac
 
@@ -4335,143 +4115,104 @@ fi
 done
 
 
-# Work around system/gprof mips/hppa hang
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking working gprof" >&5
+# Check whether --enable-gprof was given.
+if test "${enable_gprof+set}" = set; then :
+  enableval=$enable_gprof; if test "$enableval" = "yes" ; then
+		   { $as_echo "$as_me:${as_lineno-$LINENO}: checking working gprof" >&5
 $as_echo_n "checking working gprof... " >&6; }
-old_enable_gprof=$enable_gprof
-case $use in
-  powerpc*) if test "$host_cpu" = "powerpc64le" ; then enable_gprof="no"; fi;;
-  sh4*)  enable_gprof="no";;
-  ia64*)  enable_gprof="no";;
-#  mips*) enable_gprof="no";;
-  hppa*) enable_gprof="no";;
-  arm*)  enable_gprof="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
-  *gnu)  enable_gprof="no";;
-esac
-if test "$enable_gprof" = "$old_enable_gprof" ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-else
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+		   case $use in
+		       powerpc*) if test "$host_cpu" = "powerpc64le" ; then enableval="no"; fi;;
+		       sh4*)  enableval="no";;
+		       ia64*) enableval="no";;
+		       hppa*) enableval="no";;
+		       arm*)  enableval="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
+		       *gnu)  enableval="no";;
+		   esac
+		   if test "$enableval" != "yes" ; then
+		       { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
 $as_echo "disabled" >&6; }
-fi
-
-if test "$enable_gprof" = "yes" ; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for text start" >&5
+		   else
+		       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+		       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for text start" >&5
 $as_echo_n "checking for text start... " >&6; }
-	echo 'int main () {return(0);}' >foo.c
-	$CC foo.c -o foo
-	GCL_GPROF_START=`nm foo | $AWK  '/  *[TD]  *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
-	rm -f foo.c foo
-	if test "$GCL_GPROF_START" != "" ; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCL_GPROF_START" >&5
+		       echo 'int main () {return(0);}' >foo.c
+		       $CC foo.c -o foo
+		       GCL_GPROF_START=`nm foo | $AWK  '/  *[TD]  *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
+		       rm -f foo.c foo
+		       if test "$GCL_GPROF_START" != "" ; then
+			   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCL_GPROF_START" >&5
 $as_echo "$GCL_GPROF_START" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define GCL_GPROF_START $GCL_GPROF_START
 _ACEOF
 
-		case "$use" in
-		   arm*)
-	             #FIXME report and remove this when done
-	             { $as_echo "$as_me:${as_lineno-$LINENO}: result: Reducing optimization on profiling arm build to workaround gcc bug" >&5
-$as_echo "Reducing optimization on profiling arm build to workaround gcc bug" >&6; }
-		     enable_debug=yes;;
-		esac
-                TCFLAGS="$TCFLAGS -pg";
-		case $use in
-		s390*) ;; # relocation truncation bug in gcc
-		*) TLIBS="$TLIBS -pg";;
-		esac
-        	TFPFLAG=""
+			   assert_arg_to_tcflags -pg
+			   case $use in
+			       s390*) ;; # relocation truncation bug in gcc
+			       *) TLIBS="$TLIBS -pg";;
+			   esac
+       			   TFPFLAG=""
 
 $as_echo "#define GCL_GPROF 1" >>confdefs.h
 
-	else
-                enable_gprof="no";
-	fi
-fi
-
-if $CC -v 2>&1 | tail -1 | grep "gcc version 4.6.1" >/dev/null ; then
-   case "$use" in
-     arm*)
-     #FIXME report and remove this when done
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Reducing optimization on arm build to workaround gcc 4.6 bug" >&5
-$as_echo "Reducing optimization on arm build to workaround gcc 4.6 bug" >&6; }
-	enable_debug=yes;;
-   esac
+		       fi
+		   fi
+	       fi
 fi
 
 
 if test "$enable_debug" = "yes" ; then
-	TCFLAGS="$TCFLAGS -g"
-	# for subconfigurations
-	CFLAGS="$CFLAGS -g"
+    assert_arg_to_tcflags -g
+    # for subconfigurations
+    CFLAGS="$CFLAGS -g"
 else
-	TO3FLAGS="-O3 $TFPFLAG"
-	TO2FLAGS="-O"
+    TO3FLAGS="-O3 $TFPFLAG"
+    TO2FLAGS="-O"
 fi
 
 # gcc on ppc cannot compile our new_init.c with full opts --CM
 TONIFLAGS=""
 case $use in
-     powerpc*macosx)
-	   TCFLAGS="$TCFLAGS -mlongcall";;
-     *linux)
+    powerpc*macosx) assert_arg_to_tcflags -mlongcall;;
+    *linux)
 	case $use in
-#		amd64*) # stack-boundary option does not work
-#			TCFLAGS="$TCFLAGS -m64 -mpreferred-stack-boundary=8";;
-		alpha*)
-			TCFLAGS="$TCFLAGS -mieee"
-			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.8.1
-			;;
-#		m68k*)
-#			TCFLAGS="$TCFLAGS -ffloat-store";;
-		aarch64*)
-			TLIBS="$TLIBS -lgcc_s";;
-		hppa*)
-			TCFLAGS="$TCFLAGS -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
-#			TCFLAGS="$TCFLAGS -ffunction-sections"
-#			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O $TFPFLAG" ; fi
-#			if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
-			;;
-		mips*)
-			case $canonical in
-			mips64*linux*)
-				TLIBS="$TLIBS -Wl,-z -Wl,now";;
-			esac
-#			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.6.2
-			;;
-		ia64*)
-			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
-			;;
-		arm*)
-			TCFLAGS="$TCFLAGS -mlong-calls -fdollars-in-identifiers -g "
-#			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.6.2
-#			if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
-			;;
-		powerpc*)
-                        TCFLAGS="$TCFLAGS -mlongcall"
-			;;
-#			if $CC -v 2>&1 | grep -q "gcc version 3.2" ; then
-#			   echo Reducing optimization for buggy gcc-3.2
-#			   if test "$enable_debug" != "yes" ; then TONIFLAGS="-O $TFPFLAG" ; fi
-#			fi;
-#			echo Probing for longcall
-#			if ! $CC -v 2>&1 | $AWK '/^gcc version / {split($3,A,".");if (A[[1]]+0>3 || (A[[1]]+0>=3 && A[[2]]+0>=3)) exit 1;}'; then
-#			   echo Enabling longcall on gcc 3.3 or later
-#			   TCFLAGS="$TCFLAGS -mlongcall"
-#			   echo Reducing optimization for buggy gcc 3.3 or later
-#			   if test "$enable_debug" != "yes" ; then TONIFLAGS="-O $TFPFLAG" ; fi
-#			fi;;
+	    alpha*)
+		assert_arg_to_tcflags -mieee
+		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.8.1
+		;;
+	    aarch64*)
+		TLIBS="$TLIBS -lgcc_s";;
+	    hppa*)
+		assert_arg_to_tcflags -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
+		;;
+	    mips*)
+		case $canonical in
+		    mips64*linux*)
+			assert_arg_to_tldflags -Wl,-z,now;;
+		esac
+		;;
+	    ia64*)
+		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
+		;;
+	    arm*)
+		assert_arg_to_tcflags -mlong-calls
+		assert_arg_to_tcflags -fdollars-in-identifiers
+		assert_arg_to_tcflags -g #?
+		;;
+	    powerpc*)
+		assert_arg_to_tcflags -mlongcall
+		;;
 	esac;;
 esac
 if test "$enable_pic" = "yes" ; then
-	TCFLAGS="$TCFLAGS -fPIC"
+    assert_arg_to_tcflags -fPIC
 fi
 
+
 FDEBUG=`echo $CFLAGS | tr ' ' '\012' |grep "^\-g$"|tr '\012' ' '`
 #CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-g$"`
 FOMITF=`echo $CFLAGS | tr ' ' '\012' |grep "^\-fomit-frame-pointer$"|tr '\012' ' '`
@@ -4488,27 +4229,27 @@ FOOPT0=`echo $CFLAGS | tr ' ' '\012' |gr
 CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-O0$"|tr '\012' ' '`
 
 if test "$FOOPT0" != "" ; then
-   TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[123 ],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
-   TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[123 ],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
+    TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[123 ],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
+    TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[123 ],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
 else
-if test "$FOOPT1" != "" ; then
-   TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[2-3],-O1,g'`
-   TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[2-3],-O1,g'`
-else
-if test "$FOOPT2" != "" ; then
-   TO3FLAGS=`echo "$TO3FLAGS" | sed 's,\-O3,-O2,g'`
-   TO2FLAGS=`echo "$TO2FLAGS" | sed 's,\-O3,-O2,g'`
-fi
-fi
+    if test "$FOOPT1" != "" ; then
+	TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[2-3],-O1,g'`
+	TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[2-3],-O1,g'`
+    else
+	if test "$FOOPT2" != "" ; then
+	    TO3FLAGS=`echo "$TO3FLAGS" | sed 's,\-O3,-O2,g'`
+	    TO2FLAGS=`echo "$TO2FLAGS" | sed 's,\-O3,-O2,g'`
+	fi
+    fi
 fi
 
 if test "$FDEBUG" != "" ; then
-   TO3FLAGS=`echo $TO3FLAGS | sed 's,\-fomit-frame-pointer,,g'`
-   TO2FLAGS=`echo $TO2FLAGS | sed 's,\-fomit-frame-pointer,,g'`
+    TO3FLAGS=`echo $TO3FLAGS | sed 's,\-fomit-frame-pointer,,g'`
+    TO2FLAGS=`echo $TO2FLAGS | sed 's,\-fomit-frame-pointer,,g'`
 fi
 
 if test "$FOMITF" != "" ; then
-   TO3FLAGS="$TO3FLAGS $FOMITF"
+    TO3FLAGS="$TO3FLAGS $FOMITF"
 fi
 
 # Step 1: set the variable "system" to hold the name and version number
@@ -4569,8 +4310,8 @@ if test -f /usr/lib/NextStep/software_ve
 else
     system=`uname -s`-`uname -r`
     if test "$?" -ne 0 ; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown (can't find uname command)" >&5
-$as_echo "unknown (can't find uname command)" >&6; }
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown (cannot find uname command)" >&5
+$as_echo "unknown (cannot find uname command)" >&6; }
 	system=unknown
     else
 	# Special check for weird MP-RAS system (uname returns weird
@@ -4588,7 +4329,7 @@ $as_echo "$system" >&6; }
 fi
 
 case $use in
-     *macosx)
+    *macosx)
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
@@ -4864,7 +4605,7 @@ fi
 done
 
 	ac_fn_c_check_member "$LINENO" "struct _malloc_zone_t" "memalign" "ac_cv_member_struct__malloc_zone_t_memalign" "
-		#include <malloc/malloc.h>
+			    #include <malloc/malloc.h>
 
 "
 if test "x$ac_cv_member_struct__malloc_zone_t_memalign" = xyes; then :
@@ -4877,7 +4618,6 @@ fi
 	;;
 esac
 
-
 for ac_header in setjmp.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "setjmp.h" "ac_cv_header_setjmp_h" "$ac_includes_default"
@@ -4887,7 +4627,7 @@ if test "x$ac_cv_header_setjmp_h" = xyes
 _ACEOF
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking sizeof jmp_buf" >&5
 $as_echo_n "checking sizeof jmp_buf... " >&6; }
-	if test "$cross_compiling" = yes; then :
+     if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -4896,19 +4636,24 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+		     #include <stdio.h>
+		     #include <setjmp.h>
 
-			#include <stdio.h>
-			#include <setjmp.h>
-			int main() {
-			   FILE *fp=fopen("conftest1","w");
-			   fprintf(fp,"%lu\n",sizeof(jmp_buf));
-			   fclose(fp);
-			   return 0;
-			}
+int
+main ()
+{
+
+		     FILE *fp=fopen("conftest1","w");
+		     fprintf(fp,"%lu\n",sizeof(jmp_buf));
+		     fclose(fp);
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   sizeof_jmp_buf=`cat conftest1`
-			 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_jmp_buf" >&5
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_jmp_buf" >&5
 $as_echo "$sizeof_jmp_buf" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -4929,7 +4674,6 @@ done
 
 
 # sysconf
-
 for ac_header in unistd.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
@@ -4944,52 +4688,6 @@ if ${ac_cv_lib_c_sysconf+:} false; then
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lc  $LIBS"
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5022,39 +4720,40 @@ $as_echo "$ac_cv_lib_c_sysconf" >&6; }
 if test "x$ac_cv_lib_c_sysconf" = xyes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking _SC_CLK_TCK" >&5
 $as_echo_n "checking _SC_CLK_TCK... " >&6; }
-		if test "$cross_compiling" = yes; then :
-  hz=0
+	     hz=0
+	     if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <unistd.h>
-		            #include <stdio.h>
-		            int
-			    main() {
-			   	FILE *fp=fopen("conftest1","w");
-				fprintf(fp,"%lu\n",sysconf(_SC_CLK_TCK));
-				fclose(fp);
-			        return 0;
-			    }
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  hz=`cat conftest1`
 
-cat >>confdefs.h <<_ACEOF
-#define HZ $hz
-_ACEOF
+			     #include <unistd.h>
+			     #include <stdio.h>
 
+int
+main ()
+{
+
+			     FILE *fp=fopen("conftest1","w");
+			     fprintf(fp,"%lu\n",sysconf(_SC_CLK_TCK));
+			     fclose(fp);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
 
-else
-  hz=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-	        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hz" >&5
+	     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hz" >&5
 $as_echo "$hz" >&6; }
-
 fi
 
 fi
@@ -5063,20 +4762,16 @@ done
 
 
 
-#MY_SUBDIRS=
-
-#
-# GMP
-#
-
 rm -f makedefsafter
 
-MP_INCLUDE=""
-if test $use_gmp = yes ; then
+# Check whether --enable-dynsysgmp was given.
+if test "${enable_dynsysgmp+set}" = set; then :
+  enableval=$enable_dynsysgmp;
+fi
+
 
- PATCHED_SYMBOLS=""
- if test "$enable_dynsysgmp" = "yes" ; then
-	for ac_header in gmp.h
+if test "$enable_dynsysgmp" != "no" ; then
+    for ac_header in gmp.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
 if test "x$ac_cv_header_gmp_h" = xyes; then :
@@ -5120,100 +4815,97 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_init" >&5
 $as_echo "$ac_cv_lib_gmp___gmpz_init" >&6; }
 if test "x$ac_cv_lib_gmp___gmpz_init" = xyes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"for external gmp version\"" >&5
-$as_echo_n "checking \"for external gmp version\"... " >&6; }
-			if test "$cross_compiling" = yes; then :
-  echo "Cannot use dynamic gmp lib"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for external gmp version" >&5
+$as_echo_n "checking for external gmp version... " >&6; }
+		 if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <gmp.h>
-				    int main() {
-				    #if __GNU_MP_VERSION > 3
-					return 0;
-				    #else
-					return -1;
-				    #endif
-				    }
+
+				 #include <gmp.h>
+
+int
+main ()
+{
+
+				 #if __GNU_MP_VERSION > 3
+				 return 0;
+				 #else
+				 return -1;
+				 #endif
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
-  #				MPFILES=$GMPDIR/mpn/mul_n.o
-#				PATCHED_SYMBOLS=__gmpn_toom3_mul_n
-				MPFILES=
-				PATCHED_SYMBOLS=
-#				if test "$use" = "m68k-linux" ; then
-#					MPFILES="$MPFILES $GMPDIR/mpn/lshift.o $GMPDIR/mpn/rshift.o"
-#					PATCHED_SYMBOLS="$PATCHED_SYMBOLS __gmpn_lshift __gmpn_rshift"
-#				fi
-				TLIBS="$TLIBS -lgmp"
-				echo "#include \"gmp.h\"" >foo.c
-				echo "int main() {return 0;}" >>foo.c
-				MP_INCLUDE=`cpp foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
-				rm -f foo.c
-else
-  echo "Cannot use dynamic gmp lib"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
+$as_echo "good" >&6; }
+		      TLIBS="$TLIBS -lgmp"
+		      echo "#include \"gmp.h\"" >foo.c
+		      echo "int main() {return 0;}" >>foo.c
+		      MP_INCLUDE=`cpp 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
 fi
 
-else
-  echo "Cannot use dynamic gmp lib"
 fi
 
-else
-  echo "Cannot use dynamic gmp lib"
 fi
 
 done
 
+
+    if test "$MP_INCLUDE" = "" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Cannot use dynamic gmp lib" >&5
+$as_echo "Cannot use dynamic gmp lib" >&6; }
+    fi
+
 fi
 
-NEED_LOCAL_GMP=''
+
 if test "$MP_INCLUDE" = "" ; then
-	NEED_LOCAL_GMP=1;
-fi
-if test "$PATCHED_SYMBOLS" != "" ; then
-	NEED_LOCAL_GMP=1;
-fi
 
-if test "$NEED_LOCAL_GMP" != "" ; then
+    GMPDIR=gmp4
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking doing configure in gmp directory" >&5
+$as_echo_n "checking doing configure in gmp directory... " >&6; }
+    echo
+    echo "#"
+    echo "#"
+    echo "# -------------------"
+    echo "# Subconfigure of GMP"
+    echo "#"
+    echo "#"
 
-   	 GMPDIR=gmp4
-	 { $as_echo "$as_me:${as_lineno-$LINENO}: checking use_gmp=yes, doing configure in gmp directory" >&5
-$as_echo_n "checking use_gmp=yes, 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 && 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
+    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
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking \"for leading underscore in object symbols\"" >&5
-$as_echo_n "checking \"for leading underscore in object symbols\"... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for leading underscore in object symbols" >&5
+$as_echo_n "checking for leading underscore in object symbols... " >&6; }
 cat>foo.c <<EOFF
 #include <math.h>
 #include <stdio.h>
@@ -5221,15 +4913,15 @@ int main() {FILE *f;double d=0.0;getc(f)
 EOFF
 $CC -c foo.c -o foo.o
 if nm foo.o |grep " U " | grep "_cos" >/dev/null || nm foo.o |grep " U " | grep " _getc" >/dev/null ; then
-	LEADING_UNDERSCORE=1
+    LEADING_UNDERSCORE=1
 
 $as_echo "#define LEADING_UNDERSCORE 1" >>confdefs.h
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5
 $as_echo "\"yes\"" >&6; }
 else
-	LEADING_UNDERSCORE=""
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
+    LEADING_UNDERSCORE=""
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
 $as_echo "\"no\"" >&6; }
 fi
 
@@ -5239,16 +4931,16 @@ $as_echo_n "checking \"for GNU ld option
 touch map
 $CC -o foo  -Wl,-Map  map foo.o >/dev/null 2>&1
 if test `cat map | wc -l` != "0" ; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5
 $as_echo "\"yes\"" >&6; }
 
 $as_echo "#define HAVE_GNU_LD 1" >>confdefs.h
 
-	GNU_LD=1
+    GNU_LD=1
 else
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
 $as_echo "\"no\"" >&6; }
-	GNU_LD=
+    GNU_LD=
 fi
 rm -f foo.c foo.o foo map
 
@@ -5263,17 +4955,16 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-        #include <stdio.h>
-	#include "$MP_INCLUDE"
+				   #include <stdio.h>
+				   #include "$MP_INCLUDE"
 
 int
 main ()
 {
 
-	FILE *fp=fopen("conftest1","w");
-	fprintf(fp,"%u",sizeof(mp_limb_t));
-	fclose(fp);
-	return 0;
+				   FILE *fp=fopen("conftest1","w");
+				   fprintf(fp,"%u",sizeof(mp_limb_t));
+				   fclose(fp);
 
   ;
   return 0;
@@ -5307,18 +4998,18 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-        #include <stdio.h>
-	#include "$MP_INCLUDE"
+				   #include <stdio.h>
+				   #include "$MP_INCLUDE"
 
 int
 main ()
 {
 
-	#ifdef _SHORT_LIMB
-	return 0;
-	#else
-	return 1;
-	#endif
+				   #ifdef _SHORT_LIMB
+				   return 0;
+				   #else
+				   return 1;
+				   #endif
 
   ;
   return 0;
@@ -5349,18 +5040,18 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
-	#include "$MP_INCLUDE"
+				   #include <stdio.h>
+				   #include "$MP_INCLUDE"
 
 int
 main ()
 {
 
-	#ifdef _LONG_LONG_LIMB
-	return 0;
-	#else
-	return 1;
-	#endif
+				   #ifdef _LONG_LONG_LIMB
+				   return 0;
+				   #else
+				   return 1;
+				   #endif
 
   ;
   return 0;
@@ -5380,17 +5071,17 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
- GMP=1
+GMP=1
 
 $as_echo "#define GMP 1" >>confdefs.h
 
 
 
- echo > makedefsafter
- echo "MPFILES=$MPFILES" >> makedefsafter
- echo "PATCHED_SYMBOLS=$PATCHED_SYMBOLS" >> makedefsafter
- echo >> makedefsafter
-fi
+echo > makedefsafter
+echo "MPFILES=$MPFILES" >> makedefsafter
+echo "PATCHED_SYMBOLS=$PATCHED_SYMBOLS" >> makedefsafter
+echo >> makedefsafter
+
 
 
 #
@@ -5399,7 +5090,7 @@ fi
 
 if test "$enable_xgcl" = "yes" ; then
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
 $as_echo_n "checking for X... " >&6; }
 
 
@@ -5592,24 +5283,14 @@ else
 $as_echo "libraries $x_libraries, headers $x_includes" >&6; }
 fi
 
-#   AC_PATH_XTRA
-#   echo $X_CFLAGS
-#   echo $X_LIBS
-#   echo $X_EXTRA_LIBS
-#   echo $X_PRE_LIBS
-
-   miss=0
-#   AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)#FIXME remove these
-#   AC_CHECK_LIB(Xt,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)
-#   AC_CHECK_LIB(Xext,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)
-#   AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)#until here
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lX11" >&5
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lX11" >&5
 $as_echo_n "checking for main in -lX11... " >&6; }
 if ${ac_cv_lib_X11_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lX11 $X_LIBS $LIBS"
+LIBS="-lX11  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5635,22 +5316,14 @@ fi
 $as_echo "$ac_cv_lib_X11_main" >&6; }
 if test "x$ac_cv_lib_X11_main" = xyes; then :
   X_LIBS="$X_LIBS -lX11"
+$as_echo "#define HAVE_XGCL 1" >>confdefs.h
+
 else
-  miss=1
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: missing x libraries -- cannot compile xgcl" >&5
+$as_echo "missing x libraries -- cannot compile xgcl" >&6; }
 fi
 
 
-   if test "$miss" = "1" ; then
-      X_CFLAGS=
-      X_LIBS=
-      X_EXTRA_LIBS=
-      X_PRE_LIBS=
-      echo missing x libraries -- cannot compile xgcl
-   else
-
-$as_echo "#define HAVE_XGCL 1" >>confdefs.h
-
-   fi
 fi
 
 
@@ -5663,7 +5336,7 @@ fi
 
 if test "$enable_dlopen" = "yes" ; then
 
- 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
 if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -5700,25 +5373,27 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  have_dl=1
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+  LIBS="-ldl $LIBS"
+
 else
-  have_dl=0
+  as_fn_error $? "Cannot find dlopen" "$LINENO" 5
 fi
 
- 	if test "$have_dl" = "0" ; then
- 		echo "Cannot find dlopen in -dl"
- 		exit 1
- 	fi
 
-	TLIBS="$TLIBS -ldl -rdynamic"
-	TCFLAGS="-fPIC $TCFLAGS"
+    TLIBS="$TLIBS -ldl -rdynamic"
+    assert_arg_to_tcflags -fPIC
 
 $as_echo "#define USE_DLOPEN 1" >>confdefs.h
 
+
 fi
 
 if test "$enable_statsysbfd" = "yes" || test "$enable_dynsysbfd" = "yes" ; then
-	for ac_header in bfd.h
+    for ac_header in bfd.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
 if test "x$ac_cv_header_bfd_h" = xyes; then :
@@ -5763,18 +5438,28 @@ fi
 $as_echo "$ac_cv_lib_bfd_bfd_init" >&6; }
 if test "x$ac_cv_lib_bfd_bfd_init" = xyes; then :
   #
-		# Old binutils appear to need CONST defined to const
-		#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if need to define CONST for bfd" >&5
-$as_echo_n "checking if need to define CONST for bfd... " >&6; }
-			if test "$cross_compiling" = yes; then :
+	    # Old binutils appear to need CONST defined to const
+	    #
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking need to define CONST for bfd" >&5
+$as_echo_n "checking need to define CONST for bfd... " >&6; }
+	    if test "$cross_compiling" = yes; then :
   as_fn_error $? "cannot use bfd" "$LINENO" 5
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define IN_GCC
-				    #include <bfd.h>
-				    int main() { symbol_info t; return 0;}
+
+			    #define IN_GCC
+			    #include <bfd.h>
+
+int
+main ()
+{
+
+			    symbol_info t;
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -5785,10 +5470,20 @@ else
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define CONST const
-                                            #define IN_GCC
-					    #include <bfd.h>
-					    int main() {symbol_info t; return 0;}
+
+				#define CONST const
+				#define IN_GCC
+				#include <bfd.h>
+
+int
+main ()
+{
+
+				symbol_info t;
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -5820,13 +5515,13 @@ done
 $as_echo "#define HAVE_LIBBFD 1" >>confdefs.h
 
 
-#
-# BFD boolean syntax
-#
+    #
+    # BFD boolean syntax
+    #
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for useable bfd_boolean" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for useable bfd_boolean" >&5
 $as_echo_n "checking for useable bfd_boolean... " >&6; }
-	if test "$cross_compiling" = yes; then :
+    if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -5835,14 +5530,14 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		#define IN_GCC
-		#include <bfd.h>
-		bfd_boolean foo() {return FALSE;}
+		    #define IN_GCC
+		    #include <bfd.h>
+		    bfd_boolean foo() {return FALSE;}
 
 int
 main ()
 {
-return 0;
+
   ;
   return 0;
 }
@@ -5862,13 +5557,13 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
-#
-# bfd_link_info.output_bfd minimal configure change check
-#
-
- 	ac_fn_c_check_member "$LINENO" "struct bfd_link_info" "output_bfd" "ac_cv_member_struct_bfd_link_info_output_bfd" "
-		#include <bfd.h>
-		#include <bfdlink.h>
+    #
+    # bfd_link_info.output_bfd minimal configure change check
+    #
+
+    ac_fn_c_check_member "$LINENO" "struct bfd_link_info" "output_bfd" "ac_cv_member_struct_bfd_link_info_output_bfd" "
+			#include <bfd.h>
+			#include <bfdlink.h>
 
 "
 if test "x$ac_cv_member_struct_bfd_link_info_output_bfd" = xyes; then :
@@ -5879,25 +5574,25 @@ fi
 
 
 
-#
-# FIXME: Need to workaround mingw before this point -- CM
-#
-	if test "$enable_statsysbfd" = "yes" && ! $CC -v 2>&1 | fgrep ming > /dev/null ; then
-		echo 'int main() {bfd_init();bfd_openr("/dev/null",0);return 0;}' >foo.c
-		MP=`$CC  -Wl,-M  -static -o foo foo.c -lbfd -liberty -ldl 2>&1 | grep -v : | tr '()' '\012\012' | $AWK '{print $NF}' | sort | uniq`
-		rm -f foo.c foo
-		if echo $MP | tr ' ' '\012' | grep libbfd.a >/dev/null; then
-		   LIBBFD="`echo $MP | tr ' ' '\012' | grep libbfd.a | $AWK '{i=split($1,A,"/");for (j=1;j<=i;j++) if (j>1 && A[j]=="..") {j--;i-=2;for (k=j;k<=i;k++) A[k]=A[k+2];j--;}} END {for (j=1;j<=i;j++) printf("%s%s",A[j],j!=i ? "/" : "")}'`"
-		else
-		   as_fn_error $? "cannot locate external libbfd.a" "$LINENO" 5
-		fi
-		if echo $MP | tr ' ' '\012' | grep libiberty.a >/dev/null ; then
-		   LIBIBERTY="`echo $MP | tr ' ' '\012' | grep libiberty.a | $AWK '{i=split($1,A,"/");for (j=1;j<=i;j++) if (j>1 && A[j]=="..") {j--;i-=2;for (k=j;k<=i;k++) A[k]=A[k+2];j--;}} END {for (j=1;j<=i;j++) printf("%s%s",A[j],j!=i ? "/" : "")}'`"
-		else
-		   as_fn_error $? "cannot locate external libiberty.a" "$LINENO" 5
-		fi
-		BUILD_BFD=copy_bfd
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5
+    #
+    # FIXME: Need to workaround mingw before this point -- CM
+    #
+    if test "$enable_statsysbfd" = "yes" && ! $CC -v 2>&1 | fgrep ming > /dev/null ; then
+	echo 'int main() {bfd_init();bfd_openr("/dev/null",0);return 0;}' >foo.c
+	MP=`$CC  -Wl,-M  -static -o foo foo.c -lbfd -liberty -ldl 2>&1 | grep -v : | tr '()' '\012\012' | $AWK '{print $NF}' | sort | uniq`
+	rm -f foo.c foo
+	if echo $MP | tr ' ' '\012' | grep libbfd.a >/dev/null; then
+	    LIBBFD="`echo $MP | tr ' ' '\012' | grep libbfd.a | $AWK '{i=split($1,A,\"/\");for (j=1;j<=i;j++) if (j>1 && A[j]==\"..\") {j--;i-=2;for (k=j;k<=i;k++) A[k]=A[k+2];j--;}} END {for (j=1;j<=i;j++) printf(\"%s%s\",A[j],j!=i ? \"/\" : \"\")}'`"
+	else
+	    as_fn_error $? "cannot locate external libbfd.a" "$LINENO" 5
+	fi
+	if echo $MP | tr ' ' '\012' | grep libiberty.a >/dev/null ; then
+	    LIBIBERTY="`echo $MP | tr ' ' '\012' | grep libiberty.a | $AWK '{i=split($1,A,\"/\");for (j=1;j<=i;j++) if (j>1 && A[j]==\"..\") {j--;i-=2;for (k=j;k<=i;k++) A[k]=A[k+2];j--;}} END {for (j=1;j<=i;j++) printf(\"%s%s\",A[j],j!=i ? \"/\" : \"\")}'`"
+	else
+	    as_fn_error $? "cannot locate external libiberty.a" "$LINENO" 5
+	fi
+	BUILD_BFD=copy_bfd
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5
 $as_echo_n "checking for inflate in -lz... " >&6; }
 if ${ac_cv_lib_z_inflate+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -5939,7 +5634,7 @@ else
   as_fn_error $? "Need zlib for bfd linking" "$LINENO" 5
 fi
 
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
 $as_echo_n "checking for dlsym in -ldl... " >&6; }
 if ${ac_cv_lib_dl_dlsym+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -5985,76 +5680,22 @@ fi
 
 
 
-	else
-		TLIBS="$TLIBS -lbfd -liberty -ldl"
-	fi
+    else
+	TLIBS="$TLIBS -lbfd -liberty -ldl"
+    fi
 fi
 
-if test "$enable_locbfd" = "yes" ; then
-
-	# check for gettext.  It is part of glibc, but others
-	# need GNU gettext separately.
-#	AC_CHECK_HEADERS(libintl.h, true,
-#			   AC_MSG_ERROR(libintl.h (gettext) not found))
-#	AC_SEARCH_LIBS(dgettext, intl, true, AC_MSG_ERROR(gettext library not found))
-
-	echo "#"
-	echo "#"
-	echo "# -------------------------"
-	echo "# Subconfigure of LIBINTL"
-	echo "#"
-	echo "#"
-	cd binutils/intl && chmod +x configure && ./configure --disable-nls && cd ../..
-#       MY_SUBDIRS="$MY_SUBDIRS binutils/libiberty "
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# Subconfigure of LIBINTL done"
-	echo "# ------------------------------"
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# -------------------------"
-	echo "# Subconfigure of LIBIBERTY"
-	echo "#"
-	echo "#"
-	cd binutils/libiberty && chmod +x configure && ./configure --disable-nls && cd ../..
-#       MY_SUBDIRS="$MY_SUBDIRS binutils/libiberty "
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# Subconfigure of LIBIBERTY done"
-	echo "# ------------------------------"
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# -------------------"
-	echo "# Subconfigure of BFD"
-	echo "#"
-	echo "#"
-	cd binutils/bfd && chmod +x configure && ./configure --with-included-gettext --disable-nls && cd ../..
-#       MY_SUBDIRS="$MY_SUBDIRS binutils/bfd "
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# Subconfigure of BFD done"
-	echo "# ------------------------"
-	echo "#"
-#	TLIBS="$TLIBS `pwd`/binutils/bfd/libbfd.a `pwd`/binutils/libiberty/libiberty.a"
-
-$as_echo "#define HAVE_LIBBFD 1" >>confdefs.h
-
-	BUILD_BFD="h/bfd.h h/bfdlink.h h/ansidecl.h h/symcat.h"
-
+# Check whether --enable-xdr was given.
+if test "${enable_xdr+set}" = set; then :
+  enableval=$enable_xdr;
 fi
 
 
-if test "$enable_xdr" = "yes" ; then
-   ac_fn_c_check_func "$LINENO" "xdr_double" "ac_cv_func_xdr_double"
+if test "$enable_xdr" != "no" ; then
+    XDR_LIB=""
+    ac_fn_c_check_func "$LINENO" "xdr_double" "ac_cv_func_xdr_double"
 if test "x$ac_cv_func_xdr_double" = xyes; then :
-
-$as_echo "#define HAVE_XDR 1" >>confdefs.h
-
+  XDR_LIB=" "
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -ltirpc" >&5
 $as_echo_n "checking for xdr_double in -ltirpc... " >&6; }
@@ -6093,10 +5734,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tirpc_xdr_double" >&5
 $as_echo "$ac_cv_lib_tirpc_xdr_double" >&6; }
 if test "x$ac_cv_lib_tirpc_xdr_double" = xyes; then :
-
-$as_echo "#define HAVE_XDR 1" >>confdefs.h
-
-	                TLIBS="$TLIBS -ltirpc" TCFLAGS="$TCFLAGS -I/usr/include/tirpc"
+  XDR_LIB=tirpc
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -lgssrpc" >&5
 $as_echo_n "checking for xdr_double in -lgssrpc... " >&6; }
@@ -6135,10 +5773,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gssrpc_xdr_double" >&5
 $as_echo "$ac_cv_lib_gssrpc_xdr_double" >&6; }
 if test "x$ac_cv_lib_gssrpc_xdr_double" = xyes; then :
-
-$as_echo "#define HAVE_XDR 1" >>confdefs.h
-
-	                TLIBS="$TLIBS -lgssrpc" TCFLAGS="$TCFLAGS -I/usr/include/gssrpc"
+  XDR_LIB=gssrpc
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -lrpc" >&5
 $as_echo_n "checking for xdr_double in -lrpc... " >&6; }
@@ -6177,10 +5812,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rpc_xdr_double" >&5
 $as_echo "$ac_cv_lib_rpc_xdr_double" >&6; }
 if test "x$ac_cv_lib_rpc_xdr_double" = xyes; then :
-
-$as_echo "#define HAVE_XDR 1" >>confdefs.h
-
-	                TLIBS="$TLIBS -lrpc" TCFLAGS="$TCFLAGS -I/usr/include/rpc"
+  XDR_LIB=rpc
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -loncrpc" >&5
 $as_echo_n "checking for xdr_double in -loncrpc... " >&6; }
@@ -6219,10 +5851,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_oncrpc_xdr_double" >&5
 $as_echo "$ac_cv_lib_oncrpc_xdr_double" >&6; }
 if test "x$ac_cv_lib_oncrpc_xdr_double" = xyes; then :
-
-$as_echo "#define HAVE_XDR 1" >>confdefs.h
-
-	                TLIBS="$TLIBS -loncrpc" TCFLAGS="$TCFLAGS -I/usr/include/oncrpc"
+  XDR_LIB=oncrpc
 fi
 
 fi
@@ -6233,6 +5862,16 @@ fi
 
 fi
 
+
+    if test "$XDR_LIB" != ""; then
+
+$as_echo "#define HAVE_XDR 1" >>confdefs.h
+
+	if test "$XDR_LIB" != " "; then
+	    TLIBS="$TLIBS -l$XDR_LIB"
+	    add_arg_to_tcflags -I/usr/include/$XDR_LIB
+	fi
+    fi
 fi
 
 
@@ -6247,18 +5886,24 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-  #include <stdio.h>
-  #include <unistd.h>
-  int main() {
-      unsigned long u;
-      long j;
-      if (__builtin_clzl(0)!=sizeof(long)*8)
-      	 return -1;
-      for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
-      	  if (__builtin_clzl(u)!=j)
-  	     return -1;
-      return 0;
-   }
+		#include <stdio.h>
+		#include <unistd.h>
+
+int
+main ()
+{
+
+		unsigned long u;
+		long j;
+		if (__builtin_clzl(0)!=sizeof(long)*8)
+      		   return -1;
+		   for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
+      		       if (__builtin_clzl(u)!=j)
+  			  return -1;
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -6286,18 +5931,24 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-  #include <stdio.h>
-  #include <unistd.h>
-  int main() {
-      unsigned long u;
-      long j;
-      if (__builtin_ctzl(0)!=sizeof(long)*8)
-      	 return -1;
-      for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
-      	  if (__builtin_ctzl(u)!=j)
-  	     return -1;
-      return 0;
-   }
+		#include <stdio.h>
+		#include <unistd.h>
+
+int
+main ()
+{
+
+		unsigned long u;
+		long j;
+		if (__builtin_ctzl(0)!=sizeof(long)*8)
+      		   return -1;
+		   for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
+      		       if (__builtin_ctzl(u)!=j)
+  			  return -1;
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -6316,13 +5967,13 @@ fi
 
 
 case $use in
-     sh4*) ;;     #FIXME, these exceptions needed as of gcc 4.7
-     hppa*) ;;    #FIXME
-     powerpc*) ;; #FIXME
-     alpha*) ;;   #FIXME
-     ia64*) ;;    #FIXME
-     *)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking __builtin___clear_cache" >&5
+    sh4*) ;;     #FIXME, these exceptions needed as of gcc 4.7
+    hppa*) ;;    #FIXME
+    powerpc*) ;; #FIXME
+    alpha*) ;;   #FIXME
+    ia64*) ;;    #FIXME
+    *)
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __builtin___clear_cache" >&5
 $as_echo_n "checking __builtin___clear_cache... " >&6; }
 	if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -6333,7 +5984,6 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
 int
 main ()
 {
@@ -6349,7 +5999,7 @@ if ac_fn_c_try_run "$LINENO"; then :
 
 $as_echo "#define HAVE_BUILTIN_CLEAR_CACHE 1" >>confdefs.h
 
-				 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+	     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -6414,13 +6064,10 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-
 int
 main ()
 {
 
-
 		/* Are we little or big endian?  Adapted from Harbison&Steele.  */
 		union {long l;char c[sizeof(long)];} u;
 		u.l = 1;
@@ -6459,8 +6106,6 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-
 int
 main ()
 {
@@ -6494,8 +6139,8 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pagewidth" >&5
 $as_echo_n "checking for pagewidth... " >&6; }
 case $use in
-     mips*) min_pagewidth=14;;
-     *) min_pagewidth=12;;
+    mips*) min_pagewidth=14;;
+    *) min_pagewidth=12;;
 esac
 if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -6506,23 +6151,21 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-	    #include <stdio.h>
-            #include <unistd.h>
-            #ifdef __CYGWIN__
-            #define getpagesize() 4096
-            #endif
+		#include <stdio.h>
+		#include <unistd.h>
+		#ifdef __CYGWIN__
+		#define getpagesize() 4096
+		#endif
 
 int
 main ()
 {
 
-	    size_t i=getpagesize(),j;
-	    FILE *fp=fopen("conftest1","w");
-	    for (j=0;i>>=1;j++);
-	    j=j<$min_pagewidth ? $min_pagewidth : j;
-	    fprintf(fp,"%u",j);
-	    return 0;
+		size_t i=getpagesize(),j;
+		FILE *fp=fopen("conftest1","w");
+		for (j=0;i>>=1;j++);
+		    j=j<$min_pagewidth ? $min_pagewidth : j;
+		    fprintf(fp,"%u",j);
 
   ;
   return 0;
@@ -6557,27 +6200,27 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-        #include <stdio.h>
-	#define EXTER
-	#define INLINE
-	#include "$MP_INCLUDE"
-	#include "./h/enum.h"
-	#define OBJ_ALIGN
-	#include "./h/type.h"
-	#include "./h/lu.h"
-	#include "./h/object.h"
+		#include <stdio.h>
+		#define EXTER
+		#define INLINE
+		#include "$MP_INCLUDE"
+		#include "./h/enum.h"
+		#define OBJ_ALIGN
+		#include "./h/type.h"
+		#include "./h/lu.h"
+		#include "./h/object.h"
 
 int
 main ()
 {
 
-	unsigned long i;
-   	FILE *fp=fopen("conftest1","w");
-	for (i=1;i && NOT_OBJECT_ALIGNED(i); i<<=1);
-	if (!i) return -1;
-	fprintf(fp,"%lu",i);
-	fclose(fp);
-	return 0;
+		unsigned long i;
+   		FILE *fp=fopen("conftest1","w");
+		for (i=1;i && NOT_OBJECT_ALIGNED(i); i<<=1);
+		    if (!i) return -1;
+		       fprintf(fp,"%lu",i);
+		       fclose(fp);
+		       return 0;
 
   ;
   return 0;
@@ -6585,7 +6228,7 @@ main ()
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   obj_align=`cat conftest1`
-	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $obj_align" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $obj_align" >&5
 $as_echo "$obj_align" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -6615,8 +6258,8 @@ int
 main ()
 {
 
-	    char *v __attribute__ ((aligned ($obj_align)));
-	    return 0;
+			 char *v __attribute__ ((aligned ($obj_align)));
+
   ;
   return 0;
 }
@@ -6653,8 +6296,8 @@ int
 main ()
 {
 
-	    extern int v() __attribute__ ((noreturn));
-	    return 0;
+			 extern int v() __attribute__ ((noreturn));
+
   ;
   return 0;
 }
@@ -6679,68 +6322,43 @@ _ACEOF
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sizeof struct contblock" >&5
 $as_echo_n "checking sizeof struct contblock... " >&6; }
 
-# work around MSYS pwd result incompatibility
-if test "$use" = "mingw" ; then
 if test "$cross_compiling" = yes; then :
-  echo Cannot find sizeof struct contblock;exit 1
+  as_fn_error $? "Cannot find sizeof struct contblock" "$LINENO" 5
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-	#define EXTER
-	#define INLINE
-	#include "$MP_INCLUDE"
-	#include "h/enum.h"
-	#include "h/type.h"
-	#include "h/lu.h"
-	#include "h/object.h"
-	int main(int argc,char **argv,char **envp) {
-	FILE *f=fopen("conftest1","w");
-	fprintf(f,"%u",sizeof(struct contblock));
-	fclose(f);
-	return 0;
-	}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  sizeof_contblock=`cat conftest1`
-else
-  echo Cannot find sizeof struct contblock;exit 1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
 
-else
-if test "$cross_compiling" = yes; then :
-  echo Cannot find sizeof struct contblock;exit 1
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-	#define EXTER
-	#define INLINE
-	#include "$MP_INCLUDE"
-	#include "`pwd`/h/enum.h"
-	#include "`pwd`/h/type.h"
-	#include "`pwd`/h/lu.h"
-	#include "`pwd`/h/object.h"
-	int main(int argc,char **argv,char **envp) {
-	FILE *f=fopen("conftest1","w");
-	fprintf(f,"%u",sizeof(struct contblock));
-	fclose(f);
-	return 0;
-	}
+		#include <stdio.h>
+		#define EXTER
+		#define INLINE
+		#include "$MP_INCLUDE"
+		#include "h/enum.h"
+		#include "h/type.h"
+		#include "h/lu.h"
+		#include "h/object.h"
+
+int
+main ()
+{
+
+		FILE *f=fopen("conftest1","w");
+		fprintf(f,"%u",sizeof(struct contblock));
+		fclose(f);
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   sizeof_contblock=`cat conftest1`
 else
-  echo Cannot find sizeof struct contblock;exit 1
+  as_fn_error $? "Cannot find sizeof struct contblock" "$LINENO" 5
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_contblock" >&5
 $as_echo "$sizeof_contblock" >&6; }
 
@@ -6758,19 +6376,25 @@ $as_echo "no: WARNING you must be able t
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <unistd.h>
-	    #include <stdio.h>
-	    int main() {
+
+		#include <unistd.h>
+		#include <stdio.h>
+
+int
+main ()
+{
+
 		FILE *f;
 		if (!(f=fopen("conftest1","w")))
-			return -1;
-		fprintf(f,"%u",sbrk(0));
-		return 0;
-		}
+		   return -1;
+		   fprintf(f,"%u",sbrk(0));
+
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
-  HAVE_SBRK=1
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+  HAVE_SBRK=1;{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no: WARNING you must be able to emulate sbrk: as on mingw or macosx" >&5
@@ -6782,16 +6406,16 @@ fi
 
 
 if test "$use" = "386-macosx" ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: emulating sbrk for mac" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: emulating sbrk for mac" >&5
 $as_echo "emulating sbrk for mac" >&6; };
-   HAVE_SBRK=0
+    HAVE_SBRK=0
 fi
 
 if test "$HAVE_SBRK" = "1" ; then
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_NO_RANDOMIZE constant" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_NO_RANDOMIZE constant" >&5
 $as_echo_n "checking for ADDR_NO_RANDOMIZE constant... " >&6; }
-   if test "$cross_compiling" = yes; then :
+    if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -6800,18 +6424,16 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-            #include <sys/personality.h>
- 	    #include <stdio.h>
+		    #include <sys/personality.h>
+ 		    #include <stdio.h>
 
 int
 main ()
 {
 
-	    FILE *f;
-	    if (!(f=fopen("conftest1","w"))) return -1;
-	    fprintf(f,"%x",ADDR_NO_RANDOMIZE);
-	    return 0;
+		    FILE *f;
+		    if (!(f=fopen("conftest1","w"))) return -1;
+		       fprintf(f,"%x",ADDR_NO_RANDOMIZE);
 
   ;
   return 0;
@@ -6819,11 +6441,11 @@ main ()
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   ADDR_NO_RANDOMIZE=`cat conftest1`
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_NO_RANDOMIZE" >&5
+	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_NO_RANDOMIZE" >&5
 $as_echo "yes $ADDR_NO_RANDOMIZE" >&6; }
 else
   ADDR_NO_RANDOMIZE=0
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no assuming 0x40000" >&5
+	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no assuming 0x40000" >&5
 $as_echo "no assuming 0x40000" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -6836,9 +6458,9 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_COMPAT_LAYOUT constant" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_COMPAT_LAYOUT constant" >&5
 $as_echo_n "checking for ADDR_COMPAT_LAYOUT constant... " >&6; }
-   if test "$cross_compiling" = yes; then :
+    if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -6847,18 +6469,16 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-            #include <sys/personality.h>
- 	    #include <stdio.h>
+		    #include <sys/personality.h>
+ 		    #include <stdio.h>
 
 int
 main ()
 {
 
-	    FILE *f;
-	    if (!(f=fopen("conftest1","w"))) return -1;
-	    fprintf(f,"%x",ADDR_COMPAT_LAYOUT);
-	    return 0;
+		    FILE *f;
+		    if (!(f=fopen("conftest1","w"))) return -1;
+		       fprintf(f,"%x",ADDR_COMPAT_LAYOUT);
 
   ;
   return 0;
@@ -6866,11 +6486,11 @@ main ()
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   ADDR_COMPAT_LAYOUT=`cat conftest1`
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_COMPAT_LAYOUT" >&5
+	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_COMPAT_LAYOUT" >&5
 $as_echo "yes $ADDR_COMPAT_LAYOUT" >&6; }
 else
   ADDR_COMPAT_LAYOUT=0
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -6883,9 +6503,9 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_LIMIT_3GB constant" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_LIMIT_3GB constant" >&5
 $as_echo_n "checking for ADDR_LIMIT_3GB constant... " >&6; }
-   if test "$cross_compiling" = yes; then :
+    if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -6894,18 +6514,16 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-            #include <sys/personality.h>
- 	    #include <stdio.h>
+		    #include <sys/personality.h>
+ 		    #include <stdio.h>
 
 int
 main ()
 {
 
-	    FILE *f;
-	    if (!(f=fopen("conftest1","w"))) return -1;
-	    fprintf(f,"%x",ADDR_LIMIT_3GB);
-	    return 0;
+		    FILE *f;
+		    if (!(f=fopen("conftest1","w"))) return -1;
+		       fprintf(f,"%x",ADDR_LIMIT_3GB);
 
   ;
   return 0;
@@ -6913,11 +6531,11 @@ main ()
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   ADDR_LIMIT_3GB=`cat conftest1`
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_LIMIT_3GB" >&5
+	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $ADDR_LIMIT_3GB" >&5
 $as_echo "yes $ADDR_LIMIT_3GB" >&6; }
 else
   ADDR_LIMIT_3GB=0
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -6930,9 +6548,9 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for personality(ADDR_NO_RANDOMIZE) support" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for personality(ADDR_NO_RANDOMIZE) support" >&5
 $as_echo_n "checking for personality(ADDR_NO_RANDOMIZE) support... " >&6; }
-   if test "$cross_compiling" = yes; then :
+    if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -6941,12 +6559,13 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+		    #include <stdio.h>
+		    #include <stdlib.h>
+		    int main(int argc,char *argv[],char *envp[]) {
+			#include "h/unrandomize.h"
+			return 0;
+		    }
 
-	        #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 :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -6963,92 +6582,89 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that sbrk is (now) non-random" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking that sbrk is (now) non-random" >&5
 $as_echo_n "checking that sbrk is (now) non-random... " >&6; }
-	if test "$cross_compiling" = yes; then :
-  SBRK=0
+    SBRK=0
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-	            #include <stdlib.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,"%u",sbrk(0));
-			return 0;}
+			if (!(f=fopen("conftest1","w")))
+			   return -1;
+			   fprintf(f,"%u",sbrk(0));
+			   return 0;
+		    }
+
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   SBRK=`cat conftest1`
-else
-  SBRK=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 "$SBRK" = "0" ; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot trap sbrk" >&5
-$as_echo "cannot trap sbrk" >&6; }
-		exit 1
-	fi
-	if test "$cross_compiling" = yes; then :
-  SBRK1=0
+    if test "$SBRK" = "0" ; then
+	as_fn_error $? "cannot trap sbrk" "$LINENO" 5
+    fi
+
+    SBRK1=0
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-	            #include <stdlib.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,"%u",sbrk(0));
-			return 0;}
+			   fprintf(f,"%u",sbrk(0));
+			   return 0;
+		    }
+
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   SBRK1=`cat conftest1`
-else
-  SBRK1=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_echo "$as_me:${as_lineno-$LINENO}: result: cannot trap sbrk" >&5
-$as_echo "cannot trap sbrk" >&6; }
-		exit 1
-	fi
-	if test "$SBRK" = "$SBRK1" ; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+    if test "$SBRK1" = "0" ; then
+	as_fn_error $? "cannot trap sbrk" "$LINENO" 5
+    fi
+    if test "$SBRK" = "$SBRK1" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	else
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+    else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "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"
-		exit 1
-	fi
+	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
-
-
-
-
-
-
-
-
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CSTACK_ADDRESS" >&5
 $as_echo_n "checking CSTACK_ADDRESS... " >&6; }
 if test "$cross_compiling" = yes; then :
@@ -7060,34 +6676,35 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
-	#include <stdlib.h>
-	void *
-	foo() {
-	      int i;
-	      return (void *)&i;
-        }
-
-	int main(int argc,char **argv,char **envp) {
-	void *v ;
-	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)&v;
-	if (foo()>i) i-=j;
-	j--;
-	i+=j;
-	i&=~j;
-	fprintf(fp,"0x%lx",i-1);
-	fclose(fp);
-	return 0;
-}
+		#include <stdio.h>
+		#include <stdlib.h>
+		void *
+		foo() {
+		    int i;
+		    return (void *)&i;
+		}
+
+		int
+		main(int argc,char **argv,char **envp) {
+		    void *v ;
+		    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)&v;
+		    if (foo()>i) i-=j;
+		       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`
@@ -7117,35 +6734,36 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
-	#include <stdlib.h>
-	void *
-	foo() {
-	      int i;
-	      return (void *)&i;
-        }
-
-	int main(int argc,char **argv,char **envp) {
-	void *v ;
-	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)&v;
-	if (foo()>i) i-=j;
-	j--;
-	i+=j;
-	i&=~j;
-	for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
-	fprintf(fp,"%d",j);
-	fclose(fp);
-	return 0;
-}
+		#include <stdio.h>
+		#include <stdlib.h>
+		void *
+		foo() {
+		    int i;
+		    return (void *)&i;
+		}
+
+		int
+		main(int argc,char **argv,char **envp) {
+		    void *v ;
+		    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)&v;
+		    if (foo()>i) i-=j;
+		       j--;
+		       i+=j;
+		       i&=~j;
+		       for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
+			   fprintf(fp,"%d",j);
+			   fclose(fp);
+			   return 0;
+		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   cstack_bits=`cat conftest1`
@@ -7175,33 +6793,33 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
-	#include <stdlib.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;
-}
+		#include <stdio.h>
+		#include <stdlib.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;
+		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	neg_cstack_address=1
+     neg_cstack_address=1
 
 $as_echo "#define NEG_CSTACK_ADDRESS 1" >>confdefs.h
 
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	neg_cstack_address=0
+     neg_cstack_address=0
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking finding CSTACK_ALIGNMENT" >&5
 $as_echo_n "checking finding CSTACK_ALIGNMENT... " >&6; }
 if test "$cross_compiling" = yes; then :
@@ -7213,23 +6831,23 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.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>
+		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;
+		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   cstack_alignment=`cat conftest1`
@@ -7259,24 +6877,25 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
-	#include <stdlib.h>
-	void *
-	foo(void) {
-	int i;
-	return (void *)&i;
-	}
-
-	int main(int argc,char **argv,char **envp) {
-	char *b;
-	FILE *fp = fopen("conftest1","w");
-	#ifdef CAN_UNRANDOMIZE_SBRK
-	#include "h/unrandomize.h"
-	#endif
-	fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
-	fclose(fp);
-	return 0;
-}
+		#include <stdio.h>
+		#include <stdlib.h>
+		void *
+		foo(void) {
+		    int i;
+		    return (void *)&i;
+		}
+
+		int
+		main(int argc,char **argv,char **envp) {
+		    char *b;
+		    FILE *fp = fopen("conftest1","w");
+		    #ifdef CAN_UNRANDOMIZE_SBRK
+		    #include "h/unrandomize.h"
+		    #endif
+		    fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
+		    fclose(fp);
+		    return 0;
+		}
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   cstack_direction=`cat conftest1`
@@ -7295,62 +6914,74 @@ _ACEOF
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_direction" >&5
 $as_echo "$cstack_direction" >&6; }
 
+# Check whether --enable-immfix was given.
+if test "${enable_immfix+set}" = set; then :
+  enableval=$enable_immfix;
+fi
+
+
+# Check whether --enable-fastimmfix was given.
+if test "${enable_fastimmfix+set}" = set; then :
+  enableval=$enable_fastimmfix;
+else
+  enable_fastimmfix=64
+fi
 
 
 
 if test "$use" != "386-gnu" ; then #hurd can push .data below C stack, but sbrk(0) remains above, foiling unexec
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking finding default linker script" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking finding default linker script" >&5
 $as_echo_n "checking finding default linker script... " >&6; }
-   touch unixport/gcl.script
-   echo "int main() {return 0;}" >foo.c
-   $CC -Wl,--verbose foo.c -o foo 2>&1 | \
-       $AWK '/\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=/ {i=1-i;next} {if (i) print}' >gcl.script
-   rm -rf foo.c foo
+    touch unixport/gcl.script
+    echo "int main() {return 0;}" >foo.c
+    $CC $TLDFLAGS -Wl,--verbose foo.c -o foo 2>&1 | \
+	$AWK '/\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=/ {i=1-i;next} {if (i) print}' >gcl.script
+    rm -rf foo.c foo
 
-   if test "`cat gcl.script | wc -l`" != "0" ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: got it" >&5
+    if test "`cat gcl.script | wc -l`" != "0" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: got it" >&5
 $as_echo "got it" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: trying to adjust text start" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: trying to adjust text start" >&5
 $as_echo "$as_me: trying to adjust text start" >&6;}
-      cp gcl.script gcl.script.def
+	cp gcl.script gcl.script.def
 
-      n=-1;
-      k=0;
-      lim=`$AWK 'END {printf("%d\n",m*8-2)}' m=$ac_cv_sizeof_long`;
-      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
-#        diff -u gcl.script.def gcl.script
-        echo "int main() {return 0;}" >foo.c
-        if ( $CC -Wl,-T gcl.script foo.c -o foo && ./foo ) >/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
-	 break;
-        fi;
-        n=`$AWK 'END {print n+1}' n=$n </dev/null`
-      done
+	n=-1;
+	k=0;
+	lim=`$AWK 'END {printf("%d\n",m*8-2)}' m=$ac_cv_sizeof_long`;
+	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
+	    #        diff -u gcl.script.def gcl.script
+            echo "int main() {return 0;}" >foo.c
+            if ( $CC $TLDFLAGS -Wl,-T gcl.script foo.c -o foo && ./foo ) >/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
+		break;
+            fi;
+            n=`$AWK 'END {print n+1}' n=$n </dev/null`
+	done
 
-      { $as_echo "$as_me:${as_lineno-$LINENO}: min log text start $min" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: min log text start $min" >&5
 $as_echo "$as_me: min log text start $min" >&6;}
-      { $as_echo "$as_me:${as_lineno-$LINENO}: max log text start $max" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: max log text start $max" >&5
 $as_echo "$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
-	    max=$cstack_bits;
-            { $as_echo "$as_me:${as_lineno-$LINENO}: max log text start reduced to $max considering c stack address" >&5
+	if test $neg_cstack_address -eq 1 ; then #FIXME test this
+      	    if test $cstack_bits -lt $max ; then
+		max=$cstack_bits;
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: max log text start reduced to $max considering c stack address" >&5
 $as_echo "$as_me: max log text start reduced to $max considering c stack address" >&6;}
-	 fi
-      fi
+	    fi
+	fi
 
-      j=-1;
-      low_shft="";
-      if test $min -le $max ; then
-            if test $max -ge $enable_fastimmfix && test "$enable_immfix" = "yes" ; then
+	j=-1;
+	low_shft="";
+	if test $min -le $max ; 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`;
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: raising log text to $j for a $max bit wide low immfix table" >&5
@@ -7360,9 +6991,9 @@ $as_echo "$as_me: raising log text to $j
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: lowering log text to $j to maximize data area" >&5
 $as_echo "$as_me: lowering log text to $j to maximize data area" >&6;}
 	    fi
-      fi
+	fi
 
-      if test "$low_shft" != "" ; then
+	if test "$low_shft" != "" ; then
 
 cat >>confdefs.h <<_ACEOF
 #define LOW_SHFT $low_shft
@@ -7373,34 +7004,34 @@ cat >>confdefs.h <<_ACEOF
 #define OBJNULL (object)0x$j
 _ACEOF
 
-      else
+	else
 
 cat >>confdefs.h <<_ACEOF
 #define OBJNULL NULL
 _ACEOF
 
-      fi
+	fi
 
-#      echo $j;
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking our linker script" >&5
+	#      echo $j;
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking our linker script" >&5
 $as_echo_n "checking our linker script... " >&6; }
-      if test "$j" -ne "-1" ; then
+	if test "$j" -ne "-1" ; then
             cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[0-9]*","0x" j,$0);} {print}' j=$j >gcl.script
 	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
 $as_echo "done" >&6; }
 	    rm -f gcl.script.def
 	    LDFLAGS="$LDFLAGS -Wl,-T gcl.script "
 	    cp gcl.script unixport
-      else
-	 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none found or not needed" >&5
+	else
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none found or not needed" >&5
 $as_echo "none found or not needed" >&6; }
-	 rm -f gcl.script gcl.script.def
-      fi
-      rm -rf foo.c foo
-  else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+	    rm -f gcl.script gcl.script.def
+	fi
+	rm -rf foo.c foo
+    else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
-  fi
+    fi
 
 else
 
@@ -7412,19 +7043,6 @@ _ACEOF
 
 fi
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 mem_top=0
 mem_range=0
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking mem top" >&5
@@ -7438,30 +7056,30 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
+		#include <stdio.h>
 
 int
 main ()
 {
 
-	void *v;
-	unsigned long i,j,k,l,m;
-	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 : -1) : l;
-	for (i=j=k;j && i<l;j>>=1,i|=j);
-	if (j<(k>>3)) i=0;
-	j=1;
-	j<<=$PAGEWIDTH;
-	j<<=4;
-	j--;
-	i+=j;
-	i&=~j;
-	fprintf(fp,"0x%lx",i);
-	fclose(fp);
-	return 0;
+		void *v;
+		unsigned long i,j,k,l,m;
+		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 : -1) : l;
+		    for (i=j=k;j && i<l;j>>=1,i|=j);
+			if (j<(k>>3)) i=0;
+			   j=1;
+			   j<<=$PAGEWIDTH;
+			   j<<=4;
+			   j--;
+			   i+=j;
+			   i&=~j;
+			   fprintf(fp,"0x%lx",i);
+			   fclose(fp);
+			   return 0;
 
   ;
   return 0;
@@ -7478,10 +7096,11 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mem_top" >&5
 $as_echo "$mem_top" >&6; }
+
 if test "$mem_top" != "0x0" ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking finding upper mem half range" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking finding upper mem half range" >&5
 $as_echo_n "checking finding upper mem half range... " >&6; }
-   if test "$cross_compiling" = yes; then :
+    if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -7490,19 +7109,19 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-   #include <stdio.h>
+		    #include <stdio.h>
 
 int
 main ()
 {
 
-   unsigned long j;
-   FILE *fp = fopen("conftest1","w");
+		    unsigned long j;
+		    FILE *fp = fopen("conftest1","w");
 
-   for (j=1;j && !(j& $mem_top);j<<=1);
-   fprintf(fp,"0x%lx",j>>1);
-   fclose(fp);
-   return 0;
+		    for (j=1;j && !(j& $mem_top);j<<=1);
+			fprintf(fp,"0x%lx",j>>1);
+			fclose(fp);
+			return 0;
 
   ;
   return 0;
@@ -7517,9 +7136,9 @@ rm -f core *.core core.conftest.* gmon.o
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mem_range" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mem_range" >&5
 $as_echo "$mem_range" >&6; }
-   if test "$mem_range" != "0x0" ; then
+    if test "$mem_range" != "0x0" ; then
 
 cat >>confdefs.h <<_ACEOF
 #define MEM_TOP $mem_top
@@ -7530,12 +7149,12 @@ cat >>confdefs.h <<_ACEOF
 #define MEM_RANGE $mem_range
 _ACEOF
 
-   fi
+    fi
 fi
 
-if test "$enable_immfix" = "yes" ; then
-  if test "$mem_top" != "0x0" ; then
-     if test "$mem_range" != "0x0" ; then
+if test "$enable_immfix" != "no" ; then
+    if test "$mem_top" != "0x0" ; then
+	if test "$mem_range" != "0x0" ; then
 
 cat >>confdefs.h <<_ACEOF
 #define IM_FIX_BASE $mem_top
@@ -7546,24 +7165,10 @@ cat >>confdefs.h <<_ACEOF
 #define IM_FIX_LIM $mem_range
 _ACEOF
 
-     fi
-  fi
+	fi
+    fi
 fi
 
-
-
-
-# On systems with execshield, brk is randomized.  We need to catch
-# this and restore the traditional behavior here
-
-
-
-
-
-
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sizeof long long int" >&5
 $as_echo_n "checking sizeof long long int... " >&6; }
 if test "$cross_compiling" = yes; then :
@@ -7575,14 +7180,14 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#include <stdio.h>
+		#include <stdio.h>
 
 int
 main ()
 {
 
-	if (sizeof(long long int) == 2*sizeof(long)) return 0;
-	return 1;
+		if (sizeof(long long int) == 2*sizeof(long)) return 0;
+		   return 1;
 
   ;
   return 0;
@@ -7604,7 +7209,6 @@ fi
 
 
 
-
 for ac_header in dirent.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "dirent.h" "ac_cv_header_dirent_h" "$ac_includes_default"
@@ -7614,21 +7218,21 @@ if test "x$ac_cv_header_dirent_h" = xyes
 _ACEOF
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for d_type" >&5
 $as_echo_n "checking for d_type... " >&6; }
-	if test "$cross_compiling" = yes; then :
+		 if test "$cross_compiling" = yes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		#include <dirent.h>
+				 #include <dirent.h>
 
 int
 main ()
 {
 
-		struct dirent d;
-		return d.d_type=0;
+				 struct dirent d;
+				 return d.d_type=0;
 
   ;
   return 0;
@@ -7652,32 +7256,18 @@ fi
 done
 
 
-# readline
-# Check whether --enable-readline was given.
-if test "${enable_readline+set}" = set; then :
-  enableval=$enable_readline;
-else
-  enable_readline="yes"
-fi
-
-
 # ansi lisp
+SYSTEM=ansi_gcl
+CLSTANDARD=ANSI
 # Check whether --enable-ansi was given.
 if test "${enable_ansi+set}" = set; then :
-  enableval=$enable_ansi;
-else
-  enable_ansi="yes"
+  enableval=$enable_ansi; if test "$enable_ansi" = "no" ; then
+		   SYSTEM=gcl
+		   CLSTANDARD=CLtL1
+	       fi
 fi
 
 
-if test "$enable_ansi" = "yes" ; then
-	SYSTEM=ansi_gcl
-	CLSTANDARD=ANSI
-else
-	SYSTEM=gcl
-	CLSTANDARD=CLtL1
-fi
-
 FLISP="saved_$SYSTEM"
 
 
@@ -7913,23 +7503,22 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-            #include <stdio.h>
+		#include <stdio.h>
 
 int
 main ()
 {
 
-            char *s= "2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161404";
-	    int n, m;
-	    double f;
-	    char *endptr;
-            FILE *fp=fopen("conftest1","w");
+		char *s= "2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161404";
+		int n, m;
+		double f;
+		char *endptr;
+		FILE *fp=fopen("conftest1","w");
 
-	    n=sscanf(s,"%lf%n",&f,&m);
-	    fprintf(fp,"%d",m);
-	    fclose(fp);
-	    return s[m];
+		n=sscanf(s,"%lf%n",&f,&m);
+		fprintf(fp,"%d",m);
+		fclose(fp);
+		return s[m];
 
   ;
   return 0;
@@ -7940,7 +7529,7 @@ if ac_fn_c_try_run "$LINENO"; then :
 $as_echo "none" >&6; }
 else
   buggy_maximum_sscanf_length=`cat conftest1`
-         { $as_echo "$as_me:${as_lineno-$LINENO}: result: $buggy_maximum_sscanf_length" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $buggy_maximum_sscanf_length" >&5
 $as_echo "$buggy_maximum_sscanf_length" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -7955,8 +7544,10 @@ fi
 
 
 EXTRA_LOBJS=
-if test "$try_japi" = "yes" ; then
-   for ac_header in japi.h
+# Check whether --enable-japi was given.
+if test "${enable_japi+set}" = set; then :
+  enableval=$enable_japi; if test "$enable_japi" = "yes" ; then
+		   for ac_header in japi.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "japi.h" "ac_cv_header_japi_h" "$ac_includes_default"
 if test "x$ac_cv_header_japi_h" = xyes; then :
@@ -7965,14 +7556,16 @@ if test "x$ac_cv_header_japi_h" = xyes;
 _ACEOF
  $as_echo "#define HAVE_JAPI_H 1" >>confdefs.h
 
-				 EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o"
-			 	 LIBS="${LIBS} -ljapi -lwsock32"
+				     EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o"
+				     LIBS="${LIBS} -ljapi -lwsock32"
 fi
 
 done
 
+	       fi
 fi
 
+
 # Should really find a way to check for prototypes, but this
 # basically works for now.  CM
 #
@@ -8057,15 +7650,15 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-            #define _GNU_SOURCE
-	    #include <math.h>
+		#define _GNU_SOURCE
+		#include <math.h>
 
 int
 main ()
 {
 
-	    float f;
-	    return isnormal(f) || !isnormal(f) ? 0 : 1;
+		float f;
+		return isnormal(f) || !isnormal(f) ? 0 : 1;
 
   ;
   return 0;
@@ -8077,9 +7670,9 @@ $as_echo "#define HAVE_ISNORMAL 1" >>con
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fpclass in ieeefp.h" >&5
-$as_echo_n "checking for fpclass in ieeefp.h... " >&6; }
-		 if test "$cross_compiling" = yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fpclass of ieeefp.h" >&5
+$as_echo_n "checking for fpclass of ieeefp.h... " >&6; }
+     if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -8088,14 +7681,14 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-			#include <ieeefp.h>
+		     #include <ieeefp.h>
 
 int
 main ()
 {
 
-			float f;
-			return fpclass(f)>=FP_NZERO || fpclass(f)<FP_NZERO ? 0 : 1;
+		     float f;
+		     return fpclass(f)>=FP_NZERO || fpclass(f)<FP_NZERO ? 0 : 1;
 
   ;
   return 0;
@@ -8131,15 +7724,15 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-        #define _GNU_SOURCE
-	#include <math.h>
+		#define _GNU_SOURCE
+		#include <math.h>
 
 int
 main ()
 {
 
-	float f;
-	return isfinite(f) || !isfinite(f) ? 0 : 1;
+		float f;
+		return isfinite(f) || !isfinite(f) ? 0 : 1;
 
   ;
   return 0;
@@ -8153,7 +7746,7 @@ $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for finite()" >&5
 $as_echo_n "checking for finite()... " >&6; }
-	      if test "$cross_compiling" = yes; then :
+     if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run test program while cross compiling
@@ -8162,15 +7755,15 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		#include <math.h>
-		#include <ieeefp.h>
+		     #include <math.h>
+		     #include <ieeefp.h>
 
 int
 main ()
 {
 
-		float f;
-		return finite(f) || !finite(f) ? 0 : 1;
+		     float f;
+		     return finite(f) || !finite(f) ? 0 : 1;
 
   ;
   return 0;
@@ -8194,8 +7787,6 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
-
-
 #--------------------------------------------------------------------
 #	Check for the existence of the -lsocket and -lnsl libraries.
 #	The order here is important, so that they end up in the right
@@ -8315,10 +7906,19 @@ fi
 fi
 
 
-RL_OBJS=""
-RL_LIB=""
-if test "$enable_readline" = "yes" ; then
-	for ac_header in readline/readline.h
+# readline
+# Check whether --enable-readline was given.
+if test "${enable_readline+set}" = set; then :
+  enableval=$enable_readline;
+fi
+
+
+if test "$use" = "mingw" ; then
+    enable_readline=no
+fi
+
+if test "$enable_readline" != "no" ; then
+    for ac_header in readline/readline.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
 if test "x$ac_cv_header_readline_readline_h" = xyes; then :
@@ -8365,12 +7965,8 @@ if test "x$ac_cv_lib_readline_rl_initial
 
 $as_echo "#define HAVE_READLINE 1" >>confdefs.h
 
-			TLIBS="$TLIBS -lreadline" #some machines don't link this, e.g. Slackware
-			RL_OBJS=gcl_readline.o
-# Readline support now initialized automatically when compiled in, this lisp
-# object no longer needed -- 20040102 CM
-#			RL_LIB=lsp/gcl_readline.o
-
+				   TLIBS="$TLIBS -lreadline" #some machines don't link this, e.g. Slackware
+				   RL_OBJS=gcl_readline.o
 fi
 
 fi
@@ -8378,8 +7974,8 @@ fi
 done
 
 
-# These tests discover differences between readline 4.1 and 4.3
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
+    # These tests discover differences between readline 4.1 and 4.3
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
 if ${ac_cv_lib_readline_rl_completion_matches+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8429,34 +8025,37 @@ fi
 
 
 
+# sockets
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking For network code for nsocket.c" >&5
 $as_echo_n "checking For network code for nsocket.c... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-/************* for the sockets ******************/
-#include <sys/socket.h>		/* struct sockaddr, SOCK_STREAM, ... */
-#ifndef NO_UNAME
-#   include <sys/utsname.h>	/* uname system call. */
-#endif
-#include <netinet/in.h>		/* struct in_addr, struct sockaddr_in */
-#include <arpa/inet.h>		/* inet_ntoa() */
-#include <netdb.h>		/* gethostbyname() */
+		#include <sys/time.h>
+		#include <sys/types.h>
+		#include <unistd.h>
+
+		#include <errno.h>
+		#include <fcntl.h>
+		#include <stdio.h>
+
+		/************* for the sockets ******************/
+		#include <sys/socket.h>		/* struct sockaddr, SOCK_STREAM, ... */
+		#ifndef NO_UNAME
+		#   include <sys/utsname.h>	/* uname system call. */
+		#endif
+		#include <netinet/in.h>		/* struct in_addr, struct sockaddr_in */
+		#include <arpa/inet.h>		/* inet_ntoa() */
+		#include <netdb.h>		/* gethostbyname() */
 
 int
 main ()
 {
- connect(0,(struct sockaddr *)0,0);
-    gethostbyname("jil");
-    socket(AF_INET, SOCK_STREAM, 0);
+
+		connect(0,(struct sockaddr *)0,0);
+		gethostbyname("jil");
+		socket(AF_INET, SOCK_STREAM, 0);
 
   ;
   return 0;
@@ -8466,7 +8065,7 @@ if ac_fn_c_try_link "$LINENO"; then :
 
 $as_echo "#define HAVE_NSOCKET 1" >>confdefs.h
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -8480,16 +8079,18 @@ rm -f core conftest.err conftest.$ac_obj
 $as_echo_n "checking check for listen using fcntl... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-#include <fcntl.h>
+
+		#include <stdio.h>
+		#include <fcntl.h>
 
 int
 main ()
 {
-FILE *fp=fopen("configure.in","r");
-  int orig;
-  orig = fcntl(fileno(fp), F_GETFL);
-  if (! (orig & O_NONBLOCK )) return 0;
+
+		FILE *fp=fopen("configure.in","r");
+		int orig;
+		orig = fcntl(fileno(fp), F_GETFL);
+		if (! (orig & O_NONBLOCK )) return 0;
 
   ;
   return 0;
@@ -8499,7 +8100,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
 
 $as_echo "#define LISTEN_USE_FCNTL 1" >>confdefs.h
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -8508,8 +8109,6 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
-
-
 ac_fn_c_check_func "$LINENO" "profil" "ac_cv_func_profil"
 if test "x$ac_cv_func_profil" = xyes; then :
 
@@ -8531,7 +8130,7 @@ fi
 
 
 if test "$no_setenv" = "1" ; then
-ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv"
+    ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv"
 if test "x$ac_cv_func_putenv" = xyes; then :
 
 $as_echo "#define HAVE_PUTENV 1" >>confdefs.h
@@ -8551,17 +8150,11 @@ fi
 
 gcl_ok=no
 
-
-
-
-
-
-# if test "x$enable_machine" = "x" ; then
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5
 $as_echo_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... " >&6; }
 
 case $system in
-       OSF*)
+    OSF*)
 
 $as_echo "#define USE_FIONBIO 1" >>confdefs.h
 
@@ -8593,8 +8186,9 @@ esac
 $as_echo_n "checking check for SV_ONSTACK... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <signal.h>
-int joe=SV_ONSTACK;
+
+		#include <signal.h>
+		int joe=SV_ONSTACK;
 
 int
 main ()
@@ -8609,7 +8203,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
 $as_echo "#define HAVE_SV_ONSTACK 1" >>confdefs.h
 
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -8621,8 +8215,9 @@ rm -f core conftest.err conftest.$ac_obj
 $as_echo_n "checking check for SIGSYS... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <signal.h>
-int joe=SIGSYS;
+
+		#include <signal.h>
+		int joe=SIGSYS;
 
 int
 main ()
@@ -8637,7 +8232,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
 $as_echo "#define HAVE_SIGSYS 1" >>confdefs.h
 
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -8650,8 +8245,9 @@ rm -f core conftest.err conftest.$ac_obj
 $as_echo_n "checking check for SIGEMT... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <signal.h>
-int joe=SIGEMT;
+
+		#include <signal.h>
+		int joe=SIGEMT;
 
 int
 main ()
@@ -8666,7 +8262,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
 $as_echo "#define HAVE_SIGEMT 1" >>confdefs.h
 
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -8705,7 +8301,7 @@ if test "x$ac_cv_header_dis_asm_h" = xye
 #define HAVE_DIS_ASM_H 1
 _ACEOF
  MLIBS=$LIBS
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for init_disassemble_info in -lopcodes" >&5
+		 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for init_disassemble_info in -lopcodes" >&5
 $as_echo_n "checking for init_disassemble_info in -lopcodes... " >&6; }
 if ${ac_cv_lib_opcodes_init_disassemble_info+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8750,7 +8346,7 @@ _ACEOF
 
 fi
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+		 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
 if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8788,7 +8384,7 @@ fi
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   #opcodes changes too quickly to link directly
-		for ac_func in print_insn_i386
+			      for ac_func in print_insn_i386
 do :
   ac_fn_c_check_func "$LINENO" "print_insn_i386" "ac_cv_func_print_insn_i386"
 if test "x$ac_cv_func_print_insn_i386" = xyes; then :
@@ -8807,7 +8403,7 @@ done
 
 
 #if test $use = "386-linux" ; then
-	for ac_header in asm/sigcontext.h
+for ac_header in asm/sigcontext.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "asm/sigcontext.h" "ac_cv_header_asm_sigcontext_h" "$ac_includes_default"
 if test "x$ac_cv_header_asm_sigcontext_h" = xyes; then :
@@ -8819,7 +8415,7 @@ fi
 
 done
 
-	for ac_header in asm/signal.h
+for ac_header in asm/signal.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "asm/signal.h" "ac_cv_header_asm_signal_h" "$ac_includes_default"
 if test "x$ac_cv_header_asm_signal_h" = xyes; then :
@@ -8831,17 +8427,18 @@ fi
 
 done
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigcontext..." >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigcontext..." >&5
 $as_echo_n "checking for sigcontext...... " >&6; }
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <signal.h>
+
+		#include <signal.h>
 
 int
 main ()
 {
 
-        struct sigcontext foo;
+		struct sigcontext foo;
 
   ;
   return 0;
@@ -8849,38 +8446,31 @@ main ()
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
-        sigcontext_works=1;
-
 $as_echo "#define SIGNAL_H_HAS_SIGCONTEXT 1" >>confdefs.h
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: sigcontext in signal.h" >&5
-$as_echo "sigcontext in signal.h" >&6; }
-
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: sigcontext of signal.h" >&5
+$as_echo "sigcontext of signal.h" >&6; }
 else
-  sigcontext_works=0;
-         { $as_echo "$as_me:${as_lineno-$LINENO}: result: sigcontext NOT in signal.h" >&5
-$as_echo "sigcontext NOT in signal.h" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       if test "$sigcontext_works" = 0 ; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigcontext..." >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: sigcontext NOT of signal.h" >&5
+$as_echo "sigcontext NOT of signal.h" >&6; }
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigcontext..." >&5
 $as_echo_n "checking for sigcontext...... " >&6; }
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <signal.h>
-             #ifdef HAVE_ASM_SIGCONTEXT_H
-             #include <asm/sigcontext.h>
-             #endif
-             #ifdef HAVE_ASM_SIGNAL_H
-             #include <asm/signal.h>
-             #endif
+
+		     #include <signal.h>
+		     #ifdef HAVE_ASM_SIGCONTEXT_H
+		     #include <asm/sigcontext.h>
+		     #endif
+		     #ifdef HAVE_ASM_SIGNAL_H
+		     #include <asm/signal.h>
+		     #endif
 
 int
 main ()
 {
 
-        struct sigcontext foo;
+		     struct sigcontext foo;
 
   ;
   return 0;
@@ -8888,39 +8478,17 @@ main ()
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
-
 $as_echo "#define HAVE_SIGCONTEXT 1" >>confdefs.h
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: sigcontext in asm files" >&5
-$as_echo "sigcontext in asm files" >&6; }
-
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: result: sigcontext asm files" >&5
+$as_echo "sigcontext asm files" >&6; }
 else
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no sigcontext found" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no sigcontext found" >&5
 $as_echo "no sigcontext found" >&6; }
-
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-       fi
-#	echo 'foo() {}' > conftest1.c
-#	$CC -S conftest1.c
-#	use_underscore=0
-#	if fgrep _foo conftest1.s ; then use_underscore=1 ; fi
-#	if test $use_underscore = 0 ; then
-#            MPI_FILE=mpi-386_no_under.o
-#          else
-#	     MPI_FILE=mpi-386d.o
-#        fi
-#	AC_SUBST(MPI_FILE)
-#       GCC=$CC
-#        if test -x  /usr/bin/i386-glibc20-linux-gcc ; then
-#          GCC=/usr/bin/i386-glibc20-linux-gcc
-#       fi
-#	AC_SUBST(GCC)
-
-#fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 # Extract the first word of "emacs", so it can be a program name with args.
 set dummy emacs; ac_word=$2
@@ -8980,11 +8548,11 @@ EOF
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking emacs site lisp directory" >&5
 $as_echo_n "checking emacs site lisp directory... " >&6; }
 if [ "$EMACS_SITE_LISP" = "unknown" ] ; then
-	if [ "$EMACS" != "" ] ; then
-		EMACS_SITE_LISP=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d  |sed -e /Warning:/d`
-	else
-		EMACS_SITE_LISP=""
-	fi
+    if [ "$EMACS" != "" ] ; then
+	EMACS_SITE_LISP=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d  |sed -e /Warning:/d`
+    else
+	EMACS_SITE_LISP=""
+    fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EMACS_SITE_LISP" >&5
 $as_echo "$EMACS_SITE_LISP" >&6; }
@@ -9005,14 +8573,14 @@ EOF
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking emacs default.el" >&5
 $as_echo_n "checking emacs default.el... " >&6; }
 if [ "$EMACS" != "" ] ; then
-	EMACS_DEFAULT_EL=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d |sed -e /Warning:/d`
+    EMACS_DEFAULT_EL=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d |sed -e /Warning:/d`
 else
-	EMACS_DEFAULT_EL=""
+    EMACS_DEFAULT_EL=""
 fi
 if  test -f "${EMACS_DEFAULT_EL}"  ; then true;else
-  if test -d $EMACS_SITE_LISP ; then
-     EMACS_DEFAULT_EL=${EMACS_SITE_LISP}/default.el
-  fi
+    if test -d $EMACS_SITE_LISP ; then
+	EMACS_DEFAULT_EL=${EMACS_SITE_LISP}/default.el
+    fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EMACS_DEFAULT_EL" >&5
 $as_echo "$EMACS_DEFAULT_EL" >&6; }
@@ -9046,14 +8614,34 @@ fi
 $as_echo "$INFO_DIR" >&6; }
 
 
-if test "$enable_tcltk" = "yes" ; then
+# Check whether --enable-tcltk was given.
+if test "${enable_tcltk+set}" = set; then :
+  enableval=$enable_tcltk;
+fi
+
+# Check whether --enable-tkconfig was given.
+if test "${enable_tkconfig+set}" = set; then :
+  enableval=$enable_tkconfig; TK_CONFIG_PREFIX=$enableval
+else
+  TK_CONFIG_PREFIX=unknown
+fi
+
+# Check whether --enable-tclconfig was given.
+if test "${enable_tclconfig+set}" = set; then :
+  enableval=$enable_tclconfig; TCL_CONFIG_PREFIX=$enableval
+else
+  TCL_CONFIG_PREFIX=unknown
+fi
+
+
+if test "$enable_tcltk" != "no" ; then
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tcl/tk" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tcl/tk" >&5
 $as_echo_n "checking for tcl/tk... " >&6; }
 
-   if test -d "${TCL_CONFIG_PREFIX}"  ; then true ; else
+    if test -d "${TCL_CONFIG_PREFIX}"  ; then true ; else
 
-     # Extract the first word of "tclsh", so it can be a program name with args.
+	# Extract the first word of "tclsh", so it can be a program name with args.
 set dummy tclsh; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
@@ -9092,76 +8680,76 @@ fi
 
 
 
-     if test "${TCLSH}" = "" ; then true ; else
+	if test "${TCLSH}" = "" ; then true ; else
 
-        rm -f conftest.tcl
-        cat >> conftest.tcl <<EOF
+	    rm -f conftest.tcl
+	    cat >> conftest.tcl <<EOF
 
 puts [set tcl_version]
 
 EOF
 
-        TCL_VERSION=`${TCLSH} < conftest.tcl`
-     fi
+	    TCL_VERSION=`${TCLSH} < conftest.tcl`
+	fi
 
-     if test -x /usr/lib/tcl$TCL_VERSION/tclConfig.sh ; then
-       TCL_CONFIG_PREFIX=/usr/lib/tcl$TCL_VERSION
-     fi
+	if test -x /usr/lib/tcl$TCL_VERSION/tclConfig.sh ; then
+	    TCL_CONFIG_PREFIX=/usr/lib/tcl$TCL_VERSION
+	fi
 
-   fi
+    fi
 
-   if test -f ${TCL_CONFIG_PREFIX}/tclConfig.sh  ; then . ${TCL_CONFIG_PREFIX}/tclConfig.sh ; fi
+    if test -f ${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
-         TK_CONFIG_PREFIX=${TCL_CONFIG_PREFIX}
-      else
-         if test -x `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 -d "${TK_CONFIG_PREFIX}"  ; then true ; else
+	if test -f ${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
+		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 -f ${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}
-   else
-      if test -d ${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION} ; then
-        TCL_LIBRARY=${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION}
-      fi
-   fi
+    if test -d ${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION} ; then
+	TCL_LIBRARY=${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION}
+    else
+	if test -d ${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION} ; then
+	    TCL_LIBRARY=${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION}
+	fi
+    fi
 
-   if test -d ${TK_CONFIG_PREFIX}/tk${TK_VERSION} ; then
-      TK_LIBRARY=${TK_CONFIG_PREFIX}/tk${TK_VERSION}
-   else
-      if test -d ${TK_CONFIG_PREFIX}/../tk${TK_VERSION} ; then
-        TK_LIBRARY=${TK_CONFIG_PREFIX}/../tk${TK_VERSION}
-      fi
-   fi
+    if test -d ${TK_CONFIG_PREFIX}/tk${TK_VERSION} ; then
+	TK_LIBRARY=${TK_CONFIG_PREFIX}/tk${TK_VERSION}
+    else
+	if test -d ${TK_CONFIG_PREFIX}/../tk${TK_VERSION} ; then
+	    TK_LIBRARY=${TK_CONFIG_PREFIX}/../tk${TK_VERSION}
+	fi
+    fi
 
-   if test -f ${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
-        TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
-      fi
-   fi
+    if test -f ${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
+	    TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
+	fi
+    fi
 
-   if test -f ${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
-        TK_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
-      fi
-   fi
+    if test -f ${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
+	    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
-      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
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llieee" >&5
+    TCL_VERSION_DOT_FREE=`echo ${TCL_VERSION} | tr -d .`
+    if test -f ${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
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llieee" >&5
 $as_echo_n "checking for main in -llieee... " >&6; }
 if ${ac_cv_lib_lieee_main+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -9197,14 +8785,11 @@ else
   have_ieee=0
 fi
 
-      if test "$have_ieee" = "0" ; then
-        TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-lieee::g" `
-      fi
-      if test "$have_dl" = "0" ; then
-        TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-ldl::g"`
-      fi
-      TCL_STUB_LIBS=""
-   fi
+	if test "$have_ieee" = "0" ; then
+	    TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-lieee::g" `
+	fi
+	TCL_STUB_LIBS=""
+    fi
 
 fi
 
@@ -9229,16 +8814,18 @@ fi
 
 
 if test -d "${TK_CONFIG_PREFIX}" ; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using TK_VERSION=${TK_VERSION} in ${TK_CONFIG_PREFIX}" >&5
-$as_echo "using TK_VERSION=${TK_VERSION} in ${TK_CONFIG_PREFIX}" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: using TK_VERSION=${TK_VERSION} of ${TK_CONFIG_PREFIX}" >&5
+$as_echo "using TK_VERSION=${TK_VERSION} of ${TK_CONFIG_PREFIX}" >&6; }
 else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
 fi
 
-NOTIFY=$enable_notify
-
+# Check whether --enable-notify was given.
+if test "${enable_notify+set}" = set; then :
+  enableval=$enable_notify; NOTIFY=$enable_notify
 
+fi
 
 
 
@@ -9477,42 +9064,17 @@ _ACEOF
 fi
 
 
-# alloca
-
-# dlopen etc
-# idea make it so you do something dlopen(libX.so,RTLD_GLOBAL)
-# then dlload("foo.o") a lisp file can refer to things in libX.so
-#
-
-# what machine this is, and include then a machine specific hdr.
-# and machine specific defs.
-
-# check bzero,
-
-# check getcwd, getwd etc..
-
 
+LDFLAGS="`echo $LDFLAGS | sed 's,gcl.script,../unixport/gcl.script,g'` $TLDFLAGS"
 
+LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS $TLIBS"
 
-# check socket stuff..
-
-# getrlimit
-
-# fionread or block
-
-# redhat/cygnus released for some reason a buggy version of gcc,
-# which no one else released.   Catch that here.
-
-LDFLAGS="`echo $LDFLAGS | sed 's,gcl.script,../unixport/gcl.script,g'`"
-
-LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TLDFLAGS $LIBS $TLIBS"
-
-FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS $TCFLAGS $PROCESSOR_FLAGS"
+FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS $TCFLAGS"
 
 # Work around bug with gcc on ppc -- CM
-NIFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TONIFLAGS $PROCESSOR_FLAGS -I\$(GCLDIR)/o"
+NIFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TONIFLAGS -I\$(GCLDIR)/o"
 
-CFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TO3FLAGS $PROCESSOR_FLAGS -I\$(GCLDIR)/o"
+CFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TO3FLAGS -I\$(GCLDIR)/o"
 
 O3FLAGS=$TO3FLAGS
 
@@ -9522,12 +9084,10 @@ O2FLAGS=$TO2FLAGS
 
 
 
-
-
 if test -f h/$use.defs  ; then
 
 
-  ac_config_files="$ac_config_files makedefc windows/gcl.iss windows/sysdir.bat windows/install.lsp"
+    ac_config_files="$ac_config_files makedefc windows/gcl.iss windows/sysdir.bat windows/install.lsp"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -10804,13 +10364,13 @@ if test -n "$ac_unrecognized_opts" && te
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-  echo makedefc
-  cat makedefc
+    echo makedefc
+    cat makedefc
 
-  echo    add-defs1 $use
-  CC=$CC ./add-defs1 $use
+    echo    add-defs1 $use
+    CC=$CC ./add-defs1 $use
 
 else
-  echo "Unable to guess machine type"
-  echo use configure --enable-machine=XXX,  for XXX such that h/XXX.defs exists, ie in h/*.defs
+    echo "Unable to guess machine type"
+    echo use configure --enable-machine=XXX,  for XXX such that h/XXX.defs exists, ie in h/*.defs
 fi
--- gcl-2.6.12.orig/configure.in
+++ gcl-2.6.12/configure.in
@@ -5,107 +5,6 @@ AC_CONFIG_HEADER(h/gclincl.h)
 VERSION=`cat majvers`.`cat minvers`
 AC_SUBST(VERSION)
 
-# some parts of this configure script are taken from the tcl configure.in
-
-#
-# Arguments
-#
-
-dnl help="--enable-maxpage=XXXX will compile in a page table of size XXX (default ${default_maxpage})"
-
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	    #include <stdio.h>
-dnl             #include <unistd.h>
-dnl 	    ]],[[
-dnl 	    FILE *fp=fopen("conftest1","w");
-dnl 	    fprintf(fp,"%u",262144*( SIZEOF_LONG >>2)/(1<<($PAGEWIDTH-12)));
-dnl 	    return 0;]])],[def_maxpage=`cat conftest1`],[def_maxpage=262144])
-
-dnl AC_ARG_ENABLE(maxpage,
-dnl [ --enable-maxpage=XXXX  will compile in a page table of size XXX
-dnl                          (eg '--enable-maxpage=64*1024' would produce
-dnl 			 64K pages allowing 256 MB if pages are 4K each)],
-dnl ,enable_maxpage=$def_maxpage)
-
-AC_ARG_ENABLE(widecons,[use a three word cons with simplified typing],[AC_DEFINE([WIDE_CONS],[1],[three word cons])])
-
-
-AC_ARG_ENABLE(safecdr,[protect cdr from immfix and speed up type processing],,[enable_safecdr="no"])
-if test "$enable_safecdr" = "yes" ; then
-   AC_DEFINE([USE_SAFE_CDR],[1],[protect cdr from immfix and speed up type processing])
-fi
-AC_ARG_ENABLE(safecdrdbg,[debug safecdr code],[AC_DEFINE([DEBUG_SAFE_CDR],[1],[debug safecdr code])])
-
-AC_ARG_ENABLE([prelink],[--enable-prelink will insist that the produced images may be prelinked],[PRELINK_CHECK=t],[PRELINK_CHECK=])
-
-AC_ARG_ENABLE([fastimmfix],[--enable-fastimmfix=XXXX will reject low immediate fixnums unless 1<<XXXX can be attained],
-,[enable_fastimmfix=64])
-
-
-AC_ARG_ENABLE(holepage,[ --enable-holepage=XXXX will compile in a XXX-sized hole between the heap and relocatable memory area (eg '--enable-holepage=64*1024' would give 64K pages allowing 256 MB if pages are 4K each)] ,
-[AC_DEFINE_UNQUOTED(HOLEPAGE,$enable_holepage,[number of pages to use for hole])])
-
-AC_ARG_ENABLE(vssize,[ --enable-vssize=XXXX will compile in a value stack of size XXX] ,
-,enable_vssize=262144)
-AC_DEFINE_UNQUOTED(VSSIZE,$enable_vssize,[value stack size])
-
-AC_ARG_ENABLE(bdssize,[ --enable-bdssize=XXXX will compile in a binding stack of size XXX] ,
-,enable_bdssize=2048)
-AC_DEFINE_UNQUOTED(BDSSIZE,$enable_bdssize,[binding stack size])
-
-AC_ARG_ENABLE(ihssize,[ --enable-ihssize=XXXX will compile in a invocation history stack of size XXX] ,
-,enable_ihssize=4096)
-AC_DEFINE_UNQUOTED(IHSSIZE,$enable_ihssize,[invocation history stack size])
-
-AC_ARG_ENABLE(frssize,[ --enable-frssize=XXXX will compile in a frame stack of size XXX] ,
-,enable_frssize=4096)
-AC_DEFINE_UNQUOTED(FRSSIZE,$enable_frssize,[frame stack size])
-
-AC_ARG_ENABLE(machine,[ --enable-machine=XXXX will force the use of one of the definitions in h/XXXX.defs] ,
-[enable_machine=$enableval],[enable_machine=""])
-
-AC_ARG_ENABLE(immfix,
-[ --enable-immfix        will enable an immediate fixnum table
-                         above the C stack],
-,enable_immfix=yes)
-
-#AC_ARG_ENABLE(gmp,[ --enable-gmp=no will disable use of GMP gnu multiprecision arithmetic, (default is =yes)] ,
-#[use_gmp=$enableval],[use_gmp="yes"])
-
-use_gmp="yes"
-
-AC_ARG_ENABLE(notify,[ --enable-notify=no will disable the automatic notification of gcl maintainers of successful builds/problems] ,
-[enable_notify=$enableval],[enable_notify="yes"])
-
-AC_ARG_ENABLE(tcltk,[ try to build gcl-tk ] ,
-[enable_tcltk=$enableval],[enable_tcltk="yes"])
-
-AC_ARG_ENABLE(tkconfig,[ --enable-tkconfig=XXXX will force the use of a TK_CONFIG_PREFIX=XXXXX as place to look for tkConfig.sh and tclConfig.sh ] ,
-[TK_CONFIG_PREFIX=$enableval],[TK_CONFIG_PREFIX="unknown"])
-
-
-AC_ARG_ENABLE(tclconfig,[ --enable-tclconfig=XXXX will force the use of a TCL_CONFIG_PREFIX=XXXXX as place to look for tclConfig.sh and tclConfig.sh ] ,
-[TCL_CONFIG_PREFIX=$enableval],[TCL_CONFIG_PREFIX="unknown"])
-
-AC_ARG_ENABLE(infodir,[ --enable-infodir=XXXX will force the use of a INFO_DIR=XXXXX as place to look for info ] ,
-[INFO_DIR=$enableval],[INFO_DIR=$prefix/share/info])
-INFO_DIR=`eval echo $INFO_DIR/`
-
-AC_ARG_ENABLE(emacsdir,[ --enable-emacsdir=XXXX will manually specify the location for elisp files ] ,
-[EMACS_SITE_LISP=$enableval],[EMACS_SITE_LISP=$prefix/share/emacs/site-lisp])
-EMACS_SITE_LISP=`eval echo $EMACS_SITE_LISP/`
-
-AC_ARG_ENABLE(common-binary,[ --enable-common-binary=yes forces use of lowest common denominator instruction sets, (default is =yes)] ,
-[use_common_binary=$enableval],[use_common_binary="yes"])
-
-AC_ARG_ENABLE(japi,[ --enable-japi=yes will compile in support for the JAPI graphical interface if present on your system],
-[try_japi=$enableval],[try_japi="no"])
-
-AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR],
-[enable_xdr=$enableval],[enable_xdr="yes"])
-
-AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for XGCL],
-[enable_xgcl=$enableval],[enable_xgcl="yes"])
 
 #
 # Host information 
@@ -119,341 +18,150 @@ my_host_system=`echo $host_os | awk '{j=
 AC_DEFINE_UNQUOTED(HOST_CPU,"`echo $host_cpu | awk '{print toupper($0)}'`",[Host cpu])
 AC_DEFINE_UNQUOTED(HOST_KERNEL,"`echo $my_host_kernel | awk '{print toupper($0)}'`",[Host kernel])
 if test "$my_host_system" != "" ; then 
-	AC_DEFINE_UNQUOTED(HOST_SYSTEM,"`echo $my_host_system | awk '{print toupper($0)}'`",[Host system])
+    AC_DEFINE_UNQUOTED(HOST_SYSTEM,"`echo $my_host_system | awk '{print toupper($0)}'`",[Host system])
 fi
 ## host=CPU-COMPANY-SYSTEM
 AC_MSG_RESULT(host=$host)
 
-PROCESSOR_FLAGS=${PROCESSOR_FLAGS:-""}
-
 use=unknown
-TLDFLAGS=""
 case $canonical in
-     older)
-     use=386-bsd;;
-
-     sh4*linux*)
-	use=sh4-linux;;
-
-     *x86_64*linux*)
-	use=amd64-linux;;
-
-     *x86_64*kfreebsd*)
-	use=amd64-kfreebsd;;
-
-     *86*linux*)
-	use=386-linux;;
-
-     *86*kfreebsd*)
-	use=386-kfreebsd;;
-
-     *86*gnu*)
-	use=386-gnu;;
-
-# m6800 not working with gcc-3.2
-     m68k*linux*)
-       if test "$use_common_binary" = "yes"; then
-         host=m68020-unknown-linux-gnu
-         echo "The host is canonicalised to $host"
-       fi
-     	use=m68k-linux;;
-
-     alpha*linux*)
-     	use=alpha-linux;;
-
-     mips*linux*)
-     	use=mips-linux;;
-
-     mipsel*linux*)
-     	use=mipsel-linux;;
-
-     sparc*linux*)
-     	use=sparc-linux;;
-
-     aarch64*linux*)
-        use=aarch64-linux;;
-
-     arm*linux*)
-     	use=arm-linux;;
-
-     s390*linux*)
-     	use=s390-linux;;
-
-     ia64*linux*)
-     	use=ia64-linux;;
-
-     hppa*linux*)
-     	use=hppa-linux;;
-
-     powerpc*linux*)
-     	use=powerpc-linux;;
-
-     powerpc-*-darwin*)
-     	use=powerpc-macosx;;
-     
-     *86*darwin*)
-     	use=386-macosx
-	if test "$build_cpu" = "x86_64" ; then 
-	   CFLAGS="-m64 $CFLAGS";
-	   LDFLAGS="-m64 -Wl,-headerpad,72 -Wl,-no_pie $LDFLAGS"; 
-	else 
-	   CFLAGS="-m32 $CFLAGS";
-	   LDFLAGS="-m32  -Wl,-headerpad,56 -Wl,-no_pie $LDFLAGS"; 
-        fi;;
-     
-     alpha-dec-osf)
-     use=alpha-osf1;;
-
-     mips-dec-ultrix)
-     use=dec3100;;
-
-     old)
-     use=dos-go32;;
-
-     *86*-freebsd*)
-     use=FreeBSD;;
-
-     hp3*-*hpux*)
-     use=hp300;;
-
-     hp3*-*-*bsd*)
-     use=hp300-bsd;;
-
-     hppa*-*hpux*)
-     use=hp800;;
-
-     mips-sgi-irix)
-       case $system in
-           IRIX5*)
-            use=irix5;;
-           IRIX6*)
-            use=irix6;;
-           IRIX3*)
-            use=sgi4d;;
-       esac ;;
- 
-
-     m68k-apple-aux*)
-     use=mac2;;
-
-     old)
-     use=mp386;;
-
-     *86-ncr-sysv4)
-     use=ncr;;
-
-     *[3-9]86-*netbsd*)
-     use=NetBSD;;
-
-     old)
-     use=NeXT;;
-
-     old)
-     use=NeXT30-m68k;;
-
-     *86-*nextstep*)
-     use=NeXT32-i386;;
-
-     *m68*-*nextstep*)
-     use=NeXT32-m68k;;
-
-     *rs6000-*-aix4*)
-     use=rios;;
-
-     *rs6000-*-aix3*)
-     use=rios-aix3;;
-
-     old)
-     use=rt_aix;;
-
-     old)
-     use=sgi;;
-
-     sparc-sun-solaris*)
-     use=solaris;;
-
-     i?86-pc-solaris*)
-     use=solaris-i386;;
-
-     old)
-     use=sun2r3;;
-
-     old)
-     use=sun3;;
-
-     m68*-sunos*)
-     use=sun3-os4;;
-
-     old)
-     use=sun386i;;
-
-     sparc*sunos*)
-     use=sun4;;
-
-     *86-sequent-dynix)
-     use=symmetry;;
-
-     u370*aix)
-     use=u370_aix;;
-
-     old)
-     use=vax;;
-
-     i*mingw*)
-       if test "$use_common_binary" = "yes"; then
-         host=i386-pc-mingw32
-	 PROCESSOR_FLAGS="-march=i386 "
-         echo "The host is canonicalised to $host"
-       fi
-     use=mingw;;
-
-     i*cygwin*)
-	if $CC -v 2>&1 | fgrep ming > /dev/null ;
-            then use=mingw
-          else  use=gnuwin95
+    sh4*linux*) use=sh4-linux;;
+    *x86_64*linux*) use=amd64-linux;;
+    *x86_64*kfreebsd*)	use=amd64-kfreebsd;;
+    *86*linux*) use=386-linux;;
+    *86*kfreebsd*) use=386-kfreebsd;;
+    *86*gnu*)	use=386-gnu;;
+    m68k*linux*) use=m68k-linux;;
+    alpha*linux*) use=alpha-linux;;
+    mips*linux*) use=mips-linux;;
+    mipsel*linux*) use=mipsel-linux;;
+    sparc*linux*) use=sparc-linux;;
+    aarch64*linux*) use=aarch64-linux;;
+    arm*linux*) use=arm-linux;;
+    s390*linux*) use=s390-linux;;
+    ia64*linux*) use=ia64-linux;;
+    hppa*linux*) use=hppa-linux;;
+    powerpc*linux*) use=powerpc-linux;;
+    powerpc-*-darwin*) use=powerpc-macosx;;
+    *86*darwin*) use=386-macosx;;
+    i*mingw*|i*msys*) use=mingw;;
+    i*cygwin*)
+        if $CC -v 2>&1 | fgrep ming > /dev/null ;
+        then use=mingw
+        else use=gnuwin95
         fi;;
-
-     *openbsd*)
-	# 'ld -Z' means disable W^X
-	TLDFLAGS="$TLDFLAGS -Z"
-	use=FreeBSD;;
-  
+    *openbsd*) use=FreeBSD;;
+    sparc-sun-solaris*) use=solaris;;
+    i?86-pc-solaris*) use=solaris-i386;;
 esac
 
-AC_SUBST(PROCESSOR_FLAGS)
+AC_ARG_ENABLE([machine],[  --enable-machine=XXXX will force the use of one of the definitions in h/XXXX.defs],
+	      [echo enable_machine=$enableval ; use=$enableval])
 
-echo enable_machine=$enable_machine
-if test "x$enable_machine" != "x" ; then
-  use=$enable_machine
-fi
+AC_MSG_RESULT([use=$use])	
 
 def_dlopen="no"
 def_statsysbfd="no"
 def_custreloc="yes"
-#def_statsysbfd="yes"
-#def_custreloc="no"
-def_locbfd="no"
 def_oldgmp="no"
 def_pic="no";
 def_static="no";
 def_debug="no";
 case $use in 
-     *kfreebsd)
+    *kfreebsd)
 	ln -snf linux.defs h/$use.defs;;
-     *gnu)
+    *gnu)
 	ln -snf linux.defs h/$use.defs;;
-     *linux)
+    *linux)
 	ln -snf linux.defs h/$use.defs;
 	case $use in
-# def_static -- Function descriptors are currently realized at runtime in a non-reproducible fashion
-# on these architectures -- CM			
-     	        powerpc*)
-#			if test "$host_cpu" = "powerpc64" ; then def_dlopen="yes" ; def_custreloc="no" ; fi
-			;;
-		ia64*)
-			def_dlopen="yes" ; def_custreloc="no" ;;
-		hppa*)
-			def_pic="yes" ;;
-#			def_dlopen="yes" ; def_custreloc="no" ; def_pic="yes" ;;
+	    ia64*)
+		def_dlopen="yes" ; def_custreloc="no" ;;
+	    hppa*)
+		def_pic="yes" ;;
 	esac;;
 esac
 
-AC_ARG_ENABLE(dlopen,
-	[ --enable-dlopen uses dlopen for loading objects, which can then not be retained  in saved images ]
-	,,enable_dlopen="$def_dlopen")
-AC_ARG_ENABLE(statsysbfd,
-	[ --enable-statsysbfd uses a static sytem bfd library for loading and relocationing object files ]
-	,,enable_statsysbfd="$def_statsysbfd")
-AC_ARG_ENABLE(dynsysbfd,
-	[ --enable-dynsysbfd uses a dynamic shared sytem bfd library for loading and relocationing object files ]
-	,,enable_dynsysbfd="no")
-#AC_ARG_ENABLE(locbfd,
-#	[ --enable-locbfd uses a static bfd library built from this source tree for loading and relocationing object files ]
-#	,,enable_locbfd="$def_locbfd")
-AC_ARG_ENABLE(custreloc,
-	[ --enable-custreloc uses custom gcl code if available for loading  and relocationing object files ]
-	,,enable_custreloc="$def_custreloc")
-AC_ARG_ENABLE(debug,
-	[ --enable-debug builds gcl with -g in CFLAGS to enable running under gdb ]
-	,,enable_debug="$def_debug")
-AC_ARG_ENABLE(gprof,
-	[ --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof ]
-	,,enable_gprof="no")
-AC_ARG_ENABLE(static,[ --enable-static will link your GCL against static as opposed to shared system libraries ] ,
-        [enable_static=$enableval],[enable_static="$def_static"])
-AC_ARG_ENABLE(pic,
-	[ --enable-pic builds gcl with -fPIC in CFLAGS ]
-	,,enable_pic="$def_pic")
-
-AC_ARG_ENABLE(oldgmp,
-	[ --enable-oldgmp will link against gmp2 instead of gmp3 ]
-	,,enable_oldgmp="$def_oldgmp")
-
-AC_ARG_ENABLE(dynsysgmp,
-	[ --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source ]
-	,,enable_dynsysgmp="yes")
+AC_ARG_ENABLE([widecons],[  --enable-widecons will use a three word cons with simplified typing],
+	      [if test "$enableval" = "yes" ; then AC_DEFINE([WIDE_CONS],[1],[three word cons]) fi])
+
+AC_ARG_ENABLE([safecdr],[  --enable-safecdr will protect cdr from immfix and speed up type processing],
+	      [if test "$enableval" = "yes" ; then
+		   AC_DEFINE([USE_SAFE_CDR],[1],[protect cdr from immfix and speed up type processing])
+		   AC_ARG_ENABLE([safecdrdbg],[  --enable-safecdrdbg will debug safecdr code],
+				 [if test "$enableval" = "yes" ; then AC_DEFINE([DEBUG_SAFE_CDR],[1],[debug safecdr code]) fi])
+	       fi])
+
+AC_ARG_ENABLE([prelink],[  --enable-prelink will insist that the produced images may be prelinked],
+	      [if test "$enable_prelink" = "yes" ; then PRELINK_CHECK=t; fi])
+AC_SUBST(PRELINK_CHECK)
+
+AC_ARG_ENABLE([vssize],[  --enable-vssize=XXXX will compile in a value stack of size XXX],
+	      [AC_DEFINE_UNQUOTED(VSSIZE,$enableval,[value stack size])])
+AC_ARG_ENABLE([bdssize],[  --enable-bdssize=XXXX will compile in a binding stack of size XXX],
+	      [AC_DEFINE_UNQUOTED(BDSSIZE,$enableval,[binding stack size])])
+AC_ARG_ENABLE([ihssize],[  --enable-ihssize=XXXX will compile in a invocation history stack of size XXX],
+	      [AC_DEFINE_UNQUOTED(IHSSIZE,$enableval,[invocation history stack size])])
+AC_ARG_ENABLE([frssize],[  --enable-frssize=XXXX will compile in a frame stack of size XXX],
+	      [AC_DEFINE_UNQUOTED(FRSSIZE,$enableval,[frame stack size])])
+
+AC_ARG_ENABLE([infodir],[  --enable-infodir=XXXX will force the use of a INFO_DIR=XXXXX as place to look for info],
+	      [INFO_DIR=$enableval],[INFO_DIR=$prefix/share/info])
+INFO_DIR=`eval echo $INFO_DIR/`
+
+AC_ARG_ENABLE([emacsdir],[  --enable-emacsdir=XXXX will manually specify the location for elisp files],
+	      [EMACS_SITE_LISP=$enableval],[EMACS_SITE_LISP=$prefix/share/emacs/site-lisp])
+EMACS_SITE_LISP=`eval echo $EMACS_SITE_LISP/`
+
+AC_ARG_ENABLE([xgcl],[  --enable-xgcl=yes will compile in support for XGCL],,[enable_xgcl=yes])
 
-load_opt="0"
+AC_ARG_ENABLE([dlopen],[  --enable-dlopen uses dlopen for loading objects, which can then not be retained  in saved images],
+	      ,[enable_dlopen=$def_dlopen])
+AC_ARG_ENABLE([statsysbfd],[  --enable-statsysbfd uses a static sytem bfd library for loading and relocationing object files],
+	      ,[enable_statsysbfd=$def_statsysbfd])
+AC_ARG_ENABLE([dynsysbfd],[  --enable-dynsysbfd uses a dynamic shared sytem bfd library for loading and relocationing object files],
+	      ,[enable_dynsysbfd=no])
+AC_ARG_ENABLE([custreloc],[  --enable-custreloc uses custom gcl code if available for loading  and relocationing object files],
+	      ,[enable_custreloc=$def_custreloc])
+
+AC_ARG_ENABLE([debug],[  --enable-debug builds gcl with -g in CFLAGS to enable running under gdb],
+	      ,[enable_debug=$def_debug])
+AC_ARG_ENABLE([static],[  --enable-static will link your GCL against static as opposed to shared system libraries],
+	      ,[enable_static=$def_static])
+AC_ARG_ENABLE([pic],[  --enable-pic builds gcl with -fPIC in CFLAGS],,[enable_pic=$def_pic])
+
+load_opt=0
 if test "$enable_dlopen" = "yes" ; then
-   load_opt=1
+    load_opt=1
 fi
 if test "$enable_statsysbfd" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   esac
+    case $load_opt in
+	0) load_opt=1;;
+	1) load_opt=2;;
+    esac
 fi
 if test "$enable_dynsysbfd" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   2) load_opt=3;;
-   esac
-fi
-if test "$enable_locbfd" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   2) load_opt=3;;
-   3) load_opt=4;;
-   esac
+    case $load_opt in
+	0) load_opt=1;;
+	1) load_opt=2;;
+	2) load_opt=3;;
+    esac
 fi
 if test "$enable_custreloc" = "yes" ; then
-   case $load_opt in
-   0) load_opt=1;;
-   1) load_opt=2;;
-   2) load_opt=3;;
-   3) load_opt=4;;
-   4) load_opt=5;;
-   esac
+    case $load_opt in
+	0) load_opt=1;;
+	1) load_opt=2;;
+	2) load_opt=3;;
+	3) load_opt=4;;
+	4) load_opt=5;;
+    esac
 fi
 
 if test "$load_opt" != "1" ; then
-	echo "Exactly one loader option must be chosen: dlopen=$enable_dlopen statsysbfd=$enable_statsysbfd dynsysbfd=$enable_dynsysbfd locbfd=$enable_locbfd custreloc=$enable_custreloc"
-	exit 1
+    echo "Exactly one loader option must be chosen: dlopen=$enable_dlopen statsysbfd=$enable_statsysbfd dynsysbfd=$enable_dynsysbfd custreloc=$enable_custreloc"
+    AC_MSG_ERROR([loader option failure])
 fi
 
-TLDFLAGS=""
-if test "$enable_static" = "yes" ; then
-   TLDFLAGS="-static -Wl,-zmuldefs $TLDFLAGS"; #FIXME should be in unixport/makefile
-   AC_DEFINE(STATIC_LINKING,1,[staticly linked images])
-fi
-case $use in
-     *gnuwin*)
-	TLDFLAGS="$TLDFLAGS -Wl,--stack,8000000";;
-esac
-
-## finally warn if we did not find a recognized machine.s
-##
-#if test "$use" = "unknown" ; then
-#types=`echo h/*.defs` | sed -e "s:h/::g" -e "s:\.defs:g"`
-#echo got canonical=$canonical, but was not recognized. 
-#echo Unable to guess type to use.  Try one of 
-#exit(1)
-#fi
-
-AC_MSG_RESULT([use=$use])	
-
 
 #
 # System programs
@@ -462,221 +170,250 @@ AC_MSG_RESULT([use=$use])
 # We set the default CFLAGS below, and don't want the autoconf default
 # CM 20040106
 if test "$CFLAGS" = "" ; then
-	CFLAGS=" "
+    CFLAGS=" "
 fi
 if test "$LDFLAGS" = "" ; then
-	LDFLAGS=" "
+    LDFLAGS=" "
 fi
 
 AC_PROG_CC
 AC_PROG_CPP
 AC_SUBST(CC)
+GCL_CC=`basename $CC`
+if echo $GCL_CC |grep gcc |grep -q win; then
+    GCL_CC=gcc
+fi
+AC_SUBST(GCL_CC)
 
+add_arg_to_tcflags() {
+    
+    local i=1
+    AC_MSG_CHECKING([for CFLAG $1])
+    CFLAGS_ORI=$CFLAGS
+    CFLAGS="$CFLAGS -Werror $1 `echo $1|sed 's,-Wno-,-W,1'`"
+    AC_RUN_IFELSE(
+	[AC_LANG_PROGRAM([[]],[[]])],
+	[TCFLAGS="$TCFLAGS $1";AC_MSG_RESULT([yes]);i=0],
+	[AC_MSG_RESULT([no])],
+	[AC_MSG_RESULT([no])])
+    CFLAGS=$CFLAGS_ORI
+    return $i
+    
+}
 
-# can only test for numbers -- CM
-# if test "${GCC}" -eq "yes" ; then
-#if [[ "${GCC}" = "yes" ]] ; then
-# Allog for environment variable overrides on compiler selection -- CM
-#GCC=$CC
-#else
-#GCC=""
-#fi
-# subst GCC not only under 386-linux, but where available -- CM
-
-TCFLAGS="-fsigned-char -fno-builtin-malloc -fno-builtin-free"
-
-if test "$GCC" = "yes" ; then
-
-   TCFLAGS="$TCFLAGS -Wall"
-
-   AC_MSG_CHECKING([for clang])
-   AC_RUN_IFELSE([
-   	AC_LANG_SOURCE([[
-		int main() {
-		return
-		#ifdef __clang__
-		0
-		#else
-		1
-		#endif
-		;}]])],
-	[AC_MSG_RESULT([yes])
-	 clang="yes"
-	 TCFLAGS="$TCFLAGS -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign"
-	 AC_DEFINE([CLANG],[1],[running clang compiler])],	
-	[AC_MSG_RESULT([no])
-	 #FIXME -Wno-unused-but-set-variable when time
-	 TMPF=-Wno-unused-but-set-variable
-	 AC_MSG_CHECKING([for CFLAG $TMPF])
-	 CFLAGS_ORI=$CFLAGS
-	 CFLAGS="$CFLAGS $TMPF"
-	 AC_TRY_RUN([int main() {return 0;}],TCFLAGS="$TCFLAGS $TMPF";AC_MSG_RESULT(yes),AC_MSG_RESULT(no),AC_MSG_RESULT(no))
-	 CFLAGS=$CFLAGS_ORI])
-fi
+assert_arg_to_tcflags() {
+    if ! add_arg_to_tcflags $1 ; then AC_MSG_RESULT([cannot add $1 to CFLAGS]); exit 1 ; fi
+    return 0
+}
 
-if test "$GCC" = "yes" ; then
-	TCFLAGS="$TCFLAGS -pipe"
-	case $use in
-	     *mingw*)
-#	        echo "WARNING: Remove -fno-zero-initialized-in-bss from makedefs if gcc less than 3.3.1."
-#	        echo "         It is otherwise needed for the Unexec stuff to work."
-#		if test "$enable_debug" = "yes" ; then TCFLAGS="$TCFLAGS -gstabs" ; fi
-		TCFLAGS="$TCFLAGS -fno-zero-initialized-in-bss -mms-bitfields";;
-	     *gnuwin*)
-#	        echo "WARNING: Remove -fno-zero-initialized-in-bss from makedefs if gcc less than 3.3.1."
-#	        echo "         It is otherwise needed for the Unexec stuff to work."
-#		if test "$enable_debug" = "yes" ; then TCFLAGS="$TCFLAGS -gstabs" ; fi
-		TCFLAGS="$TCFLAGS -fno-zero-initialized-in-bss -mms-bitfields";;
-        esac
-fi
-#if test -f /proc/sys/kernel/exec-shield ; then
-#	exec_stat=`cat /proc/sys/kernel/exec-shield`
-#	if test "$exec_stat" != "0" ; then
-#		# CFLAGS here to hopefully cover the DBEGIN routine below
-#		CFLAGS="$CFLAGS -Wa,--execstack"
-#	fi
-#fi
+add_args_to_tcflags() {
+    
+    while test "$#" -ge 1 ; do
+  	add_arg_to_tcflags $1
+	shift
+    done
+}
+
+add_arg_to_tldflags() {
+    
+    local i=1
+    AC_MSG_CHECKING([for LDFLAG $1])
+    LDFLAGS_ORI=$LDFLAGS
+    LDFLAGS="$LDFLAGS -Werror $1"
+    AC_RUN_IFELSE(
+	[AC_LANG_PROGRAM([[]],[[]])],
+	[TLDFLAGS="$TLDFLAGS $1";AC_MSG_RESULT([yes]);i=0],
+	[AC_MSG_RESULT([no])],
+	[AC_MSG_RESULT([no])])
+    LDFLAGS=$LDFLAGS_ORI
+    return $i
+    
+}
+
+assert_arg_to_tldflags() {
+    if ! add_arg_to_tldflags $1 ; then AC_MSG_RESULT([cannot add $1 to LDFLAGS]); exit 1 ; fi
+    return 0
+}
+
+add_args_to_tldflags() {
+    
+    while test "$#" -ge 1 ; do
+  	add_arg_to_tldflags $1
+	shift
+    done
+}
+
+remove_arg_from_ldflags() {
+    
+    NEW_LDFLAGS=""	  
+    for i in $LDFLAGS; do
+	if ! test "$i" = "$1" ; then
+      	    NEW_LDFLAGS="$NEW_LDFLAGS $i"
+	else
+            AC_MSG_RESULT([removing $1 from LDFLAGS])
+	fi
+    done
+    LDFLAGS=$NEW_LDFLAGS
+    
+    return 0
+    
+}
+
+TCFLAGS=""
+add_args_to_tcflags -fsigned-char -pipe \
+                    -fno-builtin-malloc -fno-builtin-free \
+                    -fno-PIE -fno-pie -fno-PIC -fno-pic \
+	            -Wall \
+	            -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign \
+	            -Wno-unused-but-set-variable -Wno-misleading-indentation
+
+TLDFLAGS=""
+add_args_to_tldflags -Wl,-no_pie -no-pie -Wl,-z,lazy
+
+AC_MSG_CHECKING([for clang])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM([[
+			 #ifdef __clang__
+			 #define RET 0
+			 #else
+			 #define RET 1
+			 #endif
+		     ]],
+		     [[
+			 return RET;
+		     ]])],
+    [AC_MSG_RESULT([yes])
+     clang="yes"
+     remove_arg_from_ldflags -pie
+     AC_DEFINE([CLANG],[1],[running clang compiler])],	
+    [AC_MSG_RESULT([no])])
+
+case $use in
+    *mingw*)
+	assert_arg_to_tcflags -fno-zero-initialized-in-bss
+	assert_arg_to_tcflags -mms-bitfields;;
+    *gnuwin*)
+	assert_arg_to_tcflags -fno-zero-initialized-in-bss
+	assert_arg_to_tcflags -mms-bitfields
+        assert_arg_to_tldflags -Wl,--stack,8000000;;
+    386-macosx)
+	assert_arg_to_tldflags -Wl,-no_pie
+	if test "$build_cpu" = "x86_64" ; then
+	    assert_arg_to_tcflags -m64
+	    assert_arg_to_tldflags -m64
+	    assert_arg_to_tldflags -Wl,-headerpad,72
+        else
+	    assert_arg_to_tcflags -m32
+	    assert_arg_to_tldflags -m32
+	    assert_arg_to_tldflags -Wl,-headerpad,56
+        fi;;
+    FreeBSD) assert_arg_to_tldflags -Z;;
+esac
+
+if test "$enable_static" = "yes" ; then
+    assert_arg_to_tldflags -static
+    assert_arg_to_tldflags -Wl,-zmuldefs
+    AC_DEFINE(STATIC_LINKING,1,[staticly linked images])
+fi
 
 TO3FLAGS=""
 TO2FLAGS=""
 
-#TFPFLAG="-fomit-frame-pointer"
-# FIXME -- remove when mingw compiler issues are fixed
 case "$use" in
-  *mingw*)
+    *mingw*)
   	TFPFLAG="";;
-  m68k*)#FIXME gcc 4.x bug workaround
+    m68k*)#FIXME gcc 4.x bug workaround
 	TFPFLAG="";;
-  *)
+    *)
 	TFPFLAG="-fomit-frame-pointer";;
 esac
 
 AC_CHECK_PROGS(AWK,[gawk nawk awk])
 
-# Work around system/gprof mips/hppa hang
-AC_MSG_CHECKING([working gprof])
-old_enable_gprof=$enable_gprof
-case $use in
-  powerpc*) if test "$host_cpu" = "powerpc64le" ; then enable_gprof="no"; fi;;
-  sh4*)  enable_gprof="no";;
-  ia64*)  enable_gprof="no";;
-#  mips*) enable_gprof="no";;
-  hppa*) enable_gprof="no";;
-  arm*)  enable_gprof="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
-  *gnu)  enable_gprof="no";;
-esac		     
-if test "$enable_gprof" = "$old_enable_gprof" ; then
-   AC_MSG_RESULT([ok])
-else
-   AC_MSG_RESULT([disabled])
-fi
-
-if test "$enable_gprof" = "yes" ; then
-	AC_MSG_CHECKING(for text start)
-	echo 'int main () {return(0);}' >foo.c
-	$CC foo.c -o foo
-	GCL_GPROF_START=`nm foo | $AWK  '/  *[[TD]]  *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
-	rm -f foo.c foo
-	if test "$GCL_GPROF_START" != "" ; then
-		AC_MSG_RESULT($GCL_GPROF_START)
-		AC_DEFINE_UNQUOTED(GCL_GPROF_START,$GCL_GPROF_START,[starting address for gprof])
-		case "$use" in	
-		   arm*)	
-	             #FIXME report and remove this when done
-	             AC_MSG_RESULT(Reducing optimization on profiling arm build to workaround gcc bug)
-		     enable_debug=yes;;
-		esac
-                TCFLAGS="$TCFLAGS -pg";
-		case $use in
-		s390*) ;; # relocation truncation bug in gcc
-		*) TLIBS="$TLIBS -pg";;
-		esac
-        	TFPFLAG=""
- 		AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
-	else			   
-                enable_gprof="no";
-	fi			   
-fi
-
-if $CC -v 2>&1 | tail -1 | grep "gcc version 4.6.1" >/dev/null ; then
-   case "$use" in	
-     arm*)	
-     #FIXME report and remove this when done
-	AC_MSG_RESULT(Reducing optimization on arm build to workaround gcc 4.6 bug)
-	enable_debug=yes;;
-   esac
-fi
-
+AC_ARG_ENABLE([gprof],[  --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof],
+	      [if test "$enableval" = "yes" ; then
+		   AC_MSG_CHECKING([working gprof])
+		   case $use in
+		       powerpc*) if test "$host_cpu" = "powerpc64le" ; then enableval="no"; fi;;
+		       sh4*)  enableval="no";;
+		       ia64*) enableval="no";;
+		       hppa*) enableval="no";;
+		       arm*)  enableval="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
+		       *gnu)  enableval="no";;
+		   esac		     
+		   if test "$enableval" != "yes" ; then
+		       AC_MSG_RESULT([disabled])
+		   else
+		       AC_MSG_RESULT([ok])
+		       AC_MSG_CHECKING([for text start])
+		       echo 'int main () {return(0);}' >foo.c
+		       $CC foo.c -o foo
+		       GCL_GPROF_START=`nm foo | $AWK  '/  *[[TD]]  *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
+		       rm -f foo.c foo
+		       if test "$GCL_GPROF_START" != "" ; then
+			   AC_MSG_RESULT($GCL_GPROF_START)
+			   AC_DEFINE_UNQUOTED(GCL_GPROF_START,$GCL_GPROF_START,[starting address for gprof])
+			   assert_arg_to_tcflags -pg
+			   case $use in
+			       s390*) ;; # relocation truncation bug in gcc
+			       *) TLIBS="$TLIBS -pg";;
+			   esac
+       			   TFPFLAG=""
+			   AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
+		       fi			   
+		   fi
+	       fi])
 
 if test "$enable_debug" = "yes" ; then
-	TCFLAGS="$TCFLAGS -g"
-	# for subconfigurations
-	CFLAGS="$CFLAGS -g"
+    assert_arg_to_tcflags -g
+    # for subconfigurations
+    CFLAGS="$CFLAGS -g"
 else
-	TO3FLAGS="-O3 $TFPFLAG"
-	TO2FLAGS="-O"
+    TO3FLAGS="-O3 $TFPFLAG"
+    TO2FLAGS="-O"
 fi
 
 # gcc on ppc cannot compile our new_init.c with full opts --CM
 TONIFLAGS=""
 case $use in 
-     powerpc*macosx)
-	   TCFLAGS="$TCFLAGS -mlongcall";;
-     *linux)
+    powerpc*macosx) assert_arg_to_tcflags -mlongcall;;
+    *linux)
 	case $use in
-#		amd64*) # stack-boundary option does not work
-#			TCFLAGS="$TCFLAGS -m64 -mpreferred-stack-boundary=8";;  
-		alpha*)
-			TCFLAGS="$TCFLAGS -mieee"
-			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.8.1
-			;;
-#		m68k*)
-#			TCFLAGS="$TCFLAGS -ffloat-store";;
-		aarch64*)
-			TLIBS="$TLIBS -lgcc_s";;
-		hppa*)
-			TCFLAGS="$TCFLAGS -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
-#			TCFLAGS="$TCFLAGS -ffunction-sections"
-#			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O $TFPFLAG" ; fi
-#			if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
-			;;
-		mips*)
-			case $canonical in
-			mips64*linux*)
-				TLIBS="$TLIBS -Wl,-z -Wl,now";;
-			esac
-#			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.6.2
-			;;
-		ia64*)
-			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
-			;;
-		arm*)
-			TCFLAGS="$TCFLAGS -mlong-calls -fdollars-in-identifiers -g "
-#			if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.6.2
-#			if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
-			;;
-		powerpc*) 
-                        TCFLAGS="$TCFLAGS -mlongcall"
-			;;
-#			if $CC -v 2>&1 | grep -q "gcc version 3.2" ; then
-#			   echo Reducing optimization for buggy gcc-3.2
-#			   if test "$enable_debug" != "yes" ; then TONIFLAGS="-O $TFPFLAG" ; fi
-#			fi;
-#			echo Probing for longcall
-#			if ! $CC -v 2>&1 | $AWK '/^gcc version / {split($3,A,".");if (A[[1]]+0>3 || (A[[1]]+0>=3 && A[[2]]+0>=3)) exit 1;}'; then
-#			   echo Enabling longcall on gcc 3.3 or later
-#			   TCFLAGS="$TCFLAGS -mlongcall"
-#			   echo Reducing optimization for buggy gcc 3.3 or later
-#			   if test "$enable_debug" != "yes" ; then TONIFLAGS="-O $TFPFLAG" ; fi
-#			fi;;
+	    alpha*)
+		assert_arg_to_tcflags -mieee
+		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.8.1
+		;;
+	    aarch64*)
+		TLIBS="$TLIBS -lgcc_s";;
+	    hppa*)
+		assert_arg_to_tcflags -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
+		;;
+	    mips*)
+		case $canonical in
+		    mips64*linux*)
+			assert_arg_to_tldflags -Wl,-z,now;;
+		esac
+		;;
+	    ia64*)
+		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
+		;;
+	    arm*)
+		assert_arg_to_tcflags -mlong-calls
+		assert_arg_to_tcflags -fdollars-in-identifiers
+		assert_arg_to_tcflags -g #?
+		;;
+	    powerpc*) 
+		assert_arg_to_tcflags -mlongcall
+		;;
 	esac;;
 esac
 if test "$enable_pic" = "yes" ; then
-	TCFLAGS="$TCFLAGS -fPIC"
+    assert_arg_to_tcflags -fPIC
 fi
 
+
 FDEBUG=`echo $CFLAGS | tr ' ' '\012' |grep "^\-g$"|tr '\012' ' '`
 #CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-g$"`
 FOMITF=`echo $CFLAGS | tr ' ' '\012' |grep "^\-fomit-frame-pointer$"|tr '\012' ' '`
@@ -693,27 +430,27 @@ FOOPT0=`echo $CFLAGS | tr ' ' '\012' |gr
 CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-O0$"|tr '\012' ' '`
 
 if test "$FOOPT0" != "" ; then
-   TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[[123 ]],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
-   TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[[123 ]],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
-else 
-if test "$FOOPT1" != "" ; then
-   TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[[2-3]],-O1,g'`
-   TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[[2-3]],-O1,g'`
+    TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[[123 ]],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
+    TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[[123 ]],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
 else 
-if test "$FOOPT2" != "" ; then
-   TO3FLAGS=`echo "$TO3FLAGS" | sed 's,\-O3,-O2,g'`
-   TO2FLAGS=`echo "$TO2FLAGS" | sed 's,\-O3,-O2,g'`
-fi
-fi
+    if test "$FOOPT1" != "" ; then
+	TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[[2-3]],-O1,g'`
+	TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[[2-3]],-O1,g'`
+    else 
+	if test "$FOOPT2" != "" ; then
+	    TO3FLAGS=`echo "$TO3FLAGS" | sed 's,\-O3,-O2,g'`
+	    TO2FLAGS=`echo "$TO2FLAGS" | sed 's,\-O3,-O2,g'`
+	fi
+    fi
 fi
 
 if test "$FDEBUG" != "" ; then
-   TO3FLAGS=`echo $TO3FLAGS | sed 's,\-fomit-frame-pointer,,g'`
-   TO2FLAGS=`echo $TO2FLAGS | sed 's,\-fomit-frame-pointer,,g'`
+    TO3FLAGS=`echo $TO3FLAGS | sed 's,\-fomit-frame-pointer,,g'`
+    TO2FLAGS=`echo $TO2FLAGS | sed 's,\-fomit-frame-pointer,,g'`
 fi
 
 if test "$FOMITF" != "" ; then
-   TO3FLAGS="$TO3FLAGS $FOMITF"
+    TO3FLAGS="$TO3FLAGS $FOMITF"
 fi
 
 # Step 1: set the variable "system" to hold the name and version number
@@ -731,12 +468,12 @@ if test -f /usr/lib/NextStep/software_ve
 else
     system=`uname -s`-`uname -r`
     if test "$?" -ne 0 ; then
-	AC_MSG_RESULT([unknown (can't find uname command)])
+	AC_MSG_RESULT([unknown (cannot find uname command)])
 	system=unknown
     else
 	# Special check for weird MP-RAS system (uname returns weird
 	# results, and the version is kept in special file).
-    
+	
 	if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
 	    system="MP-RAS-`${AWK} '{print $3}' '/etc/.relid'`"
 	fi
@@ -748,156 +485,130 @@ else
 fi
 
 case $use in
-     *macosx)
+    *macosx)
         AC_CHECK_HEADERS(malloc/malloc.h,,[AC_MSG_ERROR([need malloc.h on macosx])])
 	AC_CHECK_MEMBER([struct _malloc_zone_t.memalign],
- 		AC_DEFINE(HAVE_MALLOC_ZONE_MEMALIGN,1,[memalign element present]), [], 
-		[
-		#include <malloc/malloc.h>
-		])
+ 			AC_DEFINE(HAVE_MALLOC_ZONE_MEMALIGN,1,[memalign element present]), [], 
+			[
+			    #include <malloc/malloc.h>
+			])
 	AC_SUBST(HAVE_MALLOC_ZONE_MEMALIGN)
 	;;
 esac
 
-
-AC_CHECK_HEADERS(setjmp.h,
-	AC_MSG_CHECKING([sizeof jmp_buf])
-	AC_RUN_IFELSE([
-		AC_LANG_SOURCE([[
-			#include <stdio.h>
-			#include <setjmp.h>
-			int main() {
-			   FILE *fp=fopen("conftest1","w");
-			   fprintf(fp,"%lu\n",sizeof(jmp_buf));
-			   fclose(fp);
-			   return 0;
-			}]])],
-			[sizeof_jmp_buf=`cat conftest1`
-			 AC_MSG_RESULT($sizeof_jmp_buf)
-			 AC_DEFINE_UNQUOTED(SIZEOF_JMP_BUF,$sizeof_jmp_buf,[sizeof jmp_buf])],
-			 [AC_MSG_RESULT(no)]))
+AC_CHECK_HEADERS(
+    [setjmp.h],
+    [AC_MSG_CHECKING([sizeof jmp_buf])
+     AC_RUN_IFELSE(
+	 [AC_LANG_PROGRAM(
+		 [[
+		     #include <stdio.h>
+		     #include <setjmp.h>
+		 ]],
+		 [[
+		     FILE *fp=fopen("conftest1","w");
+		     fprintf(fp,"%lu\n",sizeof(jmp_buf));
+		     fclose(fp);
+		 ]])],
+	 [sizeof_jmp_buf=`cat conftest1`
+	  AC_MSG_RESULT($sizeof_jmp_buf)
+	  AC_DEFINE_UNQUOTED(SIZEOF_JMP_BUF,$sizeof_jmp_buf,[sizeof jmp_buf])],
+	 [AC_MSG_RESULT([no])])])
 
 # sysconf
+AC_CHECK_HEADERS(
+    [unistd.h],
+    [AC_CHECK_LIB(
+	    [c],[sysconf],
+	    [AC_MSG_CHECKING([_SC_CLK_TCK])
+	     hz=0
+	     AC_RUN_IFELSE(
+		 [AC_LANG_PROGRAM(
+			 [[
+			     #include <unistd.h>
+			     #include <stdio.h>
+			 ]],
+			 [[
+			     FILE *fp=fopen("conftest1","w");
+			     fprintf(fp,"%lu\n",sysconf(_SC_CLK_TCK));
+			     fclose(fp);
+			 ]],
+			 [hz=`cat conftest1`
+			  AC_DEFINE_UNQUOTED(HZ,$hz,[time system constant])])])
+	     AC_MSG_RESULT($hz)])])
 
-AC_CHECK_HEADERS(unistd.h,
-	AC_CHECK_LIB(c,sysconf,
-		AC_MSG_CHECKING(_SC_CLK_TCK)
-		AC_TRY_RUN([#include <unistd.h>
-		            #include <stdio.h>
-		            int
-			    main() {
-			   	FILE *fp=fopen("conftest1","w");
-				fprintf(fp,"%lu\n",sysconf(_SC_CLK_TCK));
-				fclose(fp);
-			        return 0;
-			    }],
-			    hz=`cat conftest1`
-			    AC_DEFINE_UNQUOTED(HZ,$hz,[time system constant])
-			    ,hz=0,hz=0)
-	        [AC_MSG_RESULT($hz)]
-		dnl AC_MSG_CHECKING(_SC_PHYS_PAGES)
-		dnl AC_RUN_IFELSE([
-		dnl 	AC_LANG_SOURCE([[
-		dnl 	#include <stdio.h>
-		dnl 	#include <unistd.h>
-		dnl 	int main() {
-		dnl 	   FILE *fp=fopen("conftest1","w");
-		dnl 	   fprintf(fp,"%lu\n",sysconf(_SC_PHYS_PAGES));
-		dnl 	   fclose(fp);
-		dnl 	   return 0;
-		dnl 	}]])],
-		dnl 	[phys=`cat conftest1`
-		dnl 	 AC_MSG_RESULT($phys)
-		dnl 	 AC_DEFINE(HAVE_SYSCONF_PHYS_PAGES,$phys,[probe runtime phys pages for gc performance])],
-		dnl 	 [AC_MSG_RESULT(no)])
-			 ))
-
-
-#MY_SUBDIRS=
-
-#
-# GMP
-#
 
 rm -f makedefsafter
 
-MP_INCLUDE=""
-if test $use_gmp = yes ; then
+AC_ARG_ENABLE([dynsysgmp],
+	      [  --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source])
 
- PATCHED_SYMBOLS=""
- if test "$enable_dynsysgmp" = "yes" ; then
-	AC_CHECK_HEADERS(gmp.h,
-		AC_CHECK_LIB(gmp,__gmpz_init,
-			AC_MSG_CHECKING("for external gmp version")
-			AC_TRY_RUN([#include <gmp.h>
-				    int main() {
-				    #if __GNU_MP_VERSION > 3
-					return 0;
-				    #else
-					return -1;
-				    #endif
-				    }],
-#				MPFILES=$GMPDIR/mpn/mul_n.o
-#				PATCHED_SYMBOLS=__gmpn_toom3_mul_n
-				MPFILES=
-				PATCHED_SYMBOLS=
-#				if test "$use" = "m68k-linux" ; then
-#					MPFILES="$MPFILES $GMPDIR/mpn/lshift.o $GMPDIR/mpn/rshift.o"
-#					PATCHED_SYMBOLS="$PATCHED_SYMBOLS __gmpn_lshift __gmpn_rshift"
-#				fi
-				TLIBS="$TLIBS -lgmp"
-				echo "#include \"gmp.h\"" >foo.c
-				echo "int main() {return 0;}" >>foo.c
-				MP_INCLUDE=`cpp foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
-				rm -f foo.c,
-				echo "Cannot use dynamic gmp lib" , echo "Cannot use dynamic gmp lib" ),
-			echo "Cannot use dynamic gmp lib" ,),
-		echo "Cannot use dynamic gmp lib" ,)
-fi
-
-NEED_LOCAL_GMP=''
-if test "$MP_INCLUDE" = "" ; then			
-	NEED_LOCAL_GMP=1;
-fi
-if test "$PATCHED_SYMBOLS" != "" ; then			
-	NEED_LOCAL_GMP=1;
+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=`cpp 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
 
-if test "$NEED_LOCAL_GMP" != "" ; then			
-
-   	 GMPDIR=gmp4
-	 AC_MSG_CHECKING([use_gmp=yes, 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 && 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
 
+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
 fi
 
-AC_MSG_CHECKING("for leading underscore in object symbols")
+AC_MSG_CHECKING([for leading underscore in object symbols])
 cat>foo.c <<EOFF
 #include <math.h>
 #include <stdio.h>
@@ -905,12 +616,12 @@ int main() {FILE *f;double d=0.0;getc(f)
 EOFF
 $CC -c foo.c -o foo.o
 if nm foo.o |grep " U " | grep "_cos" >/dev/null || nm foo.o |grep " U " | grep " _getc" >/dev/null ; then
-	LEADING_UNDERSCORE=1
-	AC_DEFINE(LEADING_UNDERSCORE,1,[symbol name mangling convention])
-	AC_MSG_RESULT("yes")
+    LEADING_UNDERSCORE=1
+    AC_DEFINE(LEADING_UNDERSCORE,1,[symbol name mangling convention])
+    AC_MSG_RESULT("yes")
 else
-	LEADING_UNDERSCORE=""
-	AC_MSG_RESULT("no")
+    LEADING_UNDERSCORE=""
+    AC_MSG_RESULT("no")
 fi
 
 
@@ -918,61 +629,63 @@ AC_MSG_CHECKING("for GNU ld option -Map"
 touch map
 $CC -o foo [ -Wl,-Map ] map foo.o >/dev/null 2>&1
 if test `cat map | wc -l` != "0" ; then
-	AC_MSG_RESULT("yes")
-	AC_DEFINE(HAVE_GNU_LD,1,[gnu linker present])
-	GNU_LD=1
+    AC_MSG_RESULT("yes")
+    AC_DEFINE(HAVE_GNU_LD,1,[gnu linker present])
+    GNU_LD=1
 else
-	AC_MSG_RESULT("no")
-	GNU_LD=
+    AC_MSG_RESULT("no")
+    GNU_LD=
 fi
 rm -f foo.c foo.o foo map
 
 AC_MSG_CHECKING([for size of gmp limbs])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-        #include <stdio.h>
-	#include "$MP_INCLUDE"
-	]],[[
-	FILE *fp=fopen("conftest1","w");
-	fprintf(fp,"%u",sizeof(mp_limb_t));
-	fclose(fp);
-	return 0;
-	]])],[mpsize=`cat conftest1`],[AC_MSG_ERROR([Cannot determine mpsize])])
+				   #include <stdio.h>
+				   #include "$MP_INCLUDE"
+			       ]],
+			       [[
+				   FILE *fp=fopen("conftest1","w");
+				   fprintf(fp,"%u",sizeof(mp_limb_t));
+				   fclose(fp);
+			       ]])],[mpsize=`cat conftest1`],[AC_MSG_ERROR([Cannot determine mpsize])])
 AC_DEFINE_UNQUOTED(MP_LIMB_BYTES,$mpsize,[sizeof mp_limb in gmp library])
 AC_MSG_RESULT($mpsize) 
 
 AC_MSG_CHECKING([_SHORT_LIMB])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-        #include <stdio.h>
-	#include "$MP_INCLUDE"
-	]],[[
-	#ifdef _SHORT_LIMB
-	return 0;
-	#else
-	return 1;
-	#endif
-	]])],[AC_DEFINE(__SHORT_LIMB,1,[short gmp3 limbs]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
+				   #include <stdio.h>
+				   #include "$MP_INCLUDE"
+			       ]],
+			       [[
+				   #ifdef _SHORT_LIMB
+				   return 0;
+				   #else
+				   return 1;
+				   #endif
+			       ]])],[AC_DEFINE(__SHORT_LIMB,1,[short gmp3 limbs]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
 
 AC_MSG_CHECKING([_LONG_LONG_LIMB])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-	#include <stdio.h>
-	#include "$MP_INCLUDE"
-	]],[[
-	#ifdef _LONG_LONG_LIMB
-	return 0;
-	#else
-	return 1;
-	#endif
-	]])],[AC_DEFINE(__LONG_LONG_LIMB,1,[long gmp3 limbs]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
-
- GMP=1
- AC_DEFINE(GMP,1,[using gmp])
- AC_SUBST(GMP)
- AC_SUBST(GMPDIR)
- echo > makedefsafter
- echo "MPFILES=$MPFILES" >> makedefsafter
- echo "PATCHED_SYMBOLS=$PATCHED_SYMBOLS" >> makedefsafter
- echo >> makedefsafter
-fi
+				   #include <stdio.h>
+				   #include "$MP_INCLUDE"
+			       ]],
+			       [[
+				   #ifdef _LONG_LONG_LIMB
+				   return 0;
+				   #else
+				   return 1;
+				   #endif
+			       ]])],[AC_DEFINE(__LONG_LONG_LIMB,1,[long gmp3 limbs]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
+
+GMP=1
+AC_DEFINE(GMP,1,[using gmp])
+AC_SUBST(GMP)
+AC_SUBST(GMPDIR)
+echo > makedefsafter
+echo "MPFILES=$MPFILES" >> makedefsafter
+echo "PATCHED_SYMBOLS=$PATCHED_SYMBOLS" >> makedefsafter
+echo >> makedefsafter
+
 
 
 #
@@ -980,30 +693,13 @@ fi
 # 
 
 if test "$enable_xgcl" = "yes" ; then 
-
-   AC_PATH_X
-#   AC_PATH_XTRA
-#   echo $X_CFLAGS
-#   echo $X_LIBS
-#   echo $X_EXTRA_LIBS
-#   echo $X_PRE_LIBS
-
-   miss=0
-#   AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)#FIXME remove these
-#   AC_CHECK_LIB(Xt,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)
-#   AC_CHECK_LIB(Xext,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)
-#   AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)#until here
-   AC_CHECK_LIB(X11,main,X_LIBS="$X_LIBS -lX11",miss=1,$X_LIBS)
- 
-   if test "$miss" = "1" ; then
-      X_CFLAGS=
-      X_LIBS=
-      X_EXTRA_LIBS=
-      X_PRE_LIBS=
-      echo missing x libraries -- cannot compile xgcl
-   else
-      AC_DEFINE(HAVE_XGCL,1,[using xgcl])
-   fi
+    
+    AC_PATH_X
+    
+    AC_CHECK_LIB(X11,main,
+		 [X_LIBS="$X_LIBS -lX11" AC_DEFINE(HAVE_XGCL,1,[using xgcl])],
+		 [AC_MSG_RESULT([missing x libraries -- cannot compile xgcl])])
+    
 fi
 
 
@@ -1015,225 +711,194 @@ AC_SUBST(X_CFLAGS)
 #
 
 if test "$enable_dlopen" = "yes" ; then
+    
+    AC_CHECK_LIB([dl],[dlopen],,AC_MSG_ERROR([Cannot find dlopen]))
+    
+    TLIBS="$TLIBS -ldl -rdynamic"
+    assert_arg_to_tcflags -fPIC
+    AC_DEFINE(USE_DLOPEN,1,[link compiled objects via libdl])
 
- 	AC_CHECK_LIB(dl,dlopen,have_dl=1,have_dl=0)
- 	if test "$have_dl" = "0" ; then
- 		echo "Cannot find dlopen in -dl"
- 		exit 1
- 	fi
-dnl	AC_SEARCH_LIBS(dlopen, dl, have_dl=1, AC_ERROR(dlopen not found))
-dnl LIBS and TLIBS - why not merged from the beginning?
-
-	TLIBS="$TLIBS -ldl -rdynamic"
-	TCFLAGS="-fPIC $TCFLAGS"
-dnl	TLIBS="$TLIBS -rdynamic"
-	AC_DEFINE(USE_DLOPEN,1,[link compiled objects via libdl])
 fi
 
 if test "$enable_statsysbfd" = "yes" || test "$enable_dynsysbfd" = "yes" ; then
-	AC_CHECK_HEADERS(bfd.h,
-		AC_CHECK_LIB(bfd,bfd_init,
-		#
-		# Old binutils appear to need CONST defined to const
-		#
-			AC_MSG_CHECKING(if need to define CONST for bfd)
-			AC_TRY_RUN([#define IN_GCC
-				    #include <bfd.h>
-				    int main() { symbol_info t; return 0;}],
-				AC_MSG_RESULT(no),
-				AC_TRY_RUN([#define CONST const
-                                            #define IN_GCC
-					    #include <bfd.h>
-					    int main() {symbol_info t; return 0;}],
-					AC_MSG_RESULT(yes) 
-					AC_DEFINE(NEED_CONST,1,[binutils requires CONST definition]),
-					AC_MSG_ERROR([cannot use bfd]),
-					AC_MSG_ERROR([cannot use bfd])),
-				AC_MSG_ERROR([cannot use bfd]))
-			,,-liberty))
-
-	AC_DEFINE(HAVE_LIBBFD,1,[use libbfd])
-
-#
-# BFD boolean syntax
-#
-
-	AC_MSG_CHECKING(for useable bfd_boolean)
-	AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-		#define IN_GCC
-		#include <bfd.h>
-		bfd_boolean foo() {return FALSE;}
-		]],[[return 0;]])],
-		[AC_MSG_RESULT(yes) 
-		AC_DEFINE(HAVE_BFD_BOOLEAN,1,[bfd_boolean defined])],
-		[AC_MSG_RESULT(no)])
-
-#
-# bfd_link_info.output_bfd minimal configure change check
-#
-
- 	AC_CHECK_MEMBER([struct bfd_link_info.output_bfd],
- 		AC_DEFINE(HAVE_OUTPUT_BFD,1,[output_bfd element present]), [], 
-		[
-		#include <bfd.h>
-		#include <bfdlink.h>
-		])
-	AC_SUBST(HAVE_OUTPUT_BFD)
-
-#
-# FIXME: Need to workaround mingw before this point -- CM
-#
-	if test "$enable_statsysbfd" = "yes" && ! $CC -v 2>&1 | fgrep ming > /dev/null ; then
-		echo 'int main() {bfd_init();bfd_openr("/dev/null",0);return 0;}' >foo.c
-		MP=`$CC [ -Wl,-M ] -static -o foo foo.c -lbfd -liberty -ldl 2>&1 | grep -v : | tr '()' '\012\012' | $AWK '{print $NF}' | sort | uniq`
-		rm -f foo.c foo
-		if echo $MP | tr ' ' '\012' | grep libbfd.a >/dev/null; then
-		   LIBBFD="`echo $MP | tr ' ' '\012' | grep libbfd.a | $AWK '{i=split($1,A,"/");for (j=1;j<=i;j++) if (j>1 && A[[j]]=="..") {j--;i-=2;for (k=j;k<=i;k++) A[[k]]=A[[k+2]];j--;}} END {for (j=1;j<=i;j++) printf("%s%s",A[[j]],j!=i ? "/" : "")}'`"
-		else
-		   AC_MSG_ERROR([cannot locate external libbfd.a])
-		fi   
-		if echo $MP | tr ' ' '\012' | grep libiberty.a >/dev/null ; then
-		   LIBIBERTY="`echo $MP | tr ' ' '\012' | grep libiberty.a | $AWK '{i=split($1,A,"/");for (j=1;j<=i;j++) if (j>1 && A[[j]]=="..") {j--;i-=2;for (k=j;k<=i;k++) A[[k]]=A[[k+2]];j--;}} END {for (j=1;j<=i;j++) printf("%s%s",A[[j]],j!=i ? "/" : "")}'`"
-		else
-		   AC_MSG_ERROR([cannot locate external libiberty.a])
-		fi   
-		BUILD_BFD=copy_bfd
-		AC_CHECK_LIB(z,inflate,
-			[TLIBS="$TLIBS -lz"],
-			AC_MSG_ERROR([Need zlib for bfd linking]),[])
-		AC_CHECK_LIB(dl,dlsym,
-			[TLIBS="$TLIBS -ldl"],
-			AC_MSG_ERROR([Need libdl for bfd linking]),[])
-		AC_SUBST(BUILD_BFD)
-		AC_SUBST(LIBBFD)
-		AC_SUBST(LIBIBERTY)
-
+    AC_CHECK_HEADERS(
+	[bfd.h],
+	AC_CHECK_LIB(
+	    [bfd],[bfd_init],
+	    #
+	    # Old binutils appear to need CONST defined to const
+	    #
+	    AC_MSG_CHECKING([need to define CONST for bfd])
+	    AC_RUN_IFELSE(
+		[AC_LANG_PROGRAM(
+			[[
+			    #define IN_GCC
+			    #include <bfd.h>
+			]],
+			[[
+			    symbol_info t;
+			]])],
+		AC_MSG_RESULT([no]),
+		AC_RUN_IFELSE(
+		    [AC_LANG_PROGRAM(
+			    [[
+				#define CONST const
+				#define IN_GCC
+				#include <bfd.h>
+			    ]],
+			    [[
+				symbol_info t;
+			    ]])],
+		    AC_MSG_RESULT([yes]) 
+		    AC_DEFINE(NEED_CONST,1,[binutils requires CONST definition]),
+		    AC_MSG_ERROR([cannot use bfd]),
+		    AC_MSG_ERROR([cannot use bfd])),
+		AC_MSG_ERROR([cannot use bfd]))
+	    ,,-liberty))
+    
+    AC_DEFINE(HAVE_LIBBFD,1,[use libbfd])
+    
+    #
+    # BFD boolean syntax
+    #
+    
+    AC_MSG_CHECKING(for useable bfd_boolean)
+    AC_RUN_IFELSE(
+	[AC_LANG_PROGRAM(
+		[[
+		    #define IN_GCC
+		    #include <bfd.h>
+		    bfd_boolean foo() {return FALSE;}
+		]],
+		[[]])],
+	[AC_MSG_RESULT(yes) 
+	 AC_DEFINE(HAVE_BFD_BOOLEAN,1,[bfd_boolean defined])],
+	[AC_MSG_RESULT(no)])
+    
+    #
+    # bfd_link_info.output_bfd minimal configure change check
+    #
+    
+    AC_CHECK_MEMBER([struct bfd_link_info.output_bfd],
+ 		    AC_DEFINE(HAVE_OUTPUT_BFD,1,[output_bfd element present]), [], 
+		    [[
+			#include <bfd.h>
+			#include <bfdlink.h>
+		    ]])
+    AC_SUBST(HAVE_OUTPUT_BFD)
+    
+    #
+    # FIXME: Need to workaround mingw before this point -- CM
+    #
+    if test "$enable_statsysbfd" = "yes" && ! $CC -v 2>&1 | fgrep ming > /dev/null ; then
+	echo 'int main() {bfd_init();bfd_openr("/dev/null",0);return 0;}' >foo.c
+	MP=`$CC [ -Wl,-M ] -static -o foo foo.c -lbfd -liberty -ldl 2>&1 | grep -v : | tr '()' '\012\012' | $AWK '{print $NF}' | sort | uniq`
+	rm -f foo.c foo
+	if echo $MP | tr ' ' '\012' | grep libbfd.a >/dev/null; then
+	    LIBBFD="`echo $MP | tr ' ' '\012' | grep libbfd.a | $AWK '{i=split($1,A,\"/\");for (j=1;j<=i;j++) if (j>1 && A[[j]]==\"..\") {j--;i-=2;for (k=j;k<=i;k++) A[[k]]=A[[k+2]];j--;}} END {for (j=1;j<=i;j++) printf(\"%s%s\",A[[j]],j!=i ? \"/\" : \"\")}'`"
 	else
-		TLIBS="$TLIBS -lbfd -liberty -ldl"
-	fi
-fi
-
-if test "$enable_locbfd" = "yes" ; then
-
-	# check for gettext.  It is part of glibc, but others
-	# need GNU gettext separately.
-#	AC_CHECK_HEADERS(libintl.h, true,
-#			   AC_MSG_ERROR(libintl.h (gettext) not found))
-#	AC_SEARCH_LIBS(dgettext, intl, true, AC_MSG_ERROR(gettext library not found))
- 
-	echo "#"
-	echo "#"
-	echo "# -------------------------"
-	echo "# Subconfigure of LIBINTL"
-	echo "#"
-	echo "#"
-	cd binutils/intl && chmod +x configure && ./configure --disable-nls && cd ../..
-#       MY_SUBDIRS="$MY_SUBDIRS binutils/libiberty " 
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# Subconfigure of LIBINTL done"
-	echo "# ------------------------------"
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# -------------------------"
-	echo "# Subconfigure of LIBIBERTY"
-	echo "#"
-	echo "#"
-	cd binutils/libiberty && chmod +x configure && ./configure --disable-nls && cd ../..
-#       MY_SUBDIRS="$MY_SUBDIRS binutils/libiberty " 
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# Subconfigure of LIBIBERTY done"
-	echo "# ------------------------------"
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# -------------------"
-	echo "# Subconfigure of BFD"
-	echo "#"
-	echo "#"
-	cd binutils/bfd && chmod +x configure && ./configure --with-included-gettext --disable-nls && cd ../..
-#       MY_SUBDIRS="$MY_SUBDIRS binutils/bfd " 
-	echo "#"
-	echo "#"
-	echo "#"
-	echo "# Subconfigure of BFD done"
-	echo "# ------------------------"
-	echo "#"
-#	TLIBS="$TLIBS `pwd`/binutils/bfd/libbfd.a `pwd`/binutils/libiberty/libiberty.a"
-	AC_DEFINE(HAVE_LIBBFD,1,[use libbfd])
-	BUILD_BFD="h/bfd.h h/bfdlink.h h/ansidecl.h h/symcat.h"
+	    AC_MSG_ERROR([cannot locate external libbfd.a])
+	fi   
+	if echo $MP | tr ' ' '\012' | grep libiberty.a >/dev/null ; then
+	    LIBIBERTY="`echo $MP | tr ' ' '\012' | grep libiberty.a | $AWK '{i=split($1,A,\"/\");for (j=1;j<=i;j++) if (j>1 && A[[j]]==\"..\") {j--;i-=2;for (k=j;k<=i;k++) A[[k]]=A[[k+2]];j--;}} END {for (j=1;j<=i;j++) printf(\"%s%s\",A[[j]],j!=i ? \"/\" : \"\")}'`"
+	else
+	    AC_MSG_ERROR([cannot locate external libiberty.a])
+	fi   
+	BUILD_BFD=copy_bfd
+	AC_CHECK_LIB(z,inflate,
+		     [TLIBS="$TLIBS -lz"],
+		     AC_MSG_ERROR([Need zlib for bfd linking]),[])
+	AC_CHECK_LIB(dl,dlsym,
+		     [TLIBS="$TLIBS -ldl"],
+		     AC_MSG_ERROR([Need libdl for bfd linking]),[])
 	AC_SUBST(BUILD_BFD)
+	AC_SUBST(LIBBFD)
+	AC_SUBST(LIBIBERTY)
+	
+    else
+	TLIBS="$TLIBS -lbfd -liberty -ldl"
+    fi
 fi
 
+AC_ARG_ENABLE([xdr],[  --enable-xdr=yes will compile in support for XDR])
 
-if test "$enable_xdr" = "yes" ; then
-   AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions]),
-   	   AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions])
-	                TLIBS="$TLIBS -ltirpc" TCFLAGS="$TCFLAGS -I/usr/include/tirpc",
-	   AC_CHECK_LIB(gssrpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions])
-	                TLIBS="$TLIBS -lgssrpc" TCFLAGS="$TCFLAGS -I/usr/include/gssrpc",
-	   AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions])
-	                TLIBS="$TLIBS -lrpc" TCFLAGS="$TCFLAGS -I/usr/include/rpc",
-	   AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions])
-	                TLIBS="$TLIBS -loncrpc" TCFLAGS="$TCFLAGS -I/usr/include/oncrpc")))))
+if test "$enable_xdr" != "no" ; then
+    XDR_LIB=""
+    AC_CHECK_FUNC([xdr_double],XDR_LIB=" ",
+		  [AC_CHECK_LIB([tirpc],[xdr_double],[XDR_LIB=tirpc],
+				[AC_CHECK_LIB([gssrpc],[xdr_double],[XDR_LIB=gssrpc],
+					      [AC_CHECK_LIB([rpc],[xdr_double],[XDR_LIB=rpc],
+							    [AC_CHECK_LIB([oncrpc],[xdr_double],[XDR_LIB=oncrpc])])])])])
+    
+    if test "$XDR_LIB" != ""; then
+	AC_DEFINE(HAVE_XDR,1,[have xdr extensions])
+	if test "$XDR_LIB" != " "; then
+	    TLIBS="$TLIBS -l$XDR_LIB"
+	    add_arg_to_tcflags -I/usr/include/$XDR_LIB
+	fi
+    fi
 fi
 
 
 AC_MSG_CHECKING([__builtin_clzl])
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-  #include <stdio.h>
-  #include <unistd.h>
-  int main() {
-      unsigned long u;
-      long j;
-      if (__builtin_clzl(0)!=sizeof(long)*8)
-      	 return -1;
-      for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
-      	  if (__builtin_clzl(u)!=j)
-  	     return -1;
-      return 0;
-   }]])],[AC_MSG_RESULT([yes])
-	  AC_DEFINE(HAVE_CLZL,[1],[clzl instruction])],
-	  [AC_MSG_RESULT([no])])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+		#include <unistd.h>
+	    ]],
+	    [[
+		unsigned long u;
+		long j;
+		if (__builtin_clzl(0)!=sizeof(long)*8)
+      		   return -1;
+		   for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
+      		       if (__builtin_clzl(u)!=j)
+  			  return -1;
+	    ]])],
+    [AC_MSG_RESULT([yes])
+     AC_DEFINE(HAVE_CLZL,[1],[clzl instruction])],
+    [AC_MSG_RESULT([no])])
 
 AC_MSG_CHECKING([__builtin_ctzl])
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-  #include <stdio.h>
-  #include <unistd.h>
-  int main() {
-      unsigned long u;
-      long j;
-      if (__builtin_ctzl(0)!=sizeof(long)*8)
-      	 return -1;
-      for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
-      	  if (__builtin_ctzl(u)!=j)
-  	     return -1;
-      return 0;
-   }]])],[AC_MSG_RESULT([yes])
-	  AC_DEFINE(HAVE_CTZL,[1],[ctzl instruction])],
-	  [AC_MSG_RESULT([no])])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+		#include <unistd.h>
+	    ]],
+	    [[
+		unsigned long u;
+		long j;
+		if (__builtin_ctzl(0)!=sizeof(long)*8)
+      		   return -1;
+		   for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
+      		       if (__builtin_ctzl(u)!=j)
+  			  return -1;
+	    ]])],
+    [AC_MSG_RESULT([yes])
+     AC_DEFINE(HAVE_CTZL,[1],[ctzl instruction])],
+    [AC_MSG_RESULT([no])])
 
 
 case $use in
-     sh4*) ;;     #FIXME, these exceptions needed as of gcc 4.7
-     hppa*) ;;    #FIXME
-     powerpc*) ;; #FIXME
-     alpha*) ;;   #FIXME
-     ia64*) ;;    #FIXME
-     *) 
-     AC_MSG_CHECKING(__builtin___clear_cache)
-	AC_RUN_IFELSE([
-		AC_LANG_PROGRAM([[]],[[
+    sh4*) ;;     #FIXME, these exceptions needed as of gcc 4.7
+    hppa*) ;;    #FIXME
+    powerpc*) ;; #FIXME
+    alpha*) ;;   #FIXME
+    ia64*) ;;    #FIXME
+    *) 
+	AC_MSG_CHECKING(__builtin___clear_cache)
+	AC_RUN_IFELSE(
+	    [AC_LANG_PROGRAM(
+		    [[]],
+		    [[
 			void *v,*ve;
 			__builtin___clear_cache(v,ve);
-				]])],
-				[AC_DEFINE(HAVE_BUILTIN_CLEAR_CACHE,1,[have __builtin__clear_cache instruction])
-				 AC_MSG_RESULT(yes)],
-				 AC_MSG_RESULT(no));;
+		    ]])],
+	    [AC_DEFINE(HAVE_BUILTIN_CLEAR_CACHE,1,[have __builtin__clear_cache instruction])
+	     AC_MSG_RESULT(yes)],
+	    AC_MSG_RESULT(no));;
 esac
 
 #AC_CONFIG_SUBDIRS($MY_SUBDIRS)
@@ -1247,547 +912,481 @@ AC_CHECK_SIZEOF(long,0)
 ####  Memory areas and alignment
 
 AC_MSG_CHECKING(for byte order)
-AC_RUN_IFELSE([
-	AC_LANG_PROGRAM([[
-		]],[[
-
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[]],
+	    [[
 		/* Are we little or big endian?  Adapted from Harbison&Steele.  */
 		union {long l;char c[sizeof(long)];} u;
 		u.l = 1;
 		return u.c[sizeof(long)-1] ? 1 : 0;
-	]])],[
+	    ]])],[
 	AC_MSG_RESULT(little)],
-	[AC_MSG_RESULT(big) 
-	AC_DEFINE(WORDS_BIGENDIAN,1,[big endian byte order])])
+    [AC_MSG_RESULT(big) 
+     AC_DEFINE(WORDS_BIGENDIAN,1,[big endian byte order])])
 AC_SUBST(WORDS_BIGENDIAN)
 
 
 AC_MSG_CHECKING(for word order)
-AC_RUN_IFELSE([
-	AC_LANG_PROGRAM([[
-		]],[[
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[]],
+	    [[
 		/* Are we little or big endian?  Adapted from Harbison&Steele.  */
 		union {double d;int l[sizeof(double)/sizeof(int)];} u;
 		u.d = 1.0;
 		return u.l[sizeof(double)/sizeof(int)-1] ? 0 : 1;
-	]])],
-	[AC_MSG_RESULT(little)],
-	[AC_MSG_RESULT(big) 
-	AC_DEFINE(DOUBLE_BIGENDIAN,1,[big endian word order])])
+	    ]])],
+    [AC_MSG_RESULT(little)],
+    [AC_MSG_RESULT(big) 
+     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;;
+    mips*) min_pagewidth=14;;
+    *) min_pagewidth=12;;
 esac
-AC_RUN_IFELSE([
-	AC_LANG_PROGRAM([[
-	    #include <stdio.h>
-            #include <unistd.h>
-            #ifdef __CYGWIN__
-            #define getpagesize() 4096
-            #endif
-	    ]],[[
-	    size_t i=getpagesize(),j; 
-	    FILE *fp=fopen("conftest1","w");
-	    for (j=0;i>>=1;j++);
-	    j=j<$min_pagewidth ? $min_pagewidth : j;
-	    fprintf(fp,"%u",j);
-	    return 0;
-	]])],
-	[PAGEWIDTH=`cat conftest1`],
-	[PAGEWIDTH=0])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+		#include <unistd.h>
+		#ifdef __CYGWIN__
+		#define getpagesize() 4096
+		#endif
+	    ]],
+	    [[
+		size_t i=getpagesize(),j; 
+		FILE *fp=fopen("conftest1","w");
+		for (j=0;i>>=1;j++);
+		    j=j<$min_pagewidth ? $min_pagewidth : j;
+		    fprintf(fp,"%u",j);
+	    ]])],
+    [PAGEWIDTH=`cat conftest1`],
+    [PAGEWIDTH=0])
 AC_MSG_RESULT($PAGEWIDTH)
 AC_DEFINE_UNQUOTED(PAGEWIDTH,$PAGEWIDTH,[system pagewidth])
 AC_SUBST(PAGEWIDTH)
 
 AC_MSG_CHECKING([for required object alignment])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-        #include <stdio.h>
-	#define EXTER
-	#define INLINE
-	#include "$MP_INCLUDE"
-	#include "./h/enum.h"
-	#define OBJ_ALIGN
-	#include "./h/type.h"
-	#include "./h/lu.h"
-	#include "./h/object.h"
-	]],[[
-	unsigned long i;
-   	FILE *fp=fopen("conftest1","w");
-	for (i=1;i && NOT_OBJECT_ALIGNED(i); i<<=1);
-	if (!i) return -1;
-	fprintf(fp,"%lu",i);
-	fclose(fp);
-	return 0;
-	]])],
-	 [obj_align=`cat conftest1`
-	 AC_MSG_RESULT($obj_align)
-	 AC_DEFINE_UNQUOTED(OBJ_ALIGNMENT,$obj_align,[needed object alignment in bytes])],
-         [AC_MSG_ERROR([Cannot find object alignent])])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+		#define EXTER
+		#define INLINE
+		#include "$MP_INCLUDE"
+		#include "./h/enum.h"
+		#define OBJ_ALIGN
+		#include "./h/type.h"
+		#include "./h/lu.h"
+		#include "./h/object.h"
+	    ]],
+	    [[
+		unsigned long i;
+   		FILE *fp=fopen("conftest1","w");
+		for (i=1;i && NOT_OBJECT_ALIGNED(i); i<<=1);
+		    if (!i) return -1;
+		       fprintf(fp,"%lu",i);
+		       fclose(fp);
+		       return 0;
+	    ]])],
+    [obj_align=`cat conftest1`
+     AC_MSG_RESULT($obj_align)
+     AC_DEFINE_UNQUOTED(OBJ_ALIGNMENT,$obj_align,[needed object alignment bytes])],
+    [AC_MSG_ERROR([Cannot find object alignent])])
 
 AC_MSG_CHECKING([for C extension variable alignment])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
-	    char *v __attribute__ ((aligned ($obj_align)));
-	    return 0;]])],[obj_align="__attribute__ ((aligned ($obj_align)))"],[AC_MSG_ERROR([Need alignment attributes])])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM([[]],
+		     [[
+			 char *v __attribute__ ((aligned ($obj_align)));
+		     ]])],[obj_align="__attribute__ ((aligned ($obj_align)))"],[AC_MSG_ERROR([Need alignment attributes])])
 AC_MSG_RESULT($obj_align)
 AC_DEFINE_UNQUOTED(OBJ_ALIGN,$obj_align,[can use C extension for object alignment])
 
 AC_MSG_CHECKING([for C extension noreturn function attribute])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
-	    extern int v() __attribute__ ((noreturn));
-	    return 0;]])],[no_return="__attribute__ ((noreturn))"],[no_return=])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM([[]],
+		     [[
+			 extern int v() __attribute__ ((noreturn));
+		     ]])],
+    [no_return="__attribute__ ((noreturn))"],[no_return=])
 AC_MSG_RESULT($no_return)
 AC_DEFINE_UNQUOTED(NO_RETURN,$no_return,[can use C extension for functions that do not return])
 
-AC_MSG_CHECKING(sizeof struct contblock)
+AC_MSG_CHECKING([sizeof struct contblock])
+
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+		#define EXTER
+		#define INLINE
+		#include "$MP_INCLUDE"
+		#include "h/enum.h"
+		#include "h/type.h"
+		#include "h/lu.h"
+		#include "h/object.h"
+	    ]],
+	    [[
+		FILE *f=fopen("conftest1","w");
+		fprintf(f,"%u",sizeof(struct contblock));
+		fclose(f);
+	    ]])],
+    [sizeof_contblock=`cat conftest1`],
+    [AC_MSG_ERROR([Cannot find sizeof struct contblock])],
+    [AC_MSG_ERROR([Cannot find sizeof struct contblock])])
 
-# work around MSYS pwd result incompatibility
-if test "$use" = "mingw" ; then
-AC_TRY_RUN([#include <stdio.h>
-	#define EXTER
-	#define INLINE
-	#include "$MP_INCLUDE"
-	#include "h/enum.h"
-	#include "h/type.h"
-	#include "h/lu.h"
-	#include "h/object.h"
-	int main(int argc,char **argv,char **envp) {
-	FILE *f=fopen("conftest1","w");
-	fprintf(f,"%u",sizeof(struct contblock));
-	fclose(f);
-	return 0;
-	}],sizeof_contblock=`cat conftest1`,
-	   echo Cannot find sizeof struct contblock;exit 1,
-	   echo Cannot find sizeof struct contblock;exit 1)
-else
-AC_TRY_RUN([#include <stdio.h>
-	#define EXTER
-	#define INLINE
-	#include "$MP_INCLUDE"
-	#include "`pwd`/h/enum.h"
-	#include "`pwd`/h/type.h"
-	#include "`pwd`/h/lu.h"
-	#include "`pwd`/h/object.h"
-	int main(int argc,char **argv,char **envp) {
-	FILE *f=fopen("conftest1","w");
-	fprintf(f,"%u",sizeof(struct contblock));
-	fclose(f);
-	return 0;
-	}],sizeof_contblock=`cat conftest1`,
-	   echo Cannot find sizeof struct contblock;exit 1,
-	   echo Cannot find sizeof struct contblock;exit 1)
-fi
 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_TRY_RUN([#include <unistd.h>
-	    #include <stdio.h>
-	    int main() {
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <unistd.h>
+		#include <stdio.h>
+	    ]],
+	    [[
 		FILE *f;
 		if (!(f=fopen("conftest1","w")))
-			return -1;
-		fprintf(f,"%u",sbrk(0));
-		return 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]))
+		   return -1;
+		   fprintf(f,"%u",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
+    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);
-	    return 0;
-        ]])],
+    
+    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])],
+	 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);
-	    return 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])],
+	 AC_MSG_RESULT([yes $ADDR_COMPAT_LAYOUT])],
 	[ADDR_COMPAT_LAYOUT=0
-	AC_MSG_RESULT([no])]
+	 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);
-	    return 0;
-        ]])],
+    
+    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])],
+	 AC_MSG_RESULT([yes $ADDR_LIMIT_3GB])],
 	[ADDR_LIMIT_3GB=0
-	AC_MSG_RESULT([no])]
+	 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 <stdio.h>
-	        #include <stdlib.h>
- 		int main(int argc,char **argv,char **envp) {
-		#include "h/unrandomize.h"
-		return 0;}]])],
+    
+    AC_MSG_CHECKING([for personality(ADDR_NO_RANDOMIZE) support])
+    AC_RUN_IFELSE(
+	[AC_LANG_SOURCE(
+		[[
+		    #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_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])
-	AC_TRY_RUN([#include <stdio.h>
-	            #include <stdlib.h>
+    AC_MSG_CHECKING([that sbrk is (now) non-random])
+    SBRK=0
+    AC_RUN_IFELSE(
+	[AC_LANG_SOURCE(
+		[[
+		    #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,"%u",sbrk(0));
-			return 0;}],SBRK=`cat conftest1`,SBRK=0,SBRK=0)
-	if test "$SBRK" = "0" ; then
-		AC_MSG_RESULT(cannot trap sbrk)
-		exit 1
-	fi
-	AC_TRY_RUN([#include <stdio.h>
-	            #include <stdlib.h>
+			if (!(f=fopen("conftest1","w")))
+			   return -1;
+			   fprintf(f,"%u",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 <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,"%u",sbrk(0));
-			return 0;}],SBRK1=`cat conftest1`,SBRK1=0,SBRK1=0)
-	if test "$SBRK1" = "0" ; then
-		AC_MSG_RESULT(cannot trap sbrk)
-		exit 1
-	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"
-		exit 1
-	fi
+			   fprintf(f,"%u",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
-
-dnl AC_MSG_CHECKING(DBEGIN)
-dnl AC_RUN_IFELSE([AC_LANG_SOURCE([[
-dnl   #include <stdio.h>
-dnl   #include <stdlib.h>
-dnl   #include <unistd.h>
-dnl   void gprof_cleanup() {};
-
-dnl   int main(int argc,char **argv,char **envp) {
-
-dnl   void *b;
-dnl   FILE *fp;
-
-dnl   #ifdef CAN_UNRANDOMIZE_SBRK
-dnl   #include "h/unrandomize.h"
-dnl   #endif
-			
-dnl   fp = fopen("conftest1","w");
-
-dnl   #ifdef _WIN32
-dnl   fprintf ( fp,"0x%lx", 0x3000000 );  /* Windows custom allocation from this point up */
-dnl   #else
-dnl   #if defined (__APPLE__) && defined (__MACH__)
-dnl   fprintf(fp,"0x0");
-dnl   #else
-dnl   b = sbrk(0);
-dnl   fprintf(fp,"0x%lx",((unsigned long) b) & ~(unsigned long)((1<<PAGEWIDTH)-1));
-dnl   #endif
-dnl   #endif
-dnl   fclose(fp);
-dnl   return 0;}]])],
-dnl   [dbegin=`cat conftest1`],[dbegin=0])
-
-dnl AC_MSG_RESULT($dbegin)
-
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	    #include <stdio.h>
-dnl             #include <unistd.h>
-dnl 	    ]],[[
-dnl 	    FILE *fp=fopen("conftest1","w");
-dnl 	    fprintf(fp,"%u",262144*( SIZEOF_LONG >>2)/(1<<($PAGEWIDTH-12)));
-dnl 	    return 0;]])],[def_maxpage=`cat conftest1`],[def_maxpage=262144])
-
-dnl AC_ARG_ENABLE(maxpage,
-dnl [ --enable-maxpage=XXXX  will compile in a page table of size XXX
-dnl                          (eg '--enable-maxpage=64*1024' would produce
-dnl 			 64K pages allowing 256 MB if pages are 4K each)],
-dnl ,enable_maxpage=$def_maxpage)
-
-
 AC_MSG_CHECKING(CSTACK_ADDRESS)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-	#include <stdio.h>
-	#include <stdlib.h>
-	void *
-	foo() {
-	      int i;
-	      return (void *)&i;
-        }
-
-	int main(int argc,char **argv,char **envp) {
-	void *v ;
-	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)&v;
-	if (foo()>i) 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_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+	    [[
+		#include <stdio.h>
+		#include <stdlib.h>
+		void *
+		foo() {
+		    int i;
+		    return (void *)&i;
+		}
+		
+		int
+		main(int argc,char **argv,char **envp) {
+		    void *v ;
+		    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)&v;
+		    if (foo()>i) 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)
 
 AC_MSG_CHECKING([cstack bits])
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-	#include <stdio.h>
-	#include <stdlib.h>
-	void *
-	foo() {
-	      int i;
-	      return (void *)&i;
-        }
-
-	int main(int argc,char **argv,char **envp) {
-	void *v ;
-	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)&v;
-	if (foo()>i) i-=j;
-	j--;
-	i+=j;
-	i&=~j;
-	for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
-	fprintf(fp,"%d",j);
-	fclose(fp);
-	return 0;
-}]])],[cstack_bits=`cat conftest1`],[cstack_bits=0])
+AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+	    [[
+		#include <stdio.h>
+		#include <stdlib.h>
+		void *
+		foo() {
+		    int i;
+		    return (void *)&i;
+		}
+		
+		int
+		main(int argc,char **argv,char **envp) {
+		    void *v ;
+		    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)&v;
+		    if (foo()>i) i-=j;
+		       j--;
+		       i+=j;
+		       i&=~j;
+		       for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
+			   fprintf(fp,"%d",j);
+			   fclose(fp);
+			   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>
-	int main(int argc,char **argv,char **envp) {
-	#ifdef CAN_UNRANDOMIZE_SBRK
-	#include "h/unrandomize.h"
-	#endif
-	return (long)$cstack_address<0 ? 0 : -1;
-}]])],[AC_MSG_RESULT(yes)
-	neg_cstack_address=1
-	AC_DEFINE(NEG_CSTACK_ADDRESS,1,[C stack address is negative])],
-      [AC_MSG_RESULT(no)
-	neg_cstack_address=0])
-
+AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+	    [[
+		#include <stdio.h>
+		#include <stdlib.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;
+		}]])],
+    [AC_MSG_RESULT(yes)
+     neg_cstack_address=1
+     AC_DEFINE(NEG_CSTACK_ADDRESS,1,[C stack address is negative])],
+    [AC_MSG_RESULT(no)
+     neg_cstack_address=0])
 
 AC_MSG_CHECKING([finding CSTACK_ALIGNMENT])
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-	#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;
-}]])],[cstack_alignment=`cat conftest1`],[cstack_alignment=0])
+AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+	    [[
+		#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;
+		}]])],
+    [cstack_alignment=`cat conftest1`],[cstack_alignment=0])
 AC_DEFINE_UNQUOTED(CSTACK_ALIGNMENT,$cstack_alignment,[C stack alignment])
 AC_MSG_RESULT($cstack_alignment)
 
 AC_MSG_CHECKING(CSTACK_DIRECTION)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-	#include <stdio.h>
-	#include <stdlib.h>
-	void *
-	foo(void) {
-	int i;
-	return (void *)&i;
-	}
-
-	int main(int argc,char **argv,char **envp) {
-	char *b;
-	FILE *fp = fopen("conftest1","w");
-	#ifdef CAN_UNRANDOMIZE_SBRK
-	#include "h/unrandomize.h"
-	#endif
-	fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
-	fclose(fp);
-	return 0;
-}]])],[cstack_direction=`cat conftest1`],[cstack_direction=0])
+AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+	    [[
+		#include <stdio.h>
+		#include <stdlib.h>
+		void *
+		foo(void) {
+		    int i;
+		    return (void *)&i;
+		}
+		
+		int
+		main(int argc,char **argv,char **envp) {
+		    char *b;
+		    FILE *fp = fopen("conftest1","w");
+		    #ifdef CAN_UNRANDOMIZE_SBRK
+		    #include "h/unrandomize.h"
+		    #endif
+		    fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
+		    fclose(fp);
+		    return 0;
+		}]])],
+    [cstack_direction=`cat conftest1`],[cstack_direction=0])
 AC_DEFINE_UNQUOTED(CSTACK_DIRECTION,$cstack_direction,[whether C stack grows up or down])
 AC_MSG_RESULT($cstack_direction)
 
+AC_ARG_ENABLE([immfix],[  --enable-immfix will enable an immediate fixnum table above the C stack])
 
-dnl AC_MSG_CHECKING(for shared library/C stack ceiling to heap)
-dnl if test "$use" = "mingw" ; then
-dnl   heap_ceiling=2000000000
-dnl else
-dnl if test "$use" = "solaris-i386" ; then
-dnl   heap_ceiling=0x0
-dnl else
-dnl if test "$enable_static" = "yes" ; then
-dnl   heap_ceiling=0x0
-dnl else
-dnl if ! test -x `which ldd` && ! test -f /proc/self/maps ; then
-dnl    heap_ceiling=0x0
-dnl else
-dnl if test -f /proc/self/maps ; then
-dnl    heap_ceiling=0x`/bin/cat /proc/self/maps | grep "/lib.*/ld-" | cut -f1 -d- | head -1`
-dnl else 
-dnl if test "`which ldd`" = "" ; then 
-dnl    heap_ceiling=0x0
-dnl else
-dnl #echo -e "#include <stdio.h>\n int main() {printf(\"foo\");return 0;}" >foo.c
-dnl #$CC foo.c -o foo
-dnl    AAWK=`which awk`
-dnl # | grep -v ld-kfreebsd needed on some strange bsd amd64 boxes
-dnl    heap_ceiling=`ldd $AAWK | tail -n 1 | $AWK '{print $NF}' | tr -d '()'`
-dnl fi
-dnl fi
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	#include <stdio.h>
-dnl 	]],[[
-dnl 	FILE *fp=fopen("conftest1","w");
-dnl 	unsigned long h=$heap_ceiling,d=$dbegin,c=$cstack_address;
-dnl 	h=h<d ? 0 : h;
-dnl 	h=c>d && c<h ? c : h;
-dnl 	fprintf(fp,"0x%lx",h);
-dnl 	return 0;]])],[heap_ceiling=`cat conftest1`],[AC_MSG_ERROR([failed])])
-dnl fi
-dnl fi
-dnl fi
-dnl fi
-dnl AC_MSG_RESULT($heap_ceiling)
-dnl AC_DEFINE_UNQUOTED(SHARED_LIB_HEAP_CEILING,$heap_ceiling,
-dnl 	[address at which shared lib placement terminates heap growth])
-
-dnl ## Don't lower heap start if C stack is below default dbegin, as we're
-dnl # likely to get more heap this way.
-dnl if test "$enable_static" = "yes" ; then 
-dnl    echo "int main() {return !((unsigned long)$dbegin < (unsigned long)$cstack_address);}" >foo.c
-dnl else
-dnl    echo "int main() {return !($heap_ceiling && (unsigned long)$dbegin < (unsigned long)$cstack_address);}" >foo.c
-dnl fi
-dnl $CC foo.c -o foo
-dnl if ./foo ; then
+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 -Wl,--verbose foo.c -o foo 2>&1 | \
-       $AWK '/\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=/ {i=1-i;next} {if (i) print}' >gcl.script
-   rm -rf foo.c foo
-
-   if test "`cat gcl.script | wc -l`" != "0" ; then
-      AC_MSG_RESULT(got it)
-      AC_MSG_NOTICE([trying to adjust text start])
-      cp gcl.script gcl.script.def
-
-      n=-1;
-      k=0;
-      lim=`$AWK 'END {printf("%d\n",m*8-2)}' m=$ac_cv_sizeof_long`;
-      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
-#        diff -u gcl.script.def gcl.script
-        echo "int main() {return 0;}" >foo.c
-        if ( $CC -Wl,-T gcl.script foo.c -o foo && ./foo ) >/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
-	 break;
-        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
-	    max=$cstack_bits;
-            AC_MSG_NOTICE([max log text start reduced to $max considering c stack address])
-	 fi	
-      fi
-
-      j=-1;
-      low_shft="";
-      if test $min -le $max ; then
-            if test $max -ge $enable_fastimmfix && test "$enable_immfix" = "yes" ; then
+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 $TLDFLAGS -Wl,--verbose foo.c -o foo 2>&1 | \
+	$AWK '/\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=/ {i=1-i;next} {if (i) print}' >gcl.script
+    rm -rf foo.c foo
+    
+    if test "`cat gcl.script | wc -l`" != "0" ; then
+	AC_MSG_RESULT(got it)
+	AC_MSG_NOTICE([trying to adjust text start])
+	cp gcl.script gcl.script.def
+	
+	n=-1;
+	k=0;
+	lim=`$AWK 'END {printf("%d\n",m*8-2)}' m=$ac_cv_sizeof_long`;
+	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
+	    #        diff -u gcl.script.def gcl.script
+            echo "int main() {return 0;}" >foo.c
+            if ( $CC $TLDFLAGS -Wl,-T gcl.script foo.c -o foo && ./foo ) >/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
+		break;
+            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
+		max=$cstack_bits;
+		AC_MSG_NOTICE([max log text start reduced to $max considering 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
 	        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 $j for a $max bit wide low immfix table])
@@ -1795,356 +1394,139 @@ if test "$use" != "386-gnu" ; then #hurd
 	        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 $j to maximize data area])
 	    fi
-      fi
-
-      if test "$low_shft" != "" ; then
+	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])      	 
-      else				   
+	else				   
             AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])      	 
-      fi					     
-
-#      echo $j;
-      AC_MSG_CHECKING([our linker script])
-      if test "$j" -ne "-1" ; then
+	fi					     
+	
+	#      echo $j;
+	AC_MSG_CHECKING([our linker script])
+	if test "$j" -ne "-1" ; then
             cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
 	    AC_MSG_RESULT([done])
 	    rm -f gcl.script.def
 	    LDFLAGS="$LDFLAGS -Wl,-T gcl.script "
 	    cp gcl.script unixport
-      else
-	 AC_MSG_RESULT([none found or not needed])
-	 rm -f gcl.script gcl.script.def
-      fi
-      rm -rf foo.c foo
-  else
-      AC_MSG_RESULT([not found])
-  fi 
-
+	else
+	    AC_MSG_RESULT([none found or not needed])
+	    rm -f gcl.script gcl.script.def
+	fi
+	rm -rf foo.c foo
+    else
+	AC_MSG_RESULT([not found])
+    fi 
+    
 else
- 
-     AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])      	 
-
+    
+    AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])      	 
+    
 fi
 
-   dnl old_LDFLAGS="$LDFLAGS"
-   dnl LDFLAGS="$LDFLAGS $TLDFLAGS"
-   dnl AC_MSG_CHECKING([revised DBEGIN])
-   dnl AC_RUN_IFELSE([AC_LANG_SOURCE([[
-   dnl 	#include <stdio.h>
-   dnl 	#include <stdlib.h>
-   dnl 	#include <unistd.h>
-
-   dnl 	int main(int argc,char **argv,char **envp) {
-
-   dnl 	    void *b;
-   dnl 	    FILE *fp;
-
-   dnl 	    #ifdef CAN_UNRANDOMIZE_SBRK
-   dnl 	    #include "h/unrandomize.h"
-   dnl 	    #endif
-   dnl 	    fp = fopen("conftest1","w");
-
-   dnl 	    #ifdef _WIN32
-   dnl 	    fprintf ( fp,"0x%lx", 0x1a000000 );  /* Windows custom allocation from this point up */
-   dnl 	    #else
-   dnl 	    #if defined (__APPLE__) && defined (__MACH__)
-   dnl 	    fprintf(fp,"((unsigned long)get_dbegin())");
-   dnl 	    #else
-   dnl 	    b = sbrk(0);
-   dnl 	    fprintf(fp,"0x%lx",((unsigned long) b) & ~(unsigned long)0xffffff);
-   dnl 	    #endif
-   dnl 	    #endif
-   dnl 	    fclose(fp);
-   dnl 	    return 0;}]])],[dbegin=`cat conftest1`],[dbegin=0])
-   dnl AC_MSG_RESULT($dbegin)
-   dnl LDFLAGS="$old_LDFLAGS"
-dnl fi
-dnl dnl AC_DEFINE_UNQUOTED(DBEGIN,$dbegin,[down-rounded beginning address of lisp data])
-dnl rm -rf foo*
-
-dnl AC_MSG_CHECKING(for maxpage revision)
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	#include <stdio.h>
-dnl 	]],[[
-dnl 	char *b;
-dnl 	unsigned long i,j;
-dnl 	FILE *fp = fopen("conftest1","w");
-dnl 	j=((unsigned long)$enable_maxpage <<$PAGEWIDTH) + $dbegin;
-dnl 	j=$heap_ceiling && j>$heap_ceiling ? $heap_ceiling : j;
-dnl 	j-=$dbegin;
-dnl 	/*  for (i=1;i<<1 && i<=j;i<<=1); */
-dnl 	/*  if (i>j) i>>=1; */
-dnl 	i=j;
-dnl 	fprintf(fp,"%ld",i>>$PAGEWIDTH);
-dnl 	fclose(fp);
-dnl 	return 0;
-dnl ]])],[tmp_maxpage=`cat conftest1`],[tmp_maxpage=0])
-dnl if test "$tmp_maxpage" != "$enable_maxpage" ; then
-dnl    enable_maxpage=$tmp_maxpage
-dnl    AC_MSG_RESULT($enable_maxpage)
-dnl else
-dnl    AC_MSG_RESULT($enable_maxpage is OK)
-dnl fi
-dnl AC_DEFINE_UNQUOTED(MAXPAGE,$enable_maxpage,[maximum number of pages to be allocated])
-
-dnl AC_MSG_CHECKING(for C stack size floor from heap)
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	#include <stdio.h>
-dnl 	]],[[
-dnl 	char *b;
-dnl 	FILE *fp = fopen("conftest1","w");
-dnl 	unsigned long j,k;
-
-dnl 	j=$cstack_address + $cstack_direction * $enable_cssize;
-dnl 	k=($dbegin + ((unsigned long)$enable_maxpage << $PAGEWIDTH));
-dnl 	j=abs(j-$cstack_address)!=$enable_cssize || (j<k && $dbegin < $cstack_address) ? k : j;
-dnl 	j-=$cstack_address;
-dnl 	j*=$cstack_direction;
-dnl 	fprintf(fp,"%lu",j);
-dnl 	fclose(fp);
-dnl 	return 0;
-dnl ]])],[tmp_cssize=`cat conftest1`],[tmp_cssize=0])
-dnl if test "$tmp_cssize" != "$enable_cssize" ; then
-dnl    enable_cssize=$tmp_cssize;
-dnl    AC_MSG_RESULT($enable_cssize)
-dnl else
-dnl    AC_MSG_RESULT($enable_cssize is OK)
-dnl fi
-
-dnl AC_MSG_CHECKING(for C stack size limit from fixnum table)
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	#include <stdio.h>
-dnl 	]],[[
-dnl 	char *b;
-dnl 	FILE *fp = fopen("conftest1","w");
-dnl 	unsigned long j,k;
-
-dnl 	j=$cstack_address + $cstack_direction * $enable_cssize;
-dnl 	if ($cstack_direction>0) {
-dnl 	  k=$cstack_address + ((-(unsigned long)$cstack_address)>>1);
-dnl 	  j=j<$cstack_address || j > k ? k : j;
-dnl 	  j=$cstack_address < $dbegin && j > $dbegin ? $dbegin : j;
-dnl 	}
-dnl 	j-=$cstack_address;
-dnl 	j*=$cstack_direction;
-dnl 	fprintf(fp,"%lu",j);
-dnl 	fclose(fp);
-dnl 	return 0;
-dnl ]])],[tmp_cssize=`cat conftest1`],[tmp_cssize=0])
-dnl if test "$tmp_cssize" != "$enable_cssize" ; then
-dnl    enable_cssize=$tmp_cssize;
-dnl    AC_MSG_RESULT($enable_cssize)
-dnl else
-dnl    AC_MSG_RESULT($enable_cssize is OK)
-dnl fi
-
-dnl AC_MSG_CHECKING(for C stack size limit from address wrap)
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	#include <stdio.h>
-dnl 	]],[[
-dnl 	char *b;
-dnl 	FILE *fp = fopen("conftest1","w");
-dnl 	unsigned long j,k;
-
-dnl 	j=-$cstack_address * $cstack_direction;
-dnl 	j=j>$enable_cssize ? $enable_cssize : j;
-dnl 	fprintf(fp,"%lu",j);
-dnl 	fclose(fp);
-dnl 	return 0;
-dnl ]])],[tmp_cssize=`cat conftest1`],[tmp_cssize=0])
-dnl if test "$tmp_cssize" != "$enable_cssize" ; then
-dnl    enable_cssize=$tmp_cssize;
-dnl    AC_MSG_RESULT($enable_cssize)
-dnl else
-dnl    AC_MSG_RESULT($enable_cssize is OK)
-dnl fi
-dnl AC_DEFINE_UNQUOTED(CSSIZE,$enable_cssize,[maximum C stack size])
-
-dnl AC_MSG_CHECKING(for fast NULL_OR_ON_CSTACK macro)
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 	#include <stdio.h>
-dnl 	]],[[
-dnl 	return ((long)$dbegin>=0 &&
-dnl 	       ((long)$dbegin+(long)($enable_maxpage<<$PAGEWIDTH)) >=0 &&
-dnl 	       ((long)$cstack_address<0)) ? 0 : 1;
-dnl ]])],[tmp_fnocm=yes],[tmp_fnocm=no])
-dnl if test "$tmp_fnocm" = "yes" ; then
-dnl    AC_MSG_RESULT(yes)
-dnl    AC_DEFINE(USE_FAST_NULL_OR_ON_CSTACK_MACRO,1,[whether one instruction heap address check can be used])
-dnl else
-dnl    AC_MSG_RESULT(no)
-dnl fi
-
 mem_top=0
 mem_range=0
 AC_MSG_CHECKING(mem top)
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-	#include <stdio.h>
-	]],[[
-	void *v;
-	unsigned long i,j,k,l,m;
-	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 : -1) : l;
-	for (i=j=k;j && i<l;j>>=1,i|=j);
-	if (j<(k>>3)) i=0;
-	j=1;
-	j<<=$PAGEWIDTH;
-	j<<=4;
-	j--;
-	i+=j;
-	i&=~j;
-	fprintf(fp,"0x%lx",i);
-	fclose(fp);
-	return 0;
-]])],[mem_top=`cat conftest1`],[mem_top="0x0"])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+	    ]],
+	    [[
+		void *v;
+		unsigned long i,j,k,l,m;
+		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 : -1) : l;
+		    for (i=j=k;j && i<l;j>>=1,i|=j);
+			if (j<(k>>3)) i=0;
+			   j=1;
+			   j<<=$PAGEWIDTH;
+			   j<<=4;
+			   j--;
+			   i+=j;
+			   i&=~j;
+			   fprintf(fp,"0x%lx",i);
+			   fclose(fp);
+			   return 0;
+	    ]])],
+    [mem_top=`cat conftest1`],[mem_top="0x0"])
 AC_MSG_RESULT($mem_top)
+
 if test "$mem_top" != "0x0" ; then
-   AC_MSG_CHECKING(finding upper mem half range)
-   AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-   #include <stdio.h>
-   ]],[[
-   unsigned long j;
-   FILE *fp = fopen("conftest1","w");
-
-   for (j=1;j && !(j& $mem_top);j<<=1);
-   fprintf(fp,"0x%lx",j>>1);
-   fclose(fp);
-   return 0;
-   ]])],[mem_range=`cat conftest1`],[mem_range="0x0"])
-   AC_MSG_RESULT($mem_range)
-   if test "$mem_range" != "0x0" ; then 
+    AC_MSG_CHECKING(finding upper mem half range)
+    AC_RUN_IFELSE(
+	[AC_LANG_PROGRAM(
+		[[
+		    #include <stdio.h>
+		]],
+		[[
+		    unsigned long j;
+		    FILE *fp = fopen("conftest1","w");
+		    
+		    for (j=1;j && !(j& $mem_top);j<<=1);
+			fprintf(fp,"0x%lx",j>>1);
+			fclose(fp);
+			return 0;
+		]])],
+	[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
 fi
 
-if test "$enable_immfix" = "yes" ; then
-  if test "$mem_top" != "0x0" ; then
-     if test "$mem_range" != "0x0" ; then 
-	AC_DEFINE_UNQUOTED(IM_FIX_BASE,$mem_top,[beginning address for immediate fixnum range])
-        AC_DEFINE_UNQUOTED(IM_FIX_LIM,$mem_range,[size of immediate fixnum address space])
-     fi
-  fi
-fi
-
-
-dnl AC_MSG_CHECKING(for word order)
-dnl AC_TRY_RUN([int main () {
-dnl   /* Are we little or big endian?  Adapted from Harbison&Steele.  */
-dnl   union
-dnl   {
-dnl     double d;
-dnl     int l[sizeof(double)/sizeof(int)];
-dnl   } u;
-dnl   u.d = 1.0;
-dnl   return u.l[sizeof(double)/sizeof(int)-1] ? 0 : 1;
-dnl }],AC_MSG_RESULT(little) 
-dnl    AC_DEFINE(LITTLE_END),
-dnl    AC_MSG_RESULT(big),
-dnl    AC_MSG_RESULT([WARNING: ASSUMING LITTLE ENDIAN FOR CROSS COMPILING !!!]
-dnl    AC_DEFINE(LITTLE_END)))
-dnl AC_SUBST(LITTLE_END)
-
-
-# On systems with execshield, brk is randomized.  We need to catch
-# this and restore the traditional behavior here
-
-dnl old_LDFLAGS="$LDFLAGS"
-dnl LDFLAGS="$TLDFLAGS"
-dnl AC_MSG_CHECKING("finding DBEGIN")
-dnl AC_TRY_RUN([#include <stdio.h>
-dnl             #include <stdlib.h>
-
-dnl void gprof_cleanup() {};
-dnl int
-dnl main(int argc,char * argv[],char *envp[])
-dnl {
-dnl   char *b,*b1;
-dnl   FILE *fp;
-
-dnl #ifdef CAN_UNRANDOMIZE_SBRK
-dnl #include "h/unrandomize.h"
-dnl #endif
-dnl   b = (void *) malloc(1000);
-dnl   fp = fopen("conftest1","w");
-
-dnl #ifdef _WIN32
-dnl   fprintf(fp,"_dbegin");
-dnl #else
-dnl #if defined (__APPLE__) && defined (__MACH__)
-dnl   fprintf(fp,"mach_mapstart");
-dnl #else
-dnl   b1=((unsigned long) b) & ~(unsigned long)0xffffff;b=(void *)b1<(void *)&b1 && (void *)b>(void *)&b ? ((unsigned long) b) & ~(unsigned long)((1<<PAGEWIDTH)-1) : b1;
-dnl   fprintf(fp,"0x%lx",b);
-dnl #endif
-dnl #endif
-dnl   fclose(fp);
-dnl   return 0;
-dnl }],dbegin=`cat conftest1`,dbegin=0,dbegin=0)
-dnl AC_DEFINE_UNQUOTED(DBEGIN,$dbegin /* where data begins */)
-dnl AC_MSG_RESULT(got $dbegin)
-dnl LDFLAGS="$old_LDFLAGS"
-
-
-dnl AC_MSG_CHECKING("finding CSTACK_ADDRESS")
-dnl AC_TRY_RUN([#include <stdio.h>
-dnl main()
-dnl {
-dnl   char *b ;
-dnl   FILE *fp = fopen("conftest1","w");
-dnl   fprintf(fp,"%ld",((long) &b));
-dnl   fclose(fp);
-dnl   return 0;
-dnl }],cstack_address=`cat conftest1`,cstack_address=0,cstack_address=0)
-dnl AC_DEFINE_UNQUOTED(CSTACK_ADDRESS,$cstack_address \
-dnl )
-dnl AC_MSG_RESULT(got $cstack_address)
-
-
+if test "$enable_immfix" != "no" ; then
+    if test "$mem_top" != "0x0" ; then
+	if test "$mem_range" != "0x0" ; then 
+	    AC_DEFINE_UNQUOTED(IM_FIX_BASE,$mem_top,[beginning address for immediate fixnum range])
+            AC_DEFINE_UNQUOTED(IM_FIX_LIM,$mem_range,[size of immediate fixnum address space])
+	fi
+    fi
+fi
 
 AC_MSG_CHECKING([sizeof long long int])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-	#include <stdio.h>
-	]],[[
-	if (sizeof(long long int) == 2*sizeof(long)) return 0;
-	return 1;
-]])],[AC_DEFINE(HAVE_LONG_LONG,1,[long long is available]) AC_MSG_RESULT(yes)],
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+	    ]],
+	    [[
+		if (sizeof(long long int) == 2*sizeof(long)) return 0;
+		   return 1;
+	    ]])],
+    [AC_DEFINE(HAVE_LONG_LONG,1,[long long is available]) AC_MSG_RESULT(yes)],
     [AC_MSG_RESULT(no)])
 
 AC_SUBST(HAVE_LONG_LONG)
 
-
-AC_CHECK_HEADERS(dirent.h,
-	AC_MSG_CHECKING([for d_type])
-	AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-		#include <dirent.h>
-			]],[[
-		struct dirent d;
-		return d.d_type=0;
-		]])],
-		[AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_D_TYPE,1,[have struct dirent d_type field])],
-		AC_MSG_RESULT([no]),AC_MSG_RESULT([no])))
-
-# readline
-AC_ARG_ENABLE(readline,
-	[--enable-readline    enables command line completion via the readline library ],,
-	enable_readline="yes")
+AC_CHECK_HEADERS([dirent.h],
+		 AC_MSG_CHECKING([for d_type])
+		 AC_RUN_IFELSE(
+		     [AC_LANG_PROGRAM(
+			     [[
+				 #include <dirent.h>
+			     ]],
+			     [[
+				 struct dirent d;
+				 return d.d_type=0;
+			     ]])],
+		     [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_D_TYPE,1,[have struct dirent d_type field])],
+		     AC_MSG_RESULT([no]),AC_MSG_RESULT([no])))
 
 # ansi lisp
-AC_ARG_ENABLE(ansi,[--enable-ansi builds a large gcl aiming for ansi compliance, 
-		    --disable-ansi builds the smaller traditional CLtL1 image],,enable_ansi="yes")
-
-if test "$enable_ansi" = "yes" ; then
-	SYSTEM=ansi_gcl
-	CLSTANDARD=ANSI
-else
-	SYSTEM=gcl
-	CLSTANDARD=CLtL1
-fi
+SYSTEM=ansi_gcl
+CLSTANDARD=ANSI
+AC_ARG_ENABLE([ansi],[  --enable-ansi builds a large gcl aiming for ansi compliance],
+	      [if test "$enable_ansi" = "no" ; then
+		   SYSTEM=gcl
+		   CLSTANDARD=CLtL1
+	       fi])
 
 FLISP="saved_$SYSTEM"
 AC_SUBST(FLISP)
@@ -2192,51 +1574,44 @@ AC_EGREP_HEADER([gettimeofday],
                 [sys/time.h],
 		[AC_MSG_RESULT([present])],
 		[AC_MSG_RESULT([missing])
-		AC_DEFINE(GETTOD_NOT_DECLARED,1,[No gettimeofday call -- fixme])])
+		 AC_DEFINE(GETTOD_NOT_DECLARED,1,[No gettimeofday call -- fixme])])
 
 
 AC_CHECK_LIB(m,sin,LIBS="${LIBS} -lm",true)
 AC_CHECK_LIB(mingwex,main,LIBS="${LIBS} -lmingwex",true)
 
 AC_MSG_CHECKING([for buggy maximum sscanf length])
-AC_RUN_IFELSE([
-	AC_LANG_PROGRAM([[
-            #include <stdio.h>
-          ]],[[
-            char *s= "2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161404";
-	    int n, m;
-	    double f;
-	    char *endptr;
-            FILE *fp=fopen("conftest1","w");
-
-	    n=sscanf(s,"%lf%n",&f,&m);
-	    fprintf(fp,"%d",m);
-	    fclose(fp);
-	    return s[m];
-	  ]])],
-	[AC_MSG_RESULT([none])],
-	[buggy_maximum_sscanf_length=`cat conftest1`
-         AC_MSG_RESULT([$buggy_maximum_sscanf_length])
-	 AC_DEFINE_UNQUOTED(BUGGY_MAXIMUM_SSCANF_LENGTH,$buggy_maximum_sscanf_length,[sscanf terminates prematurely (Windows XP)])])
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+	    ]],
+	    [[
+		char *s= "2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161404";
+		int n, m;
+		double f;
+		char *endptr;
+		FILE *fp=fopen("conftest1","w");
+		
+		n=sscanf(s,"%lf%n",&f,&m);
+		fprintf(fp,"%d",m);
+		fclose(fp);
+		return s[m];
+	    ]])],
+    [AC_MSG_RESULT([none])],
+    [buggy_maximum_sscanf_length=`cat conftest1`
+     AC_MSG_RESULT([$buggy_maximum_sscanf_length])
+     AC_DEFINE_UNQUOTED(BUGGY_MAXIMUM_SSCANF_LENGTH,$buggy_maximum_sscanf_length,[sscanf terminates prematurely (Windows XP)])])
 
 
 EXTRA_LOBJS=
-if test "$try_japi" = "yes" ; then
-   AC_CHECK_HEADERS(japi.h,[AC_DEFINE(HAVE_JAPI_H)
-				 EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o"
-			 	 LIBS="${LIBS} -ljapi -lwsock32"] )
-fi
-dnl if test "$use" = "mingw" ; then
-dnl  if test "$try_xdr" = "yes" ; then
-dnl    AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
-dnl 			 	 LIBS="${LIBS} -loncrpc"] )
-dnl  fi
-dnl else
-dnl  if test "$try_xdr" = "yes" ; then
-dnl    AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
-dnl 			 	 LIBS="${LIBS} -lrpc"] )
-dnl  fi
-dnl fi
+AC_ARG_ENABLE([japi],[  --enable-japi=yes will compile in support for the JAPI graphical interface if present on your system],
+	      [if test "$enable_japi" = "yes" ; then
+		   AC_CHECK_HEADERS([japi.h],
+				    [AC_DEFINE(HAVE_JAPI_H)
+				     EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o"
+				     LIBS="${LIBS} -ljapi -lwsock32"])
+	       fi])
 
 # Should really find a way to check for prototypes, but this 
 # basically works for now.  CM
@@ -2260,76 +1635,53 @@ AC_CHECK_HEADERS(float.h,AC_DEFINE(HAVE_
 # test makes sense.  CM
 #
 AC_MSG_CHECKING([for isnormal])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-            #define _GNU_SOURCE
-	    #include <math.h>
-	    ]],[[
-	    float f;
-	    return isnormal(f) || !isnormal(f) ? 0 : 1;
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#define _GNU_SOURCE
+		#include <math.h>
+	    ]],
+	    [[
+		float f;
+		return isnormal(f) || !isnormal(f) ? 0 : 1;
 	    ]])],
-		[AC_DEFINE(HAVE_ISNORMAL,1,[Have isnormal function]) AC_MSG_RESULT(yes)],
-		[AC_MSG_CHECKING([for fpclass in ieeefp.h])
-		 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-			#include <ieeefp.h>
-			]],[[
-			float f;
-			return fpclass(f)>=FP_NZERO || fpclass(f)<FP_NZERO ? 0 : 1;
-			]])],[AC_DEFINE(HAVE_IEEEFP,1,[Have ieeefp fpclass function]) AC_MSG_RESULT(yes)],
-			     [AC_MSG_RESULT(no)])])
+    [AC_DEFINE(HAVE_ISNORMAL,1,[Have isnormal function]) AC_MSG_RESULT(yes)],
+    [AC_MSG_CHECKING([for fpclass of ieeefp.h])
+     AC_RUN_IFELSE(
+	 [AC_LANG_PROGRAM(
+		 [[
+		     #include <ieeefp.h>
+		 ]],
+		 [[
+		     float f;
+		     return fpclass(f)>=FP_NZERO || fpclass(f)<FP_NZERO ? 0 : 1;
+		 ]])],[AC_DEFINE(HAVE_IEEEFP,1,[Have ieeefp fpclass function]) AC_MSG_RESULT(yes)],
+	 [AC_MSG_RESULT(no)])])
 
 AC_MSG_CHECKING([for isfinite])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-        #define _GNU_SOURCE
-	#include <math.h>
-	]],[[
-	float f;
-	return isfinite(f) || !isfinite(f) ? 0 : 1;
-	]])],[AC_DEFINE(HAVE_ISFINITE,1,[Have isfinite function]) AC_MSG_RESULT(yes)],
-	     [AC_MSG_CHECKING([for finite()])
-	      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#define _GNU_SOURCE
 		#include <math.h>
-		#include <ieeefp.h>
-		]],[[
+	    ]],
+	    [[
 		float f;
-		return finite(f) || !finite(f) ? 0 : 1;
-		]])],[AC_DEFINE(HAVE_FINITE,1,[Have finite function]) AC_MSG_RESULT(yes)],
-   		     [AC_MSG_ERROR(no)])])
-
-dnl AC_MSG_CHECKING([for INFINITY])
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl         #define _GNU_SOURCE
-dnl 	#include <math.h>
-dnl 	]],[[
-dnl 	double d=INFINITY;
-dnl 	return 0;
-dnl 	]])],[AC_MSG_RESULT(yes)],
-dnl 	    [AC_MSG_CHECKING([for builtin_inf()])
-dnl 	    AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 		#include <math.h>
-dnl 		#include <ieeefp.h>
-dnl 		]],[[
-dnl 		double d=__builtin_inf();
-dnl 		return 0;
-dnl 		]])],[AC_DEFINE_UNQUOTED(INFINITY,__builtin_inf(),[Have builtin_inf]) AC_MSG_RESULT(yes)],
-dnl 		    [AC_MSG_ERROR(no)])])
-
-dnl AC_MSG_CHECKING([for NAN])
-dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl         #define _GNU_SOURCE
-dnl 	#include <math.h>
-dnl 	]],[[
-dnl 	double d=NAN;
-dnl 	return 0;
-dnl 	]])],[AC_MSG_RESULT(yes)],
-dnl 	    [AC_MSG_CHECKING([for builtin_nan()])
-dnl 	    AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-dnl 		#include <math.h>
-dnl 		#include <ieeefp.h>
-dnl 		]],[[
-dnl 		double d=__builtin_nan("0x0");
-dnl 		return 0;
-dnl 		]])],[AC_DEFINE_UNQUOTED(NAN,__builtin_nan("0x0"),[Have builtin_nan]) AC_MSG_RESULT(yes)],
-dnl 		    [AC_MSG_ERROR(no)])])
+		return isfinite(f) || !isfinite(f) ? 0 : 1;
+	    ]])],[AC_DEFINE(HAVE_ISFINITE,1,[Have isfinite function]) AC_MSG_RESULT(yes)],
+    [AC_MSG_CHECKING([for finite()])
+     AC_RUN_IFELSE(
+	 [AC_LANG_PROGRAM(
+		 [[
+		     #include <math.h>
+		     #include <ieeefp.h>
+		 ]],
+		 [[
+		     float f;
+		     return finite(f) || !finite(f) ? 0 : 1;
+		 ]])],
+	 [AC_DEFINE(HAVE_FINITE,1,[Have finite function]) AC_MSG_RESULT(yes)],
+   	 [AC_MSG_ERROR(no)])])
 
 #--------------------------------------------------------------------
 #	Check for the existence of the -lsocket and -lnsl libraries.
@@ -2363,69 +1715,78 @@ if test "$tcl_checkBoth" = 1; then
 fi
 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [TLIBS="$TLIBS -lnsl"]))
 
-RL_OBJS=""
-RL_LIB=""
-if test "$enable_readline" = "yes" ; then
-	AC_CHECK_HEADERS(readline/readline.h,
-		AC_CHECK_LIB(readline,rl_initialize,
-			AC_DEFINE(HAVE_READLINE,1,[have readline library]) 
-			TLIBS="$TLIBS -lreadline" #some machines don't link this, e.g. Slackware
-			RL_OBJS=gcl_readline.o
-# Readline support now initialized automatically when compiled in, this lisp
-# object no longer needed -- 20040102 CM
-#			RL_LIB=lsp/gcl_readline.o
-			))
-
-# These tests discover differences between readline 4.1 and 4.3
-	AC_CHECK_LIB(readline,rl_completion_matches,
-			AC_DEFINE(HAVE_DECL_RL_COMPLETION_MATCHES,1,[have readline completion matches])
-			AC_DEFINE(HAVE_RL_COMPENTRY_FUNC_T,1,[have readline completion matches]),,)
+# readline
+AC_ARG_ENABLE(readline,[  --enable-readline    enables command line completion via the readline library ])
+
+if test "$use" = "mingw" ; then
+    enable_readline=no
+fi
+
+if test "$enable_readline" != "no" ; then
+    AC_CHECK_HEADERS([readline/readline.h],
+		     AC_CHECK_LIB([readline],[rl_initialize],
+				  [AC_DEFINE(HAVE_READLINE,1,[have readline library]) 
+				   TLIBS="$TLIBS -lreadline" #some machines don't link this, e.g. Slackware
+				   RL_OBJS=gcl_readline.o]))
+    
+    # These tests discover differences between readline 4.1 and 4.3
+    AC_CHECK_LIB([readline],[rl_completion_matches],
+		 [AC_DEFINE(HAVE_DECL_RL_COMPLETION_MATCHES,1,[have readline completion matches])
+		  AC_DEFINE(HAVE_RL_COMPENTRY_FUNC_T,1,[have readline completion matches])])
 fi
 
 AC_SUBST(RL_OBJS)
 AC_SUBST(RL_LIB)
 
-AC_MSG_CHECKING(For network code for nsocket.c)
-AC_TRY_LINK([
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-/************* for the sockets ******************/ 
-#include <sys/socket.h>		/* struct sockaddr, SOCK_STREAM, ... */
-#ifndef NO_UNAME
-#   include <sys/utsname.h>	/* uname system call. */
-#endif
-#include <netinet/in.h>		/* struct in_addr, struct sockaddr_in */
-#include <arpa/inet.h>		/* inet_ntoa() */
-#include <netdb.h>		/* gethostbyname() */
-],[ connect(0,(struct sockaddr *)0,0);
-    gethostbyname("jil");
-    socket(AF_INET, SOCK_STREAM, 0);
-	],
-[AC_DEFINE(HAVE_NSOCKET,1,[can use nsocket library])
- AC_MSG_RESULT(yes)],
-AC_MSG_RESULT(no))
-
-
-AC_MSG_CHECKING(check for listen using fcntl)
-AC_TRY_COMPILE([#include <stdio.h>
-#include <fcntl.h>
-],
-[FILE *fp=fopen("configure.in","r");
-  int orig;
-  orig = fcntl(fileno(fp), F_GETFL);
-  if (! (orig & O_NONBLOCK )) return 0;
-],
-[AC_DEFINE(LISTEN_USE_FCNTL,1,[can use fcntl for listen function])
- AC_MSG_RESULT(yes)],
-AC_MSG_RESULT(no))
-
+# sockets
 
+AC_MSG_CHECKING([For network code for nsocket.c])
+AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <sys/time.h>
+		#include <sys/types.h>
+		#include <unistd.h>
+		
+		#include <errno.h>
+		#include <fcntl.h>
+		#include <stdio.h>
+		
+		/************* for the sockets ******************/ 
+		#include <sys/socket.h>		/* struct sockaddr, SOCK_STREAM, ... */
+		#ifndef NO_UNAME
+		#   include <sys/utsname.h>	/* uname system call. */
+		#endif
+		#include <netinet/in.h>		/* struct in_addr, struct sockaddr_in */
+		#include <arpa/inet.h>		/* inet_ntoa() */
+		#include <netdb.h>		/* gethostbyname() */
+	    ]],
+	    [[
+		connect(0,(struct sockaddr *)0,0);
+		gethostbyname("jil");
+		socket(AF_INET, SOCK_STREAM, 0);
+	    ]])],
+    [AC_DEFINE(HAVE_NSOCKET,1,[can use nsocket library])
+     AC_MSG_RESULT([yes])],
+    [AC_MSG_RESULT([no])])
+
+
+AC_MSG_CHECKING([check for listen using fcntl])
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <stdio.h>
+		#include <fcntl.h>
+	    ]],
+	    [[
+		FILE *fp=fopen("configure.in","r");
+		int orig;
+		orig = fcntl(fileno(fp), F_GETFL);
+		if (! (orig & O_NONBLOCK )) return 0;
+	    ]])],
+    [AC_DEFINE(LISTEN_USE_FCNTL,1,[can use fcntl for listen function])
+     AC_MSG_RESULT([yes])],
+    [AC_MSG_RESULT([no])])
 
 
 AC_CHECK_FUNC(profil, ,[AC_DEFINE(NO_PROFILE,1,[no profil system call])])
@@ -2433,29 +1794,18 @@ AC_SUBST(NO_PROFILE)
 AC_CHECK_FUNC(setenv,[AC_DEFINE(HAVE_SETENV,1,[have setenv call])],no_setenv=1 )
 AC_SUBST(HAVE_SETENV)
 if test "$no_setenv" = "1" ; then
-AC_CHECK_FUNC(putenv,[AC_DEFINE(HAVE_PUTENV,1,[have putenv call])],)
-AC_SUBST(HAVE_PUTENV)
+    AC_CHECK_FUNC(putenv,[AC_DEFINE(HAVE_PUTENV,1,[have putenv call])],)
+    AC_SUBST(HAVE_PUTENV)
 fi
 
 AC_CHECK_FUNC(_cleanup, [AC_DEFINE(USE_CLEANUP,1,[have _cleanup function])],)
 AC_SUBST(USE_CLEANUP)
 gcl_ok=no
 
-dnl AC_HEADER_EGREP(LITTLE_ENDIAN, ctype.h, gcl_ok=yes, gcl_ok=noo)
-dnl if test $gcl_ok = yes ; then
-dnl AC_DEFINE(ENDIAN_ALREADY_DEFINED)
-dnl fi
-
-dnl AC_SUBST(ENDIAN_ALREADY_DEFINED)
-
-
-
-
-# if test "x$enable_machine" = "x" ; then
 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
 
 case $system in
-       OSF*)
+    OSF*)
 	AC_DEFINE(USE_FIONBIO,1,[use fionbio for non-blocking io])
 	AC_MSG_RESULT(FIONBIO)
 	;;
@@ -2474,103 +1824,85 @@ esac
 
 
 AC_MSG_CHECKING(check for SV_ONSTACK)
-AC_TRY_COMPILE([#include <signal.h>
-int joe=SV_ONSTACK;
-],
-[],
-[AC_DEFINE(HAVE_SV_ONSTACK,1,[have sv_onstack])
- AC_SUBST(HAVE_SV_ONSTACK)
- AC_MSG_RESULT(yes)],
-AC_MSG_RESULT(no))
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <signal.h>
+		int joe=SV_ONSTACK;
+	    ]],
+	    [[]])],
+    [AC_DEFINE(HAVE_SV_ONSTACK,1,[have sv_onstack])
+     AC_SUBST(HAVE_SV_ONSTACK)
+     AC_MSG_RESULT([yes])],
+    [AC_MSG_RESULT([no])])
 
 AC_MSG_CHECKING(check for SIGSYS)
-AC_TRY_COMPILE([#include <signal.h>
-int joe=SIGSYS;
-],
-[],
-[AC_DEFINE(HAVE_SIGSYS,1,[have SIGSYS signal])
- AC_SUBST(HAVE_SIGSYS)
- AC_MSG_RESULT(yes)],
-AC_MSG_RESULT(no))
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <signal.h>
+		int joe=SIGSYS;
+	    ]],[[]])],
+    [AC_DEFINE(HAVE_SIGSYS,1,[have SIGSYS signal])
+     AC_SUBST(HAVE_SIGSYS)
+     AC_MSG_RESULT([yes])],
+    [AC_MSG_RESULT([no])])
 
 
 AC_MSG_CHECKING(check for SIGEMT)
-AC_TRY_COMPILE([#include <signal.h>
-int joe=SIGEMT;
-],
-[],
-[AC_DEFINE(HAVE_SIGEMT,1,[have SIGEMT signal])
- AC_SUBST(HAVE_SIGEMT)
- AC_MSG_RESULT(yes)],
-AC_MSG_RESULT(no))
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <signal.h>
+		int joe=SIGEMT;
+	    ]],[[]])],
+    [AC_DEFINE(HAVE_SIGEMT,1,[have SIGEMT signal])
+     AC_SUBST(HAVE_SIGEMT)
+     AC_MSG_RESULT([yes])],
+    [AC_MSG_RESULT([no])])
 
 AC_CHECK_FUNCS(sigaltstack)
 AC_CHECK_FUNCS(feenableexcept)
 
 AC_CHECK_HEADERS(dis-asm.h,
-	MLIBS=$LIBS
-	AC_CHECK_LIB(opcodes,init_disassemble_info)
-	AC_CHECK_LIB(dl,dlopen,#opcodes changes too quickly to link directly 
-		AC_CHECK_FUNCS(print_insn_i386,LIBS="$MLIBS -ldl")))
+		 MLIBS=$LIBS
+		 AC_CHECK_LIB(opcodes,init_disassemble_info)
+		 AC_CHECK_LIB(dl,dlopen,#opcodes changes too quickly to link directly 
+			      AC_CHECK_FUNCS(print_insn_i386,LIBS="$MLIBS -ldl")))
 
 #if test $use = "386-linux" ; then
-	AC_CHECK_HEADERS(asm/sigcontext.h)
-	AC_CHECK_HEADERS(asm/signal.h)
-	AC_MSG_CHECKING([for sigcontext...])
-        AC_TRY_COMPILE([#include <signal.h>
-       ],
-       [
-        struct sigcontext foo;
-       ],
-       [
-        sigcontext_works=1;
-        AC_DEFINE(SIGNAL_H_HAS_SIGCONTEXT,1,[have sigcontext in signal.h])
-	AC_MSG_RESULT(sigcontext in signal.h)
-       ],
-        
-	[sigcontext_works=0;
-         AC_MSG_RESULT(sigcontext NOT in signal.h)]
-       )
-       if test "$sigcontext_works" = 0 ; then
-       AC_MSG_CHECKING([for sigcontext...])
-       AC_TRY_COMPILE([#include <signal.h>
-             #ifdef HAVE_ASM_SIGCONTEXT_H     
-             #include <asm/sigcontext.h>
-             #endif
-             #ifdef HAVE_ASM_SIGNAL_H          
-             #include <asm/signal.h>
-             #endif
-          ],
-        [ 
-        struct sigcontext foo;
-        ],
-        [
-        AC_DEFINE(HAVE_SIGCONTEXT,1,[have sigcontext])
-	AC_MSG_RESULT(sigcontext in asm files)
-        ],
-        [
-        AC_MSG_RESULT(no sigcontext found)
-     ])
-
-
-       fi
-#	echo 'foo() {}' > conftest1.c
-#	$CC -S conftest1.c
-#	use_underscore=0	
-#	if fgrep _foo conftest1.s ; then use_underscore=1 ; fi
-#	if test $use_underscore = 0 ; then
-#            MPI_FILE=mpi-386_no_under.o
-#          else
-#	     MPI_FILE=mpi-386d.o
-#        fi
-#	AC_SUBST(MPI_FILE)
-#       GCC=$CC
-#        if test -x  /usr/bin/i386-glibc20-linux-gcc ; then
-#          GCC=/usr/bin/i386-glibc20-linux-gcc
-#       fi
-#	AC_SUBST(GCC)
-
-#fi
+AC_CHECK_HEADERS(asm/sigcontext.h)
+AC_CHECK_HEADERS(asm/signal.h)
+AC_MSG_CHECKING([for sigcontext...])
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+	    [[
+		#include <signal.h>
+	    ]],
+	    [[
+		struct sigcontext foo;
+	    ]])],
+    [AC_DEFINE(SIGNAL_H_HAS_SIGCONTEXT,1,[have sigcontext of signal.h])
+     AC_MSG_RESULT([sigcontext of signal.h])],
+    [AC_MSG_RESULT([sigcontext NOT of signal.h])
+     AC_MSG_CHECKING([for sigcontext...])
+     AC_COMPILE_IFELSE(
+	 [AC_LANG_PROGRAM(
+		 [[
+		     #include <signal.h>
+		     #ifdef HAVE_ASM_SIGCONTEXT_H     
+		     #include <asm/sigcontext.h>
+		     #endif
+		     #ifdef HAVE_ASM_SIGNAL_H          
+		     #include <asm/signal.h>
+		     #endif
+		 ]],
+		 [[
+		     struct sigcontext foo;
+		 ]])],
+	 [AC_DEFINE(HAVE_SIGCONTEXT,1,[have sigcontext])
+	  AC_MSG_RESULT(sigcontext asm files)],
+	 [AC_MSG_RESULT([no sigcontext found])])])
 
 AC_PATH_PROG(EMACS,emacs)
 
@@ -2590,11 +1922,11 @@ EOF
 
 AC_MSG_CHECKING([emacs site lisp directory])
 if [[ "$EMACS_SITE_LISP" = "unknown" ]] ; then
-	if [[ "$EMACS" != "" ]] ; then
-		EMACS_SITE_LISP=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d  |sed -e /Warning:/d`
-	else
-		EMACS_SITE_LISP=""
-	fi
+    if [[ "$EMACS" != "" ]] ; then
+	EMACS_SITE_LISP=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d  |sed -e /Warning:/d`
+    else
+	EMACS_SITE_LISP=""
+    fi
 fi
 AC_MSG_RESULT($EMACS_SITE_LISP)
 AC_SUBST(EMACS_SITE_LISP)
@@ -2613,14 +1945,14 @@ EOF
 
 AC_MSG_CHECKING([emacs default.el])
 if [[ "$EMACS" != "" ]] ; then
-	EMACS_DEFAULT_EL=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d |sed -e /Warning:/d`
+    EMACS_DEFAULT_EL=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d |sed -e /Warning:/d`
 else
-	EMACS_DEFAULT_EL=""
+    EMACS_DEFAULT_EL=""
 fi
 if  test -f "${EMACS_DEFAULT_EL}"  ; then true;else
-  if test -d $EMACS_SITE_LISP ; then
-     EMACS_DEFAULT_EL=${EMACS_SITE_LISP}/default.el
-  fi
+    if test -d $EMACS_SITE_LISP ; then
+	EMACS_DEFAULT_EL=${EMACS_SITE_LISP}/default.el
+    fi
 fi
 AC_MSG_RESULT($EMACS_DEFAULT_EL)
 AC_SUBST(EMACS_DEFAULT_EL)
@@ -2651,93 +1983,98 @@ fi
 AC_MSG_RESULT($INFO_DIR)
 AC_SUBST(INFO_DIR)
 
-if test "$enable_tcltk" = "yes" ; then
+AC_ARG_ENABLE([tcltk],[  --enable-tcltk will try to build gcl-tk])
+AC_ARG_ENABLE([tkconfig],
+	      [  --enable-tkconfig=XXXX will force the use of a TK_CONFIG_PREFIX=XXXXX as place to look for tkConfig.sh and tclConfig.sh],
+	      [TK_CONFIG_PREFIX=$enableval],[TK_CONFIG_PREFIX=unknown])
+AC_ARG_ENABLE([tclconfig],
+	      [  --enable-tclconfig=XXXX will force the use of a TCL_CONFIG_PREFIX=XXXXX as place to look for tclConfig.sh and tclConfig.sh],
+	      [TCL_CONFIG_PREFIX=$enableval],[TCL_CONFIG_PREFIX=unknown])
 
-   AC_MSG_CHECKING([for tcl/tk])
+if test "$enable_tcltk" != "no" ; then
     
-   if test -d "${TCL_CONFIG_PREFIX}"  ; then true ; else
+    AC_MSG_CHECKING([for tcl/tk])
     
-     AC_CHECK_PROG(TCLSH,tclsh,tclsh,${TCLSH})
-   
-     if test "${TCLSH}" = "" ; then true ; else
-   
-        rm -f conftest.tcl
-        cat >> conftest.tcl <<EOF
+    if test -d "${TCL_CONFIG_PREFIX}"  ; then true ; else
+	
+	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`
-     fi
-   
-     if test -x /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 -d "${TK_CONFIG_PREFIX}"  ; then true ; else
-      if test -f ${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
-            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 -d ${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION} ; then
-      TCL_LIBRARY=${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION}
-   else
-      if test -d ${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION} ; then
-        TCL_LIBRARY=${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION}
-      fi
-   fi
-   
-   if test -d ${TK_CONFIG_PREFIX}/tk${TK_VERSION} ; then
-      TK_LIBRARY=${TK_CONFIG_PREFIX}/tk${TK_VERSION}
-   else
-      if test -d ${TK_CONFIG_PREFIX}/../tk${TK_VERSION} ; then
-        TK_LIBRARY=${TK_CONFIG_PREFIX}/../tk${TK_VERSION}
-      fi
-   fi
-   
-   if test -f ${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
-        TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
-      fi
-   fi
-   
-   if test -f ${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
-        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
-      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
-      AC_CHECK_LIB(lieee,main,have_ieee=1,have_ieee=0)
-      if test "$have_ieee" = "0" ; then
-        TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-lieee::g" `
-      fi
-      if test "$have_dl" = "0" ; then
-        TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-ldl::g"`
-      fi
-      TCL_STUB_LIBS=""
-   fi
-
+	    
+	    TCL_VERSION=`${TCLSH} < conftest.tcl`
+	fi
+	
+	if test -x /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 -d "${TK_CONFIG_PREFIX}"  ; then true ; else
+	if test -f ${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
+		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 -d ${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION} ; then
+	TCL_LIBRARY=${TCL_CONFIG_PREFIX}/tcl${TCL_VERSION}
+    else
+	if test -d ${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION} ; then
+	    TCL_LIBRARY=${TCL_CONFIG_PREFIX}/../tcl${TCL_VERSION}
+	fi
+    fi
+    
+    if test -d ${TK_CONFIG_PREFIX}/tk${TK_VERSION} ; then
+	TK_LIBRARY=${TK_CONFIG_PREFIX}/tk${TK_VERSION}
+    else
+	if test -d ${TK_CONFIG_PREFIX}/../tk${TK_VERSION} ; then
+	    TK_LIBRARY=${TK_CONFIG_PREFIX}/../tk${TK_VERSION}
+	fi
+    fi
+    
+    if test -f ${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
+	    TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
+	fi
+    fi
+    
+    if test -f ${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
+	    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
+	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
+	AC_CHECK_LIB(lieee,main,have_ieee=1,have_ieee=0)
+	if test "$have_ieee" = "0" ; then
+	    TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-lieee::g" `
+	fi
+	TCL_STUB_LIBS=""
+    fi
+    
 fi
 
 AC_SUBST(TK_CONFIG_PREFIX)
@@ -2761,15 +2098,14 @@ AC_SUBST(TCL_LIBS)
 
 
 if test -d "${TK_CONFIG_PREFIX}" ; then
-AC_MSG_RESULT([using TK_VERSION=${TK_VERSION} in ${TK_CONFIG_PREFIX}])
+    AC_MSG_RESULT([using TK_VERSION=${TK_VERSION} of ${TK_CONFIG_PREFIX}])
 else
-AC_MSG_RESULT([not found])
+    AC_MSG_RESULT([not found])
 fi
 
-NOTIFY=$enable_notify
-AC_SUBST(NOTIFY)
-
-      
+AC_ARG_ENABLE([notify],[  --enable-notify=no will disable the automatic notification of gcl maintainers of successful builds/problems],
+	      [NOTIFY=$enable_notify
+	       AC_SUBST(NOTIFY)])
 
 
 # for sgbc the mprotect capabilities.
@@ -2779,76 +2115,37 @@ AC_CHECK_HEADERS(sys/mman.h,AC_CHECK_FUN
 AC_CHECK_HEADERS(alloca.h)
 AC_FUNC_ALLOCA
 
-# alloca
-
-# dlopen etc
-# idea make it so you do something dlopen(libX.so,RTLD_GLOBAL)
-# then dlload("foo.o") a lisp file can refer to things in libX.so
-# 
-
-# what machine this is, and include then a machine specific hdr.
-# and machine specific defs.
-
-# check bzero,
-
-# check getcwd, getwd etc..
-
-
-
 
-# check socket stuff..
-
-# getrlimit
-
-# fionread or block
-
-# redhat/cygnus released for some reason a buggy version of gcc,
-# which no one else released.   Catch that here.
-dnl AC_MSG_CHECKING([Checking for buggy gcc version from redhat])
-dnl if  2>&1 $CC -v | fgrep "gcc version 2.96" > /dev/null 
-dnl    then 
-dnl         BROKEN_O4_OPT=1
-dnl         AC_DEFINE(BROKEN_O4_OPT)
-dnl         AC_SUBST(BROKEN_O4_OPT)
-dnl         echo ODIR_DEBUG=-O >> makedefsafter
-dnl 	echo >> makedefsafter
-dnl 	AC_MSG_RESULT([yes .. turning off -O4])
-dnl    else
-dnl 	AC_MSG_RESULT([no])
-dnl fi 
-
-LDFLAGS="`echo $LDFLAGS | sed 's,gcl.script,../unixport/gcl.script,g'`"
+LDFLAGS="`echo $LDFLAGS | sed 's,gcl.script,../unixport/gcl.script,g'` $TLDFLAGS"
 AC_SUBST(LDFLAGS)
-LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TLDFLAGS $LIBS $TLIBS"
+LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS $TLIBS"
 AC_SUBST(LIBS)
-FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS $TCFLAGS $PROCESSOR_FLAGS"
+FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS $TCFLAGS"
 AC_SUBST(FINAL_CFLAGS)
 # Work around bug with gcc on ppc -- CM
-NIFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TONIFLAGS $PROCESSOR_FLAGS -I\$(GCLDIR)/o"
+NIFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TONIFLAGS -I\$(GCLDIR)/o"
 AC_SUBST(NIFLAGS)
-CFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TO3FLAGS $PROCESSOR_FLAGS -I\$(GCLDIR)/o"
+CFLAGS="$CFLAGS $CPPFLAGS $TCFLAGS $TO3FLAGS -I\$(GCLDIR)/o"
 AC_SUBST(CFLAGS)
 O3FLAGS=$TO3FLAGS
 AC_SUBST(O3FLAGS)
 O2FLAGS=$TO2FLAGS
 AC_SUBST(O2FLAGS)
 
-AC_SUBST(PRELINK_CHECK)
-
 AC_SUBST(EXTRA_LOBJS)
 AC_SUBST(LEADING_UNDERSCORE)
 AC_SUBST(GNU_LD)
 if test -f h/$use.defs  ; then
-
-  AC_SUBST(use)
-  AC_OUTPUT(makedefc windows/gcl.iss windows/sysdir.bat windows/install.lsp )
-  echo makedefc
-  cat makedefc
-
-  echo    add-defs1 $use
-  CC=$CC ./add-defs1 $use
-
+    
+    AC_SUBST(use)
+    AC_OUTPUT(makedefc windows/gcl.iss windows/sysdir.bat windows/install.lsp )
+    echo makedefc
+    cat makedefc
+    
+    echo    add-defs1 $use
+    CC=$CC ./add-defs1 $use
+    
 else
-  echo "Unable to guess machine type"
-  echo use configure --enable-machine=XXX,  for XXX such that h/XXX.defs exists, ie in h/*.defs
+    echo "Unable to guess machine type"
+    echo use configure --enable-machine=XXX,  for XXX such that h/XXX.defs exists, ie in h/*.defs
 fi
--- gcl-2.6.12.orig/gcl-tk/sheader.h
+++ gcl-2.6.12/gcl-tk/sheader.h
@@ -45,7 +45,7 @@ struct message_header {
 
 
 #define BYTE_S 8
-#define BYTE_MASK (~(~0 << BYTE_S))
+#define BYTE_MASK (~(~0UL << BYTE_S))
 
 #define GET_3BYTES(p,ans) do{ unsigned char* __p = (unsigned char *) p; \
 				ans = BYTE_MASK&(*__p++); \
--- gcl-2.6.12.orig/h/compprotos.h
+++ gcl-2.6.12/h/compprotos.h
@@ -170,6 +170,7 @@ int gcl_putc(int,void *);
 #ifdef CMPINCLUDE
 int setjmp();
 int _setjmp();
+int _setjmp3();
 #endif
 void vfun_wrong_number_of_args(object);
 void ihs_overflow (void);
@@ -179,4 +180,3 @@ char *gcl_gets(char *,int);
 int gcl_puts(const char *);
 int endp_error(object);
 object Icall_gen_error_handler(object,object,object,object,ufixnum,...);
-
--- gcl-2.6.12.orig/h/funlink.h
+++ gcl-2.6.12/h/funlink.h
@@ -54,7 +54,7 @@ enum F_arg_types
   };
 
 /* Make a mask for bits i < j, masking j-i bits */
-#define MASK_RANGE(i,j)  ((~(~0 << (j-i)))<< i)
+#define MASK_RANGE(i,j)  ((~(~0UL << (j-i)))<< i)
 
 #define F_PLAIN(x) (((x) & MASK_RANGE( F_START_TYPES_POS,31)) == 0)
 #define ARG_LIMIT 63
--- gcl-2.6.12.orig/h/mingw.defs
+++ gcl-2.6.12/h/mingw.defs
@@ -54,7 +54,7 @@ TCL_LIB_SPEC=
 TCL_DL_LIBS=
 TCL_LIBS=
 
-PWD_CMD=pwd -W
+#PWD_CMD=pwd -W
 
 #
 # End h/mingw.defs
--- gcl-2.6.12.orig/h/mingw.h
+++ gcl-2.6.12/h/mingw.h
@@ -26,21 +26,6 @@
 #define f_nsyms NumberOfSymbols
 #define NO_PWD_H
 
-#define MAXPATHLEN 512
-
-/* alter pathToAlter to fit in with the Clibrary of the system.
-   and report error using name 'x' if you cant do it.
-   The result in pathToAlter should be less
-*/   
-#define FIX_FILENAME(x,pathToAlter) fix_filename(x,pathToAlter)
-
-#define MEMORY_SAVE(self,filename) \
-  do { char buf[MAXPATHLEN]; \
-       strcpy(buf,self); \
-       fix_filename(Cnil,buf); \
-       memory_save(buf,filename); \
-       } while (0)
-
 #define signals_pending *signalsPendingPtr
 
 #undef DBEGIN_TY
--- gcl-2.6.12.orig/h/object.h
+++ gcl-2.6.12/h/object.h
@@ -371,6 +371,9 @@ emsg(const char *s,...) {
   va_list args;
   ufixnum n=0;
   void *v=NULL;
+#ifndef vsnprintf
+  extern int vsnprintf();
+#endif
   va_start(args,s);
   n=vsnprintf(v,n,s,args)+1;
   va_end(args);
--- gcl-2.6.12.orig/h/protoize.h
+++ gcl-2.6.12/h/protoize.h
@@ -1777,6 +1777,7 @@ void gcl_init_shared_memory ( void );
 void fix_filename ( object pathname, char *filename1 );
 void alarm ( int n );
 void *sbrk ( ptrdiff_t increment );
+#define sigset_t int
 void sigemptyset( sigset_t *set);
 void sigaddset ( sigset_t *set, int n);
 int sigismember ( sigset_t *set, int n );
@@ -1798,19 +1799,12 @@ msystem(const char *);
 void
 assert_error(const char *,unsigned,const char *,const char *);
 
-#ifdef _WIN32
-void
-detect_wine(void);
-
+#ifdef __MINGW32__
 void
 init_shared_memory(void);
 
-void *
-alloca(size_t);
-
 object
 find_init_string(const char *);
-
 #endif
 
 void *
@@ -1964,3 +1958,6 @@ gcl_cleanup(int);
 
 void
 do_gcl_abort(void);
+
+int
+vsystem(const char *);
--- gcl-2.6.12.orig/h/wincoff.h
+++ gcl-2.6.12/h/wincoff.h
@@ -10,6 +10,7 @@
    in this */
 #undef va_start
 
+#include "winsock2.h"
 #include "windows.h"
 #ifdef __MINGW32__
 #include "minglacks.h"
--- gcl-2.6.12.orig/lsp/gcl_auto_new.lsp
+++ gcl-2.6.12/lsp/gcl_auto_new.lsp
@@ -206,14 +206,8 @@
 ;; So to stop users from invoking this
 #+sun
 (defun user-homedir-pathname ()
- (let* ((tem (si::getenv "HOME"))
-	(l (- (length tem) 1)))
-   (cond ((null tem) nil)
-	 (t 
-	  (or (and (>= l 0)
-		   (eql (aref tem l) #\/))
-	      (setq tem (concatenate 'string tem "/")))
-	  (pathname tem)))))
-
+ (let* ((tem (si::getenv "HOME")))
+   (when tem
+     (pathname (coerce-slash-terminated tem)))))
 
 (AUTOLOAD 'init-readline '|gcl_readline|)
--- gcl-2.6.12.orig/lsp/gcl_directory.lsp
+++ gcl-2.6.12/lsp/gcl_directory.lsp
@@ -34,9 +34,9 @@
 (defun make-frame (s &aux (l (length s)))
   (replace (make-array l :element-type 'character :adjustable t :fill-pointer l) s))
 
-(defun expand-wild-directory (l f zz &optional (yy (make-frame zz)))
+(defun expand-wild-directory (d l f zz &optional (yy (make-frame zz)))
   (let* ((x (member-if 'wild-dir-element-p l))
-	 (s (namestring (make-pathname :directory (ldiff l x))))
+	 (s (namestring (make-pathname :device d :directory (ldiff l x))))
 	 (z (vector-push-string zz s))
 	 (l (length yy))
 	 (y (link-expand (vector-push-string yy s) l))
@@ -45,19 +45,15 @@
       (cond ((eq (car x) :wild-inferiors) (recurse-dir z y f))
 	    (x (walk-dir z y (lambda (q e l)
 			       (declare (ignore l))
-			       (expand-wild-directory (cons :relative (cdr x)) f q e)) :directory));FIXME
+			       (expand-wild-directory d (cons :relative (cdr x)) f q e)) :directory));FIXME
 	    ((funcall f z y))))))
 
-(defun chdir (s)
-  (when (chdir1 (namestring (pathname s)));to expand ~/
-    (setq *current-directory* (current-directory-pathname))))
-
 (defun directory (p &key &aux (p (translate-logical-pathname p))(d (pathname-directory p))
 		    (c (unless (eq (car d) :absolute) (make-frame (namestring *current-directory*))))
 		    (lc (when c (length c)))
 		    (filesp (or (pathname-name p) (pathname-type p)))
 		    (v (compile-regexp (to-regexp p)))(*up-key* :back) r)
-  (expand-wild-directory d
+  (expand-wild-directory (pathname-device p) d
    (lambda (dir exp &aux (pexp (pathname (if c (vector-push-string c exp 0 lc) exp))))
      (if filesp
 	 (walk-dir dir exp
@@ -67,5 +63,15 @@
 		       (push (merge-pathnames (parse-namestring dir nil *default-pathname-defaults* :start pos) pexp nil) r)))
 		   :file)
        (when (pathname-match-p dir v) (push pexp r))))
-   (make-frame (if c "./" "")))
+   (make-frame ""))
   r)
+
+(defun chdir (s)
+  (when (chdir1 (namestring (pathname s)));to expand ~/
+    (setq *current-directory* (current-directory-pathname))))
+
+(defun which (s)
+  (let ((r (with-open-file (s (apply 'string-concatenate "|" #-winnt "which "
+				     #+winnt "for %i in (" s #+winnt ".exe) do @echo.%~$PATH:i" nil))
+			   (read-line s nil 'eof))))
+    (if (eq r 'eof) s (string-downcase r))))
--- gcl-2.6.12.orig/lsp/gcl_iolib.lsp
+++ gcl-2.6.12/lsp/gcl_iolib.lsp
@@ -451,7 +451,7 @@
       (let* ((*load-pathname* pp)(*load-truename* epp))
 	(with-open-file
 	 (s epp :external-format external-format)
-	 (if (member (peek-char nil s nil 'eof) '#.(mapcar 'code-char (list 127 #xfe #xff #x4c)))
+	 (if (member (peek-char nil s nil 'eof) '#.(mapcar 'code-char (list 127 #xcf #xce #x4c)))
 	     (load-fasl s print)
 	   (let ((*standard-input* s)) (load-stream s print)))))
     (when if-does-not-exist
--- gcl-2.6.12.orig/lsp/gcl_make_pathname.lsp
+++ gcl-2.6.12/lsp/gcl_make_pathname.lsp
@@ -4,29 +4,58 @@
 ;;   (declare (optimize (safety 1)))
 ;;   (when (typep x 'pathname) t))
 
+
+(eval-when (compile eval)
+  (defun add-dir-sep (s &optional (i 0) (bp 0) (l (length s)))
+    (when (< i l)
+      (let ((x (aref s i)))
+	(append
+	 (if (eql x #\/)
+	     (if (zerop bp) (list #\[ x #\\ #\]) (list x #\\))
+	   (list x))
+	 (add-dir-sep s (1+ i) (case x (#\[ (1+ bp))(#\] (1- bp))(otherwise bp)) l)))))
+
+  (defun ads (s) #+winnt (coerce (add-dir-sep s) 'string) #-winnt s))
+
+(defconstant +dirsep+ (compile-regexp #.(ads "/")))
+
+(defconstant +glob-to-regexp-alist+ (list (cons #v"{[^}]*}" (lambda (x) (msub '((#\| . #\,)(#\( . #\{)(#\) . #\})) x)))
+					  (cons #v"\\[[^\\]*\\]"
+						(lambda (x)
+						  (string-concatenate "(" (substitute #\^ #\! (subseq x 0 2)) (subseq x 2) ")")))
+					  (cons #v"\\*" (lambda (x) #.(ads "([^/.]*)")))
+					  (cons #v"\\?" (lambda (x) #.(ads "([^/.])")))
+					  (cons #v"\\." (lambda (x) "\\."))))
+
+(defconstant +physical-pathname-defaults+ '(("" "" "")
+					    #+winnt("" "([A-Za-z]:)?" ":") #-winnt("" "()" "")
+					    ("" #.(ads "(/?([^/]+/)*)") "" "" #.(ads "([^/]+/)") "/")
+					    ("" #.(ads "([^/.]*)") "")
+					    ("." #.(ads "(\\.[^/]*)?") "")
+					    ("" "" "")))
+
+(defconstant +logical-pathname-defaults+  '(("" "([-0-9A-Z]+:)?" ":")
+					    ("" "" "")
+					    ("" "(;?((\\*?([-0-9A-Z]+\\*?)+|\\*|\\*\\*);)*)" "" "" "((\\*?([-0-9A-Z]+\\*?)+|\\*);)" ";")
+					    ("" "(\\*?([-0-9A-Z]+\\*?)+|\\*)?" "")
+					    ("." "(\\.(\\*?([-0-9A-Z]+\\*?)+|\\*))?" "")
+					    ("." "(\\.([1-9][0-9]*|newest|NEWEST|\\*))?" "")))
+
 (defun msub (a x) (if a (msub (cdr a) (substitute (caar a) (cdar a) x)) x))
 
-(defvar *glob-to-regexp-alist* (list (cons #v"{[^}]*}" (lambda (x) (msub '((#\| . #\,)(#\( . #\{)(#\) . #\})) x)))
-				     (cons #v"\\[[^\\]*\\]" (lambda (x)
-							      (concatenate 'string "("
-									   (substitute #\^ #\! (subseq x 0 2))
-									   (subseq x 2) ")")))
-				     (cons #v"\\*" (lambda (x) "([^/.]*)"))
-				     (cons #v"\\?" (lambda (x) "([^/.])"))
-				     (cons #v"\\." (lambda (x) "\\."))))
 
 (defun mglist (x &optional (b 0))
   (let* ((y (mapcan (lambda (z &aux (w (string-match (car z) x b)))
 		      (unless (eql w -1)
 			(list (list w (match-end 0) z))))
-		    *glob-to-regexp-alist*))
+		    +glob-to-regexp-alist+))
 	 (z (when y (reduce (lambda (y x) (if (< (car x) (car y)) x y)) y))))
     (when z
       (cons z (mglist x (cadr z))))))
 
 (defun mgsub (x &optional (l (mglist x)) (b 0) &aux (w (pop l)))
   (if w
-      (concatenate 'string
+      (string-concatenate
 		   (subseq x b (car w))
 		   (funcall (cdaddr w) (subseq x (car w) (cadr w)))
 		   (mgsub x l (cadr w)))
@@ -49,21 +78,10 @@
 ;    )
 )
 
-(defconstant +physical-pathname-defaults+ '(("" "" "")
-					    ("" "" "")
-					    ("" "(/?([^/]+/)*)" "" "" "([^/]+/)" "/")
-					    ("" "([^/.]*)" "")
-					    ("." "(\\.[^/]*)?" "")
-					    ("" "" "")))
-(defconstant +logical-pathname-defaults+  '(("" "([-0-9A-Z]+:)?" ":")
-					    ("" "" "")
-					    ("" "(;?((\\*?([-0-9A-Z]+\\*?)+|\\*|\\*\\*);)*)" "" "" "((\\*?([-0-9A-Z]+\\*?)+|\\*);)" ";")
-					    ("" "(\\*?([-0-9A-Z]+\\*?)+|\\*)?" "")
-					    ("." "(\\.(\\*?([-0-9A-Z]+\\*?)+|\\*))?" "")
-					    ("." "(\\.([1-9][0-9]*|newest|NEWEST|\\*))?" "")))
+
 
 (defun to-regexp-or-namestring (x rp lp)
-  (apply 'concatenate 'string
+  (apply 'string-concatenate
 	 (mapcan (lambda (x y) (elsub x y rp lp))
 		 x (if lp +logical-pathname-defaults+ +physical-pathname-defaults+))))
 
@@ -101,14 +119,14 @@
 (eval-when (compile eval)
   (defun strsym (p &rest r)
     (declare (:dynamic-extent r))
-    (intern (apply 'concatenate 'string (mapcar 'string-upcase r)) p)))
+    (intern (apply 'string-concatenate (mapcar 'string-upcase r)) p)))
 
 #.`(defun make-pathname (&key (host nil hostp) (device nil devicep) (directory nil directoryp)
 			      (name nil namep) (type nil typep) (version nil versionp)
 			      defaults (case :local) namestring &aux defaulted (def (when defaults (pathname defaults))))
      (declare (optimize (safety 1)))
      (check-type host (or (member nil :unspecific) string))
-     (check-type device (member nil :unspecific))
+     (check-type device (or (member nil :unspecific) string))
      (check-type directory (or (member nil :unspecific :wild) string list))
      (check-type name (or string (member nil :unspecific :wild)))
      (check-type type (or string (member nil :unspecific :wild)))
@@ -116,7 +134,8 @@
      (check-type defaults (or null pathname-designator))
      (check-type case (member :common :local))
      ,(flet ((def? (k) `(let* (,@(when (eq k 'host) `((def (or def *default-pathname-defaults*))))
-			       (nk (if ,(strsym :si k "P") ,k (progn (setq defaulted t) (when def (,(strsym :si "C-PATHNAME-" k) def)))))
+			       (nk (if ,(strsym :si k "P") ,k (when def (,(strsym :si "C-PATHNAME-" k) def))))
+			       (nk (progn (unless (eq ,k nk) (setq defaulted t)) nk))
 			       (nk (if (eq case :local) nk (progn (setq defaulted t) (toggle-case nk)))))
 			nk)))
 	`(let* ((h ,(def? 'host))
--- gcl-2.6.12.orig/lsp/gcl_parse_namestring.lsp
+++ gcl-2.6.12/lsp/gcl_parse_namestring.lsp
@@ -14,6 +14,7 @@
 (defun dir-conj (x) (if (eq x :relative) :absolute :relative))
 
 (defvar *up-key* :up)
+(defvar *canonicalized* nil)
 
 (defun mfr (x b i) (subseq x b i));  (make-array (- i b) :element-type 'character :displaced-to x :displaced-index-offset b)
 
@@ -30,15 +31,15 @@
 	 (z (if w (cdr w) z)))
     (if (eq z :up) *up-key* z)))
 
-(defun dir-parse (x sep sepfirst &optional (b 0))
+(defun dir-parse (x &optional lp (b 0))
   (when (stringp x)
-    (let ((i (search sep x :start2 b)));string-match spoils outer match results
-      (when i
-	(let* ((y (dir-parse x sep sepfirst (1+ i)))
+    (let ((i (string-match (if lp #v";" +dirsep+) x b)))
+      (unless (minusp i)
+	(let* ((y (dir-parse x lp (1+ i)))
 	       (z (element x b i :directory))
-	       (y (if z (cons z y) y)))
+	       (y (if z (cons z y) (progn (when (> i b) (setq *canonicalized* t)) y))))
 	  (if (zerop b)
-	      (cons (if (zerop i) sepfirst (dir-conj sepfirst)) y)
+	      (cons (if (if lp (plusp i) (zerop i)) :absolute :relative) y)
 	    y))))))
 
 (defun match-component (x i k &optional (boff 0) (eoff 0))
@@ -52,40 +53,37 @@
 
 (defconstant +generic-logical-pathname-regexp+ (compile-regexp (to-regexp-or-namestring (make-list (length +logical-pathname-defaults+)) t t)))
 
-(defun expand-home-dir (dir)
-  (cond ((and (eq (car dir) :relative) (stringp (cadr dir)) (eql #\~ (aref (cadr dir) 0)))
-	 (append (dir-parse (home-namestring (cadr dir)) "/" :absolute) (cddr dir)))
-	(dir)))
-
 (defun logical-pathname-parse (x &optional host def (b 0) (e (length x)))
-  (when (and (eql b (string-match +generic-logical-pathname-regexp+ x b e)) (eql (match-end 0) e))
-    (let ((mhost (match-component x 1 :host 0 -1)))
-      (when (and host mhost)
-	(unless (string-equal host mhost)
+  (when *pathname-logical* ;;accelerator
+    (when (and (eql b (string-match +generic-logical-pathname-regexp+ x b e)) (eql (match-end 0) e))
+      (let ((mhost (match-component x 1 :host 0 -1)))
+	(when (and host mhost)
+	  (unless (string-equal host mhost)
 	    (error 'error :format-control "Host part of ~s does not match ~s" :format-arguments (list x host))))
-      (let ((host (or host mhost (pathname-host def))))
-	(when (logical-pathname-host-p host)
-	  (let* ((dir (dir-parse (match-component x 2 :none) ";" :relative))
-		 (edir (expand-home-dir dir)))
-	  (make-pathname :host host
-			 :device :unspecific
-			 :directory edir
-			 :name (match-component x 6 :name)
-			 :type (match-component x 8 :type 1)
-			 :version (version-parse (match-component x 11 :version 1))
-			 :namestring (when (and mhost (eql b 0) (eql e (length x)) (eq dir edir)) x))))))))
-  
+	(let ((host (or host mhost (pathname-host def))))
+	  (when (logical-pathname-host-p host)
+	    (make-pathname :host host
+			   :device :unspecific
+			   :name (match-component x 6 :name)
+			   :type (match-component x 8 :type 1)
+			   :version (version-parse (match-component x 11 :version 1))
+			   :directory (dir-parse (match-component x 2 :none) t);must be last
+			   :namestring (when (and mhost (eql b 0) (eql e (length x))) x))))))))
+
 (defconstant +generic-physical-pathname-regexp+ (compile-regexp (to-regexp-or-namestring (make-list (length +physical-pathname-defaults+)) t nil)))
 
-(defun pathname-parse (x b e)
-  (when (and (eql b (string-match +generic-physical-pathname-regexp+ x b e)) (eql (match-end 0) e))
-    (let* ((dir (dir-parse (match-component x 1 :none) "/" :absolute))
-	   (edir (expand-home-dir dir)))
-      (make-pathname :directory edir
-		     :name (match-component x 3 :name)
-		     :type (match-component x 4 :type 1)
-		     :namestring (when (and (eql b 0) (eql e (length x)) (eq dir edir)) x)))))
+(defun expand-home-dir (dir)
+  (if (and (eq (car dir) :relative) (stringp (cadr dir)) (eql #\~ (aref (cadr dir) 0)))
+      (prog1 (append (dir-parse (home-namestring (cadr dir))) (cddr dir)) (setq *canonicalized* t))
+    dir))
 
+(defun pathname-parse (x b e &aux (*canonicalized* nil))
+  (when (and (eql b (string-match +generic-physical-pathname-regexp+ x b e)) (eql (match-end 0) e))
+    (make-pathname :device (match-component x 1 :none 0 -1)
+		   :name (match-component x 4 :name)
+		   :type (match-component x 5 :type 1)
+		   :directory (expand-home-dir (dir-parse (match-component x 2 :none)));must be last
+		   :namestring (unless *canonicalized* (when (and (eql b 0) (eql e (length x))) x)))))
 
 (defun path-stream-name (x)
   (check-type x pathname-designator)
--- gcl-2.6.12.orig/lsp/gcl_top.lsp
+++ gcl-2.6.12/lsp/gcl_top.lsp
@@ -581,27 +581,20 @@ First directory is checked for first nam
 
 (defvar *tmp-dir*)
 
-(defun wine-tmp-redirect ()
-  (let* ((s (find-symbol "*WINE-DETECTED*" (find-package "SYSTEM"))))
-    (when (and s (symbol-value s))
-      (list *system-directory*))))
-	 
 (defun ensure-dir-string (str)
   (if (eq (stat str) :directory)
       (coerce-slash-terminated str)
     str))
 
 (defun get-temp-dir ()
-  (dolist (x `(,@(wine-tmp-redirect) ,@(mapcar 'si::getenv '("TMPDIR" "TMP" "TEMP")) "/tmp" ""))
+  (dolist (x `(,@(mapcar 'si::getenv '("TMPDIR" "TMP" "TEMP")) "/tmp" ""))
     (when x
       (let ((x (coerce-slash-terminated x)))
 	(when (eq (stat x) :directory)
 	  (return-from get-temp-dir x))))))
 
-(defun get-path (s &aux (m (string-match "([^/ ]*)( |$)" s))(b (match-beginning 1))(e (match-end 1))
-		   (r (with-open-file (s (concatenate 'string "|which " (subseq s b e))) (read s nil 'eof))))
-  (if (eq r 'eof) s (concatenate 'string (string-downcase r) (subseq s e))))
-
+(defun get-path (s &aux (m (string-match "([^ ]*)( |$)" s))(b (match-beginning 1))(e (match-end 1)))
+  (string-concatenate (which (pathname-name (subseq s b e))) (subseq s e)))
 
 (defvar *cc* "cc")
 (defvar *ld* "ld")
@@ -609,7 +602,7 @@ First directory is checked for first nam
 
 (defvar *current-directory* *system-directory*)
 
-(defun current-directory-pathname nil (pathname (concatenate 'string (getcwd) "/")))
+(defun current-directory-pathname nil (pathname (coerce-slash-terminated (getcwd))))
 
 (defun set-up-top-level (&aux (i (argc)) tem)
   (declare (fixnum i))
@@ -627,9 +620,7 @@ First directory is checked for first nam
       (when dir
 	(setq *lib-directory* (coerce-slash-terminated dir)))))
   (unless (and *load-path* (equal tem *lib-directory*))
-    (setq *load-path* (cons (string-concatenate *lib-directory* "lsp/") *load-path*))
-    (setq *load-path* (cons (string-concatenate *lib-directory* "gcl-tk/") *load-path*))
-    (setq *load-path* (cons (string-concatenate *lib-directory*  "xgcl-2/") *load-path*)))
+    (mapc (lambda (x) (push (string-concatenate *lib-directory* x) *load-path*)) '("lsp/" "gcl-tk/" "xgcl-2/")))
   (unless (boundp '*system-directory*)
     (setq *system-directory* (namestring (truename (make-pathname :name nil :type nil :defaults (argv 0))))))))
 
--- gcl-2.6.12.orig/lsp/gcl_truename.lsp
+++ gcl-2.6.12/lsp/gcl_truename.lsp
@@ -4,11 +4,11 @@
   (labels ((frame (b e) (make-array (- n b) :element-type 'character
 				    :displaced-to str :displaced-index-offset b :fill-pointer (- e b)))
 	   (set-fr (fr e &aux (fr (or fr (frame 0 b)))) (setf (fill-pointer fr) e) fr))
-    (let* ((i (string-match #v"/" str b))
+    (let* ((i (string-match +dirsep+ str b))
 	   (fr (set-fr fr (if (eql i -1) n i)))
 	   (l (when (eq (stat fr) :link) (readlinkat 0 fr))))
       (cond (l (let ((b (if (eql #\/ (aref l 0)) 0 b)))
-		 (link-expand (concatenate 'string (set-fr fr b) l (frame (if (eql i -1) n i) n)) b)))
+		 (link-expand (string-concatenate (set-fr fr b) l (frame (if (eql i -1) n i) n)) b)))
 	    ((eql i -1) str)
 	    ((link-expand str (1+ i) n fr))))))
 
--- gcl-2.6.12.orig/makedefc.in
+++ gcl-2.6.12/makedefc.in
@@ -45,6 +45,7 @@ PRELINK_CHECK=@PRELINK_CHECK@
 
 NOTIFY=@NOTIFY@
 CC=@CC@
+GCL_CC=@GCL_CC@
 CFLAGS=@CFLAGS@
 LDFLAGS=@LDFLAGS@
 FINAL_CFLAGS=@FINAL_CFLAGS@
--- gcl-2.6.12.orig/o/bind.c
+++ gcl-2.6.12/o/bind.c
@@ -23,6 +23,8 @@ Foundation, 675 Mass Ave, Cambridge, MA
 	bind.c
 */
 
+#include <string.h>
+
 #include "include.h"
 
 static void
--- gcl-2.6.12.orig/o/fasdump.c
+++ gcl-2.6.12/o/fasdump.c
@@ -149,7 +149,7 @@ enum dump_type {
 
 /* given SHORT extract top code (say 4 bits) and bottom byte */
 #define TOP(i) (i >> SIZE_BYTE)
-#define BOTTOM(i) (i &  ~(~0 << SIZE_BYTE))
+#define BOTTOM(i) (i &  ~(~0UL << SIZE_BYTE))
 
 #define FASD_VERSION 2
 
@@ -328,7 +328,7 @@ getd(str)
 
       
 #define D_TYPE_OF(byt) \
-  ((enum dump_type )((unsigned int) byt & ~(~0 << SIZE_D_CODE)))
+  ((enum dump_type )((unsigned int) byt & ~(~0UL << SIZE_D_CODE)))
 
 /* this field may be the top of a short for length, or part of an extended
    code */
@@ -379,7 +379,7 @@ getd(str)
 
 
 
-#define MASK ~(~0 << 8)
+#define MASK ~(~0UL << 8)
 #define WRITE_BYTEI(x,i)  putc((((x) >> (i*SIZE_BYTE)) & MASK),fas_stream)
 
 #define PUTFIX(v_) Join(PUT,SIZEOF_LONG)(v_)
@@ -398,7 +398,7 @@ getd(str)
      WRITE_BYTEI(var,7);} while(0)
 
 #define PUT4(varx ) \
- do{int var= varx ; \
+ do{unsigned long var= varx ; \
      DPRINTF("{4byte:varx= %d}", var); \
        WRITE_BYTEI(var,0); \
      WRITE_BYTEI(var,1); \
@@ -406,14 +406,14 @@ getd(str)
      WRITE_BYTEI(var,3);} while(0)
 
 #define PUT2(var ) \
- do{int v=var; \
+ do{unsigned long v=var; \
      DPRINTF("{2byte:var= %d}", v); \
        WRITE_BYTEI(v,0); \
      WRITE_BYTEI(v,1); \
      } while(0)
 
 #define PUT3(var ) \
- do{int v=var; \
+ do{unsigned long v=var; \
      DPRINTF("{3byte:var= %d}", v); \
        WRITE_BYTEI(v,0); \
      WRITE_BYTEI(v,1); \
--- gcl-2.6.12.orig/o/file.d
+++ gcl-2.6.12/o/file.d
@@ -89,8 +89,8 @@ Foundation, 675 Mass Ave, Cambridge, MA
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
 #else
-#  include <windows.h>
 #  include <winsock2.h>
+#  include <windows.h>
 #endif
 #include <errno.h>
 
@@ -400,7 +400,8 @@ open_stream(object fn,enum smmode smm, o
       fclose(fp);
       if (if_exists==sKerror) FILE_ERROR(fn,"File exists");
       else if (if_exists==sKrename) {
-	massert(snprintf(FN2,sizeof(FN2),"%s.BAK",FN1)>=0);
+	massert(snprintf(FN2,sizeof(FN2),"%-*.*s~",(int)strlen(FN1)-1,(int)strlen(FN1)-1,FN1)>=0);
+	massert(!unlink(FN2));/*MinGW*/
 	massert(!rename(FN1,FN2));
 	if (!(fp=fopen(FN1,smm==smm_output ? "w" : "w+"))) cannot_create(fn);
       } else if (if_exists==sKrename_and_delete ||
--- gcl-2.6.12.orig/o/funlink.c
+++ gcl-2.6.12/o/funlink.c
@@ -322,10 +322,11 @@ call_proc(object sym, void **link, int a
 
     } else if (type_of(fun)==t_afun) {
 
-      ufixnum at=F_TYPES(fun->sfn.sfn_argd)>>F_TYPE_WIDTH;
-      ufixnum ma=F_MIN_ARGS(fun->sfn.sfn_argd);
-      ufixnum xa=F_MAX_ARGS(fun->sfn.sfn_argd);
-      ufixnum rt=F_RESULT_TYPE(fun->sfn.sfn_argd);
+      ufixnum ad=fun->sfn.sfn_argd;
+      ufixnum at=F_TYPES(ad)>>F_TYPE_WIDTH;
+      ufixnum ma=F_MIN_ARGS(ad);
+      ufixnum xa=F_MAX_ARGS(ad);
+      ufixnum rt=F_RESULT_TYPE(ad);
 
       nargs=SFUN_NARGS(argd);
       if (nargs<ma || nargs > xa || ((argd>>8)&0x3)!=rt || (argd>>12)!=at)
--- gcl-2.6.12.orig/o/hash.d
+++ gcl-2.6.12/o/hash.d
@@ -48,7 +48,7 @@ typedef unsigned char uchar;
 
 static ufixnum rtb[256];
 
-#define MASK(n) (~(~0L << (n)))
+#define MASK(n) (~(~0UL << (n)))
 
 static ufixnum
 ufixhash(ufixnum g) {
--- gcl-2.6.12.orig/o/main.c
+++ gcl-2.6.12/o/main.c
@@ -148,7 +148,7 @@ mbrk(void *v) {
     
 #if defined(__CYGWIN__)||defined(__MINGW32__)
 
-#include <Windows.h>
+#include <windows.h>
 
 static ufixnum
 get_phys_pages_no_malloc(char n) {
@@ -470,12 +470,6 @@ main(int argc, char **argv, char **envp)
   kcl_self = argv[0];
 #endif
 
-#ifdef __MINGW32__
-  {
-    char *s=kcl_self;
-    for (;*s;s++) if (*s=='\\') *s='/';
-  }
-#endif	
   *argv=kcl_self;
   
 #ifdef CAN_UNRANDOMIZE_SBRK
@@ -537,10 +531,6 @@ main(int argc, char **argv, char **envp)
   
   }
 
-#ifdef _WIN32
-  detect_wine();
-#endif
-
   sSAlisp_maxpagesA->s.s_dbind = make_fixnum(real_maxpage);
 
   ihs_push(Cnil);
--- gcl-2.6.12.orig/o/mingfile.c
+++ gcl-2.6.12/o/mingfile.c
@@ -1,57 +1,6 @@
 #include "include.h"
-#include "windows.h"
 #include "winsock2.h"
-
-extern object truename(object);
-extern object make_pathname();
-void Ldirectory ( void )
-{
-	char filename[MAXPATHLEN];
-	object *top=vs_top;
-	object path;
-	check_arg(1);
-	check_type_or_pathname_string_symbol_stream(&vs_base[0]);
-	path = vs_base[0] = coerce_to_pathname(vs_base[0]);
-	
-	if (vs_base[0]->pn.pn_name==Cnil && vs_base[0]->pn.pn_type==Cnil) {
-		coerce_to_filename(vs_base[0], filename);
-		strcat(filename, "*.*");
-	} else if (vs_base[0]->pn.pn_name==Cnil) {
-		vs_base[0]->pn.pn_name = sKwild;
-		coerce_to_filename(vs_base[0], filename);
-		vs_base[0]->pn.pn_name = Cnil;
-	} else if (vs_base[0]->pn.pn_type==Cnil) {
-		coerce_to_filename(vs_base[0], filename);
-		strcat(filename, ".*");
-	} else
-		coerce_to_filename(vs_base[0], filename);
-	{ WIN32_FIND_DATA data;
-	  HANDLE dirHandle = FindFirstFile(filename,&data);
-
-	if (dirHandle== INVALID_HANDLE_VALUE) {
-	  vs_base[0]=Cnil; return;
-	} else {
-	  do {
-	    if (strcmp(data.cFileName,"..") != 0 && strcmp(data.cFileName,".") != 0 ) {
-	      object name = make_simple_string(data.cFileName);
-	      object new =  coerce_to_pathname(name);
-	      vs_push(make_pathname(path->pn.pn_host,
-				    path->pn.pn_device,
-				    path->pn.pn_directory,
-				    new->pn.pn_name,
-				    new->pn.pn_type,
-				    new->pn.pn_version));
-	    }
-	  } while (FindNextFile(dirHandle,&data));
-	  FindClose(dirHandle);
-	}
-	vs_push(Cnil);
-	while (vs_top > top + 1)
-		stack_cons();
-	vs_base = top;
-
-	}
-}
+#include "windows.h"
 
 int
 mingwlisten(FILE *fp) {
--- gcl-2.6.12.orig/o/mingwin.c
+++ gcl-2.6.12/o/mingwin.c
@@ -2,6 +2,7 @@
 
 
 
+#include "winsock2.h"
 #include "windows.h"
 #include "errno.h"
 #include "signal.h"
@@ -923,20 +924,6 @@ sigprocmask (int how , const sigset_t *s
   return 0;
 }
   
-void
-fix_filename(object pathname, char *filename1) {
-
-  char *filename=filename1,*p=filename;
-  extern char *getwd();
-
-  while (*p) {
-    if (*p=='\\') *p='/';
-    p++;
-  }
-
-}
-
-
 char *GCLExeName ( void )
 {
     static char module_name_buf[128];
@@ -948,3 +935,35 @@ char *GCLExeName ( void )
     }
     return ( (char *) rv );
 }
+
+int
+vsystem(const char *command) {
+
+  STARTUPINFO s={0};
+  PROCESS_INFORMATION p={0};
+  long unsigned int e;
+  char *cmd=NULL,*r;
+
+  if (!strpbrk(command,"\"'$<>")) {
+
+    cmd=FN1;
+    massert((r=strpbrk(command," \n\t"))-command<sizeof(FN1));
+    memcpy(FN1,command,r-command);
+    FN1[r-command]=0;
+
+  } else {
+
+    massert(snprintf(FN1,sizeof(FN1),"cmd /c %s",command)>=0);
+    command=FN1;
+
+  }
+
+  massert(CreateProcess(cmd,(void *)command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW,NULL,NULL,&s,&p));
+  massert(!WaitForSingleObject(p.hProcess,INFINITE));
+  massert(GetExitCodeProcess(p.hProcess,&e));
+  massert(CloseHandle(p.hProcess));
+  massert(CloseHandle(p.hThread));
+
+  return e;
+
+}
--- gcl-2.6.12.orig/o/sfaslcoff.c
+++ gcl-2.6.12/o/sfaslcoff.c
@@ -47,7 +47,16 @@ struct scnhdr {
 #define ALLOC_SEC(sec) (sec->s_flags&(SEC_CODE|SEC_DATA|SEC_BSS))
 #define  LOAD_SEC(sec) (sec->s_flags&(SEC_CODE|SEC_DATA))
 
-#define STOP(s_,op_) ({char *_s=s_,_c=_s[8];_s[8]=0;op_;_s[8]=_c;})
+#define NM(sym_,tab_,nm_,op_)				\
+  ({char _c=0,*nm_;					\
+    if ((sym_)->n.n.n_zeroes)				\
+      {(nm_)=(sym_)->n.n_name;_c=(nm_)[8];(nm_)[8]=0;}	\
+    else						\
+      (nm_)=(tab_)+(sym_)->n.n.n_offset;		\
+    op_;						\
+    if (_c) (nm_)[8]=_c;				\
+  })
+
 
 struct reloc {
   union {
@@ -164,7 +173,7 @@ get_sym_value(const char *name) {
 static void
 relocate_symbols(struct syment *sym,struct syment *sye,struct scnhdr *sec1,char *st1) {
 
-  struct node *answ;
+  long value;
 
   for (;sym<sye;sym++) {
 
@@ -173,10 +182,9 @@ relocate_symbols(struct syment *sym,stru
 
     else if (!sym->n_scnum) {
 
-      if (sym->n.n.n_zeroes)
-	STOP(sym->n.n_name,sym->n_value=get_sym_value(sym->n.n_name));
-      else
-	sym->n_value=get_sym_value(st1+sym->n.n.n_offset);
+      NM(sym,st1,s,value=get_sym_value(s));
+
+      sym->n_value=value;
 
     }
 
@@ -256,10 +264,7 @@ load_self_symbols() {
     
     ns++;
 
-    if (sym->n.n.n_zeroes)
-      STOP(sym->n.n_name,sl+=strlen(sym->n.n_name)+1);
-    else
-      sl+=strlen(st1+sym->n.n.n_offset)+1;
+    NM(sym,st1,s,sl+=strlen(s)+1);
   
     sym+=sym->n_numaux;
 
@@ -274,10 +279,7 @@ load_self_symbols() {
     if (sym->n_sclass!=2 || sym->n_scnum<1)
       continue;
 
-    if (sym->n.n.n_zeroes)
-      STOP(sym->n.n_name,strcpy(st,sym->n.n_name));
-    else
-      strcpy(st,st1+sym->n.n.n_offset);
+    NM(sym,st1,s,strcpy(st,s));
     
     sec=sec1+sym->n_scnum-1;
     jj=sym->n_value+sec->s_vaddr+h->h_ibase;
@@ -343,7 +345,7 @@ find_init_string(const char *s) {
   struct syment *sy1,*sym,*sye;
   char *st1,*ste;
   void *st,*est;
-  object o;
+  object o=OBJNULL;
 
   massert(f=fopen(s,"r"));
   massert(st=get_mmap(f,&est));
@@ -358,13 +360,9 @@ find_init_string(const char *s) {
 
   for (sym=sy1;sym<sye;sym++) {
 
-    s=sym->n.n.n_zeroes ? sym->n.n_name : st1+sym->n.n.n_offset;
-    
-    if (!strncmp(s,"_init_",6)) {
-      if (sym->n.n.n_zeroes)
-	STOP((char *)s,o=make_simple_string(s));
-      else
-	o=make_simple_string(s);
+    NM(sym,st1,s,if (!strncmp(s,"_init_",6)) o=make_simple_string(s));
+
+    if (o!=OBJNULL) {
       massert(!un_mmap(st,&est));
       massert(!fclose(f));
       return o;
--- gcl-2.6.12.orig/o/sockets.c
+++ gcl-2.6.12/o/sockets.c
@@ -33,8 +33,8 @@ Foundation, 675 Mass Ave, Cambridge, MA
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
 #else
-#  include <windows.h>
 #  include <winsock2.h>
+#  include <windows.h>
 #endif
 
 #ifdef __STDC__
--- gcl-2.6.12.orig/o/unexnt.c
+++ gcl-2.6.12/o/unexnt.c
@@ -780,7 +780,7 @@ map_in_heap (char *filename)
     }
     
   size = get_committed_heap_size ();
-  file_base = MapViewOfFileEx (file_mapping, FILE_MAP_COPY, 0, 
+  file_base = MapViewOfFileEx (file_mapping, FILE_MAP_COPY|FILE_MAP_EXECUTE, 0,
 			       heap_index_in_executable, size,
 			       get_heap_start ());
   if (file_base != 0) 
@@ -794,7 +794,7 @@ map_in_heap (char *filename)
   CloseHandle (file_mapping);
 
   if (VirtualAlloc (get_heap_start (), get_committed_heap_size (),
-		    MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE) == NULL)
+		    MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE) == NULL)
     {
       i = GetLastError ();
       do_gcl_abort();
@@ -1057,7 +1057,7 @@ sbrk (ptrdiff_t increment)
 
       /* Commit more of our heap. */
       if (VirtualAlloc (data_region_end, size, MEM_COMMIT,
-			PAGE_READWRITE) == NULL)
+			PAGE_EXECUTE_READWRITE) == NULL)
 	return NULL;
       data_region_end += size;
 
--- gcl-2.6.12.orig/o/unixfsys.c
+++ gcl-2.6.12/o/unixfsys.c
@@ -21,6 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA
 
 #include <unistd.h>
 #include <errno.h>
+#include <string.h>
 
 #define IN_UNIXFSYS
 #include "include.h"
@@ -72,39 +73,43 @@ coerce_to_filename1(object spec, char *p
   memcpy(p,namestring->st.st_self,namestring->st.st_fillp);
   p[namestring->st.st_fillp]=0;
 
-#ifdef FIX_FILENAME
-  FIX_FILENAME(spec,p);
-#endif
-
 }
 
+#ifndef __MINGW32__
+static char GETPW_BUF[4096];
+#endif
+
 DEFUN_NEW("UID-TO-NAME",object,fSuid_to_name,SI,1,1,NONE,OI,OO,OO,OO,(fixnum uid),"") {
+#ifndef __MINGW32__
   struct passwd *pwent,pw;
   long r;
 
   massert((r=sysconf(_SC_GETPW_R_SIZE_MAX))>=0);
-  massert(r<=sizeof(FN1));/*FIXME maybe once at image startup*/
+  massert(r<=sizeof(GETPW_BUF));/*FIXME maybe once at image startup*/
 
-  massert(!getpwuid_r(uid,&pw,FN1,r,&pwent));
+  massert(!getpwuid_r(uid,&pw,GETPW_BUF,r,&pwent));
 
   RETURN1(make_simple_string(pwent->pw_name));
-
+#else
+  RETURN1(Cnil);
+#endif
 }
 
 DEFUN_NEW("HOME-NAMESTRING",object,fShome_namestring,SI,1,1,NONE,OO,OO,OO,OO,(object nm),"") {
 
+#ifndef __MINGW32__
   struct passwd *pwent,pw;
   long r;
 
   massert((r=sysconf(_SC_GETPW_R_SIZE_MAX))>=0);
-  massert(r<=sizeof(FN1));/*FIXME maybe once at image startup*/
+  massert(r<=sizeof(GETPW_BUF));/*FIXME maybe once at image startup*/
 
   if (nm->st.st_fillp==1)
 
     if ((pw.pw_dir=getenv("HOME")))
       pwent=&pw;
     else
-      massert(!getpwuid_r(getuid(),&pw,FN1,r,&pwent) && pwent);
+      massert(!getpwuid_r(getuid(),&pw,GETPW_BUF,r,&pwent) && pwent);
 
   else {
 
@@ -112,15 +117,19 @@ DEFUN_NEW("HOME-NAMESTRING",object,fShom
     memcpy(FN2,nm->st.st_self+1,nm->st.st_fillp-1);
     FN2[nm->st.st_fillp-1]=0;
 
-    massert(!getpwnam_r(FN2,&pw,FN1,r,&pwent) && pwent);
+    massert(!getpwnam_r(FN2,&pw,GETPW_BUF,r,&pwent) && pwent);
 
   }
 
-  massert(strlen(pwent->pw_dir)+2<sizeof(FN3));
-  memcpy(FN3,pwent->pw_dir,strlen(pwent->pw_dir));
-  FN3[strlen(pwent->pw_dir)]='/';
-  FN3[strlen(pwent->pw_dir)+1]=0;
+  massert((r=strlen(pwent->pw_dir))+2<sizeof(FN3));
+  memcpy(FN3,pwent->pw_dir,r);
+  FN3[r]='/';
+  FN3[r+1]=0;
   RETURN1(make_simple_string(FN3));
+#else
+  massert(snprintf(FN1,sizeof(FN1)-1,"%s%s",getenv("SystemDrive"),getenv("HOMEPATH"))>=0);
+  RETURN1(make_simple_string(FN1));
+#endif
 
 }
 
@@ -160,28 +169,61 @@ DEF_ORDINARY("DIRECTORY",sKdirectory,KEY
 DEF_ORDINARY("LINK",sKlink,KEYWORD,"");
 DEF_ORDINARY("FILE",sKfile,KEYWORD,"");
 
+object
+file_stream(object x) {
+  if (type_of(x)==t_stream)
+    switch(x->sm.sm_mode) {
+    case smm_input:
+    case smm_output:
+    case smm_io:
+    case smm_probe:
+      return x;
+    case smm_synonym:
+      return file_stream(x->sm.sm_object0->s.s_dbind);
+    default:
+      break;
+  }
+  return Cnil;
+}
+
+
 DEFUNM_NEW("STAT",object,fSstat,SI,1,1,NONE,OO,OO,OO,OO,(object x),"") {
 
   struct stat ss;
 
-  check_type_string(&x);
-  coerce_to_filename(x,FN1);
+  if (type_of(x)==t_string) {
+
+    coerce_to_filename(x,FN1);
 
 #ifdef __MINGW32__
-  {
-    char *p=FN1+strlen(FN1)-1;
-    for (;p>FN1 && *p=='/';p--)
-      *p=0;
-  }
+    {char *p=FN1+strlen(FN1)-1;for (;p>FN1 && *p=='/';p--) *p=0;}
 #endif
-  if (lstat(FN1,&ss))
+    if (lstat(FN1,&ss))
+      RETURN1(Cnil);
+  } else if ((x=file_stream(x))!=Cnil&&x->sm.sm_fp) {
+    if (fstat(fileno(x->sm.sm_fp),&ss))
+      RETURN1(Cnil);
+  } else
     RETURN1(Cnil);
-  else
-    RETURN4(S_ISDIR(ss.st_mode) ? sKdirectory :
-	    (S_ISLNK(ss.st_mode) ? sKlink : sKfile),
-	    make_fixnum(ss.st_size),
-	    make_fixnum(ss.st_mtime),
-	    make_fixnum(ss.st_uid));
+
+  RETURN4(S_ISDIR(ss.st_mode) ? sKdirectory :
+	  (S_ISLNK(ss.st_mode) ? sKlink : sKfile),
+	  make_fixnum(ss.st_size),
+	  make_fixnum(ss.st_mtime),
+	  make_fixnum(ss.st_uid));
+
+}
+
+DEFUN_NEW("FTELL",object,fSftell,SI,1,1,NONE,IO,OO,OO,OO,(object x),"") {
+
+  RETURN1((x=file_stream(x))!=Cnil&&x->sm.sm_fp ? (object)ftell(x->sm.sm_fp) : (object)0);
+
+}
+
+DEFUN_NEW("FSEEK",object,fSfseek,SI,2,2,NONE,OO,IO,OO,OO,(object x,fixnum pos),"") {
+
+  RETURN1((x=file_stream(x))!=Cnil&&x->sm.sm_fp&&!fseek(x->sm.sm_fp,pos,SEEK_SET) ? Ct : Cnil);
+
 }
 
 #include <sys/types.h>
@@ -198,7 +240,11 @@ DEFUN_NEW("READLINKAT",object,fSreadlink
   massert(z1<sizeof(FN1));
   memcpy(FN1,s->st.st_self,z1);
   FN1[z1]=0;
+#ifndef __MINGW32__
   massert((l=readlinkat(d ? dirfd((DIR *)d) : AT_FDCWD,FN1,FN2,sizeof(FN2)))>=0 && l<sizeof(FN2));
+#else
+  l=0;
+#endif
   FN2[l]=0;
   RETURN1(make_simple_string(FN2));
 
@@ -237,13 +283,15 @@ DEFUN_NEW("SETENV",object,fSsetenv,SI,2,
 DEFUN_NEW("OPENDIR",object,fSopendir,SI,1,1,NONE,IO,OO,OO,OO,(object x),"") {
   check_type_string(&x);
   coerce_to_filename(x,FN1);
-  return (object)opendir(FN1);
+  return (object)opendir(strlen(FN1) ? FN1 : "./");
 }
 
-#ifdef HAVE_D_TYPE
-  
+
 DEFUN_NEW("D-TYPE-LIST",object,fSd_type_list,SI,0,0,NONE,OI,OO,OO,OO,(void),"") {
-  RETURN1(list(8,
+  RETURN1(
+
+#ifdef HAVE_D_TYPE
+	  list(8,
 	       MMcons(make_fixnum(DT_BLK),make_keyword("BLOCK")),
 	       MMcons(make_fixnum(DT_CHR),make_keyword("CHAR")),
 	       MMcons(make_fixnum(DT_DIR),make_keyword("DIRECTORY")),
@@ -252,11 +300,21 @@ DEFUN_NEW("D-TYPE-LIST",object,fSd_type_
 	       MMcons(make_fixnum(DT_REG),make_keyword("FILE")),
 	       MMcons(make_fixnum(DT_SOCK),make_keyword("SOCKET")),
 	       MMcons(make_fixnum(DT_UNKNOWN),make_keyword("UNKNOWN"))
-	       ));
-}
+	       )
 #else
 #define DT_UNKNOWN 0
+#define DT_REG 1
+#define DT_DIR 2
+	  list(3,
+	       MMcons(make_fixnum(DT_REG),make_keyword("FILE")),
+	       MMcons(make_fixnum(DT_DIR),make_keyword("DIRECTORY")),
+	       MMcons(make_fixnum(DT_UNKNOWN),make_keyword("UNKNOWN"))
+	       )
 #endif
+	  );
+}
+
+
 
 DEFUN_NEW("READDIR",object,fSreaddir,SI,3,3,NONE,OI,IO,OO,OO,(fixnum x,fixnum y,object s),"") {
 
@@ -264,15 +322,21 @@ DEFUN_NEW("READDIR",object,fSreaddir,SI,
   object z;
   long tl;
   size_t l;
+  long d_type=DT_UNKNOWN;
+#ifdef HAVE_D_TYPE
+#define get_d_type(e,s) e->d_type
+#else
+#define get_d_type(e,s) \
+  ({struct stat ss;\
+    massert(snprintf(FN1,sizeof(FN1),"%-*.*s%s",s->st.st_fillp,s->st.st_fillp,s->st.st_self,e->d_name)>=0);\
+    lstat(FN1,&ss);S_ISDIR(ss.st_mode) ? DT_DIR : DT_REG;})
+#endif
 
   if (!x) RETURN1(Cnil);
 
   tl=telldir((DIR *)x);
 
-#ifndef HAVE_D_TYPE
-  y=DT_UNKNOWN;
-#endif
-  for (;(e=readdir((DIR *)x)) && y!=DT_UNKNOWN && e->d_type!=y;);
+  for (;(e=readdir((DIR *)x)) && y!=DT_UNKNOWN && y!=(d_type=get_d_type(e,s)););
   if (!e) RETURN1(Cnil);
 
   if (s==Cnil)
@@ -290,9 +354,7 @@ DEFUN_NEW("READDIR",object,fSreaddir,SI,
     }
   }
 
-#ifdef HAVE_D_TYPE
-  if (y==DT_UNKNOWN) z=MMcons(z,make_fixnum(e->d_type));
-#endif
+  if (y==DT_UNKNOWN) z=MMcons(z,make_fixnum(d_type));
 
   RETURN1(z);
 
--- gcl-2.6.12.orig/o/unixsys.c
+++ gcl-2.6.12/o/unixsys.c
@@ -24,10 +24,14 @@ Foundation, 675 Mass Ave, Cambridge, MA
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifndef __MINGW32__
 #include <sys/wait.h>
+#endif
 
 #include "include.h"
 
+#ifndef __MINGW32__
+
 int
 vsystem(const char *command) {
 
@@ -43,12 +47,13 @@ vsystem(const char *command) {
 
   else {
 
-    z=alloca(n);
-    memcpy(z,command,n);
+    massert(n<sizeof(FN1));
+    memcpy((z=FN1),command,n);
     for (j=1,c=z;strtok(c,spc);c=NULL,j++);
 
     memcpy(z,command,n);
-    p1=alloca(j*sizeof(*p1));
+    massert(j*sizeof(*p1)<sizeof(FN2));
+    p1=(void *)FN2;
     for (pp=p1,c=z;(*pp=strtok(c,spc));c=NULL,pp++);
 
   }
@@ -68,6 +73,7 @@ vsystem(const char *command) {
   return s;
 
 }
+#endif
 
 
 #ifdef ATT3B2
@@ -104,104 +110,10 @@ char *command;
 }
 #endif
 
-#ifdef _WIN32
-
-DEFVAR("*WINE-DETECTED*",sSAwine_detectedA,SI,Cnil,"");
-
-#include "windows.h"
-
-static int mpid;
-
-void
-close_msys() {
-
-  msystem("");
-
-}
-
-void
-detect_wine() {
-
-  char b[4096];
-  struct stat ss;
-  const char *s="/proc/self/status";
-  FILE *f;
-  object o;
-
-  sSAwine_detectedA->s.s_dbind=Cnil;
-
-  if (stat(s,&ss))
-    return;
-
-  massert(f=fopen(s,"r"));
-  massert(fscanf(f,"%s",b)==1);
-  massert(fscanf(f,"%s",b)==1);
-  massert(!fclose(f));
-
-  if (strncmp("wineserver",b,9))
-    return;
-
-  massert(o=sSAsystem_directoryA->s.s_dbind);
-  massert(o!=Cnil);
-  mpid=getpid();
-  
-  massert(snprintf(b,sizeof(b),"%-.*smsys /tmp/ out%0d tmp%0d log%0d",
-		   o->st.st_fillp,o->st.st_self,mpid,mpid,mpid)>0);
-  massert(!psystem(b));
-
-  sSAwine_detectedA->s.s_dbind=Ct;
-  
-  massert(!atexit(close_msys));
-  
-}
-#endif  
-
 int
 msystem(const char *s) {
 
-  int r;
-
-#ifdef _WIN32
-
-  if (sSAwine_detectedA->s.s_dbind==Ct) {
-
-    char b[4096],b1[4096],c;
-    FILE *fp;
-
-    massert(snprintf(b,sizeof(b),"/tmp/out%0d",mpid)>0);
-    massert(snprintf(b1,sizeof(b1),"%s1",b)>0);
-
-    massert(fp=fopen(b1,"w"));
-    massert(fprintf(fp,"%s",s)>=0);
-    massert(!fclose(fp));
-
-    massert(MoveFileEx(b1,b,MOVEFILE_REPLACE_EXISTING));
-    
-    if (!*s)
-      return 0;
-    
-    for (;;Sleep(100)) {
-      
-      massert(fp=fopen(b,"r"));
-      massert((c=fgetc(fp))!=EOF);
-      if (c!=s[0]) {
-	massert(ungetc(c,fp)!=EOF);
-	break;
-      }
-      massert(!fclose(fp));
-      
-    }
-    
-    massert(fscanf(fp,"%d",&r)==1);
-    massert(!fclose(fp));
-
-  } else
-
-#endif
-
-    r=psystem(s);
-
-  return r;
+  return psystem(s);
 
 }
 
--- gcl-2.6.12.orig/unixport/makefile
+++ gcl-2.6.12/unixport/makefile
@@ -77,8 +77,8 @@ sys_init.lsp: sys_init.lsp.in
 		-e "s#@LI-MINVERS@#`cat ../minvers | cut -f1 -d.`#1" \
 		-e "s#@LI-MAJVERS@#`cat ../majvers`#1" \
 		-e "s#@LI-RELEASE@#`cat ../release`#1" \
-		-e "s#@LI-CC@#\"$(CC) -c $(FINAL_CFLAGS)\"#1" \
-		-e "s#@LI-LD@#\"$(CC) $(LD_FLAGS) -o \"#1" \
+		-e "s#@LI-CC@#\"$(GCL_CC) -c $(FINAL_CFLAGS)\"#1" \
+		-e "s#@LI-LD@#\"$(GCL_CC) $(LD_FLAGS) -o \"#1" \
 		-e "s#@LI-LD-LIBS@#\" $(LD_LIBS_PRE) -l$* $(LD_LIBS_POST)\"#1" \
 		-e "s#@LI-OPT-THREE@#\"$(O3FLAGS)\"#1" \
 		-e "s#@LI-OPT-TWO@#\"$(O2FLAGS)\"#1" \
@@ -92,7 +92,7 @@ saved_%:raw_% $(RSYM) sys_init.lsp raw_%
 
 	cp sys_init.lsp foo
 	echo "(unless si::*quit-tags* (in-package \"USER\")(system:save-system \"$@\"))" >>foo
-	ar x lib$*.a $$(ar t lib$*.a |grep ^gcl_)
+	j=$$(ar t lib$*.a |grep ^gcl_);[ "$$j" = "" ] || ar x lib$*.a $$j #accelerator
 	$(PORTDIR)/raw_$*$(EXE) $(PORTDIR)/ -libdir $(GCLDIR)/ < foo
 #       check that saved image can be prelinked
 	[ "$(PRELINK_CHECK)" = "" ] || \
--- gcl-2.6.12.orig/unixport/sys.c
+++ gcl-2.6.12/unixport/sys.c
@@ -15,16 +15,6 @@ ar_init_fn(void (fn)(void),const char *s
   if (stat(s,&ss)) {
     assert(snprintf(b,sizeof(b),"ar x %-.*slib%sgcl.a %s",sysd->st.st_fillp,sysd->st.st_self,FLAVOR,s)>0);
     assert(!msystem(b));
-#ifdef _WIN32
-    if (sSAwine_detectedA->s.s_dbind!=Cnil) {
-      char *n;
-      unsigned l;
-      l=strlen(s)+6;
-      n=alloca(l);
-      snprintf(n,l,"/tmp/%s",s);
-      s=(void *)n;
-    }
-#endif
   }
   gcl_init_or_load1(fn,s);
   assert(!unlink(s));