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