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