config.sub revision 14bc0770
1e9554658Smrg#! /bin/sh
2e9554658Smrg# Configuration validation subroutine script.
314bc0770Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4e9554658Smrg
514bc0770Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
614bc0770Smrg
714bc0770Smrgtimestamp='2021-08-14'
8e9554658Smrg
95dd5f640Smrg# This file is free software; you can redistribute it and/or modify it
105dd5f640Smrg# under the terms of the GNU General Public License as published by
115dd5f640Smrg# the Free Software Foundation; either version 3 of the License, or
12e9554658Smrg# (at your option) any later version.
13e9554658Smrg#
145dd5f640Smrg# This program is distributed in the hope that it will be useful, but
155dd5f640Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
165dd5f640Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
175dd5f640Smrg# General Public License for more details.
18e9554658Smrg#
19e9554658Smrg# You should have received a copy of the GNU General Public License
20688b3aecSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21e9554658Smrg#
22e9554658Smrg# As a special exception to the GNU General Public License, if you
23e9554658Smrg# distribute this file as part of a program that contains a
24e9554658Smrg# configuration script generated by Autoconf, you may include it under
255dd5f640Smrg# the same distribution terms that you use for the rest of that
265dd5f640Smrg# program.  This Exception is an additional permission under section 7
275dd5f640Smrg# of the GNU General Public License, version 3 ("GPLv3").
28e9554658Smrg
29e9554658Smrg
30688b3aecSmrg# Please send patches to <config-patches@gnu.org>.
31e9554658Smrg#
32e9554658Smrg# Configuration subroutine to validate and canonicalize a configuration type.
33e9554658Smrg# Supply the specified configuration type as an argument.
34e9554658Smrg# If it is invalid, we print an error message on stderr and exit with code 1.
35e9554658Smrg# Otherwise, we print the canonical config type on stdout and succeed.
36e9554658Smrg
378903d43aSmrg# You can get the latest version of this script from:
3814bc0770Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
398903d43aSmrg
40e9554658Smrg# This file is supposed to be the same for all GNU packages
41e9554658Smrg# and recognize all the CPU types, system types and aliases
42e9554658Smrg# that are meaningful with *any* GNU software.
43e9554658Smrg# Each package is responsible for reporting which valid configurations
44e9554658Smrg# it does not support.  The user should be able to distinguish
45e9554658Smrg# a failure to support a valid configuration from a meaningless
46e9554658Smrg# configuration.
47e9554658Smrg
48e9554658Smrg# The goal of this file is to map all the various variations of a given
49e9554658Smrg# machine specification into a single specification in the form:
50e9554658Smrg#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
51e9554658Smrg# or in some cases, the newer four-part form:
52e9554658Smrg#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
53e9554658Smrg# It is wrong to echo any other type of specification.
54e9554658Smrg
5514bc0770Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
5614bc0770Smrg# about features and limitations of the classic Bourne shell that were
5714bc0770Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
5814bc0770Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
5914bc0770Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
6014bc0770Smrg# have a pre-POSIX /bin/sh.
6114bc0770Smrg
62e9554658Smrgme=`echo "$0" | sed -e 's,.*/,,'`
63e9554658Smrg
64e9554658Smrgusage="\
65688b3aecSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
66e9554658Smrg
67e9554658SmrgCanonicalize a configuration name.
68e9554658Smrg
69688b3aecSmrgOptions:
70e9554658Smrg  -h, --help         print this help, then exit
71e9554658Smrg  -t, --time-stamp   print date of last modification, then exit
72e9554658Smrg  -v, --version      print version number, then exit
73e9554658Smrg
74e9554658SmrgReport bugs and patches to <config-patches@gnu.org>."
75e9554658Smrg
76e9554658Smrgversion="\
77e9554658SmrgGNU config.sub ($timestamp)
78e9554658Smrg
7914bc0770SmrgCopyright 1992-2021 Free Software Foundation, Inc.
80e9554658Smrg
81e9554658SmrgThis is free software; see the source for copying conditions.  There is NO
82e9554658Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83e9554658Smrg
84e9554658Smrghelp="
85e9554658SmrgTry \`$me --help' for more information."
86e9554658Smrg
87e9554658Smrg# Parse command line
88e9554658Smrgwhile test $# -gt 0 ; do
89e9554658Smrg  case $1 in
90e9554658Smrg    --time-stamp | --time* | -t )
91e9554658Smrg       echo "$timestamp" ; exit ;;
92e9554658Smrg    --version | -v )
93e9554658Smrg       echo "$version" ; exit ;;
94e9554658Smrg    --help | --h* | -h )
95e9554658Smrg       echo "$usage"; exit ;;
96e9554658Smrg    -- )     # Stop option processing
97e9554658Smrg       shift; break ;;
98e9554658Smrg    - )	# Use stdin as input.
99e9554658Smrg       break ;;
100e9554658Smrg    -* )
10114bc0770Smrg       echo "$me: invalid option $1$help" >&2
102e9554658Smrg       exit 1 ;;
103e9554658Smrg
104e9554658Smrg    *local*)
105e9554658Smrg       # First pass through any local machine types.
106688b3aecSmrg       echo "$1"
107e9554658Smrg       exit ;;
108e9554658Smrg
109e9554658Smrg    * )
110e9554658Smrg       break ;;
111e9554658Smrg  esac
112e9554658Smrgdone
113e9554658Smrg
114e9554658Smrgcase $# in
115e9554658Smrg 0) echo "$me: missing argument$help" >&2
116e9554658Smrg    exit 1;;
117e9554658Smrg 1) ;;
118e9554658Smrg *) echo "$me: too many arguments$help" >&2
119e9554658Smrg    exit 1;;
120e9554658Smrgesac
121e9554658Smrg
12214bc0770Smrg# Split fields of configuration type
12314bc0770Smrg# shellcheck disable=SC2162
12414bc0770Smrgsaved_IFS=$IFS
12514bc0770SmrgIFS="-" read field1 field2 field3 field4 <<EOF
12614bc0770Smrg$1
12714bc0770SmrgEOF
12814bc0770SmrgIFS=$saved_IFS
129e9554658Smrg
13014bc0770Smrg# Separate into logical components for further validation
13114bc0770Smrgcase $1 in
13214bc0770Smrg	*-*-*-*-*)
13314bc0770Smrg		echo Invalid configuration \`"$1"\': more than four components >&2
13414bc0770Smrg		exit 1
1355dd5f640Smrg		;;
13614bc0770Smrg	*-*-*-*)
13714bc0770Smrg		basic_machine=$field1-$field2
13814bc0770Smrg		basic_os=$field3-$field4
139e9554658Smrg		;;
14014bc0770Smrg	*-*-*)
14114bc0770Smrg		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
14214bc0770Smrg		# parts
14314bc0770Smrg		maybe_os=$field2-$field3
14414bc0770Smrg		case $maybe_os in
14514bc0770Smrg			nto-qnx* | linux-* | uclinux-uclibc* \
14614bc0770Smrg			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
14714bc0770Smrg			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
14814bc0770Smrg			| storm-chaos* | os2-emx* | rtmk-nova*)
14914bc0770Smrg				basic_machine=$field1
15014bc0770Smrg				basic_os=$maybe_os
15114bc0770Smrg				;;
15214bc0770Smrg			android-linux)
15314bc0770Smrg				basic_machine=$field1-unknown
15414bc0770Smrg				basic_os=linux-android
15514bc0770Smrg				;;
15614bc0770Smrg			*)
15714bc0770Smrg				basic_machine=$field1-$field2
15814bc0770Smrg				basic_os=$field3
15914bc0770Smrg				;;
16014bc0770Smrg		esac
161e9554658Smrg		;;
16214bc0770Smrg	*-*)
16314bc0770Smrg		# A lone config we happen to match not fitting any pattern
16414bc0770Smrg		case $field1-$field2 in
16514bc0770Smrg			decstation-3100)
16614bc0770Smrg				basic_machine=mips-dec
16714bc0770Smrg				basic_os=
16814bc0770Smrg				;;
16914bc0770Smrg			*-*)
17014bc0770Smrg				# Second component is usually, but not always the OS
17114bc0770Smrg				case $field2 in
17214bc0770Smrg					# Prevent following clause from handling this valid os
17314bc0770Smrg					sun*os*)
17414bc0770Smrg						basic_machine=$field1
17514bc0770Smrg						basic_os=$field2
17614bc0770Smrg						;;
17714bc0770Smrg					zephyr*)
17814bc0770Smrg						basic_machine=$field1-unknown
17914bc0770Smrg						basic_os=$field2
18014bc0770Smrg						;;
18114bc0770Smrg					# Manufacturers
18214bc0770Smrg					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
18314bc0770Smrg					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
18414bc0770Smrg					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
18514bc0770Smrg					| convergent* | ncr* | news | 32* | 3600* | 3100* \
18614bc0770Smrg					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
18714bc0770Smrg					| ultra | tti* | harris | dolphin | highlevel | gould \
18814bc0770Smrg					| cbm | ns | masscomp | apple | axis | knuth | cray \
18914bc0770Smrg					| microblaze* | sim | cisco \
19014bc0770Smrg					| oki | wec | wrs | winbond)
19114bc0770Smrg						basic_machine=$field1-$field2
19214bc0770Smrg						basic_os=
19314bc0770Smrg						;;
19414bc0770Smrg					*)
19514bc0770Smrg						basic_machine=$field1
19614bc0770Smrg						basic_os=$field2
19714bc0770Smrg						;;
19814bc0770Smrg				esac
19914bc0770Smrg			;;
20014bc0770Smrg		esac
201e9554658Smrg		;;
20214bc0770Smrg	*)
20314bc0770Smrg		# Convert single-component short-hands not valid as part of
20414bc0770Smrg		# multi-component configurations.
20514bc0770Smrg		case $field1 in
20614bc0770Smrg			386bsd)
20714bc0770Smrg				basic_machine=i386-pc
20814bc0770Smrg				basic_os=bsd
20914bc0770Smrg				;;
21014bc0770Smrg			a29khif)
21114bc0770Smrg				basic_machine=a29k-amd
21214bc0770Smrg				basic_os=udi
21314bc0770Smrg				;;
21414bc0770Smrg			adobe68k)
21514bc0770Smrg				basic_machine=m68010-adobe
21614bc0770Smrg				basic_os=scout
21714bc0770Smrg				;;
21814bc0770Smrg			alliant)
21914bc0770Smrg				basic_machine=fx80-alliant
22014bc0770Smrg				basic_os=
22114bc0770Smrg				;;
22214bc0770Smrg			altos | altos3068)
22314bc0770Smrg				basic_machine=m68k-altos
22414bc0770Smrg				basic_os=
22514bc0770Smrg				;;
22614bc0770Smrg			am29k)
22714bc0770Smrg				basic_machine=a29k-none
22814bc0770Smrg				basic_os=bsd
22914bc0770Smrg				;;
23014bc0770Smrg			amdahl)
23114bc0770Smrg				basic_machine=580-amdahl
23214bc0770Smrg				basic_os=sysv
23314bc0770Smrg				;;
23414bc0770Smrg			amiga)
23514bc0770Smrg				basic_machine=m68k-unknown
23614bc0770Smrg				basic_os=
23714bc0770Smrg				;;
23814bc0770Smrg			amigaos | amigados)
23914bc0770Smrg				basic_machine=m68k-unknown
24014bc0770Smrg				basic_os=amigaos
24114bc0770Smrg				;;
24214bc0770Smrg			amigaunix | amix)
24314bc0770Smrg				basic_machine=m68k-unknown
24414bc0770Smrg				basic_os=sysv4
24514bc0770Smrg				;;
24614bc0770Smrg			apollo68)
24714bc0770Smrg				basic_machine=m68k-apollo
24814bc0770Smrg				basic_os=sysv
24914bc0770Smrg				;;
25014bc0770Smrg			apollo68bsd)
25114bc0770Smrg				basic_machine=m68k-apollo
25214bc0770Smrg				basic_os=bsd
25314bc0770Smrg				;;
25414bc0770Smrg			aros)
25514bc0770Smrg				basic_machine=i386-pc
25614bc0770Smrg				basic_os=aros
25714bc0770Smrg				;;
25814bc0770Smrg			aux)
25914bc0770Smrg				basic_machine=m68k-apple
26014bc0770Smrg				basic_os=aux
26114bc0770Smrg				;;
26214bc0770Smrg			balance)
26314bc0770Smrg				basic_machine=ns32k-sequent
26414bc0770Smrg				basic_os=dynix
26514bc0770Smrg				;;
26614bc0770Smrg			blackfin)
26714bc0770Smrg				basic_machine=bfin-unknown
26814bc0770Smrg				basic_os=linux
26914bc0770Smrg				;;
27014bc0770Smrg			cegcc)
27114bc0770Smrg				basic_machine=arm-unknown
27214bc0770Smrg				basic_os=cegcc
27314bc0770Smrg				;;
27414bc0770Smrg			convex-c1)
27514bc0770Smrg				basic_machine=c1-convex
27614bc0770Smrg				basic_os=bsd
27714bc0770Smrg				;;
27814bc0770Smrg			convex-c2)
27914bc0770Smrg				basic_machine=c2-convex
28014bc0770Smrg				basic_os=bsd
28114bc0770Smrg				;;
28214bc0770Smrg			convex-c32)
28314bc0770Smrg				basic_machine=c32-convex
28414bc0770Smrg				basic_os=bsd
28514bc0770Smrg				;;
28614bc0770Smrg			convex-c34)
28714bc0770Smrg				basic_machine=c34-convex
28814bc0770Smrg				basic_os=bsd
28914bc0770Smrg				;;
29014bc0770Smrg			convex-c38)
29114bc0770Smrg				basic_machine=c38-convex
29214bc0770Smrg				basic_os=bsd
29314bc0770Smrg				;;
29414bc0770Smrg			cray)
29514bc0770Smrg				basic_machine=j90-cray
29614bc0770Smrg				basic_os=unicos
29714bc0770Smrg				;;
29814bc0770Smrg			crds | unos)
29914bc0770Smrg				basic_machine=m68k-crds
30014bc0770Smrg				basic_os=
30114bc0770Smrg				;;
30214bc0770Smrg			da30)
30314bc0770Smrg				basic_machine=m68k-da30
30414bc0770Smrg				basic_os=
30514bc0770Smrg				;;
30614bc0770Smrg			decstation | pmax | pmin | dec3100 | decstatn)
30714bc0770Smrg				basic_machine=mips-dec
30814bc0770Smrg				basic_os=
30914bc0770Smrg				;;
31014bc0770Smrg			delta88)
31114bc0770Smrg				basic_machine=m88k-motorola
31214bc0770Smrg				basic_os=sysv3
31314bc0770Smrg				;;
31414bc0770Smrg			dicos)
31514bc0770Smrg				basic_machine=i686-pc
31614bc0770Smrg				basic_os=dicos
31714bc0770Smrg				;;
31814bc0770Smrg			djgpp)
31914bc0770Smrg				basic_machine=i586-pc
32014bc0770Smrg				basic_os=msdosdjgpp
32114bc0770Smrg				;;
32214bc0770Smrg			ebmon29k)
32314bc0770Smrg				basic_machine=a29k-amd
32414bc0770Smrg				basic_os=ebmon
32514bc0770Smrg				;;
32614bc0770Smrg			es1800 | OSE68k | ose68k | ose | OSE)
32714bc0770Smrg				basic_machine=m68k-ericsson
32814bc0770Smrg				basic_os=ose
32914bc0770Smrg				;;
33014bc0770Smrg			gmicro)
33114bc0770Smrg				basic_machine=tron-gmicro
33214bc0770Smrg				basic_os=sysv
33314bc0770Smrg				;;
33414bc0770Smrg			go32)
33514bc0770Smrg				basic_machine=i386-pc
33614bc0770Smrg				basic_os=go32
33714bc0770Smrg				;;
33814bc0770Smrg			h8300hms)
33914bc0770Smrg				basic_machine=h8300-hitachi
34014bc0770Smrg				basic_os=hms
34114bc0770Smrg				;;
34214bc0770Smrg			h8300xray)
34314bc0770Smrg				basic_machine=h8300-hitachi
34414bc0770Smrg				basic_os=xray
34514bc0770Smrg				;;
34614bc0770Smrg			h8500hms)
34714bc0770Smrg				basic_machine=h8500-hitachi
34814bc0770Smrg				basic_os=hms
34914bc0770Smrg				;;
35014bc0770Smrg			harris)
35114bc0770Smrg				basic_machine=m88k-harris
35214bc0770Smrg				basic_os=sysv3
35314bc0770Smrg				;;
35414bc0770Smrg			hp300 | hp300hpux)
35514bc0770Smrg				basic_machine=m68k-hp
35614bc0770Smrg				basic_os=hpux
35714bc0770Smrg				;;
35814bc0770Smrg			hp300bsd)
35914bc0770Smrg				basic_machine=m68k-hp
36014bc0770Smrg				basic_os=bsd
36114bc0770Smrg				;;
36214bc0770Smrg			hppaosf)
36314bc0770Smrg				basic_machine=hppa1.1-hp
36414bc0770Smrg				basic_os=osf
36514bc0770Smrg				;;
36614bc0770Smrg			hppro)
36714bc0770Smrg				basic_machine=hppa1.1-hp
36814bc0770Smrg				basic_os=proelf
36914bc0770Smrg				;;
37014bc0770Smrg			i386mach)
37114bc0770Smrg				basic_machine=i386-mach
37214bc0770Smrg				basic_os=mach
37314bc0770Smrg				;;
37414bc0770Smrg			isi68 | isi)
37514bc0770Smrg				basic_machine=m68k-isi
37614bc0770Smrg				basic_os=sysv
37714bc0770Smrg				;;
37814bc0770Smrg			m68knommu)
37914bc0770Smrg				basic_machine=m68k-unknown
38014bc0770Smrg				basic_os=linux
38114bc0770Smrg				;;
38214bc0770Smrg			magnum | m3230)
38314bc0770Smrg				basic_machine=mips-mips
38414bc0770Smrg				basic_os=sysv
38514bc0770Smrg				;;
38614bc0770Smrg			merlin)
38714bc0770Smrg				basic_machine=ns32k-utek
38814bc0770Smrg				basic_os=sysv
38914bc0770Smrg				;;
39014bc0770Smrg			mingw64)
39114bc0770Smrg				basic_machine=x86_64-pc
39214bc0770Smrg				basic_os=mingw64
39314bc0770Smrg				;;
39414bc0770Smrg			mingw32)
39514bc0770Smrg				basic_machine=i686-pc
39614bc0770Smrg				basic_os=mingw32
39714bc0770Smrg				;;
39814bc0770Smrg			mingw32ce)
39914bc0770Smrg				basic_machine=arm-unknown
40014bc0770Smrg				basic_os=mingw32ce
40114bc0770Smrg				;;
40214bc0770Smrg			monitor)
40314bc0770Smrg				basic_machine=m68k-rom68k
40414bc0770Smrg				basic_os=coff
40514bc0770Smrg				;;
40614bc0770Smrg			morphos)
40714bc0770Smrg				basic_machine=powerpc-unknown
40814bc0770Smrg				basic_os=morphos
40914bc0770Smrg				;;
41014bc0770Smrg			moxiebox)
41114bc0770Smrg				basic_machine=moxie-unknown
41214bc0770Smrg				basic_os=moxiebox
41314bc0770Smrg				;;
41414bc0770Smrg			msdos)
41514bc0770Smrg				basic_machine=i386-pc
41614bc0770Smrg				basic_os=msdos
41714bc0770Smrg				;;
41814bc0770Smrg			msys)
41914bc0770Smrg				basic_machine=i686-pc
42014bc0770Smrg				basic_os=msys
42114bc0770Smrg				;;
42214bc0770Smrg			mvs)
42314bc0770Smrg				basic_machine=i370-ibm
42414bc0770Smrg				basic_os=mvs
42514bc0770Smrg				;;
42614bc0770Smrg			nacl)
42714bc0770Smrg				basic_machine=le32-unknown
42814bc0770Smrg				basic_os=nacl
42914bc0770Smrg				;;
43014bc0770Smrg			ncr3000)
43114bc0770Smrg				basic_machine=i486-ncr
43214bc0770Smrg				basic_os=sysv4
43314bc0770Smrg				;;
43414bc0770Smrg			netbsd386)
43514bc0770Smrg				basic_machine=i386-pc
43614bc0770Smrg				basic_os=netbsd
43714bc0770Smrg				;;
43814bc0770Smrg			netwinder)
43914bc0770Smrg				basic_machine=armv4l-rebel
44014bc0770Smrg				basic_os=linux
44114bc0770Smrg				;;
44214bc0770Smrg			news | news700 | news800 | news900)
44314bc0770Smrg				basic_machine=m68k-sony
44414bc0770Smrg				basic_os=newsos
44514bc0770Smrg				;;
44614bc0770Smrg			news1000)
44714bc0770Smrg				basic_machine=m68030-sony
44814bc0770Smrg				basic_os=newsos
44914bc0770Smrg				;;
45014bc0770Smrg			necv70)
45114bc0770Smrg				basic_machine=v70-nec
45214bc0770Smrg				basic_os=sysv
45314bc0770Smrg				;;
45414bc0770Smrg			nh3000)
45514bc0770Smrg				basic_machine=m68k-harris
45614bc0770Smrg				basic_os=cxux
45714bc0770Smrg				;;
45814bc0770Smrg			nh[45]000)
45914bc0770Smrg				basic_machine=m88k-harris
46014bc0770Smrg				basic_os=cxux
46114bc0770Smrg				;;
46214bc0770Smrg			nindy960)
46314bc0770Smrg				basic_machine=i960-intel
46414bc0770Smrg				basic_os=nindy
46514bc0770Smrg				;;
46614bc0770Smrg			mon960)
46714bc0770Smrg				basic_machine=i960-intel
46814bc0770Smrg				basic_os=mon960
46914bc0770Smrg				;;
47014bc0770Smrg			nonstopux)
47114bc0770Smrg				basic_machine=mips-compaq
47214bc0770Smrg				basic_os=nonstopux
47314bc0770Smrg				;;
47414bc0770Smrg			os400)
47514bc0770Smrg				basic_machine=powerpc-ibm
47614bc0770Smrg				basic_os=os400
47714bc0770Smrg				;;
47814bc0770Smrg			OSE68000 | ose68000)
47914bc0770Smrg				basic_machine=m68000-ericsson
48014bc0770Smrg				basic_os=ose
48114bc0770Smrg				;;
48214bc0770Smrg			os68k)
48314bc0770Smrg				basic_machine=m68k-none
48414bc0770Smrg				basic_os=os68k
48514bc0770Smrg				;;
48614bc0770Smrg			paragon)
48714bc0770Smrg				basic_machine=i860-intel
48814bc0770Smrg				basic_os=osf
48914bc0770Smrg				;;
49014bc0770Smrg			parisc)
49114bc0770Smrg				basic_machine=hppa-unknown
49214bc0770Smrg				basic_os=linux
49314bc0770Smrg				;;
49414bc0770Smrg			psp)
49514bc0770Smrg				basic_machine=mipsallegrexel-sony
49614bc0770Smrg				basic_os=psp
49714bc0770Smrg				;;
49814bc0770Smrg			pw32)
49914bc0770Smrg				basic_machine=i586-unknown
50014bc0770Smrg				basic_os=pw32
50114bc0770Smrg				;;
50214bc0770Smrg			rdos | rdos64)
50314bc0770Smrg				basic_machine=x86_64-pc
50414bc0770Smrg				basic_os=rdos
50514bc0770Smrg				;;
50614bc0770Smrg			rdos32)
50714bc0770Smrg				basic_machine=i386-pc
50814bc0770Smrg				basic_os=rdos
50914bc0770Smrg				;;
51014bc0770Smrg			rom68k)
51114bc0770Smrg				basic_machine=m68k-rom68k
51214bc0770Smrg				basic_os=coff
51314bc0770Smrg				;;
51414bc0770Smrg			sa29200)
51514bc0770Smrg				basic_machine=a29k-amd
51614bc0770Smrg				basic_os=udi
51714bc0770Smrg				;;
51814bc0770Smrg			sei)
51914bc0770Smrg				basic_machine=mips-sei
52014bc0770Smrg				basic_os=seiux
52114bc0770Smrg				;;
52214bc0770Smrg			sequent)
52314bc0770Smrg				basic_machine=i386-sequent
52414bc0770Smrg				basic_os=
52514bc0770Smrg				;;
52614bc0770Smrg			sps7)
52714bc0770Smrg				basic_machine=m68k-bull
52814bc0770Smrg				basic_os=sysv2
52914bc0770Smrg				;;
53014bc0770Smrg			st2000)
53114bc0770Smrg				basic_machine=m68k-tandem
53214bc0770Smrg				basic_os=
53314bc0770Smrg				;;
53414bc0770Smrg			stratus)
53514bc0770Smrg				basic_machine=i860-stratus
53614bc0770Smrg				basic_os=sysv4
53714bc0770Smrg				;;
53814bc0770Smrg			sun2)
53914bc0770Smrg				basic_machine=m68000-sun
54014bc0770Smrg				basic_os=
54114bc0770Smrg				;;
54214bc0770Smrg			sun2os3)
54314bc0770Smrg				basic_machine=m68000-sun
54414bc0770Smrg				basic_os=sunos3
54514bc0770Smrg				;;
54614bc0770Smrg			sun2os4)
54714bc0770Smrg				basic_machine=m68000-sun
54814bc0770Smrg				basic_os=sunos4
54914bc0770Smrg				;;
55014bc0770Smrg			sun3)
55114bc0770Smrg				basic_machine=m68k-sun
55214bc0770Smrg				basic_os=
55314bc0770Smrg				;;
55414bc0770Smrg			sun3os3)
55514bc0770Smrg				basic_machine=m68k-sun
55614bc0770Smrg				basic_os=sunos3
55714bc0770Smrg				;;
55814bc0770Smrg			sun3os4)
55914bc0770Smrg				basic_machine=m68k-sun
56014bc0770Smrg				basic_os=sunos4
56114bc0770Smrg				;;
56214bc0770Smrg			sun4)
56314bc0770Smrg				basic_machine=sparc-sun
56414bc0770Smrg				basic_os=
56514bc0770Smrg				;;
56614bc0770Smrg			sun4os3)
56714bc0770Smrg				basic_machine=sparc-sun
56814bc0770Smrg				basic_os=sunos3
56914bc0770Smrg				;;
57014bc0770Smrg			sun4os4)
57114bc0770Smrg				basic_machine=sparc-sun
57214bc0770Smrg				basic_os=sunos4
57314bc0770Smrg				;;
57414bc0770Smrg			sun4sol2)
57514bc0770Smrg				basic_machine=sparc-sun
57614bc0770Smrg				basic_os=solaris2
57714bc0770Smrg				;;
57814bc0770Smrg			sun386 | sun386i | roadrunner)
57914bc0770Smrg				basic_machine=i386-sun
58014bc0770Smrg				basic_os=
58114bc0770Smrg				;;
58214bc0770Smrg			sv1)
58314bc0770Smrg				basic_machine=sv1-cray
58414bc0770Smrg				basic_os=unicos
58514bc0770Smrg				;;
58614bc0770Smrg			symmetry)
58714bc0770Smrg				basic_machine=i386-sequent
58814bc0770Smrg				basic_os=dynix
58914bc0770Smrg				;;
59014bc0770Smrg			t3e)
59114bc0770Smrg				basic_machine=alphaev5-cray
59214bc0770Smrg				basic_os=unicos
59314bc0770Smrg				;;
59414bc0770Smrg			t90)
59514bc0770Smrg				basic_machine=t90-cray
59614bc0770Smrg				basic_os=unicos
59714bc0770Smrg				;;
59814bc0770Smrg			toad1)
59914bc0770Smrg				basic_machine=pdp10-xkl
60014bc0770Smrg				basic_os=tops20
60114bc0770Smrg				;;
60214bc0770Smrg			tpf)
60314bc0770Smrg				basic_machine=s390x-ibm
60414bc0770Smrg				basic_os=tpf
60514bc0770Smrg				;;
60614bc0770Smrg			udi29k)
60714bc0770Smrg				basic_machine=a29k-amd
60814bc0770Smrg				basic_os=udi
60914bc0770Smrg				;;
61014bc0770Smrg			ultra3)
61114bc0770Smrg				basic_machine=a29k-nyu
61214bc0770Smrg				basic_os=sym1
61314bc0770Smrg				;;
61414bc0770Smrg			v810 | necv810)
61514bc0770Smrg				basic_machine=v810-nec
61614bc0770Smrg				basic_os=none
61714bc0770Smrg				;;
61814bc0770Smrg			vaxv)
61914bc0770Smrg				basic_machine=vax-dec
62014bc0770Smrg				basic_os=sysv
62114bc0770Smrg				;;
62214bc0770Smrg			vms)
62314bc0770Smrg				basic_machine=vax-dec
62414bc0770Smrg				basic_os=vms
62514bc0770Smrg				;;
62614bc0770Smrg			vsta)
62714bc0770Smrg				basic_machine=i386-pc
62814bc0770Smrg				basic_os=vsta
62914bc0770Smrg				;;
63014bc0770Smrg			vxworks960)
63114bc0770Smrg				basic_machine=i960-wrs
63214bc0770Smrg				basic_os=vxworks
63314bc0770Smrg				;;
63414bc0770Smrg			vxworks68)
63514bc0770Smrg				basic_machine=m68k-wrs
63614bc0770Smrg				basic_os=vxworks
63714bc0770Smrg				;;
63814bc0770Smrg			vxworks29k)
63914bc0770Smrg				basic_machine=a29k-wrs
64014bc0770Smrg				basic_os=vxworks
64114bc0770Smrg				;;
64214bc0770Smrg			xbox)
64314bc0770Smrg				basic_machine=i686-pc
64414bc0770Smrg				basic_os=mingw32
64514bc0770Smrg				;;
64614bc0770Smrg			ymp)
64714bc0770Smrg				basic_machine=ymp-cray
64814bc0770Smrg				basic_os=unicos
64914bc0770Smrg				;;
65014bc0770Smrg			*)
65114bc0770Smrg				basic_machine=$1
65214bc0770Smrg				basic_os=
65314bc0770Smrg				;;
65414bc0770Smrg		esac
655e9554658Smrg		;;
656e9554658Smrgesac
657e9554658Smrg
65814bc0770Smrg# Decode 1-component or ad-hoc basic machines
659e9554658Smrgcase $basic_machine in
66014bc0770Smrg	# Here we handle the default manufacturer of certain CPU types.  It is in
66114bc0770Smrg	# some cases the only manufacturer, in others, it is the most popular.
66214bc0770Smrg	w89k)
66314bc0770Smrg		cpu=hppa1.1
66414bc0770Smrg		vendor=winbond
665688b3aecSmrg		;;
66614bc0770Smrg	op50n)
66714bc0770Smrg		cpu=hppa1.1
66814bc0770Smrg		vendor=oki
669e9554658Smrg		;;
67014bc0770Smrg	op60c)
67114bc0770Smrg		cpu=hppa1.1
67214bc0770Smrg		vendor=oki
673e9554658Smrg		;;
67414bc0770Smrg	ibm*)
67514bc0770Smrg		cpu=i370
67614bc0770Smrg		vendor=ibm
677e9554658Smrg		;;
67814bc0770Smrg	orion105)
67914bc0770Smrg		cpu=clipper
68014bc0770Smrg		vendor=highlevel
6815dd5f640Smrg		;;
68214bc0770Smrg	mac | mpw | mac-mpw)
68314bc0770Smrg		cpu=m68k
68414bc0770Smrg		vendor=apple
6855dd5f640Smrg		;;
68614bc0770Smrg	pmac | pmac-mpw)
68714bc0770Smrg		cpu=powerpc
68814bc0770Smrg		vendor=apple
6895dd5f640Smrg		;;
6905dd5f640Smrg
691e9554658Smrg	# Recognize the various machine names and aliases which stand
692e9554658Smrg	# for a CPU type and a company and sometimes even an OS.
693e9554658Smrg	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
69414bc0770Smrg		cpu=m68000
69514bc0770Smrg		vendor=att
696e9554658Smrg		;;
697e9554658Smrg	3b*)
69814bc0770Smrg		cpu=we32k
69914bc0770Smrg		vendor=att
700c2b339b4Smrg		;;
7018903d43aSmrg	bluegene*)
70214bc0770Smrg		cpu=powerpc
70314bc0770Smrg		vendor=ibm
70414bc0770Smrg		basic_os=cnk
705e9554658Smrg		;;
706e9554658Smrg	decsystem10* | dec10*)
70714bc0770Smrg		cpu=pdp10
70814bc0770Smrg		vendor=dec
70914bc0770Smrg		basic_os=tops10
710e9554658Smrg		;;
711e9554658Smrg	decsystem20* | dec20*)
71214bc0770Smrg		cpu=pdp10
71314bc0770Smrg		vendor=dec
71414bc0770Smrg		basic_os=tops20
715e9554658Smrg		;;
716e9554658Smrg	delta | 3300 | motorola-3300 | motorola-delta \
717e9554658Smrg	      | 3300-motorola | delta-motorola)
71814bc0770Smrg		cpu=m68k
71914bc0770Smrg		vendor=motorola
720e9554658Smrg		;;
721688b3aecSmrg	dpx2*)
72214bc0770Smrg		cpu=m68k
72314bc0770Smrg		vendor=bull
72414bc0770Smrg		basic_os=sysv3
725e9554658Smrg		;;
726e9554658Smrg	encore | umax | mmax)
72714bc0770Smrg		cpu=ns32k
72814bc0770Smrg		vendor=encore
729e9554658Smrg		;;
73014bc0770Smrg	elxsi)
73114bc0770Smrg		cpu=elxsi
73214bc0770Smrg		vendor=elxsi
73314bc0770Smrg		basic_os=${basic_os:-bsd}
734e9554658Smrg		;;
735e9554658Smrg	fx2800)
73614bc0770Smrg		cpu=i860
73714bc0770Smrg		vendor=alliant
738e9554658Smrg		;;
739e9554658Smrg	genix)
74014bc0770Smrg		cpu=ns32k
74114bc0770Smrg		vendor=ns
742e9554658Smrg		;;
743e9554658Smrg	h3050r* | hiux*)
74414bc0770Smrg		cpu=hppa1.1
74514bc0770Smrg		vendor=hitachi
74614bc0770Smrg		basic_os=hiuxwe2
747e9554658Smrg		;;
748e9554658Smrg	hp3k9[0-9][0-9] | hp9[0-9][0-9])
74914bc0770Smrg		cpu=hppa1.0
75014bc0770Smrg		vendor=hp
751e9554658Smrg		;;
752e9554658Smrg	hp9k2[0-9][0-9] | hp9k31[0-9])
75314bc0770Smrg		cpu=m68000
75414bc0770Smrg		vendor=hp
755e9554658Smrg		;;
756e9554658Smrg	hp9k3[2-9][0-9])
75714bc0770Smrg		cpu=m68k
75814bc0770Smrg		vendor=hp
759e9554658Smrg		;;
760e9554658Smrg	hp9k6[0-9][0-9] | hp6[0-9][0-9])
76114bc0770Smrg		cpu=hppa1.0
76214bc0770Smrg		vendor=hp
763e9554658Smrg		;;
764e9554658Smrg	hp9k7[0-79][0-9] | hp7[0-79][0-9])
76514bc0770Smrg		cpu=hppa1.1
76614bc0770Smrg		vendor=hp
767e9554658Smrg		;;
768e9554658Smrg	hp9k78[0-9] | hp78[0-9])
769e9554658Smrg		# FIXME: really hppa2.0-hp
77014bc0770Smrg		cpu=hppa1.1
77114bc0770Smrg		vendor=hp
772e9554658Smrg		;;
773e9554658Smrg	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
774e9554658Smrg		# FIXME: really hppa2.0-hp
77514bc0770Smrg		cpu=hppa1.1
77614bc0770Smrg		vendor=hp
777e9554658Smrg		;;
778e9554658Smrg	hp9k8[0-9][13679] | hp8[0-9][13679])
77914bc0770Smrg		cpu=hppa1.1
78014bc0770Smrg		vendor=hp
781e9554658Smrg		;;
782e9554658Smrg	hp9k8[0-9][0-9] | hp8[0-9][0-9])
78314bc0770Smrg		cpu=hppa1.0
78414bc0770Smrg		vendor=hp
785e9554658Smrg		;;
786e9554658Smrg	i*86v32)
78714bc0770Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
78814bc0770Smrg		vendor=pc
78914bc0770Smrg		basic_os=sysv32
790e9554658Smrg		;;
791e9554658Smrg	i*86v4*)
79214bc0770Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79314bc0770Smrg		vendor=pc
79414bc0770Smrg		basic_os=sysv4
795e9554658Smrg		;;
796e9554658Smrg	i*86v)
79714bc0770Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79814bc0770Smrg		vendor=pc
79914bc0770Smrg		basic_os=sysv
800e9554658Smrg		;;
801e9554658Smrg	i*86sol2)
80214bc0770Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
80314bc0770Smrg		vendor=pc
80414bc0770Smrg		basic_os=solaris2
805e9554658Smrg		;;
80614bc0770Smrg	j90 | j90-cray)
80714bc0770Smrg		cpu=j90
80814bc0770Smrg		vendor=cray
80914bc0770Smrg		basic_os=${basic_os:-unicos}
810e9554658Smrg		;;
811e9554658Smrg	iris | iris4d)
81214bc0770Smrg		cpu=mips
81314bc0770Smrg		vendor=sgi
81414bc0770Smrg		case $basic_os in
81514bc0770Smrg		    irix*)
816e9554658Smrg			;;
817e9554658Smrg		    *)
81814bc0770Smrg			basic_os=irix4
819e9554658Smrg			;;
820e9554658Smrg		esac
821e9554658Smrg		;;
822e9554658Smrg	miniframe)
82314bc0770Smrg		cpu=m68000
82414bc0770Smrg		vendor=convergent
825e9554658Smrg		;;
82614bc0770Smrg	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
82714bc0770Smrg		cpu=m68k
82814bc0770Smrg		vendor=atari
82914bc0770Smrg		basic_os=mint
830e9554658Smrg		;;
831e9554658Smrg	news-3600 | risc-news)
83214bc0770Smrg		cpu=mips
83314bc0770Smrg		vendor=sony
83414bc0770Smrg		basic_os=newsos
835e9554658Smrg		;;
836688b3aecSmrg	next | m*-next)
83714bc0770Smrg		cpu=m68k
83814bc0770Smrg		vendor=next
83914bc0770Smrg		case $basic_os in
84014bc0770Smrg		    openstep*)
84114bc0770Smrg		        ;;
84214bc0770Smrg		    nextstep*)
843e9554658Smrg			;;
84414bc0770Smrg		    ns2*)
84514bc0770Smrg		      basic_os=nextstep2
846e9554658Smrg			;;
847e9554658Smrg		    *)
84814bc0770Smrg		      basic_os=nextstep3
849e9554658Smrg			;;
850e9554658Smrg		esac
851e9554658Smrg		;;
852e9554658Smrg	np1)
85314bc0770Smrg		cpu=np1
85414bc0770Smrg		vendor=gould
855688b3aecSmrg		;;
856e9554658Smrg	op50n-* | op60c-*)
85714bc0770Smrg		cpu=hppa1.1
85814bc0770Smrg		vendor=oki
85914bc0770Smrg		basic_os=proelf
860e9554658Smrg		;;
861e9554658Smrg	pa-hitachi)
86214bc0770Smrg		cpu=hppa1.1
86314bc0770Smrg		vendor=hitachi
86414bc0770Smrg		basic_os=hiuxwe2
865c2b339b4Smrg		;;
866e9554658Smrg	pbd)
86714bc0770Smrg		cpu=sparc
86814bc0770Smrg		vendor=tti
869e9554658Smrg		;;
870e9554658Smrg	pbb)
87114bc0770Smrg		cpu=m68k
87214bc0770Smrg		vendor=tti
873e9554658Smrg		;;
87414bc0770Smrg	pc532)
87514bc0770Smrg		cpu=ns32k
87614bc0770Smrg		vendor=pc532
877e9554658Smrg		;;
878e9554658Smrg	pn)
87914bc0770Smrg		cpu=pn
88014bc0770Smrg		vendor=gould
881e9554658Smrg		;;
88214bc0770Smrg	power)
88314bc0770Smrg		cpu=power
88414bc0770Smrg		vendor=ibm
885e9554658Smrg		;;
88614bc0770Smrg	ps2)
88714bc0770Smrg		cpu=i386
88814bc0770Smrg		vendor=ibm
889e9554658Smrg		;;
89014bc0770Smrg	rm[46]00)
89114bc0770Smrg		cpu=mips
89214bc0770Smrg		vendor=siemens
893e9554658Smrg		;;
89414bc0770Smrg	rtpc | rtpc-*)
89514bc0770Smrg		cpu=romp
89614bc0770Smrg		vendor=ibm
897e9554658Smrg		;;
89814bc0770Smrg	sde)
89914bc0770Smrg		cpu=mipsisa32
90014bc0770Smrg		vendor=sde
90114bc0770Smrg		basic_os=${basic_os:-elf}
902e9554658Smrg		;;
90314bc0770Smrg	simso-wrs)
90414bc0770Smrg		cpu=sparclite
90514bc0770Smrg		vendor=wrs
90614bc0770Smrg		basic_os=vxworks
907e9554658Smrg		;;
90814bc0770Smrg	tower | tower-32)
90914bc0770Smrg		cpu=m68k
91014bc0770Smrg		vendor=ncr
911e9554658Smrg		;;
91214bc0770Smrg	vpp*|vx|vx-*)
91314bc0770Smrg		cpu=f301
91414bc0770Smrg		vendor=fujitsu
9155dd5f640Smrg		;;
91614bc0770Smrg	w65)
91714bc0770Smrg		cpu=w65
91814bc0770Smrg		vendor=wdc
919e9554658Smrg		;;
92014bc0770Smrg	w89k-*)
92114bc0770Smrg		cpu=hppa1.1
92214bc0770Smrg		vendor=winbond
92314bc0770Smrg		basic_os=proelf
924e9554658Smrg		;;
92514bc0770Smrg	none)
92614bc0770Smrg		cpu=none
92714bc0770Smrg		vendor=none
928e9554658Smrg		;;
92914bc0770Smrg	leon|leon[3-9])
93014bc0770Smrg		cpu=sparc
93114bc0770Smrg		vendor=$basic_machine
932e9554658Smrg		;;
93314bc0770Smrg	leon-*|leon[3-9]-*)
93414bc0770Smrg		cpu=sparc
93514bc0770Smrg		vendor=`echo "$basic_machine" | sed 's/-.*//'`
936e9554658Smrg		;;
93714bc0770Smrg
93814bc0770Smrg	*-*)
93914bc0770Smrg		# shellcheck disable=SC2162
94014bc0770Smrg		saved_IFS=$IFS
94114bc0770Smrg		IFS="-" read cpu vendor <<EOF
94214bc0770Smrg$basic_machine
94314bc0770SmrgEOF
94414bc0770Smrg		IFS=$saved_IFS
945e9554658Smrg		;;
94614bc0770Smrg	# We use `pc' rather than `unknown'
94714bc0770Smrg	# because (1) that's what they normally are, and
94814bc0770Smrg	# (2) the word "unknown" tends to confuse beginning users.
94914bc0770Smrg	i*86 | x86_64)
95014bc0770Smrg		cpu=$basic_machine
95114bc0770Smrg		vendor=pc
952e9554658Smrg		;;
95314bc0770Smrg	# These rules are duplicated from below for sake of the special case above;
95414bc0770Smrg	# i.e. things that normalized to x86 arches should also default to "pc"
95514bc0770Smrg	pc98)
95614bc0770Smrg		cpu=i386
95714bc0770Smrg		vendor=pc
958e9554658Smrg		;;
95914bc0770Smrg	x64 | amd64)
96014bc0770Smrg		cpu=x86_64
96114bc0770Smrg		vendor=pc
962e9554658Smrg		;;
96314bc0770Smrg	# Recognize the basic CPU types without company name.
96414bc0770Smrg	*)
96514bc0770Smrg		cpu=$basic_machine
96614bc0770Smrg		vendor=unknown
967e9554658Smrg		;;
96814bc0770Smrgesac
96914bc0770Smrg
97014bc0770Smrgunset -v basic_machine
97114bc0770Smrg
97214bc0770Smrg# Decode basic machines in the full and proper CPU-Company form.
97314bc0770Smrgcase $cpu-$vendor in
97414bc0770Smrg	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
97514bc0770Smrg	# some cases the only manufacturer, in others, it is the most popular.
97614bc0770Smrg	craynv-unknown)
97714bc0770Smrg		vendor=cray
97814bc0770Smrg		basic_os=${basic_os:-unicosmp}
979e9554658Smrg		;;
98014bc0770Smrg	c90-unknown | c90-cray)
98114bc0770Smrg		vendor=cray
98214bc0770Smrg		basic_os=${Basic_os:-unicos}
983e9554658Smrg		;;
98414bc0770Smrg	fx80-unknown)
98514bc0770Smrg		vendor=alliant
986c2b339b4Smrg		;;
98714bc0770Smrg	romp-unknown)
98814bc0770Smrg		vendor=ibm
989e9554658Smrg		;;
99014bc0770Smrg	mmix-unknown)
99114bc0770Smrg		vendor=knuth
992e9554658Smrg		;;
99314bc0770Smrg	microblaze-unknown | microblazeel-unknown)
99414bc0770Smrg		vendor=xilinx
995e9554658Smrg		;;
99614bc0770Smrg	rs6000-unknown)
99714bc0770Smrg		vendor=ibm
998e9554658Smrg		;;
99914bc0770Smrg	vax-unknown)
100014bc0770Smrg		vendor=dec
1001e9554658Smrg		;;
100214bc0770Smrg	pdp11-unknown)
100314bc0770Smrg		vendor=dec
10045dd5f640Smrg		;;
100514bc0770Smrg	we32k-unknown)
100614bc0770Smrg		vendor=att
1007e9554658Smrg		;;
100814bc0770Smrg	cydra-unknown)
100914bc0770Smrg		vendor=cydrome
1010e9554658Smrg		;;
101114bc0770Smrg	i370-ibm*)
101214bc0770Smrg		vendor=ibm
1013e9554658Smrg		;;
101414bc0770Smrg	orion-unknown)
101514bc0770Smrg		vendor=highlevel
1016e9554658Smrg		;;
101714bc0770Smrg	xps-unknown | xps100-unknown)
101814bc0770Smrg		cpu=xps100
101914bc0770Smrg		vendor=honeywell
1020e9554658Smrg		;;
102114bc0770Smrg
102214bc0770Smrg	# Here we normalize CPU types with a missing or matching vendor
102314bc0770Smrg	dpx20-unknown | dpx20-bull)
102414bc0770Smrg		cpu=rs6000
102514bc0770Smrg		vendor=bull
102614bc0770Smrg		basic_os=${basic_os:-bosx}
1027e9554658Smrg		;;
102814bc0770Smrg
102914bc0770Smrg	# Here we normalize CPU types irrespective of the vendor
103014bc0770Smrg	amd64-*)
103114bc0770Smrg		cpu=x86_64
1032e9554658Smrg		;;
103314bc0770Smrg	blackfin-*)
103414bc0770Smrg		cpu=bfin
103514bc0770Smrg		basic_os=linux
1036e9554658Smrg		;;
103714bc0770Smrg	c54x-*)
103814bc0770Smrg		cpu=tic54x
1039e9554658Smrg		;;
104014bc0770Smrg	c55x-*)
104114bc0770Smrg		cpu=tic55x
1042e9554658Smrg		;;
104314bc0770Smrg	c6x-*)
104414bc0770Smrg		cpu=tic6x
1045e9554658Smrg		;;
104614bc0770Smrg	e500v[12]-*)
104714bc0770Smrg		cpu=powerpc
104814bc0770Smrg		basic_os=${basic_os}"spe"
1049e9554658Smrg		;;
105014bc0770Smrg	mips3*-*)
105114bc0770Smrg		cpu=mips64
1052e9554658Smrg		;;
105314bc0770Smrg	ms1-*)
105414bc0770Smrg		cpu=mt
1055e9554658Smrg		;;
105614bc0770Smrg	m68knommu-*)
105714bc0770Smrg		cpu=m68k
105814bc0770Smrg		basic_os=linux
1059e9554658Smrg		;;
106014bc0770Smrg	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
106114bc0770Smrg		cpu=s12z
1062c2b339b4Smrg		;;
106314bc0770Smrg	openrisc-*)
106414bc0770Smrg		cpu=or32
1065e9554658Smrg		;;
106614bc0770Smrg	parisc-*)
106714bc0770Smrg		cpu=hppa
106814bc0770Smrg		basic_os=linux
1069e9554658Smrg		;;
107014bc0770Smrg	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
107114bc0770Smrg		cpu=i586
1072e9554658Smrg		;;
107314bc0770Smrg	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
107414bc0770Smrg		cpu=i686
1075e9554658Smrg		;;
107614bc0770Smrg	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
107714bc0770Smrg		cpu=i686
1078e9554658Smrg		;;
107914bc0770Smrg	pentium4-*)
108014bc0770Smrg		cpu=i786
1081e9554658Smrg		;;
108214bc0770Smrg	pc98-*)
108314bc0770Smrg		cpu=i386
1084e9554658Smrg		;;
108514bc0770Smrg	ppc-* | ppcbe-*)
108614bc0770Smrg		cpu=powerpc
1087e9554658Smrg		;;
108814bc0770Smrg	ppcle-* | powerpclittle-*)
108914bc0770Smrg		cpu=powerpcle
1090e9554658Smrg		;;
109114bc0770Smrg	ppc64-*)
109214bc0770Smrg		cpu=powerpc64
1093e9554658Smrg		;;
109414bc0770Smrg	ppc64le-* | powerpc64little-*)
109514bc0770Smrg		cpu=powerpc64le
1096e9554658Smrg		;;
109714bc0770Smrg	sb1-*)
109814bc0770Smrg		cpu=mipsisa64sb1
1099e9554658Smrg		;;
110014bc0770Smrg	sb1el-*)
110114bc0770Smrg		cpu=mipsisa64sb1el
1102e9554658Smrg		;;
110314bc0770Smrg	sh5e[lb]-*)
110414bc0770Smrg		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1105e9554658Smrg		;;
110614bc0770Smrg	spur-*)
110714bc0770Smrg		cpu=spur
1108e9554658Smrg		;;
110914bc0770Smrg	strongarm-* | thumb-*)
111014bc0770Smrg		cpu=arm
1111e9554658Smrg		;;
111214bc0770Smrg	tx39-*)
111314bc0770Smrg		cpu=mipstx39
1114688b3aecSmrg		;;
111514bc0770Smrg	tx39el-*)
111614bc0770Smrg		cpu=mipstx39el
1117e9554658Smrg		;;
111814bc0770Smrg	x64-*)
111914bc0770Smrg		cpu=x86_64
1120e9554658Smrg		;;
11215dd5f640Smrg	xscale-* | xscalee[bl]-*)
112214bc0770Smrg		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1123e9554658Smrg		;;
112414bc0770Smrg	arm64-*)
112514bc0770Smrg		cpu=aarch64
1126e9554658Smrg		;;
1127e9554658Smrg
112814bc0770Smrg	# Recognize the canonical CPU Types that limit and/or modify the
112914bc0770Smrg	# company names they are paired with.
113014bc0770Smrg	cr16-*)
113114bc0770Smrg		basic_os=${basic_os:-elf}
1132e9554658Smrg		;;
113314bc0770Smrg	crisv32-* | etraxfs*-*)
113414bc0770Smrg		cpu=crisv32
113514bc0770Smrg		vendor=axis
1136e9554658Smrg		;;
113714bc0770Smrg	cris-* | etrax*-*)
113814bc0770Smrg		cpu=cris
113914bc0770Smrg		vendor=axis
1140e9554658Smrg		;;
114114bc0770Smrg	crx-*)
114214bc0770Smrg		basic_os=${basic_os:-elf}
1143e9554658Smrg		;;
114414bc0770Smrg	neo-tandem)
114514bc0770Smrg		cpu=neo
114614bc0770Smrg		vendor=tandem
1147e9554658Smrg		;;
114814bc0770Smrg	nse-tandem)
114914bc0770Smrg		cpu=nse
115014bc0770Smrg		vendor=tandem
1151e9554658Smrg		;;
115214bc0770Smrg	nsr-tandem)
115314bc0770Smrg		cpu=nsr
115414bc0770Smrg		vendor=tandem
1155e9554658Smrg		;;
115614bc0770Smrg	nsv-tandem)
115714bc0770Smrg		cpu=nsv
115814bc0770Smrg		vendor=tandem
1159e9554658Smrg		;;
116014bc0770Smrg	nsx-tandem)
116114bc0770Smrg		cpu=nsx
116214bc0770Smrg		vendor=tandem
1163e9554658Smrg		;;
116414bc0770Smrg	mipsallegrexel-sony)
116514bc0770Smrg		cpu=mipsallegrexel
116614bc0770Smrg		vendor=sony
1167e9554658Smrg		;;
116814bc0770Smrg	tile*-*)
116914bc0770Smrg		basic_os=${basic_os:-linux-gnu}
1170e9554658Smrg		;;
117114bc0770Smrg
1172e9554658Smrg	*)
117314bc0770Smrg		# Recognize the canonical CPU types that are allowed with any
117414bc0770Smrg		# company name.
117514bc0770Smrg		case $cpu in
117614bc0770Smrg			1750a | 580 \
117714bc0770Smrg			| a29k \
117814bc0770Smrg			| aarch64 | aarch64_be \
117914bc0770Smrg			| abacus \
118014bc0770Smrg			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
118114bc0770Smrg			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
118214bc0770Smrg			| alphapca5[67] | alpha64pca5[67] \
118314bc0770Smrg			| am33_2.0 \
118414bc0770Smrg			| amdgcn \
118514bc0770Smrg			| arc | arceb | arc32 | arc64 \
118614bc0770Smrg			| arm | arm[lb]e | arme[lb] | armv* \
118714bc0770Smrg			| avr | avr32 \
118814bc0770Smrg			| asmjs \
118914bc0770Smrg			| ba \
119014bc0770Smrg			| be32 | be64 \
119114bc0770Smrg			| bfin | bpf | bs2000 \
119214bc0770Smrg			| c[123]* | c30 | [cjt]90 | c4x \
119314bc0770Smrg			| c8051 | clipper | craynv | csky | cydra \
119414bc0770Smrg			| d10v | d30v | dlx | dsp16xx \
119514bc0770Smrg			| e2k | elxsi | epiphany \
119614bc0770Smrg			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
119714bc0770Smrg			| h8300 | h8500 \
119814bc0770Smrg			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
119914bc0770Smrg			| hexagon \
120014bc0770Smrg			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
120114bc0770Smrg			| ip2k | iq2000 \
120214bc0770Smrg			| k1om \
120314bc0770Smrg			| le32 | le64 \
120414bc0770Smrg			| lm32 \
120514bc0770Smrg			| loongarch32 | loongarch64 | loongarchx32 \
120614bc0770Smrg			| m32c | m32r | m32rle \
120714bc0770Smrg			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
120814bc0770Smrg			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
120914bc0770Smrg			| m88110 | m88k | maxq | mb | mcore | mep | metag \
121014bc0770Smrg			| microblaze | microblazeel \
121114bc0770Smrg			| mips | mipsbe | mipseb | mipsel | mipsle \
121214bc0770Smrg			| mips16 \
121314bc0770Smrg			| mips64 | mips64eb | mips64el \
121414bc0770Smrg			| mips64octeon | mips64octeonel \
121514bc0770Smrg			| mips64orion | mips64orionel \
121614bc0770Smrg			| mips64r5900 | mips64r5900el \
121714bc0770Smrg			| mips64vr | mips64vrel \
121814bc0770Smrg			| mips64vr4100 | mips64vr4100el \
121914bc0770Smrg			| mips64vr4300 | mips64vr4300el \
122014bc0770Smrg			| mips64vr5000 | mips64vr5000el \
122114bc0770Smrg			| mips64vr5900 | mips64vr5900el \
122214bc0770Smrg			| mipsisa32 | mipsisa32el \
122314bc0770Smrg			| mipsisa32r2 | mipsisa32r2el \
122414bc0770Smrg			| mipsisa32r3 | mipsisa32r3el \
122514bc0770Smrg			| mipsisa32r5 | mipsisa32r5el \
122614bc0770Smrg			| mipsisa32r6 | mipsisa32r6el \
122714bc0770Smrg			| mipsisa64 | mipsisa64el \
122814bc0770Smrg			| mipsisa64r2 | mipsisa64r2el \
122914bc0770Smrg			| mipsisa64r3 | mipsisa64r3el \
123014bc0770Smrg			| mipsisa64r5 | mipsisa64r5el \
123114bc0770Smrg			| mipsisa64r6 | mipsisa64r6el \
123214bc0770Smrg			| mipsisa64sb1 | mipsisa64sb1el \
123314bc0770Smrg			| mipsisa64sr71k | mipsisa64sr71kel \
123414bc0770Smrg			| mipsr5900 | mipsr5900el \
123514bc0770Smrg			| mipstx39 | mipstx39el \
123614bc0770Smrg			| mmix \
123714bc0770Smrg			| mn10200 | mn10300 \
123814bc0770Smrg			| moxie \
123914bc0770Smrg			| mt \
124014bc0770Smrg			| msp430 \
124114bc0770Smrg			| nds32 | nds32le | nds32be \
124214bc0770Smrg			| nfp \
124314bc0770Smrg			| nios | nios2 | nios2eb | nios2el \
124414bc0770Smrg			| none | np1 | ns16k | ns32k | nvptx \
124514bc0770Smrg			| open8 \
124614bc0770Smrg			| or1k* \
124714bc0770Smrg			| or32 \
124814bc0770Smrg			| orion \
124914bc0770Smrg			| picochip \
125014bc0770Smrg			| pdp10 | pdp11 | pj | pjl | pn | power \
125114bc0770Smrg			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
125214bc0770Smrg			| pru \
125314bc0770Smrg			| pyramid \
125414bc0770Smrg			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
125514bc0770Smrg			| rl78 | romp | rs6000 | rx \
125614bc0770Smrg			| s390 | s390x \
125714bc0770Smrg			| score \
125814bc0770Smrg			| sh | shl \
125914bc0770Smrg			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
126014bc0770Smrg			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
126114bc0770Smrg			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
126214bc0770Smrg			| sparclite \
126314bc0770Smrg			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
126414bc0770Smrg			| spu \
126514bc0770Smrg			| tahoe \
126614bc0770Smrg			| thumbv7* \
126714bc0770Smrg			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
126814bc0770Smrg			| tron \
126914bc0770Smrg			| ubicom32 \
127014bc0770Smrg			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
127114bc0770Smrg			| vax \
127214bc0770Smrg			| visium \
127314bc0770Smrg			| w65 \
127414bc0770Smrg			| wasm32 | wasm64 \
127514bc0770Smrg			| we32k \
127614bc0770Smrg			| x86 | x86_64 | xc16x | xgate | xps100 \
127714bc0770Smrg			| xstormy16 | xtensa* \
127814bc0770Smrg			| ymp \
127914bc0770Smrg			| z8k | z80)
128014bc0770Smrg				;;
128114bc0770Smrg
128214bc0770Smrg			*)
128314bc0770Smrg				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
128414bc0770Smrg				exit 1
128514bc0770Smrg				;;
128614bc0770Smrg		esac
1287e9554658Smrg		;;
1288e9554658Smrgesac
1289e9554658Smrg
1290e9554658Smrg# Here we canonicalize certain aliases for manufacturers.
129114bc0770Smrgcase $vendor in
129214bc0770Smrg	digital*)
129314bc0770Smrg		vendor=dec
1294e9554658Smrg		;;
129514bc0770Smrg	commodore*)
129614bc0770Smrg		vendor=cbm
1297e9554658Smrg		;;
1298e9554658Smrg	*)
1299e9554658Smrg		;;
1300e9554658Smrgesac
1301e9554658Smrg
1302e9554658Smrg# Decode manufacturer-specific aliases for certain operating systems.
1303e9554658Smrg
130414bc0770Smrgif test x$basic_os != x
1305e9554658Smrgthen
130614bc0770Smrg
130714bc0770Smrg# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
130814bc0770Smrg# set os.
130914bc0770Smrgcase $basic_os in
131014bc0770Smrg	gnu/linux*)
131114bc0770Smrg		kernel=linux
131214bc0770Smrg		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
131314bc0770Smrg		;;
131414bc0770Smrg	os2-emx)
131514bc0770Smrg		kernel=os2
131614bc0770Smrg		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
131714bc0770Smrg		;;
131814bc0770Smrg	nto-qnx*)
131914bc0770Smrg		kernel=nto
132014bc0770Smrg		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
132114bc0770Smrg		;;
132214bc0770Smrg	*-*)
132314bc0770Smrg		# shellcheck disable=SC2162
132414bc0770Smrg		saved_IFS=$IFS
132514bc0770Smrg		IFS="-" read kernel os <<EOF
132614bc0770Smrg$basic_os
132714bc0770SmrgEOF
132814bc0770Smrg		IFS=$saved_IFS
132914bc0770Smrg		;;
133014bc0770Smrg	# Default OS when just kernel was specified
133114bc0770Smrg	nto*)
133214bc0770Smrg		kernel=nto
133314bc0770Smrg		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
133414bc0770Smrg		;;
133514bc0770Smrg	linux*)
133614bc0770Smrg		kernel=linux
133714bc0770Smrg		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
133814bc0770Smrg		;;
133914bc0770Smrg	*)
134014bc0770Smrg		kernel=
134114bc0770Smrg		os=$basic_os
134214bc0770Smrg		;;
134314bc0770Smrgesac
134414bc0770Smrg
134514bc0770Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel,
134614bc0770Smrg# etc.)
1347e9554658Smrgcase $os in
1348688b3aecSmrg	# First match some system type aliases that might get confused
1349688b3aecSmrg	# with valid system types.
135014bc0770Smrg	# solaris* is a basic system type, with this one exception.
135114bc0770Smrg	auroraux)
135214bc0770Smrg		os=auroraux
13538903d43aSmrg		;;
135414bc0770Smrg	bluegene*)
135514bc0770Smrg		os=cnk
1356e9554658Smrg		;;
135714bc0770Smrg	solaris1 | solaris1.*)
135814bc0770Smrg		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1359e9554658Smrg		;;
136014bc0770Smrg	solaris)
136114bc0770Smrg		os=solaris2
1362e9554658Smrg		;;
136314bc0770Smrg	unixware*)
136414bc0770Smrg		os=sysv4.2uw
1365e9554658Smrg		;;
1366688b3aecSmrg	# es1800 is here to avoid being matched by es* (a different OS)
136714bc0770Smrg	es1800*)
136814bc0770Smrg		os=ose
1369688b3aecSmrg		;;
137014bc0770Smrg	# Some version numbers need modification
137114bc0770Smrg	chorusos*)
137214bc0770Smrg		os=chorusos
1373e9554658Smrg		;;
137414bc0770Smrg	isc)
137514bc0770Smrg		os=isc2.2
1376e9554658Smrg		;;
137714bc0770Smrg	sco6)
137814bc0770Smrg		os=sco5v6
1379e9554658Smrg		;;
138014bc0770Smrg	sco5)
138114bc0770Smrg		os=sco3.2v5
1382e9554658Smrg		;;
138314bc0770Smrg	sco4)
138414bc0770Smrg		os=sco3.2v4
1385e9554658Smrg		;;
138614bc0770Smrg	sco3.2.[4-9]*)
138714bc0770Smrg		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
1388e9554658Smrg		;;
138914bc0770Smrg	sco*v* | scout)
139014bc0770Smrg		# Don't match below
1391e9554658Smrg		;;
139214bc0770Smrg	sco*)
139314bc0770Smrg		os=sco3.2v2
1394e9554658Smrg		;;
139514bc0770Smrg	psos*)
139614bc0770Smrg		os=psos
1397e9554658Smrg		;;
139814bc0770Smrg	qnx*)
139914bc0770Smrg		os=qnx
1400e9554658Smrg		;;
140114bc0770Smrg	hiux*)
140214bc0770Smrg		os=hiuxwe2
1403e9554658Smrg		;;
140414bc0770Smrg	lynx*178)
140514bc0770Smrg		os=lynxos178
1406e9554658Smrg		;;
140714bc0770Smrg	lynx*5)
140814bc0770Smrg		os=lynxos5
1409e9554658Smrg		;;
141014bc0770Smrg	lynxos*)
141114bc0770Smrg		# don't get caught up in next wildcard
1412e9554658Smrg		;;
141314bc0770Smrg	lynx*)
141414bc0770Smrg		os=lynxos
1415e9554658Smrg		;;
141614bc0770Smrg	mac[0-9]*)
141714bc0770Smrg		os=`echo "$os" | sed -e 's|mac|macos|'`
1418e9554658Smrg		;;
141914bc0770Smrg	opened*)
142014bc0770Smrg		os=openedition
1421e9554658Smrg		;;
142214bc0770Smrg	os400*)
142314bc0770Smrg		os=os400
1424e9554658Smrg		;;
142514bc0770Smrg	sunos5*)
142614bc0770Smrg		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1427e9554658Smrg		;;
142814bc0770Smrg	sunos6*)
142914bc0770Smrg		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1430e9554658Smrg		;;
143114bc0770Smrg	wince*)
143214bc0770Smrg		os=wince
1433e9554658Smrg		;;
143414bc0770Smrg	utek*)
143514bc0770Smrg		os=bsd
1436e9554658Smrg		;;
143714bc0770Smrg	dynix*)
143814bc0770Smrg		os=bsd
1439e9554658Smrg		;;
144014bc0770Smrg	acis*)
144114bc0770Smrg		os=aos
1442e9554658Smrg		;;
144314bc0770Smrg	atheos*)
144414bc0770Smrg		os=atheos
1445e9554658Smrg		;;
144614bc0770Smrg	syllable*)
144714bc0770Smrg		os=syllable
144814bc0770Smrg		;;
144914bc0770Smrg	386bsd)
145014bc0770Smrg		os=bsd
145114bc0770Smrg		;;
145214bc0770Smrg	ctix* | uts*)
145314bc0770Smrg		os=sysv
145414bc0770Smrg		;;
145514bc0770Smrg	nova*)
145614bc0770Smrg		os=rtmk-nova
145714bc0770Smrg		;;
145814bc0770Smrg	ns2)
145914bc0770Smrg		os=nextstep2
146014bc0770Smrg		;;
146114bc0770Smrg	# Preserve the version number of sinix5.
146214bc0770Smrg	sinix5.*)
146314bc0770Smrg		os=`echo "$os" | sed -e 's|sinix|sysv|'`
1464e9554658Smrg		;;
146514bc0770Smrg	sinix*)
146614bc0770Smrg		os=sysv4
1467e9554658Smrg		;;
146814bc0770Smrg	tpf*)
146914bc0770Smrg		os=tpf
1470e9554658Smrg		;;
147114bc0770Smrg	triton*)
147214bc0770Smrg		os=sysv3
1473e9554658Smrg		;;
147414bc0770Smrg	oss*)
147514bc0770Smrg		os=sysv3
1476e9554658Smrg		;;
147714bc0770Smrg	svr4*)
147814bc0770Smrg		os=sysv4
1479e9554658Smrg		;;
148014bc0770Smrg	svr3)
148114bc0770Smrg		os=sysv3
1482e9554658Smrg		;;
148314bc0770Smrg	sysvr4)
148414bc0770Smrg		os=sysv4
1485e9554658Smrg		;;
148614bc0770Smrg	ose*)
148714bc0770Smrg		os=ose
1488e9554658Smrg		;;
148914bc0770Smrg	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
149014bc0770Smrg		os=mint
1491c2b339b4Smrg		;;
149214bc0770Smrg	dicos*)
149314bc0770Smrg		os=dicos
149414bc0770Smrg		;;
149514bc0770Smrg	pikeos*)
1496688b3aecSmrg		# Until real need of OS specific support for
1497688b3aecSmrg		# particular features comes up, bare metal
1498688b3aecSmrg		# configurations are quite functional.
149914bc0770Smrg		case $cpu in
1500688b3aecSmrg		    arm*)
150114bc0770Smrg			os=eabi
1502688b3aecSmrg			;;
1503688b3aecSmrg		    *)
150414bc0770Smrg			os=elf
1505688b3aecSmrg			;;
1506688b3aecSmrg		esac
1507688b3aecSmrg		;;
1508e9554658Smrg	*)
150914bc0770Smrg		# No normalization, but not necessarily accepted, that comes below.
1510e9554658Smrg		;;
1511e9554658Smrgesac
151214bc0770Smrg
1513e9554658Smrgelse
1514e9554658Smrg
1515e9554658Smrg# Here we handle the default operating systems that come with various machines.
1516e9554658Smrg# The value should be what the vendor currently ships out the door with their
1517e9554658Smrg# machine or put another way, the most popular os provided with the machine.
1518e9554658Smrg
1519e9554658Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say,
1520e9554658Smrg# "-sun"), then you have to tell the case statement up towards the top
1521e9554658Smrg# that MANUFACTURER isn't an operating system.  Otherwise, code above
1522e9554658Smrg# will signal an error saying that MANUFACTURER isn't an operating
1523e9554658Smrg# system, and we'll never get to this point.
1524e9554658Smrg
152514bc0770Smrgkernel=
152614bc0770Smrgcase $cpu-$vendor in
15275dd5f640Smrg	score-*)
152814bc0770Smrg		os=elf
1529e9554658Smrg		;;
15305dd5f640Smrg	spu-*)
153114bc0770Smrg		os=elf
1532e9554658Smrg		;;
1533e9554658Smrg	*-acorn)
153414bc0770Smrg		os=riscix1.2
1535e9554658Smrg		;;
1536e9554658Smrg	arm*-rebel)
153714bc0770Smrg		kernel=linux
153814bc0770Smrg		os=gnu
1539e9554658Smrg		;;
1540e9554658Smrg	arm*-semi)
154114bc0770Smrg		os=aout
1542e9554658Smrg		;;
15435dd5f640Smrg	c4x-* | tic4x-*)
154414bc0770Smrg		os=coff
15455dd5f640Smrg		;;
1546688b3aecSmrg	c8051-*)
154714bc0770Smrg		os=elf
154814bc0770Smrg		;;
154914bc0770Smrg	clipper-intergraph)
155014bc0770Smrg		os=clix
1551688b3aecSmrg		;;
15525dd5f640Smrg	hexagon-*)
155314bc0770Smrg		os=elf
1554e9554658Smrg		;;
15558903d43aSmrg	tic54x-*)
155614bc0770Smrg		os=coff
15578903d43aSmrg		;;
15588903d43aSmrg	tic55x-*)
155914bc0770Smrg		os=coff
15608903d43aSmrg		;;
15618903d43aSmrg	tic6x-*)
156214bc0770Smrg		os=coff
15638903d43aSmrg		;;
1564e9554658Smrg	# This must come before the *-dec entry.
1565e9554658Smrg	pdp10-*)
156614bc0770Smrg		os=tops20
1567e9554658Smrg		;;
1568e9554658Smrg	pdp11-*)
156914bc0770Smrg		os=none
1570e9554658Smrg		;;
1571e9554658Smrg	*-dec | vax-*)
157214bc0770Smrg		os=ultrix4.2
1573e9554658Smrg		;;
1574e9554658Smrg	m68*-apollo)
157514bc0770Smrg		os=domain
1576e9554658Smrg		;;
1577e9554658Smrg	i386-sun)
157814bc0770Smrg		os=sunos4.0.2
1579e9554658Smrg		;;
1580e9554658Smrg	m68000-sun)
158114bc0770Smrg		os=sunos3
1582e9554658Smrg		;;
1583e9554658Smrg	m68*-cisco)
158414bc0770Smrg		os=aout
1585e9554658Smrg		;;
15865dd5f640Smrg	mep-*)
158714bc0770Smrg		os=elf
1588c2b339b4Smrg		;;
1589e9554658Smrg	mips*-cisco)
159014bc0770Smrg		os=elf
1591e9554658Smrg		;;
1592e9554658Smrg	mips*-*)
159314bc0770Smrg		os=elf
1594e9554658Smrg		;;
1595e9554658Smrg	or32-*)
159614bc0770Smrg		os=coff
1597e9554658Smrg		;;
1598e9554658Smrg	*-tti)	# must be before sparc entry or we get the wrong os.
159914bc0770Smrg		os=sysv3
1600e9554658Smrg		;;
1601e9554658Smrg	sparc-* | *-sun)
160214bc0770Smrg		os=sunos4.1.1
1603e9554658Smrg		;;
1604688b3aecSmrg	pru-*)
160514bc0770Smrg		os=elf
1606688b3aecSmrg		;;
1607e9554658Smrg	*-be)
160814bc0770Smrg		os=beos
1609e9554658Smrg		;;
1610e9554658Smrg	*-ibm)
161114bc0770Smrg		os=aix
1612e9554658Smrg		;;
16135dd5f640Smrg	*-knuth)
161414bc0770Smrg		os=mmixware
1615e9554658Smrg		;;
1616e9554658Smrg	*-wec)
161714bc0770Smrg		os=proelf
1618e9554658Smrg		;;
1619e9554658Smrg	*-winbond)
162014bc0770Smrg		os=proelf
1621e9554658Smrg		;;
1622e9554658Smrg	*-oki)
162314bc0770Smrg		os=proelf
1624e9554658Smrg		;;
1625e9554658Smrg	*-hp)
162614bc0770Smrg		os=hpux
1627e9554658Smrg		;;
1628e9554658Smrg	*-hitachi)
162914bc0770Smrg		os=hiux
1630e9554658Smrg		;;
1631e9554658Smrg	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
163214bc0770Smrg		os=sysv
1633e9554658Smrg		;;
1634e9554658Smrg	*-cbm)
163514bc0770Smrg		os=amigaos
1636e9554658Smrg		;;
1637e9554658Smrg	*-dg)
163814bc0770Smrg		os=dgux
1639e9554658Smrg		;;
1640e9554658Smrg	*-dolphin)
164114bc0770Smrg		os=sysv3
1642e9554658Smrg		;;
1643e9554658Smrg	m68k-ccur)
164414bc0770Smrg		os=rtu
1645e9554658Smrg		;;
1646e9554658Smrg	m88k-omron*)
164714bc0770Smrg		os=luna
1648e9554658Smrg		;;
1649688b3aecSmrg	*-next)
165014bc0770Smrg		os=nextstep
1651e9554658Smrg		;;
1652e9554658Smrg	*-sequent)
165314bc0770Smrg		os=ptx
1654e9554658Smrg		;;
1655e9554658Smrg	*-crds)
165614bc0770Smrg		os=unos
1657e9554658Smrg		;;
1658e9554658Smrg	*-ns)
165914bc0770Smrg		os=genix
1660e9554658Smrg		;;
1661e9554658Smrg	i370-*)
166214bc0770Smrg		os=mvs
1663e9554658Smrg		;;
1664e9554658Smrg	*-gould)
166514bc0770Smrg		os=sysv
1666e9554658Smrg		;;
1667e9554658Smrg	*-highlevel)
166814bc0770Smrg		os=bsd
1669e9554658Smrg		;;
1670e9554658Smrg	*-encore)
167114bc0770Smrg		os=bsd
1672e9554658Smrg		;;
1673e9554658Smrg	*-sgi)
167414bc0770Smrg		os=irix
1675e9554658Smrg		;;
1676e9554658Smrg	*-siemens)
167714bc0770Smrg		os=sysv4
1678e9554658Smrg		;;
1679e9554658Smrg	*-masscomp)
168014bc0770Smrg		os=rtu
1681e9554658Smrg		;;
1682e9554658Smrg	f30[01]-fujitsu | f700-fujitsu)
168314bc0770Smrg		os=uxpv
1684e9554658Smrg		;;
1685e9554658Smrg	*-rom68k)
168614bc0770Smrg		os=coff
1687e9554658Smrg		;;
1688e9554658Smrg	*-*bug)
168914bc0770Smrg		os=coff
1690e9554658Smrg		;;
1691e9554658Smrg	*-apple)
169214bc0770Smrg		os=macos
1693e9554658Smrg		;;
1694e9554658Smrg	*-atari*)
169514bc0770Smrg		os=mint
169614bc0770Smrg		;;
169714bc0770Smrg	*-wrs)
169814bc0770Smrg		os=vxworks
1699e9554658Smrg		;;
1700e9554658Smrg	*)
170114bc0770Smrg		os=none
1702e9554658Smrg		;;
1703e9554658Smrgesac
170414bc0770Smrg
1705e9554658Smrgfi
1706e9554658Smrg
170714bc0770Smrg# Now, validate our (potentially fixed-up) OS.
170814bc0770Smrgcase $os in
170914bc0770Smrg	# Sometimes we do "kernel-libc", so those need to count as OSes.
171014bc0770Smrg	musl* | newlib* | relibc* | uclibc*)
171114bc0770Smrg		;;
171214bc0770Smrg	# Likewise for "kernel-abi"
171314bc0770Smrg	eabi* | gnueabi*)
171414bc0770Smrg		;;
171514bc0770Smrg	# VxWorks passes extra cpu info in the 4th filed.
171614bc0770Smrg	simlinux | simwindows | spe)
171714bc0770Smrg		;;
171814bc0770Smrg	# Now accept the basic system types.
171914bc0770Smrg	# The portable systems comes first.
172014bc0770Smrg	# Each alternative MUST end in a * to match a version number.
172114bc0770Smrg	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
172214bc0770Smrg	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
172314bc0770Smrg	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
172414bc0770Smrg	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
172514bc0770Smrg	     | hiux* | abug | nacl* | netware* | windows* \
172614bc0770Smrg	     | os9* | macos* | osx* | ios* \
172714bc0770Smrg	     | mpw* | magic* | mmixware* | mon960* | lnews* \
172814bc0770Smrg	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
172914bc0770Smrg	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
173014bc0770Smrg	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
173114bc0770Smrg	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
173214bc0770Smrg	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
173314bc0770Smrg	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
173414bc0770Smrg	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
173514bc0770Smrg	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
173614bc0770Smrg	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
173714bc0770Smrg	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
173814bc0770Smrg	     | chorusrdb* | cegcc* | glidix* | serenity* \
173914bc0770Smrg	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
174014bc0770Smrg	     | midipix* | mingw32* | mingw64* | mint* \
174114bc0770Smrg	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
174214bc0770Smrg	     | interix* | uwin* | mks* | rhapsody* | darwin* \
174314bc0770Smrg	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
174414bc0770Smrg	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
174514bc0770Smrg	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
174614bc0770Smrg	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
174714bc0770Smrg	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
174814bc0770Smrg	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
174914bc0770Smrg	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
175014bc0770Smrg	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
175114bc0770Smrg	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
175214bc0770Smrg		;;
175314bc0770Smrg	# This one is extra strict with allowed versions
175414bc0770Smrg	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
175514bc0770Smrg		# Don't forget version if it is 3.2v4 or newer.
175614bc0770Smrg		;;
175714bc0770Smrg	none)
175814bc0770Smrg		;;
175914bc0770Smrg	*)
176014bc0770Smrg		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
176114bc0770Smrg		exit 1
176214bc0770Smrg		;;
176314bc0770Smrgesac
176414bc0770Smrg
176514bc0770Smrg# As a final step for OS-related things, validate the OS-kernel combination
176614bc0770Smrg# (given a valid OS), if there is a kernel.
176714bc0770Smrgcase $kernel-$os in
176814bc0770Smrg	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
176914bc0770Smrg		   | linux-musl* | linux-relibc* | linux-uclibc* )
177014bc0770Smrg		;;
177114bc0770Smrg	uclinux-uclibc* )
177214bc0770Smrg		;;
177314bc0770Smrg	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
177414bc0770Smrg		# These are just libc implementations, not actual OSes, and thus
177514bc0770Smrg		# require a kernel.
177614bc0770Smrg		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
177714bc0770Smrg		exit 1
177814bc0770Smrg		;;
177914bc0770Smrg	kfreebsd*-gnu* | kopensolaris*-gnu*)
178014bc0770Smrg		;;
178114bc0770Smrg	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
178214bc0770Smrg		;;
178314bc0770Smrg	nto-qnx*)
178414bc0770Smrg		;;
178514bc0770Smrg	os2-emx)
178614bc0770Smrg		;;
178714bc0770Smrg	*-eabi* | *-gnueabi*)
178814bc0770Smrg		;;
178914bc0770Smrg	-*)
179014bc0770Smrg		# Blank kernel with real OS is always fine.
179114bc0770Smrg		;;
179214bc0770Smrg	*-*)
179314bc0770Smrg		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
179414bc0770Smrg		exit 1
179514bc0770Smrg		;;
179614bc0770Smrgesac
179714bc0770Smrg
1798e9554658Smrg# Here we handle the case where we know the os, and the CPU type, but not the
1799e9554658Smrg# manufacturer.  We pick the logical manufacturer.
180014bc0770Smrgcase $vendor in
180114bc0770Smrg	unknown)
180214bc0770Smrg		case $cpu-$os in
180314bc0770Smrg			*-riscix*)
1804e9554658Smrg				vendor=acorn
1805e9554658Smrg				;;
180614bc0770Smrg			*-sunos*)
1807e9554658Smrg				vendor=sun
1808e9554658Smrg				;;
180914bc0770Smrg			*-cnk* | *-aix*)
1810e9554658Smrg				vendor=ibm
1811e9554658Smrg				;;
181214bc0770Smrg			*-beos*)
1813e9554658Smrg				vendor=be
1814e9554658Smrg				;;
181514bc0770Smrg			*-hpux*)
1816e9554658Smrg				vendor=hp
1817e9554658Smrg				;;
181814bc0770Smrg			*-mpeix*)
1819e9554658Smrg				vendor=hp
1820e9554658Smrg				;;
182114bc0770Smrg			*-hiux*)
1822e9554658Smrg				vendor=hitachi
1823e9554658Smrg				;;
182414bc0770Smrg			*-unos*)
1825e9554658Smrg				vendor=crds
1826e9554658Smrg				;;
182714bc0770Smrg			*-dgux*)
1828e9554658Smrg				vendor=dg
1829e9554658Smrg				;;
183014bc0770Smrg			*-luna*)
1831e9554658Smrg				vendor=omron
1832e9554658Smrg				;;
183314bc0770Smrg			*-genix*)
1834e9554658Smrg				vendor=ns
1835e9554658Smrg				;;
183614bc0770Smrg			*-clix*)
183714bc0770Smrg				vendor=intergraph
183814bc0770Smrg				;;
183914bc0770Smrg			*-mvs* | *-opened*)
184014bc0770Smrg				vendor=ibm
184114bc0770Smrg				;;
184214bc0770Smrg			*-os400*)
1843e9554658Smrg				vendor=ibm
1844e9554658Smrg				;;
184514bc0770Smrg			s390-* | s390x-*)
1846e9554658Smrg				vendor=ibm
1847e9554658Smrg				;;
184814bc0770Smrg			*-ptx*)
1849e9554658Smrg				vendor=sequent
1850e9554658Smrg				;;
185114bc0770Smrg			*-tpf*)
1852e9554658Smrg				vendor=ibm
1853e9554658Smrg				;;
185414bc0770Smrg			*-vxsim* | *-vxworks* | *-windiss*)
1855e9554658Smrg				vendor=wrs
1856e9554658Smrg				;;
185714bc0770Smrg			*-aux*)
1858e9554658Smrg				vendor=apple
1859e9554658Smrg				;;
186014bc0770Smrg			*-hms*)
1861e9554658Smrg				vendor=hitachi
1862e9554658Smrg				;;
186314bc0770Smrg			*-mpw* | *-macos*)
1864e9554658Smrg				vendor=apple
1865e9554658Smrg				;;
186614bc0770Smrg			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1867e9554658Smrg				vendor=atari
1868e9554658Smrg				;;
186914bc0770Smrg			*-vos*)
1870e9554658Smrg				vendor=stratus
1871e9554658Smrg				;;
1872e9554658Smrg		esac
1873e9554658Smrg		;;
1874e9554658Smrgesac
1875e9554658Smrg
187614bc0770Smrgecho "$cpu-$vendor-${kernel:+$kernel-}$os"
1877e9554658Smrgexit
1878e9554658Smrg
1879e9554658Smrg# Local variables:
188014bc0770Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1881e9554658Smrg# time-stamp-start: "timestamp='"
1882e9554658Smrg# time-stamp-format: "%:y-%02m-%02d"
1883e9554658Smrg# time-stamp-end: "'"
1884e9554658Smrg# End:
1885