transform-numeric-bound-test: don't wrap in safety 0.
[sbcl.git] / run-sbcl.sh
blob52ffc27adcbf46322c15165fa4eb75440f044884
1 #!/bin/sh
2 # A simple shell-script to run the freshly build SBCL without
3 # installing it.
5 # This software is part of the SBCL system. See the README file for
6 # more information.
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.
14 set -e
16 this="$0"
18 build_directory_p(){
19 [ -x "$1"/src/runtime/sbcl -a -f "$1"/output/sbcl.core ];
22 # OSX 10.8 readlink doesn't have -f
23 while [ -h "$this" ]; do
24 # Stop resolving symlinks when $this lives in a build tree.
25 # (Build trees might consist of symlinks to something that doesn't
26 # follow our repo layout.)
27 if build_directory_p `dirname "$this"`; then
28 break
30 # [ -h should guarantee that readlink output will be non-null
31 link=`readlink -n "$this"`
32 # if absolute path
33 if expr "$link" : '^/.*' > /dev/null; then
34 this="$link"
35 else
36 this=`dirname "$this"`/"$link"
38 done
39 BASE=`dirname "$this"`
40 # BASE can still be relative if $0 is a relative pathname naming a
41 # non-symlink, or if the last symlink visited in that loop has a
42 # relative target. We need BASE to be an absolute pathname in order to
43 # make MODULE-PROVIDE-CONTRIB work throughout the Lisp session, even
44 # after frobbing *DEFAULT-PATHNAME-DEFAULTS*.
45 if expr "$BASE" : '^/.*' > /dev/null; [ $? != 0 ]; then
46 BASE=`cd "$BASE" && pwd`
49 CORE_DEFINED=no
51 for arg in "$@"; do
52 case "$arg" in
53 --core)
54 CORE_DEFINED=yes
56 --help)
57 echo "usage: run-sbcl.sh sbcl-options*"
58 echo
59 echo "Runs SBCL from the build directory or binary tarball without need for"
60 echo "installation. Except for --help, accepts all the same command-line options"
61 echo "as SBCL does."
62 echo
63 exit 1
65 esac
66 done
68 if [ "$CORE_DEFINED" = "no" ]; then
69 CORE="$BASE"/output/sbcl.core
72 if [ -d "$BASE"/android-libs ]; then
73 export LD_LIBRARY_PATH="$BASE"/android-libs
76 if build_directory_p "$BASE"; then
77 export SBCL_HOME
78 if [ "$CORE_DEFINED" = "no" ]; then
79 SBCL_HOME="$BASE"/obj/sbcl-home exec "$BASE"/src/runtime/sbcl --core "$CORE" "$@"
80 else
81 SBCL_HOME="$BASE"/obj/sbcl-home exec "$BASE"/src/runtime/sbcl "$@"
83 else
84 echo "No built SBCL here ($BASE): run 'sh make.sh' first!"
85 exit 1