f8ec622e95b052747c1b1ddd1c3bf7ee9317fdae
[ncurses.git] / config.sub
1 #! /bin/sh
2 # Configuration validation subroutine script, version 1.1.
3 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
4 #   Free Software Foundation, Inc.
5
6 version='2000-07-06'
7
8 # This file is (in principle) common to ALL GNU software.
9 # The presence of a machine in this file suggests that SOME GNU software
10 # can handle that machine.  It does not imply ALL GNU software can.
11 #
12 # This file is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place - Suite 330,
25 # Boston, MA 02111-1307, USA.
26
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
31
32 # Please send patches to <config-patches@gnu.org>.
33 #
34 # Configuration subroutine to validate and canonicalize a configuration type.
35 # Supply the specified configuration type as an argument.
36 # If it is invalid, we print an error message on stderr and exit with code 1.
37 # Otherwise, we print the canonical config type on stdout and succeed.
38
39 # This file is supposed to be the same for all GNU packages
40 # and recognize all the CPU types, system types and aliases
41 # that are meaningful with *any* GNU software.
42 # Each package is responsible for reporting which valid configurations
43 # it does not support.  The user should be able to distinguish
44 # a failure to support a valid configuration from a meaningless
45 # configuration.
46
47 # The goal of this file is to map all the various variations of a given
48 # machine specification into a single specification in the form:
49 #       CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
50 # or in some cases, the newer four-part form:
51 #       CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
52 # It is wrong to echo any other type of specification.
53
54 me=`echo "$0" | sed -e 's,.*/,,'`
55
56 usage="\
57 Usage: $0 [OPTION] CPU-MFR-OPSYS
58        $0 [OPTION] ALIAS
59
60 Canonicalize a configuration name.
61
62 Operation modes:
63   -h, --help               print this help, then exit
64   -V, --version            print version number, then exit"
65
66 help="
67 Try \`$me --help' for more information."
68
69 # Parse command line
70 while test $# -gt 0 ; do
71   case "$1" in
72     --version | --vers* | -V )
73        echo "$version" ; exit 0 ;;
74     --help | --h* | -h )
75        echo "$usage"; exit 0 ;;
76     -- )     # Stop option processing
77        shift; break ;;
78     - ) # Use stdin as input.
79        break ;;
80     -* )
81        exec >&2
82        echo "$me: invalid option $1"
83        echo "$help"
84        exit 1 ;;
85
86     *local*)
87        # First pass through any local machine types.
88        echo $1
89        exit 0;;
90
91     * )
92        break ;;
93   esac
94 done
95
96 case $# in
97  0) echo "$me: missing argument$help" >&2
98     exit 1;;
99  1) ;;
100  *) echo "$me: too many arguments$help" >&2
101     exit 1;;
102 esac
103
104 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
105 # Here we must recognize all the valid KERNEL-OS combinations.
106 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
107 case $maybe_os in
108   nto-qnx* | linux-gnu*)
109     os=-$maybe_os
110     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
111     ;;
112   *)
113     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
114     if [ $basic_machine != $1 ]
115     then os=`echo $1 | sed 's/.*-/-/'`
116     else os=; fi
117     ;;
118 esac
119
120 ### Let's recognize common machines as not being operating systems so
121 ### that things like config.sub decstation-3100 work.  We also
122 ### recognize some manufacturers as not being operating systems, so we
123 ### can provide default operating systems below.
124 case $os in
125         -os2)
126                 basic_machine=`echo $1 | sed -e 's/86-.*/86/'`
127                 ;;
128         -sun*os*)
129                 # Prevent following clause from handling this invalid input.
130                 ;;
131         -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
132         -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
133         -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
134         -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
135         -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
136         -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
137         -apple | -axis)
138                 os=
139                 basic_machine=$1
140                 ;;
141         -sim | -cisco | -oki | -wec | -winbond)
142                 os=
143                 basic_machine=$1
144                 ;;
145         -scout)
146                 ;;
147         -wrs)
148                 os=-vxworks
149                 basic_machine=$1
150                 ;;
151         -hiux*)
152                 os=-hiuxwe2
153                 ;;
154         -sco5)
155                 os=-sco3.2v5
156                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
157                 ;;
158         -sco4)
159                 os=-sco3.2v4
160                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
161                 ;;
162         -sco3.2.[4-9]*)
163                 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
164                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
165                 ;;
166         -sco3.2v[4-9]*)
167                 # Don't forget version if it is 3.2v4 or newer.
168                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
169                 ;;
170         -sco*)
171                 os=-sco3.2v2
172                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
173                 ;;
174         -udk*)
175                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
176                 ;;
177         -isc)
178                 os=-isc2.2
179                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
180                 ;;
181         -clix*)
182                 basic_machine=clipper-intergraph
183                 ;;
184         -isc*)
185                 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186                 ;;
187         -lynx*)
188                 os=-lynxos
189                 ;;
190         -ptx*)
191                 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
192                 ;;
193         -windowsnt*)
194                 os=`echo $os | sed -e 's/windowsnt/winnt/'`
195                 ;;
196         -psos*)
197                 os=-psos
198                 ;;
199         -mint | -mint[0-9]*)
200                 basic_machine=m68k-atari
201                 os=-mint
202                 ;;
203 esac
204
205 # Decode aliases for certain CPU-COMPANY combinations.
206 case $basic_machine in
207         # Recognize the basic CPU types without company name.
208         # Some are omitted here because they have special meanings below.
209         tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
210                 | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
211                 | 580 | i960 | h8300 \
212                 | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
213                 | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
214                 | hppa64 \
215                 | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
216                 | alphaev6[78] \
217                 | we32k | ns16k | clipper | i370 | sh | sh[34] \
218                 | powerpc | powerpcle \
219                 | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
220                 | mips64orion | mips64orionel | mipstx39 | mipstx39el \
221                 | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
222                 | mips64vr5000 | miprs64vr5000el | mcore \
223                 | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
224                 | thumb | d10v | d30v | fr30 | avr)
225                 basic_machine=$basic_machine-unknown
226                 ;;
227         m6811 | m68hc11 | m6812 | m68hc12)
228                 # Motorola 68HC11/12.
229                 basic_machine=$basic_machine-unknown
230                 os=-none
231                 ;;
232         m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
233                 ;;
234
235         # We use `pc' rather than `unknown'
236         # because (1) that's what they normally are, and
237         # (2) the word "unknown" tends to confuse beginning users.
238         i[234567]86)
239           basic_machine=$basic_machine-pc
240           ;;
241         # Object if more than one company name word.
242         *-*-*)
243                 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
244                 exit 1
245                 ;;
246         # Recognize the basic CPU types with company name.
247         # FIXME: clean up the formatting here.
248         vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
249               | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
250               | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
251               | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
252               | xmp-* | ymp-* \
253               | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
254               | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
255               | hppa2.0n-* | hppa64-* \
256               | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
257               | alphaev6[78]-* \
258               | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
259               | clipper-* | orion-* \
260               | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
261               | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
262               | mips64el-* | mips64orion-* | mips64orionel-* \
263               | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
264               | mipstx39-* | mipstx39el-* | mcore-* \
265               | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
266               | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
267               | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
268               | bs2000-* | tic54x-* | c54x-*)
269                 ;;
270         # Recognize the various machine names and aliases which stand
271         # for a CPU type and a company and sometimes even an OS.
272         386bsd)
273                 basic_machine=i386-unknown
274                 os=-bsd
275                 ;;
276         3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
277                 basic_machine=m68000-att
278                 ;;
279         3b*)
280                 basic_machine=we32k-att
281                 ;;
282         a29khif)
283                 basic_machine=a29k-amd
284                 os=-udi
285                 ;;
286         adobe68k)
287                 basic_machine=m68010-adobe
288                 os=-scout
289                 ;;
290         alliant | fx80)
291                 basic_machine=fx80-alliant
292                 ;;
293         altos | altos3068)
294                 basic_machine=m68k-altos
295                 ;;
296         am29k)
297                 basic_machine=a29k-none
298                 os=-bsd
299                 ;;
300         amdahl)
301                 basic_machine=580-amdahl
302                 os=-sysv
303                 ;;
304         amiga | amiga-*)
305                 basic_machine=m68k-cbm
306                 ;;
307         amigaos | amigados)
308                 basic_machine=m68k-cbm
309                 os=-amigaos
310                 ;;
311         amigaunix | amix)
312                 basic_machine=m68k-cbm
313                 os=-sysv4
314                 ;;
315         apollo68)
316                 basic_machine=m68k-apollo
317                 os=-sysv
318                 ;;
319         apollo68bsd)
320                 basic_machine=m68k-apollo
321                 os=-bsd
322                 ;;
323         aux)
324                 basic_machine=m68k-apple
325                 os=-aux
326                 ;;
327         balance)
328                 basic_machine=ns32k-sequent
329                 os=-dynix
330                 ;;
331         convex-c1)
332                 basic_machine=c1-convex
333                 os=-bsd
334                 ;;
335         convex-c2)
336                 basic_machine=c2-convex
337                 os=-bsd
338                 ;;
339         convex-c32)
340                 basic_machine=c32-convex
341                 os=-bsd
342                 ;;
343         convex-c34)
344                 basic_machine=c34-convex
345                 os=-bsd
346                 ;;
347         convex-c38)
348                 basic_machine=c38-convex
349                 os=-bsd
350                 ;;
351         cray | ymp)
352                 basic_machine=ymp-cray
353                 os=-unicos
354                 ;;
355         cray2)
356                 basic_machine=cray2-cray
357                 os=-unicos
358                 ;;
359         [ctj]90-cray)
360                 basic_machine=c90-cray
361                 os=-unicos
362                 ;;
363         crds | unos)
364                 basic_machine=m68k-crds
365                 ;;
366         cris | cris-* | etrax*)
367                 basic_machine=cris-axis
368                 ;;
369         da30 | da30-*)
370                 basic_machine=m68k-da30
371                 ;;
372         decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
373                 basic_machine=mips-dec
374                 ;;
375         delta | 3300 | motorola-3300 | motorola-delta \
376               | 3300-motorola | delta-motorola)
377                 basic_machine=m68k-motorola
378                 ;;
379         delta88)
380                 basic_machine=m88k-motorola
381                 os=-sysv3
382                 ;;
383         dpx20 | dpx20-*)
384                 basic_machine=rs6000-bull
385                 os=-bosx
386                 ;;
387         dpx2* | dpx2*-bull)
388                 basic_machine=m68k-bull
389                 os=-sysv3
390                 ;;
391         ebmon29k)
392                 basic_machine=a29k-amd
393                 os=-ebmon
394                 ;;
395         elxsi)
396                 basic_machine=elxsi-elxsi
397                 os=-bsd
398                 ;;
399         encore | umax | mmax)
400                 basic_machine=ns32k-encore
401                 ;;
402         es1800 | OSE68k | ose68k | ose | OSE)
403                 basic_machine=m68k-ericsson
404                 os=-ose
405                 ;;
406         fx2800)
407                 basic_machine=i860-alliant
408                 ;;
409         genix)
410                 basic_machine=ns32k-ns
411                 ;;
412         gmicro)
413                 basic_machine=tron-gmicro
414                 os=-sysv
415                 ;;
416         h3050r* | hiux*)
417                 basic_machine=hppa1.1-hitachi
418                 os=-hiuxwe2
419                 ;;
420         h8300hms)
421                 basic_machine=h8300-hitachi
422                 os=-hms
423                 ;;
424         h8300xray)
425                 basic_machine=h8300-hitachi
426                 os=-xray
427                 ;;
428         h8500hms)
429                 basic_machine=h8500-hitachi
430                 os=-hms
431                 ;;
432         harris)
433                 basic_machine=m88k-harris
434                 os=-sysv3
435                 ;;
436         hp300-*)
437                 basic_machine=m68k-hp
438                 ;;
439         hp300bsd)
440                 basic_machine=m68k-hp
441                 os=-bsd
442                 ;;
443         hp300hpux)
444                 basic_machine=m68k-hp
445                 os=-hpux
446                 ;;
447         hp3k9[0-9][0-9] | hp9[0-9][0-9])
448                 basic_machine=hppa1.0-hp
449                 ;;
450         hp9k2[0-9][0-9] | hp9k31[0-9])
451                 basic_machine=m68000-hp
452                 ;;
453         hp9k3[2-9][0-9])
454                 basic_machine=m68k-hp
455                 ;;
456         hp9k6[0-9][0-9] | hp6[0-9][0-9])
457                 basic_machine=hppa1.0-hp
458                 ;;
459         hp9k7[0-79][0-9] | hp7[0-79][0-9])
460                 basic_machine=hppa1.1-hp
461                 ;;
462         hp9k78[0-9] | hp78[0-9])
463                 # FIXME: really hppa2.0-hp
464                 basic_machine=hppa1.1-hp
465                 ;;
466         hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
467                 # FIXME: really hppa2.0-hp
468                 basic_machine=hppa1.1-hp
469                 ;;
470         hp9k8[0-9][13679] | hp8[0-9][13679])
471                 basic_machine=hppa1.1-hp
472                 ;;
473         hp9k8[0-9][0-9] | hp8[0-9][0-9])
474                 basic_machine=hppa1.0-hp
475                 ;;
476         hppa-next)
477                 os=-nextstep3
478                 ;;
479         hppaosf)
480                 basic_machine=hppa1.1-hp
481                 os=-osf
482                 ;;
483         hppro)
484                 basic_machine=hppa1.1-hp
485                 os=-proelf
486                 ;;
487         i370-ibm* | ibm*)
488                 basic_machine=i370-ibm
489                 ;;
490 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
491         i[34567]86v32)
492                 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
493                 os=-sysv32
494                 ;;
495         i[34567]86v4*)
496                 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
497                 os=-sysv4
498                 ;;
499         i[34567]86v)
500                 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
501                 os=-sysv
502                 ;;
503         i[34567]86sol2)
504                 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
505                 os=-solaris2
506                 ;;
507         i386mach)
508                 basic_machine=i386-mach
509                 os=-mach
510                 ;;
511         i386-vsta | vsta)
512                 basic_machine=i386-unknown
513                 os=-vsta
514                 ;;
515         i386-go32 | go32)
516                 basic_machine=i386-unknown
517                 os=-go32
518                 ;;
519         i386-mingw32 | mingw32)
520                 basic_machine=i386-unknown
521                 os=-mingw32
522                 ;;
523         iris | iris4d)
524                 basic_machine=mips-sgi
525                 case $os in
526                     -irix*)
527                         ;;
528                     *)
529                         os=-irix4
530                         ;;
531                 esac
532                 ;;
533         isi68 | isi)
534                 basic_machine=m68k-isi
535                 os=-sysv
536                 ;;
537         m88k-omron*)
538                 basic_machine=m88k-omron
539                 ;;
540         magnum | m3230)
541                 basic_machine=mips-mips
542                 os=-sysv
543                 ;;
544         merlin)
545                 basic_machine=ns32k-utek
546                 os=-sysv
547                 ;;
548         miniframe)
549                 basic_machine=m68000-convergent
550                 ;;
551         *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
552                 basic_machine=m68k-atari
553                 os=-mint
554                 ;;
555         mipsel*-linux*)
556                 basic_machine=mipsel-unknown
557                 os=-linux-gnu
558                 ;;
559         mips*-linux*)
560                 basic_machine=mips-unknown
561                 os=-linux-gnu
562                 ;;
563         mips3*-*)
564                 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
565                 ;;
566         mips3*)
567                 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
568                 ;;
569         mmix*)
570                 basic_machine=mmix-knuth
571                 os=-mmixware
572                 ;;
573         monitor)
574                 basic_machine=m68k-rom68k
575                 os=-coff
576                 ;;
577         msdos)
578                 basic_machine=i386-unknown
579                 os=-msdos
580                 ;;
581         mvs)
582                 basic_machine=i370-ibm
583                 os=-mvs
584                 ;;
585         ncr3000)
586                 basic_machine=i486-ncr
587                 os=-sysv4
588                 ;;
589         netbsd386)
590                 basic_machine=i386-unknown
591                 os=-netbsd
592                 ;;
593         netwinder)
594                 basic_machine=armv4l-rebel
595                 os=-linux
596                 ;;
597         news | news700 | news800 | news900)
598                 basic_machine=m68k-sony
599                 os=-newsos
600                 ;;
601         news1000)
602                 basic_machine=m68030-sony
603                 os=-newsos
604                 ;;
605         news-3600 | risc-news)
606                 basic_machine=mips-sony
607                 os=-newsos
608                 ;;
609         necv70)
610                 basic_machine=v70-nec
611                 os=-sysv
612                 ;;
613         next | m*-next )
614                 basic_machine=m68k-next
615                 case $os in
616                     -nextstep* )
617                         ;;
618                     -ns2*)
619                       os=-nextstep2
620                         ;;
621                     *)
622                       os=-nextstep3
623                         ;;
624                 esac
625                 ;;
626         nh3000)
627                 basic_machine=m68k-harris
628                 os=-cxux
629                 ;;
630         nh[45]000)
631                 basic_machine=m88k-harris
632                 os=-cxux
633                 ;;
634         nindy960)
635                 basic_machine=i960-intel
636                 os=-nindy
637                 ;;
638         mon960)
639                 basic_machine=i960-intel
640                 os=-mon960
641                 ;;
642         np1)
643                 basic_machine=np1-gould
644                 ;;
645         nsr-tandem)
646                 basic_machine=nsr-tandem
647                 ;;
648         op50n-* | op60c-*)
649                 basic_machine=hppa1.1-oki
650                 os=-proelf
651                 ;;
652         OSE68000 | ose68000)
653                 basic_machine=m68000-ericsson
654                 os=-ose
655                 ;;
656         os68k)
657                 basic_machine=m68k-none
658                 os=-os68k
659                 ;;
660         pa-hitachi)
661                 basic_machine=hppa1.1-hitachi
662                 os=-hiuxwe2
663                 ;;
664         paragon)
665                 basic_machine=i860-intel
666                 os=-osf
667                 ;;
668         pbd)
669                 basic_machine=sparc-tti
670                 ;;
671         pbb)
672                 basic_machine=m68k-tti
673                 ;;
674         pc532 | pc532-*)
675                 basic_machine=ns32k-pc532
676                 ;;
677         pentium | p5 | k5 | k6 | nexen)
678                 basic_machine=i586-pc
679                 ;;
680         pentiumpro | p6 | 6x86 | athlon)
681                 basic_machine=i686-pc
682                 ;;
683         pentiumii | pentium2)
684                 basic_machine=i786-pc
685                 ;;
686         pentium-* | p5-* | k5-* | k6-* | nexen-*)
687                 basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
688                 ;;
689         pentiumpro-* | p6-* | 6x86-* | athlon-*)
690                 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
691                 ;;
692         pentiumii-* | pentium2-*)
693                 basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
694                 ;;
695         pn)
696                 basic_machine=pn-gould
697                 ;;
698         power)  basic_machine=rs6000-ibm
699                 ;;
700         ppc)    basic_machine=powerpc-unknown
701                 ;;
702         ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
703                 ;;
704         ppcle | powerpclittle | ppc-le | powerpc-little)
705                 basic_machine=powerpcle-unknown
706                 ;;
707         ppcle-* | powerpclittle-*)
708                 basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
709                 ;;
710         ps2)
711                 basic_machine=i386-ibm
712                 ;;
713         rom68k)
714                 basic_machine=m68k-rom68k
715                 os=-coff
716                 ;;
717         rm[46]00)
718                 basic_machine=mips-siemens
719                 ;;
720         rtpc | rtpc-*)
721                 basic_machine=romp-ibm
722                 ;;
723         sa29200)
724                 basic_machine=a29k-amd
725                 os=-udi
726                 ;;
727         sequent)
728                 basic_machine=i386-sequent
729                 ;;
730         sh)
731                 basic_machine=sh-hitachi
732                 os=-hms
733                 ;;
734         sparclite-wrs)
735                 basic_machine=sparclite-wrs
736                 os=-vxworks
737                 ;;
738         sps7)
739                 basic_machine=m68k-bull
740                 os=-sysv2
741                 ;;
742         spur)
743                 basic_machine=spur-unknown
744                 ;;
745         st2000)
746                 basic_machine=m68k-tandem
747                 ;;
748         stratus)
749                 basic_machine=i860-stratus
750                 os=-sysv4
751                 ;;
752         sun2)
753                 basic_machine=m68000-sun
754                 ;;
755         sun2os3)
756                 basic_machine=m68000-sun
757                 os=-sunos3
758                 ;;
759         sun2os4)
760                 basic_machine=m68000-sun
761                 os=-sunos4
762                 ;;
763         sun3os3)
764                 basic_machine=m68k-sun
765                 os=-sunos3
766                 ;;
767         sun3os4)
768                 basic_machine=m68k-sun
769                 os=-sunos4
770                 ;;
771         sun4os3)
772                 basic_machine=sparc-sun
773                 os=-sunos3
774                 ;;
775         sun4os4)
776                 basic_machine=sparc-sun
777                 os=-sunos4
778                 ;;
779         sun4sol2)
780                 basic_machine=sparc-sun
781                 os=-solaris2
782                 ;;
783         sun3 | sun3-*)
784                 basic_machine=m68k-sun
785                 ;;
786         sun4)
787                 basic_machine=sparc-sun
788                 ;;
789         sun386 | sun386i | roadrunner)
790                 basic_machine=i386-sun
791                 ;;
792         sv1)
793                 basic_machine=sv1-cray
794                 os=-unicos
795                 ;;
796         symmetry)
797                 basic_machine=i386-sequent
798                 os=-dynix
799                 ;;
800         t3e)
801                 basic_machine=t3e-cray
802                 os=-unicos
803                 ;;
804         tic54x | c54x*)
805                 basic_machine=tic54x-unknown
806                 os=-coff
807                 ;;
808         tx39)
809                 basic_machine=mipstx39-unknown
810                 ;;
811         tx39el)
812                 basic_machine=mipstx39el-unknown
813                 ;;
814         tower | tower-32)
815                 basic_machine=m68k-ncr
816                 ;;
817         udi29k)
818                 basic_machine=a29k-amd
819                 os=-udi
820                 ;;
821         ultra3)
822                 basic_machine=a29k-nyu
823                 os=-sym1
824                 ;;
825         v810 | necv810)
826                 basic_machine=v810-nec
827                 os=-none
828                 ;;
829         vaxv)
830                 basic_machine=vax-dec
831                 os=-sysv
832                 ;;
833         vms)
834                 basic_machine=vax-dec
835                 os=-vms
836                 ;;
837         vpp*|vx|vx-*)
838                basic_machine=f301-fujitsu
839                ;;
840         vxworks960)
841                 basic_machine=i960-wrs
842                 os=-vxworks
843                 ;;
844         vxworks68)
845                 basic_machine=m68k-wrs
846                 os=-vxworks
847                 ;;
848         vxworks29k)
849                 basic_machine=a29k-wrs
850                 os=-vxworks
851                 ;;
852         w65*)
853                 basic_machine=w65-wdc
854                 os=-none
855                 ;;
856         w89k-*)
857                 basic_machine=hppa1.1-winbond
858                 os=-proelf
859                 ;;
860         xmp)
861                 basic_machine=xmp-cray
862                 os=-unicos
863                 ;;
864         xps | xps100)
865                 basic_machine=xps100-honeywell
866                 ;;
867         z8k-*-coff)
868                 basic_machine=z8k-unknown
869                 os=-sim
870                 ;;
871         none)
872                 basic_machine=none-none
873                 os=-none
874                 ;;
875
876 # Here we handle the default manufacturer of certain CPU types.  It is in
877 # some cases the only manufacturer, in others, it is the most popular.
878         w89k)
879                 basic_machine=hppa1.1-winbond
880                 ;;
881         op50n)
882                 basic_machine=hppa1.1-oki
883                 ;;
884         op60c)
885                 basic_machine=hppa1.1-oki
886                 ;;
887         mips)
888                 if [ x$os = x-linux-gnu ]; then
889                         basic_machine=mips-unknown
890                 else
891                         basic_machine=mips-mips
892                 fi
893                 ;;
894         romp)
895                 basic_machine=romp-ibm
896                 ;;
897         rs6000)
898                 basic_machine=rs6000-ibm
899                 ;;
900         vax)
901                 basic_machine=vax-dec
902                 ;;
903         pdp11)
904                 basic_machine=pdp11-dec
905                 ;;
906         we32k)
907                 basic_machine=we32k-att
908                 ;;
909         sh3 | sh4)
910                 base_machine=sh-unknown
911                 ;;
912         sparc | sparcv9)
913                 basic_machine=sparc-sun
914                 ;;
915         cydra)
916                 basic_machine=cydra-cydrome
917                 ;;
918         orion)
919                 basic_machine=orion-highlevel
920                 ;;
921         orion105)
922                 basic_machine=clipper-highlevel
923                 ;;
924         mac | mpw | mac-mpw)
925                 basic_machine=m68k-apple
926                 ;;
927         pmac | pmac-mpw)
928                 basic_machine=powerpc-apple
929                 ;;
930         c4x*)
931                 basic_machine=c4x-none
932                 os=-coff
933                 ;;
934         *)
935                 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
936                 exit 1
937                 ;;
938 esac
939
940 # Here we canonicalize certain aliases for manufacturers.
941 case $basic_machine in
942         *-digital*)
943                 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
944                 ;;
945         *-commodore*)
946                 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
947                 ;;
948         *)
949                 ;;
950 esac
951
952 # Decode manufacturer-specific aliases for certain operating systems.
953
954 if [ x"$os" != x"" ]
955 then
956 case $os in
957         # First match some system type aliases
958         # that might get confused with valid system types.
959         # -solaris* is a basic system type, with this one exception.
960         -solaris1 | -solaris1.*)
961                 os=`echo $os | sed -e 's|solaris1|sunos4|'`
962                 ;;
963         -solaris)
964                 os=-solaris2
965                 ;;
966         -svr4*)
967                 os=-sysv4
968                 ;;
969         -unixware*)
970                 os=-sysv4.2uw
971                 ;;
972         -gnu/linux*)
973                 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
974                 ;;
975         # First accept the basic system types.
976         # The portable systems comes first.
977         # Each alternative MUST END IN A *, to match a version number.
978         # -sysv* is not here because it comes later, after sysvr4.
979         -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
980               | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
981               | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
982               | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
983               | -aos* \
984               | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
985               | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
986               | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
987               | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
988               | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
989               | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
990               | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
991               | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
992               | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
993               | -openstep* | -oskit*)
994         # Remember, each alternative MUST END IN *, to match a version number.
995                 ;;
996         -qnx*)
997                 case $basic_machine in
998                     x86-* | i[34567]86-*)
999                         ;;
1000                     *)
1001                         os=-nto$os
1002                         ;;
1003                 esac
1004                 ;;
1005         -nto*)
1006                 os=-nto-qnx
1007                 ;;
1008         -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1009               | -os2 \
1010               | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
1011               | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1012                 ;;
1013         -mac*)
1014                 os=`echo $os | sed -e 's|mac|macos|'`
1015                 ;;
1016         -linux*)
1017                 os=`echo $os | sed -e 's|linux|linux-gnu|'`
1018                 ;;
1019         -sunos5*)
1020                 os=`echo $os | sed -e 's|sunos5|solaris2|'`
1021                 ;;
1022         -sunos6*)
1023                 os=`echo $os | sed -e 's|sunos6|solaris3|'`
1024                 ;;
1025         -opened*)
1026                 os=-openedition
1027                 ;;
1028         -wince*)
1029                 os=-wince
1030                 ;;
1031         -osfrose*)
1032                 os=-osfrose
1033                 ;;
1034         -osf*)
1035                 os=-osf
1036                 ;;
1037         -utek*)
1038                 os=-bsd
1039                 ;;
1040         -dynix*)
1041                 os=-bsd
1042                 ;;
1043         -acis*)
1044                 os=-aos
1045                 ;;
1046         -386bsd)
1047                 os=-bsd
1048                 ;;
1049         -ctix* | -uts*)
1050                 os=-sysv
1051                 ;;
1052         -ns2 )
1053                 os=-nextstep2
1054                 ;;
1055         -nsk)
1056                 os=-nsk
1057                 ;;
1058         # Preserve the version number of sinix5.
1059         -sinix5.*)
1060                 os=`echo $os | sed -e 's|sinix|sysv|'`
1061                 ;;
1062         -sinix*)
1063                 os=-sysv4
1064                 ;;
1065         -triton*)
1066                 os=-sysv3
1067                 ;;
1068         -oss*)
1069                 os=-sysv3
1070                 ;;
1071         -svr4)
1072                 os=-sysv4
1073                 ;;
1074         -svr3)
1075                 os=-sysv3
1076                 ;;
1077         -sysvr4)
1078                 os=-sysv4
1079                 ;;
1080         # This must come after -sysvr4.
1081         -sysv*)
1082                 ;;
1083         -ose*)
1084                 os=-ose
1085                 ;;
1086         -es1800*)
1087                 os=-ose
1088                 ;;
1089         -xenix)
1090                 os=-xenix
1091                 ;;
1092         -*mint | -*MiNT)
1093                 os=-mint
1094                 ;;
1095         -none)
1096                 ;;
1097         *)
1098                 # Get rid of the `-' at the beginning of $os.
1099                 os=`echo $os | sed 's/[^-]*-//'`
1100                 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1101                 exit 1
1102                 ;;
1103 esac
1104 else
1105
1106 # Here we handle the default operating systems that come with various machines.
1107 # The value should be what the vendor currently ships out the door with their
1108 # machine or put another way, the most popular os provided with the machine.
1109
1110 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1111 # "-sun"), then you have to tell the case statement up towards the top
1112 # that MANUFACTURER isn't an operating system.  Otherwise, code above
1113 # will signal an error saying that MANUFACTURER isn't an operating
1114 # system, and we'll never get to this point.
1115
1116 case $basic_machine in
1117         *-acorn)
1118                 os=-riscix1.2
1119                 ;;
1120         arm*-rebel)
1121                 os=-linux
1122                 ;;
1123         arm*-semi)
1124                 os=-aout
1125                 ;;
1126         pdp11-*)
1127                 os=-none
1128                 ;;
1129         *-dec | vax-*)
1130                 os=-ultrix4.2
1131                 ;;
1132         m68*-apollo)
1133                 os=-domain
1134                 ;;
1135         i386-sun)
1136                 os=-sunos4.0.2
1137                 ;;
1138         m68000-sun)
1139                 os=-sunos3
1140                 # This also exists in the configure program, but was not the
1141                 # default.
1142                 # os=-sunos4
1143                 ;;
1144         m68*-cisco)
1145                 os=-aout
1146                 ;;
1147         mips*-cisco)
1148                 os=-elf
1149                 ;;
1150         mips*-*)
1151                 os=-elf
1152                 ;;
1153         *-tti)  # must be before sparc entry or we get the wrong os.
1154                 os=-sysv3
1155                 ;;
1156         sparc-* | *-sun)
1157                 os=-sunos4.1.1
1158                 ;;
1159         *-be)
1160                 os=-beos
1161                 ;;
1162         *-ibm)
1163                 os=-aix
1164                 ;;
1165         *-wec)
1166                 os=-proelf
1167                 ;;
1168         *-winbond)
1169                 os=-proelf
1170                 ;;
1171         *-oki)
1172                 os=-proelf
1173                 ;;
1174         *-hp)
1175                 os=-hpux
1176                 ;;
1177         *-hitachi)
1178                 os=-hiux
1179                 ;;
1180         i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1181                 os=-sysv
1182                 ;;
1183         *-cbm)
1184                 os=-amigaos
1185                 ;;
1186         *-dg)
1187                 os=-dgux
1188                 ;;
1189         *-dolphin)
1190                 os=-sysv3
1191                 ;;
1192         m68k-ccur)
1193                 os=-rtu
1194                 ;;
1195         m88k-omron*)
1196                 os=-luna
1197                 ;;
1198         *-next )
1199                 os=-nextstep
1200                 ;;
1201         *-sequent)
1202                 os=-ptx
1203                 ;;
1204         *-crds)
1205                 os=-unos
1206                 ;;
1207         *-ns)
1208                 os=-genix
1209                 ;;
1210         i370-*)
1211                 os=-mvs
1212                 ;;
1213         *-next)
1214                 os=-nextstep3
1215                 ;;
1216         *-gould)
1217                 os=-sysv
1218                 ;;
1219         *-highlevel)
1220                 os=-bsd
1221                 ;;
1222         *-encore)
1223                 os=-bsd
1224                 ;;
1225         *-sgi)
1226                 os=-irix
1227                 ;;
1228         *-siemens)
1229                 os=-sysv4
1230                 ;;
1231         *-masscomp)
1232                 os=-rtu
1233                 ;;
1234         f301-fujitsu)
1235                 os=-uxpv
1236                 ;;
1237         *-rom68k)
1238                 os=-coff
1239                 ;;
1240         *-*bug)
1241                 os=-coff
1242                 ;;
1243         *-apple)
1244                 os=-macos
1245                 ;;
1246         *-atari*)
1247                 os=-mint
1248                 ;;
1249         *)
1250                 os=-none
1251                 ;;
1252 esac
1253 fi
1254
1255 # Here we handle the case where we know the os, and the CPU type, but not the
1256 # manufacturer.  We pick the logical manufacturer.
1257 vendor=unknown
1258 case $basic_machine in
1259         *-unknown)
1260                 case $os in
1261                         -riscix*)
1262                                 vendor=acorn
1263                                 ;;
1264                         -sunos*)
1265                                 vendor=sun
1266                                 ;;
1267                         -aix*)
1268                                 vendor=ibm
1269                                 ;;
1270                         -beos*)
1271                                 vendor=be
1272                                 ;;
1273                         -hpux*)
1274                                 vendor=hp
1275                                 ;;
1276                         -mpeix*)
1277                                 vendor=hp
1278                                 ;;
1279                         -hiux*)
1280                                 vendor=hitachi
1281                                 ;;
1282                         -unos*)
1283                                 vendor=crds
1284                                 ;;
1285                         -dgux*)
1286                                 vendor=dg
1287                                 ;;
1288                         -luna*)
1289                                 vendor=omron
1290                                 ;;
1291                         -genix*)
1292                                 vendor=ns
1293                                 ;;
1294                         -mvs* | -opened*)
1295                                 vendor=ibm
1296                                 ;;
1297                         -ptx*)
1298                                 vendor=sequent
1299                                 ;;
1300                         -vxsim* | -vxworks*)
1301                                 vendor=wrs
1302                                 ;;
1303                         -aux*)
1304                                 vendor=apple
1305                                 ;;
1306                         -hms*)
1307                                 vendor=hitachi
1308                                 ;;
1309                         -mpw* | -macos*)
1310                                 vendor=apple
1311                                 ;;
1312                         -*mint | -*MiNT)
1313                                 vendor=atari
1314                                 ;;
1315                 esac
1316                 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1317                 ;;
1318 esac
1319
1320 echo $basic_machine$os
1321 exit 0
1322
1323 # Local variables:
1324 # eval: (add-hook 'write-file-hooks 'time-stamp)
1325 # time-stamp-start: "version='"
1326 # time-stamp-format: "%:y-%02m-%02d"
1327 # time-stamp-end: "'"
1328 # End: