* config.sub: Complain if no argument is given. Added support for 386bsd as OS
[deliverable/binutils-gdb.git] / config.sub
1 #!/bin/sh
2 # Configuration validation subroutine script, version 1.0.
3 # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
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
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
31 # configuration.
32
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
37
38 if [ x$1 = x ]
39 then
40 echo Configuration name missing. 1>&2
41 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
42 echo "or $0 ALIAS" 1>&2
43 echo where ALIAS is a recognized configuration type. 1>&2
44 exit 1
45 fi
46
47 # First pass through any local machine types.
48 case $1 in
49 *local*)
50 echo $1
51 exit 0
52 ;;
53 *)
54 ;;
55 esac
56
57 # Separate what the user gave into CPU-COMPANY and OS (if any).
58 basic_machine=`echo $1 | sed 's/-[^-][^-]*$//'`
59 if [ $basic_machine != $1 ]
60 then os=`echo $1 | sed 's/.*-/-/'`
61 else os=; fi
62
63 # Lets recognize common machines as not being OS so that things like
64 # config.subr decstation-3100 as legal.
65 case $os in
66 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
67 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
68 -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \
69 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -osf* | \
70 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
71 -harris | -sim)
72 os=
73 basic_machine=$1
74 ;;
75 -scout)
76 ;;
77 -sco*)
78 os=-scosysv322
79 basic_machine=i386-unknown
80 ;;
81 -OSE68k | -ose68k | -OSE | -ose | -es1800)
82 os=-ose
83 basic_machine=m68k-ericsson
84 ;;
85 -OSE68000 | -ose68000)
86 os=-ose
87 basic_machine=m68000-ericsson
88 ;;
89 -isc*)
90 os=-iscsysv
91 basic_machine=i386-unknown
92 ;;
93 # start-sanitize-v9
94 -32)
95 basic_machine=sparc64-hal
96 os=-hal32
97 ;;
98 -64)
99 basic_machine=sparc64-hal
100 os=-hal64
101 ;;
102 -v7)
103 basic_machine=sparc64-sun
104 os=-v7
105 ;;
106 # end-sanitize-v9
107 esac
108
109 # Decode aliases for certain CPU-COMPANY combinations.
110 case $basic_machine in
111 # Recognize the basic CPU types with without company name.
112 tahoe | i386 | i486 | i860 | m68k | m680[01234]0 | m683?2 \
113 | m88k | ns32k | arm | pyramid \
114 | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 | we32k\
115 | v70 | we32k | z8k)
116 basic_machine=$basic_machine-unknown
117 ;;
118 # Recognize the basic CPU types with with company name.
119 vax-* | tahoe-* | i386-* | i486-* | i860-* | m68k-* \
120 | m680[01234]0-* | m683?2-* | m88k-* \
121 | sparc-* | ns32k-* | alliant-* | arm-* | c[123]* \
122 | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
123 | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
124 | hppa1.0-* | hppa1.1-* | we32k-* | z8k-*)
125 ;;
126 # Recognize the various machine names and aliases which stand
127 # for a CPU type and a company and sometimes even an OS.
128 # start-sanitize-life
129 life-*) ;;
130 life)
131 basic_machine=life-philips
132 os=-none
133 ;;
134 # end-sanitize-life
135
136 # start-sanitize-v9
137 sparc64-*) ;;
138 hal-32 | hal32)
139 basic_machine=sparc64-hal
140 os=-hal32
141 ;;
142 hal-64 | hal64)
143 basic_machine=sparc64-hal
144 os=-hal64
145 ;;
146 sparc64)
147 basic_machine=sparc64-sun
148 os=-v9
149 ;;
150 sparc64-v7 | sparc64v7)
151 basic_machine=sparc64-sun
152 os=-v7
153 ;;
154 # end-sanitize-v9
155
156 vaxv)
157 basic_machine=vax-dec
158 os=-sysv
159 ;;
160 vms)
161 basic_machine=vax-dec
162 os=-vms
163 ;;
164 i386mach)
165 basic_machine=i386-mach
166 os=-mach
167 ;;
168 i386v32)
169 basic_machine=i386-unknown
170 os=-sysv32
171 ;;
172 i386-sco* | i386sco | sco)
173 basic_machine=i386-unknown
174 os=-scosysv322
175 ;;
176 go32 | i386-go32)
177 basic_machine=i386-unknown
178 os=-go32
179 ;;
180 i386-isc* | isc)
181 basic_machine=i386-unknown
182 os=-iscsysv
183 ;;
184 i386-linux* | linux)
185 basic_machine=i386-unknown
186 os=-linux
187 ;;
188 i386v4*)
189 basic_machine=i386-unknown
190 os=-sysv4
191 ;;
192 i486v4*)
193 basic_machine=i486-unknown
194 os=-sysv4
195 ;;
196 i386v)
197 basic_machine=i386-unknown
198 os=-sysv
199 ;;
200 i486v)
201 basic_machine=i486-unknown
202 os=-sysv
203 ;;
204 386bsd)
205 basic_machine=i386-unknown
206 os=-bsd
207 ;;
208 spur)
209 basic_machine=spur-unknown
210 ;;
211 alliant)
212 basic_machine=alliant-alliant
213 ;;
214 convex-c1)
215 basic_machine=c1-convex
216 os=-sysv
217 ;;
218 convex-c2)
219 basic_machine=c2-convex
220 os=-sysv
221 ;;
222 convex-c32)
223 basic_machine=c32-convex
224 os=-sysv
225 ;;
226 convex-c34)
227 basic_machine=c34-convex
228 os=-sysv
229 ;;
230 convex-c38)
231 basic_machine=c38-convex
232 os=-sysv
233 ;;
234 m88k-omron*)
235 basic_machine=m88k-omron
236 ;;
237 merlin)
238 basic_machine=ns32k-utek
239 os=-sysv
240 ;;
241 crds | unos)
242 basic_machine=m68k-crds
243 ;;
244 encore | umax | mmax)
245 basic_machine=ns32k-encore
246 os=-sysv
247 ;;
248 genix)
249 basic_machine=ns32k-ns
250 ;;
251 iris | iris3 | iris4d)
252 basic_machine=mips-sgi
253 os=-irix3
254 ;;
255 iris4)
256 basic_machine=mips-sgi
257 os=-irix4
258 ;;
259 news | news700 | news800 | news900)
260 basic_machine=m68k-sony
261 os=-newsos
262 ;;
263 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
264 basic_machine=m68k-att
265 ;;
266 3b* | we32k* )
267 basic_machine=we32k-att
268 os=-sysv
269 ;;
270 delta | 3300 | motorola-3300 | motorola-delta \
271 | 3300-motorola | delta-motorola)
272 basic_machine=m68k-motorola
273 ;;
274 balance)
275 basic_machine=ns32k-sequent
276 os=-dynix
277 ;;
278 pc532)
279 basic_machine=ns32k-pc532
280 ;;
281 symmetry)
282 basic_machine=i386-sequent
283 os=-dynix
284 ;;
285 sun2)
286 basic_machine=m68000-sun
287 ;;
288 sun2os3)
289 basic_machine=m68000-sun
290 os=-sunos3
291 ;;
292 sun2os4)
293 basic_machine=m68000-sun
294 os=-sunos4
295 ;;
296 sun3os3)
297 basic_machine=m68k-sun
298 os=-sunos3
299 ;;
300 sun3os4)
301 basic_machine=m68k-sun
302 os=-sunos4
303 ;;
304 sun4os3)
305 basic_machine=sparc-sun
306 os=-sunos3
307 ;;
308 sun4os4)
309 basic_machine=sparc-sun
310 os=-sunos4
311 ;;
312 sun4sol2)
313 basic_machine=sparc-sun
314 os=-solaris2
315 ;;
316 z8ksim)
317 basic_machine=z8k-unknown
318 os=-sim
319 ;;
320 sun3)
321 basic_machine=m68k-sun
322 ;;
323 sun4)
324 basic_machine=sparc-sun
325 ;;
326 msdos)
327 basic_machine=i386-unknown
328 os=-msdos
329 ;;
330 pbd)
331 basic_machine=sparc-unicom
332 ;;
333 sun386 | sun386i | roadrunner)
334 basic_machine=i386-sun
335 ;;
336 ps2)
337 basic_machine=i386-ibm
338 ;;
339 next)
340 basic_machine=m68k-next
341 os=-bsd
342 ;;
343 hp9k3[2-9][0-9])
344 basic_machine=m68k-hp
345 ;;
346 hp9k31[0-9] | hp9k2[0-9][0-9])
347 basic_machine=m68000-hp
348 ;;
349 hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
350 basic_machine=hppa1.1-hp
351 ;;
352 hp9k8[0-9][0-9] | hp8[0-9][0-9])
353 basic_machine=hppa1.0-hp
354 ;;
355 isi68 | isi)
356 basic_machine=m68k-isi
357 os=-sysv
358 ;;
359 apollo68)
360 basic_machine=m68k-apollo
361 os=-sysv
362 ;;
363 apollo68bsd)
364 basic_machine=m68k-apollo
365 os=-bsd
366 ;;
367 altos | altos3068)
368 basic_machine=m68k-altos
369 ;;
370 miniframe)
371 basic_machine=m68000-convergent
372 ;;
373 tower | tower-32)
374 basic_machine=m68k-ncr
375 ;;
376 news-3600 | risc-news)
377 basic_machine=mips-sony
378 os=-newsos
379 ;;
380 st2000)
381 basic_machine=m68kmote-tandem
382 ;;
383 decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
384 basic_machine=mips-dec
385 ;;
386 magnum | m3230)
387 basic_machine=mips-mips
388 os=-sysv
389 ;;
390 gmicro)
391 basic_machine=tron-gmicro
392 os=-sysv
393 ;;
394 rtpc | rtpc-*)
395 basic_machine=romp-ibm
396 ;;
397 am29k)
398 basic_machine=a29k-none
399 os=-bsd
400 ;;
401 amdahl)
402 basic_machine=580-amdahl
403 os=-sysv
404 ;;
405 amigados)
406 basic_machine=m68k-cbm
407 os=-amigados
408 ;;
409 amigaunix | amix)
410 basic_machine=m68k-cbm
411 os=-sysv4
412 ;;
413 stratus)
414 basic_machine=i860-stratus
415 os=-sysv4
416 ;;
417 cray | ymp)
418 basic_machine=ymp-cray
419 os=-unicos
420 ;;
421 cray2)
422 basic_machine=cray2-cray
423 os=-unicos
424 ;;
425 xmp)
426 basic_machine=xmp-cray
427 os=-unicos
428 ;;
429 delta88)
430 basic_machine=m88k-motorola
431 os=-m88kbcs
432 ;;
433 dpx2)
434 basic_machine=m68k-bull
435 os=-sysv
436 ;;
437 ebmon29k)
438 basic_machine=a29k-amd
439 os=-ebmon
440 ;;
441
442 h8300hms)
443 basic_machine=h8300-hitachi
444 os=-hms
445 ;;
446 udi29k)
447 basic_machine=a29k-amd
448 os=-udi
449 ;;
450 a29khif)
451 basic_machine=a29k-amd
452 os=-udi
453 ;;
454 sa29200)
455 basic_machine=a29k-amd
456 os=-udi
457 ;;
458 h8300xray)
459 basic_machine=h8300-hitachi
460 os=-xray
461 ;;
462 harris)
463 basic_machine=m88k-harris
464 os=-m88kbcs
465 ;;
466 hp300bsd)
467 basic_machine=m68k-hp
468 os=-bsd
469 ;;
470 hp300hpux)
471 basic_machine=m68k-hp
472 os=-hpux
473 ;;
474 hp9k2[0-9][0-9] | hp9k31[0-9])
475 basic_machine=m68000-hp
476 os=-hpux
477 ;;
478 hp9k3[2-9][0-9])
479 basic_machine=m68k-hp
480 os=-hpux
481 ;;
482 hppabsd)
483 basic_machine=hppa-hp
484 os=-bsd
485 ;;
486 hppahpux)
487 basic_machine=hppa-hp
488 os=-hpux
489 ;;
490 ncr3000)
491 basic_machine=i486-ncr
492 os=-sysv4
493 ;;
494 necv70)
495 basic_machine=v70-nec
496 os=-sysv
497 ;;
498 news1000)
499 basic_machine=m68030-sony
500 os=-newsos
501 ;;
502 nindy960)
503 basic_machine=i960-intel
504 os=-nindy
505 ;;
506 pn)
507 basic_machine=pn-gould
508 os=-sysv
509 ;;
510 np1)
511 basic_machine=np1-gould
512 os=-sysv
513 ;;
514 ultra3)
515 basic_machine=a29k-nyu
516 os=-sym1
517 ;;
518 vxworks960)
519 basic_machine=i960-wrs
520 os=-vxworks
521 ;;
522 vxworks68)
523 basic_machine=m68k-wrs
524 os=-vxworks
525 ;;
526 es1800 | OSE68k | ose68k)
527 basic_machine=m68k-ericsson
528 os=-ose
529 ;;
530 OSE68000 | ose68000)
531 basic_machine=m68000-ericsson
532 os=-ose
533 ;;
534 os68k)
535 basic_machine=m68k-none
536 os=-os68k
537 ;;
538 sparclite)
539 basic_machine=sparclite-fujitsu
540 os=-none
541 ;;
542 sparclite-wrs)
543 basic_machine=sparclite-wrs
544 os=-vxworks
545 ;;
546 sparcfrw)
547 basic_machine=sparcfrw-sun
548 os=-sunos4
549 ;;
550 sparcfrwcompat)
551 basic_machine=sparcfrwcompat-sun
552 os=-sunos4
553 ;;
554 sparclitefrw)
555 basic_machine=sparclitefrw-fujitsu
556 os=-none
557 ;;
558 sparclitefrwcompat)
559 basic_machine=sparclitefrwcompat-fujitsu
560 os=-none
561 ;;
562 adobe68k)
563 basic_machine=m68010-adobe
564 os=-scout
565 ;;
566
567 none)
568 basic_machine=none-none
569 os=-none
570 ;;
571
572 # Here we handle the default manufacturer of certain CPU types. It is in
573 # some cases the only manufacturer, in others, it is the most popular.
574 mips)
575 basic_machine=mips-mips
576 ;;
577 romp)
578 basic_machine=romp-ibm
579 ;;
580 rs6000)
581 basic_machine=rs6000-ibm
582 ;;
583 vax)
584 basic_machine=vax-dec
585 ;;
586 sparc)
587 basic_machine=sparc-sun
588 ;;
589 fx2800)
590 basic_machine=i860-alliant
591 ;;
592 *)
593 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
594 exit 1
595 ;;
596 esac
597
598 # Decode manufacturer-specific aliases for certain operating systems.
599
600 if [ "$os" ]
601 then
602 case $os in
603 # First accept the basic system types.
604 # The portable systems comes first.
605 # Each alternative must end in a *, to match a version number.
606 -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* \
607 | -aout | -coff | -elf \
608 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
609 | -unos* | -osf* | -v88r* | -luna* | -dgux* | -solaris* | -sym* \
610 | -newsos | -amigados* | -msdos* | -none* | -os68k* | -irix* \
611 | -nindy* | -vxworks* | -ebmon* | -udi | -hms* | -xray \
612 | -m88kbcs* | -go32 | -linux* | -sim | -es1800*)
613 ;;
614 # start-sanitize-v9
615 -v7 | -v9 | -hal32 | -hal64) ;;
616 # end-sanitize-v9
617
618 # Note that readline checks for newsos
619 # -newsos*)
620 # os=-bsd
621 # ;;
622 -osfrose*)
623 os=-osf
624 ;;
625 -osf*)
626 os=-bsd
627 ;;
628 -dynix*)
629 os=-bsd
630 ;;
631 -aos*)
632 os=-bsd
633 ;;
634 -386bsd)
635 os=-bsd
636 ;;
637 -ctix* | -uts*)
638 os=-sysv
639 ;;
640 -svr4)
641 os=-sysv4
642 ;;
643 -svr3)
644 os=-sysv3
645 ;;
646 -ose*)
647 os=-ose
648 ;;
649 -es1800*)
650 os=-ose
651 ;;
652 *)
653 # Get rid of the `-' at the beginning of $os.
654 os=`echo $1 | sed 's/[^-]*-//'`
655 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
656 exit 1
657 ;;
658 esac
659 else
660
661 # Here we handle the default operating systems that come with various machines.
662 # The value should be what the vendor currently ships out the door with their
663 # machine or put another way, the most popular os provided with the machine.
664 case $basic_machine in
665 *-dec | vax-*)
666 os=-ultrix42
667 ;;
668 i386-sun)
669 os=-sunos402
670 ;;
671 m68000-sun)
672 os=-sunos3
673 # This also exists in the configure program, but was not the
674 # default.
675 # os=-sunos4
676 ;;
677 sparc-* | *-sun)
678 os=-sunos411
679 ;;
680 romp-*)
681 os=-bsd
682 ;;
683 *-ibm)
684 os=-aix
685 ;;
686 *-hp)
687 os=-hpux
688 ;;
689 *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
690 os=-sysv
691 ;;
692 *-dg)
693 os=-dgux
694 ;;
695 m88k-omron*)
696 os=-luna
697 ;;
698 *-crds)
699 os=-unos
700 ;;
701 *-ns)
702 os=-genix
703 ;;
704 i386-*)
705 os=-scosysv322
706 ;;
707 *)
708 os=-none
709 ;;
710 esac
711 fi
712
713 # Here we handle the case where we know the os, and the CPU type, but not the
714 # manufacturer. We pick the logical manufacturer.
715 vendor=unknown
716 case $basic_machine in
717 *-unknown)
718 case $os in
719 -sunos*)
720 vendor=sun
721 ;;
722 -aix*)
723 vendor=ibm
724 ;;
725 -hpux*)
726 vendor=hp
727 ;;
728 -unos*)
729 vendor=crds
730 ;;
731 -dgux*)
732 vendor=dg
733 ;;
734 -luna*)
735 vendor=omron
736 ;;
737 -genix*)
738 vendor=ns
739 ;;
740 -vxworks*)
741 vendor=wrs
742 ;;
743 esac
744 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
745 ;;
746 esac
747
748 echo $basic_machine$os
This page took 0.045886 seconds and 5 git commands to generate.