(os): Accept coff as an OS.
[kopensolaris-gnu/glibc.git] / config.sub
1 #!/bin/sh
2 # Configuration validation subroutine script, version 1.1.
3 #   Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 # This file is (in principle) common to ALL GNU software.
5 # The presence of a machine in this file suggests that SOME GNU software
6 # can handle that machine.  It does not imply ALL GNU software can. 
7
8 #This file is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 2 of the License, or
11 #(at your option) any later version.
12
13 #This program is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #GNU General Public License for more details.
17
18 #You should have received a copy of the GNU General Public License
19 #along with this program; if not, write to the Free Software
20 #Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22
23 # Configuration subroutine to validate and canonicalize a configuration type.
24 # Supply the specified configuration type as an argument.
25 # If it is invalid, we print an error message on stderr and exit with code 1.
26 # Otherwise, we print the canonical config type on stdout and succeed.
27
28 # This file is supposed to be the same for all GNU packages
29 # and recognize all the CPU types, system types and aliases
30 # that are meaningful with *any* GNU software.
31 # Each package is responsible for reporting which valid configurations
32 # it does not support.  The user should be able to distinguish
33 # a failure to support a valid configuration from a meaningless
34 # configuration.
35
36 # The goal of this file is to map all the various variations of a given
37 # machine specification into a single specification in the form:
38 #       CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
39 # It is wrong to echo any other type of specification.
40
41 # First pass through any local machine types.
42 case $1 in
43         *local*)
44                 echo $1
45                 exit 0
46                 ;;
47         *)
48         ;;
49 esac
50
51 # Separate what the user gave into CPU-COMPANY and OS (if any).
52 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
53 if [ $basic_machine != $1 ]
54 then os=`echo $1 | sed 's/.*-/-/'`
55 else os=; fi
56
57 ### Let's recognize common machines as not being operating systems so
58 ### that things like config.sub decstation-3100 work.  We also
59 ### recognize some manufacturers as not being operating systems, so we
60 ### can provide default operating systems below.
61 case $os in
62         -sun*os*)
63                 # Prevent following clause from handling this invalid input.
64                 ;;
65         -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
66         -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
67         -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
68         -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
69         -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
70         -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
71                 os=
72                 basic_machine=$1
73                 ;;
74         -hiux*)
75                 os=-hiuxwe2
76                 ;;
77         -sco4)
78                 os=-sco3.2v4
79                 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
80                 ;;
81         -sco3.2.[4-9]*)
82                 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
83                 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
84                 ;;
85         -sco3.2v[4-9]*)
86                 # Don't forget version if it is 3.2v4 or newer.
87                 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
88                 ;;
89         -sco*)
90                 os=-sco3.2v2
91                 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
92                 ;;
93         -isc)
94                 os=-isc2.2
95                 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
96                 ;;
97         -clix*)
98                 basic_machine=clipper-intergraph
99                 ;;
100         -isc*)
101                 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
102                 ;;
103         -lynx)
104                 os=-lynxos
105                 ;;
106         -ptx*)
107                 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
108                 ;;
109 esac
110
111 # Decode aliases for certain CPU-COMPANY combinations.
112 case $basic_machine in
113         # Recognize the basic CPU types without company name.
114         # Some are omitted here because they have special meanings below.
115         tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
116                 | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
117                 | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
118                 | powerpc | sparc64 | 1750a | dsp16xx)
119                 basic_machine=$basic_machine-unknown
120                 ;;
121         # Object if more than one company name word.
122         *-*-*)
123                 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
124                 exit 1
125                 ;;
126         # Recognize the basic CPU types with company name.
127         vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
128               | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
129               | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
130               | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
131               | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
132               | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
133               | sh-* | powerpc-* | sparc64-*)
134                 ;;
135         # Recognize the various machine names and aliases which stand
136         # for a CPU type and a company and sometimes even an OS.
137         3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
138                 basic_machine=m68000-att
139                 ;;
140         3b*)
141                 basic_machine=we32k-att
142                 ;;
143         alliant | fx80)
144                 basic_machine=fx80-alliant
145                 ;;
146         altos | altos3068)
147                 basic_machine=m68k-altos
148                 ;;
149         am29k)
150                 basic_machine=a29k-none
151                 os=-bsd
152                 ;;
153         amdahl)
154                 basic_machine=580-amdahl
155                 os=-sysv
156                 ;;
157         amiga | amiga-*)
158                 basic_machine=m68k-cbm
159                 ;;
160         amigados)
161                 basic_machine=m68k-cbm
162                 os=-amigados
163                 ;;
164         amigaunix | amix)
165                 basic_machine=m68k-cbm
166                 os=-sysv4
167                 ;;
168         apollo68)
169                 basic_machine=m68k-apollo
170                 os=-sysv
171                 ;;
172         balance)
173                 basic_machine=ns32k-sequent
174                 os=-dynix
175                 ;;
176         convex-c1)
177                 basic_machine=c1-convex
178                 os=-bsd
179                 ;;
180         convex-c2)
181                 basic_machine=c2-convex
182                 os=-bsd
183                 ;;
184         convex-c32)
185                 basic_machine=c32-convex
186                 os=-bsd
187                 ;;
188         convex-c34)
189                 basic_machine=c34-convex
190                 os=-bsd
191                 ;;
192         convex-c38)
193                 basic_machine=c38-convex
194                 os=-bsd
195                 ;;
196         cray | ymp)
197                 basic_machine=ymp-cray
198                 os=-unicos
199                 ;;
200         cray2)
201                 basic_machine=cray2-cray
202                 os=-unicos
203                 ;;
204         crds | unos)
205                 basic_machine=m68k-crds
206                 ;;
207         da30 | da30-*)
208                 basic_machine=m68k-da30
209                 ;;
210         decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
211                 basic_machine=mips-dec
212                 ;;
213         delta | 3300 | motorola-3300 | motorola-delta \
214               | 3300-motorola | delta-motorola)
215                 basic_machine=m68k-motorola
216                 ;;
217         delta88)
218                 basic_machine=m88k-motorola
219                 os=-sysv3
220                 ;;
221         dpx20 | dpx20-*)
222                 basic_machine=rs6000-bull
223                 os=-bosx
224                 ;;
225         dpx2* | dpx2*-bull)
226                 basic_machine=m68k-bull
227                 os=-sysv3
228                 ;;
229         ebmon29k)
230                 basic_machine=a29k-amd
231                 os=-ebmon
232                 ;;
233         elxsi)
234                 basic_machine=elxsi-elxsi
235                 os=-bsd
236                 ;;
237         encore | umax | mmax)
238                 basic_machine=ns32k-encore
239                 ;;
240         fx2800)
241                 basic_machine=i860-alliant
242                 ;;
243         genix)
244                 basic_machine=ns32k-ns
245                 ;;
246         gmicro)
247                 basic_machine=tron-gmicro
248                 os=-sysv
249                 ;;
250         h3050r* | hiux*)
251                 basic_machine=hppa1.1-hitachi
252                 os=-hiuxwe2
253                 ;;
254         h8300hms)
255                 basic_machine=h8300-hitachi
256                 os=-hms
257                 ;;
258         harris)
259                 basic_machine=m88k-harris
260                 os=-sysv3
261                 ;;
262         hp300-*)
263                 basic_machine=m68k-hp
264                 ;;
265         hp300bsd)
266                 basic_machine=m68k-hp
267                 os=-bsd
268                 ;;
269         hp300hpux)
270                 basic_machine=m68k-hp
271                 os=-hpux
272                 ;;
273         hp9k2[0-9][0-9] | hp9k31[0-9])
274                 basic_machine=m68000-hp
275                 ;;
276         hp9k3[2-9][0-9])
277                 basic_machine=m68k-hp
278                 ;;
279         hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
280                 basic_machine=hppa1.1-hp
281                 ;;
282         hp9k8[0-9][0-9] | hp8[0-9][0-9])
283                 basic_machine=hppa1.0-hp
284                 ;;
285         i370-ibm* | ibm*)
286                 basic_machine=i370-ibm
287                 os=-mvs
288                 ;;
289 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
290         i[345]86v32)
291                 basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
292                 os=-sysv32
293                 ;;
294         i[345]86v4*)
295                 basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
296                 os=-sysv4
297                 ;;
298         i[345]86v)
299                 basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
300                 os=-sysv
301                 ;;
302         i[345]86sol2)
303                 basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
304                 os=-solaris2
305                 ;;
306         iris | iris4d)
307                 basic_machine=mips-sgi
308                 case $os in
309                     -irix*)
310                         ;;
311                     *)
312                         os=-irix4
313                         ;;
314                 esac
315                 ;;
316         isi68 | isi)
317                 basic_machine=m68k-isi
318                 os=-sysv
319                 ;;
320         m88k-omron*)
321                 basic_machine=m88k-omron
322                 ;;
323         magnum | m3230)
324                 basic_machine=mips-mips
325                 os=-sysv
326                 ;;
327         merlin)
328                 basic_machine=ns32k-utek
329                 os=-sysv
330                 ;;
331         miniframe)
332                 basic_machine=m68000-convergent
333                 ;;
334         ncr3000)
335                 basic_machine=i486-ncr
336                 os=-sysv4
337                 ;;
338         news | news700 | news800 | news900)
339                 basic_machine=m68k-sony
340                 os=-newsos
341                 ;;
342         news1000)
343                 basic_machine=m68030-sony
344                 os=-newsos
345                 ;;
346         news-3600 | risc-news)
347                 basic_machine=mips-sony
348                 os=-newsos
349                 ;;
350         next | m*-next )
351                 basic_machine=m68k-next
352                 case $os in
353                     -nextstep* )
354                         ;;
355                     -ns2*)
356                       os=-nextstep2
357                         ;;
358                     *)
359                       os=-nextstep3
360                         ;;
361                 esac
362                 ;;
363         nh3000)
364                 basic_machine=m68k-harris
365                 os=-cxux
366                 ;;
367         nh[45]000)
368                 basic_machine=m88k-harris
369                 os=-cxux
370                 ;;
371         nindy960)
372                 basic_machine=i960-intel
373                 os=-nindy
374                 ;;
375         np1)
376                 basic_machine=np1-gould
377                 ;;
378         pa-hitachi)
379                 basic_machine=hppa1.1-hitachi
380                 os=-hiuxwe2
381                 ;;
382         paragon)
383                 basic_machine=i860-intel
384                 os=-osf
385                 ;;
386         pbd)
387                 basic_machine=sparc-tti
388                 ;;
389         pbb)
390                 basic_machine=m68k-tti
391                 ;;
392         pc532 | pc532-*)
393                 basic_machine=ns32k-pc532
394                 ;;
395         pentium-*)
396                 # We will change tis to say i586 once there has been
397                 # time for various packages to start to recognize that.
398                 basic_machine=i486-`echo $basic_machine | sed 's/^[^-]*-//'`
399                 ;;
400         pn)
401                 basic_machine=pn-gould
402                 ;;
403         ps2)
404                 basic_machine=i386-ibm
405                 ;;
406         rtpc | rtpc-*)
407                 basic_machine=romp-ibm
408                 ;;
409         sequent)
410                 basic_machine=i386-sequent
411                 ;;
412         sh)
413                 basic_machine=sh-hitachi
414                 os=-hms
415                 ;;
416         sps7)
417                 basic_machine=m68k-bull
418                 os=-sysv2
419                 ;;
420         spur)
421                 basic_machine=spur-unknown
422                 ;;
423         sun2)
424                 basic_machine=m68000-sun
425                 ;;
426         sun2os3)
427                 basic_machine=m68000-sun
428                 os=-sunos3
429                 ;;
430         sun2os4)
431                 basic_machine=m68000-sun
432                 os=-sunos4
433                 ;;
434         sun3os3)
435                 basic_machine=m68k-sun
436                 os=-sunos3
437                 ;;
438         sun3os4)
439                 basic_machine=m68k-sun
440                 os=-sunos4
441                 ;;
442         sun4os3)
443                 basic_machine=sparc-sun
444                 os=-sunos3
445                 ;;
446         sun4os4)
447                 basic_machine=sparc-sun
448                 os=-sunos4
449                 ;;
450         sun3 | sun3-*)
451                 basic_machine=m68k-sun
452                 ;;
453         sun4)
454                 basic_machine=sparc-sun
455                 ;;
456         sun386 | sun386i | roadrunner)
457                 basic_machine=i386-sun
458                 ;;
459         symmetry)
460                 basic_machine=i386-sequent
461                 os=-dynix
462                 ;;
463         tower | tower-32)
464                 basic_machine=m68k-ncr
465                 ;;
466         ultra3)
467                 basic_machine=a29k-nyu
468                 os=-sym1
469                 ;;
470         vaxv)
471                 basic_machine=vax-dec
472                 os=-sysv
473                 ;;
474         vms)
475                 basic_machine=vax-dec
476                 os=-vms
477                 ;;
478         vxworks960)
479                 basic_machine=i960-wrs
480                 os=-vxworks
481                 ;;
482         vxworks68)
483                 basic_machine=m68k-wrs
484                 os=-vxworks
485                 ;;
486         xmp)
487                 basic_machine=xmp-cray
488                 os=-unicos
489                 ;;
490         xps | xps100)
491                 basic_machine=xps100-honeywell
492                 ;;
493         none)
494                 basic_machine=none-none
495                 os=-none
496                 ;;
497
498 # Here we handle the default manufacturer of certain CPU types.  It is in
499 # some cases the only manufacturer, in others, it is the most popular.
500         mips)
501                 basic_machine=mips-mips
502                 ;;
503         romp)
504                 basic_machine=romp-ibm
505                 ;;
506         rs6000)
507                 basic_machine=rs6000-ibm
508                 ;;
509         vax)
510                 basic_machine=vax-dec
511                 ;;
512         we32k)
513                 basic_machine=we32k-att
514                 ;;
515         sparc)
516                 basic_machine=sparc-sun
517                 ;;
518         cydra)
519                 basic_machine=cydra-cydrome
520                 ;;
521         orion)
522                 basic_machine=orion-highlevel
523                 ;;
524         orion105)
525                 basic_machine=clipper-highlevel
526                 ;;
527         *)
528                 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
529                 exit 1
530                 ;;
531 esac
532
533 # Here we canonicalize certain aliases for manufacturers.
534 case $basic_machine in
535         *-digital*)
536                 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
537                 ;;
538         *-commodore*)
539                 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
540                 ;;
541         *)
542                 ;;
543 esac
544
545 # Decode manufacturer-specific aliases for certain operating systems.
546
547 if [ x"$os" != x"" ]
548 then
549 case $os in
550         # -solaris* is a basic system type, with this one exception.
551         -solaris1 | -solaris1.*)
552                 os=`echo $os | sed -e 's|solaris1|sunos4|'`
553                 ;;
554         -solaris)
555                 os=-solaris2
556                 ;;
557         # First accept the basic system types.
558         # The portable systems comes first.
559         # Each alternative must end in a *, to match a version number.
560         # -sysv* is not here because it comes later, after sysvr4.
561         -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
562               | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
563               | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
564               | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
565               | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
566               | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
567               | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
568               | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
569               | -ptx* | -coff*)
570                 ;;
571         -sunos5*)
572                 os=`echo $os | sed -e 's|sunos5|solaris2|'`
573                 ;;
574         -sunos6*)
575                 os=`echo $os | sed -e 's|sunos6|solaris3|'`
576                 ;;
577         -osfrose*)
578                 os=-osfrose
579                 ;;
580         -osf*)
581                 os=-osf
582                 ;;
583         -utek*)
584                 os=-bsd
585                 ;;
586         -dynix*)
587                 os=-bsd
588                 ;;
589         -acis*)
590                 os=-aos
591                 ;;
592         -ctix* | -uts*)
593                 os=-sysv
594                 ;;
595         -triton*)
596                 os=-sysv3
597                 ;;
598         -oss*)
599                 os=-sysv3
600                 ;;
601         -svr4)
602                 os=-sysv4
603                 ;;
604         -svr3)
605                 os=-sysv3
606                 ;;
607         -sysvr4)
608                 os=-sysv4
609                 ;;
610         # This must come after -sysvr4.
611         -sysv*)
612                 ;;
613         -xenix)
614                 os=-xenix
615                 ;;
616         -none)
617                 ;;
618         *)
619                 # Get rid of the `-' at the beginning of $os.
620                 os=`echo $os | sed 's/[^-]*-//'`
621                 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
622                 exit 1
623                 ;;
624 esac
625 else
626
627 # Here we handle the default operating systems that come with various machines.
628 # The value should be what the vendor currently ships out the door with their
629 # machine or put another way, the most popular os provided with the machine.
630
631 # Note that if you're going to try to match "-MANUFACTURER" here (say,
632 # "-sun"), then you have to tell the case statement up towards the top
633 # that MANUFACTURER isn't an operating system.  Otherwise, code above
634 # will signal an error saying that MANUFACTURER isn't an operating
635 # system, and we'll never get to this point.
636
637 case $basic_machine in
638         *-acorn)
639                 os=-riscix1.2
640                 ;;
641         *-dec | vax-*)
642                 os=-ultrix4.2
643                 ;;
644         i386-sun)
645                 os=-sunos4.0.2
646                 ;;
647         m68000-sun)
648                 os=-sunos3
649                 # This also exists in the configure program, but was not the
650                 # default.
651                 # os=-sunos4
652                 ;;
653         *-tti)  # must be before sparc entry or we get the wrong os.
654                 os=-sysv3
655                 ;;
656         sparc-* | *-sun)
657                 os=-sunos4.1.1
658                 ;;
659         *-ibm)
660                 os=-aix
661                 ;;
662         *-hp)
663                 os=-hpux
664                 ;;
665         *-hitachi)
666                 os=-hiux
667                 ;;
668         i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
669                 os=-sysv
670                 ;;
671         *-cbm)
672                 os=-amigados
673                 ;;
674         *-dg)
675                 os=-dgux
676                 ;;
677         *-dolphin)
678                 os=-sysv3
679                 ;;
680         m68k-ccur)
681                 os=-rtu
682                 ;;
683         m88k-omron*)
684                 os=-luna
685                 ;;
686         *-sequent)
687                 os=-ptx
688                 ;;
689         *-crds)
690                 os=-unos
691                 ;;
692         *-ns)
693                 os=-genix
694                 ;;
695         i370-*)
696                 os=-mvs
697                 ;;
698         *-next)
699                 os=-nextstep3
700                 ;;
701         *-gould)
702                 os=-sysv
703                 ;;
704         *-highlevel)
705                 os=-bsd
706                 ;;
707         *-encore)
708                 os=-bsd
709                 ;;
710         *-sgi)
711                 os=-irix
712                 ;;
713         *-masscomp)
714                 os=-rtu
715                 ;;
716         *)
717                 os=-none
718                 ;;
719 esac
720 fi
721
722 # Here we handle the case where we know the os, and the CPU type, but not the
723 # manufacturer.  We pick the logical manufacturer.
724 vendor=unknown
725 case $basic_machine in
726         *-unknown)
727                 case $os in
728                         -riscix*)
729                                 vendor=acorn
730                                 ;;
731                         -sunos*)
732                                 vendor=sun
733                                 ;;
734                         -lynxos*)
735                                 vendor=lynx
736                                 ;;
737                         -aix*)
738                                 vendor=ibm
739                                 ;;
740                         -hpux*)
741                                 vendor=hp
742                                 ;;
743                         -hiux*)
744                                 vendor=hitachi
745                                 ;;
746                         -unos*)
747                                 vendor=crds
748                                 ;;
749                         -dgux*)
750                                 vendor=dg
751                                 ;;
752                         -luna*)
753                                 vendor=omron
754                                 ;;
755                         -genix*)
756                                 vendor=ns
757                                 ;;
758                         -mvs*)
759                                 vendor=ibm
760                                 ;;
761                         -ptx*)
762                                 vendor=sequent
763                                 ;;
764                 esac
765                 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
766                 ;;
767 esac
768
769 echo $basic_machine$os