1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
#!/bin/sh
# Configuration script for GNU CC
# Copyright (C) 1988 Free Software Foundation, Inc.
#This file is part of GNU CC.
#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 1, or (at your option)
#any later version.
#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING. If not, write to
#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Shell script to create proper links to machine-dependent files in
# preparation for compiling gcc.
#
# Usage: config.gcc [vint] [-srcdir=DIR] machine
#
# If config.gcc succeeds, it leaves its status in config.status.
# If config.gcc fails after disturbing the status quo,
# config.status is removed.
#
progname=$0
remove=rm
hard_link=ln
symbolic_link='ln -s'
#for Test
#remove="echo rm"
#hard_link="echo ln"
#symbolic_link="echo ln -s"
for arg in $*;
do
case $arg in
-srcdir=*)
srcdir=`echo $arg | sed s/-srcdir=//`
;;
-vint)
vint=on
;;
*)
machine=$arg
;;
esac
done
# Find the source files, if location was not specified.
if [ x$srcdir = x ]
then
srcdirdefaulted=1
srcdir=.
if [ ! -r tree.c ]
then
srcdir=..
fi
fi
if [ ! -r ${srcdir}/tree.c ]
then
if [ x$srcdirdefaulted = x ]
then
echo "$progname: Can't find compiler sources in \`${srcdir}'." 1>&2
else
echo "$progname: Can't find compiler sources in \`.' or \`..'." 1>&2
fi
exit 1
fi
if [ x$machine != x ];
then
case $machine in
vax) # for vaxen running bsd
;;
ultrix) # for vaxen running ultrix
cpu_type=vax
;;
tahoe) # for tahoe's running bsd
;;
harris) # for harris tahoe, using COFF.
cpu_type=tahoe
;;
vms) # for vaxen running VMS
cpu_type=vax
configuration_file=xm-${machine}.h
target_machine=tm-${machine}.h
;;
vax-sysv | vaxv) # for vaxen running system V
cpu_type=vax
configuration_file=xm-vaxv.h
target_machine=tm-vaxv.h
;;
sequent-i386) # for Intel 80386's on Sequent Symmetry
cpu_type=i386
configuration_file=xm-i386.h
target_machine=tm-seq386.h
;;
i386-mach)
cpu_type=i386
configuration_file=xm-i386.h
target_machine=tm-i386gas.h
;;
i386-sysv | i386v) # for Intel 80386's running system V
machine=i386v
cpu_type=i386
configuration_file=xm-${machine}.h
;;
i386-sysv4 | i386v4) # for Intel 80386's running system V.4
machine=i386v4
cpu_type=i386
configuration_file=xm-i386v.h
;;
i386-sysv-gas | i386g)
cpu_type=i386
configuration_file=xm-i386v.h
target_machine=tm-i386vgas.h
;;
i386-sco) # for Intel 80386's running SCO system
machine=i386sco
cpu_type=i386
configuration_file=xm-i386v.h
;;
i386-esix) # for Intel 80386's running ESIX system
machine=i386esix
cpu_type=i386
configuration_file=xm-i386v.h
;;
i386-isc) # for Intel 80386's running ISC
machine=i386isc
cpu_type=i386
configuration_file=xm-i386v.h
;;
i386-aix | ps2-aix | aix386 | ps2aix ) # for IBM PS/2 running AIX
machine=aix386
cpu_type=i386
configuration_file=xm-${machine}.h
;;
i860)
;;
i860-gas)
target_machine=tm-i860g.h
;;
next )
cpu_type=m68k
target_machine=tm-next.h
;;
sun4-os3 | sun-4-os3)
cpu_type=sparc
target_machine=tm-sun4os3.h
;;
sun3-os3 | sun-3-os3)
cpu_type=m68k
target_machine=tm-sun3os3.h
;;
sun3-nfp-os3 | sun-3-nfp-os3)
cpu_type=m68k
target_machine=tm-sun3os3nf.h
;;
sun3-mach)
cpu_type=m68k
target_machine=tm-sun3mach.h
;;
sun2 | sun-2 | sun2-os3 | sun-2-os3)
cpu_type=m68k
target_machine=tm-sun2.h
;;
sun2-os4 | sun-2-os4)
cpu_type=m68k
target_machine=tm-sun2os4.h
;;
sun386 | sun386i | roadrunner)
cpu_type=i386
configuration_file=xm-sun386i.h
target_machine=tm-sun386i.h
;;
sun4 | sun-4 | sun4-os4 | sun-4-os4)
cpu_type=sparc
target_machine=tm-sparc.h
;;
sun3 | sun-3 | sun3-os4 | sun-3-os4)
cpu_type=m68k
target_machine=tm-sun3.h
;;
sun3-nfp | sun-3-nfp | sun3-nfp-os4 | sun-3-nfp-os4)
cpu_type=m68k
target_machine=tm-sun3-nfp.h
;;
sun2-os4 |sun-2-os4)
cpu_type=m68k
target_machine=tm-sun2.h
;;
hp9k320) # HP 9000 series 300 with gcc alone
cpu_type=m68k
configuration_file=xm-hp9k320.h
;;
hp9k320-old) # HP 9000 series 300 with gcc alone
cpu_type=m68k
target_machine=tm-hp9k32old.h
configuration_file=xm-hp9k320.h
;;
hp9k320-gas | hp9k320g) # with gnu as, ld and gdb
cpu_type=m68k
configuration_file=xm-hp9k320.h
target_machine=tm-hp9k320g.h
;;
hp9k320-bsd) # HP 9000/3xx running Berkeley Unix
cpu_type=m68k
target_machine=tm-hp9k3bsd.h
;;
hp9k200-bsd) # HP 9000/2xx running Berkeley Unix
cpu_type=m68k
target_machine=tm-hp9k2bsd.h
;;
isi68)
cpu_type=m68k
;;
isi68-nfp)
cpu_type=m68k
;;
news | news800)
configuration_file=xm-m68k.h
target_machine=tm-news.h
cpu_type=m68k
;;
news-gas | news-g)
configuration_file=xm-m68k.h
target_machine=tm-newsgas.h
cpu_type=m68k
;;
altos | altos3068) # Altos 3068 with gnu as, ld and gdb
cpu_type=m68k
configuration_file=xm-altos3068.h
target_machine=tm-altos3068.h
;;
3b1)
cpu_type=m68k
configuration_file=xm-${machine}.h
;;
3b1g | 3b1-gas)
machine=3b1g
cpu_type=m68k
configuration_file=xm-3b1.h
;;
delta68k | motorola-3300 | delta)
cpu_type=m68k
configuration_file=xm-delta68k.h
target_machine=tm-delta68k.h
;;
sequent-ns32k | sequent)
machine=sequent
cpu_type=ns32k
;;
encore)
cpu_type=ns32k
;;
genix)
target_machine=tm-genix.h
machine=ns32k
cpu_type=ns32k
configuration_file=xm-genix.h
;;
88000)
cpu_type=m88k
target_machine=tm-${cpu_type}.h
;;
alliant) # Alliant FX/8
;;
convex-c1) # Convex C1
if [ -r /usr/include/stdlib.h ]
then
target_machine=tm-convex1.h
else
target_machine=tm-conv1os7.h
fi
cpu_type=convex
;;
convex-c2) # Convex C2
if [ -r /usr/include/stdlib.h ]
then
target_machine=tm-convex2.h
else
target_machine=tm-conv2os7.h
fi
cpu_type=convex
;;
iris) # Mostly like a MIPS.
cpu_type=mips
target_machine=tm-iris.h
configuration_file=xm-iris.h
;;
mips) # Default MIPS environment
;;
mips-sysv) # SYSV variant of MIPS system.
cpu_type=mips
target_machine=tm-mips-sysv.h
configuration_file=xm-umips.h
;;
mips-bsd43) # BSD 4.3 variant of MIPS system.
cpu_type=mips
target_machine=tm-mips-bsd.h
;;
mips-news | news-3600 | risc-news) # Sony NEWS 3600 or risc/news.
cpu_type=mips
target_machine=tm-mips-news.h
;;
dec-3100 | decstation) # Decstation or pmax.
cpu_type=mips
target_machine=tm-decstatn.h
;;
apollo68)
cpu_type=m68k
;;
tower) # NCR Tower 32 SVR3. as with sdb debugging.
cpu_type=m68k
target_machine=tm-tower-as.h
configuration_file=xm-tower.h
;;
pyr | pyramid)
machine=pyr
;;
# 370)
# machine=370
# ;;
esac
# if cpu_type is not set, define cpu_type to machine.
#
cpu_type=${cpu_type-$machine}
configuration_file=${configuration_file-xm-$cpu_type.h}
target_machine=${target_machine-tm-$machine.h}
machine_description=${cpu_type}.md
aux_output=${aux_output-out-$cpu_type.c}
if [ xx${vint} = xx ]
then
files="$configuration_file $target_machine
$machine_description $aux_output"
links="config.h tm.h md aux-output.c"
else
files="$configuration_file tm-vmc.h $target_machine
$machine_description $aux_output"
links="config.h tm.h tm-pre.h md aux-output.c"
fi
while [ -n "$files" ]
do
# set file to car of files, files to cdr of files
set $files; file=$1; shift; files=$*
set $links; link=$1; shift; links=$*
if [ ! -r ${srcdir}/config/$file ]
then
echo "$progname: cannot create a link \`$link'," 1>&2
echo "since the file \`config/$file' does not exist." 1>&2
exit 1
fi
$remove -f $link
rm -f config.status
# Make a symlink if possible, otherwise try a hard link
$symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
if [ ! -r $link ]
then
echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
exit 1
fi
echo "Linked \`$link' to \`${srcdir}/config/$file'."
done
if [ xx${vint} = xx ]
then
echo "Links are now set up for use with a $machine." \
| tee config.status
else
echo "Links are now set up for use with a $machine (vint)." \
| tee config.status
fi
# Install a makefile, and make it set VPATH
# if necessary so that the sources are found.
# Also change its value of srcdir.
# Also create a .gdbinit file which runs the one in srcdir
# and tells GDB to look there for source files.
case $srcdir in
.)
;;
*)
echo "VPATH = ${srcdir}" > x
cat x ${srcdir}/Makefile | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile
rm x
echo "dir ." > .gdbinit
echo "dir ${srcdir}" >> .gdbinit
echo "source ${srcdir}/.gdbinit" >> .gdbinit
;;
esac
exit 0
else
echo "Usage: $progname machine"
echo -n "Where \`machine' is something like "
echo "\`vax', \`sun3', \`encore', etc."
if [ -r config.status ]
then
cat config.status
fi
exit 1
fi
|