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