From a523caeebf90fe1434e78c99f868fae8dcc57ed8 Mon Sep 17 00:00:00 2001
From: "Taylor R. Campbell" <net/mumble/campbell>
Date: Wed, 4 Apr 2007 05:08:19 +0000
Subject: [PATCH] Very belatedly, many changes to smooth many rough edges with
 the C back end.  It should now be possible to bootstrap and install the
 system using the C back end much more cleanly, by the following steps:

  # Prepare the tree for compiling from C.
  ./Setup.sh
  ./configure --enable-native-code=c
  make c

  # Optionally, clean everything except the bare minimum of the C code
  # to generate a distribution tree.  Doing so requires reconfiguring.
  make c-clean
  # ...distribute the tree..
  ./configure --enable-native-code=c

  # Make the system from C, without needing an existing Scheme
  # installation for bootstrapping.
  make

  # Install.
  make install
---
 v7/dist/make-c-files                          |  94 ++++++++++
 v7/src/Clean.sh                               |   7 +-
 v7/src/Makefile.in                            |  20 ++-
 v7/src/Setup.sh                               |   8 +-
 v7/src/compiler/Clean.sh                      |  17 +-
 v7/src/compiler/configure                     |   4 +-
 v7/src/configure.ac                           |  20 ++-
 v7/src/cref/Makefile.in                       |   8 +-
 v7/src/edwin/Clean.sh                         |  17 +-
 v7/src/edwin/Makefile.in                      |   7 +-
 v7/src/edwin/autold.scm                       |  85 +++++----
 v7/src/etc/Clean.sh                           |  25 ++-
 v7/src/etc/c-boot-compiler.sh                 |  91 ++++++++++
 v7/src/etc/c-build-bands.sh                   |  49 ++++++
 v7/src/etc/c-bundle.sh                        | 144 +++++++++++++++
 v7/src/etc/c-compile.scm                      |  72 ++++++++
 v7/src/etc/c-compile.sh                       |  44 +++++
 v7/src/etc/c-initial-bands.sh                 |  40 +++++
 v7/src/etc/{script.scm => c-prepare.scm}      |  35 ++--
 v7/src/etc/c-prepare.sh                       |  39 ++++
 v7/src/etc/optiondb.scm                       |  46 ++---
 v7/src/imail/Makefile.in                      |   8 +-
 v7/src/imail/load.scm                         |   3 +-
 v7/src/microcode/Clean.sh                     |   4 +-
 v7/src/microcode/compinit.c                   |  83 ---------
 v7/src/microcode/configure.ac                 |  18 +-
 v7/src/microcode/make-compinit                |   4 -
 v7/src/microcode/makegen/Makefile.in.in       |  32 ++--
 v7/src/microcode/makegen/bundles-liarc.scm    |  88 ++++++++++
 v7/src/microcode/makegen/dirs-liarc.scm       |  14 +-
 .../{liarc-rules-2 => liarc-base-rules}       |  17 +-
 v7/src/microcode/makegen/makegen.scm          | 166 ++++++++++++++----
 v7/src/microcode/makegen/pkds-liarc.scm       |  33 ++++
 v7/src/runtime/Makefile.in                    |   7 +-
 v7/src/runtime/packag.scm                     |  15 +-
 v7/src/sos/Makefile.in                        |   8 +-
 v7/src/sos/load.scm                           |   3 +-
 v7/src/ssp/Makefile.in                        |   8 +-
 v7/src/ssp/load.scm                           |   3 +-
 v7/src/star-parser/Makefile.in                |   8 +-
 v7/src/xdoc/Makefile.in                       |   8 +-
 v7/src/xdoc/load.scm                          |   3 +-
 v7/src/xml/Makefile.in                        |   8 +-
 v7/src/xml/load.scm                           |   3 +-
 44 files changed, 1133 insertions(+), 283 deletions(-)
 create mode 100644 v7/dist/make-c-files
 create mode 100755 v7/src/etc/c-boot-compiler.sh
 create mode 100755 v7/src/etc/c-build-bands.sh
 create mode 100755 v7/src/etc/c-bundle.sh
 create mode 100644 v7/src/etc/c-compile.scm
 create mode 100755 v7/src/etc/c-compile.sh
 create mode 100755 v7/src/etc/c-initial-bands.sh
 rename v7/src/etc/{script.scm => c-prepare.scm} (60%)
 create mode 100755 v7/src/etc/c-prepare.sh
 delete mode 100644 v7/src/microcode/compinit.c
 delete mode 100755 v7/src/microcode/make-compinit
 create mode 100644 v7/src/microcode/makegen/bundles-liarc.scm
 rename v7/src/microcode/makegen/{liarc-rules-2 => liarc-base-rules} (72%)
 create mode 100644 v7/src/microcode/makegen/pkds-liarc.scm

diff --git a/v7/dist/make-c-files b/v7/dist/make-c-files
new file mode 100644
index 000000000..6751db37f
--- /dev/null
+++ b/v7/dist/make-c-files
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# $Id: make-c-files,v 1.1 2007/04/04 05:08:18 riastradh Exp $
+#
+# Copyright 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+if [ $# -gt 3 ]; then
+    echo "usage: ${0} [TYPE [VERSION [DESTINATION]]]"
+    exit 1
+fi
+
+TYPE="${1:-std}"
+VERSION="${2}"
+DESTINATION="${3}"
+
+case "${TYPE}" in
+(6001 | all | std)
+    ;;
+(snapshot)
+    [ "${VERSION}" ] || VERSION="snapshot"
+    ;;
+(*)
+    echo "Unknown distribution type: ${TYPE}"
+    echo "Valid types: std all 6001 snapshot"
+    exit 1
+    ;;
+esac
+
+if [ "${VERSION}" = "snapshot" ]; then
+    VERSION=$(date +%Y%m%d)
+fi
+
+DIST_DIR="/scheme/v7/dist"
+
+. "${DIST_DIR}/release-prefix"
+
+TL_DIR="$(pwd)"
+
+C_DIR_REL="$(get_release_prefix "${VERSION}")"
+C_DIR="${TL_DIR}/${C_DIR_REL}"
+SRC_FILE="${SRC_FILE}.tar.gz"
+STAMP_C="${TL_DIR}/stamp-c"
+
+if [ ! -f "${SRC_FILE}" ]; then
+    echo "No source file: ${SRC_FILE}"
+    exit 1
+fi
+
+if [ ! -f "${STAMP_BUILD}" ]; then
+    rm -rf "${C_DIR}"
+
+    tar xzf "${SRC_FILE}"
+
+    cd "${C_DIR}/src"
+    ./configure --enable-native-code=c
+    make c
+    make c-clean
+fi
+
+tarfile="${C_DIR}-c.tar.gz"
+zipfile="${C_DIR}-c.zip"
+
+rm -f "${tarfile}"
+rm -f "${zipfile}"
+
+tar cvzf "${tarfile}" "${C_DIR}"
+
+for S in $(find ${C_DIR} -type l); do
+    [ ! -r "${S}" ] && rm -f "${S}"
+done
+
+zip -rl "${zipfile}" "${C_DIR}"
+chmod -w "${zipfile}"
+
+rm -rf "${C_DIR}"
diff --git a/v7/src/Clean.sh b/v7/src/Clean.sh
index a63b2b57b..3756e6b8b 100755
--- a/v7/src/Clean.sh
+++ b/v7/src/Clean.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Clean.sh,v 1.10 2007/01/05 21:19:20 cph Exp $
+# $Id: Clean.sh,v 1.11 2007/04/04 05:08:18 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -33,6 +33,7 @@ fi
 
 COMMAND=$1
 shift
+SUBDIRS="$@"
 
 FULL=no
 DIST=no
@@ -43,7 +44,7 @@ mostlyclean)
 clean)
     FULL=yes
     ;;
-distclean)
+distclean | c-clean)
     FULL=yes
     DIST=yes
     ;;
@@ -73,7 +74,7 @@ if [ ${MAINTAINER} = yes ]; then
     rm -rf configure lib autom4te.cache
 fi
 
-for SUBDIR; do
+for SUBDIR in ${SUBDIRS}; do
     if test -x ${SUBDIR}/Clean.sh; then
 	echo "making ${COMMAND} in ${SUBDIR}"
 	( cd ${SUBDIR} && ./Clean.sh ${COMMAND} ) || exit 1
diff --git a/v7/src/Makefile.in b/v7/src/Makefile.in
index 1f49c4a4b..9ab035d08 100644
--- a/v7/src/Makefile.in
+++ b/v7/src/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.28 2007/01/05 21:19:20 cph Exp $
+# $Id: Makefile.in,v 1.29 2007/04/04 05:08:18 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -68,11 +68,24 @@ INSTALLED_SUBDIRS = microcode runtime cref edwin imail sos ssp star-parser \
 AUXDIR = @AUXDIR@
 EDETC = $(AUXDIR)/edwin/etc
 
+COMPILE_SCRIPT = @COMPILE_SCRIPT@
+BUILD_BANDS_SCRIPT = @BUILD_BANDS_SCRIPT@
 
 all:
 	( cd microcode && $(MAKE) all )
-	$(srcdir)/etc/compile.sh $(srcdir)
-	$(srcdir)/etc/build-bands.sh
+	$(srcdir)/etc/$(COMPILE_SCRIPT) $(srcdir)
+	( cd microcode && $(MAKE) liarc-bundles )
+	$(srcdir)/etc/$(BUILD_BANDS_SCRIPT)
+
+c: boot-compiler.com
+	$(srcdir)/etc/c-prepare.sh
+
+boot-compiler.com:
+	$(srcdir)/etc/c-boot-compiler.sh
+
+c-clean:
+	-rm -f boot-compiler.com
+	$(srcdir)/Clean.sh $@ $(SUBDIRS)
 
 mostlyclean clean distclean maintainer-clean:
 	$(srcdir)/Clean.sh $@ $(SUBDIRS)
