Minor config polish.
[external/binutils.git] / config.sub
1 #!/bin/sh
2
3 # Configuration subroutine to validate and canonicalize a configuration type.
4 # Supply the specified configuration type as an argument.
5 # If it is invalid, we print an error message on stderr and exit with code 1.
6 # Otherwise, we print the canonical config type on stdout and succeed.
7
8 # This file is supposed to be the same for all GNU packages
9 # and recognize all the CPU types, system types and aliases
10 # that are meaningful with *any* GNU software.
11 # Each package is responsible for reporting which valid configurations
12 # it does not support.  The user should be able to distinguish
13 # a failure to support a valid configuration from a meaningless
14 # configuration.
15
16 # decode aliases into canonical names
17
18 case "$1" in
19 # cpu alone is a valid alias for cpu-none-none.
20 vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
21         | alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
22         | rtpc | rs6000 | i960)
23         cpu=$1
24         vendor=none
25         os=none
26         ;;
27 nindy960)
28         cpu=i960
29         vendor=intel
30         os=nindy
31         ;;
32 vxworks68)
33         cpu=m68k
34         vendor=wrs
35         os=vxworks
36         ;;
37 vxworks960)
38         cpu=i960
39         vendor=wrs
40         os=vxworks
41         ;;
42 am29k)
43         cpu=a29k
44         vendor=none
45         os=bsd
46         ;;
47 umax)
48         cpu=ns32k
49         vendor=encore
50         os=sysv # maybe?
51         ;;
52 pn)
53         cpu=pn
54         vendor=gould
55         os=sysv # maybe?
56         ;;
57 np1)
58         cpu=np1
59         vendor=gould
60         os=sysv # maybe?
61         ;;
62 merlin)
63         cpu=merlin
64         vendor=utek
65         os=sysv # maybe?
66         ;;
67 iris | iris4d)
68         cpu=mips
69         vendor=sgi
70         os=sysv # maybe?
71         ;;
72 news1000)
73         cpu=m68030
74         vendor=sony
75         os=sysv # maybe?
76         ;;
77 news | news700 | news800 | news900)
78         cpu=m68k
79         vendor=sony
80         os=sysv # maybe?
81         ;;
82 unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300)
83         cpu=m68k
84         vendor=att
85         os=sysv # maybe?
86         ;;
87 delta | 3300 | motorola-3300 | motorola-delta \
88       | 3300-motorola | delta-motorola)
89         cpu=m68k
90         vendor=motorola
91         os=sysv # maybe?
92         ;;
93 vax-dec)
94         cpu=vax
95         vendor=dec
96         os=ultrix # maybe?
97         ;;
98 balance)
99         cpu=ns32k
100         vendor=sequent
101         os=dynix
102         ;;
103 mmax)
104         cpu=ns32k
105         vendor=encore
106         os=sysv # maybe?
107         ;;
108 symmetry)
109         cpu=i386
110         vendor=sequent
111         os=dynix
112         ;;
113 sun2)
114         cpu=m68000
115         vendor=sun
116         os=sunos4
117         ;;
118 sun2os3)
119         cpu=m68000
120         vendor=sun
121         os=sunos3
122         ;;
123 sun2os4)
124         cpu=m68000
125         vendor=sun
126         os=sunos4
127         ;;
128 sun3)
129         cpu=m68k
130         vendor=sun
131         os=sunos4
132         ;;
133 sun3os3)
134         cpu=m68k
135         vendor=sun
136         os=sunos3
137         ;;
138 sun3os4)
139         cpu=m68k
140         vendor=sun
141         os=sunos4
142         ;;
143 sun4)
144         cpu=sparc
145         vendor=sun
146         os=sunos4
147         ;;
148 sun4os3)
149         cpu=sparc
150         vendor=sun
151         os=sunos3
152         ;;
153 sun4os4)
154         cpu=sparc
155         vendor=sun
156         os=sunos4
157         ;;
158 pbd)
159         cpu=sparc
160         vendor=unicom
161         os=sysv
162         ;;
163 roadrunner | sun386 | sun386i)
164         cpu=i386
165         vendor=sun
166         os=sunos
167         ;;
168 ps2)
169         cpu=i386
170         vendor=ibm
171         os=sysv # maybe?
172         ;;
173 i386sco)
174         cpu=i386
175         vendor=sco
176         os=sysv # maybe?
177         ;;
178 i386v)
179         cpu=i386
180         vendor=none
181         os=sysv
182         ;;
183 i386v32)
184         cpu=i386
185         vendor=none
186         os=sysv32
187         ;;
188 next)
189         cpu=m68k
190         vendor=next
191         os=sysv # maybe?
192         ;;
193 hp300bsd)
194         cpu=m68k
195         vendor=hp
196         os=bsd
197         ;;
198 hp300hpux | hpux | hp9k3[2-9][0-9])
199         cpu=m68k
200         vendor=hp
201         os=hpux
202         ;;
203 hp9k31[0-9] | hp9k2[0-9][0-9])
204         cpu=m68000
205         vendor=hp
206         os=hpux
207         ;;
208 isi | isi68)
209         cpu=m68k
210         vendor=isi
211         os=sysv # maybe?
212         ;;
213 apollo68)
214         cpu=m68k
215         vendor=apollo
216         os=sysv # maybe?
217         ;;
218 altos | altos3068)
219         cpu=m68k
220         vendor=altos
221         os=sysv # maybe?
222         ;;
223 altosgas)
224         cpu=m68k
225         vendor=altos
226         os=gas
227         ;;
228 miniframe)
229         cpu=m68000
230         vendor=convergent
231         os=sysv # maybe?
232         ;;
233 tower | tower-32)
234         cpu=m68k
235         vendor=ncr
236         os=sysv # maybe?
237         ;;
238 bigmips | news-3600 | risc-news)
239         cpu=mips
240         vendor=sony
241         os=newsos # maybe?
242         ;;
243 littlemips)
244         cpu=mips
245         vendor=little
246         os=bsd
247         ;;
248 dec3100 | decstatn | decstation | decstation-3100 | pmax)
249         cpu=mips
250         vendor=dec
251         os=ultrix
252         ;;
253 magnum | m3230)
254         cpu=mips
255         vendor=mips
256         os=sysv # maybe?
257         ;;
258 gmicro)
259         cpu=tron
260         vendor=none
261         os=sysv # maybe?
262         ;;
263 convex-c1)
264         cpu=c1
265         vendor=convex
266         os=sysv # maybe?
267         ;;
268 convex-c2)
269         cpu=c2
270         vendor=convex
271         os=sysv # maybe?
272         ;;
273 none)
274         cpu=none
275         vendor=none
276         os=none
277         ;;
278
279 # not an alias.  parse what we expect to be a canonical name.
280 *)
281         cpu=`echo $1 | sed 's/-.*$//'`
282
283         if [ "${cpu}" = "$1" ] ; then
284                 # no vendor so this is an invalid name.
285                 echo '***' No vendor: configuration \`$1\' not recognized 1>&2
286                 exit 1
287         else
288                 # parse out vendor
289                 rest=`echo $1 | sed "s/${cpu}-//"`
290                 vendor=`echo ${rest} | sed 's/-.*$//'`
291
292                 if [ "${vendor}" = "${rest}" ] ; then
293                         # a missing os is acceptable
294                         os=none
295                 else
296                         os=`echo ${rest} | sed "s/${vendor}-//"`
297                 fi
298         fi
299         ;;
300 esac
301
302 # At this point we should have three parts of a canonical name in cpu,
303 # vendor, and os.
304
305 # verify that the cpu is known.
306
307 case "${cpu}" in
308 vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
309         | alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
310         | rtpc | rs6000 | i960)
311         ;;
312 *)
313         echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2
314         exit 1
315         ;;
316 esac
317
318 # verify that the vendor is known.
319
320 case "${vendor}" in
321 none | convex | mips | dec | little | sony | ncr | convergent \
322         | altos | apollo | isi | hp | next | sco | ibm | sun \
323         | unicom | sequent | encore | motorola | att | sgi \
324         | utek | gould | wrs | intel | aout | bout | coff) ;;
325 *)
326         echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2
327         exit 1
328         ;;
329 esac
330
331 # verify that the os is known, if it exists.
332
333 case "${os}" in
334 aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \
335         | isc* | mach* | newsos* | nindy* | none | osf* | osf* | sco* \
336         | sunos* | sysv* | ultrix* | unos* | v88r* | vms* | vxworks*)
337         ;;
338 *)
339         echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2
340         exit 1
341         ;;
342 esac
343
344 echo ${cpu}-${vendor}-${os}