: ${MIT_SCHEME_EXE:=mit-scheme}
+# Please keep the following messages synchronized with the messages in
+# these files:
+#
+# src/Setup.sh
+# src/configure.ac
+# src/etc/make-native.sh
+
if ! ${MIT_SCHEME_EXE} --batch-mode --eval '(%exit)' > /dev/null 2> /dev/null
then
cat <<EOF >&2
-This script needs an existing MIT/GNU Scheme installation to function.
+*** Error in ${0}
+
+This script needs an existing MIT/GNU Scheme installation to function,
+but the program \`${MIT_SCHEME_EXE}' does not appear to run it.
-If you have installed MIT/GNU Scheme in an unusual location, or with
-an unusual name, set the environment variable MIT_SCHEME_EXE to the
-name or pathname of the MIT/GNU Scheme executable, which is usually
-\`mit-scheme' or \`/usr/local/bin/mit-scheme', and set the environment
-variable MITSCHEME_LIBRARY_PATH to the pathname of the MIT/GNU Scheme
-library directory, which is usually \`/usr/local/lib/mit-scheme-ARCH',
-where ARCH is the compiled code architecture, such as \`c', \`i386',
-etc.
+If you have installed MIT/GNU Scheme in an unusual location, set the
+environment variable MIT_SCHEME_EXE to the name or pathname of the
+MIT/GNU Scheme executable, which is usually \`mit-scheme' or
+\`/usr/local/bin/mit-scheme', and set the environment variable
+MITSCHEME_LIBRARY_PATH to the pathname of the MIT/GNU Scheme library
+directory, which is usually \`/usr/local/lib/mit-scheme-ARCH', where
+ARCH is the compiled code architecture, such as \`c', \`i386', etc.
EOF
exit 1
fi
AUXDIR_NAME=mit-scheme-${mit_scheme_native_code}
AUXDIR='$(libdir)'/${AUXDIR_NAME}
+# Please keep the following messages synchronized with the messages in
+# these files:
+#
+# src/Setup.sh
+# src/configure.ac
+# src/etc/make-native.sh
+
: ${MIT_SCHEME_EXE:=mit-scheme-${mit_scheme_native_code}}
if test x"${enable_host_scheme_test}" = xyes; then
AC_MSG_CHECKING([for an existing MIT/GNU Scheme installation])
MIT_SCHEME_EXE=mit-scheme
else
AC_MSG_ERROR([
-This script needs an existing MIT/GNU Scheme installation to function.
-
-If you have installed MIT/GNU Scheme in an unusual location, or with
-an unusual name, set the environment variable MIT_SCHEME_EXE to the
-name or pathname of the MIT/GNU Scheme executable, which is usually
-\`mit-scheme' or \`/usr/local/bin/mit-scheme', and set the environment
-variable MITSCHEME_LIBRARY_PATH to the pathname of the MIT/GNU Scheme
-library directory, which is usually
-\`/usr/local/lib/mit-scheme-${mit_scheme_native_code}'.
+This script needs an existing MIT/GNU Scheme installation to function,
+but neither the program \`${MIT_SCHEME_EXE}' nor the program
+\`mit-scheme' appears to run it.
+
+If you have installed MIT/GNU Scheme in an unusual location, set the
+environment variable MIT_SCHEME_EXE to the name or pathname of the
+MIT/GNU Scheme executable, which is usually \`mit-scheme' or
+\`/usr/local/bin/mit-scheme', and set the environment variable
+MITSCHEME_LIBRARY_PATH to the pathname of the MIT/GNU Scheme library
+directory, which is usually \`/usr/local/lib/mit-scheme-${mit_scheme_native_code}'.
])
fi
AC_MSG_RESULT([yes])
exec ./configure "${@}"
fi
+if [ ! -f runtime/runtime-unx.c ]; then
+ cat <<EOF >&2
+*** Error in ${0}
+
+This script should be run only in a distribution of MIT/GNU Scheme
+prepared for portable C code, from the top-level \`src/' directory.
+To prepare the distribution, run etc/make-liarc-dist.sh from that
+directory.
+EOF
+ exit 1
+fi
+
run_configure --prefix=`pwd`/boot-root --enable-native-code=c \
--disable-host-scheme-test
run_make stamp_install-liarc-boot-compiler c-clean distclean
: ${MIT_SCHEME_EXE:=mit-scheme-c}
export MIT_SCHEME_EXE
+# Please keep the following messages synchronized with the messages in
+# these files:
+#
+# src/Setup.sh
+# src/configure.ac
+# src/etc/make-native.sh
+
+script_name="${0}"
+report_error ()
+{
+ local line
+ cat <<EOF
+*** Error in ${script_name}
+
+This script builds MIT/GNU Scheme a native back end, starting from
+MIT/GNU Scheme with the portable C back end.
+EOF
+ printf '\n'
+ cat
+ printf '\n'
+ cat <<EOF
+If you have installed MIT/GNU Scheme with the portable C back end in
+an unusual location, set the environment variable MIT_SCHEME_EXE to
+the name or pathname of the MIT/GNU Scheme executable, which is
+usually \`mit-scheme-c' or \`/usr/local/bin/mit-scheme-c', and set the
+environment variable MITSCHEME_LIBRARY_PATH to the pathname of the
+MIT/GNU Scheme library directory, which is usually
+\`/usr/local/lib/mit-scheme-c'.
+EOF
+ exit 1
+}
+
+test_program='(begin (write microcode-id/compiled-code-type) (%exit 0))'
+scheme_failure=
+cc_type=`${MIT_SCHEME_EXE} --batch-mode --eval "${test_program}" 2>/dev/null` \
+ || scheme_failure=yes
+
+if [ yes = "${scheme_failure}" ]; then
+ report_error <<EOF >&2
+This script needs an existing MIT/GNU Scheme installation with the
+portable C back end, but the program \`${MIT_SCHEME_EXE}' does not
+appear to run it.
+EOF
+elif [ c != "${cc_type}" ]; then
+ report_error <<EOF >&2
+This script needs an existing MIT/GNU Scheme installation with the
+portable C back end, but the program \`${MIT_SCHEME_EXE}' uses native
+${cc_type} code rather than portable C code.
+EOF
+fi
+
run_cmd ./Setup.sh
run_configure --prefix=`pwd`/boot-root ${NATIVE_CODE}
-run_cmd etc/compile-boot-compiler.sh mit-scheme-c
+run_cmd etc/compile-boot-compiler.sh "${MIT_SCHEME_EXE}"
run_cmd_in_dir compiler run_make compile-liarc-bundle
run_cmd etc/native-prepare.sh "${MIT_SCHEME_EXE}"
run_make compile-microcode