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