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