22 |
|
|
23 |
# the path of the directory in which executables (like this file) are kept. |
# the path of the directory in which executables (like this file) are kept. |
24 |
BIN_DIR=@BINDIR@ |
BIN_DIR=@BINDIR@ |
25 |
|
if [ ! -d "$BIN_DIR" ]; then |
26 |
|
cmddir=`dirname $0` |
27 |
|
case "$cmddir" in |
28 |
|
/* ) BIN_DIR="$cmddir";; |
29 |
|
* ) BIN_DIR=`cd $cmddir; pwd` ;; |
30 |
|
esac |
31 |
|
fi |
32 |
|
|
33 |
# the path of the directory in which the runtime system executables are kept. |
# the path of the directory in which the runtime system executables are kept. |
34 |
RUN_DIR=$BIN_DIR/.run |
RUN_DIR=$BIN_DIR/.run |
52 |
# |
# |
53 |
############################################################################# |
############################################################################# |
54 |
|
|
55 |
|
# special shortcut for frequent use (and for Linux' binfmt) |
56 |
|
case "$1" in /* | ./* | ../* ) HEAP="@SMLload=$1"; shift ;; esac |
57 |
|
|
58 |
|
ALLOC="" |
59 |
|
|
60 |
# |
# |
61 |
# Process command line arguments |
# Process command line arguments |
62 |
# |
# |
81 |
echo "$CMD @VERSION@" |
echo "$CMD @VERSION@" |
82 |
exit 0 |
exit 0 |
83 |
;; |
;; |
84 |
|
@SMLalloc=*) |
85 |
|
ALLOC=$arg |
86 |
|
;; |
87 |
*) |
*) |
88 |
ARGS="$ARGS $arg" |
ARGS="$ARGS $arg" |
89 |
;; |
;; |
90 |
esac |
esac |
91 |
done |
done |
92 |
|
|
93 |
|
# |
94 |
|
# Try to figure out the CPU's cache size and set the allocation area |
95 |
|
# size accordingly. This is majorly important for Celeron systems |
96 |
|
# which suffer badly when the allocation area is too big. |
97 |
|
# |
98 |
|
if [ "$ALLOC" = "" ] ; then |
99 |
|
if [ -f /proc/cpuinfo ] ; then |
100 |
|
# "head" is called to make sure we consider only one matching line. |
101 |
|
# (On linux SMP systems there is more than one such line.) |
102 |
|
cache=`fgrep 'cache size' </proc/cpuinfo | head -1` |
103 |
|
if [ $? = 0 ] ; then |
104 |
|
kb=`echo $cache | sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'` |
105 |
|
case $kb in |
106 |
|
128) |
107 |
|
# This is the Celeron case. |
108 |
|
ALLOC="@SMLalloc=32k" |
109 |
|
;; |
110 |
|
256) |
111 |
|
# Do CPUs like this exist? |
112 |
|
ALLOC="@SMLalloc=128k" |
113 |
|
;; |
114 |
|
512) |
115 |
|
# The Pentium II case... |
116 |
|
ALLOC="@SMLalloc=512k" |
117 |
|
;; |
118 |
|
*) |
119 |
|
;; |
120 |
|
esac |
121 |
|
fi |
122 |
|
fi |
123 |
|
fi |
124 |
|
|
125 |
if [ "$RUN" = "" ]; then |
if [ "$RUN" = "" ]; then |
126 |
# |
# |
127 |
# Construct the runtime system path from the ARCH and OS |
# Construct the runtime system path from the ARCH and OS |
154 |
# |
# |
155 |
# run the sucker! |
# run the sucker! |
156 |
# |
# |
157 |
exec $RUN @SMLcmdname=$0 $HEAP $ARGS |
exec $RUN @SMLcmdname=$0 $HEAP $ALLOC $ARGS |