SCM Repository
Annotation of /sml/trunk/config/_run-sml
Parent Directory
|
Revision Log
Revision 661 - (view) (download)
1 : | monnier | 211 | #!@SHELL@ |
2 : | # | ||
3 : | # The standard driver for SML/NJ under the new runtime system | ||
4 : | # | ||
5 : | |||
6 : | CMD=`basename $0` | ||
7 : | |||
8 : | # | ||
9 : | # for /bin/ksh, disable reading user's environment file | ||
10 : | # | ||
11 : | unset ENV | ||
12 : | |||
13 : | ############################################################################# | ||
14 : | # | ||
15 : | # BEGIN SITE SPECIFIC STUFF | ||
16 : | # | ||
17 : | ############################################################################# | ||
18 : | |||
19 : | # | ||
20 : | # SITE SPECIFIC CONFIGURATION INFO | ||
21 : | # | ||
22 : | |||
23 : | # the path of the directory in which executables (like this file) are kept. | ||
24 : | BIN_DIR=@BINDIR@ | ||
25 : | monnier | 214 | 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 : | monnier | 211 | |
33 : | # the path of the directory in which the runtime system executables are kept. | ||
34 : | RUN_DIR=$BIN_DIR/.run | ||
35 : | |||
36 : | # the path of the directory in which the heap images are kept. | ||
37 : | HEAP_DIR=$BIN_DIR/.heap | ||
38 : | |||
39 : | # | ||
40 : | # the following could be replaced with some site specific code | ||
41 : | # | ||
42 : | ARCH_N_OPSYS=`$BIN_DIR/.arch-n-opsys` | ||
43 : | if [ "$?" != "0" ]; then | ||
44 : | echo "$CMD: unable to determine architecture/operating system" | ||
45 : | exit 1 | ||
46 : | fi | ||
47 : | eval $ARCH_N_OPSYS | ||
48 : | |||
49 : | ############################################################################# | ||
50 : | # | ||
51 : | # END SITE SPECIFIC STUFF | ||
52 : | # | ||
53 : | ############################################################################# | ||
54 : | |||
55 : | monnier | 214 | # special shortcut for frequent use (and for Linux' binfmt) |
56 : | case "$1" in /* | ./* | ../* ) HEAP="@SMLload=$1"; shift ;; esac | ||
57 : | |||
58 : | blume | 569 | ALLOC="" |
59 : | |||
60 : | monnier | 211 | # |
61 : | # Process command line arguments | ||
62 : | # | ||
63 : | ARGS="" | ||
64 : | while [ "$#" != "0" ]; do | ||
65 : | arg=$1; shift | ||
66 : | case $arg in | ||
67 : | @SMLrun=*) | ||
68 : | RUN=`echo $arg | sed 's/@SMLrun=//'` | ||
69 : | ;; | ||
70 : | @SMLload=*) | ||
71 : | HEAP=$arg; | ||
72 : | ;; | ||
73 : | @SMLappl) | ||
74 : | if [ "$#" = "0" ]; then | ||
75 : | echo "$CMD: missing argument for @SMLappl option" | ||
76 : | exit 1 | ||
77 : | fi | ||
78 : | APPL=$1; shift | ||
79 : | ;; | ||
80 : | @SMLversion) | ||
81 : | echo "$CMD @VERSION@" | ||
82 : | exit 0 | ||
83 : | ;; | ||
84 : | blume | 569 | @SMLalloc=*) |
85 : | ALLOC=$arg | ||
86 : | ;; | ||
87 : | monnier | 211 | *) |
88 : | ARGS="$ARGS $arg" | ||
89 : | ;; | ||
90 : | esac | ||
91 : | done | ||
92 : | |||
93 : | blume | 569 | # |
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 : | monnier | 661 | ALLOC="@SMLalloc=256k" |
117 : | blume | 569 | ;; |
118 : | *) | ||
119 : | ;; | ||
120 : | esac | ||
121 : | fi | ||
122 : | fi | ||
123 : | fi | ||
124 : | |||
125 : | monnier | 211 | if [ "$RUN" = "" ]; then |
126 : | # | ||
127 : | # Construct the runtime system path from the ARCH and OS | ||
128 : | # | ||
129 : | RUN="$RUN_DIR/run.$ARCH-$OPSYS" | ||
130 : | if [ ! -x "$RUN" ]; then | ||
131 : | if [ "$ALT_OPSYS" = "" ]; then | ||
132 : | echo "$CMD: cannot find runtime system $RUN" | ||
133 : | exit 1 | ||
134 : | else | ||
135 : | RUN="$RUN_DIR/run.$ARCH-$ALT_OPSYS" | ||
136 : | if [ ! -x "$RUN" ]; then | ||
137 : | echo "$CMD: cannot find runtime system $RUN" | ||
138 : | exit 1 | ||
139 : | fi | ||
140 : | fi | ||
141 : | fi | ||
142 : | fi | ||
143 : | |||
144 : | if [ "$HEAP" = "" ]; then | ||
145 : | # | ||
146 : | # Construct the heap image path from the APPL and ARCH | ||
147 : | # | ||
148 : | if [ "$APPL" = "" ]; then | ||
149 : | APPL=$CMD | ||
150 : | fi | ||
151 : | HEAP="@SMLload=$HEAP_DIR/$APPL" | ||
152 : | fi | ||
153 : | |||
154 : | # | ||
155 : | # run the sucker! | ||
156 : | # | ||
157 : | blume | 569 | exec $RUN @SMLcmdname=$0 $HEAP $ALLOC $ARGS |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |