1.0.41.48: make run-sbcl.sh work on Darwin (and presumably other BSD-clones)
[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 BASE=`(readlink -f ${BASE} 2> /dev/null || echo ${BASE})`
18 CORE_DEFINED=no
19
20 for arg in $*; do
21     case $arg in
22         (--core)
23           CORE_DEFINED=yes
24           ;;
25         (--help)
26           echo "usage: run-sbcl.sh sbcl-options*"
27           echo
28           echo "Runs SBCL from the build directory or binary tarball without need for"
29           echo "installation. Except for --help, accepts all the same command-line options"
30           echo "as SBCL does."
31           echo
32           exit 1
33           ;;
34     esac
35 done
36
37 ARGUMENTS=""
38
39 if [ "$CORE_DEFINED" = "no" ]; then
40     ARGUMENTS="--core "$BASE"/output/sbcl.core"
41 fi
42
43 if [ -x "$BASE"/src/runtime/sbcl -a -f "$BASE"/output/sbcl.core ]; then
44     echo "(running SBCL from: $BASE)"
45     SBCL_HOME="$BASE"/contrib "$BASE"/src/runtime/sbcl $ARGUMENTS "$@"
46 else
47     echo "No built SBCL here ($BASE): run 'sh make.sh' first!"
48     exit 1
49 fi