Add sanity checks and clarify error messages in various scripts.
authorTaylor R Campbell <campbell@mumble.net>
Sun, 28 Feb 2010 19:43:42 +0000 (14:43 -0500)
committerTaylor R Campbell <campbell@mumble.net>
Sun, 28 Feb 2010 19:43:42 +0000 (14:43 -0500)
src/Setup.sh
src/configure.ac
src/etc/make-liarc.sh
src/etc/make-native.sh

index 5531a1b84ef97d41ddfc9d83ab4e2d1ba5251272..be098824a07b4a018d46a21ac500984054da27f8 100755 (executable)
@@ -29,19 +29,28 @@ set -e
 
 : ${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
index 14980dd5de6fa172a6f869b8e4cd9b0420a61ab5..a9a5e74df3edce97f36c18a8187f4886f9a6acb1 100644 (file)
@@ -56,6 +56,13 @@ esac
 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])
@@ -65,15 +72,16 @@ if test x"${enable_host_scheme_test}" = xyes; then
        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])
index f66765ff73e7e5414e713fc741aacef8800a143b..4b89fc6b5c75f1969c6051e8869618eb2b65216a 100755 (executable)
@@ -39,6 +39,18 @@ if [ ${FASTP} = yes ]; then
     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
index b8395c3cac87f54669b45350c4efbab2855c8b07..e48b1c4e53ccd7831765542160d06dad0521cacb 100755 (executable)
@@ -46,9 +46,60 @@ fi
 : ${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