config.sub revision 74b97a6c
1b3307321Smrg#! /bin/sh
2b3307321Smrg# Configuration validation subroutine script.
374b97a6cSmrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4b3307321Smrg
574b97a6cSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
674b97a6cSmrg
774b97a6cSmrgtimestamp='2021-07-03'
8b3307321Smrg
974a3f230Smrg# This file is free software; you can redistribute it and/or modify it
1074a3f230Smrg# under the terms of the GNU General Public License as published by
1174a3f230Smrg# the Free Software Foundation; either version 3 of the License, or
12b3307321Smrg# (at your option) any later version.
13b3307321Smrg#
1474a3f230Smrg# This program is distributed in the hope that it will be useful, but
1574a3f230Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1674a3f230Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1774a3f230Smrg# General Public License for more details.
18b3307321Smrg#
19b3307321Smrg# You should have received a copy of the GNU General Public License
2006ef0fecSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21afe13c8eSmrg#
22b3307321Smrg# As a special exception to the GNU General Public License, if you
23b3307321Smrg# distribute this file as part of a program that contains a
24b3307321Smrg# configuration script generated by Autoconf, you may include it under
2574a3f230Smrg# the same distribution terms that you use for the rest of that
2674a3f230Smrg# program.  This Exception is an additional permission under section 7
2774a3f230Smrg# of the GNU General Public License, version 3 ("GPLv3").
28b3307321Smrg
29afe13c8eSmrg
3006ef0fecSmrg# Please send patches to <config-patches@gnu.org>.
31b3307321Smrg#
32b3307321Smrg# Configuration subroutine to validate and canonicalize a configuration type.
33b3307321Smrg# Supply the specified configuration type as an argument.
34b3307321Smrg# If it is invalid, we print an error message on stderr and exit with code 1.
35b3307321Smrg# Otherwise, we print the canonical config type on stdout and succeed.
36b3307321Smrg
3729cb5710Smrg# You can get the latest version of this script from:
3874b97a6cSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
3929cb5710Smrg
40b3307321Smrg# This file is supposed to be the same for all GNU packages
41b3307321Smrg# and recognize all the CPU types, system types and aliases
42b3307321Smrg# that are meaningful with *any* GNU software.
43b3307321Smrg# Each package is responsible for reporting which valid configurations
44b3307321Smrg# it does not support.  The user should be able to distinguish
45b3307321Smrg# a failure to support a valid configuration from a meaningless
46b3307321Smrg# configuration.
47b3307321Smrg
48b3307321Smrg# The goal of this file is to map all the various variations of a given
49b3307321Smrg# machine specification into a single specification in the form:
50b3307321Smrg#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
51b3307321Smrg# or in some cases, the newer four-part form:
52b3307321Smrg#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
53b3307321Smrg# It is wrong to echo any other type of specification.
54b3307321Smrg
5574b97a6cSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
5674b97a6cSmrg# about features and limitations of the classic Bourne shell that were
5774b97a6cSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
5874b97a6cSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
5974b97a6cSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
6074b97a6cSmrg# have a pre-POSIX /bin/sh.
6174b97a6cSmrg
62b3307321Smrgme=`echo "$0" | sed -e 's,.*/,,'`
63b3307321Smrg
64b3307321Smrgusage="\
6506ef0fecSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
66b3307321Smrg
67b3307321SmrgCanonicalize a configuration name.
68b3307321Smrg
6906ef0fecSmrgOptions:
70b3307321Smrg  -h, --help         print this help, then exit
71b3307321Smrg  -t, --time-stamp   print date of last modification, then exit
72b3307321Smrg  -v, --version      print version number, then exit
73b3307321Smrg
74b3307321SmrgReport bugs and patches to <config-patches@gnu.org>."
75b3307321Smrg
76b3307321Smrgversion="\
77b3307321SmrgGNU config.sub ($timestamp)
78b3307321Smrg
7974b97a6cSmrgCopyright 1992-2021 Free Software Foundation, Inc.
80b3307321Smrg
81b3307321SmrgThis is free software; see the source for copying conditions.  There is NO
82b3307321Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83b3307321Smrg
84b3307321Smrghelp="
85b3307321SmrgTry \`$me --help' for more information."
86b3307321Smrg
87b3307321Smrg# Parse command line
88b3307321Smrgwhile test $# -gt 0 ; do
89b3307321Smrg  case $1 in
90b3307321Smrg    --time-stamp | --time* | -t )
91afe13c8eSmrg       echo "$timestamp" ; exit ;;
92b3307321Smrg    --version | -v )
93afe13c8eSmrg       echo "$version" ; exit ;;
94b3307321Smrg    --help | --h* | -h )
95afe13c8eSmrg       echo "$usage"; exit ;;
96b3307321Smrg    -- )     # Stop option processing
97b3307321Smrg       shift; break ;;
98b3307321Smrg    - )	# Use stdin as input.
99b3307321Smrg       break ;;
100b3307321Smrg    -* )
10174b97a6cSmrg       echo "$me: invalid option $1$help" >&2
102b3307321Smrg       exit 1 ;;
103b3307321Smrg
104b3307321Smrg    *local*)
105b3307321Smrg       # First pass through any local machine types.
10606ef0fecSmrg       echo "$1"
107afe13c8eSmrg       exit ;;
108b3307321Smrg
109b3307321Smrg    * )
110b3307321Smrg       break ;;
111b3307321Smrg  esac
112b3307321Smrgdone
113b3307321Smrg
114b3307321Smrgcase $# in
115b3307321Smrg 0) echo "$me: missing argument$help" >&2
116b3307321Smrg    exit 1;;
117b3307321Smrg 1) ;;
118b3307321Smrg *) echo "$me: too many arguments$help" >&2
119b3307321Smrg    exit 1;;
120b3307321Smrgesac
121b3307321Smrg
12274b97a6cSmrg# Split fields of configuration type
12374b97a6cSmrg# shellcheck disable=SC2162
12474b97a6cSmrgIFS="-" read field1 field2 field3 field4 <<EOF
12574b97a6cSmrg$1
12674b97a6cSmrgEOF
127b3307321Smrg
12874b97a6cSmrg# Separate into logical components for further validation
12974b97a6cSmrgcase $1 in
13074b97a6cSmrg	*-*-*-*-*)
13174b97a6cSmrg		echo Invalid configuration \`"$1"\': more than four components >&2
13274b97a6cSmrg		exit 1
13374a3f230Smrg		;;
13474b97a6cSmrg	*-*-*-*)
13574b97a6cSmrg		basic_machine=$field1-$field2
13674b97a6cSmrg		basic_os=$field3-$field4
137b3307321Smrg		;;
13874b97a6cSmrg	*-*-*)
13974b97a6cSmrg		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
14074b97a6cSmrg		# parts
14174b97a6cSmrg		maybe_os=$field2-$field3
14274b97a6cSmrg		case $maybe_os in
14374b97a6cSmrg			nto-qnx* | linux-* | uclinux-uclibc* \
14474b97a6cSmrg			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
14574b97a6cSmrg			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
14674b97a6cSmrg			| storm-chaos* | os2-emx* | rtmk-nova*)
14774b97a6cSmrg				basic_machine=$field1
14874b97a6cSmrg				basic_os=$maybe_os
14974b97a6cSmrg				;;
15074b97a6cSmrg			android-linux)
15174b97a6cSmrg				basic_machine=$field1-unknown
15274b97a6cSmrg				basic_os=linux-android
15374b97a6cSmrg				;;
15474b97a6cSmrg			*)
15574b97a6cSmrg				basic_machine=$field1-$field2
15674b97a6cSmrg				basic_os=$field3
15774b97a6cSmrg				;;
15874b97a6cSmrg		esac
159b3307321Smrg		;;
16074b97a6cSmrg	*-*)
16174b97a6cSmrg		# A lone config we happen to match not fitting any pattern
16274b97a6cSmrg		case $field1-$field2 in
16374b97a6cSmrg			decstation-3100)
16474b97a6cSmrg				basic_machine=mips-dec
16574b97a6cSmrg				basic_os=
16674b97a6cSmrg				;;
16774b97a6cSmrg			*-*)
16874b97a6cSmrg				# Second component is usually, but not always the OS
16974b97a6cSmrg				case $field2 in
17074b97a6cSmrg					# Prevent following clause from handling this valid os
17174b97a6cSmrg					sun*os*)
17274b97a6cSmrg						basic_machine=$field1
17374b97a6cSmrg						basic_os=$field2
17474b97a6cSmrg						;;
17574b97a6cSmrg					# Manufacturers
17674b97a6cSmrg					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
17774b97a6cSmrg					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
17874b97a6cSmrg					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
17974b97a6cSmrg					| convergent* | ncr* | news | 32* | 3600* | 3100* \
18074b97a6cSmrg					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
18174b97a6cSmrg					| ultra | tti* | harris | dolphin | highlevel | gould \
18274b97a6cSmrg					| cbm | ns | masscomp | apple | axis | knuth | cray \
18374b97a6cSmrg					| microblaze* | sim | cisco \
18474b97a6cSmrg					| oki | wec | wrs | winbond)
18574b97a6cSmrg						basic_machine=$field1-$field2
18674b97a6cSmrg						basic_os=
18774b97a6cSmrg						;;
18874b97a6cSmrg					*)
18974b97a6cSmrg						basic_machine=$field1
19074b97a6cSmrg						basic_os=$field2
19174b97a6cSmrg						;;
19274b97a6cSmrg				esac
19374b97a6cSmrg			;;
19474b97a6cSmrg		esac
195b3307321Smrg		;;
19674b97a6cSmrg	*)
19774b97a6cSmrg		# Convert single-component short-hands not valid as part of
19874b97a6cSmrg		# multi-component configurations.
19974b97a6cSmrg		case $field1 in
20074b97a6cSmrg			386bsd)
20174b97a6cSmrg				basic_machine=i386-pc
20274b97a6cSmrg				basic_os=bsd
20374b97a6cSmrg				;;
20474b97a6cSmrg			a29khif)
20574b97a6cSmrg				basic_machine=a29k-amd
20674b97a6cSmrg				basic_os=udi
20774b97a6cSmrg				;;
20874b97a6cSmrg			adobe68k)
20974b97a6cSmrg				basic_machine=m68010-adobe
21074b97a6cSmrg				basic_os=scout
21174b97a6cSmrg				;;
21274b97a6cSmrg			alliant)
21374b97a6cSmrg				basic_machine=fx80-alliant
21474b97a6cSmrg				basic_os=
21574b97a6cSmrg				;;
21674b97a6cSmrg			altos | altos3068)
21774b97a6cSmrg				basic_machine=m68k-altos
21874b97a6cSmrg				basic_os=
21974b97a6cSmrg				;;
22074b97a6cSmrg			am29k)
22174b97a6cSmrg				basic_machine=a29k-none
22274b97a6cSmrg				basic_os=bsd
22374b97a6cSmrg				;;
22474b97a6cSmrg			amdahl)
22574b97a6cSmrg				basic_machine=580-amdahl
22674b97a6cSmrg				basic_os=sysv
22774b97a6cSmrg				;;
22874b97a6cSmrg			amiga)
22974b97a6cSmrg				basic_machine=m68k-unknown
23074b97a6cSmrg				basic_os=
23174b97a6cSmrg				;;
23274b97a6cSmrg			amigaos | amigados)
23374b97a6cSmrg				basic_machine=m68k-unknown
23474b97a6cSmrg				basic_os=amigaos
23574b97a6cSmrg				;;
23674b97a6cSmrg			amigaunix | amix)
23774b97a6cSmrg				basic_machine=m68k-unknown
23874b97a6cSmrg				basic_os=sysv4
23974b97a6cSmrg				;;
24074b97a6cSmrg			apollo68)
24174b97a6cSmrg				basic_machine=m68k-apollo
24274b97a6cSmrg				basic_os=sysv
24374b97a6cSmrg				;;
24474b97a6cSmrg			apollo68bsd)
24574b97a6cSmrg				basic_machine=m68k-apollo
24674b97a6cSmrg				basic_os=bsd
24774b97a6cSmrg				;;
24874b97a6cSmrg			aros)
24974b97a6cSmrg				basic_machine=i386-pc
25074b97a6cSmrg				basic_os=aros
25174b97a6cSmrg				;;
25274b97a6cSmrg			aux)
25374b97a6cSmrg				basic_machine=m68k-apple
25474b97a6cSmrg				basic_os=aux
25574b97a6cSmrg				;;
25674b97a6cSmrg			balance)
25774b97a6cSmrg				basic_machine=ns32k-sequent
25874b97a6cSmrg				basic_os=dynix
25974b97a6cSmrg				;;
26074b97a6cSmrg			blackfin)
26174b97a6cSmrg				basic_machine=bfin-unknown
26274b97a6cSmrg				basic_os=linux
26374b97a6cSmrg				;;
26474b97a6cSmrg			cegcc)
26574b97a6cSmrg				basic_machine=arm-unknown
26674b97a6cSmrg				basic_os=cegcc
26774b97a6cSmrg				;;
26874b97a6cSmrg			convex-c1)
26974b97a6cSmrg				basic_machine=c1-convex
27074b97a6cSmrg				basic_os=bsd
27174b97a6cSmrg				;;
27274b97a6cSmrg			convex-c2)
27374b97a6cSmrg				basic_machine=c2-convex
27474b97a6cSmrg				basic_os=bsd
27574b97a6cSmrg				;;
27674b97a6cSmrg			convex-c32)
27774b97a6cSmrg				basic_machine=c32-convex
27874b97a6cSmrg				basic_os=bsd
27974b97a6cSmrg				;;
28074b97a6cSmrg			convex-c34)
28174b97a6cSmrg				basic_machine=c34-convex
28274b97a6cSmrg				basic_os=bsd
28374b97a6cSmrg				;;
28474b97a6cSmrg			convex-c38)
28574b97a6cSmrg				basic_machine=c38-convex
28674b97a6cSmrg				basic_os=bsd
28774b97a6cSmrg				;;
28874b97a6cSmrg			cray)
28974b97a6cSmrg				basic_machine=j90-cray
29074b97a6cSmrg				basic_os=unicos
29174b97a6cSmrg				;;
29274b97a6cSmrg			crds | unos)
29374b97a6cSmrg				basic_machine=m68k-crds
29474b97a6cSmrg				basic_os=
29574b97a6cSmrg				;;
29674b97a6cSmrg			da30)
29774b97a6cSmrg				basic_machine=m68k-da30
29874b97a6cSmrg				basic_os=
29974b97a6cSmrg				;;
30074b97a6cSmrg			decstation | pmax | pmin | dec3100 | decstatn)
30174b97a6cSmrg				basic_machine=mips-dec
30274b97a6cSmrg				basic_os=
30374b97a6cSmrg				;;
30474b97a6cSmrg			delta88)
30574b97a6cSmrg				basic_machine=m88k-motorola
30674b97a6cSmrg				basic_os=sysv3
30774b97a6cSmrg				;;
30874b97a6cSmrg			dicos)
30974b97a6cSmrg				basic_machine=i686-pc
31074b97a6cSmrg				basic_os=dicos
31174b97a6cSmrg				;;
31274b97a6cSmrg			djgpp)
31374b97a6cSmrg				basic_machine=i586-pc
31474b97a6cSmrg				basic_os=msdosdjgpp
31574b97a6cSmrg				;;
31674b97a6cSmrg			ebmon29k)
31774b97a6cSmrg				basic_machine=a29k-amd
31874b97a6cSmrg				basic_os=ebmon
31974b97a6cSmrg				;;
32074b97a6cSmrg			es1800 | OSE68k | ose68k | ose | OSE)
32174b97a6cSmrg				basic_machine=m68k-ericsson
32274b97a6cSmrg				basic_os=ose
32374b97a6cSmrg				;;
32474b97a6cSmrg			gmicro)
32574b97a6cSmrg				basic_machine=tron-gmicro
32674b97a6cSmrg				basic_os=sysv
32774b97a6cSmrg				;;
32874b97a6cSmrg			go32)
32974b97a6cSmrg				basic_machine=i386-pc
33074b97a6cSmrg				basic_os=go32
33174b97a6cSmrg				;;
33274b97a6cSmrg			h8300hms)
33374b97a6cSmrg				basic_machine=h8300-hitachi
33474b97a6cSmrg				basic_os=hms
33574b97a6cSmrg				;;
33674b97a6cSmrg			h8300xray)
33774b97a6cSmrg				basic_machine=h8300-hitachi
33874b97a6cSmrg				basic_os=xray
33974b97a6cSmrg				;;
34074b97a6cSmrg			h8500hms)
34174b97a6cSmrg				basic_machine=h8500-hitachi
34274b97a6cSmrg				basic_os=hms
34374b97a6cSmrg				;;
34474b97a6cSmrg			harris)
34574b97a6cSmrg				basic_machine=m88k-harris
34674b97a6cSmrg				basic_os=sysv3
34774b97a6cSmrg				;;
34874b97a6cSmrg			hp300 | hp300hpux)
34974b97a6cSmrg				basic_machine=m68k-hp
35074b97a6cSmrg				basic_os=hpux
35174b97a6cSmrg				;;
35274b97a6cSmrg			hp300bsd)
35374b97a6cSmrg				basic_machine=m68k-hp
35474b97a6cSmrg				basic_os=bsd
35574b97a6cSmrg				;;
35674b97a6cSmrg			hppaosf)
35774b97a6cSmrg				basic_machine=hppa1.1-hp
35874b97a6cSmrg				basic_os=osf
35974b97a6cSmrg				;;
36074b97a6cSmrg			hppro)
36174b97a6cSmrg				basic_machine=hppa1.1-hp
36274b97a6cSmrg				basic_os=proelf
36374b97a6cSmrg				;;
36474b97a6cSmrg			i386mach)
36574b97a6cSmrg				basic_machine=i386-mach
36674b97a6cSmrg				basic_os=mach
36774b97a6cSmrg				;;
36874b97a6cSmrg			isi68 | isi)
36974b97a6cSmrg				basic_machine=m68k-isi
37074b97a6cSmrg				basic_os=sysv
37174b97a6cSmrg				;;
37274b97a6cSmrg			m68knommu)
37374b97a6cSmrg				basic_machine=m68k-unknown
37474b97a6cSmrg				basic_os=linux
37574b97a6cSmrg				;;
37674b97a6cSmrg			magnum | m3230)
37774b97a6cSmrg				basic_machine=mips-mips
37874b97a6cSmrg				basic_os=sysv
37974b97a6cSmrg				;;
38074b97a6cSmrg			merlin)
38174b97a6cSmrg				basic_machine=ns32k-utek
38274b97a6cSmrg				basic_os=sysv
38374b97a6cSmrg				;;
38474b97a6cSmrg			mingw64)
38574b97a6cSmrg				basic_machine=x86_64-pc
38674b97a6cSmrg				basic_os=mingw64
38774b97a6cSmrg				;;
38874b97a6cSmrg			mingw32)
38974b97a6cSmrg				basic_machine=i686-pc
39074b97a6cSmrg				basic_os=mingw32
39174b97a6cSmrg				;;
39274b97a6cSmrg			mingw32ce)
39374b97a6cSmrg				basic_machine=arm-unknown
39474b97a6cSmrg				basic_os=mingw32ce
39574b97a6cSmrg				;;
39674b97a6cSmrg			monitor)
39774b97a6cSmrg				basic_machine=m68k-rom68k
39874b97a6cSmrg				basic_os=coff
39974b97a6cSmrg				;;
40074b97a6cSmrg			morphos)
40174b97a6cSmrg				basic_machine=powerpc-unknown
40274b97a6cSmrg				basic_os=morphos
40374b97a6cSmrg				;;
40474b97a6cSmrg			moxiebox)
40574b97a6cSmrg				basic_machine=moxie-unknown
40674b97a6cSmrg				basic_os=moxiebox
40774b97a6cSmrg				;;
40874b97a6cSmrg			msdos)
40974b97a6cSmrg				basic_machine=i386-pc
41074b97a6cSmrg				basic_os=msdos
41174b97a6cSmrg				;;
41274b97a6cSmrg			msys)
41374b97a6cSmrg				basic_machine=i686-pc
41474b97a6cSmrg				basic_os=msys
41574b97a6cSmrg				;;
41674b97a6cSmrg			mvs)
41774b97a6cSmrg				basic_machine=i370-ibm
41874b97a6cSmrg				basic_os=mvs
41974b97a6cSmrg				;;
42074b97a6cSmrg			nacl)
42174b97a6cSmrg				basic_machine=le32-unknown
42274b97a6cSmrg				basic_os=nacl
42374b97a6cSmrg				;;
42474b97a6cSmrg			ncr3000)
42574b97a6cSmrg				basic_machine=i486-ncr
42674b97a6cSmrg				basic_os=sysv4
42774b97a6cSmrg				;;
42874b97a6cSmrg			netbsd386)
42974b97a6cSmrg				basic_machine=i386-pc
43074b97a6cSmrg				basic_os=netbsd
43174b97a6cSmrg				;;
43274b97a6cSmrg			netwinder)
43374b97a6cSmrg				basic_machine=armv4l-rebel
43474b97a6cSmrg				basic_os=linux
43574b97a6cSmrg				;;
43674b97a6cSmrg			news | news700 | news800 | news900)
43774b97a6cSmrg				basic_machine=m68k-sony
43874b97a6cSmrg				basic_os=newsos
43974b97a6cSmrg				;;
44074b97a6cSmrg			news1000)
44174b97a6cSmrg				basic_machine=m68030-sony
44274b97a6cSmrg				basic_os=newsos
44374b97a6cSmrg				;;
44474b97a6cSmrg			necv70)
44574b97a6cSmrg				basic_machine=v70-nec
44674b97a6cSmrg				basic_os=sysv
44774b97a6cSmrg				;;
44874b97a6cSmrg			nh3000)
44974b97a6cSmrg				basic_machine=m68k-harris
45074b97a6cSmrg				basic_os=cxux
45174b97a6cSmrg				;;
45274b97a6cSmrg			nh[45]000)
45374b97a6cSmrg				basic_machine=m88k-harris
45474b97a6cSmrg				basic_os=cxux
45574b97a6cSmrg				;;
45674b97a6cSmrg			nindy960)
45774b97a6cSmrg				basic_machine=i960-intel
45874b97a6cSmrg				basic_os=nindy
45974b97a6cSmrg				;;
46074b97a6cSmrg			mon960)
46174b97a6cSmrg				basic_machine=i960-intel
46274b97a6cSmrg				basic_os=mon960
46374b97a6cSmrg				;;
46474b97a6cSmrg			nonstopux)
46574b97a6cSmrg				basic_machine=mips-compaq
46674b97a6cSmrg				basic_os=nonstopux
46774b97a6cSmrg				;;
46874b97a6cSmrg			os400)
46974b97a6cSmrg				basic_machine=powerpc-ibm
47074b97a6cSmrg				basic_os=os400
47174b97a6cSmrg				;;
47274b97a6cSmrg			OSE68000 | ose68000)
47374b97a6cSmrg				basic_machine=m68000-ericsson
47474b97a6cSmrg				basic_os=ose
47574b97a6cSmrg				;;
47674b97a6cSmrg			os68k)
47774b97a6cSmrg				basic_machine=m68k-none
47874b97a6cSmrg				basic_os=os68k
47974b97a6cSmrg				;;
48074b97a6cSmrg			paragon)
48174b97a6cSmrg				basic_machine=i860-intel
48274b97a6cSmrg				basic_os=osf
48374b97a6cSmrg				;;
48474b97a6cSmrg			parisc)
48574b97a6cSmrg				basic_machine=hppa-unknown
48674b97a6cSmrg				basic_os=linux
48774b97a6cSmrg				;;
48874b97a6cSmrg			psp)
48974b97a6cSmrg				basic_machine=mipsallegrexel-sony
49074b97a6cSmrg				basic_os=psp
49174b97a6cSmrg				;;
49274b97a6cSmrg			pw32)
49374b97a6cSmrg				basic_machine=i586-unknown
49474b97a6cSmrg				basic_os=pw32
49574b97a6cSmrg				;;
49674b97a6cSmrg			rdos | rdos64)
49774b97a6cSmrg				basic_machine=x86_64-pc
49874b97a6cSmrg				basic_os=rdos
49974b97a6cSmrg				;;
50074b97a6cSmrg			rdos32)
50174b97a6cSmrg				basic_machine=i386-pc
50274b97a6cSmrg				basic_os=rdos
50374b97a6cSmrg				;;
50474b97a6cSmrg			rom68k)
50574b97a6cSmrg				basic_machine=m68k-rom68k
50674b97a6cSmrg				basic_os=coff
50774b97a6cSmrg				;;
50874b97a6cSmrg			sa29200)
50974b97a6cSmrg				basic_machine=a29k-amd
51074b97a6cSmrg				basic_os=udi
51174b97a6cSmrg				;;
51274b97a6cSmrg			sei)
51374b97a6cSmrg				basic_machine=mips-sei
51474b97a6cSmrg				basic_os=seiux
51574b97a6cSmrg				;;
51674b97a6cSmrg			sequent)
51774b97a6cSmrg				basic_machine=i386-sequent
51874b97a6cSmrg				basic_os=
51974b97a6cSmrg				;;
52074b97a6cSmrg			sps7)
52174b97a6cSmrg				basic_machine=m68k-bull
52274b97a6cSmrg				basic_os=sysv2
52374b97a6cSmrg				;;
52474b97a6cSmrg			st2000)
52574b97a6cSmrg				basic_machine=m68k-tandem
52674b97a6cSmrg				basic_os=
52774b97a6cSmrg				;;
52874b97a6cSmrg			stratus)
52974b97a6cSmrg				basic_machine=i860-stratus
53074b97a6cSmrg				basic_os=sysv4
53174b97a6cSmrg				;;
53274b97a6cSmrg			sun2)
53374b97a6cSmrg				basic_machine=m68000-sun
53474b97a6cSmrg				basic_os=
53574b97a6cSmrg				;;
53674b97a6cSmrg			sun2os3)
53774b97a6cSmrg				basic_machine=m68000-sun
53874b97a6cSmrg				basic_os=sunos3
53974b97a6cSmrg				;;
54074b97a6cSmrg			sun2os4)
54174b97a6cSmrg				basic_machine=m68000-sun
54274b97a6cSmrg				basic_os=sunos4
54374b97a6cSmrg				;;
54474b97a6cSmrg			sun3)
54574b97a6cSmrg				basic_machine=m68k-sun
54674b97a6cSmrg				basic_os=
54774b97a6cSmrg				;;
54874b97a6cSmrg			sun3os3)
54974b97a6cSmrg				basic_machine=m68k-sun
55074b97a6cSmrg				basic_os=sunos3
55174b97a6cSmrg				;;
55274b97a6cSmrg			sun3os4)
55374b97a6cSmrg				basic_machine=m68k-sun
55474b97a6cSmrg				basic_os=sunos4
55574b97a6cSmrg				;;
55674b97a6cSmrg			sun4)
55774b97a6cSmrg				basic_machine=sparc-sun
55874b97a6cSmrg				basic_os=
55974b97a6cSmrg				;;
56074b97a6cSmrg			sun4os3)
56174b97a6cSmrg				basic_machine=sparc-sun
56274b97a6cSmrg				basic_os=sunos3
56374b97a6cSmrg				;;
56474b97a6cSmrg			sun4os4)
56574b97a6cSmrg				basic_machine=sparc-sun
56674b97a6cSmrg				basic_os=sunos4
56774b97a6cSmrg				;;
56874b97a6cSmrg			sun4sol2)
56974b97a6cSmrg				basic_machine=sparc-sun
57074b97a6cSmrg				basic_os=solaris2
57174b97a6cSmrg				;;
57274b97a6cSmrg			sun386 | sun386i | roadrunner)
57374b97a6cSmrg				basic_machine=i386-sun
57474b97a6cSmrg				basic_os=
57574b97a6cSmrg				;;
57674b97a6cSmrg			sv1)
57774b97a6cSmrg				basic_machine=sv1-cray
57874b97a6cSmrg				basic_os=unicos
57974b97a6cSmrg				;;
58074b97a6cSmrg			symmetry)
58174b97a6cSmrg				basic_machine=i386-sequent
58274b97a6cSmrg				basic_os=dynix
58374b97a6cSmrg				;;
58474b97a6cSmrg			t3e)
58574b97a6cSmrg				basic_machine=alphaev5-cray
58674b97a6cSmrg				basic_os=unicos
58774b97a6cSmrg				;;
58874b97a6cSmrg			t90)
58974b97a6cSmrg				basic_machine=t90-cray
59074b97a6cSmrg				basic_os=unicos
59174b97a6cSmrg				;;
59274b97a6cSmrg			toad1)
59374b97a6cSmrg				basic_machine=pdp10-xkl
59474b97a6cSmrg				basic_os=tops20
59574b97a6cSmrg				;;
59674b97a6cSmrg			tpf)
59774b97a6cSmrg				basic_machine=s390x-ibm
59874b97a6cSmrg				basic_os=tpf
59974b97a6cSmrg				;;
60074b97a6cSmrg			udi29k)
60174b97a6cSmrg				basic_machine=a29k-amd
60274b97a6cSmrg				basic_os=udi
60374b97a6cSmrg				;;
60474b97a6cSmrg			ultra3)
60574b97a6cSmrg				basic_machine=a29k-nyu
60674b97a6cSmrg				basic_os=sym1
60774b97a6cSmrg				;;
60874b97a6cSmrg			v810 | necv810)
60974b97a6cSmrg				basic_machine=v810-nec
61074b97a6cSmrg				basic_os=none
61174b97a6cSmrg				;;
61274b97a6cSmrg			vaxv)
61374b97a6cSmrg				basic_machine=vax-dec
61474b97a6cSmrg				basic_os=sysv
61574b97a6cSmrg				;;
61674b97a6cSmrg			vms)
61774b97a6cSmrg				basic_machine=vax-dec
61874b97a6cSmrg				basic_os=vms
61974b97a6cSmrg				;;
62074b97a6cSmrg			vsta)
62174b97a6cSmrg				basic_machine=i386-pc
62274b97a6cSmrg				basic_os=vsta
62374b97a6cSmrg				;;
62474b97a6cSmrg			vxworks960)
62574b97a6cSmrg				basic_machine=i960-wrs
62674b97a6cSmrg				basic_os=vxworks
62774b97a6cSmrg				;;
62874b97a6cSmrg			vxworks68)
62974b97a6cSmrg				basic_machine=m68k-wrs
63074b97a6cSmrg				basic_os=vxworks
63174b97a6cSmrg				;;
63274b97a6cSmrg			vxworks29k)
63374b97a6cSmrg				basic_machine=a29k-wrs
63474b97a6cSmrg				basic_os=vxworks
63574b97a6cSmrg				;;
63674b97a6cSmrg			xbox)
63774b97a6cSmrg				basic_machine=i686-pc
63874b97a6cSmrg				basic_os=mingw32
63974b97a6cSmrg				;;
64074b97a6cSmrg			ymp)
64174b97a6cSmrg				basic_machine=ymp-cray
64274b97a6cSmrg				basic_os=unicos
64374b97a6cSmrg				;;
64474b97a6cSmrg			*)
64574b97a6cSmrg				basic_machine=$1
64674b97a6cSmrg				basic_os=
64774b97a6cSmrg				;;
64874b97a6cSmrg		esac
649b3307321Smrg		;;
650b3307321Smrgesac
651b3307321Smrg
65274b97a6cSmrg# Decode 1-component or ad-hoc basic machines
653b3307321Smrgcase $basic_machine in
65474b97a6cSmrg	# Here we handle the default manufacturer of certain CPU types.  It is in
65574b97a6cSmrg	# some cases the only manufacturer, in others, it is the most popular.
65674b97a6cSmrg	w89k)
65774b97a6cSmrg		cpu=hppa1.1
65874b97a6cSmrg		vendor=winbond
65906ef0fecSmrg		;;
66074b97a6cSmrg	op50n)
66174b97a6cSmrg		cpu=hppa1.1
66274b97a6cSmrg		vendor=oki
663b3307321Smrg		;;
66474b97a6cSmrg	op60c)
66574b97a6cSmrg		cpu=hppa1.1
66674b97a6cSmrg		vendor=oki
667b3307321Smrg		;;
66874b97a6cSmrg	ibm*)
66974b97a6cSmrg		cpu=i370
67074b97a6cSmrg		vendor=ibm
671afe13c8eSmrg		;;
67274b97a6cSmrg	orion105)
67374b97a6cSmrg		cpu=clipper
67474b97a6cSmrg		vendor=highlevel
67574a3f230Smrg		;;
67674b97a6cSmrg	mac | mpw | mac-mpw)
67774b97a6cSmrg		cpu=m68k
67874b97a6cSmrg		vendor=apple
67974a3f230Smrg		;;
68074b97a6cSmrg	pmac | pmac-mpw)
68174b97a6cSmrg		cpu=powerpc
68274b97a6cSmrg		vendor=apple
68374a3f230Smrg		;;
68474a3f230Smrg
685b3307321Smrg	# Recognize the various machine names and aliases which stand
686b3307321Smrg	# for a CPU type and a company and sometimes even an OS.
687b3307321Smrg	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
68874b97a6cSmrg		cpu=m68000
68974b97a6cSmrg		vendor=att
690b3307321Smrg		;;
691b3307321Smrg	3b*)
69274b97a6cSmrg		cpu=we32k
69374b97a6cSmrg		vendor=att
694afe13c8eSmrg		;;
69529cb5710Smrg	bluegene*)
69674b97a6cSmrg		cpu=powerpc
69774b97a6cSmrg		vendor=ibm
69874b97a6cSmrg		basic_os=cnk
699b3307321Smrg		;;
700b3307321Smrg	decsystem10* | dec10*)
70174b97a6cSmrg		cpu=pdp10
70274b97a6cSmrg		vendor=dec
70374b97a6cSmrg		basic_os=tops10
704b3307321Smrg		;;
705b3307321Smrg	decsystem20* | dec20*)
70674b97a6cSmrg		cpu=pdp10
70774b97a6cSmrg		vendor=dec
70874b97a6cSmrg		basic_os=tops20
709b3307321Smrg		;;
710b3307321Smrg	delta | 3300 | motorola-3300 | motorola-delta \
711b3307321Smrg	      | 3300-motorola | delta-motorola)
71274b97a6cSmrg		cpu=m68k
71374b97a6cSmrg		vendor=motorola
714b3307321Smrg		;;
71506ef0fecSmrg	dpx2*)
71674b97a6cSmrg		cpu=m68k
71774b97a6cSmrg		vendor=bull
71874b97a6cSmrg		basic_os=sysv3
719b3307321Smrg		;;
720b3307321Smrg	encore | umax | mmax)
72174b97a6cSmrg		cpu=ns32k
72274b97a6cSmrg		vendor=encore
723b3307321Smrg		;;
72474b97a6cSmrg	elxsi)
72574b97a6cSmrg		cpu=elxsi
72674b97a6cSmrg		vendor=elxsi
72774b97a6cSmrg		basic_os=${basic_os:-bsd}
728b3307321Smrg		;;
729b3307321Smrg	fx2800)
73074b97a6cSmrg		cpu=i860
73174b97a6cSmrg		vendor=alliant
732b3307321Smrg		;;
733b3307321Smrg	genix)
73474b97a6cSmrg		cpu=ns32k
73574b97a6cSmrg		vendor=ns
736b3307321Smrg		;;
737b3307321Smrg	h3050r* | hiux*)
73874b97a6cSmrg		cpu=hppa1.1
73974b97a6cSmrg		vendor=hitachi
74074b97a6cSmrg		basic_os=hiuxwe2
741b3307321Smrg		;;
742b3307321Smrg	hp3k9[0-9][0-9] | hp9[0-9][0-9])
74374b97a6cSmrg		cpu=hppa1.0
74474b97a6cSmrg		vendor=hp
745b3307321Smrg		;;
746b3307321Smrg	hp9k2[0-9][0-9] | hp9k31[0-9])
74774b97a6cSmrg		cpu=m68000
74874b97a6cSmrg		vendor=hp
749b3307321Smrg		;;
750b3307321Smrg	hp9k3[2-9][0-9])
75174b97a6cSmrg		cpu=m68k
75274b97a6cSmrg		vendor=hp
753b3307321Smrg		;;
754b3307321Smrg	hp9k6[0-9][0-9] | hp6[0-9][0-9])
75574b97a6cSmrg		cpu=hppa1.0
75674b97a6cSmrg		vendor=hp
757b3307321Smrg		;;
758b3307321Smrg	hp9k7[0-79][0-9] | hp7[0-79][0-9])
75974b97a6cSmrg		cpu=hppa1.1
76074b97a6cSmrg		vendor=hp
761b3307321Smrg		;;
762b3307321Smrg	hp9k78[0-9] | hp78[0-9])
763b3307321Smrg		# FIXME: really hppa2.0-hp
76474b97a6cSmrg		cpu=hppa1.1
76574b97a6cSmrg		vendor=hp
766b3307321Smrg		;;
767b3307321Smrg	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
768b3307321Smrg		# FIXME: really hppa2.0-hp
76974b97a6cSmrg		cpu=hppa1.1
77074b97a6cSmrg		vendor=hp
771b3307321Smrg		;;
772b3307321Smrg	hp9k8[0-9][13679] | hp8[0-9][13679])
77374b97a6cSmrg		cpu=hppa1.1
77474b97a6cSmrg		vendor=hp
775b3307321Smrg		;;
776b3307321Smrg	hp9k8[0-9][0-9] | hp8[0-9][0-9])
77774b97a6cSmrg		cpu=hppa1.0
77874b97a6cSmrg		vendor=hp
779b3307321Smrg		;;
780b3307321Smrg	i*86v32)
78174b97a6cSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
78274b97a6cSmrg		vendor=pc
78374b97a6cSmrg		basic_os=sysv32
784b3307321Smrg		;;
785b3307321Smrg	i*86v4*)
78674b97a6cSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
78774b97a6cSmrg		vendor=pc
78874b97a6cSmrg		basic_os=sysv4
789b3307321Smrg		;;
790b3307321Smrg	i*86v)
79174b97a6cSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79274b97a6cSmrg		vendor=pc
79374b97a6cSmrg		basic_os=sysv
794b3307321Smrg		;;
795b3307321Smrg	i*86sol2)
79674b97a6cSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79774b97a6cSmrg		vendor=pc
79874b97a6cSmrg		basic_os=solaris2
799b3307321Smrg		;;
80074b97a6cSmrg	j90 | j90-cray)
80174b97a6cSmrg		cpu=j90
80274b97a6cSmrg		vendor=cray
80374b97a6cSmrg		basic_os=${basic_os:-unicos}
804b3307321Smrg		;;
805b3307321Smrg	iris | iris4d)
80674b97a6cSmrg		cpu=mips
80774b97a6cSmrg		vendor=sgi
80874b97a6cSmrg		case $basic_os in
80974b97a6cSmrg		    irix*)
810b3307321Smrg			;;
811b3307321Smrg		    *)
81274b97a6cSmrg			basic_os=irix4
813b3307321Smrg			;;
814b3307321Smrg		esac
815b3307321Smrg		;;
816b3307321Smrg	miniframe)
81774b97a6cSmrg		cpu=m68000
81874b97a6cSmrg		vendor=convergent
819b3307321Smrg		;;
82074b97a6cSmrg	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
82174b97a6cSmrg		cpu=m68k
82274b97a6cSmrg		vendor=atari
82374b97a6cSmrg		basic_os=mint
824b3307321Smrg		;;
825b3307321Smrg	news-3600 | risc-news)
82674b97a6cSmrg		cpu=mips
82774b97a6cSmrg		vendor=sony
82874b97a6cSmrg		basic_os=newsos
829b3307321Smrg		;;
83006ef0fecSmrg	next | m*-next)
83174b97a6cSmrg		cpu=m68k
83274b97a6cSmrg		vendor=next
83374b97a6cSmrg		case $basic_os in
83474b97a6cSmrg		    openstep*)
83574b97a6cSmrg		        ;;
83674b97a6cSmrg		    nextstep*)
837b3307321Smrg			;;
83874b97a6cSmrg		    ns2*)
83974b97a6cSmrg		      basic_os=nextstep2
840b3307321Smrg			;;
841b3307321Smrg		    *)
84274b97a6cSmrg		      basic_os=nextstep3
843b3307321Smrg			;;
844b3307321Smrg		esac
845b3307321Smrg		;;
846b3307321Smrg	np1)
84774b97a6cSmrg		cpu=np1
84874b97a6cSmrg		vendor=gould
84906ef0fecSmrg		;;
850b3307321Smrg	op50n-* | op60c-*)
85174b97a6cSmrg		cpu=hppa1.1
85274b97a6cSmrg		vendor=oki
85374b97a6cSmrg		basic_os=proelf
854b3307321Smrg		;;
855b3307321Smrg	pa-hitachi)
85674b97a6cSmrg		cpu=hppa1.1
85774b97a6cSmrg		vendor=hitachi
85874b97a6cSmrg		basic_os=hiuxwe2
859afe13c8eSmrg		;;
860b3307321Smrg	pbd)
86174b97a6cSmrg		cpu=sparc
86274b97a6cSmrg		vendor=tti
863b3307321Smrg		;;
864b3307321Smrg	pbb)
86574b97a6cSmrg		cpu=m68k
86674b97a6cSmrg		vendor=tti
867afe13c8eSmrg		;;
86874b97a6cSmrg	pc532)
86974b97a6cSmrg		cpu=ns32k
87074b97a6cSmrg		vendor=pc532
871b3307321Smrg		;;
872b3307321Smrg	pn)
87374b97a6cSmrg		cpu=pn
87474b97a6cSmrg		vendor=gould
875b3307321Smrg		;;
87674b97a6cSmrg	power)
87774b97a6cSmrg		cpu=power
87874b97a6cSmrg		vendor=ibm
879b3307321Smrg		;;
88074b97a6cSmrg	ps2)
88174b97a6cSmrg		cpu=i386
88274b97a6cSmrg		vendor=ibm
883b3307321Smrg		;;
88474b97a6cSmrg	rm[46]00)
88574b97a6cSmrg		cpu=mips
88674b97a6cSmrg		vendor=siemens
887b3307321Smrg		;;
88874b97a6cSmrg	rtpc | rtpc-*)
88974b97a6cSmrg		cpu=romp
89074b97a6cSmrg		vendor=ibm
891b3307321Smrg		;;
89274b97a6cSmrg	sde)
89374b97a6cSmrg		cpu=mipsisa32
89474b97a6cSmrg		vendor=sde
89574b97a6cSmrg		basic_os=${basic_os:-elf}
896b3307321Smrg		;;
89774b97a6cSmrg	simso-wrs)
89874b97a6cSmrg		cpu=sparclite
89974b97a6cSmrg		vendor=wrs
90074b97a6cSmrg		basic_os=vxworks
901b3307321Smrg		;;
90274b97a6cSmrg	tower | tower-32)
90374b97a6cSmrg		cpu=m68k
90474b97a6cSmrg		vendor=ncr
905b3307321Smrg		;;
90674b97a6cSmrg	vpp*|vx|vx-*)
90774b97a6cSmrg		cpu=f301
90874b97a6cSmrg		vendor=fujitsu
90974a3f230Smrg		;;
91074b97a6cSmrg	w65)
91174b97a6cSmrg		cpu=w65
91274b97a6cSmrg		vendor=wdc
913afe13c8eSmrg		;;
91474b97a6cSmrg	w89k-*)
91574b97a6cSmrg		cpu=hppa1.1
91674b97a6cSmrg		vendor=winbond
91774b97a6cSmrg		basic_os=proelf
918b3307321Smrg		;;
91974b97a6cSmrg	none)
92074b97a6cSmrg		cpu=none
92174b97a6cSmrg		vendor=none
922b3307321Smrg		;;
92374b97a6cSmrg	leon|leon[3-9])
92474b97a6cSmrg		cpu=sparc
92574b97a6cSmrg		vendor=$basic_machine
926b3307321Smrg		;;
92774b97a6cSmrg	leon-*|leon[3-9]-*)
92874b97a6cSmrg		cpu=sparc
92974b97a6cSmrg		vendor=`echo "$basic_machine" | sed 's/-.*//'`
930afe13c8eSmrg		;;
93174b97a6cSmrg
93274b97a6cSmrg	*-*)
93374b97a6cSmrg		# shellcheck disable=SC2162
93474b97a6cSmrg		IFS="-" read cpu vendor <<EOF
93574b97a6cSmrg$basic_machine
93674b97a6cSmrgEOF
937afe13c8eSmrg		;;
93874b97a6cSmrg	# We use `pc' rather than `unknown'
93974b97a6cSmrg	# because (1) that's what they normally are, and
94074b97a6cSmrg	# (2) the word "unknown" tends to confuse beginning users.
94174b97a6cSmrg	i*86 | x86_64)
94274b97a6cSmrg		cpu=$basic_machine
94374b97a6cSmrg		vendor=pc
944b3307321Smrg		;;
94574b97a6cSmrg	# These rules are duplicated from below for sake of the special case above;
94674b97a6cSmrg	# i.e. things that normalized to x86 arches should also default to "pc"
94774b97a6cSmrg	pc98)
94874b97a6cSmrg		cpu=i386
94974b97a6cSmrg		vendor=pc
950b3307321Smrg		;;
95174b97a6cSmrg	x64 | amd64)
95274b97a6cSmrg		cpu=x86_64
95374b97a6cSmrg		vendor=pc
954b3307321Smrg		;;
95574b97a6cSmrg	# Recognize the basic CPU types without company name.
95674b97a6cSmrg	*)
95774b97a6cSmrg		cpu=$basic_machine
95874b97a6cSmrg		vendor=unknown
959afe13c8eSmrg		;;
96074b97a6cSmrgesac
96174b97a6cSmrg
96274b97a6cSmrgunset -v basic_machine
96374b97a6cSmrg
96474b97a6cSmrg# Decode basic machines in the full and proper CPU-Company form.
96574b97a6cSmrgcase $cpu-$vendor in
96674b97a6cSmrg	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
96774b97a6cSmrg	# some cases the only manufacturer, in others, it is the most popular.
96874b97a6cSmrg	craynv-unknown)
96974b97a6cSmrg		vendor=cray
97074b97a6cSmrg		basic_os=${basic_os:-unicosmp}
971b3307321Smrg		;;
97274b97a6cSmrg	c90-unknown | c90-cray)
97374b97a6cSmrg		vendor=cray
97474b97a6cSmrg		basic_os=${Basic_os:-unicos}
975b3307321Smrg		;;
97674b97a6cSmrg	fx80-unknown)
97774b97a6cSmrg		vendor=alliant
978afe13c8eSmrg		;;
97974b97a6cSmrg	romp-unknown)
98074b97a6cSmrg		vendor=ibm
981b3307321Smrg		;;
98274b97a6cSmrg	mmix-unknown)
98374b97a6cSmrg		vendor=knuth
984b3307321Smrg		;;
98574b97a6cSmrg	microblaze-unknown | microblazeel-unknown)
98674b97a6cSmrg		vendor=xilinx
987b3307321Smrg		;;
98874b97a6cSmrg	rs6000-unknown)
98974b97a6cSmrg		vendor=ibm
990b3307321Smrg		;;
99174b97a6cSmrg	vax-unknown)
99274b97a6cSmrg		vendor=dec
993b3307321Smrg		;;
99474b97a6cSmrg	pdp11-unknown)
99574b97a6cSmrg		vendor=dec
99674a3f230Smrg		;;
99774b97a6cSmrg	we32k-unknown)
99874b97a6cSmrg		vendor=att
999b3307321Smrg		;;
100074b97a6cSmrg	cydra-unknown)
100174b97a6cSmrg		vendor=cydrome
1002b3307321Smrg		;;
100374b97a6cSmrg	i370-ibm*)
100474b97a6cSmrg		vendor=ibm
1005b3307321Smrg		;;
100674b97a6cSmrg	orion-unknown)
100774b97a6cSmrg		vendor=highlevel
1008b3307321Smrg		;;
100974b97a6cSmrg	xps-unknown | xps100-unknown)
101074b97a6cSmrg		cpu=xps100
101174b97a6cSmrg		vendor=honeywell
1012b3307321Smrg		;;
101374b97a6cSmrg
101474b97a6cSmrg	# Here we normalize CPU types with a missing or matching vendor
101574b97a6cSmrg	dpx20-unknown | dpx20-bull)
101674b97a6cSmrg		cpu=rs6000
101774b97a6cSmrg		vendor=bull
101874b97a6cSmrg		basic_os=${basic_os:-bosx}
1019b3307321Smrg		;;
102074b97a6cSmrg
102174b97a6cSmrg	# Here we normalize CPU types irrespective of the vendor
102274b97a6cSmrg	amd64-*)
102374b97a6cSmrg		cpu=x86_64
1024b3307321Smrg		;;
102574b97a6cSmrg	blackfin-*)
102674b97a6cSmrg		cpu=bfin
102774b97a6cSmrg		basic_os=linux
1028b3307321Smrg		;;
102974b97a6cSmrg	c54x-*)
103074b97a6cSmrg		cpu=tic54x
1031b3307321Smrg		;;
103274b97a6cSmrg	c55x-*)
103374b97a6cSmrg		cpu=tic55x
1034b3307321Smrg		;;
103574b97a6cSmrg	c6x-*)
103674b97a6cSmrg		cpu=tic6x
1037b3307321Smrg		;;
103874b97a6cSmrg	e500v[12]-*)
103974b97a6cSmrg		cpu=powerpc
104074b97a6cSmrg		basic_os=${basic_os}"spe"
1041b3307321Smrg		;;
104274b97a6cSmrg	mips3*-*)
104374b97a6cSmrg		cpu=mips64
1044b3307321Smrg		;;
104574b97a6cSmrg	ms1-*)
104674b97a6cSmrg		cpu=mt
1047b3307321Smrg		;;
104874b97a6cSmrg	m68knommu-*)
104974b97a6cSmrg		cpu=m68k
105074b97a6cSmrg		basic_os=linux
1051b3307321Smrg		;;
105274b97a6cSmrg	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
105374b97a6cSmrg		cpu=s12z
1054afe13c8eSmrg		;;
105574b97a6cSmrg	openrisc-*)
105674b97a6cSmrg		cpu=or32
1057b3307321Smrg		;;
105874b97a6cSmrg	parisc-*)
105974b97a6cSmrg		cpu=hppa
106074b97a6cSmrg		basic_os=linux
1061b3307321Smrg		;;
106274b97a6cSmrg	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
106374b97a6cSmrg		cpu=i586
1064b3307321Smrg		;;
106574b97a6cSmrg	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
106674b97a6cSmrg		cpu=i686
1067b3307321Smrg		;;
106874b97a6cSmrg	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
106974b97a6cSmrg		cpu=i686
1070afe13c8eSmrg		;;
107174b97a6cSmrg	pentium4-*)
107274b97a6cSmrg		cpu=i786
1073b3307321Smrg		;;
107474b97a6cSmrg	pc98-*)
107574b97a6cSmrg		cpu=i386
1076b3307321Smrg		;;
107774b97a6cSmrg	ppc-* | ppcbe-*)
107874b97a6cSmrg		cpu=powerpc
1079b3307321Smrg		;;
108074b97a6cSmrg	ppcle-* | powerpclittle-*)
108174b97a6cSmrg		cpu=powerpcle
1082b3307321Smrg		;;
108374b97a6cSmrg	ppc64-*)
108474b97a6cSmrg		cpu=powerpc64
1085b3307321Smrg		;;
108674b97a6cSmrg	ppc64le-* | powerpc64little-*)
108774b97a6cSmrg		cpu=powerpc64le
1088b3307321Smrg		;;
108974b97a6cSmrg	sb1-*)
109074b97a6cSmrg		cpu=mipsisa64sb1
1091b3307321Smrg		;;
109274b97a6cSmrg	sb1el-*)
109374b97a6cSmrg		cpu=mipsisa64sb1el
1094b3307321Smrg		;;
109574b97a6cSmrg	sh5e[lb]-*)
109674b97a6cSmrg		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1097b3307321Smrg		;;
109874b97a6cSmrg	spur-*)
109974b97a6cSmrg		cpu=spur
1100b3307321Smrg		;;
110174b97a6cSmrg	strongarm-* | thumb-*)
110274b97a6cSmrg		cpu=arm
1103b3307321Smrg		;;
110474b97a6cSmrg	tx39-*)
110574b97a6cSmrg		cpu=mipstx39
110606ef0fecSmrg		;;
110774b97a6cSmrg	tx39el-*)
110874b97a6cSmrg		cpu=mipstx39el
1109afe13c8eSmrg		;;
111074b97a6cSmrg	x64-*)
111174b97a6cSmrg		cpu=x86_64
1112b3307321Smrg		;;
111374a3f230Smrg	xscale-* | xscalee[bl]-*)
111474b97a6cSmrg		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
111574a3f230Smrg		;;
111674b97a6cSmrg	arm64-*)
111774b97a6cSmrg		cpu=aarch64
1118b3307321Smrg		;;
1119b3307321Smrg
112074b97a6cSmrg	# Recognize the canonical CPU Types that limit and/or modify the
112174b97a6cSmrg	# company names they are paired with.
112274b97a6cSmrg	cr16-*)
112374b97a6cSmrg		basic_os=${basic_os:-elf}
1124b3307321Smrg		;;
112574b97a6cSmrg	crisv32-* | etraxfs*-*)
112674b97a6cSmrg		cpu=crisv32
112774b97a6cSmrg		vendor=axis
1128afe13c8eSmrg		;;
112974b97a6cSmrg	cris-* | etrax*-*)
113074b97a6cSmrg		cpu=cris
113174b97a6cSmrg		vendor=axis
1132b3307321Smrg		;;
113374b97a6cSmrg	crx-*)
113474b97a6cSmrg		basic_os=${basic_os:-elf}
1135b3307321Smrg		;;
113674b97a6cSmrg	neo-tandem)
113774b97a6cSmrg		cpu=neo
113874b97a6cSmrg		vendor=tandem
1139b3307321Smrg		;;
114074b97a6cSmrg	nse-tandem)
114174b97a6cSmrg		cpu=nse
114274b97a6cSmrg		vendor=tandem
1143b3307321Smrg		;;
114474b97a6cSmrg	nsr-tandem)
114574b97a6cSmrg		cpu=nsr
114674b97a6cSmrg		vendor=tandem
1147b3307321Smrg		;;
114874b97a6cSmrg	nsv-tandem)
114974b97a6cSmrg		cpu=nsv
115074b97a6cSmrg		vendor=tandem
1151b3307321Smrg		;;
115274b97a6cSmrg	nsx-tandem)
115374b97a6cSmrg		cpu=nsx
115474b97a6cSmrg		vendor=tandem
1155b3307321Smrg		;;
115674b97a6cSmrg	mipsallegrexel-sony)
115774b97a6cSmrg		cpu=mipsallegrexel
115874b97a6cSmrg		vendor=sony
1159b3307321Smrg		;;
116074b97a6cSmrg	tile*-*)
116174b97a6cSmrg		basic_os=${basic_os:-linux-gnu}
1162b3307321Smrg		;;
116374b97a6cSmrg
1164b3307321Smrg	*)
116574b97a6cSmrg		# Recognize the canonical CPU types that are allowed with any
116674b97a6cSmrg		# company name.
116774b97a6cSmrg		case $cpu in
116874b97a6cSmrg			1750a | 580 \
116974b97a6cSmrg			| a29k \
117074b97a6cSmrg			| aarch64 | aarch64_be \
117174b97a6cSmrg			| abacus \
117274b97a6cSmrg			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
117374b97a6cSmrg			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
117474b97a6cSmrg			| alphapca5[67] | alpha64pca5[67] \
117574b97a6cSmrg			| am33_2.0 \
117674b97a6cSmrg			| amdgcn \
117774b97a6cSmrg			| arc | arceb | arc32 | arc64 \
117874b97a6cSmrg			| arm | arm[lb]e | arme[lb] | armv* \
117974b97a6cSmrg			| avr | avr32 \
118074b97a6cSmrg			| asmjs \
118174b97a6cSmrg			| ba \
118274b97a6cSmrg			| be32 | be64 \
118374b97a6cSmrg			| bfin | bpf | bs2000 \
118474b97a6cSmrg			| c[123]* | c30 | [cjt]90 | c4x \
118574b97a6cSmrg			| c8051 | clipper | craynv | csky | cydra \
118674b97a6cSmrg			| d10v | d30v | dlx | dsp16xx \
118774b97a6cSmrg			| e2k | elxsi | epiphany \
118874b97a6cSmrg			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
118974b97a6cSmrg			| h8300 | h8500 \
119074b97a6cSmrg			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
119174b97a6cSmrg			| hexagon \
119274b97a6cSmrg			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
119374b97a6cSmrg			| ip2k | iq2000 \
119474b97a6cSmrg			| k1om \
119574b97a6cSmrg			| le32 | le64 \
119674b97a6cSmrg			| lm32 \
119774b97a6cSmrg			| loongarch32 | loongarch64 | loongarchx32 \
119874b97a6cSmrg			| m32c | m32r | m32rle \
119974b97a6cSmrg			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
120074b97a6cSmrg			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
120174b97a6cSmrg			| m88110 | m88k | maxq | mb | mcore | mep | metag \
120274b97a6cSmrg			| microblaze | microblazeel \
120374b97a6cSmrg			| mips | mipsbe | mipseb | mipsel | mipsle \
120474b97a6cSmrg			| mips16 \
120574b97a6cSmrg			| mips64 | mips64eb | mips64el \
120674b97a6cSmrg			| mips64octeon | mips64octeonel \
120774b97a6cSmrg			| mips64orion | mips64orionel \
120874b97a6cSmrg			| mips64r5900 | mips64r5900el \
120974b97a6cSmrg			| mips64vr | mips64vrel \
121074b97a6cSmrg			| mips64vr4100 | mips64vr4100el \
121174b97a6cSmrg			| mips64vr4300 | mips64vr4300el \
121274b97a6cSmrg			| mips64vr5000 | mips64vr5000el \
121374b97a6cSmrg			| mips64vr5900 | mips64vr5900el \
121474b97a6cSmrg			| mipsisa32 | mipsisa32el \
121574b97a6cSmrg			| mipsisa32r2 | mipsisa32r2el \
121674b97a6cSmrg			| mipsisa32r3 | mipsisa32r3el \
121774b97a6cSmrg			| mipsisa32r5 | mipsisa32r5el \
121874b97a6cSmrg			| mipsisa32r6 | mipsisa32r6el \
121974b97a6cSmrg			| mipsisa64 | mipsisa64el \
122074b97a6cSmrg			| mipsisa64r2 | mipsisa64r2el \
122174b97a6cSmrg			| mipsisa64r3 | mipsisa64r3el \
122274b97a6cSmrg			| mipsisa64r5 | mipsisa64r5el \
122374b97a6cSmrg			| mipsisa64r6 | mipsisa64r6el \
122474b97a6cSmrg			| mipsisa64sb1 | mipsisa64sb1el \
122574b97a6cSmrg			| mipsisa64sr71k | mipsisa64sr71kel \
122674b97a6cSmrg			| mipsr5900 | mipsr5900el \
122774b97a6cSmrg			| mipstx39 | mipstx39el \
122874b97a6cSmrg			| mmix \
122974b97a6cSmrg			| mn10200 | mn10300 \
123074b97a6cSmrg			| moxie \
123174b97a6cSmrg			| mt \
123274b97a6cSmrg			| msp430 \
123374b97a6cSmrg			| nds32 | nds32le | nds32be \
123474b97a6cSmrg			| nfp \
123574b97a6cSmrg			| nios | nios2 | nios2eb | nios2el \
123674b97a6cSmrg			| none | np1 | ns16k | ns32k | nvptx \
123774b97a6cSmrg			| open8 \
123874b97a6cSmrg			| or1k* \
123974b97a6cSmrg			| or32 \
124074b97a6cSmrg			| orion \
124174b97a6cSmrg			| picochip \
124274b97a6cSmrg			| pdp10 | pdp11 | pj | pjl | pn | power \
124374b97a6cSmrg			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
124474b97a6cSmrg			| pru \
124574b97a6cSmrg			| pyramid \
124674b97a6cSmrg			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
124774b97a6cSmrg			| rl78 | romp | rs6000 | rx \
124874b97a6cSmrg			| s390 | s390x \
124974b97a6cSmrg			| score \
125074b97a6cSmrg			| sh | shl \
125174b97a6cSmrg			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
125274b97a6cSmrg			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
125374b97a6cSmrg			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
125474b97a6cSmrg			| sparclite \
125574b97a6cSmrg			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
125674b97a6cSmrg			| spu \
125774b97a6cSmrg			| tahoe \
125874b97a6cSmrg			| thumbv7* \
125974b97a6cSmrg			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
126074b97a6cSmrg			| tron \
126174b97a6cSmrg			| ubicom32 \
126274b97a6cSmrg			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
126374b97a6cSmrg			| vax \
126474b97a6cSmrg			| visium \
126574b97a6cSmrg			| w65 \
126674b97a6cSmrg			| wasm32 | wasm64 \
126774b97a6cSmrg			| we32k \
126874b97a6cSmrg			| x86 | x86_64 | xc16x | xgate | xps100 \
126974b97a6cSmrg			| xstormy16 | xtensa* \
127074b97a6cSmrg			| ymp \
127174b97a6cSmrg			| z8k | z80)
127274b97a6cSmrg				;;
127374b97a6cSmrg
127474b97a6cSmrg			*)
127574b97a6cSmrg				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
127674b97a6cSmrg				exit 1
127774b97a6cSmrg				;;
127874b97a6cSmrg		esac
1279b3307321Smrg		;;
1280b3307321Smrgesac
1281b3307321Smrg
1282b3307321Smrg# Here we canonicalize certain aliases for manufacturers.
128374b97a6cSmrgcase $vendor in
128474b97a6cSmrg	digital*)
128574b97a6cSmrg		vendor=dec
1286b3307321Smrg		;;
128774b97a6cSmrg	commodore*)
128874b97a6cSmrg		vendor=cbm
1289b3307321Smrg		;;
1290b3307321Smrg	*)
1291b3307321Smrg		;;
1292b3307321Smrgesac
1293b3307321Smrg
1294b3307321Smrg# Decode manufacturer-specific aliases for certain operating systems.
1295b3307321Smrg
129674b97a6cSmrgif test x$basic_os != x
1297b3307321Smrgthen
129874b97a6cSmrg
129974b97a6cSmrg# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
130074b97a6cSmrg# set os.
130174b97a6cSmrgcase $basic_os in
130274b97a6cSmrg	gnu/linux*)
130374b97a6cSmrg		kernel=linux
130474b97a6cSmrg		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
130574b97a6cSmrg		;;
130674b97a6cSmrg	os2-emx)
130774b97a6cSmrg		kernel=os2
130874b97a6cSmrg		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
130974b97a6cSmrg		;;
131074b97a6cSmrg	nto-qnx*)
131174b97a6cSmrg		kernel=nto
131274b97a6cSmrg		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
131374b97a6cSmrg		;;
131474b97a6cSmrg	*-*)
131574b97a6cSmrg		# shellcheck disable=SC2162
131674b97a6cSmrg		IFS="-" read kernel os <<EOF
131774b97a6cSmrg$basic_os
131874b97a6cSmrgEOF
131974b97a6cSmrg		;;
132074b97a6cSmrg	# Default OS when just kernel was specified
132174b97a6cSmrg	nto*)
132274b97a6cSmrg		kernel=nto
132374b97a6cSmrg		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
132474b97a6cSmrg		;;
132574b97a6cSmrg	linux*)
132674b97a6cSmrg		kernel=linux
132774b97a6cSmrg		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
132874b97a6cSmrg		;;
132974b97a6cSmrg	*)
133074b97a6cSmrg		kernel=
133174b97a6cSmrg		os=$basic_os
133274b97a6cSmrg		;;
133374b97a6cSmrgesac
133474b97a6cSmrg
133574b97a6cSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel,
133674b97a6cSmrg# etc.)
1337b3307321Smrgcase $os in
133806ef0fecSmrg	# First match some system type aliases that might get confused
133906ef0fecSmrg	# with valid system types.
134074b97a6cSmrg	# solaris* is a basic system type, with this one exception.
134174b97a6cSmrg	auroraux)
134274b97a6cSmrg		os=auroraux
134329cb5710Smrg		;;
134474b97a6cSmrg	bluegene*)
134574b97a6cSmrg		os=cnk
1346b3307321Smrg		;;
134774b97a6cSmrg	solaris1 | solaris1.*)
134874b97a6cSmrg		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1349b3307321Smrg		;;
135074b97a6cSmrg	solaris)
135174b97a6cSmrg		os=solaris2
1352b3307321Smrg		;;
135374b97a6cSmrg	unixware*)
135474b97a6cSmrg		os=sysv4.2uw
1355b3307321Smrg		;;
135606ef0fecSmrg	# es1800 is here to avoid being matched by es* (a different OS)
135774b97a6cSmrg	es1800*)
135874b97a6cSmrg		os=ose
135906ef0fecSmrg		;;
136074b97a6cSmrg	# Some version numbers need modification
136174b97a6cSmrg	chorusos*)
136274b97a6cSmrg		os=chorusos
1363b3307321Smrg		;;
136474b97a6cSmrg	isc)
136574b97a6cSmrg		os=isc2.2
1366b3307321Smrg		;;
136774b97a6cSmrg	sco6)
136874b97a6cSmrg		os=sco5v6
1369b3307321Smrg		;;
137074b97a6cSmrg	sco5)
137174b97a6cSmrg		os=sco3.2v5
1372b3307321Smrg		;;
137374b97a6cSmrg	sco4)
137474b97a6cSmrg		os=sco3.2v4
1375b3307321Smrg		;;
137674b97a6cSmrg	sco3.2.[4-9]*)
137774b97a6cSmrg		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
1378afe13c8eSmrg		;;
137974b97a6cSmrg	sco*v* | scout)
138074b97a6cSmrg		# Don't match below
1381b3307321Smrg		;;
138274b97a6cSmrg	sco*)
138374b97a6cSmrg		os=sco3.2v2
1384b3307321Smrg		;;
138574b97a6cSmrg	psos*)
138674b97a6cSmrg		os=psos
1387b3307321Smrg		;;
138874b97a6cSmrg	qnx*)
138974b97a6cSmrg		os=qnx
1390b3307321Smrg		;;
139174b97a6cSmrg	hiux*)
139274b97a6cSmrg		os=hiuxwe2
1393afe13c8eSmrg		;;
139474b97a6cSmrg	lynx*178)
139574b97a6cSmrg		os=lynxos178
1396b3307321Smrg		;;
139774b97a6cSmrg	lynx*5)
139874b97a6cSmrg		os=lynxos5
1399b3307321Smrg		;;
140074b97a6cSmrg	lynxos*)
140174b97a6cSmrg		# don't get caught up in next wildcard
1402b3307321Smrg		;;
140374b97a6cSmrg	lynx*)
140474b97a6cSmrg		os=lynxos
1405b3307321Smrg		;;
140674b97a6cSmrg	mac[0-9]*)
140774b97a6cSmrg		os=`echo "$os" | sed -e 's|mac|macos|'`
1408b3307321Smrg		;;
140974b97a6cSmrg	opened*)
141074b97a6cSmrg		os=openedition
1411afe13c8eSmrg		;;
141274b97a6cSmrg	os400*)
141374b97a6cSmrg		os=os400
1414b3307321Smrg		;;
141574b97a6cSmrg	sunos5*)
141674b97a6cSmrg		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1417b3307321Smrg		;;
141874b97a6cSmrg	sunos6*)
141974b97a6cSmrg		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1420b3307321Smrg		;;
142174b97a6cSmrg	wince*)
142274b97a6cSmrg		os=wince
1423b3307321Smrg		;;
142474b97a6cSmrg	utek*)
142574b97a6cSmrg		os=bsd
1426b3307321Smrg		;;
142774b97a6cSmrg	dynix*)
142874b97a6cSmrg		os=bsd
1429b3307321Smrg		;;
143074b97a6cSmrg	acis*)
143174b97a6cSmrg		os=aos
1432b3307321Smrg		;;
143374b97a6cSmrg	atheos*)
143474b97a6cSmrg		os=atheos
1435afe13c8eSmrg		;;
143674b97a6cSmrg	syllable*)
143774b97a6cSmrg		os=syllable
1438b3307321Smrg		;;
143974b97a6cSmrg	386bsd)
144074b97a6cSmrg		os=bsd
1441b3307321Smrg		;;
144274b97a6cSmrg	ctix* | uts*)
144374b97a6cSmrg		os=sysv
1444b3307321Smrg		;;
144574b97a6cSmrg	nova*)
144674b97a6cSmrg		os=rtmk-nova
1447b3307321Smrg		;;
144874b97a6cSmrg	ns2)
144974b97a6cSmrg		os=nextstep2
1450b3307321Smrg		;;
145174b97a6cSmrg	# Preserve the version number of sinix5.
145274b97a6cSmrg	sinix5.*)
145374b97a6cSmrg		os=`echo "$os" | sed -e 's|sinix|sysv|'`
1454b3307321Smrg		;;
145574b97a6cSmrg	sinix*)
145674b97a6cSmrg		os=sysv4
1457b3307321Smrg		;;
145874b97a6cSmrg	tpf*)
145974b97a6cSmrg		os=tpf
1460b3307321Smrg		;;
146174b97a6cSmrg	triton*)
146274b97a6cSmrg		os=sysv3
1463afe13c8eSmrg		;;
146474b97a6cSmrg	oss*)
146574b97a6cSmrg		os=sysv3
14665e358ecaSmrg		;;
146774b97a6cSmrg	svr4*)
146874b97a6cSmrg		os=sysv4
146974b97a6cSmrg		;;
147074b97a6cSmrg	svr3)
147174b97a6cSmrg		os=sysv3
147274b97a6cSmrg		;;
147374b97a6cSmrg	sysvr4)
147474b97a6cSmrg		os=sysv4
147574b97a6cSmrg		;;
147674b97a6cSmrg	ose*)
147774b97a6cSmrg		os=ose
147874b97a6cSmrg		;;
147974b97a6cSmrg	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
148074b97a6cSmrg		os=mint
148174b97a6cSmrg		;;
148274b97a6cSmrg	dicos*)
148374b97a6cSmrg		os=dicos
148474b97a6cSmrg		;;
148574b97a6cSmrg	pikeos*)
148606ef0fecSmrg		# Until real need of OS specific support for
148706ef0fecSmrg		# particular features comes up, bare metal
148806ef0fecSmrg		# configurations are quite functional.
148974b97a6cSmrg		case $cpu in
149006ef0fecSmrg		    arm*)
149174b97a6cSmrg			os=eabi
149206ef0fecSmrg			;;
149306ef0fecSmrg		    *)
149474b97a6cSmrg			os=elf
149506ef0fecSmrg			;;
149606ef0fecSmrg		esac
149706ef0fecSmrg		;;
1498b3307321Smrg	*)
149974b97a6cSmrg		# No normalization, but not necessarily accepted, that comes below.
1500b3307321Smrg		;;
1501b3307321Smrgesac
150274b97a6cSmrg
1503b3307321Smrgelse
1504b3307321Smrg
1505b3307321Smrg# Here we handle the default operating systems that come with various machines.
1506b3307321Smrg# The value should be what the vendor currently ships out the door with their
1507b3307321Smrg# machine or put another way, the most popular os provided with the machine.
1508b3307321Smrg
1509b3307321Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say,
1510b3307321Smrg# "-sun"), then you have to tell the case statement up towards the top
1511b3307321Smrg# that MANUFACTURER isn't an operating system.  Otherwise, code above
1512b3307321Smrg# will signal an error saying that MANUFACTURER isn't an operating
1513b3307321Smrg# system, and we'll never get to this point.
1514b3307321Smrg
151574b97a6cSmrgkernel=
151674b97a6cSmrgcase $cpu-$vendor in
151774a3f230Smrg	score-*)
151874b97a6cSmrg		os=elf
1519afe13c8eSmrg		;;
152074a3f230Smrg	spu-*)
152174b97a6cSmrg		os=elf
1522afe13c8eSmrg		;;
1523b3307321Smrg	*-acorn)
152474b97a6cSmrg		os=riscix1.2
1525b3307321Smrg		;;
1526b3307321Smrg	arm*-rebel)
152774b97a6cSmrg		kernel=linux
152874b97a6cSmrg		os=gnu
1529b3307321Smrg		;;
1530b3307321Smrg	arm*-semi)
153174b97a6cSmrg		os=aout
1532b3307321Smrg		;;
153374a3f230Smrg	c4x-* | tic4x-*)
153474b97a6cSmrg		os=coff
153574a3f230Smrg		;;
153606ef0fecSmrg	c8051-*)
153774b97a6cSmrg		os=elf
153874b97a6cSmrg		;;
153974b97a6cSmrg	clipper-intergraph)
154074b97a6cSmrg		os=clix
154106ef0fecSmrg		;;
154274a3f230Smrg	hexagon-*)
154374b97a6cSmrg		os=elf
1544b3307321Smrg		;;
154529cb5710Smrg	tic54x-*)
154674b97a6cSmrg		os=coff
154729cb5710Smrg		;;
154829cb5710Smrg	tic55x-*)
154974b97a6cSmrg		os=coff
155029cb5710Smrg		;;
155129cb5710Smrg	tic6x-*)
155274b97a6cSmrg		os=coff
155329cb5710Smrg		;;
1554b3307321Smrg	# This must come before the *-dec entry.
1555b3307321Smrg	pdp10-*)
155674b97a6cSmrg		os=tops20
1557b3307321Smrg		;;
1558b3307321Smrg	pdp11-*)
155974b97a6cSmrg		os=none
1560b3307321Smrg		;;
1561b3307321Smrg	*-dec | vax-*)
156274b97a6cSmrg		os=ultrix4.2
1563b3307321Smrg		;;
1564b3307321Smrg	m68*-apollo)
156574b97a6cSmrg		os=domain
1566b3307321Smrg		;;
1567b3307321Smrg	i386-sun)
156874b97a6cSmrg		os=sunos4.0.2
1569b3307321Smrg		;;
1570b3307321Smrg	m68000-sun)
157174b97a6cSmrg		os=sunos3
1572b3307321Smrg		;;
1573b3307321Smrg	m68*-cisco)
157474b97a6cSmrg		os=aout
1575b3307321Smrg		;;
157674a3f230Smrg	mep-*)
157774b97a6cSmrg		os=elf
1578afe13c8eSmrg		;;
1579b3307321Smrg	mips*-cisco)
158074b97a6cSmrg		os=elf
1581b3307321Smrg		;;
1582b3307321Smrg	mips*-*)
158374b97a6cSmrg		os=elf
1584b3307321Smrg		;;
1585b3307321Smrg	or32-*)
158674b97a6cSmrg		os=coff
1587b3307321Smrg		;;
1588b3307321Smrg	*-tti)	# must be before sparc entry or we get the wrong os.
158974b97a6cSmrg		os=sysv3
1590b3307321Smrg		;;
1591b3307321Smrg	sparc-* | *-sun)
159274b97a6cSmrg		os=sunos4.1.1
1593b3307321Smrg		;;
159406ef0fecSmrg	pru-*)
159574b97a6cSmrg		os=elf
159606ef0fecSmrg		;;
1597b3307321Smrg	*-be)
159874b97a6cSmrg		os=beos
1599b3307321Smrg		;;
1600b3307321Smrg	*-ibm)
160174b97a6cSmrg		os=aix
1602b3307321Smrg		;;
160374a3f230Smrg	*-knuth)
160474b97a6cSmrg		os=mmixware
1605afe13c8eSmrg		;;
1606b3307321Smrg	*-wec)
160774b97a6cSmrg		os=proelf
1608b3307321Smrg		;;
1609b3307321Smrg	*-winbond)
161074b97a6cSmrg		os=proelf
1611b3307321Smrg		;;
1612b3307321Smrg	*-oki)
161374b97a6cSmrg		os=proelf
1614b3307321Smrg		;;
1615b3307321Smrg	*-hp)
161674b97a6cSmrg		os=hpux
1617b3307321Smrg		;;
1618b3307321Smrg	*-hitachi)
161974b97a6cSmrg		os=hiux
1620b3307321Smrg		;;
1621b3307321Smrg	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
162274b97a6cSmrg		os=sysv
1623b3307321Smrg		;;
1624b3307321Smrg	*-cbm)
162574b97a6cSmrg		os=amigaos
1626b3307321Smrg		;;
1627b3307321Smrg	*-dg)
162874b97a6cSmrg		os=dgux
1629b3307321Smrg		;;
1630b3307321Smrg	*-dolphin)
163174b97a6cSmrg		os=sysv3
1632b3307321Smrg		;;
1633b3307321Smrg	m68k-ccur)
163474b97a6cSmrg		os=rtu
1635b3307321Smrg		;;
1636b3307321Smrg	m88k-omron*)
163774b97a6cSmrg		os=luna
1638b3307321Smrg		;;
163906ef0fecSmrg	*-next)
164074b97a6cSmrg		os=nextstep
1641b3307321Smrg		;;
1642b3307321Smrg	*-sequent)
164374b97a6cSmrg		os=ptx
1644b3307321Smrg		;;
1645b3307321Smrg	*-crds)
164674b97a6cSmrg		os=unos
1647b3307321Smrg		;;
1648b3307321Smrg	*-ns)
164974b97a6cSmrg		os=genix
1650b3307321Smrg		;;
1651b3307321Smrg	i370-*)
165274b97a6cSmrg		os=mvs
1653b3307321Smrg		;;
1654b3307321Smrg	*-gould)
165574b97a6cSmrg		os=sysv
1656b3307321Smrg		;;
1657b3307321Smrg	*-highlevel)
165874b97a6cSmrg		os=bsd
1659b3307321Smrg		;;
1660b3307321Smrg	*-encore)
166174b97a6cSmrg		os=bsd
1662b3307321Smrg		;;
1663b3307321Smrg	*-sgi)
166474b97a6cSmrg		os=irix
1665b3307321Smrg		;;
1666b3307321Smrg	*-siemens)
166774b97a6cSmrg		os=sysv4
1668b3307321Smrg		;;
1669b3307321Smrg	*-masscomp)
167074b97a6cSmrg		os=rtu
1671b3307321Smrg		;;
1672b3307321Smrg	f30[01]-fujitsu | f700-fujitsu)
167374b97a6cSmrg		os=uxpv
1674b3307321Smrg		;;
1675b3307321Smrg	*-rom68k)
167674b97a6cSmrg		os=coff
1677b3307321Smrg		;;
1678b3307321Smrg	*-*bug)
167974b97a6cSmrg		os=coff
1680b3307321Smrg		;;
1681b3307321Smrg	*-apple)
168274b97a6cSmrg		os=macos
1683b3307321Smrg		;;
1684b3307321Smrg	*-atari*)
168574b97a6cSmrg		os=mint
168674b97a6cSmrg		;;
168774b97a6cSmrg	*-wrs)
168874b97a6cSmrg		os=vxworks
1689b3307321Smrg		;;
1690b3307321Smrg	*)
169174b97a6cSmrg		os=none
1692b3307321Smrg		;;
1693b3307321Smrgesac
169474b97a6cSmrg
1695b3307321Smrgfi
1696b3307321Smrg
169774b97a6cSmrg# Now, validate our (potentially fixed-up) OS.
169874b97a6cSmrgcase $os in
169974b97a6cSmrg	# Sometimes we do "kernel-libc", so those need to count as OSes.
170074b97a6cSmrg	musl* | newlib* | uclibc*)
170174b97a6cSmrg		;;
170274b97a6cSmrg	# Likewise for "kernel-abi"
170374b97a6cSmrg	eabi* | gnueabi*)
170474b97a6cSmrg		;;
170574b97a6cSmrg	# VxWorks passes extra cpu info in the 4th filed.
170674b97a6cSmrg	simlinux | simwindows | spe)
170774b97a6cSmrg		;;
170874b97a6cSmrg	# Now accept the basic system types.
170974b97a6cSmrg	# The portable systems comes first.
171074b97a6cSmrg	# Each alternative MUST end in a * to match a version number.
171174b97a6cSmrg	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
171274b97a6cSmrg	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
171374b97a6cSmrg	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
171474b97a6cSmrg	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
171574b97a6cSmrg	     | hiux* | abug | nacl* | netware* | windows* \
171674b97a6cSmrg	     | os9* | macos* | osx* | ios* \
171774b97a6cSmrg	     | mpw* | magic* | mmixware* | mon960* | lnews* \
171874b97a6cSmrg	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
171974b97a6cSmrg	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
172074b97a6cSmrg	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
172174b97a6cSmrg	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
172274b97a6cSmrg	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
172374b97a6cSmrg	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
172474b97a6cSmrg	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
172574b97a6cSmrg	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
172674b97a6cSmrg	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
172774b97a6cSmrg	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
172874b97a6cSmrg	     | chorusrdb* | cegcc* | glidix* | serenity* \
172974b97a6cSmrg	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
173074b97a6cSmrg	     | midipix* | mingw32* | mingw64* | mint* \
173174b97a6cSmrg	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
173274b97a6cSmrg	     | interix* | uwin* | mks* | rhapsody* | darwin* \
173374b97a6cSmrg	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
173474b97a6cSmrg	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
173574b97a6cSmrg	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
173674b97a6cSmrg	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
173774b97a6cSmrg	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
173874b97a6cSmrg	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
173974b97a6cSmrg	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
174074b97a6cSmrg	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
174174b97a6cSmrg	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
174274b97a6cSmrg		;;
174374b97a6cSmrg	# This one is extra strict with allowed versions
174474b97a6cSmrg	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
174574b97a6cSmrg		# Don't forget version if it is 3.2v4 or newer.
174674b97a6cSmrg		;;
174774b97a6cSmrg	none)
174874b97a6cSmrg		;;
174974b97a6cSmrg	*)
175074b97a6cSmrg		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
175174b97a6cSmrg		exit 1
175274b97a6cSmrg		;;
175374b97a6cSmrgesac
175474b97a6cSmrg
175574b97a6cSmrg# As a final step for OS-related things, validate the OS-kernel combination
175674b97a6cSmrg# (given a valid OS), if there is a kernel.
175774b97a6cSmrgcase $kernel-$os in
175874b97a6cSmrg	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
175974b97a6cSmrg		;;
176074b97a6cSmrg	uclinux-uclibc* )
176174b97a6cSmrg		;;
176274b97a6cSmrg	-dietlibc* | -newlib* | -musl* | -uclibc* )
176374b97a6cSmrg		# These are just libc implementations, not actual OSes, and thus
176474b97a6cSmrg		# require a kernel.
176574b97a6cSmrg		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
176674b97a6cSmrg		exit 1
176774b97a6cSmrg		;;
176874b97a6cSmrg	kfreebsd*-gnu* | kopensolaris*-gnu*)
176974b97a6cSmrg		;;
177074b97a6cSmrg	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
177174b97a6cSmrg		;;
177274b97a6cSmrg	nto-qnx*)
177374b97a6cSmrg		;;
177474b97a6cSmrg	os2-emx)
177574b97a6cSmrg		;;
177674b97a6cSmrg	*-eabi* | *-gnueabi*)
177774b97a6cSmrg		;;
177874b97a6cSmrg	-*)
177974b97a6cSmrg		# Blank kernel with real OS is always fine.
178074b97a6cSmrg		;;
178174b97a6cSmrg	*-*)
178274b97a6cSmrg		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
178374b97a6cSmrg		exit 1
178474b97a6cSmrg		;;
178574b97a6cSmrgesac
178674b97a6cSmrg
1787b3307321Smrg# Here we handle the case where we know the os, and the CPU type, but not the
1788b3307321Smrg# manufacturer.  We pick the logical manufacturer.
178974b97a6cSmrgcase $vendor in
179074b97a6cSmrg	unknown)
179174b97a6cSmrg		case $cpu-$os in
179274b97a6cSmrg			*-riscix*)
1793b3307321Smrg				vendor=acorn
1794b3307321Smrg				;;
179574b97a6cSmrg			*-sunos*)
1796b3307321Smrg				vendor=sun
1797b3307321Smrg				;;
179874b97a6cSmrg			*-cnk* | *-aix*)
1799b3307321Smrg				vendor=ibm
1800b3307321Smrg				;;
180174b97a6cSmrg			*-beos*)
1802b3307321Smrg				vendor=be
1803b3307321Smrg				;;
180474b97a6cSmrg			*-hpux*)
1805b3307321Smrg				vendor=hp
1806b3307321Smrg				;;
180774b97a6cSmrg			*-mpeix*)
1808b3307321Smrg				vendor=hp
1809b3307321Smrg				;;
181074b97a6cSmrg			*-hiux*)
1811b3307321Smrg				vendor=hitachi
1812b3307321Smrg				;;
181374b97a6cSmrg			*-unos*)
1814b3307321Smrg				vendor=crds
1815b3307321Smrg				;;
181674b97a6cSmrg			*-dgux*)
1817b3307321Smrg				vendor=dg
1818b3307321Smrg				;;
181974b97a6cSmrg			*-luna*)
1820b3307321Smrg				vendor=omron
1821b3307321Smrg				;;
182274b97a6cSmrg			*-genix*)
1823b3307321Smrg				vendor=ns
1824b3307321Smrg				;;
182574b97a6cSmrg			*-clix*)
182674b97a6cSmrg				vendor=intergraph
182774b97a6cSmrg				;;
182874b97a6cSmrg			*-mvs* | *-opened*)
182974b97a6cSmrg				vendor=ibm
183074b97a6cSmrg				;;
183174b97a6cSmrg			*-os400*)
1832b3307321Smrg				vendor=ibm
1833b3307321Smrg				;;
183474b97a6cSmrg			s390-* | s390x-*)
1835afe13c8eSmrg				vendor=ibm
1836afe13c8eSmrg				;;
183774b97a6cSmrg			*-ptx*)
1838b3307321Smrg				vendor=sequent
1839b3307321Smrg				;;
184074b97a6cSmrg			*-tpf*)
1841afe13c8eSmrg				vendor=ibm
1842afe13c8eSmrg				;;
184374b97a6cSmrg			*-vxsim* | *-vxworks* | *-windiss*)
1844b3307321Smrg				vendor=wrs
1845b3307321Smrg				;;
184674b97a6cSmrg			*-aux*)
1847b3307321Smrg				vendor=apple
1848b3307321Smrg				;;
184974b97a6cSmrg			*-hms*)
1850b3307321Smrg				vendor=hitachi
1851b3307321Smrg				;;
185274b97a6cSmrg			*-mpw* | *-macos*)
1853b3307321Smrg				vendor=apple
1854b3307321Smrg				;;
185574b97a6cSmrg			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1856b3307321Smrg				vendor=atari
1857b3307321Smrg				;;
185874b97a6cSmrg			*-vos*)
1859b3307321Smrg				vendor=stratus
1860b3307321Smrg				;;
1861b3307321Smrg		esac
1862b3307321Smrg		;;
1863b3307321Smrgesac
1864b3307321Smrg
186574b97a6cSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os"
1866afe13c8eSmrgexit
1867b3307321Smrg
1868b3307321Smrg# Local variables:
186974b97a6cSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
1870b3307321Smrg# time-stamp-start: "timestamp='"
1871b3307321Smrg# time-stamp-format: "%:y-%02m-%02d"
1872b3307321Smrg# time-stamp-end: "'"
1873b3307321Smrg# End:
1874