use bootstrap for check
[deliverable/binutils-gdb.git] / config.sub
CommitLineData
4f183929 1#!/bin/sh
a2ee3e6d 2# Configuration validation subroutine script, version 1.0.
68cd7865 3# Copyright (C) 1991, 1992 Free Software Foundation, Inc.
a2ee3e6d
JW
4
5#This file is free software; you can redistribute it and/or modify
6#it under the terms of the GNU General Public License as published by
7#the Free Software Foundation; either version 2 of the License, or
8#(at your option) any later version.
9
10#This program is distributed in the hope that it will be useful,
11#but WITHOUT ANY WARRANTY; without even the implied warranty of
12#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13#GNU General Public License for more details.
14
15#You should have received a copy of the GNU General Public License
16#along with this program; if not, write to the Free Software
17#Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
4f183929
RP
19
20# Configuration subroutine to validate and canonicalize a configuration type.
21# Supply the specified configuration type as an argument.
22# If it is invalid, we print an error message on stderr and exit with code 1.
23# Otherwise, we print the canonical config type on stdout and succeed.
24
25# This file is supposed to be the same for all GNU packages
26# and recognize all the CPU types, system types and aliases
27# that are meaningful with *any* GNU software.
28# Each package is responsible for reporting which valid configurations
29# it does not support. The user should be able to distinguish
30# a failure to support a valid configuration from a meaningless
a2ee3e6d 31# configuration.
4f183929 32
a2ee3e6d
JW
33# The goal of this file is to map all the various variations of a given
34# machine specification into a single specification in the form:
35# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
36# it is wrong to echo any other type of specification
8b204e6e 37
a2ee3e6d
JW
38# First pass through any local machine types.
39case $1 in
40 *local*)
41 echo $1
42 exit 0
43 ;;
44 *)
69e87de2 45 ;;
a2ee3e6d 46esac
b9fe720d 47
a2ee3e6d
JW
48# Separate what the user gave into CPU-COMPANY and OS (if any).
49basic_machine=`echo $1 | sed 's/-[^-]*$//'`
50if [ $basic_machine != $1 ]
51then os=`echo $1 | sed 's/.*-/-/'`
52else os=; fi
caebaa16 53
a2ee3e6d
JW
54# Lets recognize common machines as not being OS so that things like
55# config.subr decstation-3100 as legal.
56case $os in
57 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
58 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
59 -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \
60 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -osf* | \
61 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
62 -harris)
63 os=
64 basic_machine=$1
65 ;;
66 -sco*)
67 os=-scosysv322
68 basic_machine=i386-unknown
69 ;;
70 -isc*)
71 os=-iscsysv
72 basic_machine=i386-unknown
73 ;;
74# start-sanitize-v9
75 -32)
76 basic_machine=sparc64-hal
77 os=-hal32
78 ;;
79 -64)
80 basic_machine=sparc64-hal
81 os=-hal64
82 ;;
83 -v7)
84 basic_machine=sparc64-sun
85 os=-v7
86 ;;
87# end-sanitize-v9
88esac
b9fe720d 89
a2ee3e6d
JW
90# Decode aliases for certain CPU-COMPANY combinations.
91case $basic_machine in
92 # Recognize the basic CPU types with without company name.
93 tahoe | i386 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
68cd7865 94 | tron | a29k | 580 | i960 | h8300 | v70)
a2ee3e6d
JW
95 basic_machine=$basic_machine-unknown
96 ;;
97 # Recognize the basic CPU types with with company name.
98 vax-* | tahoe-* | i386-* | i860-* | m68k-* | m68000-* | m88k-* \
99 | sparc-* | ns32k-* | alliant-* | arm-* | c[123]* \
100 | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
101 | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
102 | hppa-*)
103 ;;
104 # Recognize the various machine names and aliases which stand
105 # for a CPU type and a company and sometimes even an OS.
e6602723 106# start-sanitize-life
a2ee3e6d
JW
107 life-*) ;;
108 life)
109 basic_machine=life-philips
110 os=-none
111 ;;
e6602723
JG
112# end-sanitize-life
113
25fa8f53 114# start-sanitize-v9
a2ee3e6d
JW
115 sparc64-*) ;;
116 hal-32 | hal32)
117 basic_machine=sparc64-hal
118 os=-hal32
119 ;;
120 hal-64 | hal64)
121 basic_machine=sparc64-hal
122 os=-hal64
123 ;;
124 sparc64)
125 basic_machine=sparc64-sun
126 os=-v9
127 ;;
128 sparc64-v7 | sparc64v7)
129 basic_machine=sparc64-sun
130 os=-v7
131 ;;
25fa8f53 132# end-sanitize-v9
7054ee6d 133
a2ee3e6d
JW
134 vaxv)
135 basic_machine=vax-dec
136 os=-sysv
137 ;;
138 vms)
139 basic_machine=vax-dec
140 os=-vms
141 ;;
68cd7865
SEF
142 i386mach)
143 basic_machine=i386-mach
144 os=-mach
145 ;;
a2ee3e6d
JW
146 i386v32)
147 basic_machine=i386-unknown
148 os=-sysv32
149 ;;
150 i386-sco* | i386sco | sco)
151 basic_machine=i386-unknown
152 os=-scosysv322
153 ;;
154 i386-isc* | isc)
155 basic_machine=i386-unknown
156 os=-iscsysv
157 ;;
158 i386v4*)
159 basic_machine=i386-unknown
160 os=-sysv4
161 ;;
162 i386v)
163 basic_machine=i386-unknown
164 os=-sysv
165 ;;
166 spur)
167 basic_machine=spur-unknown
168 ;;
169 alliant)
170 basic_machine=alliant-alliant
171 ;;
172 convex-c1)
173 basic_machine=c1-convex
174 os=-sysv
175 ;;
176 convex-c2)
177 basic_machine=c2-convex
178 os=-sysv
179 ;;
180 convex-c32)
181 basic_machine=c32-convex
182 os=-sysv
183 ;;
184 convex-c34)
185 basic_machine=c34-convex
186 os=-sysv
187 ;;
188 convex-c38)
189 basic_machine=c38-convex
190 os=-sysv
191 ;;
192 m88k-omron*)
193 basic_machine=m88k-omron
194 ;;
195 merlin)
196 basic_machine=ns32k-utek
197 os=-sysv
198 ;;
199 crds | unos)
200 basic_machine=m68k-crds
201 ;;
202 encore | umax | mmax)
203 basic_machine=ns32k-encore
204 os=-sysv
205 ;;
206 genix)
207 basic_machine=ns32k-ns
208 ;;
68cd7865
SEF
209 iris | iris3 | iris4d)
210 basic_machine=mips-sgi
211 os=-irix3
212 ;;
213 iris4)
a2ee3e6d 214 basic_machine=mips-sgi
68cd7865 215 os=-irix4
a2ee3e6d
JW
216 ;;
217 news | news700 | news800 | news900)
218 basic_machine=m68k-sony
219 os=-newsos
220 ;;
221 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
222 basic_machine=m68k-att
223 ;;
224 delta | 3300 | motorola-3300 | motorola-delta \
225 | 3300-motorola | delta-motorola)
226 basic_machine=m68k-motorola
227 ;;
228 balance)
229 basic_machine=ns32k-sequent
230 os=-dynix
231 ;;
232 pc532)
233 basic_machine=ns32k-pc532
234 ;;
235 symmetry)
236 basic_machine=i386-sequent
237 os=-dynix
238 ;;
239 sun2)
240 basic_machine=m68000-sun
241 ;;
242 sun2os3)
243 basic_machine=m68000-sun
244 os=-sunos3
245 ;;
246 sun2os4)
247 basic_machine=m68000-sun
248 os=-sunos4
249 ;;
250 sun3os3)
251 basic_machine=m68k-sun
252 os=-sunos3
253 ;;
254 sun3os4)
255 basic_machine=m68k-sun
256 os=-sunos4
257 ;;
258 sun4os3)
259 basic_machine=sparc-sun
260 os=-sunos3
261 ;;
262 sun4os4)
263 basic_machine=sparc-sun
264 os=-sunos4
265 ;;
266 sun3)
267 basic_machine=m68k-sun
268 ;;
269 sun4)
270 basic_machine=sparc-sun
271 ;;
272 pbd)
273 basic_machine=sparc-unicom
274 ;;
275 sun386 | sun386i | roadrunner)
276 basic_machine=i386-sun
277 ;;
278 ps2)
279 basic_machine=i386-ibm
280 ;;
281 next)
282 basic_machine=m68k-next
283 os=-sysv
284 ;;
285 hp9k3[2-9][0-9])
286 basic_machine=m68k-hp
287 ;;
288 hp9k31[0-9] | hp9k2[0-9][0-9])
289 basic_machine=m68000-hp
290 ;;
291 hp9k8[0-9][0-9] | hp9k7[0-9][0-9] | hp8[0-9][0-9] | hp7[0-9][0-9])
292 basic_machine=hp800-hp
293 ;;
294 isi68 | isi)
295 basic_machine=m68k-isi
296 os=-sysv
297 ;;
298 apollo68)
299 basic_machine=m68k-apollo
300 os=-sysv
301 ;;
68cd7865
SEF
302 apollo68bsd)
303 basic_machine=m68k-apollo
304 os=-bsd
305 ;;
a2ee3e6d
JW
306 altos | altos3068)
307 basic_machine=m68k-altos
308 ;;
309 miniframe)
310 basic_machine=m68000-convergent
311 ;;
312 tower | tower-32)
313 basic_machine=m68k-ncr
314 ;;
315 news-3600 | risc-news)
316 basic_machine=mips-sony
317 os=-newsos
318 ;;
68cd7865
SEF
319 st2000)
320 basic_machine=m68kmote-tandem
321 ;;
a2ee3e6d
JW
322 decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
323 basic_machine=mips-dec
324 ;;
325 magnum | m3230)
326 basic_machine=mips-mips
327 os=-sysv
328 ;;
329 gmicro)
330 basic_machine=tron-gmicro
331 os=-sysv
332 ;;
333 rtpc | rtpc-*)
334 basic_machine=romp-ibm
335 ;;
336 am29k)
337 basic_machine=a29k-none
338 os=-bsd
339 ;;
340 amdahl)
341 basic_machine=580-amdahl
342 os=-sysv
343 ;;
344 amigados)
345 basic_machine=m68k-cbm
346 os=-amigados
347 ;;
348 amigaunix | amix)
349 basic_machine=m68k-cbm
350 os=-sysv4
351 ;;
dd16baba
SEF
352 stratus)
353 basic_machine=i860-stratus
354 os=-sysv4
355 ;;
a2ee3e6d
JW
356 cray | ymp)
357 basic_machine=ymp-cray
358 os=-unicos
359 ;;
360 cray2)
361 basic_machine=cray2-cray
362 os=-unicos
363 ;;
364 xmp)
365 basic_machine=xmp-cray
366 os=-unicos
367 ;;
368 delta88)
369 basic_machine=m88k-motorola
370 os=-m88kbcs
371 ;;
372 dpx2)
373 basic_machine=m68k-bull
374 os=-sysv
375 ;;
376 ebmon29k)
377 basic_machine=a29k-amd
378 os=-ebmon
379 ;;
380 h8300hds)
381 basic_machine=h8300-hitachi
382 os=-hds
383 ;;
384 harris)
385 basic_machine=m88k-harris
386 os=-m88kbcs
387 ;;
388 hp300bsd)
389 basic_machine=m68k-hp
390 os=-bsd
391 ;;
392 hp300hpux)
393 basic_machine=m68k-hp
394 os=-hpux
395 ;;
396 hp9k2[0-9][0-9] | hp9k31[0-9])
397 basic_machine=m68000-hp
398 os=-hpux
399 ;;
400 hp9k3[2-9][0-9])
401 basic_machine=m68k-hp
402 os=-hpux
403 ;;
404 ncr3000)
405 basic_machine=i386-ncr
406 os=-sysv4
407 ;;
68cd7865
SEF
408 necv70)
409 basic_machine=v70-nec
410 os=-sysv
411 ;;
a2ee3e6d
JW
412 news1000)
413 basic_machine=m68030-sony
414 os=-newsos
415 ;;
416 nindy960)
417 basic_machine=i960-intel
418 os=-nindy
419 ;;
420 pn)
421 basic_machine=pn-gould
422 os=-sysv
423 ;;
424 np1)
425 basic_machine=np1-gould
426 os=-sysv
427 ;;
428 ultra3)
429 basic_machine=a29k-nyu
c1e296fc 430 os=-sym1
a2ee3e6d
JW
431 ;;
432 vxworks960)
433 basic_machine=i960-wrs
434 os=-vxworks
435 ;;
436 vxworks68)
437 basic_machine=m68k-wrs
438 os=-vxworks
439 ;;
dd16baba
SEF
440 os68k)
441 basic_machine=m68k-none
442 os=-os68k
443 ;;
a2ee3e6d
JW
444 none)
445 basic_machine=none-none
446 os=-none
447 ;;
69e87de2 448
a2ee3e6d
JW
449# Here we handle the default manufacturer of certain CPU types. It is in
450# some cases the only manufacturer, in others, it is the most popular.
451 mips)
452 basic_machine=mips-mips
453 ;;
454 romp)
455 basic_machine=romp-ibm
456 ;;
457 rs6000)
458 basic_machine=rs6000-ibm
459 ;;
460 vax)
461 basic_machine=vax-dec
462 ;;
463 sparc)
464 basic_machine=sparc-sun
465 ;;
c1e296fc
SG
466 fx2800)
467 basic_machine=i860-alliant
468 ;;
a2ee3e6d
JW
469 *)
470 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
4f183929 471 exit 1
a2ee3e6d 472 ;;
4f183929
RP
473esac
474
a2ee3e6d 475# Decode manufacturer-specific aliases for certain operating systems.
e6602723 476
a2ee3e6d
JW
477if [ "$os" ]
478then
479case $os in
480 # First accept the basic system types.
481 # The portable systems comes first.
482 # Each alternative must end in a *, to match a version number.
483 -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* \
484 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
c1e296fc 485 | -unos* | -osf* | -v88r* | -luna* | -dgux* | -solari* | -sym* \
68cd7865 486 | -amigados* | -msdos* | -none* | -os68k* | -irix* \
a2ee3e6d
JW
487 | -nindy* | -vxworks* | -ebmon* | -hds* | -m88kbcs*)
488 ;;
25fa8f53 489# start-sanitize-v9
a2ee3e6d 490 -v7 | -v9 | -hal32 | -hal64) ;;
25fa8f53
RP
491# end-sanitize-v9
492
a2ee3e6d
JW
493 -newsos*)
494 os=-bsd
495 ;;
496 -osfrose*)
497 os=-osf
498 ;;
499 -osf*)
500 os=-bsd
501 ;;
502 -dynix*)
503 os=-bsd
504 ;;
505 -aos*)
506 os=-bsd
507 ;;
68cd7865 508 -ctix* | -uts*)
a2ee3e6d
JW
509 os=-sysv
510 ;;
c1e296fc
SG
511 -svr4)
512 os=-sysv4
513 ;;
514 -svr3)
515 os=-sysv3
516 ;;
a2ee3e6d
JW
517 *)
518 # Get rid of the `-' at the beginning of $os.
519 os=`echo $1 | sed 's/[^-]*-//'`
520 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
521 exit 1
522 ;;
69e87de2 523esac
a2ee3e6d 524else
69e87de2 525
a2ee3e6d
JW
526# Here we handle the default operating systems that come with various machines.
527# The value should be what the vendor currently ships out the door with their
528# machine or put another way, the most popular os provided with the machine.
529case $basic_machine in
530 *-dec | vax-*)
531 os=-ultrix42
532 ;;
533 i386-sun)
534 os=-sunos402
535 ;;
536 m68000-sun)
537 os=-sunos3
538 # This also exists in the configure program, but was not the
539 # default.
540 # os=-sunos4
541 ;;
542 sparc-* | *-sun)
543 os=-sunos411
544 ;;
545 romp-*)
546 os=-bsd
547 ;;
548 *-ibm)
549 os=-aix
550 ;;
551 *-hp)
552 os=-hpux
553 ;;
554 *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
555 os=-sysv
556 ;;
557 *-dg)
558 os=-dgux
559 ;;
560 m88k-omron*)
561 os=-luna
562 ;;
563 *-crds)
564 os=-unos
565 ;;
566 *-ns)
567 os=-genix
568 ;;
569 i386-*)
570 os=-scosysv322
571 ;;
572 *)
573 os=-none
574 ;;
69e87de2 575esac
a2ee3e6d 576fi
69e87de2 577
a2ee3e6d
JW
578# Here we handle the case where we know the os, and the CPU type, but not the
579# manufacturer. We pick the logical manufacturer.
580vendor=unknown
581case $basic_machine in
582 *-unknown)
583 case $os in
584 -sunos*)
585 vendor=sun
586 ;;
587 -aix*)
588 vendor=ibm
589 ;;
590 -hpux*)
591 vendor=hp
592 ;;
593 -unos*)
594 vendor=crds
595 ;;
596 -dgux*)
597 vendor=dg
598 ;;
599 -luna*)
600 vendor=omron
601 ;;
602 -genix*)
603 vendor=ns
604 ;;
605 esac
606 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
607 ;;
4f183929
RP
608esac
609
a2ee3e6d 610echo $basic_machine$os
This page took 0.062874 seconds and 4 git commands to generate.