1.0.42.7: fix shell scripts on Solaris (and FreeBSD?)
[sbcl.git] / run-sbcl.sh
1 #!/bin/sh
2 # A simple shell-script to run the freshly build SBCL without
3 # installing it.
4
5 # This software is part of the SBCL system. See the README file for
6 # more information.
7 #
8 # This software is derived from the CMU CL system, which was
9 # written at Carnegie Mellon University and released into the
10 # public domain. The software is in the public domain and is
11 # provided with absolutely no warranty. See the COPYING and CREDITS
12 # files for more information.
13
14 set -e
15
16 BASE=`dirname "$0"`
17 if (readlink -f "${BASE}") >/dev/null 2>&1; then
18     BASE=`readlink -f ${BASE}`
19 else
20     opwd=`pwd`
21     cd "${BASE}"
22     BASE=`pwd`
23     cd "${opwd}"
24 fi
25 CORE_DEFINED=no
26
27 for arg in $*; do
28     case $arg in
29         --core)
30           CORE_DEFINED=yes
31           ;;
32         --help)
33           echo "usage: run-sbcl.sh sbcl-options*"
34           echo
35           echo "Runs SBCL from the build directory or binary tarball without need for"
36           echo "installation. Except for --help, accepts all the same command-line options"
37           echo "as SBCL does."
38           echo
39           exit 1
40           ;;
41     esac
42 done
43
44 ARGUMENTS=""
45
46 if [ "$CORE_DEFINED" = "no" ]; then
47     ARGUMENTS="--core "$BASE"/output/sbcl.core"
48 fi
49
50 if [ -x "$BASE"/src/runtime/sbcl -a -f "$BASE"/output/sbcl.core ]; then
51     echo "(running SBCL from: $BASE)"
52     SBCL_HOME="$BASE"/contrib "$BASE"/src/runtime/sbcl $ARGUMENTS "$@"
53 else
54     echo "No built SBCL here ($BASE): run 'sh make.sh' first!"
55     exit 1
56 fi