Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 271 lines (254 sloc) 9.57 kb
a530bbe Initial revision
William Harold Newman authored
1 #!/bin/sh
babd45f 0.9.4.72:
Thiemo Seufer authored
2 set -e
a530bbe Initial revision
William Harold Newman authored
3
4 # The make-config.sh script uses information about the target machine
5 # to set things up for compilation. It's vaguely like a stripped-down
6 # version of autoconf. It's intended to be run as part of make.sh. The
7 # only time you'd want to run it by itself is if you're trying to
8 # cross-compile the system or if you're doing some kind of
9 # troubleshooting.
10
11 # This software is part of the SBCL system. See the README file for
12 # more information.
13 #
14 # This software is derived from the CMU CL system, which was
15 # written at Carnegie Mellon University and released into the
16 # public domain. The software is in the public domain and is
17 # provided with absolutely no warranty. See the COPYING and CREDITS
18 # files for more information.
19
20 echo //entering make-config.sh
21
f2aa2d0 0.6.12.7:
William Harold Newman authored
22 echo //ensuring the existence of output/ directory
23 if [ ! -d output ] ; then mkdir output; fi
24
a530bbe Initial revision
William Harold Newman authored
25 ltf=`pwd`/local-target-features.lisp-expr
26 echo //initializing $ltf
672ac58 0.6.12.6:
William Harold Newman authored
27 echo ';;;; This is a machine-generated file.' > $ltf
d7f6139 0.6.12.7.flaky1:
William Harold Newman authored
28 echo ';;;; Please do not edit it by hand.' >> $ltf
29 echo ';;;; See make-config.sh.' >> $ltf
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
30 printf '(' >> $ltf
a530bbe Initial revision
William Harold Newman authored
31
f2aa2d0 0.6.12.7:
William Harold Newman authored
32 echo //guessing default target CPU architecture from host architecture
33 case `uname -m` in
78fa16b Christophe Rhodes 0.8.18.14:
csrhodes authored
34 *86) guessed_sbcl_arch=x86 ;;
40e3ba0 Christophe Rhodes 0.9.3.63:
csrhodes authored
35 i86pc) guessed_sbcl_arch=x86 ;;
78fa16b Christophe Rhodes 0.8.18.14:
csrhodes authored
36 *x86_64) guessed_sbcl_arch=x86-64 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored
37 [Aa]lpha) guessed_sbcl_arch=alpha ;;
68fd2d2 0.7.1.20:
William Harold Newman authored
38 sparc*) guessed_sbcl_arch=sparc ;;
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
39 sun*) guessed_sbcl_arch=sparc ;;
68fd2d2 0.7.1.20:
William Harold Newman authored
40 ppc) guessed_sbcl_arch=ppc ;;
5062535 Christophe Rhodes 0.8.2.8:
csrhodes authored
41 Power*Macintosh) guessed_sbcl_arch=ppc ;;
8a19c68 Christophe Rhodes 0.7.6.27:
csrhodes authored
42 parisc) guessed_sbcl_arch=hppa ;;
fd00d78 Christophe Rhodes 0.8.21.18:
csrhodes authored
43 mips*) guessed_sbcl_arch=mips ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored
44 *)
45 # If we're not building on a supported target architecture, we
46 # we have no guess, but it's not an error yet, since maybe
47 # target architecture will be specified explicitly below.
48 guessed_sbcl_arch=''
49 ;;
50 esac
51
672ac58 0.6.12.6:
William Harold Newman authored
52 echo //setting up CPU-architecture-dependent information
f2aa2d0 0.6.12.7:
William Harold Newman authored
53 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
d7f6139 0.6.12.7.flaky1:
William Harold Newman authored
54 echo sbcl_arch=\"$sbcl_arch\"
f2aa2d0 0.6.12.7:
William Harold Newman authored
55 if [ "$sbcl_arch" = "" ] ; then
56 echo "can't guess target SBCL architecture, need SBCL_ARCH environment var"
57 exit 1
58 fi
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
59 printf ":%s" "$sbcl_arch" >> $ltf
c5759c0 Christophe Rhodes 0.8.1.15:
csrhodes authored
60
a530bbe Initial revision
William Harold Newman authored
61 for d in src/compiler src/assembly; do
62 echo //setting up symlink $d/target
63 original_dir=`pwd`
eb5265a 0.8.14.9:
William Harold Newman authored
64 cd ./$d
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
65 if [ -h target ] ; then
a530bbe Initial revision
William Harold Newman authored
66 rm target
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
67 elif [ -w target ] ; then
a530bbe Initial revision
William Harold Newman authored
68 echo "I'm afraid to replace non-symlink $d/target with a symlink."
69 exit 1
70 fi
71 if [ -d $sbcl_arch ] ; then
72 ln -s $sbcl_arch target
73 else
74 echo "missing sbcl_arch directory $PWD/$sbcl_arch"
75 exit 1
76 fi
77 cd $original_dir
78 done
79
f6f77e8 Christophe Rhodes 0.7.10.16:
csrhodes authored
80 echo //setting up symlink src/compiler/assembly
81 if [ -h src/compiler/assembly ] ; then
82 rm src/compiler/assembly
83 elif [ -w src/compiler/assembly ] ; then
84 echo "I'm afraid to replace non-symlink compiler/assembly with a symlink."
85 exit 1
86 fi
87 ln -s ../assembly src/compiler/assembly
88
a530bbe Initial revision
William Harold Newman authored
89 echo //setting up OS-dependent information
eaf8fba tidied up OpenBSD-vs.-FreeBSD stuff, and src/runtime/Config.x86-*
William Harold Newman authored
90 original_dir=`pwd`
eb5265a 0.8.14.9:
William Harold Newman authored
91 cd ./src/runtime/
68fd2d2 0.7.1.20:
William Harold Newman authored
92 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
93 # KLUDGE: these two logically belong in the previous section
94 # ("architecture-dependent"); it seems silly to enforce this in terms
95 # of the shell script, though. -- CSR, 2002-02-03
96 ln -s $sbcl_arch-arch.h target-arch.h
97 ln -s $sbcl_arch-lispregs.h target-lispregs.h
f2aa2d0 0.6.12.7:
William Harold Newman authored
98 case `uname` in
99 Linux)
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
100 printf ' :elf' >> $ltf
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
101 printf ' :linux' >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
102 sbcl_os="linux"
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
103 if [ $sbcl_arch = "x86-64" ]; then
104 ln -s Config.x86_64-linux Config
105 else
106 ln -s Config.$sbcl_arch-linux Config
107 fi
68fd2d2 0.7.1.20:
William Harold Newman authored
108 ln -s $sbcl_arch-linux-os.h target-arch-os.h
109 ln -s linux-os.h target-os.h
f2aa2d0 0.6.12.7:
William Harold Newman authored
110 ;;
1e46297 Daniel Barlow 0.7.4.17: Mostly Alpha fixes
telent authored
111 OSF1)
112 # it's changed name twice since it was called OSF/1: clearly
113 # the marketers forgot to tell the engineers about Digital Unix
114 # _or_ OSF/1 ...
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
115 printf ' :elf' >> $ltf
1e46297 Daniel Barlow 0.7.4.17: Mostly Alpha fixes
telent authored
116 printf ' :osf1' >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
117 sbcl_os="osf1"
1e46297 Daniel Barlow 0.7.4.17: Mostly Alpha fixes
telent authored
118 ln -s Config.$sbcl_arch-osf1 Config
119 ln -s $sbcl_arch-osf1-os.h target-arch-os.h
120 ln -s osf1-os.h target-os.h
121 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored
122 *BSD)
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
123 printf ' :bsd' >> $ltf
68fd2d2 0.7.1.20:
William Harold Newman authored
124 ln -s $sbcl_arch-bsd-os.h target-arch-os.h
125 ln -s bsd-os.h target-os.h
f2aa2d0 0.6.12.7:
William Harold Newman authored
126 case `uname` in
127 FreeBSD)
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
128 printf ' :elf' >> $ltf
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
129 printf ' :freebsd' >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
130 sbcl_os="freebsd"
f2aa2d0 0.6.12.7:
William Harold Newman authored
131 ln -s Config.$sbcl_arch-freebsd Config
132 ;;
133 OpenBSD)
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
134 printf ' :elf' >> $ltf
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
135 printf ' :openbsd' >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
136 sbcl_os="openbsd"
f2aa2d0 0.6.12.7:
William Harold Newman authored
137 ln -s Config.$sbcl_arch-openbsd Config
138 ;;
074ba06 Christophe Rhodes 0.8.9.6.netbsd.1:
csrhodes authored
139 NetBSD)
140 printf ' :netbsd' >> $ltf
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
141 printf ' :elf' >> $ltf
1f7bb60 Nikodemus Siivola 0.8.15.18: Linkage table tweaks & alien bugfix
nikodemus authored
142 sbcl_os="netbsd"
074ba06 Christophe Rhodes 0.8.9.6.netbsd.1:
csrhodes authored
143 ln -s Config.$sbcl_arch-netbsd Config
144 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored
145 *)
146 echo unsupported BSD variant: `uname`
147 exit 1
148 ;;
149 esac
150 ;;
5062535 Christophe Rhodes 0.8.2.8:
csrhodes authored
151 Darwin)
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
152 printf ' :mach-o' >> $ltf
5062535 Christophe Rhodes 0.8.2.8:
csrhodes authored
153 printf ' :bsd' >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
154 sbcl_os="darwin"
5062535 Christophe Rhodes 0.8.2.8:
csrhodes authored
155 ln -s $sbcl_arch-darwin-os.h target-arch-os.h
156 ln -s bsd-os.h target-os.h
157 printf ' :darwin' >> $ltf
158 ln -s Config.$sbcl_arch-darwin Config
159 ;;
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
160 SunOS)
a2ff654 Nikodemus Siivola 0.8.21.21: fix & share EXTERN-ALIEN-NAME logic (fixes bug #373)
nikodemus authored
161 printf ' :elf' >> $ltf
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
162 printf ' :sunos' >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
163 sbcl_os="sunos"
0d669e6 Christophe Rhodes 0.7.1.1:
csrhodes authored
164 ln -s Config.$sbcl_arch-sunos Config
165 ln -s $sbcl_arch-sunos-os.h target-arch-os.h
166 ln -s sunos-os.h target-os.h
167 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored
168 *)
169 echo unsupported OS type: `uname`
a530bbe Initial revision
William Harold Newman authored
170 exit 1
f2aa2d0 0.6.12.7:
William Harold Newman authored
171 ;;
172 esac
eaf8fba tidied up OpenBSD-vs.-FreeBSD stuff, and src/runtime/Config.x86-*
William Harold Newman authored
173 cd $original_dir
a530bbe Initial revision
William Harold Newman authored
174
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
175 # FIXME: Things like :c-stack-grows-..., etc, should be
176 # *derived-target-features* or equivalent, so that there was a nicer
177 # way to specify them then sprinkling them in this file. They should
178 # still be tweakable by advanced users, though, but probably not
179 # appear in *features* of target. #!+/- should be adjusted to take
180 # them in account as well. At minimum the nicer specification stuff,
181 # though:
182 #
183 # (define-feature :dlopen (features)
184 # (union '(:bsd :linux :darwin :sunos) features))
185 #
186 # (define-feature :c-stack-grows-downwards-not-upwards (features)
187 # (member :x86 features))
188
c5759c0 Christophe Rhodes 0.8.1.15:
csrhodes authored
189 # KLUDGE: currently the x86 only works with the generational garbage
190 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
191 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
192 # the absence of :GENCGC in *FEATURES*). This isn't a great
193 # separation, but for now, rather than have :GENCGC in
194 # base-target-features.lisp-expr, we add it into local-target-features
195 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
196 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
197 if [ "$sbcl_arch" = "x86" ]; then
c5759c0 Christophe Rhodes 0.8.1.15:
csrhodes authored
198 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
fae1397 0.8.18.20:
Alexey Dejneka authored
199 printf ' :stack-allocatable-closures' >> $ltf
8fc734a 0.9.3.72: enable linkage tables on Solaris/x86
Brian Mastenbrook authored
200 if [ "$sbcl_os" = "linux" ] || [ "$sbcl_os" = "freebsd" ] || [ "$sbcl_os" = "netbsd" ] || [ "$sbcl_os" = "sunos" ]; then
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
201 printf ' :linkage-table' >> $ltf
202 fi
78fa16b Christophe Rhodes 0.8.18.14:
csrhodes authored
203 elif [ "$sbcl_arch" = "x86-64" ]; then
204 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack :linkage-table' >> $ltf
02c3d0a Christophe Rhodes 0.9.1.58:
csrhodes authored
205 printf ' :stack-allocatable-closures' >> $ltf
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
206 elif [ "$sbcl_arch" = "mips" ]; then
c5759c0 Christophe Rhodes 0.8.1.15:
csrhodes authored
207 # Use a little C program to try to guess the endianness. Ware
208 # cross-compilers!
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
209 #
210 # FIXME: integrate to grovel-features, mayhaps
211 $GNUMAKE -C tools-for-build determine-endianness -I src/runtime
c5759c0 Christophe Rhodes 0.8.1.15:
csrhodes authored
212 tools-for-build/determine-endianness >> $ltf
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
213 elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "linux" ]; then
214 # Use a C program to detect which kind of glibc we're building on,
215 # to bandage across the break in source compatibility between
216 # versions 2.3.1 and 2.3.2
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
217 #
218 # FIXME: integrate to grovel-features., maypahps
16a6592 Nikodemus Siivola 0.9.1.54: dynamic-extent lists and closures on ppc
nikodemus authored
219 printf ' :stack-allocatable-closures' >> $ltf
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
220 $GNUMAKE -C tools-for-build where-is-mcontext -I src/runtime
c65f4c0 Christophe Rhodes 0.8.4.5:
csrhodes authored
221 tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h
e3f68bd Christophe Rhodes 0.8.4.36:
csrhodes authored
222 elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "darwin" ]; then
16a6592 Nikodemus Siivola 0.9.1.54: dynamic-extent lists and closures on ppc
nikodemus authored
223 printf ' :stack-allocatable-closures' >> $ltf
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
224 # We provide a dlopen shim, so a little lie won't hurt
b36697e 0.8.19.1: PowerPC linkage tables (darwin only for now)
Brian Mastenbrook authored
225 printf " :os-provides-dlopen :linkage-table" >> $ltf
e3f68bd Christophe Rhodes 0.8.4.36:
csrhodes authored
226 # The default stack ulimit under darwin is too small to run PURIFY.
227 # Best we can do is complain and exit at this stage
d543ff4 Christophe Rhodes 0.8.4.38:
csrhodes authored
228 if [ "`ulimit -s`" = "512" ]; then
e3f68bd Christophe Rhodes 0.8.4.36:
csrhodes authored
229 echo "Your stack size limit is too small to build SBCL."
230 echo "See the limit(1) or ulimit(1) commands and the README file."
231 exit 1
232 fi
fab1ba8 Christophe Rhodes 0.8.8.2:
csrhodes authored
233 elif [ "$sbcl_arch" = "sparc" ]; then
234 # Test the compiler in order to see if we are building on Sun
235 # toolchain as opposed to GNU binutils, and write the appropriate
236 # FUNCDEF macro for assembler. No harm in running this on sparc-linux
237 # as well.
238 sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
1f7bb60 Nikodemus Siivola 0.8.15.18: Linkage table tweaks & alien bugfix
nikodemus authored
239 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
240 printf ' :linkage-table' >> $ltf
241 fi
2253eba Christophe Rhodes 0.9.1.63:
csrhodes authored
242 printf ' :stack-allocatable-closures' >> $ltf
7c7e627 0.9.1.52:
Alexey Dejneka authored
243 elif [ "$sbcl_arch" = "alpha" ]; then
244 printf ' :stack-allocatable-closures' >> $ltf
c5759c0 Christophe Rhodes 0.8.1.15:
csrhodes authored
245 else
246 # Nothing need be done in this case, but sh syntax wants a placeholder.
247 echo > /dev/null
248 fi
fab1ba8 Christophe Rhodes 0.8.8.2:
csrhodes authored
249
75b5237 Nikodemus Siivola 0.8.14.5: Join the foreign legion!
nikodemus authored
250 export sbcl_os sbcl_arch
4bc6b91 Nikodemus Siivola 0.8.13.78: Birds of Feather
nikodemus authored
251 sh tools-for-build/grovel-features.sh >> $ltf
252
a530bbe Initial revision
William Harold Newman authored
253 echo //finishing $ltf
254 echo ')' >> $ltf
255
256 # FIXME: The version system should probably be redone along these lines:
257 #
258 # echo //setting up version information.
259 # versionfile=version.txt
260 # cp base-version.txt $versionfile
261 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
262 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
9139275 Christophe Rhodes 0.7.9.7:
csrhodes authored
263
264 # Make a unique ID for this build (to discourage people from
265 # mismatching sbcl and *.core files).
eba7d5d Christophe Rhodes 0.8.13.27:
csrhodes authored
266 if [ `uname` = "SunOS" ] ; then
267 # use /usr/xpg4/bin/id instead of /usr/bin/id
268 PATH=/usr/xpg4/bin:$PATH
269 fi
270 echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.tmp
Something went wrong with that request. Please try again.