@@ -94,3 +107,4 @@ install:
 	$(INSTALL_DATA) $(srcdir)/etc/TUTORIAL $(DESTDIR)$(EDETC)/.
 
 .PHONY: all mostlyclean clean distclean maintainer-clean tags TAGS install
+.PHONY: c c-clean
diff --git a/v7/src/Setup.sh b/v7/src/Setup.sh
index 133ac47d1..0e4e610a9 100755
--- a/v7/src/Setup.sh
+++ b/v7/src/Setup.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Setup.sh,v 1.16 2007/01/05 21:19:20 cph Exp $
+# $Id: Setup.sh,v 1.17 2007/04/04 05:08:18 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -48,6 +48,12 @@ maybe_link lib/edwin/etc/TUTORIAL ../../../etc/TUTORIAL
 maybe_link lib/edwin/etc/mime.types ../../../etc/mime.types
 maybe_link lib/edwin/autoload ../../edwin
 
+# lib/shared
+maybe_mkdir lib/shared
+for BUNDLE in sf+compiler edwin 6001 cref imail sos ssp xdoc xml; do
+    maybe_link "lib/shared/${BUNDLE}.so" "../../microcode/${BUNDLE}.so"
+done
+
 for SUBDIR in 6001 compiler cref edwin imail rcs runtime runtime-check \
               sf sos ssp star-parser win32 xdoc xml microcode; do
     echo "setting up ${SUBDIR}"
diff --git a/v7/src/compiler/Clean.sh b/v7/src/compiler/Clean.sh
index f17ad5191..3b14ce3e3 100755
--- a/v7/src/compiler/Clean.sh
+++ b/v7/src/compiler/Clean.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Clean.sh,v 1.12 2007/01/12 06:19:49 cph Exp $
+# $Id: Clean.sh,v 1.13 2007/04/04 05:08:18 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -36,17 +36,26 @@ export TOPDIR
 CLEANSH=${TOPDIR}/etc/Clean.sh
 "${CLEANSH}" "${1}" rm-pkg
 
+case "${1}" in
+c-clean)
+    SUBDIR_CMDS="rm-bin rm-com-sans-c"
+    ;;
+*)
+    SUBDIR_CMDS="rm-bin rm-com"
+    ;;
+esac
+
 for SUBDIR in back base fggen fgopt machine rtlbase rtlgen rtlopt; do
     if [ -d "${SUBDIR}" ]; then
 	echo "making ${1} in ${SUBDIR}"
-	(cd "${SUBDIR}" && "${CLEANSH}" "${1}" rm-bin rm-com)
+	(cd "${SUBDIR}" && "${CLEANSH}" "${1}" "${SUBDIR_CMDS}")
     fi
 done
 
 case "${1}" in
-distclean | maintainer-clean)
+distclean | maintainer-clean | c-clean)
     rm -f machine compiler.cbf compiler.pkg compiler.sf
-    "${CLEANSH}" "${1}" rm-bin rm-com
+    "${CLEANSH}" "${1}" "${SUBDIR_CMDS}"
     ;;
 esac
 
diff --git a/v7/src/compiler/configure b/v7/src/compiler/configure
index 6e4e46867..03066900b 100755
--- a/v7/src/compiler/configure
+++ b/v7/src/compiler/configure
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: configure,v 1.12 2007/02/05 18:43:08 cph Exp $
+# $Id: configure,v 1.13 2007/04/04 05:08:18 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -81,7 +81,7 @@ ln -s "machines/${MACHINE}" machine
 
 LINKS="compiler.cbf compiler.pkg compiler.sf"
 if test "${MACHINE}" = C; then
-    LINKS="${LINKS} make.so"
+    LINKS="${LINKS} make.so make.dylib"
 else
     LINKS="${LINKS} make.com"
 fi
diff --git a/v7/src/configure.ac b/v7/src/configure.ac
index 7b32c8fb5..0e156a210 100644
--- a/v7/src/configure.ac
+++ b/v7/src/configure.ac
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT([MIT/GNU Scheme], [7.7.91], [bug-mit-scheme@gnu.org], [mit-scheme])
-AC_REVISION([$Id: configure.ac,v 1.6 2007/01/12 06:19:45 cph Exp $])
+AC_REVISION([$Id: configure.ac,v 1.7 2007/04/04 05:08:18 riastradh Exp $])
 AC_CONFIG_SRCDIR([microcode/boot.c])
 AC_PROG_MAKE_SET
 
@@ -31,6 +31,24 @@ USA.
 AC_ARG_ENABLE([native-code],
     AS_HELP_STRING([--enable-native-code],
 	[Support native compiled code if available [[yes]]]))
+: ${enable_native_code='yes'}
+
+case ${enable_native_code} in
+c)
+    COMPILE_SCRIPT=c-compile.sh
+    BUILD_BANDS_SCRIPT=c-build-bands.sh
+    INSTALL_COM=:
+    ;;
+*)
+    COMPILE_SCRIPT=compile.sh
+    BUILD_BANDS_SCRIPT=build-bands.sh
+    INSTALL_COM='$(INSTALL_DATA)'
+    ;;
+esac
+
+AC_SUBST(COMPILE_SCRIPT)
+AC_SUBST(BUILD_BANDS_SCRIPT)
+AC_SUBST(INSTALL_COM)
 
 AC_PROG_INSTALL
 AC_PROG_LN_S
diff --git a/v7/src/cref/Makefile.in b/v7/src/cref/Makefile.in
index d2d9fcec7..763cec443 100644
--- a/v7/src/cref/Makefile.in
+++ b/v7/src/cref/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.8 2007/01/05 21:19:23 cph Exp $
+# $Id: Makefile.in,v 1.9 2007/04/04 05:08:18 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -54,6 +54,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -68,7 +69,10 @@ include ../Makefile.std
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(CREF_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(CREF_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(CREF_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(CREF_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(CREF_DIR)/.
 	$(INSTALL_DATA) cref-unx.pkd $(DESTDIR)$(CREF_DIR)/.
 
diff --git a/v7/src/edwin/Clean.sh b/v7/src/edwin/Clean.sh
index 2109a56f0..71769658f 100755
--- a/v7/src/edwin/Clean.sh
+++ b/v7/src/edwin/Clean.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Clean.sh,v 1.12 2007/01/05 21:19:23 cph Exp $
+# $Id: Clean.sh,v 1.13 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -31,9 +31,18 @@ if [ $# -ne 1 ]; then
     exit 1
 fi
 
-../etc/Clean.sh "${1}" rm-bin rm-com
+../etc/Clean.sh "${1}"
 
-echo "rm -f edwin-unx.* edwin-w32.* edwin-os2.* edwin.bld"
-rm -f edwin-unx.* edwin-w32.* edwin-os2.* edwin.bld
+echo "rm -rf edwin.bld"
+rm -f edwin.bld
+
+echo "rm -f edwin-unx.crf edwin-w32.crf edwin-os2.crf"
+rm -f edwin-unx.crf edwin-w32.crf edwin-os2.crf
+
+echo "rm -f edwin-unx.pkd edwin-w32.pkd edwin-os2.pkd"
+rm -f edwin-unx.pkd edwin-w32.pkd edwin-os2.pkd
+
+echo "rm -f edwin-unx.fre edwin-w32.fre edwin-os2.fre"
+rm -f edwin-unx.fre edwin-w32.fre edwin-os2.fre
 
 exit 0
diff --git a/v7/src/edwin/Makefile.in b/v7/src/edwin/Makefile.in
index 9b76d58fb..7bfd4b5ab 100644
--- a/v7/src/edwin/Makefile.in
+++ b/v7/src/edwin/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.12 2007/01/05 21:19:23 cph Exp $
+# $Id: Makefile.in,v 1.13 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -59,6 +59,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,8 +91,8 @@ install:
 	-rm -rf $(DESTDIR)$(EODIR)
 	$(mkinstalldirs) $(DESTDIR)$(EODIR)
 	@for F in $(EDOPTS); do \
-	    echo "$(INSTALL_DATA) $${F}.com $(DESTDIR)$(EODIR)/.";\
-	    $(INSTALL_DATA) $${F}.com $(DESTDIR)$(EODIR)/.;\
+	    echo "$(INSTALL_COM) $${F}.com $(DESTDIR)$(EODIR)/.";\
+	    $(INSTALL_COM) $${F}.com $(DESTDIR)$(EODIR)/.;\
 	done
 	@for F in $(EDOPTS); do \
 	    REL="../../SRC/edwin/$${F}.bci";\
diff --git a/v7/src/edwin/autold.scm b/v7/src/edwin/autold.scm
index 2a7a98138..5744ccea4 100644
--- a/v7/src/edwin/autold.scm
+++ b/v7/src/edwin/autold.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: autold.scm,v 1.68 2007/01/05 21:19:23 cph Exp $
+$Id: autold.scm,v 1.69 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -151,6 +151,33 @@ USA.
 	    (hook)
 	    (loop))))
     (if entry (loop))))
+
+(define (load-library library)
+  (for-each (lambda (entry)
+	      (let ((file (car entry))
+		    (environment (->environment (cadr entry)))
+		    (purify? (or (null? (cddr entry)) (caddr entry))))
+		(cond (((let-syntax ((ucode-primitive
+				      (sc-macro-transformer
+				       (lambda (form environment)
+					 environment
+					 (apply make-primitive-procedure
+						(cdr form))))))
+			  (ucode-primitive initialize-c-compiled-block 1))
+			(string-append "edwin_" file))
+		       => (lambda (obj)
+			    (if purify? (purify obj))
+			    (scode-eval obj environment)))
+		      (else
+		       (load (merge-pathnames file (edwin-binary-directory))
+			     environment
+			     'DEFAULT
+			     purify?)))))
+	    (cdr library))
+  (if (not (memq (car library) loaded-libraries))
+      (set! loaded-libraries
+	    (cons (car library) loaded-libraries)))
+  (run-library-load-hooks! (car library)))
 
 ;;;; Loading
 
@@ -176,41 +203,27 @@ Second arg is prefix arg when called interactively."
   (let ((force? (if (default-object? force?) #f force?))
 	(interactive? (if (default-object? interactive?) #f interactive?)))
     (let ((do-it
-	   (lambda (library)
-	     (let ((directory (edwin-binary-directory)))
-	       (for-each
-		(lambda (entry)
-		  (load (merge-pathnames (car entry) directory)
-			(cadr entry)
-			'DEFAULT
-			(or (null? (cddr entry)) (caddr entry))))
-		(cdr library)))
-	     (if (not (memq (car library) loaded-libraries))
-		 (set! loaded-libraries
-		       (cons (car library) loaded-libraries)))
-	     (run-library-load-hooks! (car library)))))
-      (let ((do-it
-	     (lambda ()
-	       (let ((library (assq name known-libraries)))
-		 (if (not library)
-		     (error "Unknown library name:" name))
-		 (if interactive?
-		     (with-output-to-transcript-buffer
-		      (lambda ()
-			(bind-condition-handler (list condition-type:error)
-			    evaluation-error-handler
-			  (lambda ()
-			    (fluid-let ((load/suppress-loading-message? #t))
-			      ((message-wrapper #f "Loading " (car library))
-			       (lambda ()
-				 (do-it library))))))))
-		     (do-it library))))))
-	(cond ((not (library-loaded? name))
-	       (do-it))
-	      ((not force?)
-	       (if interactive? (message "Library already loaded: " name)))
-	      ((not (eq? force? 'NO-WARN))
-	       (do-it)))))))
+	   (lambda ()
+	     (let ((library (assq name known-libraries)))
+	       (if (not library)
+		   (error "Unknown library name:" name))
+	       (if interactive?
+		   (with-output-to-transcript-buffer
+		       (lambda ()
+			 (bind-condition-handler (list condition-type:error)
+			     evaluation-error-handler
+			   (lambda ()
+			     (fluid-let ((load/suppress-loading-message? #t))
+			       ((message-wrapper #f "Loading " (car library))
+				(lambda ()
+				  (load-library library))))))))
+		   (load-library library))))))
+      (cond ((not (library-loaded? name))
+	     (do-it))
+	    ((not force?)
+	     (if interactive? (message "Library already loaded: " name)))
+	    ((not (eq? force? 'NO-WARN))
+	     (do-it))))))
 
 (define-command load-file
   "Load the Edwin binary file FILENAME.
diff --git a/v7/src/etc/Clean.sh b/v7/src/etc/Clean.sh
index 0336b206c..56c39d5e6 100755
--- a/v7/src/etc/Clean.sh
+++ b/v7/src/etc/Clean.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Clean.sh,v 1.16 2007/01/05 21:19:25 cph Exp $
+# $Id: Clean.sh,v 1.17 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -28,7 +28,14 @@
 
 if [ $# -eq 1 ]; then
     COMMAND="${1}"
-    KEYWORDS="rm-bin rm-com rm-pkg"
+    case "${COMMAND}" in
+    c-clean)
+	KEYWORDS="rm-bin rm-com-sans-c rm-pkg"
+	;;
+    *)
+	KEYWORDS="rm-bin rm-com rm-pkg"
+	;;
+    esac
 elif [ $# -ge 2 ]; then
     COMMAND="${1}"
     shift
@@ -47,7 +54,7 @@ mostlyclean)
 clean)
     FULL="yes"
     ;;
-distclean)
+distclean | c-clean)
     FULL="yes"
     DIST="yes"
     ;;
@@ -90,13 +97,21 @@ for KEYWORD in ${KEYWORDS}; do
 	echo "rm -f *.com *.bci *.c *.o *.so *.sl *.dylib"
 	rm -f *.com *.bci *.c *.o *.so *.sl *.dylib
 	;;
+    rm-com-sans-c)
+	echo "rm -f *.com *.bci *.o *.so *.sl *.dylib"
+	rm -f *.com *.bci *.o *.so *.sl *.dylib
+        ;;
     rm-old-pkg)
 	echo "rm -f *.bco *.bld *.glo *.con *.ldr"
 	rm -f *.bco *.bld *.glo *.con *.ldr
 	;;
     rm-pkg)
-	echo "rm -f *-unx.* *-w32.* *-os2.*"
-	rm -f *-unx.* *-w32.* *-os2.*
+	echo "rm -f *-unx.crf *-unx.fre *-unx.pkd"
+	rm -f *-unx.crf *-unx.fre *-unx.pkd
+	echo "rm -f *-w32.crf *-w32.fre *-w32.pkd"
+	rm -f *-w32.crf *-w32.fre *-w32.pkd
+	echo "rm -f *-os2.crf *-os2.fre *-os2.pkd"
+	rm -f *-os2.crf *-os2.fre *-os2.pkd
 	;;
     esac
 done
diff --git a/v7/src/etc/c-boot-compiler.sh b/v7/src/etc/c-boot-compiler.sh
new file mode 100755
index 000000000..afc503417
--- /dev/null
+++ b/v7/src/etc/c-boot-compiler.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# $Id: c-boot-compiler.sh,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+#
+# Copyright 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+if [ -z "${SCHEME_LARGE}" ]; then
+    SCHEME_LARGE="scheme --heap 3000"
+fi
+
+if [ -z "${SCHEME_COMPILER}" ]; then
+    SCHEME_COMPILER="${SCHEME_LARGE} --compiler"
+fi
+
+# Step 1: Compile CREF and SF natively, so that we can load them
+# independently of the compiler.  (There is no standard band that
+# loads them independently.)
+
+${SCHEME_COMPILER} <<EOF
+(with-working-directory-pathname "cref"
+  (lambda ()
+    (load "cref.sf")
+    (load "cref.cbf")
+    (if (not (name->package '(CROSS-REFERENCE)))
+	(load "make"))))
+(with-working-directory-pathname "sf"
+  (lambda ()
+    (load "sf.sf")
+    (load "sf.cbf")))
+EOF
+
+# Step 2: Load CREF and SF, and syntax the compiler configured with
+# the C back end.
+
+# (There *must* be a better way to write this...)
+
+LOAD_SF_CREF=`cat <<EOF
+(for-each (lambda (subdirectory)
+            (with-working-directory-pathname subdirectory
+              (lambda ()
+                (load "make"))))
+          '("cref" "sf"))
+EOF
+`
+
+${SCHEME_LARGE} <<EOF
+${LOAD_SF_CREF}
+(with-working-directory-pathname "compiler"
+  (lambda ()
+    (load "compiler.sf")))
+EOF
+
+# Step 3: Now that the compiler with the C back end is syntaxed and
+# packaged, use the native compiler to compile the bootstrap C
+# compiler natively.
+
+${SCHEME_COMPILER} <<EOF
+(with-working-directory-pathname "compiler"
+  (lambda ()
+    (load "compiler.cbf")))
+EOF
+
+# Step 4: Load up the natively compiled compiler with the C back end,
+# and save a band.
+
+${SCHEME_LARGE} <<EOF
+${LOAD_SF_CREF}
+(with-working-directory-pathname "compiler"
+  (lambda ()
+    (load "machines/C/make")))
+(disk-save "boot-compiler.com")
+EOF
diff --git a/v7/src/etc/c-build-bands.sh b/v7/src/etc/c-build-bands.sh
new file mode 100755
index 000000000..139958aa8
--- /dev/null
+++ b/v7/src/etc/c-build-bands.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $Id: c-build-bands.sh,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+#
+# Copyright 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+sh etc/c-initial-bands.sh
+
+microcode/scheme --library lib --compiler <<EOF
+(load "microcode/edwin.so")
+(load-option 'EDWIN)
+(disk-save "lib/all.com")
+EOF
+
+microcode/scheme --library lib --large <<EOF
+(load "microcode/edwin.so")
+(load-option 'EDWIN)
+(disk-save "lib/edwin.com")
+EOF
+
+(
+    cd runtime-check
+    ../microcode/scheme --library ../lib --fasl runtime_make <<EOF
+(load "../microcode/edwin.so")
+(load-option 'EDWIN)
+(load "../microcode/6001.so")
+(load-option 'STUDENT)
+(disk-save "../lib/6001.com")
+EOF
+)
diff --git a/v7/src/etc/c-bundle.sh b/v7/src/etc/c-bundle.sh
new file mode 100755
index 000000000..6db997073
--- /dev/null
+++ b/v7/src/etc/c-bundle.sh
@@ -0,0 +1,144 @@
+#!/bin/sh
+#
+# $Id: c-bundle.sh,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+#
+# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+#     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+#     2005, 2006, 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+if [ ! $# -gt 2 ]; then
+  echo "usage: ${0} TYPE SYSTEM FILES ..."
+  exit 1
+fi
+
+TYPE="${1}"
+SYSTEM="${2}"
+shift 2
+
+case "${TYPE}" in
+  library | static)
+    ;;
+  *)
+    echo "usage: ${0} TYPE SYSTEM FILES ..."
+    echo "  TYPE must be \`library' or \`static'."
+    exit 1
+    ;;
+esac
+
+(grep '^DECLARE_COMPILED_CODE' "${@}"	&& \
+ grep '^DECLARE_COMPILED_DATA' "${@}"	&& \
+ grep '^DECLARE_DATA_OBJECT'   "${@}")	\
+| sed -e 's/.*:/  /' >${SYSTEM}.h
+
+cat <<EOF >"${SYSTEM}.c"
+
+#define LIARC_IN_MICROCODE
+#include "liarc.h"
+
+#undef DECLARE_COMPILED_CODE
+#undef DECLARE_COMPILED_DATA
+#undef DECLARE_COMPILED_DATA_NS
+#undef DECLARE_DATA_OBJECT
+
+#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code)		\\
+extern int EXFUN (decl_code, (void));					\\
+extern SCHEME_OBJECT * EXFUN (code, (SCHEME_OBJECT *, entry_count_t));
+
+#define DECLARE_COMPILED_DATA(name, decl_data, data)			\\
+extern int EXFUN (decl_data, (void));					\\
+extern SCHEME_OBJECT * EXFUN (data, (entry_count_t));
+
+#define DECLARE_COMPILED_DATA_NS(name, data)				\\
+extern SCHEME_OBJECT * EXFUN (data, (entry_count_t));
+
+#define DECLARE_DATA_OBJECT(name, data)					\\
+extern SCHEME_OBJECT EXFUN (data, (void));
+
+#include "${SYSTEM}.h"
+
+#undef DECLARE_COMPILED_CODE
+#undef DECLARE_COMPILED_DATA
+#undef DECLARE_COMPILED_DATA_NS
+#undef DECLARE_DATA_OBJECT
+EOF
+
+case "${TYPE}" in
+  library)
+    cat <<EOF >>"${SYSTEM}.c"
+
+#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code)		\\
+  if (0 != (declare_compiled_code (name, nentries, decl_code, code)))	\\
+    return ((char *) NULL);
+
+#define DECLARE_COMPILED_DATA(name, decl_data, data)			\\
+  if (0 != (declare_compiled_code (name, decl_data, data)))		\\
+    return ((char *) NULL);
+
+#define DECLARE_COMPILED_DATA_NS(name, data)				\\
+  if (0 != (declare_compiled_data_ns (name, data)))			\\
+    return ((char *) NULL);
+
+#define DECLARE_DATA_OBJECT(name, data)					\\
+  if (0 != (declare_data_object (name, data)))				\\
+    return ((char *) NULL);
+
+char *
+DEFUN_VOID (dload_initialize_file)
+{
+#include "${SYSTEM}.h"
+  return (0);
+}
+EOF
+  ;;
+  static)
+    cat <<EOF >>"${SYSTEM}.c"
+
+#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code)		\\
+  result = (declare_compiled_code (name, nentries, decl_code, code));	\\
+  if (result != 0)							\\
+    return (result);
+
+#define DECLARE_COMPILED_DATA(name, decl_data, data)			\\
+  result = (declare_compiled_data (name, decl_data, data));		\\
+  if (result != 0)							\\
+    return (result);
+
+#define DECLARE_COMPILED_DATA_NS(name, data)				\\
+  result = (declare_compiled_data_ns (name, data));			\\
+  if (result != 0)							\\
+    return (result);
+
+#define DECLARE_DATA_OBJECT(name, data)					\\
+  result = (declare_data_object (name, data));				\\
+  if (result != 0)							\\
+    return (result);
+
+int
+DEFUN_VOID (initialize_compiled_code_blocks)
+{
+  int result;
+#include "${SYSTEM}.h"
+  return (0);
+}
+EOF
+  ;;
+esac
diff --git a/v7/src/etc/c-compile.scm b/v7/src/etc/c-compile.scm
new file mode 100644
index 000000000..d818ba2f9
--- /dev/null
+++ b/v7/src/etc/c-compile.scm
@@ -0,0 +1,72 @@
+#| -*-Scheme-*-
+
+$Id: c-compile.scm,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;; This generates correct debugging information for the parts of the
+;;; Scheme code that were statically linked to the microcode, and also
+;;; compiles the rest of the system that was not statically linked.
+
+;;; (Ideally, this file would be identical to compile.scm.  But we do
+;;; not live in an ideal world, and we shall have to settle for a file
+;;; that is merely very similar.  The main difference is that we need
+;;; to avoid running the C compiler on some of the files but not
+;;; others.  This is bogus.)
+
+(fluid-let ((compiler:invoke-c-compiler? #f))
+  (define (compile-package-descriptions subsystem)
+    (for-each
+     (lambda (os-suffix)
+       (cbf (pathname-new-type (string-append subsystem "-" os-suffix)
+			       "pkd")))
+     '("unx" "w32" "os2")))
+  (with-working-directory-pathname "cref"
+    (lambda ()
+      (load "cref.sf")
+      (load "cref.cbf")
+      ;; This conditional is probably not necessary.
+      (if (not (name->package '(CROSS-REFERENCE)))
+	  (load "make"))))
+  (for-each
+   (lambda (subsystem)
+     (with-working-directory-pathname subsystem
+       (lambda ()
+	 (load (pathname-new-type subsystem "sf"))
+	 (load (pathname-new-type subsystem "cbf"))
+	 (if (string=? subsystem "compiler")     ;++ kludge
+	     (cbf "compiler-unx.pkd")
+	     (compile-package-descriptions subsystem)))))
+   '("runtime" "win32" "sf" "compiler" "edwin" "6001"))
+  (with-working-directory-pathname "star-parser"
+    (lambda ()
+      (load "compile")
+      (compile-package-descriptions "parser")))
+  (for-each (lambda (subsystem)
+	      (load (merge-pathnames "compile"
+				     (pathname-as-directory subsystem)))
+	      (with-working-directory-pathname subsystem
+		(lambda ()
+		  (compile-package-descriptions subsystem))))
+	    '("sos" "imail" "xml" "ssp" "xdoc")))
diff --git a/v7/src/etc/c-compile.sh b/v7/src/etc/c-compile.sh
new file mode 100755
index 000000000..1bdc542d4
--- /dev/null
+++ b/v7/src/etc/c-compile.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $Id: c-compile.sh,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+#
+# Copyright 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+if [ $# -ge 1 ]; then
+  DIR="${1}"
+elif [ -r "./etc/c-compile.scm" ]; then
+  DIR="."
+else
+  echo "usage: ${0} DIRECTORY"
+  exit 1
+fi
+
+if [ -z "${SCHEME_COMPILER}" ]; then
+    (
+	cd "${DIR}"
+	sh etc/c-initial-bands.sh
+    )
+    SCHEME_COMPILER="${DIR}/microcode/scheme --library ${DIR}/lib"
+    SCHEME_COMPILER="${SCHEME_COMPILER} --compiler --heap 3000"
+fi
+
+${SCHEME_COMPILER} < "${DIR}/etc/c-compile.scm"
diff --git a/v7/src/etc/c-initial-bands.sh b/v7/src/etc/c-initial-bands.sh
new file mode 100755
index 000000000..4dedbc204
--- /dev/null
+++ b/v7/src/etc/c-initial-bands.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# $Id: c-initial-bands.sh,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+#
+# Copyright 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+(
+    cd runtime
+    ../microcode/scheme --library ../lib --fasl runtime_make <<EOF
+(disk-save "../lib/runtime.com")
+EOF
+)
+
+microcode/scheme --library lib --large <<EOF
+(load "microcode/sf+compiler.so")
+(load-option 'SF)
+(with-working-directory-pathname "compiler"
+  (lambda ()
+    (load "machines/C/make")))
+(load-option '*PARSER)
+(disk-save "lib/compiler.com")
diff --git a/v7/src/etc/script.scm b/v7/src/etc/c-prepare.scm
similarity index 60%
rename from v7/src/etc/script.scm
rename to v7/src/etc/c-prepare.scm
index 8ebd10ed7..18f435d7c 100644
--- a/v7/src/etc/script.scm
+++ b/v7/src/etc/c-prepare.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: script.scm,v 1.4 2007/01/05 21:19:25 cph Exp $
+$Id: c-prepare.scm,v 1.1 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -25,13 +25,15 @@ USA.
 
 |#
 
-;;;; Program to compile MIT/GNU Scheme
-
-;;; This is used to compile a part of the system written in Scheme.
-;;; This is the part of the system statically linked into the
-;;; microcode when using the C back end of the compiler.
+;;; This compiles the Scheme code that will be statically linked to
+;;; the microcode when using the C back end.
 
 (fluid-let ((compiler:invoke-c-compiler? #f))
+  (define (compile-package-descriptions subsystem)
+    (for-each (lambda (os-suffix)
+		(cbf (pathname-new-type (string-append subsystem "-" os-suffix)
+					"pkd")))
+	      '("unx" "w32" "os2")))
   (with-working-directory-pathname "microcode"
     (lambda ()
       (if (or (not (file-exists? "utabmd.bin"))
@@ -39,14 +41,19 @@ USA.
 		 (file-modification-time-indirect "utabmd.bin")))
 	  (sf "utabmd"))
       (cbf "utabmd")))
-  (for-each (lambda (dir)
-	      (with-working-directory-pathname dir
+  (for-each (lambda (subsystem)
+	      (with-working-directory-pathname subsystem
 		(lambda ()
-		  (load (string-append dir ".sf"))
-		  (load (string-append dir ".cbf"))
-		  (cbf (string-append dir "-unx.pkd")))))
-	    '("runtime" "sf" "cref" "compiler"))
+		  (load (pathname-new-type subsystem "sf"))
+		  (load (pathname-new-type subsystem "cbf"))
+		  (compile-package-descriptions subsystem))))
+	    '("runtime" "sf" "cref"))
+  (with-working-directory-pathname "compiler"
+    (lambda ()
+      (load "compiler.sf")
+      (load "compiler.cbf")
+      (cbf "compiler-unx.pkd")))
   (with-working-directory-pathname "star-parser"
     (lambda ()
-      (load "compile.scm")
-      (cbf "parser-unx.pkd"))))
\ No newline at end of file
+      (load "compile")
+      (compile-package-descriptions "parser"))))
diff --git a/v7/src/etc/c-prepare.sh b/v7/src/etc/c-prepare.sh
new file mode 100755
index 000000000..0f51c6273
--- /dev/null
+++ b/v7/src/etc/c-prepare.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $Id: c-prepare.sh,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+#
+# Copyright 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+set -e
+
+if [ $# -ge 1 ]; then
+    DIR="${1}"
+elif [ -r "./etc/c-prepare.scm" ]; then
+    DIR="."
+else
+    echo "usage: ${0} DIRECTORY"
+    exit 1
+fi
+
+if [ -z "${SCHEME_LARGE}" ]; then
+    SCHEME_LARGE="scheme --heap 3000"
+fi
+
+${SCHEME_LARGE} --band boot-compiler.com < "${DIR}/etc/c-prepare.scm"
diff --git a/v7/src/etc/optiondb.scm b/v7/src/etc/optiondb.scm
index 58b3796d2..d8120a6b4 100644
--- a/v7/src/etc/optiondb.scm
+++ b/v7/src/etc/optiondb.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: optiondb.scm,v 1.17 2007/01/05 21:19:25 cph Exp $
+$Id: optiondb.scm,v 1.18 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -52,25 +52,31 @@ USA.
 		    (pathname-new-type name (car type)))))))))
     (lambda ()
       (if (not (name->package package-name))
-	  (let dir-loop ((dirs dirs))
-	    (if (pair? dirs)
-		(let ((directory
-		       (merge-pathnames place
-					(pathname-as-directory (car dirs)))))
-		  (if (file-directory? directory)
-		      (let file-loop ((files files))
-			(if (pair? files)
-			    (if (test
-				 (merge-pathnames
-				  (car files)
-				  (pathname-as-directory directory)))
-				(with-working-directory-pathname directory
-				  (lambda ()
-				    (load (car files) '(RUNTIME))))
-				(file-loop (cdr files)))
-			    (dir-loop (cdr dirs))))
-		      (dir-loop (cdr dirs))))
-		(error "Unable to find package directory:" place)))))))
+	  (begin
+	    (ignore-errors
+	     (lambda ()
+	       (load (merge-pathnames
+		      place
+		      (system-library-directory-pathname "shared")))))
+	    (let dir-loop ((dirs dirs))
+	      (if (pair? dirs)
+		  (let ((directory
+			 (merge-pathnames place
+					  (pathname-as-directory (car dirs)))))
+		    (if (file-directory? directory)
+			(let file-loop ((files files))
+			  (if (pair? files)
+			      (if (test
+				   (merge-pathnames
+				    (car files)
+				    (pathname-as-directory directory)))
+				  (with-working-directory-pathname directory
+				    (lambda ()
+				      (load (car files) '(RUNTIME))))
+				  (file-loop (cdr files)))
+			      (dir-loop (cdr dirs))))
+			(dir-loop (cdr dirs))))
+		  (error "Unable to find package directory:" place))))))))
 
 (define-load-option 'EDWIN
   (guarded-system-loader '(edwin) "edwin"))
diff --git a/v7/src/imail/Makefile.in b/v7/src/imail/Makefile.in
index 855c5892b..99ec668e4 100644
--- a/v7/src/imail/Makefile.in
+++ b/v7/src/imail/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.8 2007/01/05 21:19:25 cph Exp $
+# $Id: Makefile.in,v 1.9 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -59,6 +59,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -80,7 +81,10 @@ tags TAGS:
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(IMAIL_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(IMAIL_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(IMAIL_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(IMAIL_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(IMAIL_DIR)/.
 	$(INSTALL_DATA) imail-unx.pkd $(DESTDIR)$(IMAIL_DIR)/.
 	$(INSTALL_DATA) $(srcdir)/load.scm $(DESTDIR)$(IMAIL_DIR)/.
diff --git a/v7/src/imail/load.scm b/v7/src/imail/load.scm
index fb0cbc3fc..6b0d65135 100644
--- a/v7/src/imail/load.scm
+++ b/v7/src/imail/load.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: load.scm,v 1.47 2007/03/11 01:11:41 riastradh Exp $
+$Id: load.scm,v 1.48 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -32,6 +32,7 @@ USA.
 (load-option 'WT-TREE)
 (with-working-directory-pathname (directory-pathname (current-load-pathname))
   (lambda ()
+    (declare-shared-library "imail" (lambda () #t))
     (fluid-let ((*allow-package-redefinition?* #t))
       (load-package-set "imail"))))
 (add-subsystem-identification! "IMAIL" '(1 21))
\ No newline at end of file
diff --git a/v7/src/microcode/Clean.sh b/v7/src/microcode/Clean.sh
index 84c90e9b5..14b436e45 100755
--- a/v7/src/microcode/Clean.sh
+++ b/v7/src/microcode/Clean.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Clean.sh,v 1.6 2007/01/05 21:19:25 cph Exp $
+# $Id: Clean.sh,v 1.7 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -32,7 +32,7 @@ if [ $# -ne 1 ]; then
 fi
 
 case "${1}" in
-mostlyclean | clean | distclean)
+mostlyclean | clean | distclean | c-clean)
     ;;
 maintainer-clean)
     if [ ! -f Makefile ] && [ -f configure ]; then
diff --git a/v7/src/microcode/compinit.c b/v7/src/microcode/compinit.c
deleted file mode 100644
index 3665687a1..000000000
--- a/v7/src/microcode/compinit.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*-C-*-
-
-$Id: compinit.c,v 1.10 2007/01/05 21:19:25 cph Exp $
-
-Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-    2006, 2007 Massachusetts Institute of Technology
-
-This file is part of MIT/GNU Scheme.
-
-MIT/GNU Scheme is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-MIT/GNU Scheme is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with MIT/GNU Scheme; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
-USA.
-
-*/
-
-#define LIARC_IN_MICROCODE
-#include "liarc.h"
-
-#undef DECLARE_COMPILED_CODE
-#undef DECLARE_COMPILED_DATA
-#undef DECLARE_COMPILED_DATA_NS
-#undef DECLARE_DATA_OBJECT
-
-#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code)		\
-extern int EXFUN (decl_code, (void));					\
-extern SCHEME_OBJECT * EXFUN (code, (SCHEME_OBJECT *, entry_count_t));
-
-#define DECLARE_COMPILED_DATA(name, decl_data, data)			\
-extern int EXFUN (decl_data, (void));					\
-extern SCHEME_OBJECT * EXFUN (data, (entry_count_t));
-
-#define DECLARE_COMPILED_DATA_NS(name, data)				\
-extern SCHEME_OBJECT * EXFUN (data, (entry_count_t));
-
-#define DECLARE_DATA_OBJECT(name, data)					\
-extern SCHEME_OBJECT EXFUN (data, (void));
-
-#include "compinit.h"
-
-#undef DECLARE_COMPILED_CODE
-#undef DECLARE_COMPILED_DATA
-#undef DECLARE_COMPILED_DATA_NS
-#undef DECLARE_DATA_OBJECT
-
-#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code)		\
-  result = (declare_compiled_code (name, nentries, decl_code, code));	\
-  if (result != 0)							\
-    return (result);
-
-#define DECLARE_COMPILED_DATA(name, decl_data, data)			\
-  result = (declare_compiled_data (name, decl_data, data));		\
-  if (result != 0)							\
-    return (result);
-
-#define DECLARE_COMPILED_DATA_NS(name, data)				\
-  result = (declare_compiled_data_ns (name, data));			\
-  if (result != 0)							\
-    return (result);
-
-#define DECLARE_DATA_OBJECT(name, data)					\
-  result = (declare_data_object (name, data));				\
-  if (result != 0)							\
-    return (result);
-
-int
-DEFUN_VOID (initialize_compiled_code_blocks)
-{
-  int result;
-#include "compinit.h"
-  return (0);
-}
diff --git a/v7/src/microcode/configure.ac b/v7/src/microcode/configure.ac
index 0329eafbf..d4fbb948a 100644
--- a/v7/src/microcode/configure.ac
+++ b/v7/src/microcode/configure.ac
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT([MIT/GNU Scheme microcode], [14.18], [bug-mit-scheme@gnu.org], [mit-scheme])
-AC_REVISION([$Id: configure.ac,v 1.38 2007/02/24 17:09:42 cph Exp $])
+AC_REVISION([$Id: configure.ac,v 1.39 2007/04/04 05:08:19 riastradh Exp $])
 AC_CONFIG_SRCDIR([boot.c])
 AC_CONFIG_HEADERS([config.h])
 AC_PROG_MAKE_SET
@@ -184,8 +184,8 @@ MODULE_TARGETS=
 MODULE_RULES=/dev/null
 MODULE_CFLAGS="-DCOMPILE_AS_MODULE"
 MODULE_LDFLAGS=
-LIARC_RULES_1=/dev/null
-LIARC_RULES_2=/dev/null
+LIARC_VARS=/dev/null
+LIARC_RULES=/dev/null
 
 dnl Checks for programs.
 AC_PROG_CC
@@ -195,9 +195,9 @@ AC_PROG_LN_S
 AC_PROG_MAKE_SET
 if test ${GCC} = yes; then
     if test ${enable_debugging} = no; then
-	CFLAGS=-O3
+	CFLAGS="-fPIC -O3"
     else
-	CFLAGS="-O0 -g"
+	CFLAGS="-fPIC -O0 -g"
 	LDFLAGS="${LDFLAGS} -g"
     fi
     CFLAGS="${CFLAGS} -Wall"
@@ -876,8 +876,8 @@ c)
     AC_DEFINE([COMPILE_FOR_STATIC_LINKING], [1],
 	[Define to 1 for static compilation of C native code.])
     OPTIONAL_BASES="${OPTIONAL_BASES} cmpauxmd unstackify compinit"
-    LIARC_RULES_1=liarc-rules-1
-    LIARC_RULES_2=makegen/liarc-rules-2
+    LIARC_VARS=liarc-vars
+    LIARC_RULES=liarc-rules
     ;;
 *)
     AC_MSG_RESULT([yes, for ${SCM_ARCH}])
@@ -930,8 +930,8 @@ AC_SUBST([MODULE_TARGETS])
 AC_SUBST_FILE([MODULE_RULES])
 AC_SUBST([MODULE_CFLAGS])
 AC_SUBST([MODULE_LDFLAGS])
-AC_SUBST_FILE([LIARC_RULES_1])
-AC_SUBST_FILE([LIARC_RULES_2])
+AC_SUBST_FILE([LIARC_VARS])
+AC_SUBST_FILE([LIARC_RULES])
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/v7/src/microcode/make-compinit b/v7/src/microcode/make-compinit
deleted file mode 100755
index df352d391..000000000
--- a/v7/src/microcode/make-compinit
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-grep \^DECLARE_COMPILED_CODE "${@}" | sed -e 's/.*:/  /'
-grep \^DECLARE_COMPILED_DATA "${@}" | sed -e 's/.*:/  /'
-grep \^DECLARE_DATA_OBJECT "${@}" | sed -e 's/.*:/  /'
diff --git a/v7/src/microcode/makegen/Makefile.in.in b/v7/src/microcode/makegen/Makefile.in.in
index 6beaafbdb..dbca294cb 100644
--- a/v7/src/microcode/makegen/Makefile.in.in
+++ b/v7/src/microcode/makegen/Makefile.in.in
@@ -1,6 +1,6 @@
 # -*- Makefile -*-
 #
-# $Id: Makefile.in.in,v 1.44 2007/02/24 17:09:46 cph Exp $
+# $Id: Makefile.in.in,v 1.45 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -117,9 +117,9 @@ COMPILE_MODULE = $(COMPILE) $(MODULE_CFLAGS)
 LINK_MODULE = $(LINK) $(MODULE_LDFLAGS)
 MODULE_LIBS = -lc
 
-# **** Rules for C back end (part 1) ****
+# **** Rules for C back end (part 1, variables) ****
 
-@LIARC_RULES_1@
+@LIARC_VARS@
 
 # **** Program definitions ****
 
@@ -176,16 +176,20 @@ ALL_LIBS = $(aux_LIBS)
 ALL_DATA = $(aux_DATA)
 
 MOSTLYCLEAN_FILES = *.o cmpauxmd.s usrdef.c compinit.h utabmd.c utabmd.bci \
-	bchdef.c $(LIARC_OBJECTS)
+	bchdef.c $(LIARC_OBJECTS) $(LIARC_BUNDLE_CLEAN_FILES)
 
 CLEAN_FILES = $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) $(EXTRA_PROGRAMS)
 
 DISTCLEAN_FILES = Makefile config.h config.cache config.log config.status \
 	cmpauxmd.m4 cmpauxmd.c cmpintmd.h makegen-cc
 
-MAINTAINER_CLEAN_FILES = Makefile.in Makefile.deps liarc-rules-1 \
+MAINTAINER_CLEAN_FILES = Makefile.in Makefile.deps liarc-vars liarc-rules \
 	config.h.in configure TAGS
 
+C_CLEAN_FILES = *.o usrdef.c compinit.h utabmd.bci bchdef.c $(LIARC_OBJECTS) \
+	$(LIARC_BUNDLE_CLEAN_FILES) $(ALL_PROGRAMS) $(ALL_LIBS) \
+	$(EXTRA_PROGRAMS) $(DISTCLEAN_FILES)
+
 # **** Implicit rules ****
 
 .SUFFIXES:
@@ -204,7 +208,9 @@ MAINTAINER_CLEAN_FILES = Makefile.in Makefile.deps liarc-rules-1 \
 
 default-target: $(ALL_PROGRAMS) $(ALL_LIBS)
 
-all: $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA)
+all: $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) $(LIARC_BOOT_BUNDLES)
+
+liarc-bundles: all $(LIARC_BUNDLES)
 
 scheme: $(scheme_OBJECTS) $(scheme_DEPENDENCIES)
 	-rm -f $@
@@ -287,8 +293,12 @@ maintainer-clean: distclean
 	-rm -f $(MAINTAINER_CLEAN_FILES)
 	( cd cmpauxmd && $(MAKE) $@ )
 
+c-clean:
+	-rm -f $(C_CLEAN_FILES)
+	-rm -rf autom4te.cache
+
 install: install-binPROGRAMS install-auxPROGRAMS install-auxLIBS \
-	install-auxDATA
+	install-auxDATA $(LIARC_INSTALL)
 
 install-binPROGRAMS: $(bin_PROGRAMS)
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
@@ -331,16 +341,16 @@ install-auxDATA: $(aux_DATA)
 	done
 
 .PHONY: default-target
-.PHONY: all tags TAGS mostlyclean clean distclean maintainer-clean
-.PHONY: install install_binPROGRAMS install_auxPROGRAMS install_auxDATA
+.PHONY: all tags TAGS mostlyclean clean distclean maintainer-clean c-clean
+.PHONY: install install-binPROGRAMS install-auxPROGRAMS install-auxDATA
 
 # **** File dependencies ****
 
 @(write-dependencies)@
 
-# **** Rules for C back end (part 2) ****
+# **** Rules for C back end (part 2, rules) ****
 
-@LIARC_RULES_2@
+@LIARC_RULES@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/v7/src/microcode/makegen/bundles-liarc.scm b/v7/src/microcode/makegen/bundles-liarc.scm
new file mode 100644
index 000000000..ffb9f0e3c
--- /dev/null
+++ b/v7/src/microcode/makegen/bundles-liarc.scm
@@ -0,0 +1,88 @@
+#| -*-Scheme-*-
+
+$Id: bundles-liarc.scm,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Bundles for LIARC to be linked into dynamically loadable shared
+;;;; objects.
+
+;;; Format: (bundle (package*) source-directoory*)
+;;;   bundle ::= string
+;;;   package ::= pathname | (pathname os-type*)
+;;;   source-directory ::= (pathname exclude-filename*)
+
+;++ This is fragile: excluding filenames is bogus.  But it will work
+;++ until we get a real module system.
+
+("sf+compiler"
+ ("../sf/sf"
+  ("../compiler/compiler" "unx")
+  "../star-parser/parser")
+ ("../sf")
+ ("../compiler")
+ ("../compiler/base")
+ ("../compiler/back")
+ ("../compiler/fggen")
+ ("../compiler/fgopt")
+ ("../compiler/machines/C")
+ ("../compiler/rtlbase")
+ ("../compiler/rtlgen")
+ ("../compiler/rtlopt")
+ ("../star-parser" "compile" "ed-ffi" "load" "test-parser"))
+
+("edwin"
+ ("../edwin/edwin")
+ ("../edwin" "decls"))
+
+;; These are listed alphabetically; I don't think the order matters.
+
+("6001"
+ ("../6001/6001")
+ ("../6001" "make"))
+
+("cref"
+ ("../cref/cref")
+ ("../cref" "make"))
+
+("imail"
+ ("../imail/imail")
+ ("../imail" "compile" "ed-ffi" "fake-env" "load"))
+
+("sos"
+ ("../sos/sos")
+ ("../sos" "compile" "ed-ffi" "load" "microbench"))
+
+("ssp"
+ ("../ssp/ssp")
+ ("../ssp" "compile" "load"))
+
+("xdoc"
+ ("../xdoc/xdoc")
+ ("../xdoc" "compile" "load" "validate-xdoc"))
+
+("xml"
+ ("../xml/xml")
+ ("../xml"
+  "compile" "ed-ffi" "load" "parser-macro" "test-parser" "test-turtle" "xpath"))
diff --git a/v7/src/microcode/makegen/dirs-liarc.scm b/v7/src/microcode/makegen/dirs-liarc.scm
index 4eac7fd8a..0217ad61f 100644
--- a/v7/src/microcode/makegen/dirs-liarc.scm
+++ b/v7/src/microcode/makegen/dirs-liarc.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: dirs-liarc.scm,v 1.2 2007/01/12 02:57:10 cph Exp $
+$Id: dirs-liarc.scm,v 1.3 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -31,15 +31,3 @@ USA.
 ;;; exclusions in the cdr.
 
 ("../runtime")
-("../sf")
-("../cref")
-("../compiler")
-("../compiler/back")
-("../compiler/base")
-("../compiler/fggen")
-("../compiler/fgopt")
-("../compiler/machines/C")
-("../compiler/rtlbase")
-("../compiler/rtlgen")
-("../compiler/rtlopt")
-("../star-parser" "compile" "ed-ffi" "load" "test-parser")
diff --git a/v7/src/microcode/makegen/liarc-rules-2 b/v7/src/microcode/makegen/liarc-base-rules
similarity index 72%
rename from v7/src/microcode/makegen/liarc-rules-2
rename to v7/src/microcode/makegen/liarc-base-rules
index de1cb9832..37dc76a63 100644
--- a/v7/src/microcode/makegen/liarc-rules-2
+++ b/v7/src/microcode/makegen/liarc-base-rules
@@ -1,6 +1,6 @@
 # -*- Makefile -*-
 #
-# $Id: liarc-rules-2,v 1.2 2007/01/12 02:57:10 cph Exp $
+# $Id: liarc-base-rules,v 1.1 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -30,6 +30,17 @@ cmpauxmd.o: cmpauxmd.c $(LIARC_HEAD_FILES) prims.h bignum.h bitstr.h avltree.h
 compinit.o: compinit.c compinit.h $(LIARC_HEAD_FILES)
 unstackify.o: unstackify.c stackops.h $(LIARC_HEAD_FILES)
 
-compinit.h: $(LIARC_SOURCES) Makefile
+compinit.c compinit.h: $(LIARC_SOURCES) Makefile
 	rm -f $@
-	./make-compinit $(LIARC_SOURCES) > $@
+	sh ../etc/c-bundle.sh static compinit $(LIARC_SOURCES)
+
+install-liarc-bundles: $(LIARC_BUNDLES)
+	$(mkinstalldirs) $(DESTDIR)$(AUXDIR)/shared
+	@for p in $(LIARC_BUNDLES); do \
+	    if test -f $$p; then \
+		echo "$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/shared/."; \
+		$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/shared/.; \
+	    fi; \
+	done
+
+.PHONY: install-liarc-bundles
diff --git a/v7/src/microcode/makegen/makegen.scm b/v7/src/microcode/makegen/makegen.scm
index 3e269c24a..38684c61f 100644
--- a/v7/src/microcode/makegen/makegen.scm
+++ b/v7/src/microcode/makegen/makegen.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: makegen.scm,v 1.15 2007/01/12 02:57:10 cph Exp $
+$Id: makegen.scm,v 1.16 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -33,6 +33,7 @@ USA.
 (load-option 'SYNCHRONOUS-SUBPROCESS)
 
 (define (generate-makefile)
+  (generate-liarc-files)
   (let ((file-lists
 	 (map (lambda (pathname)
 		(cons (pathname-name pathname)
@@ -62,8 +63,22 @@ USA.
 			  (loop
 			   (if (char=? #\newline char)
 			       0
-			       (+ column 1)))))))))))))
-  (call-with-output-file "liarc-rules-1"
+			       (+ column 1))))))))))))))
+
+(define (write-header output)
+  (write-string "# This file automatically generated at " output)
+  (write-string (universal-time->local-iso8601-string (get-universal-time))
+		output)
+  (write-string "." output)
+  (newline output)
+  (newline output))
+
+(define (generate-liarc-files)
+  (generate-liarc-variables)
+  (generate-liarc-rules))
+
+(define (generate-liarc-variables)
+  (call-with-output-file "liarc-vars"
     (lambda (output)
       (write-header output)
       (write-rule "LIARC_HEAD_FILES"
@@ -72,24 +87,124 @@ USA.
 		  output)
       (newline output)
       (newline output)
-      (let ((files
-	     (cons "utabmd"
-		   (enumerate-directories
-		    (read-file "makegen/dirs-liarc.scm")))))
-	(write-rule "LIARC_SOURCES" "=" (files+suffix files ".c") output)
-	(newline output)
-	(newline output)
-	(write-rule "LIARC_OBJECTS" "=" (files+suffix files ".o") output)
-	(newline output)))))
+      (write-rule "LIARC_BOOT_BUNDLES" "=" '("sf+compiler.so") output)
+      (newline output)
+      (write-rule "LIARC_INSTALL" "=" '("install-liarc-bundles") output)
+      (newline output)
+      (generate-liarc-static-variables output)
+      (generate-liarc-dynamic-variables output))))
 
