Skip to content
Newer
Older
100644 219 lines (203 sloc) 7.18 KB
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
1 #!/bin/sh
2
3 # The make-config.sh script uses information about the target machine
4 # to set things up for compilation. It's vaguely like a stripped-down
5 # version of autoconf. It's intended to be run as part of make.sh. The
6 # only time you'd want to run it by itself is if you're trying to
7 # cross-compile the system or if you're doing some kind of
8 # troubleshooting.
9
10 # This software is part of the SBCL system. See the README file for
11 # more information.
12 #
13 # This software is derived from the CMU CL system, which was
14 # written at Carnegie Mellon University and released into the
15 # public domain. The software is in the public domain and is
16 # provided with absolutely no warranty. See the COPYING and CREDITS
17 # files for more information.
18
19 echo //entering make-config.sh
20
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
21 echo //ensuring the existence of output/ directory
22 if [ ! -d output ] ; then mkdir output; fi
23
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
24 ltf=`pwd`/local-target-features.lisp-expr
25 echo //initializing $ltf
672ac58 0.6.12.6:
William Harold Newman authored May 9, 2001
26 echo ';;;; This is a machine-generated file.' > $ltf
d7f6139 0.6.12.7.flaky1:
William Harold Newman authored May 15, 2001
27 echo ';;;; Please do not edit it by hand.' >> $ltf
28 echo ';;;; See make-config.sh.' >> $ltf
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
29 printf '(' >> $ltf
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
30
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
31 echo //guessing default target CPU architecture from host architecture
32 case `uname -m` in
f7b3fe1 @kevinrosenberg 0.8.3.78:
kevinrosenberg authored Sep 18, 2003
33 *86|x86_64) guessed_sbcl_arch=x86 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
34 [Aa]lpha) guessed_sbcl_arch=alpha ;;
68fd2d2 0.7.1.20:
William Harold Newman authored Feb 15, 2002
35 sparc*) guessed_sbcl_arch=sparc ;;
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
36 sun*) guessed_sbcl_arch=sparc ;;
68fd2d2 0.7.1.20:
William Harold Newman authored Feb 15, 2002
37 ppc) guessed_sbcl_arch=ppc ;;
5062535 @csrhodes 0.8.2.8:
csrhodes authored Jul 29, 2003
38 Power*Macintosh) guessed_sbcl_arch=ppc ;;
8a19c68 @csrhodes 0.7.6.27:
csrhodes authored Aug 19, 2002
39 parisc) guessed_sbcl_arch=hppa ;;
4ae1b79 @csrhodes 0.7.7.9:
csrhodes authored Sep 1, 2002
40 mips) guessed_sbcl_arch=mips ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
41 *)
42 # If we're not building on a supported target architecture, we
43 # we have no guess, but it's not an error yet, since maybe
44 # target architecture will be specified explicitly below.
45 guessed_sbcl_arch=''
46 ;;
47 esac
48
672ac58 0.6.12.6:
William Harold Newman authored May 9, 2001
49 echo //setting up CPU-architecture-dependent information
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
50 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
d7f6139 0.6.12.7.flaky1:
William Harold Newman authored May 15, 2001
51 echo sbcl_arch=\"$sbcl_arch\"
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
52 if [ "$sbcl_arch" = "" ] ; then
53 echo "can't guess target SBCL architecture, need SBCL_ARCH environment var"
54 exit 1
55 fi
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
56 printf ":%s" "$sbcl_arch" >> $ltf
c5759c0 @csrhodes 0.8.1.15:
csrhodes authored Jul 2, 2003
57
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
58 for d in src/compiler src/assembly; do
59 echo //setting up symlink $d/target
60 original_dir=`pwd`
61 cd $d
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
62 if [ -h target ] ; then
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
63 rm target
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
64 elif [ -w target ] ; then
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
65 echo "I'm afraid to replace non-symlink $d/target with a symlink."
66 exit 1
67 fi
68 if [ -d $sbcl_arch ] ; then
69 ln -s $sbcl_arch target
70 else
71 echo "missing sbcl_arch directory $PWD/$sbcl_arch"
72 exit 1
73 fi
74 cd $original_dir
75 done
76
f6f77e8 @csrhodes 0.7.10.16:
csrhodes authored Dec 11, 2002
77 echo //setting up symlink src/compiler/assembly
78 if [ -h src/compiler/assembly ] ; then
79 rm src/compiler/assembly
80 elif [ -w src/compiler/assembly ] ; then
81 echo "I'm afraid to replace non-symlink compiler/assembly with a symlink."
82 exit 1
83 fi
84 ln -s ../assembly src/compiler/assembly
85
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
86 echo //setting up OS-dependent information
eaf8fba tidied up OpenBSD-vs.-FreeBSD stuff, and src/runtime/Config.x86-*
William Harold Newman authored Oct 2, 2000
87 original_dir=`pwd`
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
88 cd src/runtime/
68fd2d2 0.7.1.20:
William Harold Newman authored Feb 15, 2002
89 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
90 # KLUDGE: these two logically belong in the previous section
91 # ("architecture-dependent"); it seems silly to enforce this in terms
92 # of the shell script, though. -- CSR, 2002-02-03
93 ln -s $sbcl_arch-arch.h target-arch.h
94 ln -s $sbcl_arch-lispregs.h target-lispregs.h
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
95 case `uname` in
96 Linux)
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
97 printf ' :linux' >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
98 sbcl_os="linux"
f7b3fe1 @kevinrosenberg 0.8.3.78:
kevinrosenberg authored Sep 18, 2003
99 if [ "`uname -m`" = "x86_64" ]; then
100 ln -s Config.x86_64-linux Config
101 else
102 ln -s Config.$sbcl_arch-linux Config
103 fi
68fd2d2 0.7.1.20:
William Harold Newman authored Feb 15, 2002
104 ln -s $sbcl_arch-linux-os.h target-arch-os.h
105 ln -s linux-os.h target-os.h
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
106 ;;
1e46297 @telent 0.7.4.17: Mostly Alpha fixes
telent authored Jun 7, 2002
107 OSF1)
108 # it's changed name twice since it was called OSF/1: clearly
109 # the marketers forgot to tell the engineers about Digital Unix
110 # _or_ OSF/1 ...
111 printf ' :osf1' >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
112 sbcl_os="osf1"
1e46297 @telent 0.7.4.17: Mostly Alpha fixes
telent authored Jun 7, 2002
113 ln -s Config.$sbcl_arch-osf1 Config
114 ln -s $sbcl_arch-osf1-os.h target-arch-os.h
115 ln -s osf1-os.h target-os.h
116 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
117 *BSD)
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
118 printf ' :bsd' >> $ltf
68fd2d2 0.7.1.20:
William Harold Newman authored Feb 15, 2002
119 ln -s $sbcl_arch-bsd-os.h target-arch-os.h
120 ln -s bsd-os.h target-os.h
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
121 case `uname` in
122 FreeBSD)
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
123 printf ' :freebsd' >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
124 sbcl_os="freebsd"
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
125 ln -s Config.$sbcl_arch-freebsd Config
126 ;;
127 OpenBSD)
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
128 printf ' :openbsd' >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
129 sbcl_os="openbsd"
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
130 ln -s Config.$sbcl_arch-openbsd Config
131 ;;
074ba06 @csrhodes 0.8.9.6.netbsd.1:
csrhodes authored Mar 29, 2004
132 NetBSD)
133 printf ' :netbsd' >> $ltf
134 ln -s Config.$sbcl_arch-netbsd Config
135 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
136 *)
137 echo unsupported BSD variant: `uname`
138 exit 1
139 ;;
140 esac
141 ;;
5062535 @csrhodes 0.8.2.8:
csrhodes authored Jul 29, 2003
142 Darwin)
143 printf ' :bsd' >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
144 sbcl_os="darwin"
5062535 @csrhodes 0.8.2.8:
csrhodes authored Jul 29, 2003
145 ln -s $sbcl_arch-darwin-os.h target-arch-os.h
146 ln -s bsd-os.h target-os.h
147 printf ' :darwin' >> $ltf
148 ln -s Config.$sbcl_arch-darwin Config
149 ;;
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
150 SunOS)
151 printf ' :sunos' >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
152 sbcl_os="sunos"
0d669e6 @csrhodes 0.7.1.1:
csrhodes authored Mar 25, 2002
153 ln -s Config.$sbcl_arch-sunos Config
154 ln -s $sbcl_arch-sunos-os.h target-arch-os.h
155 ln -s sunos-os.h target-os.h
156 ;;
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
157 *)
158 echo unsupported OS type: `uname`
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
159 exit 1
f2aa2d0 0.6.12.7:
William Harold Newman authored May 10, 2001
160 ;;
161 esac
eaf8fba tidied up OpenBSD-vs.-FreeBSD stuff, and src/runtime/Config.x86-*
William Harold Newman authored Oct 2, 2000
162 cd $original_dir
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
163
c5759c0 @csrhodes 0.8.1.15:
csrhodes authored Jul 2, 2003
164 # KLUDGE: currently the x86 only works with the generational garbage
165 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
166 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
167 # the absence of :GENCGC in *FEATURES*). This isn't a great
168 # separation, but for now, rather than have :GENCGC in
169 # base-target-features.lisp-expr, we add it into local-target-features
170 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
171 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
172 if [ "$sbcl_arch" = "x86" ] ; then
173 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
174 elif [ "$sbcl_arch" = "mips" ] ; then
175 # Use a little C program to try to guess the endianness. Ware
176 # cross-compilers!
177 $GNUMAKE -C tools-for-build determine-endianness
178 tools-for-build/determine-endianness >> $ltf
c65f4c0 @csrhodes 0.8.4.5:
csrhodes authored Oct 3, 2003
179 elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "linux" ]; then
180 # Use a C program to detect which kind of glibc we're building on,
181 # to bandage across the break in source compatibility between
182 # versions 2.3.1 and 2.3.2
183 $GNUMAKE -C tools-for-build where-is-mcontext
184 tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h
e3f68bd @csrhodes 0.8.4.36:
csrhodes authored Oct 20, 2003
185 elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "darwin" ]; then
186 # The default stack ulimit under darwin is too small to run PURIFY.
187 # Best we can do is complain and exit at this stage
d543ff4 @csrhodes 0.8.4.38:
csrhodes authored Oct 22, 2003
188 if [ "`ulimit -s`" = "512" ]; then
e3f68bd @csrhodes 0.8.4.36:
csrhodes authored Oct 20, 2003
189 echo "Your stack size limit is too small to build SBCL."
190 echo "See the limit(1) or ulimit(1) commands and the README file."
191 exit 1
192 fi
fab1ba8 @csrhodes 0.8.8.2:
csrhodes authored Feb 26, 2004
193 elif [ "$sbcl_arch" = "sparc" ]; then
194 # Test the compiler in order to see if we are building on Sun
195 # toolchain as opposed to GNU binutils, and write the appropriate
196 # FUNCDEF macro for assembler. No harm in running this on sparc-linux
197 # as well.
198 sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
c5759c0 @csrhodes 0.8.1.15:
csrhodes authored Jul 2, 2003
199 else
200 # Nothing need be done in this case, but sh syntax wants a placeholder.
201 echo > /dev/null
202 fi
fab1ba8 @csrhodes 0.8.8.2:
csrhodes authored Feb 26, 2004
203
a530bbe Initial revision
William Harold Newman authored Sep 18, 2000
204 echo //finishing $ltf
205 echo ')' >> $ltf
206
207 # FIXME: The version system should probably be redone along these lines:
208 #
209 # echo //setting up version information.
210 # versionfile=version.txt
211 # cp base-version.txt $versionfile
212 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
213 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
9139275 @csrhodes 0.7.9.7:
csrhodes authored Oct 27, 2002
214
215 # Make a unique ID for this build (to discourage people from
216 # mismatching sbcl and *.core files).
ecb9714 @csrhodes 0.7.12.21:
csrhodes authored Feb 5, 2003
217 echo '"'`hostname`-`whoami`-`date +%F-%H-%M-%S`'"' > output/build-id.tmp
9139275 @csrhodes 0.7.9.7:
csrhodes authored Oct 27, 2002
218
Something went wrong with that request. Please try again.