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