From 0cd50ee4c59b2c7018d171a55d798e65862259a2 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 28 Feb 2010 14:43:42 -0500 Subject: [PATCH] Add sanity checks and clarify error messages in various scripts. --- src/Setup.sh | 27 ++++++++++++++------- src/configure.ac | 26 ++++++++++++++------- src/etc/make-liarc.sh | 12 ++++++++++ src/etc/make-native.sh | 53 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 99 insertions(+), 19 deletions(-) diff --git a/src/Setup.sh b/src/Setup.sh index 5531a1b84..be098824a 100755 --- a/src/Setup.sh +++ b/src/Setup.sh @@ -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 <&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 diff --git a/src/configure.ac b/src/configure.ac index 14980dd5d..a9a5e74df 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -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]) diff --git a/src/etc/make-liarc.sh b/src/etc/make-liarc.sh index f66765ff7..4b89fc6b5 100755 --- a/src/etc/make-liarc.sh +++ b/src/etc/make-liarc.sh @@ -39,6 +39,18 @@ if [ ${FASTP} = yes ]; then exec ./configure "${@}" fi +if [ ! -f runtime/runtime-unx.c ]; then + cat <&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 diff --git a/src/etc/make-native.sh b/src/etc/make-native.sh index b8395c3ca..e48b1c4e5 100755 --- a/src/etc/make-native.sh +++ b/src/etc/make-native.sh @@ -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 </dev/null` \ + || scheme_failure=yes + +if [ yes = "${scheme_failure}" ]; then + report_error <&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 <&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 -- 2.25.1