Now can list for bout format too
[external/binutils.git] / config.sub
1 #!/bin/sh
2 # Configuration validation subroutine script, version 1.0.
3 #   Copyright (C) 1991 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)
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       
88 esac
89
90 # Decode aliases for certain CPU-COMPANY combinations.
91 case $basic_machine in
92         # Recognize the basic CPU types with without company name.
93         tahoe | i386 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
94                 | tron | a29k | 580 | i960 | h8300)
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.
106 # start-sanitize-life
107         life-*) ;;
108         life)
109                 basic_machine=life-philips
110                 os=-none
111                 ;;
112 # end-sanitize-life
113
114 # start-sanitize-v9
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                 ;;
132 # end-sanitize-v9
133
134         vaxv)
135                 basic_machine=vax-dec
136                 os=-sysv
137                 ;;
138         vms)
139                 basic_machine=vax-dec
140                 os=-vms
141                 ;;
142         i386v32)
143                 basic_machine=i386-unknown
144                 os=-sysv32
145                 ;;
146         i386-sco* | i386sco | sco)
147                 basic_machine=i386-unknown
148                 os=-scosysv322
149                 ;;
150         i386-isc* | isc)
151                 basic_machine=i386-unknown
152                 os=-iscsysv
153                 ;;
154         i386v4*)
155                 basic_machine=i386-unknown
156                 os=-sysv4
157                 ;;
158         i386v)
159                 basic_machine=i386-unknown
160                 os=-sysv
161                 ;;
162         spur)
163                 basic_machine=spur-unknown
164                 ;;
165         alliant)
166                 basic_machine=alliant-alliant
167                 ;;
168         convex-c1)
169                 basic_machine=c1-convex
170                 os=-sysv
171                 ;;
172         convex-c2)
173                 basic_machine=c2-convex
174                 os=-sysv
175                 ;;
176         convex-c32)
177                 basic_machine=c32-convex
178                 os=-sysv
179                 ;;
180         convex-c34)
181                 basic_machine=c34-convex
182                 os=-sysv
183                 ;;
184         convex-c38)
185                 basic_machine=c38-convex
186                 os=-sysv
187                 ;;
188         m88k-omron*)
189                 basic_machine=m88k-omron
190                 ;;
191         merlin)
192                 basic_machine=ns32k-utek
193                 os=-sysv
194                 ;;
195         crds | unos)
196                 basic_machine=m68k-crds
197                 ;;
198         encore | umax | mmax)
199                 basic_machine=ns32k-encore
200                 os=-sysv
201                 ;;
202         genix)
203                 basic_machine=ns32k-ns
204                 ;;
205         iris | iris4d)
206                 basic_machine=mips-sgi
207                 os=-irix
208                 ;;
209         news | news700 | news800 | news900)
210                 basic_machine=m68k-sony
211                 os=-newsos
212                 ;;
213         3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
214                 basic_machine=m68k-att
215                 ;;
216         delta | 3300 | motorola-3300 | motorola-delta \
217               | 3300-motorola | delta-motorola)
218                 basic_machine=m68k-motorola
219                 ;;
220         balance)
221                 basic_machine=ns32k-sequent
222                 os=-dynix
223                 ;;
224         pc532)
225                 basic_machine=ns32k-pc532
226                 ;;
227         symmetry)
228                 basic_machine=i386-sequent
229                 os=-dynix
230                 ;;
231         sun2)
232                 basic_machine=m68000-sun
233                 ;;
234         sun2os3)
235                 basic_machine=m68000-sun
236                 os=-sunos3
237                 ;;
238         sun2os4)
239                 basic_machine=m68000-sun
240                 os=-sunos4
241                 ;;
242         sun3os3)
243                 basic_machine=m68k-sun
244                 os=-sunos3
245                 ;;
246         sun3os4)
247                 basic_machine=m68k-sun
248                 os=-sunos4
249                 ;;
250         sun4os3)
251                 basic_machine=sparc-sun
252                 os=-sunos3
253                 ;;
254         sun4os4)
255                 basic_machine=sparc-sun
256                 os=-sunos4
257                 ;;
258         sun3)
259                 basic_machine=m68k-sun
260                 ;;
261         sun4)
262                 basic_machine=sparc-sun
263                 ;;
264         pbd)
265                 basic_machine=sparc-unicom
266                 ;;
267         sun386 | sun386i | roadrunner)
268                 basic_machine=i386-sun
269                 ;;
270         ps2)
271                 basic_machine=i386-ibm
272                 ;;
273         next)
274                 basic_machine=m68k-next
275                 os=-sysv
276                 ;;
277         hp9k3[2-9][0-9])
278                 basic_machine=m68k-hp
279                 ;;
280         hp9k31[0-9] | hp9k2[0-9][0-9])
281                 basic_machine=m68000-hp
282                 ;;
283         hp9k8[0-9][0-9] | hp9k7[0-9][0-9] | hp8[0-9][0-9] | hp7[0-9][0-9])
284                 basic_machine=hp800-hp
285                 ;;
286         isi68 | isi)
287                 basic_machine=m68k-isi
288                 os=-sysv
289                 ;;
290         apollo68)
291                 basic_machine=m68k-apollo
292                 os=-sysv
293                 ;;
294         altos | altos3068)
295                 basic_machine=m68k-altos
296                 ;;
297         miniframe)
298                 basic_machine=m68000-convergent
299                 ;;
300         tower | tower-32)
301                 basic_machine=m68k-ncr
302                 ;;
303         news-3600 | risc-news)
304                 basic_machine=mips-sony
305                 os=-newsos
306                 ;;
307         decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
308                 basic_machine=mips-dec
309                 ;;
310         magnum | m3230)
311                 basic_machine=mips-mips
312                 os=-sysv
313                 ;;
314         gmicro)
315                 basic_machine=tron-gmicro
316                 os=-sysv
317                 ;;
318         rtpc | rtpc-*)
319                 basic_machine=romp-ibm
320                 ;;
321         am29k)
322                 basic_machine=a29k-none
323                 os=-bsd
324                 ;;
325         amdahl)
326                 basic_machine=580-amdahl
327                 os=-sysv
328                 ;;
329         amigados)
330                 basic_machine=m68k-cbm
331                 os=-amigados
332                 ;;
333         amigaunix | amix)
334                 basic_machine=m68k-cbm
335                 os=-sysv4
336                 ;;
337         cray | ymp)
338                 basic_machine=ymp-cray
339                 os=-unicos
340                 ;;
341         cray2)
342                 basic_machine=cray2-cray
343                 os=-unicos
344                 ;;
345         xmp)
346                 basic_machine=xmp-cray
347                 os=-unicos
348                 ;;
349         delta88)
350                 basic_machine=m88k-motorola
351                 os=-m88kbcs
352                 ;;
353         dpx2)
354                 basic_machine=m68k-bull
355                 os=-sysv
356                 ;;
357         ebmon29k)
358                 basic_machine=a29k-amd
359                 os=-ebmon
360                 ;;
361         h8300hds)
362                 basic_machine=h8300-hitachi
363                 os=-hds
364                 ;;
365         harris)
366                 basic_machine=m88k-harris
367                 os=-m88kbcs
368                 ;;
369         hp300bsd)
370                 basic_machine=m68k-hp
371                 os=-bsd
372                 ;;
373         hp300hpux)
374                 basic_machine=m68k-hp
375                 os=-hpux
376                 ;;
377         hp9k2[0-9][0-9] | hp9k31[0-9])
378                 basic_machine=m68000-hp
379                 os=-hpux
380                 ;;
381         hp9k3[2-9][0-9])
382                 basic_machine=m68k-hp
383                 os=-hpux
384                 ;;
385         ncr3000)
386                 basic_machine=i386-ncr
387                 os=-sysv4
388                 ;;
389         news1000)
390                 basic_machine=m68030-sony
391                 os=-newsos
392                 ;;
393         nindy960)
394                 basic_machine=i960-intel
395                 os=-nindy
396                 ;;
397         pn)
398                 basic_machine=pn-gould
399                 os=-sysv
400                 ;;
401         np1)
402                 basic_machine=np1-gould
403                 os=-sysv
404                 ;;
405         ultra3)
406                 basic_machine=a29k-nyu
407                 os=-sym1
408                 ;;
409         vxworks960)
410                 basic_machine=i960-wrs
411                 os=-vxworks
412                 ;;
413         vxworks68)
414                 basic_machine=m68k-wrs
415                 os=-vxworks
416                 ;;
417         none)
418                 basic_machine=none-none
419                 os=-none
420                 ;;
421
422 # Here we handle the default manufacturer of certain CPU types.  It is in
423 # some cases the only manufacturer, in others, it is the most popular.
424         mips)
425                 basic_machine=mips-mips
426                 ;;
427         romp)
428                 basic_machine=romp-ibm
429                 ;;
430         rs6000)
431                 basic_machine=rs6000-ibm
432                 ;;
433         vax)
434                 basic_machine=vax-dec
435                 ;;
436         sparc)
437                 basic_machine=sparc-sun
438                 ;;
439         fx2800)
440                 basic_machine=i860-alliant
441                 ;;
442         *)
443                 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
444                 exit 1
445                 ;;
446 esac
447
448 # Decode manufacturer-specific aliases for certain operating systems.
449
450 if [ "$os" ]
451 then
452 case $os in
453         # First accept the basic system types.
454         # The portable systems comes first.
455         # Each alternative must end in a *, to match a version number.
456         -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* \
457               | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
458               | -unos* | -osf* | -v88r* | -luna* | -dgux* | -solari* | -sym* \
459               | -amigados* | -msdos* | -none* \
460               | -nindy* | -vxworks* | -ebmon* | -hds* | -m88kbcs*)
461                 ;;
462 # start-sanitize-v9
463         -v7 | -v9 | -hal32 | -hal64) ;;
464 # end-sanitize-v9
465
466         -newsos*)
467                 os=-bsd
468                 ;;
469         -osfrose*)
470                 os=-osf
471                 ;;
472         -osf*)
473                 os=-bsd
474                 ;;
475         -dynix*)
476                 os=-bsd
477                 ;;
478         -aos*)
479                 os=-bsd
480                 ;;
481         -ctix* | -irix* | -uts*)
482                 os=-sysv
483                 ;;
484         -svr4)
485                 os=-sysv4
486                 ;;
487         -svr3)
488                 os=-sysv3
489                 ;;
490         *)
491                 # Get rid of the `-' at the beginning of $os.
492                 os=`echo $1 | sed 's/[^-]*-//'`
493                 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
494                 exit 1
495                 ;;
496 esac
497 else
498
499 # Here we handle the default operating systems that come with various machines.
500 # The value should be what the vendor currently ships out the door with their
501 # machine or put another way, the most popular os provided with the machine.
502 case $basic_machine in
503         *-dec | vax-*)
504                 os=-ultrix42
505                 ;;
506         i386-sun)
507                 os=-sunos402
508                 ;;
509         m68000-sun)
510                 os=-sunos3
511                 # This also exists in the configure program, but was not the
512                 # default.
513                 # os=-sunos4
514                 ;;
515         sparc-* | *-sun)
516                 os=-sunos411
517                 ;;
518         romp-*)
519                 os=-bsd
520                 ;;
521         *-ibm)
522                 os=-aix
523                 ;;
524         *-hp)
525                 os=-hpux
526                 ;;
527         *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
528                 os=-sysv
529                 ;;
530         *-dg)
531                 os=-dgux
532                 ;;
533         m88k-omron*)
534                 os=-luna
535                 ;;
536         *-crds)
537                 os=-unos
538                 ;;
539         *-ns)
540                 os=-genix
541                 ;;
542         i386-*)
543                 os=-scosysv322
544                 ;;
545         *)
546                 os=-none
547                 ;;
548 esac
549 fi
550
551 # Here we handle the case where we know the os, and the CPU type, but not the
552 # manufacturer.  We pick the logical manufacturer.
553 vendor=unknown
554 case $basic_machine in
555         *-unknown)
556                 case $os in
557                         -sunos*)
558                                 vendor=sun
559                                 ;;
560                         -aix*)
561                                 vendor=ibm
562                                 ;;
563                         -hpux*)
564                                 vendor=hp
565                                 ;;
566                         -unos*)
567                                 vendor=crds
568                                 ;;
569                         -dgux*)
570                                 vendor=dg
571                                 ;;
572                         -luna*)
573                                 vendor=omron
574                                 ;;
575                         -genix*)
576                                 vendor=ns
577                                 ;;
578                 esac
579                 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
580                 ;;
581 esac
582
583 echo $basic_machine$os