-(define (write-header output)
-  (write-string "# This file automatically generated at " output)
-  (write-string (universal-time->local-iso8601-string (get-universal-time))
-		output)
-  (write-string "." output)
-  (newline output)
+(define (generate-liarc-rules)
+  (call-with-output-file "liarc-rules"
+    (lambda (output)
+      (write-header output)
+      (generate-liarc-static-rules output)
+      (generate-liarc-dynamic-rules output))))
+
+(define (generate-liarc-static-variables output)
+  (let ((files (liarc-static-files)))
+    (write-rule "LIARC_SOURCES" "=" (files+suffix files ".c") output)
+    (newline output)
+    (newline output)
+    (write-rule "LIARC_OBJECTS" "=" (files+suffix files ".o") output)
+    (newline output)
+    (newline output)))
+
+(define (generate-liarc-static-rules output)
+  (call-with-input-file "makegen/liarc-base-rules"
+    (lambda (input)
+      (let loop ()
+	(let ((char (read-char input)))
+	  (if (not (eof-object? char))
+	      (begin (write-char char output)
+		     (loop)))))))
   (newline output))
 
+(define (generate-liarc-dynamic-variables output)
+  (let ((bundles (liarc-dynamic-bundles)))
+    (write-rule "LIARC_BUNDLE_CLEAN_FILES"
+		"="
+		(append-map (lambda (bundle)
+			      (map (lambda (suffix)
+				     (string-append (car bundle) suffix))
+				   '("-init.h" "-init.c" "-init.o" ".so")))
+			    bundles)
+		output)
+    (newline output)
+    (write-rule "LIARC_BUNDLES"
+		"="
+		;; Adding "all" to this list is a kludge for debugging
+		;; info.  Exactly what this kludge accomplishes I have
+		;; totally forgotten.
+		(cons "all"
+		      (map (lambda (bundle)
+			     (string-append (car bundle) ".so"))
+			   (liarc-dynamic-bundles)))
+		output)))
+
+(define (generate-liarc-dynamic-rules output)
+  (for-each (lambda (bundle)
+	      (let ((files
+		     (append (append-map package-description-files
+					 (cadr bundle))
+			     (enumerate-directories (cddr bundle)))))
+		(write-rule (string-append (car bundle) ".so")
+			    ":"
+			    (files+suffix files ".o")
+			    output)
+		(newline output)
+		(let ((write-command
+		       (lambda (prefix suffix)
+			 (write-char #\tab output)
+			 (write-string prefix output)
+			 (write-string (car bundle) output)
+			 (write-string suffix output)
+			 (newline output))))
+		  (write-command "$(SHELL) ../etc/c-bundle.sh library "
+				 "-init $(^:.o=.c)")
+		  (write-command "$(COMPILE_MODULE) -c " "-init.c")
+		  (write-command "$(LINK_MODULE) " "-init.o $^")
+		  (write-command "rm -f " "-init.h")
+		  (write-command "rm -f " "-init.c")
+		  (write-command "rm -f " "-init.o"))
+		(newline output)))
+	    (liarc-dynamic-bundles)))
+
+(define (liarc-static-files)
+  (append '("utabmd")
+	  (append-map package-description-files
+		      (read-file "makegen/pkds-liarc.scm"))
+	  (enumerate-directories (read-file "makegen/dirs-liarc.scm"))))
+
+(define (liarc-dynamic-bundles)
+  (read-file "makegen/bundles-liarc.scm"))
+
+(define (enumerate-directories specs)
+  (map (lambda (path)
+	 (enough-namestring (pathname-new-type path #f)))
+       (append-map (lambda (spec)
+		     (let ((dir (pathname-as-directory (car spec))))
+		       (if (file-directory? dir)
+			   (delete-matching-items
+			       (directory-read (merge-pathnames "*.scm" dir))
+			     (lambda (path)
+			       (member (pathname-name path) (cdr spec))))
+			   (begin
+			     (warn "Can't read directory:" dir)
+			     '()))))
+		   specs)))
+
+(define os-pkd-suffixes '("unx" "w32" "os2"))
+
+(define (package-description-files descriptor)
+  (receive (filename suffixes)
+      (if (pair? descriptor)
+	  (values (car descriptor) (cdr descriptor))
+	  (values descriptor os-pkd-suffixes))
+    (map (lambda (suffix)
+	   (string-append filename "-" suffix))
+	 suffixes)))
+
 (define (interpret-command command column file-lists output)
   (let ((malformed (lambda () (error "Malformed command:" command))))
     (if (not (and (pair? command)
@@ -120,21 +235,6 @@ USA.
 	(else
 	 (error "Unknown command:" command)))))))
 
-(define (enumerate-directories specs)
-  (map (lambda (path)
-	 (enough-namestring (pathname-new-type path #f)))
-       (append-map (lambda (spec)
-		     (let ((dir (pathname-as-directory (car spec))))
-		       (if (file-directory? dir)
-			   (delete-matching-items
-			       (directory-read (merge-pathnames "*.scm" dir))
-			     (lambda (path)
-			       (member (pathname-name path) (cdr spec))))
-			   (begin
-			     (warn "Can't read directory:" dir)
-			     '()))))
-		   specs)))
-
 (define (files+suffix files suffix)
   (map (lambda (file)
 	 (string-append file suffix))
diff --git a/v7/src/microcode/makegen/pkds-liarc.scm b/v7/src/microcode/makegen/pkds-liarc.scm
new file mode 100644
index 000000000..4fdd0f1c2
--- /dev/null
+++ b/v7/src/microcode/makegen/pkds-liarc.scm
@@ -0,0 +1,33 @@
+#| -*-Scheme-*-
+
+$Id: pkds-liarc.scm,v 1.1 2007/04/04 05:08:19 riastradh Exp $
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Pathnames of package description files
+
+;;; Format is either the filename of the package description file, or
+;;; a pair of that and a list of all of the OS types we want.
+
+"../runtime/runtime"
diff --git a/v7/src/runtime/Makefile.in b/v7/src/runtime/Makefile.in
index 5fa5d7e76..b29a9a177 100644
--- a/v7/src/runtime/Makefile.in
+++ b/v7/src/runtime/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.12 2007/01/05 21:19:27 cph Exp $
+# $Id: Makefile.in,v 1.13 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -59,6 +59,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -87,8 +88,8 @@ install:
 	-rm -rf $(DESTDIR)$(RODIR)
 	$(mkinstalldirs) $(DESTDIR)$(RODIR)
 	@for F in $(RUNOPTS); do \
-	    echo "$(INSTALL_DATA) $${F}.com $(DESTDIR)$(RODIR)/.";\
-	    $(INSTALL_DATA) $${F}.com $(DESTDIR)$(RODIR)/.;\
+	    echo "$(INSTALL_COM) $${F}.com $(DESTDIR)$(RODIR)/.";\
+	    $(INSTALL_COM) $${F}.com $(DESTDIR)$(RODIR)/.;\
 	done
 	@for F in $(RUNOPTS); do \
 	    REL="../SRC/runtime/$${F}.bci";\
diff --git a/v7/src/runtime/packag.scm b/v7/src/runtime/packag.scm
index d99531f85..c1b58a988 100644
--- a/v7/src/runtime/packag.scm
+++ b/v7/src/runtime/packag.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: packag.scm,v 14.50 2007/01/05 21:19:28 cph Exp $
+$Id: packag.scm,v 14.51 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -213,7 +213,7 @@ USA.
   ;; program runs before it gets purified, some of its run-time state
   ;; can end up being purified also.
   (flush-purification-queue!))
-
+
 (define (package-set-pathname pathname #!optional os-type)
   (make-pathname (pathname-host pathname)
 		 (pathname-device pathname)
@@ -242,11 +242,12 @@ USA.
 		(value (prim name)))
 	   (if (or (not value) load/suppress-loading-message?)
 	       value
-	       (let ((port (notification-output-port)))
-		 (fresh-line port)
-		 (write-string ";Initialized " port)
-		 (write name port)
-		 value))))))
+               (begin
+                 (write-notification-line
+                  (lambda (port)
+                    (write-string "Initialized " port)
+                    (write name port)))
+                 value))))))
 
 (define-integrable (make-package-file tag version descriptions loads)
   (vector tag version descriptions loads))
diff --git a/v7/src/sos/Makefile.in b/v7/src/sos/Makefile.in
index 957915ec6..4320be1ae 100644
--- a/v7/src/sos/Makefile.in
+++ b/v7/src/sos/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.8 2007/01/05 21:19:29 cph Exp $
+# $Id: Makefile.in,v 1.9 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -59,6 +59,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -80,7 +81,10 @@ tags TAGS:
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(SOS_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(SOS_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(SOS_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(SOS_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(SOS_DIR)/.
 	$(INSTALL_DATA) sos-unx.pkd $(DESTDIR)$(SOS_DIR)/.
 	$(INSTALL_DATA) $(srcdir)/load.scm $(DESTDIR)$(SOS_DIR)/.
diff --git a/v7/src/sos/load.scm b/v7/src/sos/load.scm
index 1e22c73fa..168d1585d 100644
--- a/v7/src/sos/load.scm
+++ b/v7/src/sos/load.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: load.scm,v 1.18 2007/01/05 21:19:29 cph Exp $
+$Id: load.scm,v 1.19 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -27,5 +27,6 @@ USA.
 
 (with-working-directory-pathname (directory-pathname (current-load-pathname))
   (lambda ()
+    (declare-shared-library "sos" (lambda () #t))
     (load-package-set "sos")))
 (add-subsystem-identification! "SOS" '(1 8))
\ No newline at end of file
diff --git a/v7/src/ssp/Makefile.in b/v7/src/ssp/Makefile.in
index 286ef6f48..91e99f23d 100644
--- a/v7/src/ssp/Makefile.in
+++ b/v7/src/ssp/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 2007/01/05 21:19:29 cph Exp $
+# $Id: Makefile.in,v 1.6 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -54,6 +54,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -68,7 +69,10 @@ include ../Makefile.std
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(SSP_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(SSP_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(SSP_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(SSP_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(SSP_DIR)/.
 	$(INSTALL_DATA) ssp-unx.pkd $(DESTDIR)$(SSP_DIR)/.
 	$(INSTALL_DATA) $(srcdir)/load.scm $(DESTDIR)$(SSP_DIR)/.
diff --git a/v7/src/ssp/load.scm b/v7/src/ssp/load.scm
index a986c40b1..b1e529672 100644
--- a/v7/src/ssp/load.scm
+++ b/v7/src/ssp/load.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: load.scm,v 1.8 2007/01/05 21:19:29 cph Exp $
+$Id: load.scm,v 1.9 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -32,5 +32,6 @@ USA.
 (load-option 'mime-codec)
 (with-working-directory-pathname (directory-pathname (current-load-pathname))
   (lambda ()
+    (declare-shared-library "ssp" (lambda () #t))
     (load-package-set "ssp")))
 (add-subsystem-identification! "SSP" '(0 4))
\ No newline at end of file
diff --git a/v7/src/star-parser/Makefile.in b/v7/src/star-parser/Makefile.in
index dc7590b86..15ae2df4c 100644
--- a/v7/src/star-parser/Makefile.in
+++ b/v7/src/star-parser/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.7 2007/01/05 21:19:29 cph Exp $
+# $Id: Makefile.in,v 1.8 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -59,6 +59,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -80,7 +81,10 @@ tags TAGS:
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(PARSER_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(PARSER_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(PARSER_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(PARSER_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(PARSER_DIR)/.
 	$(INSTALL_DATA) parser-unx.pkd $(DESTDIR)$(PARSER_DIR)/.
 	$(INSTALL_DATA) $(srcdir)/load.scm $(DESTDIR)$(PARSER_DIR)/.
diff --git a/v7/src/xdoc/Makefile.in b/v7/src/xdoc/Makefile.in
index 46cb8c4fe..39991431d 100644
--- a/v7/src/xdoc/Makefile.in
+++ b/v7/src/xdoc/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.4 2007/01/05 21:19:29 cph Exp $
+# $Id: Makefile.in,v 1.5 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -54,6 +54,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -68,7 +69,10 @@ include ../Makefile.std
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(XDOC_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(XDOC_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(XDOC_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(XDOC_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(XDOC_DIR)/.
 	$(INSTALL_DATA) xdoc-unx.pkd $(DESTDIR)$(XDOC_DIR)/.
 	$(INSTALL_DATA) $(srcdir)/load.scm $(DESTDIR)$(XDOC_DIR)/.
diff --git a/v7/src/xdoc/load.scm b/v7/src/xdoc/load.scm
index 8682c44e7..1c8d9d2b2 100644
--- a/v7/src/xdoc/load.scm
+++ b/v7/src/xdoc/load.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: load.scm,v 1.5 2007/01/05 21:19:29 cph Exp $
+$Id: load.scm,v 1.6 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -47,5 +47,6 @@ USA.
     (export 'xml-comment 'comment)))
 (with-working-directory-pathname (directory-pathname (current-load-pathname))
   (lambda ()
+    (declare-shared-library "xdoc" (lambda () #t))
     (load-package-set "xdoc")))
 (add-subsystem-identification! "XDOC" '(0 3))
\ No newline at end of file
diff --git a/v7/src/xml/Makefile.in b/v7/src/xml/Makefile.in
index 847697647..6f21ce6a2 100644
--- a/v7/src/xml/Makefile.in
+++ b/v7/src/xml/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.8 2007/01/05 21:19:29 cph Exp $
+# $Id: Makefile.in,v 1.9 2007/04/04 05:08:19 riastradh Exp $
 #
 # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
 #     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -59,6 +59,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_COM = @INSTALL_COM@
 
 LN_S = @LN_S@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -80,7 +81,10 @@ tags TAGS:
 
 install:
 	$(mkinstalldirs) $(DESTDIR)$(XML_DIR)
-	$(INSTALL_DATA) *.com $(DESTDIR)$(XML_DIR)/.
+	@for F in *.com; do \
+	    echo "$(INSTALL_COM) $${F} $(DESTDIR)$(XML_DIR)/.";\
+	    $(INSTALL_COM) $${F} $(DESTDIR)$(XML_DIR)/.;\
+	done
 	$(INSTALL_DATA) *.bci $(DESTDIR)$(XML_DIR)/.
 	$(INSTALL_DATA) xml-unx.pkd $(DESTDIR)$(XML_DIR)/.
 	$(INSTALL_DATA) $(srcdir)/load.scm $(DESTDIR)$(XML_DIR)/.
diff --git a/v7/src/xml/load.scm b/v7/src/xml/load.scm
index 84b14f6bc..63b6374c5 100644
--- a/v7/src/xml/load.scm
+++ b/v7/src/xml/load.scm
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: load.scm,v 1.19 2007/01/05 21:19:29 cph Exp $
+$Id: load.scm,v 1.20 2007/04/04 05:08:19 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
@@ -29,5 +29,6 @@ USA.
 (load-option 'SOS)
 (with-working-directory-pathname (directory-pathname (current-load-pathname))
   (lambda ()
+    (declare-shared-library "xml" (lambda () #t))
     (load-package-set "xml")))
 (add-subsystem-identification! "XML" '(1 0))
\ No newline at end of file
-- 
2.25.1