1#! /bin/sh
2# Configuration validation subroutine script.
3#   Copyright 1992-2018 Free Software Foundation, Inc.
4
5timestamp='2018-05-24'
6
7# This file is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, see <https://www.gnu.org/licenses/>.
19#
20# As a special exception to the GNU General Public License, if you
21# distribute this file as part of a program that contains a
22# configuration script generated by Autoconf, you may include it under
23# the same distribution terms that you use for the rest of that
24# program.  This Exception is an additional permission under section 7
25# of the GNU General Public License, version 3 ("GPLv3").
26
27
28# Please send patches to <config-patches@gnu.org>.
29#
30# Configuration subroutine to validate and canonicalize a configuration type.
31# Supply the specified configuration type as an argument.
32# If it is invalid, we print an error message on stderr and exit with code 1.
33# Otherwise, we print the canonical config type on stdout and succeed.
34
35# You can get the latest version of this script from:
36# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
37
38# This file is supposed to be the same for all GNU packages
39# and recognize all the CPU types, system types and aliases
40# that are meaningful with *any* GNU software.
41# Each package is responsible for reporting which valid configurations
42# it does not support.  The user should be able to distinguish
43# a failure to support a valid configuration from a meaningless
44# configuration.
45
46# The goal of this file is to map all the various variations of a given
47# machine specification into a single specification in the form:
48#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
49# or in some cases, the newer four-part form:
50#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
51# It is wrong to echo any other type of specification.
52
53me=`echo "$0" | sed -e 's,.*/,,'`
54
55usage="\
56Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
57
58Canonicalize a configuration name.
59
60Options:
61  -h, --help         print this help, then exit
62  -t, --time-stamp   print date of last modification, then exit
63  -v, --version      print version number, then exit
64
65Report bugs and patches to <config-patches@gnu.org>."
66
67version="\
68GNU config.sub ($timestamp)
69
70Copyright 1992-2018 Free Software Foundation, Inc.
71
72This is free software; see the source for copying conditions.  There is NO
73warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
74
75help="
76Try \`$me --help' for more information."
77
78# Parse command line
79while test $# -gt 0 ; do
80  case $1 in
81    --time-stamp | --time* | -t )
82       echo "$timestamp" ; exit ;;
83    --version | -v )
84       echo "$version" ; exit ;;
85    --help | --h* | -h )
86       echo "$usage"; exit ;;
87    -- )     # Stop option processing
88       shift; break ;;
89    - )	# Use stdin as input.
90       break ;;
91    -* )
92       echo "$me: invalid option $1$help"
93       exit 1 ;;
94
95    *local*)
96       # First pass through any local machine types.
97       echo "$1"
98       exit ;;
99
100    * )
101       break ;;
102  esac
103done
104
105case $# in
106 0) echo "$me: missing argument$help" >&2
107    exit 1;;
108 1) ;;
109 *) echo "$me: too many arguments$help" >&2
110    exit 1;;
111esac
112
113# Split fields of configuration type
114IFS="-" read -r field1 field2 field3 field4 <<EOF
115$1
116EOF
117
118# Separate into logical components for further validation
119case $1 in
120	*-*-*-*-*)
121		echo Invalid configuration \`"$1"\': more than four components >&2
122		exit 1
123		;;
124	*-*-*-*)
125		basic_machine=$field1-$field2
126		os=$field3-$field4
127		;;
128	*-*-*)
129		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
130		# parts
131		maybe_os=$field2-$field3
132		case $maybe_os in
133			nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
134			| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
135			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
136			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
137			| storm-chaos* | os2-emx* | rtmk-nova*)
138				basic_machine=$field1
139				os=$maybe_os
140				;;
141			android-linux)
142				basic_machine=$field1-unknown
143				os=linux-android
144				;;
145			*)
146				basic_machine=$field1-$field2
147				os=$field3
148				;;
149		esac
150		;;
151	*-*)
152		# Second component is usually, but not always the OS
153		case $field2 in
154			# Prevent following clause from handling this valid os
155			sun*os*)
156				basic_machine=$field1
157				os=$field2
158				;;
159			# Manufacturers
160			dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \
161			| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
162			| unicom* | ibm* | next | hp | isi* | apollo | altos* \
163			| convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* \
164			| c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* \
165			| harris | dolphin | highlevel | gould | cbm | ns | masscomp \
166			| apple | axis | knuth | cray | microblaze* \
167			| sim | cisco | oki | wec | wrs | winbond)
168				basic_machine=$field1-$field2
169				os=
170				;;
171			*)
172				basic_machine=$field1
173				os=$field2
174				;;
175		esac
176		;;
177	*)
178		# Convert single-component short-hands not valid as part of
179		# multi-component configurations.
180		case $field1 in
181			386bsd)
182				basic_machine=i386-pc
183				os=bsd
184				;;
185			a29khif)
186				basic_machine=a29k-amd
187				os=udi
188				;;
189			adobe68k)
190				basic_machine=m68010-adobe
191				os=scout
192				;;
193			am29k)
194				basic_machine=a29k-none
195				os=bsd
196				;;
197			amdahl)
198				basic_machine=580-amdahl
199				os=sysv
200				;;
201			amigaos | amigados)
202				basic_machine=m68k-unknown
203				os=amigaos
204				;;
205			amigaunix | amix)
206				basic_machine=m68k-unknown
207				os=sysv4
208				;;
209			apollo68)
210				basic_machine=m68k-apollo
211				os=sysv
212				;;
213			apollo68bsd)
214				basic_machine=m68k-apollo
215				os=bsd
216				;;
217			aros)
218				basic_machine=i386-pc
219				os=aros
220				;;
221			aux)
222				basic_machine=m68k-apple
223				os=aux
224				;;
225			balance)
226				basic_machine=ns32k-sequent
227				os=dynix
228				;;
229			blackfin)
230				basic_machine=bfin-unknown
231				os=linux
232				;;
233			cegcc)
234				basic_machine=arm-unknown
235				os=cegcc
236				;;
237			cray)
238				basic_machine=j90-cray
239				os=unicos
240				;;
241			craynv)
242				basic_machine=craynv-cray
243				os=unicosmp
244				;;
245			delta88)
246				basic_machine=m88k-motorola
247				os=sysv3
248				;;
249			dicos)
250				basic_machine=i686-pc
251				os=dicos
252				;;
253			djgpp)
254				basic_machine=i586-pc
255				os=msdosdjgpp
256				;;
257			ebmon29k)
258				basic_machine=a29k-amd
259				os=ebmon
260				;;
261			es1800 | OSE68k | ose68k | ose | OSE)
262				basic_machine=m68k-ericsson
263				os=ose
264				;;
265			gmicro)
266				basic_machine=tron-gmicro
267				os=sysv
268				;;
269			go32)
270				basic_machine=i386-pc
271				os=go32
272				;;
273			h8300hms)
274				basic_machine=h8300-hitachi
275				os=hms
276				;;
277			h8300xray)
278				basic_machine=h8300-hitachi
279				os=xray
280				;;
281			h8500hms)
282				basic_machine=h8500-hitachi
283				os=hms
284				;;
285			harris)
286				basic_machine=m88k-harris
287				os=sysv3
288				;;
289			hp300bsd)
290				basic_machine=m68k-hp
291				os=bsd
292				;;
293			hp300hpux)
294				basic_machine=m68k-hp
295				os=hpux
296				;;
297			hppaosf)
298				basic_machine=hppa1.1-hp
299				os=osf
300				;;
301			hppro)
302				basic_machine=hppa1.1-hp
303				os=proelf
304				;;
305			i386mach)
306				basic_machine=i386-mach
307				os=mach
308				;;
309			vsta)
310				basic_machine=i386-unknown
311				os=vsta
312				;;
313			isi68 | isi)
314				basic_machine=m68k-isi
315				os=sysv
316				;;
317			m68knommu)
318				basic_machine=m68k-unknown
319				os=linux
320				;;
321			magnum | m3230)
322				basic_machine=mips-mips
323				os=sysv
324				;;
325			merlin)
326				basic_machine=ns32k-utek
327				os=sysv
328				;;
329			mingw64)
330				basic_machine=x86_64-pc
331				os=mingw64
332				;;
333			mingw32)
334				basic_machine=i686-pc
335				os=mingw32
336				;;
337			mingw32ce)
338				basic_machine=arm-unknown
339				os=mingw32ce
340				;;
341			monitor)
342				basic_machine=m68k-rom68k
343				os=coff
344				;;
345			morphos)
346				basic_machine=powerpc-unknown
347				os=morphos
348				;;
349			moxiebox)
350				basic_machine=moxie-unknown
351				os=moxiebox
352				;;
353			msdos)
354				basic_machine=i386-pc
355				os=msdos
356				;;
357			msys)
358				basic_machine=i686-pc
359				os=msys
360				;;
361			mvs)
362				basic_machine=i370-ibm
363				os=mvs
364				;;
365			nacl)
366				basic_machine=le32-unknown
367				os=nacl
368				;;
369			ncr3000)
370				basic_machine=i486-ncr
371				os=sysv4
372				;;
373			netbsd386)
374				basic_machine=i386-unknown
375				os=netbsd
376				;;
377			netwinder)
378				basic_machine=armv4l-rebel
379				os=linux
380				;;
381			news | news700 | news800 | news900)
382				basic_machine=m68k-sony
383				os=newsos
384				;;
385			news1000)
386				basic_machine=m68030-sony
387				os=newsos
388				;;
389			necv70)
390				basic_machine=v70-nec
391				os=sysv
392				;;
393			nh3000)
394				basic_machine=m68k-harris
395				os=cxux
396				;;
397			nh[45]000)
398				basic_machine=m88k-harris
399				os=cxux
400				;;
401			nindy960)
402				basic_machine=i960-intel
403				os=nindy
404				;;
405			mon960)
406				basic_machine=i960-intel
407				os=mon960
408				;;
409			nonstopux)
410				basic_machine=mips-compaq
411				os=nonstopux
412				;;
413			os400)
414				basic_machine=powerpc-ibm
415				os=os400
416				;;
417			OSE68000 | ose68000)
418				basic_machine=m68000-ericsson
419				os=ose
420				;;
421			os68k)
422				basic_machine=m68k-none
423				os=os68k
424				;;
425			paragon)
426				basic_machine=i860-intel
427				os=osf
428				;;
429			parisc)
430				basic_machine=hppa-unknown
431				os=linux
432				;;
433			pw32)
434				basic_machine=i586-unknown
435				os=pw32
436				;;
437			rdos | rdos64)
438				basic_machine=x86_64-pc
439				os=rdos
440				;;
441			rdos32)
442				basic_machine=i386-pc
443				os=rdos
444				;;
445			rom68k)
446				basic_machine=m68k-rom68k
447				os=coff
448				;;
449			sa29200)
450				basic_machine=a29k-amd
451				os=udi
452				;;
453			sei)
454				basic_machine=mips-sei
455				os=seiux
456				;;
457			sps7)
458				basic_machine=m68k-bull
459				os=sysv2
460				;;
461			stratus)
462				basic_machine=i860-stratus
463				os=sysv4
464				;;
465			sun2os3)
466				basic_machine=m68000-sun
467				os=sunos3
468				;;
469			sun2os4)
470				basic_machine=m68000-sun
471				os=sunos4
472				;;
473			sun3os3)
474				basic_machine=m68k-sun
475				os=sunos3
476				;;
477			sun3os4)
478				basic_machine=m68k-sun
479				os=sunos4
480				;;
481			sun4os3)
482				basic_machine=sparc-sun
483				os=sunos3
484				;;
485			sun4os4)
486				basic_machine=sparc-sun
487				os=sunos4
488				;;
489			sun4sol2)
490				basic_machine=sparc-sun
491				os=solaris2
492				;;
493			sv1)
494				basic_machine=sv1-cray
495				os=unicos
496				;;
497			symmetry)
498				basic_machine=i386-sequent
499				os=dynix
500				;;
501			t3e)
502				basic_machine=alphaev5-cray
503				os=unicos
504				;;
505			t90)
506				basic_machine=t90-cray
507				os=unicos
508				;;
509			toad1)
510				basic_machine=pdp10-xkl
511				os=tops20
512				;;
513			tpf)
514				basic_machine=s390x-ibm
515				os=tpf
516				;;
517			udi29k)
518				basic_machine=a29k-amd
519				os=udi
520				;;
521			ultra3)
522				basic_machine=a29k-nyu
523				os=sym1
524				;;
525			v810 | necv810)
526				basic_machine=v810-nec
527				os=none
528				;;
529			vaxv)
530				basic_machine=vax-dec
531				os=sysv
532				;;
533			vms)
534				basic_machine=vax-dec
535				os=vms
536				;;
537			vxworks960)
538				basic_machine=i960-wrs
539				os=vxworks
540				;;
541			vxworks68)
542				basic_machine=m68k-wrs
543				os=vxworks
544				;;
545			vxworks29k)
546				basic_machine=a29k-wrs
547				os=vxworks
548				;;
549			xbox)
550				basic_machine=i686-pc
551				os=mingw32
552				;;
553			ymp)
554				basic_machine=ymp-cray
555				os=unicos
556				;;
557			*)
558				basic_machine=$1
559				os=
560				;;
561		esac
562		;;
563esac
564
565# Decode aliases for certain CPU-COMPANY combinations.
566case $basic_machine in
567	# Recognize the basic CPU types without company name.
568	# Some are omitted here because they have special meanings below.
569	1750a | 580 \
570	| a29k \
571	| aarch64 | aarch64_be \
572	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
573	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
574	| am33_2.0 \
575	| arc | arceb \
576	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
577	| avr | avr32 \
578	| ba \
579	| be32 | be64 \
580	| bfin \
581	| c4x | c8051 | clipper | csky \
582	| d10v | d30v | dlx | dsp16xx \
583	| e2k | epiphany \
584	| fido | fr30 | frv | ft32 \
585	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
586	| hexagon \
587	| i370 | i860 | i960 | ia16 | ia64 \
588	| ip2k | iq2000 \
589	| k1om \
590	| le32 | le64 \
591	| lm32 \
592	| m32c | m32r | m32rle | m68000 | m68k | m88k \
593	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
594	| mips | mipsbe | mipseb | mipsel | mipsle \
595	| mips16 \
596	| mips64 | mips64el \
597	| mips64octeon | mips64octeonel \
598	| mips64orion | mips64orionel \
599	| mips64r5900 | mips64r5900el \
600	| mips64vr | mips64vrel \
601	| mips64vr4100 | mips64vr4100el \
602	| mips64vr4300 | mips64vr4300el \
603	| mips64vr5000 | mips64vr5000el \
604	| mips64vr5900 | mips64vr5900el \
605	| mipsisa32 | mipsisa32el \
606	| mipsisa32r2 | mipsisa32r2el \
607	| mipsisa32r6 | mipsisa32r6el \
608	| mipsisa64 | mipsisa64el \
609	| mipsisa64r2 | mipsisa64r2el \
610	| mipsisa64r6 | mipsisa64r6el \
611	| mipsisa64sb1 | mipsisa64sb1el \
612	| mipsisa64sr71k | mipsisa64sr71kel \
613	| mipsr5900 | mipsr5900el \
614	| mipstx39 | mipstx39el \
615	| mn10200 | mn10300 \
616	| moxie \
617	| mt \
618	| msp430 \
619	| nds32 | nds32le | nds32be \
620	| nfp \
621	| nios | nios2 | nios2eb | nios2el \
622	| ns16k | ns32k \
623	| open8 | or1k | or1knd | or32 \
624	| pdp10 | pj | pjl \
625	| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
626	| pru \
627	| pyramid \
628	| riscv32 | riscv64 \
629	| rl78 | rx \
630	| score \
631	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
632	| sh64 | sh64le \
633	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
634	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
635	| spu \
636	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
637	| ubicom32 \
638	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
639	| visium \
640	| wasm32 \
641	| x86 | xc16x | xstormy16 | xtensa \
642	| z8k | z80)
643		basic_machine=$basic_machine-unknown
644		;;
645	c54x)
646		basic_machine=tic54x-unknown
647		;;
648	c55x)
649		basic_machine=tic55x-unknown
650		;;
651	c6x)
652		basic_machine=tic6x-unknown
653		;;
654	leon|leon[3-9])
655		basic_machine=sparc-$basic_machine
656		;;
657	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
658		basic_machine=$basic_machine-unknown
659		os=${os:-none}
660		;;
661	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
662		;;
663	m9s12z | m68hcs12z | hcs12z | s12z)
664		basic_machine=s12z-unknown
665		os=${os:-none}
666		;;
667	ms1)
668		basic_machine=mt-unknown
669		;;
670	strongarm | thumb | xscale)
671		basic_machine=arm-unknown
672		;;
673	xgate)
674		basic_machine=$basic_machine-unknown
675		os=${os:-none}
676		;;
677	xscaleeb)
678		basic_machine=armeb-unknown
679		;;
680
681	xscaleel)
682		basic_machine=armel-unknown
683		;;
684
685	# We use `pc' rather than `unknown'
686	# because (1) that's what they normally are, and
687	# (2) the word "unknown" tends to confuse beginning users.
688	i*86 | x86_64)
689	  basic_machine=$basic_machine-pc
690	  ;;
691	# Recognize the basic CPU types with company name.
692	580-* \
693	| a29k-* \
694	| aarch64-* | aarch64_be-* \
695	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
696	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
697	| alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* | arceb-* \
698	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
699	| avr-* | avr32-* \
700	| ba-* \
701	| be32-* | be64-* \
702	| bfin-* | bs2000-* \
703	| c[123]* | c30-* | [cjt]90-* | c4x-* \
704	| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
705	| d10v-* | d30v-* | dlx-* \
706	| e2k-* | elxsi-* \
707	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
708	| h8300-* | h8500-* \
709	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
710	| hexagon-* \
711	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
712	| ip2k-* | iq2000-* \
713	| k1om-* \
714	| le32-* | le64-* \
715	| lm32-* \
716	| m32c-* | m32r-* | m32rle-* \
717	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
718	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
719	| microblaze-* | microblazeel-* \
720	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
721	| mips16-* \
722	| mips64-* | mips64el-* \
723	| mips64octeon-* | mips64octeonel-* \
724	| mips64orion-* | mips64orionel-* \
725	| mips64r5900-* | mips64r5900el-* \
726	| mips64vr-* | mips64vrel-* \
727	| mips64vr4100-* | mips64vr4100el-* \
728	| mips64vr4300-* | mips64vr4300el-* \
729	| mips64vr5000-* | mips64vr5000el-* \
730	| mips64vr5900-* | mips64vr5900el-* \
731	| mipsisa32-* | mipsisa32el-* \
732	| mipsisa32r2-* | mipsisa32r2el-* \
733	| mipsisa32r6-* | mipsisa32r6el-* \
734	| mipsisa64-* | mipsisa64el-* \
735	| mipsisa64r2-* | mipsisa64r2el-* \
736	| mipsisa64r6-* | mipsisa64r6el-* \
737	| mipsisa64sb1-* | mipsisa64sb1el-* \
738	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
739	| mipsr5900-* | mipsr5900el-* \
740	| mipstx39-* | mipstx39el-* \
741	| mmix-* \
742	| mt-* \
743	| msp430-* \
744	| nds32-* | nds32le-* | nds32be-* \
745	| nfp-* \
746	| nios-* | nios2-* | nios2eb-* | nios2el-* \
747	| none-* | np1-* | ns16k-* | ns32k-* \
748	| open8-* \
749	| or1k*-* \
750	| orion-* \
751	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
752	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | powerpcspe-* \
753	| pru-* \
754	| pyramid-* \
755	| riscv32-* | riscv64-* \
756	| rl78-* | romp-* | rs6000-* | rx-* \
757	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
758	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
759	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
760	| sparclite-* \
761	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
762	| tahoe-* \
763	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
764	| tile*-* \
765	| tron-* \
766	| ubicom32-* \
767	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
768	| vax-* \
769	| visium-* \
770	| wasm32-* \
771	| we32k-* \
772	| x86-* | x86_64-* | xc16x-* | xps100-* \
773	| xstormy16-* | xtensa*-* \
774	| ymp-* \
775	| z8k-* | z80-*)
776		;;
777	# Recognize the basic CPU types without company name, with glob match.
778	xtensa*)
779		basic_machine=$basic_machine-unknown
780		;;
781	# Recognize the various machine names and aliases which stand
782	# for a CPU type and a company and sometimes even an OS.
783	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
784		basic_machine=m68000-att
785		;;
786	3b*)
787		basic_machine=we32k-att
788		;;
789	abacus)
790		basic_machine=abacus-unknown
791		;;
792	alliant | fx80)
793		basic_machine=fx80-alliant
794		;;
795	altos | altos3068)
796		basic_machine=m68k-altos
797		;;
798	amiga | amiga-*)
799		basic_machine=m68k-unknown
800		;;
801	asmjs)
802		basic_machine=asmjs-unknown
803		;;
804	blackfin-*)
805		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
806		os=linux
807		;;
808	bluegene*)
809		basic_machine=powerpc-ibm
810		os=cnk
811		;;
812	c54x-*)
813		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
814		;;
815	c55x-*)
816		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
817		;;
818	c6x-*)
819		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
820		;;
821	c90)
822		basic_machine=c90-cray
823		os=${os:-unicos}
824		;;
825	convex-c1)
826		basic_machine=c1-convex
827		os=bsd
828		;;
829	convex-c2)
830		basic_machine=c2-convex
831		os=bsd
832		;;
833	convex-c32)
834		basic_machine=c32-convex
835		os=bsd
836		;;
837	convex-c34)
838		basic_machine=c34-convex
839		os=bsd
840		;;
841	convex-c38)
842		basic_machine=c38-convex
843		os=bsd
844		;;
845	cr16 | cr16-*)
846		basic_machine=cr16-unknown
847		os=${os:-elf}
848		;;
849	crds | unos)
850		basic_machine=m68k-crds
851		;;
852	crisv32 | crisv32-* | etraxfs*)
853		basic_machine=crisv32-axis
854		;;
855	cris | cris-* | etrax*)
856		basic_machine=cris-axis
857		;;
858	crx)
859		basic_machine=crx-unknown
860		os=${os:-elf}
861		;;
862	da30 | da30-*)
863		basic_machine=m68k-da30
864		;;
865	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
866		basic_machine=mips-dec
867		;;
868	decsystem10* | dec10*)
869		basic_machine=pdp10-dec
870		os=tops10
871		;;
872	decsystem20* | dec20*)
873		basic_machine=pdp10-dec
874		os=tops20
875		;;
876	delta | 3300 | motorola-3300 | motorola-delta \
877	      | 3300-motorola | delta-motorola)
878		basic_machine=m68k-motorola
879		;;
880	dpx20 | dpx20-*)
881		basic_machine=rs6000-bull
882		os=${os:-bosx}
883		;;
884	dpx2*)
885		basic_machine=m68k-bull
886		os=sysv3
887		;;
888	e500v[12])
889		basic_machine=powerpc-unknown
890		os=$os"spe"
891		;;
892	e500v[12]-*)
893		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
894		os=$os"spe"
895		;;
896	encore | umax | mmax)
897		basic_machine=ns32k-encore
898		;;
899	elxsi)
900		basic_machine=elxsi-elxsi
901		os=${os:-bsd}
902		;;
903	fx2800)
904		basic_machine=i860-alliant
905		;;
906	genix)
907		basic_machine=ns32k-ns
908		;;
909	h3050r* | hiux*)
910		basic_machine=hppa1.1-hitachi
911		os=hiuxwe2
912		;;
913	hp300-*)
914		basic_machine=m68k-hp
915		;;
916	hp3k9[0-9][0-9] | hp9[0-9][0-9])
917		basic_machine=hppa1.0-hp
918		;;
919	hp9k2[0-9][0-9] | hp9k31[0-9])
920		basic_machine=m68000-hp
921		;;
922	hp9k3[2-9][0-9])
923		basic_machine=m68k-hp
924		;;
925	hp9k6[0-9][0-9] | hp6[0-9][0-9])
926		basic_machine=hppa1.0-hp
927		;;
928	hp9k7[0-79][0-9] | hp7[0-79][0-9])
929		basic_machine=hppa1.1-hp
930		;;
931	hp9k78[0-9] | hp78[0-9])
932		# FIXME: really hppa2.0-hp
933		basic_machine=hppa1.1-hp
934		;;
935	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
936		# FIXME: really hppa2.0-hp
937		basic_machine=hppa1.1-hp
938		;;
939	hp9k8[0-9][13679] | hp8[0-9][13679])
940		basic_machine=hppa1.1-hp
941		;;
942	hp9k8[0-9][0-9] | hp8[0-9][0-9])
943		basic_machine=hppa1.0-hp
944		;;
945	i370-ibm* | ibm*)
946		basic_machine=i370-ibm
947		;;
948	i*86v32)
949		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
950		os=sysv32
951		;;
952	i*86v4*)
953		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
954		os=sysv4
955		;;
956	i*86v)
957		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
958		os=sysv
959		;;
960	i*86sol2)
961		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
962		os=solaris2
963		;;
964	j90 | j90-cray)
965		basic_machine=j90-cray
966		os=${os:-unicos}
967		;;
968	iris | iris4d)
969		basic_machine=mips-sgi
970		case $os in
971		    irix*)
972			;;
973		    *)
974			os=irix4
975			;;
976		esac
977		;;
978	leon-*|leon[3-9]-*)
979		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
980		;;
981	m68knommu-*)
982		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
983		os=linux
984		;;
985	microblaze*)
986		basic_machine=microblaze-xilinx
987		;;
988	miniframe)
989		basic_machine=m68000-convergent
990		;;
991	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
992		basic_machine=m68k-atari
993		os=mint
994		;;
995	mips3*-*)
996		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
997		;;
998	mips3*)
999		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
1000		;;
1001	ms1-*)
1002		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
1003		;;
1004	news-3600 | risc-news)
1005		basic_machine=mips-sony
1006		os=newsos
1007		;;
1008	next | m*-next)
1009		basic_machine=m68k-next
1010		case $os in
1011		    nextstep* )
1012			;;
1013		    ns2*)
1014		      os=nextstep2
1015			;;
1016		    *)
1017		      os=nextstep3
1018			;;
1019		esac
1020		;;
1021	np1)
1022		basic_machine=np1-gould
1023		;;
1024	neo-tandem)
1025		basic_machine=neo-tandem
1026		;;
1027	nse-tandem)
1028		basic_machine=nse-tandem
1029		;;
1030	nsr-tandem)
1031		basic_machine=nsr-tandem
1032		;;
1033	nsv-tandem)
1034		basic_machine=nsv-tandem
1035		;;
1036	nsx-tandem)
1037		basic_machine=nsx-tandem
1038		;;
1039	op50n-* | op60c-*)
1040		basic_machine=hppa1.1-oki
1041		os=proelf
1042		;;
1043	openrisc | openrisc-*)
1044		basic_machine=or32-unknown
1045		;;
1046	pa-hitachi)
1047		basic_machine=hppa1.1-hitachi
1048		os=hiuxwe2
1049		;;
1050	parisc-*)
1051		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1052		os=linux
1053		;;
1054	pbd)
1055		basic_machine=sparc-tti
1056		;;
1057	pbb)
1058		basic_machine=m68k-tti
1059		;;
1060	pc532 | pc532-*)
1061		basic_machine=ns32k-pc532
1062		;;
1063	pc98)
1064		basic_machine=i386-pc
1065		;;
1066	pc98-*)
1067		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1068		;;
1069	pentium | p5 | k5 | k6 | nexgen | viac3)
1070		basic_machine=i586-pc
1071		;;
1072	pentiumpro | p6 | 6x86 | athlon | athlon_*)
1073		basic_machine=i686-pc
1074		;;
1075	pentiumii | pentium2 | pentiumiii | pentium3)
1076		basic_machine=i686-pc
1077		;;
1078	pentium4)
1079		basic_machine=i786-pc
1080		;;
1081	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1082		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1083		;;
1084	pentiumpro-* | p6-* | 6x86-* | athlon-*)
1085		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1086		;;
1087	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1088		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1089		;;
1090	pentium4-*)
1091		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1092		;;
1093	pn)
1094		basic_machine=pn-gould
1095		;;
1096	power)	basic_machine=power-ibm
1097		;;
1098	ppc | ppcbe)	basic_machine=powerpc-unknown
1099		;;
1100	ppc-* | ppcbe-*)
1101		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1102		;;
1103	ppcle | powerpclittle)
1104		basic_machine=powerpcle-unknown
1105		;;
1106	ppcle-* | powerpclittle-*)
1107		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1108		;;
1109	ppc64)	basic_machine=powerpc64-unknown
1110		;;
1111	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1112		;;
1113	ppc64le | powerpc64little)
1114		basic_machine=powerpc64le-unknown
1115		;;
1116	ppc64le-* | powerpc64little-*)
1117		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1118		;;
1119	ps2)
1120		basic_machine=i386-ibm
1121		;;
1122	rm[46]00)
1123		basic_machine=mips-siemens
1124		;;
1125	rtpc | rtpc-*)
1126		basic_machine=romp-ibm
1127		;;
1128	s390 | s390-*)
1129		basic_machine=s390-ibm
1130		;;
1131	s390x | s390x-*)
1132		basic_machine=s390x-ibm
1133		;;
1134	sb1)
1135		basic_machine=mipsisa64sb1-unknown
1136		;;
1137	sb1el)
1138		basic_machine=mipsisa64sb1el-unknown
1139		;;
1140	sde)
1141		basic_machine=mipsisa32-sde
1142		os=${os:-elf}
1143		;;
1144	sequent)
1145		basic_machine=i386-sequent
1146		;;
1147	sh5el)
1148		basic_machine=sh5le-unknown
1149		;;
1150	simso-wrs)
1151		basic_machine=sparclite-wrs
1152		os=vxworks
1153		;;
1154	spur)
1155		basic_machine=spur-unknown
1156		;;
1157	st2000)
1158		basic_machine=m68k-tandem
1159		;;
1160	strongarm-* | thumb-*)
1161		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1162		;;
1163	sun2)
1164		basic_machine=m68000-sun
1165		;;
1166	sun3 | sun3-*)
1167		basic_machine=m68k-sun
1168		;;
1169	sun4)
1170		basic_machine=sparc-sun
1171		;;
1172	sun386 | sun386i | roadrunner)
1173		basic_machine=i386-sun
1174		;;
1175	tile*)
1176		basic_machine=$basic_machine-unknown
1177		os=linux-gnu
1178		;;
1179	tx39)
1180		basic_machine=mipstx39-unknown
1181		;;
1182	tx39el)
1183		basic_machine=mipstx39el-unknown
1184		;;
1185	tower | tower-32)
1186		basic_machine=m68k-ncr
1187		;;
1188	vpp*|vx|vx-*)
1189		basic_machine=f301-fujitsu
1190		;;
1191	w65*)
1192		basic_machine=w65-wdc
1193		os=none
1194		;;
1195	w89k-*)
1196		basic_machine=hppa1.1-winbond
1197		os=proelf
1198		;;
1199	x64)
1200		basic_machine=x86_64-pc
1201		;;
1202	xps | xps100)
1203		basic_machine=xps100-honeywell
1204		;;
1205	xscale-* | xscalee[bl]-*)
1206		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
1207		;;
1208	none)
1209		basic_machine=none-none
1210		os=${os:-none}
1211		;;
1212
1213# Here we handle the default manufacturer of certain CPU types.  It is in
1214# some cases the only manufacturer, in others, it is the most popular.
1215	w89k)
1216		basic_machine=hppa1.1-winbond
1217		;;
1218	op50n)
1219		basic_machine=hppa1.1-oki
1220		;;
1221	op60c)
1222		basic_machine=hppa1.1-oki
1223		;;
1224	romp)
1225		basic_machine=romp-ibm
1226		;;
1227	mmix)
1228		basic_machine=mmix-knuth
1229		;;
1230	rs6000)
1231		basic_machine=rs6000-ibm
1232		;;
1233	vax)
1234		basic_machine=vax-dec
1235		;;
1236	pdp11)
1237		basic_machine=pdp11-dec
1238		;;
1239	we32k)
1240		basic_machine=we32k-att
1241		;;
1242	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
1243		basic_machine=sh-unknown
1244		;;
1245	cydra)
1246		basic_machine=cydra-cydrome
1247		;;
1248	orion)
1249		basic_machine=orion-highlevel
1250		;;
1251	orion105)
1252		basic_machine=clipper-highlevel
1253		;;
1254	mac | mpw | mac-mpw)
1255		basic_machine=m68k-apple
1256		;;
1257	pmac | pmac-mpw)
1258		basic_machine=powerpc-apple
1259		;;
1260	*-unknown)
1261		# Make sure to match an already-canonicalized machine name.
1262		;;
1263	*)
1264		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
1265		exit 1
1266		;;
1267esac
1268
1269# Here we canonicalize certain aliases for manufacturers.
1270case $basic_machine in
1271	*-digital*)
1272		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
1273		;;
1274	*-commodore*)
1275		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
1276		;;
1277	*)
1278		;;
1279esac
1280
1281# Decode manufacturer-specific aliases for certain operating systems.
1282
1283if [ x$os != x ]
1284then
1285case $os in
1286	# First match some system type aliases that might get confused
1287	# with valid system types.
1288	# solaris* is a basic system type, with this one exception.
1289	auroraux)
1290		os=auroraux
1291		;;
1292	bluegene*)
1293		os=cnk
1294		;;
1295	solaris1 | solaris1.*)
1296		os=`echo $os | sed -e 's|solaris1|sunos4|'`
1297		;;
1298	solaris)
1299		os=solaris2
1300		;;
1301	unixware*)
1302		os=sysv4.2uw
1303		;;
1304	gnu/linux*)
1305		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1306		;;
1307	# es1800 is here to avoid being matched by es* (a different OS)
1308	es1800*)
1309		os=ose
1310		;;
1311	# Some version numbers need modification
1312	chorusos*)
1313		os=chorusos
1314		;;
1315	isc)
1316		os=isc2.2
1317		;;
1318	sco6)
1319		os=sco5v6
1320		;;
1321	sco5)
1322		os=sco3.2v5
1323		;;
1324	sco4)
1325		os=sco3.2v4
1326		;;
1327	sco3.2.[4-9]*)
1328		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
1329		;;
1330	sco3.2v[4-9]* | sco5v6*)
1331		# Don't forget version if it is 3.2v4 or newer.
1332		;;
1333	scout)
1334		# Don't match below
1335		;;
1336	sco*)
1337		os=sco3.2v2
1338		;;
1339	psos*)
1340		os=psos
1341		;;
1342	# Now accept the basic system types.
1343	# The portable systems comes first.
1344	# Each alternative MUST end in a * to match a version number.
1345	# sysv* is not here because it comes later, after sysvr4.
1346	gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1347	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
1348	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1349	     | sym* | kopensolaris* | plan9* \
1350	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1351	     | aos* | aros* | cloudabi* | sortix* \
1352	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1353	     | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \
1354	     | knetbsd* | mirbsd* | netbsd* \
1355	     | bitrig* | openbsd* | solidbsd* | libertybsd* \
1356	     | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
1357	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1358	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1359	     | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
1360	     | chorusrdb* | cegcc* | glidix* \
1361	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1362	     | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
1363	     | linux-newlib* | linux-musl* | linux-uclibc* \
1364	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1365	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1366	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1367	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1368	     | os2* | vos* | palmos* | uclinux* | nucleus* \
1369	     | morphos* | superux* | rtmk* | windiss* \
1370	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1371	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1372	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1373	     | midnightbsd*)
1374	# Remember, each alternative MUST END IN *, to match a version number.
1375		;;
1376	qnx*)
1377		case $basic_machine in
1378		    x86-* | i*86-*)
1379			;;
1380		    *)
1381			os=nto-$os
1382			;;
1383		esac
1384		;;
1385	hiux*)
1386		os=hiuxwe2
1387		;;
1388	nto-qnx*)
1389		;;
1390	nto*)
1391		os=`echo $os | sed -e 's|nto|nto-qnx|'`
1392		;;
1393	sim | xray | os68k* | v88r* \
1394	    | windows* | osx | abug | netware* | os9* \
1395	    | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
1396		;;
1397	linux-dietlibc)
1398		os=linux-dietlibc
1399		;;
1400	linux*)
1401		os=`echo $os | sed -e 's|linux|linux-gnu|'`
1402		;;
1403	lynx*178)
1404		os=lynxos178
1405		;;
1406	lynx*5)
1407		os=lynxos5
1408		;;
1409	lynx*)
1410		os=lynxos
1411		;;
1412	mac*)
1413		os=`echo "$os" | sed -e 's|mac|macos|'`
1414		;;
1415	opened*)
1416		os=openedition
1417		;;
1418	os400*)
1419		os=os400
1420		;;
1421	sunos5*)
1422		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1423		;;
1424	sunos6*)
1425		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1426		;;
1427	wince*)
1428		os=wince
1429		;;
1430	utek*)
1431		os=bsd
1432		;;
1433	dynix*)
1434		os=bsd
1435		;;
1436	acis*)
1437		os=aos
1438		;;
1439	atheos*)
1440		os=atheos
1441		;;
1442	syllable*)
1443		os=syllable
1444		;;
1445	386bsd)
1446		os=bsd
1447		;;
1448	ctix* | uts*)
1449		os=sysv
1450		;;
1451	nova*)
1452		os=rtmk-nova
1453		;;
1454	ns2)
1455		os=nextstep2
1456		;;
1457	nsk*)
1458		os=nsk
1459		;;
1460	# Preserve the version number of sinix5.
1461	sinix5.*)
1462		os=`echo $os | sed -e 's|sinix|sysv|'`
1463		;;
1464	sinix*)
1465		os=sysv4
1466		;;
1467	tpf*)
1468		os=tpf
1469		;;
1470	triton*)
1471		os=sysv3
1472		;;
1473	oss*)
1474		os=sysv3
1475		;;
1476	svr4*)
1477		os=sysv4
1478		;;
1479	svr3)
1480		os=sysv3
1481		;;
1482	sysvr4)
1483		os=sysv4
1484		;;
1485	# This must come after sysvr4.
1486	sysv*)
1487		;;
1488	ose*)
1489		os=ose
1490		;;
1491	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1492		os=mint
1493		;;
1494	zvmoe)
1495		os=zvmoe
1496		;;
1497	dicos*)
1498		os=dicos
1499		;;
1500	pikeos*)
1501		# Until real need of OS specific support for
1502		# particular features comes up, bare metal
1503		# configurations are quite functional.
1504		case $basic_machine in
1505		    arm*)
1506			os=eabi
1507			;;
1508		    *)
1509			os=elf
1510			;;
1511		esac
1512		;;
1513	nacl*)
1514		;;
1515	ios)
1516		;;
1517	none)
1518		;;
1519	*-eabi)
1520		;;
1521	*)
1522		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
1523		exit 1
1524		;;
1525esac
1526else
1527
1528# Here we handle the default operating systems that come with various machines.
1529# The value should be what the vendor currently ships out the door with their
1530# machine or put another way, the most popular os provided with the machine.
1531
1532# Note that if you're going to try to match "-MANUFACTURER" here (say,
1533# "-sun"), then you have to tell the case statement up towards the top
1534# that MANUFACTURER isn't an operating system.  Otherwise, code above
1535# will signal an error saying that MANUFACTURER isn't an operating
1536# system, and we'll never get to this point.
1537
1538case $basic_machine in
1539	score-*)
1540		os=elf
1541		;;
1542	spu-*)
1543		os=elf
1544		;;
1545	*-acorn)
1546		os=riscix1.2
1547		;;
1548	arm*-rebel)
1549		os=linux
1550		;;
1551	arm*-semi)
1552		os=aout
1553		;;
1554	c4x-* | tic4x-*)
1555		os=coff
1556		;;
1557	c8051-*)
1558		os=elf
1559		;;
1560	clipper-intergraph)
1561		os=clix
1562		;;
1563	hexagon-*)
1564		os=elf
1565		;;
1566	tic54x-*)
1567		os=coff
1568		;;
1569	tic55x-*)
1570		os=coff
1571		;;
1572	tic6x-*)
1573		os=coff
1574		;;
1575	# This must come before the *-dec entry.
1576	pdp10-*)
1577		os=tops20
1578		;;
1579	pdp11-*)
1580		os=none
1581		;;
1582	*-dec | vax-*)
1583		os=ultrix4.2
1584		;;
1585	m68*-apollo)
1586		os=domain
1587		;;
1588	i386-sun)
1589		os=sunos4.0.2
1590		;;
1591	m68000-sun)
1592		os=sunos3
1593		;;
1594	m68*-cisco)
1595		os=aout
1596		;;
1597	mep-*)
1598		os=elf
1599		;;
1600	mips*-cisco)
1601		os=elf
1602		;;
1603	mips*-*)
1604		os=elf
1605		;;
1606	or32-*)
1607		os=coff
1608		;;
1609	*-tti)	# must be before sparc entry or we get the wrong os.
1610		os=sysv3
1611		;;
1612	sparc-* | *-sun)
1613		os=sunos4.1.1
1614		;;
1615	pru-*)
1616		os=elf
1617		;;
1618	*-be)
1619		os=beos
1620		;;
1621	*-ibm)
1622		os=aix
1623		;;
1624	*-knuth)
1625		os=mmixware
1626		;;
1627	*-wec)
1628		os=proelf
1629		;;
1630	*-winbond)
1631		os=proelf
1632		;;
1633	*-oki)
1634		os=proelf
1635		;;
1636	*-hp)
1637		os=hpux
1638		;;
1639	*-hitachi)
1640		os=hiux
1641		;;
1642	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1643		os=sysv
1644		;;
1645	*-cbm)
1646		os=amigaos
1647		;;
1648	*-dg)
1649		os=dgux
1650		;;
1651	*-dolphin)
1652		os=sysv3
1653		;;
1654	m68k-ccur)
1655		os=rtu
1656		;;
1657	m88k-omron*)
1658		os=luna
1659		;;
1660	*-next)
1661		os=nextstep
1662		;;
1663	*-sequent)
1664		os=ptx
1665		;;
1666	*-crds)
1667		os=unos
1668		;;
1669	*-ns)
1670		os=genix
1671		;;
1672	i370-*)
1673		os=mvs
1674		;;
1675	*-gould)
1676		os=sysv
1677		;;
1678	*-highlevel)
1679		os=bsd
1680		;;
1681	*-encore)
1682		os=bsd
1683		;;
1684	*-sgi)
1685		os=irix
1686		;;
1687	*-siemens)
1688		os=sysv4
1689		;;
1690	*-masscomp)
1691		os=rtu
1692		;;
1693	f30[01]-fujitsu | f700-fujitsu)
1694		os=uxpv
1695		;;
1696	*-rom68k)
1697		os=coff
1698		;;
1699	*-*bug)
1700		os=coff
1701		;;
1702	*-apple)
1703		os=macos
1704		;;
1705	*-atari*)
1706		os=mint
1707		;;
1708	*-wrs)
1709		os=vxworks
1710		;;
1711	*)
1712		os=none
1713		;;
1714esac
1715fi
1716
1717# Here we handle the case where we know the os, and the CPU type, but not the
1718# manufacturer.  We pick the logical manufacturer.
1719vendor=unknown
1720case $basic_machine in
1721	*-unknown)
1722		case $os in
1723			riscix*)
1724				vendor=acorn
1725				;;
1726			sunos*)
1727				vendor=sun
1728				;;
1729			cnk*|-aix*)
1730				vendor=ibm
1731				;;
1732			beos*)
1733				vendor=be
1734				;;
1735			hpux*)
1736				vendor=hp
1737				;;
1738			mpeix*)
1739				vendor=hp
1740				;;
1741			hiux*)
1742				vendor=hitachi
1743				;;
1744			unos*)
1745				vendor=crds
1746				;;
1747			dgux*)
1748				vendor=dg
1749				;;
1750			luna*)
1751				vendor=omron
1752				;;
1753			genix*)
1754				vendor=ns
1755				;;
1756			clix*)
1757				vendor=intergraph
1758				;;
1759			mvs* | opened*)
1760				vendor=ibm
1761				;;
1762			os400*)
1763				vendor=ibm
1764				;;
1765			ptx*)
1766				vendor=sequent
1767				;;
1768			tpf*)
1769				vendor=ibm
1770				;;
1771			vxsim* | vxworks* | windiss*)
1772				vendor=wrs
1773				;;
1774			aux*)
1775				vendor=apple
1776				;;
1777			hms*)
1778				vendor=hitachi
1779				;;
1780			mpw* | macos*)
1781				vendor=apple
1782				;;
1783			*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1784				vendor=atari
1785				;;
1786			vos*)
1787				vendor=stratus
1788				;;
1789		esac
1790		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
1791		;;
1792esac
1793
1794echo "$basic_machine-$os"
1795exit
1796
1797# Local variables:
1798# eval: (add-hook 'before-save-hook 'time-stamp)
1799# time-stamp-start: "timestamp='"
1800# time-stamp-format: "%:y-%02m-%02d"
1801# time-stamp-end: "'"
1802# End:
1803