193249ebfSmrg#! /bin/sh
293249ebfSmrg# Configuration validation subroutine script.
393249ebfSmrg#   Copyright 1992-2023 Free Software Foundation, Inc.
493249ebfSmrg
593249ebfSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
693249ebfSmrg
793249ebfSmrgtimestamp='2023-01-21'
893249ebfSmrg
993249ebfSmrg# This file is free software; you can redistribute it and/or modify it
1093249ebfSmrg# under the terms of the GNU General Public License as published by
1193249ebfSmrg# the Free Software Foundation, either version 3 of the License, or
1293249ebfSmrg# (at your option) any later version.
1393249ebfSmrg#
1493249ebfSmrg# This program is distributed in the hope that it will be useful, but
1593249ebfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1693249ebfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1793249ebfSmrg# General Public License for more details.
1893249ebfSmrg#
1993249ebfSmrg# You should have received a copy of the GNU General Public License
2093249ebfSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2193249ebfSmrg#
2293249ebfSmrg# As a special exception to the GNU General Public License, if you
2393249ebfSmrg# distribute this file as part of a program that contains a
2493249ebfSmrg# configuration script generated by Autoconf, you may include it under
2593249ebfSmrg# the same distribution terms that you use for the rest of that
2693249ebfSmrg# program.  This Exception is an additional permission under section 7
2793249ebfSmrg# of the GNU General Public License, version 3 ("GPLv3").
2893249ebfSmrg
2993249ebfSmrg
3093249ebfSmrg# Please send patches to <config-patches@gnu.org>.
3193249ebfSmrg#
3293249ebfSmrg# Configuration subroutine to validate and canonicalize a configuration type.
3393249ebfSmrg# Supply the specified configuration type as an argument.
3493249ebfSmrg# If it is invalid, we print an error message on stderr and exit with code 1.
3593249ebfSmrg# Otherwise, we print the canonical config type on stdout and succeed.
3693249ebfSmrg
3793249ebfSmrg# You can get the latest version of this script from:
3893249ebfSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
3993249ebfSmrg
4093249ebfSmrg# This file is supposed to be the same for all GNU packages
4193249ebfSmrg# and recognize all the CPU types, system types and aliases
4293249ebfSmrg# that are meaningful with *any* GNU software.
4393249ebfSmrg# Each package is responsible for reporting which valid configurations
4493249ebfSmrg# it does not support.  The user should be able to distinguish
4593249ebfSmrg# a failure to support a valid configuration from a meaningless
4693249ebfSmrg# configuration.
4793249ebfSmrg
4893249ebfSmrg# The goal of this file is to map all the various variations of a given
4993249ebfSmrg# machine specification into a single specification in the form:
5093249ebfSmrg#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
5193249ebfSmrg# or in some cases, the newer four-part form:
5293249ebfSmrg#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
5393249ebfSmrg# It is wrong to echo any other type of specification.
5493249ebfSmrg
5593249ebfSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
5693249ebfSmrg# about features and limitations of the classic Bourne shell that were
5793249ebfSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
5893249ebfSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
5993249ebfSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
6093249ebfSmrg# have a pre-POSIX /bin/sh.
6193249ebfSmrg
6293249ebfSmrgme=`echo "$0" | sed -e 's,.*/,,'`
6393249ebfSmrg
6493249ebfSmrgusage="\
6593249ebfSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
6693249ebfSmrg
6793249ebfSmrgCanonicalize a configuration name.
6893249ebfSmrg
6993249ebfSmrgOptions:
7093249ebfSmrg  -h, --help         print this help, then exit
7193249ebfSmrg  -t, --time-stamp   print date of last modification, then exit
7293249ebfSmrg  -v, --version      print version number, then exit
7393249ebfSmrg
7493249ebfSmrgReport bugs and patches to <config-patches@gnu.org>."
7593249ebfSmrg
7693249ebfSmrgversion="\
7793249ebfSmrgGNU config.sub ($timestamp)
7893249ebfSmrg
7993249ebfSmrgCopyright 1992-2023 Free Software Foundation, Inc.
8093249ebfSmrg
8193249ebfSmrgThis is free software; see the source for copying conditions.  There is NO
8293249ebfSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
8393249ebfSmrg
8493249ebfSmrghelp="
8593249ebfSmrgTry \`$me --help' for more information."
8693249ebfSmrg
8793249ebfSmrg# Parse command line
8893249ebfSmrgwhile test $# -gt 0 ; do
8993249ebfSmrg  case $1 in
9093249ebfSmrg    --time-stamp | --time* | -t )
9193249ebfSmrg       echo "$timestamp" ; exit ;;
9293249ebfSmrg    --version | -v )
9393249ebfSmrg       echo "$version" ; exit ;;
9493249ebfSmrg    --help | --h* | -h )
9593249ebfSmrg       echo "$usage"; exit ;;
9693249ebfSmrg    -- )     # Stop option processing
9793249ebfSmrg       shift; break ;;
9893249ebfSmrg    - )	# Use stdin as input.
9993249ebfSmrg       break ;;
10093249ebfSmrg    -* )
10193249ebfSmrg       echo "$me: invalid option $1$help" >&2
10293249ebfSmrg       exit 1 ;;
10393249ebfSmrg
10493249ebfSmrg    *local*)
10593249ebfSmrg       # First pass through any local machine types.
10693249ebfSmrg       echo "$1"
10793249ebfSmrg       exit ;;
10893249ebfSmrg
10993249ebfSmrg    * )
11093249ebfSmrg       break ;;
11193249ebfSmrg  esac
11293249ebfSmrgdone
11393249ebfSmrg
11493249ebfSmrgcase $# in
11593249ebfSmrg 0) echo "$me: missing argument$help" >&2
11693249ebfSmrg    exit 1;;
11793249ebfSmrg 1) ;;
11893249ebfSmrg *) echo "$me: too many arguments$help" >&2
11993249ebfSmrg    exit 1;;
12093249ebfSmrgesac
12193249ebfSmrg
12293249ebfSmrg# Split fields of configuration type
12393249ebfSmrg# shellcheck disable=SC2162
12493249ebfSmrgsaved_IFS=$IFS
12593249ebfSmrgIFS="-" read field1 field2 field3 field4 <<EOF
12693249ebfSmrg$1
12793249ebfSmrgEOF
12893249ebfSmrgIFS=$saved_IFS
12993249ebfSmrg
13093249ebfSmrg# Separate into logical components for further validation
13193249ebfSmrgcase $1 in
13293249ebfSmrg	*-*-*-*-*)
13393249ebfSmrg		echo Invalid configuration \`"$1"\': more than four components >&2
13493249ebfSmrg		exit 1
13593249ebfSmrg		;;
13693249ebfSmrg	*-*-*-*)
13793249ebfSmrg		basic_machine=$field1-$field2
13893249ebfSmrg		basic_os=$field3-$field4
13993249ebfSmrg		;;
14093249ebfSmrg	*-*-*)
14193249ebfSmrg		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
14293249ebfSmrg		# parts
14393249ebfSmrg		maybe_os=$field2-$field3
14493249ebfSmrg		case $maybe_os in
14593249ebfSmrg			nto-qnx* | linux-* | uclinux-uclibc* \
14693249ebfSmrg			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
14793249ebfSmrg			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
14893249ebfSmrg			| storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
14993249ebfSmrg				basic_machine=$field1
15093249ebfSmrg				basic_os=$maybe_os
15193249ebfSmrg				;;
15293249ebfSmrg			android-linux)
15393249ebfSmrg				basic_machine=$field1-unknown
15493249ebfSmrg				basic_os=linux-android
15593249ebfSmrg				;;
15693249ebfSmrg			*)
15793249ebfSmrg				basic_machine=$field1-$field2
15893249ebfSmrg				basic_os=$field3
15993249ebfSmrg				;;
16093249ebfSmrg		esac
16193249ebfSmrg		;;
16293249ebfSmrg	*-*)
16393249ebfSmrg		# A lone config we happen to match not fitting any pattern
16493249ebfSmrg		case $field1-$field2 in
16593249ebfSmrg			decstation-3100)
16693249ebfSmrg				basic_machine=mips-dec
16793249ebfSmrg				basic_os=
16893249ebfSmrg				;;
16993249ebfSmrg			*-*)
17093249ebfSmrg				# Second component is usually, but not always the OS
17193249ebfSmrg				case $field2 in
17293249ebfSmrg					# Prevent following clause from handling this valid os
17393249ebfSmrg					sun*os*)
17493249ebfSmrg						basic_machine=$field1
17593249ebfSmrg						basic_os=$field2
17693249ebfSmrg						;;
17793249ebfSmrg					zephyr*)
17893249ebfSmrg						basic_machine=$field1-unknown
17993249ebfSmrg						basic_os=$field2
18093249ebfSmrg						;;
18193249ebfSmrg					# Manufacturers
18293249ebfSmrg					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
18393249ebfSmrg					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
18493249ebfSmrg					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
18593249ebfSmrg					| convergent* | ncr* | news | 32* | 3600* | 3100* \
18693249ebfSmrg					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
18793249ebfSmrg					| ultra | tti* | harris | dolphin | highlevel | gould \
18893249ebfSmrg					| cbm | ns | masscomp | apple | axis | knuth | cray \
18993249ebfSmrg					| microblaze* | sim | cisco \
19093249ebfSmrg					| oki | wec | wrs | winbond)
19193249ebfSmrg						basic_machine=$field1-$field2
19293249ebfSmrg						basic_os=
19393249ebfSmrg						;;
19493249ebfSmrg					*)
19593249ebfSmrg						basic_machine=$field1
19693249ebfSmrg						basic_os=$field2
19793249ebfSmrg						;;
19893249ebfSmrg				esac
19993249ebfSmrg			;;
20093249ebfSmrg		esac
20193249ebfSmrg		;;
20293249ebfSmrg	*)
20393249ebfSmrg		# Convert single-component short-hands not valid as part of
20493249ebfSmrg		# multi-component configurations.
20593249ebfSmrg		case $field1 in
20693249ebfSmrg			386bsd)
20793249ebfSmrg				basic_machine=i386-pc
20893249ebfSmrg				basic_os=bsd
20993249ebfSmrg				;;
21093249ebfSmrg			a29khif)
21193249ebfSmrg				basic_machine=a29k-amd
21293249ebfSmrg				basic_os=udi
21393249ebfSmrg				;;
21493249ebfSmrg			adobe68k)
21593249ebfSmrg				basic_machine=m68010-adobe
21693249ebfSmrg				basic_os=scout
21793249ebfSmrg				;;
21893249ebfSmrg			alliant)
21993249ebfSmrg				basic_machine=fx80-alliant
22093249ebfSmrg				basic_os=
22193249ebfSmrg				;;
22293249ebfSmrg			altos | altos3068)
22393249ebfSmrg				basic_machine=m68k-altos
22493249ebfSmrg				basic_os=
22593249ebfSmrg				;;
22693249ebfSmrg			am29k)
22793249ebfSmrg				basic_machine=a29k-none
22893249ebfSmrg				basic_os=bsd
22993249ebfSmrg				;;
23093249ebfSmrg			amdahl)
23193249ebfSmrg				basic_machine=580-amdahl
23293249ebfSmrg				basic_os=sysv
23393249ebfSmrg				;;
23493249ebfSmrg			amiga)
23593249ebfSmrg				basic_machine=m68k-unknown
23693249ebfSmrg				basic_os=
23793249ebfSmrg				;;
23893249ebfSmrg			amigaos | amigados)
23993249ebfSmrg				basic_machine=m68k-unknown
24093249ebfSmrg				basic_os=amigaos
24193249ebfSmrg				;;
24293249ebfSmrg			amigaunix | amix)
24393249ebfSmrg				basic_machine=m68k-unknown
24493249ebfSmrg				basic_os=sysv4
24593249ebfSmrg				;;
24693249ebfSmrg			apollo68)
24793249ebfSmrg				basic_machine=m68k-apollo
24893249ebfSmrg				basic_os=sysv
24993249ebfSmrg				;;
25093249ebfSmrg			apollo68bsd)
25193249ebfSmrg				basic_machine=m68k-apollo
25293249ebfSmrg				basic_os=bsd
25393249ebfSmrg				;;
25493249ebfSmrg			aros)
25593249ebfSmrg				basic_machine=i386-pc
25693249ebfSmrg				basic_os=aros
25793249ebfSmrg				;;
25893249ebfSmrg			aux)
25993249ebfSmrg				basic_machine=m68k-apple
26093249ebfSmrg				basic_os=aux
26193249ebfSmrg				;;
26293249ebfSmrg			balance)
26393249ebfSmrg				basic_machine=ns32k-sequent
26493249ebfSmrg				basic_os=dynix
26593249ebfSmrg				;;
26693249ebfSmrg			blackfin)
26793249ebfSmrg				basic_machine=bfin-unknown
26893249ebfSmrg				basic_os=linux
26993249ebfSmrg				;;
27093249ebfSmrg			cegcc)
27193249ebfSmrg				basic_machine=arm-unknown
27293249ebfSmrg				basic_os=cegcc
27393249ebfSmrg				;;
27493249ebfSmrg			convex-c1)
27593249ebfSmrg				basic_machine=c1-convex
27693249ebfSmrg				basic_os=bsd
27793249ebfSmrg				;;
27893249ebfSmrg			convex-c2)
27993249ebfSmrg				basic_machine=c2-convex
28093249ebfSmrg				basic_os=bsd
28193249ebfSmrg				;;
28293249ebfSmrg			convex-c32)
28393249ebfSmrg				basic_machine=c32-convex
28493249ebfSmrg				basic_os=bsd
28593249ebfSmrg				;;
28693249ebfSmrg			convex-c34)
28793249ebfSmrg				basic_machine=c34-convex
28893249ebfSmrg				basic_os=bsd
28993249ebfSmrg				;;
29093249ebfSmrg			convex-c38)
29193249ebfSmrg				basic_machine=c38-convex
29293249ebfSmrg				basic_os=bsd
29393249ebfSmrg				;;
29493249ebfSmrg			cray)
29593249ebfSmrg				basic_machine=j90-cray
29693249ebfSmrg				basic_os=unicos
29793249ebfSmrg				;;
29893249ebfSmrg			crds | unos)
29993249ebfSmrg				basic_machine=m68k-crds
30093249ebfSmrg				basic_os=
30193249ebfSmrg				;;
30293249ebfSmrg			da30)
30393249ebfSmrg				basic_machine=m68k-da30
30493249ebfSmrg				basic_os=
30593249ebfSmrg				;;
30693249ebfSmrg			decstation | pmax | pmin | dec3100 | decstatn)
30793249ebfSmrg				basic_machine=mips-dec
30893249ebfSmrg				basic_os=
30993249ebfSmrg				;;
31093249ebfSmrg			delta88)
31193249ebfSmrg				basic_machine=m88k-motorola
31293249ebfSmrg				basic_os=sysv3
31393249ebfSmrg				;;
31493249ebfSmrg			dicos)
31593249ebfSmrg				basic_machine=i686-pc
31693249ebfSmrg				basic_os=dicos
31793249ebfSmrg				;;
31893249ebfSmrg			djgpp)
31993249ebfSmrg				basic_machine=i586-pc
32093249ebfSmrg				basic_os=msdosdjgpp
32193249ebfSmrg				;;
32293249ebfSmrg			ebmon29k)
32393249ebfSmrg				basic_machine=a29k-amd
32493249ebfSmrg				basic_os=ebmon
32593249ebfSmrg				;;
32693249ebfSmrg			es1800 | OSE68k | ose68k | ose | OSE)
32793249ebfSmrg				basic_machine=m68k-ericsson
32893249ebfSmrg				basic_os=ose
32993249ebfSmrg				;;
33093249ebfSmrg			gmicro)
33193249ebfSmrg				basic_machine=tron-gmicro
33293249ebfSmrg				basic_os=sysv
33393249ebfSmrg				;;
33493249ebfSmrg			go32)
33593249ebfSmrg				basic_machine=i386-pc
33693249ebfSmrg				basic_os=go32
33793249ebfSmrg				;;
33893249ebfSmrg			h8300hms)
33993249ebfSmrg				basic_machine=h8300-hitachi
34093249ebfSmrg				basic_os=hms
34193249ebfSmrg				;;
34293249ebfSmrg			h8300xray)
34393249ebfSmrg				basic_machine=h8300-hitachi
34493249ebfSmrg				basic_os=xray
34593249ebfSmrg				;;
34693249ebfSmrg			h8500hms)
34793249ebfSmrg				basic_machine=h8500-hitachi
34893249ebfSmrg				basic_os=hms
34993249ebfSmrg				;;
35093249ebfSmrg			harris)
35193249ebfSmrg				basic_machine=m88k-harris
35293249ebfSmrg				basic_os=sysv3
35393249ebfSmrg				;;
35493249ebfSmrg			hp300 | hp300hpux)
35593249ebfSmrg				basic_machine=m68k-hp
35693249ebfSmrg				basic_os=hpux
35793249ebfSmrg				;;
35893249ebfSmrg			hp300bsd)
35993249ebfSmrg				basic_machine=m68k-hp
36093249ebfSmrg				basic_os=bsd
36193249ebfSmrg				;;
36293249ebfSmrg			hppaosf)
36393249ebfSmrg				basic_machine=hppa1.1-hp
36493249ebfSmrg				basic_os=osf
36593249ebfSmrg				;;
36693249ebfSmrg			hppro)
36793249ebfSmrg				basic_machine=hppa1.1-hp
36893249ebfSmrg				basic_os=proelf
36993249ebfSmrg				;;
37093249ebfSmrg			i386mach)
37193249ebfSmrg				basic_machine=i386-mach
37293249ebfSmrg				basic_os=mach
37393249ebfSmrg				;;
37493249ebfSmrg			isi68 | isi)
37593249ebfSmrg				basic_machine=m68k-isi
37693249ebfSmrg				basic_os=sysv
37793249ebfSmrg				;;
37893249ebfSmrg			m68knommu)
37993249ebfSmrg				basic_machine=m68k-unknown
38093249ebfSmrg				basic_os=linux
38193249ebfSmrg				;;
38293249ebfSmrg			magnum | m3230)
38393249ebfSmrg				basic_machine=mips-mips
38493249ebfSmrg				basic_os=sysv
38593249ebfSmrg				;;
38693249ebfSmrg			merlin)
38793249ebfSmrg				basic_machine=ns32k-utek
38893249ebfSmrg				basic_os=sysv
38993249ebfSmrg				;;
39093249ebfSmrg			mingw64)
39193249ebfSmrg				basic_machine=x86_64-pc
39293249ebfSmrg				basic_os=mingw64
39393249ebfSmrg				;;
39493249ebfSmrg			mingw32)
39593249ebfSmrg				basic_machine=i686-pc
39693249ebfSmrg				basic_os=mingw32
39793249ebfSmrg				;;
39893249ebfSmrg			mingw32ce)
39993249ebfSmrg				basic_machine=arm-unknown
40093249ebfSmrg				basic_os=mingw32ce
40193249ebfSmrg				;;
40293249ebfSmrg			monitor)
40393249ebfSmrg				basic_machine=m68k-rom68k
40493249ebfSmrg				basic_os=coff
40593249ebfSmrg				;;
40693249ebfSmrg			morphos)
40793249ebfSmrg				basic_machine=powerpc-unknown
40893249ebfSmrg				basic_os=morphos
40993249ebfSmrg				;;
41093249ebfSmrg			moxiebox)
41193249ebfSmrg				basic_machine=moxie-unknown
41293249ebfSmrg				basic_os=moxiebox
41393249ebfSmrg				;;
41493249ebfSmrg			msdos)
41593249ebfSmrg				basic_machine=i386-pc
41693249ebfSmrg				basic_os=msdos
41793249ebfSmrg				;;
41893249ebfSmrg			msys)
41993249ebfSmrg				basic_machine=i686-pc
42093249ebfSmrg				basic_os=msys
42193249ebfSmrg				;;
42293249ebfSmrg			mvs)
42393249ebfSmrg				basic_machine=i370-ibm
42493249ebfSmrg				basic_os=mvs
42593249ebfSmrg				;;
42693249ebfSmrg			nacl)
42793249ebfSmrg				basic_machine=le32-unknown
42893249ebfSmrg				basic_os=nacl
42993249ebfSmrg				;;
43093249ebfSmrg			ncr3000)
43193249ebfSmrg				basic_machine=i486-ncr
43293249ebfSmrg				basic_os=sysv4
43393249ebfSmrg				;;
43493249ebfSmrg			netbsd386)
43593249ebfSmrg				basic_machine=i386-pc
43693249ebfSmrg				basic_os=netbsd
43793249ebfSmrg				;;
43893249ebfSmrg			netwinder)
43993249ebfSmrg				basic_machine=armv4l-rebel
44093249ebfSmrg				basic_os=linux
44193249ebfSmrg				;;
44293249ebfSmrg			news | news700 | news800 | news900)
44393249ebfSmrg				basic_machine=m68k-sony
44493249ebfSmrg				basic_os=newsos
44593249ebfSmrg				;;
44693249ebfSmrg			news1000)
44793249ebfSmrg				basic_machine=m68030-sony
44893249ebfSmrg				basic_os=newsos
44993249ebfSmrg				;;
45093249ebfSmrg			necv70)
45193249ebfSmrg				basic_machine=v70-nec
45293249ebfSmrg				basic_os=sysv
45393249ebfSmrg				;;
45493249ebfSmrg			nh3000)
45593249ebfSmrg				basic_machine=m68k-harris
45693249ebfSmrg				basic_os=cxux
45793249ebfSmrg				;;
45893249ebfSmrg			nh[45]000)
45993249ebfSmrg				basic_machine=m88k-harris
46093249ebfSmrg				basic_os=cxux
46193249ebfSmrg				;;
46293249ebfSmrg			nindy960)
46393249ebfSmrg				basic_machine=i960-intel
46493249ebfSmrg				basic_os=nindy
46593249ebfSmrg				;;
46693249ebfSmrg			mon960)
46793249ebfSmrg				basic_machine=i960-intel
46893249ebfSmrg				basic_os=mon960
46993249ebfSmrg				;;
47093249ebfSmrg			nonstopux)
47193249ebfSmrg				basic_machine=mips-compaq
47293249ebfSmrg				basic_os=nonstopux
47393249ebfSmrg				;;
47493249ebfSmrg			os400)
47593249ebfSmrg				basic_machine=powerpc-ibm
47693249ebfSmrg				basic_os=os400
47793249ebfSmrg				;;
47893249ebfSmrg			OSE68000 | ose68000)
47993249ebfSmrg				basic_machine=m68000-ericsson
48093249ebfSmrg				basic_os=ose
48193249ebfSmrg				;;
48293249ebfSmrg			os68k)
48393249ebfSmrg				basic_machine=m68k-none
48493249ebfSmrg				basic_os=os68k
48593249ebfSmrg				;;
48693249ebfSmrg			paragon)
48793249ebfSmrg				basic_machine=i860-intel
48893249ebfSmrg				basic_os=osf
48993249ebfSmrg				;;
49093249ebfSmrg			parisc)
49193249ebfSmrg				basic_machine=hppa-unknown
49293249ebfSmrg				basic_os=linux
49393249ebfSmrg				;;
49493249ebfSmrg			psp)
49593249ebfSmrg				basic_machine=mipsallegrexel-sony
49693249ebfSmrg				basic_os=psp
49793249ebfSmrg				;;
49893249ebfSmrg			pw32)
49993249ebfSmrg				basic_machine=i586-unknown
50093249ebfSmrg				basic_os=pw32
50193249ebfSmrg				;;
50293249ebfSmrg			rdos | rdos64)
50393249ebfSmrg				basic_machine=x86_64-pc
50493249ebfSmrg				basic_os=rdos
50593249ebfSmrg				;;
50693249ebfSmrg			rdos32)
50793249ebfSmrg				basic_machine=i386-pc
50893249ebfSmrg				basic_os=rdos
50993249ebfSmrg				;;
51093249ebfSmrg			rom68k)
51193249ebfSmrg				basic_machine=m68k-rom68k
51293249ebfSmrg				basic_os=coff
51393249ebfSmrg				;;
51493249ebfSmrg			sa29200)
51593249ebfSmrg				basic_machine=a29k-amd
51693249ebfSmrg				basic_os=udi
51793249ebfSmrg				;;
51893249ebfSmrg			sei)
51993249ebfSmrg				basic_machine=mips-sei
52093249ebfSmrg				basic_os=seiux
52193249ebfSmrg				;;
52293249ebfSmrg			sequent)
52393249ebfSmrg				basic_machine=i386-sequent
52493249ebfSmrg				basic_os=
52593249ebfSmrg				;;
52693249ebfSmrg			sps7)
52793249ebfSmrg				basic_machine=m68k-bull
52893249ebfSmrg				basic_os=sysv2
52993249ebfSmrg				;;
53093249ebfSmrg			st2000)
53193249ebfSmrg				basic_machine=m68k-tandem
53293249ebfSmrg				basic_os=
53393249ebfSmrg				;;
53493249ebfSmrg			stratus)
53593249ebfSmrg				basic_machine=i860-stratus
53693249ebfSmrg				basic_os=sysv4
53793249ebfSmrg				;;
53893249ebfSmrg			sun2)
53993249ebfSmrg				basic_machine=m68000-sun
54093249ebfSmrg				basic_os=
54193249ebfSmrg				;;
54293249ebfSmrg			sun2os3)
54393249ebfSmrg				basic_machine=m68000-sun
54493249ebfSmrg				basic_os=sunos3
54593249ebfSmrg				;;
54693249ebfSmrg			sun2os4)
54793249ebfSmrg				basic_machine=m68000-sun
54893249ebfSmrg				basic_os=sunos4
54993249ebfSmrg				;;
55093249ebfSmrg			sun3)
55193249ebfSmrg				basic_machine=m68k-sun
55293249ebfSmrg				basic_os=
55393249ebfSmrg				;;
55493249ebfSmrg			sun3os3)
55593249ebfSmrg				basic_machine=m68k-sun
55693249ebfSmrg				basic_os=sunos3
55793249ebfSmrg				;;
55893249ebfSmrg			sun3os4)
55993249ebfSmrg				basic_machine=m68k-sun
56093249ebfSmrg				basic_os=sunos4
56193249ebfSmrg				;;
56293249ebfSmrg			sun4)
56393249ebfSmrg				basic_machine=sparc-sun
56493249ebfSmrg				basic_os=
56593249ebfSmrg				;;
56693249ebfSmrg			sun4os3)
56793249ebfSmrg				basic_machine=sparc-sun
56893249ebfSmrg				basic_os=sunos3
56993249ebfSmrg				;;
57093249ebfSmrg			sun4os4)
57193249ebfSmrg				basic_machine=sparc-sun
57293249ebfSmrg				basic_os=sunos4
57393249ebfSmrg				;;
57493249ebfSmrg			sun4sol2)
57593249ebfSmrg				basic_machine=sparc-sun
57693249ebfSmrg				basic_os=solaris2
57793249ebfSmrg				;;
57893249ebfSmrg			sun386 | sun386i | roadrunner)
57993249ebfSmrg				basic_machine=i386-sun
58093249ebfSmrg				basic_os=
58193249ebfSmrg				;;
58293249ebfSmrg			sv1)
58393249ebfSmrg				basic_machine=sv1-cray
58493249ebfSmrg				basic_os=unicos
58593249ebfSmrg				;;
58693249ebfSmrg			symmetry)
58793249ebfSmrg				basic_machine=i386-sequent
58893249ebfSmrg				basic_os=dynix
58993249ebfSmrg				;;
59093249ebfSmrg			t3e)
59193249ebfSmrg				basic_machine=alphaev5-cray
59293249ebfSmrg				basic_os=unicos
59393249ebfSmrg				;;
59493249ebfSmrg			t90)
59593249ebfSmrg				basic_machine=t90-cray
59693249ebfSmrg				basic_os=unicos
59793249ebfSmrg				;;
59893249ebfSmrg			toad1)
59993249ebfSmrg				basic_machine=pdp10-xkl
60093249ebfSmrg				basic_os=tops20
60193249ebfSmrg				;;
60293249ebfSmrg			tpf)
60393249ebfSmrg				basic_machine=s390x-ibm
60493249ebfSmrg				basic_os=tpf
60593249ebfSmrg				;;
60693249ebfSmrg			udi29k)
60793249ebfSmrg				basic_machine=a29k-amd
60893249ebfSmrg				basic_os=udi
60993249ebfSmrg				;;
61093249ebfSmrg			ultra3)
61193249ebfSmrg				basic_machine=a29k-nyu
61293249ebfSmrg				basic_os=sym1
61393249ebfSmrg				;;
61493249ebfSmrg			v810 | necv810)
61593249ebfSmrg				basic_machine=v810-nec
61693249ebfSmrg				basic_os=none
61793249ebfSmrg				;;
61893249ebfSmrg			vaxv)
61993249ebfSmrg				basic_machine=vax-dec
62093249ebfSmrg				basic_os=sysv
62193249ebfSmrg				;;
62293249ebfSmrg			vms)
62393249ebfSmrg				basic_machine=vax-dec
62493249ebfSmrg				basic_os=vms
62593249ebfSmrg				;;
62693249ebfSmrg			vsta)
62793249ebfSmrg				basic_machine=i386-pc
62893249ebfSmrg				basic_os=vsta
62993249ebfSmrg				;;
63093249ebfSmrg			vxworks960)
63193249ebfSmrg				basic_machine=i960-wrs
63293249ebfSmrg				basic_os=vxworks
63393249ebfSmrg				;;
63493249ebfSmrg			vxworks68)
63593249ebfSmrg				basic_machine=m68k-wrs
63693249ebfSmrg				basic_os=vxworks
63793249ebfSmrg				;;
63893249ebfSmrg			vxworks29k)
63993249ebfSmrg				basic_machine=a29k-wrs
64093249ebfSmrg				basic_os=vxworks
64193249ebfSmrg				;;
64293249ebfSmrg			xbox)
64393249ebfSmrg				basic_machine=i686-pc
64493249ebfSmrg				basic_os=mingw32
64593249ebfSmrg				;;
64693249ebfSmrg			ymp)
64793249ebfSmrg				basic_machine=ymp-cray
64893249ebfSmrg				basic_os=unicos
64993249ebfSmrg				;;
65093249ebfSmrg			*)
65193249ebfSmrg				basic_machine=$1
65293249ebfSmrg				basic_os=
65393249ebfSmrg				;;
65493249ebfSmrg		esac
65593249ebfSmrg		;;
65693249ebfSmrgesac
65793249ebfSmrg
65893249ebfSmrg# Decode 1-component or ad-hoc basic machines
65993249ebfSmrgcase $basic_machine in
66093249ebfSmrg	# Here we handle the default manufacturer of certain CPU types.  It is in
66193249ebfSmrg	# some cases the only manufacturer, in others, it is the most popular.
66293249ebfSmrg	w89k)
66393249ebfSmrg		cpu=hppa1.1
66493249ebfSmrg		vendor=winbond
66593249ebfSmrg		;;
66693249ebfSmrg	op50n)
66793249ebfSmrg		cpu=hppa1.1
66893249ebfSmrg		vendor=oki
66993249ebfSmrg		;;
67093249ebfSmrg	op60c)
67193249ebfSmrg		cpu=hppa1.1
67293249ebfSmrg		vendor=oki
67393249ebfSmrg		;;
67493249ebfSmrg	ibm*)
67593249ebfSmrg		cpu=i370
67693249ebfSmrg		vendor=ibm
67793249ebfSmrg		;;
67893249ebfSmrg	orion105)
67993249ebfSmrg		cpu=clipper
68093249ebfSmrg		vendor=highlevel
68193249ebfSmrg		;;
68293249ebfSmrg	mac | mpw | mac-mpw)
68393249ebfSmrg		cpu=m68k
68493249ebfSmrg		vendor=apple
68593249ebfSmrg		;;
68693249ebfSmrg	pmac | pmac-mpw)
68793249ebfSmrg		cpu=powerpc
68893249ebfSmrg		vendor=apple
68993249ebfSmrg		;;
69093249ebfSmrg
69193249ebfSmrg	# Recognize the various machine names and aliases which stand
69293249ebfSmrg	# for a CPU type and a company and sometimes even an OS.
69393249ebfSmrg	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
69493249ebfSmrg		cpu=m68000
69593249ebfSmrg		vendor=att
69693249ebfSmrg		;;
69793249ebfSmrg	3b*)
69893249ebfSmrg		cpu=we32k
69993249ebfSmrg		vendor=att
70093249ebfSmrg		;;
70193249ebfSmrg	bluegene*)
70293249ebfSmrg		cpu=powerpc
70393249ebfSmrg		vendor=ibm
70493249ebfSmrg		basic_os=cnk
70593249ebfSmrg		;;
70693249ebfSmrg	decsystem10* | dec10*)
70793249ebfSmrg		cpu=pdp10
70893249ebfSmrg		vendor=dec
70993249ebfSmrg		basic_os=tops10
71093249ebfSmrg		;;
71193249ebfSmrg	decsystem20* | dec20*)
71293249ebfSmrg		cpu=pdp10
71393249ebfSmrg		vendor=dec
71493249ebfSmrg		basic_os=tops20
71593249ebfSmrg		;;
71693249ebfSmrg	delta | 3300 | motorola-3300 | motorola-delta \
71793249ebfSmrg	      | 3300-motorola | delta-motorola)
71893249ebfSmrg		cpu=m68k
71993249ebfSmrg		vendor=motorola
72093249ebfSmrg		;;
72193249ebfSmrg	dpx2*)
72293249ebfSmrg		cpu=m68k
72393249ebfSmrg		vendor=bull
72493249ebfSmrg		basic_os=sysv3
72593249ebfSmrg		;;
72693249ebfSmrg	encore | umax | mmax)
72793249ebfSmrg		cpu=ns32k
72893249ebfSmrg		vendor=encore
72993249ebfSmrg		;;
73093249ebfSmrg	elxsi)
73193249ebfSmrg		cpu=elxsi
73293249ebfSmrg		vendor=elxsi
73393249ebfSmrg		basic_os=${basic_os:-bsd}
73493249ebfSmrg		;;
73593249ebfSmrg	fx2800)
73693249ebfSmrg		cpu=i860
73793249ebfSmrg		vendor=alliant
73893249ebfSmrg		;;
73993249ebfSmrg	genix)
74093249ebfSmrg		cpu=ns32k
74193249ebfSmrg		vendor=ns
74293249ebfSmrg		;;
74393249ebfSmrg	h3050r* | hiux*)
74493249ebfSmrg		cpu=hppa1.1
74593249ebfSmrg		vendor=hitachi
74693249ebfSmrg		basic_os=hiuxwe2
74793249ebfSmrg		;;
74893249ebfSmrg	hp3k9[0-9][0-9] | hp9[0-9][0-9])
74993249ebfSmrg		cpu=hppa1.0
75093249ebfSmrg		vendor=hp
75193249ebfSmrg		;;
75293249ebfSmrg	hp9k2[0-9][0-9] | hp9k31[0-9])
75393249ebfSmrg		cpu=m68000
75493249ebfSmrg		vendor=hp
75593249ebfSmrg		;;
75693249ebfSmrg	hp9k3[2-9][0-9])
75793249ebfSmrg		cpu=m68k
75893249ebfSmrg		vendor=hp
75993249ebfSmrg		;;
76093249ebfSmrg	hp9k6[0-9][0-9] | hp6[0-9][0-9])
76193249ebfSmrg		cpu=hppa1.0
76293249ebfSmrg		vendor=hp
76393249ebfSmrg		;;
76493249ebfSmrg	hp9k7[0-79][0-9] | hp7[0-79][0-9])
76593249ebfSmrg		cpu=hppa1.1
76693249ebfSmrg		vendor=hp
76793249ebfSmrg		;;
76893249ebfSmrg	hp9k78[0-9] | hp78[0-9])
76993249ebfSmrg		# FIXME: really hppa2.0-hp
77093249ebfSmrg		cpu=hppa1.1
77193249ebfSmrg		vendor=hp
77293249ebfSmrg		;;
77393249ebfSmrg	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
77493249ebfSmrg		# FIXME: really hppa2.0-hp
77593249ebfSmrg		cpu=hppa1.1
77693249ebfSmrg		vendor=hp
77793249ebfSmrg		;;
77893249ebfSmrg	hp9k8[0-9][13679] | hp8[0-9][13679])
77993249ebfSmrg		cpu=hppa1.1
78093249ebfSmrg		vendor=hp
78193249ebfSmrg		;;
78293249ebfSmrg	hp9k8[0-9][0-9] | hp8[0-9][0-9])
78393249ebfSmrg		cpu=hppa1.0
78493249ebfSmrg		vendor=hp
78593249ebfSmrg		;;
78693249ebfSmrg	i*86v32)
78793249ebfSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
78893249ebfSmrg		vendor=pc
78993249ebfSmrg		basic_os=sysv32
79093249ebfSmrg		;;
79193249ebfSmrg	i*86v4*)
79293249ebfSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79393249ebfSmrg		vendor=pc
79493249ebfSmrg		basic_os=sysv4
79593249ebfSmrg		;;
79693249ebfSmrg	i*86v)
79793249ebfSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79893249ebfSmrg		vendor=pc
79993249ebfSmrg		basic_os=sysv
80093249ebfSmrg		;;
80193249ebfSmrg	i*86sol2)
80293249ebfSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
80393249ebfSmrg		vendor=pc
80493249ebfSmrg		basic_os=solaris2
80593249ebfSmrg		;;
80693249ebfSmrg	j90 | j90-cray)
80793249ebfSmrg		cpu=j90
80893249ebfSmrg		vendor=cray
80993249ebfSmrg		basic_os=${basic_os:-unicos}
81093249ebfSmrg		;;
81193249ebfSmrg	iris | iris4d)
81293249ebfSmrg		cpu=mips
81393249ebfSmrg		vendor=sgi
81493249ebfSmrg		case $basic_os in
81593249ebfSmrg		    irix*)
81693249ebfSmrg			;;
81793249ebfSmrg		    *)
81893249ebfSmrg			basic_os=irix4
81993249ebfSmrg			;;
82093249ebfSmrg		esac
82193249ebfSmrg		;;
82293249ebfSmrg	miniframe)
82393249ebfSmrg		cpu=m68000
82493249ebfSmrg		vendor=convergent
82593249ebfSmrg		;;
82693249ebfSmrg	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
82793249ebfSmrg		cpu=m68k
82893249ebfSmrg		vendor=atari
82993249ebfSmrg		basic_os=mint
83093249ebfSmrg		;;
83193249ebfSmrg	news-3600 | risc-news)
83293249ebfSmrg		cpu=mips
83393249ebfSmrg		vendor=sony
83493249ebfSmrg		basic_os=newsos
83593249ebfSmrg		;;
83693249ebfSmrg	next | m*-next)
83793249ebfSmrg		cpu=m68k
83893249ebfSmrg		vendor=next
83993249ebfSmrg		case $basic_os in
84093249ebfSmrg		    openstep*)
84193249ebfSmrg		        ;;
84293249ebfSmrg		    nextstep*)
84393249ebfSmrg			;;
84493249ebfSmrg		    ns2*)
84593249ebfSmrg		      basic_os=nextstep2
84693249ebfSmrg			;;
84793249ebfSmrg		    *)
84893249ebfSmrg		      basic_os=nextstep3
84993249ebfSmrg			;;
85093249ebfSmrg		esac
85193249ebfSmrg		;;
85293249ebfSmrg	np1)
85393249ebfSmrg		cpu=np1
85493249ebfSmrg		vendor=gould
85593249ebfSmrg		;;
85693249ebfSmrg	op50n-* | op60c-*)
85793249ebfSmrg		cpu=hppa1.1
85893249ebfSmrg		vendor=oki
85993249ebfSmrg		basic_os=proelf
86093249ebfSmrg		;;
86193249ebfSmrg	pa-hitachi)
86293249ebfSmrg		cpu=hppa1.1
86393249ebfSmrg		vendor=hitachi
86493249ebfSmrg		basic_os=hiuxwe2
86593249ebfSmrg		;;
86693249ebfSmrg	pbd)
86793249ebfSmrg		cpu=sparc
86893249ebfSmrg		vendor=tti
86993249ebfSmrg		;;
87093249ebfSmrg	pbb)
87193249ebfSmrg		cpu=m68k
87293249ebfSmrg		vendor=tti
87393249ebfSmrg		;;
87493249ebfSmrg	pc532)
87593249ebfSmrg		cpu=ns32k
87693249ebfSmrg		vendor=pc532
87793249ebfSmrg		;;
87893249ebfSmrg	pn)
87993249ebfSmrg		cpu=pn
88093249ebfSmrg		vendor=gould
88193249ebfSmrg		;;
88293249ebfSmrg	power)
88393249ebfSmrg		cpu=power
88493249ebfSmrg		vendor=ibm
88593249ebfSmrg		;;
88693249ebfSmrg	ps2)
88793249ebfSmrg		cpu=i386
88893249ebfSmrg		vendor=ibm
88993249ebfSmrg		;;
89093249ebfSmrg	rm[46]00)
89193249ebfSmrg		cpu=mips
89293249ebfSmrg		vendor=siemens
89393249ebfSmrg		;;
89493249ebfSmrg	rtpc | rtpc-*)
89593249ebfSmrg		cpu=romp
89693249ebfSmrg		vendor=ibm
89793249ebfSmrg		;;
89893249ebfSmrg	sde)
89993249ebfSmrg		cpu=mipsisa32
90093249ebfSmrg		vendor=sde
90193249ebfSmrg		basic_os=${basic_os:-elf}
90293249ebfSmrg		;;
90393249ebfSmrg	simso-wrs)
90493249ebfSmrg		cpu=sparclite
90593249ebfSmrg		vendor=wrs
90693249ebfSmrg		basic_os=vxworks
90793249ebfSmrg		;;
90893249ebfSmrg	tower | tower-32)
90993249ebfSmrg		cpu=m68k
91093249ebfSmrg		vendor=ncr
91193249ebfSmrg		;;
91293249ebfSmrg	vpp*|vx|vx-*)
91393249ebfSmrg		cpu=f301
91493249ebfSmrg		vendor=fujitsu
91593249ebfSmrg		;;
91693249ebfSmrg	w65)
91793249ebfSmrg		cpu=w65
91893249ebfSmrg		vendor=wdc
91993249ebfSmrg		;;
92093249ebfSmrg	w89k-*)
92193249ebfSmrg		cpu=hppa1.1
92293249ebfSmrg		vendor=winbond
92393249ebfSmrg		basic_os=proelf
92493249ebfSmrg		;;
92593249ebfSmrg	none)
92693249ebfSmrg		cpu=none
92793249ebfSmrg		vendor=none
92893249ebfSmrg		;;
92993249ebfSmrg	leon|leon[3-9])
93093249ebfSmrg		cpu=sparc
93193249ebfSmrg		vendor=$basic_machine
93293249ebfSmrg		;;
93393249ebfSmrg	leon-*|leon[3-9]-*)
93493249ebfSmrg		cpu=sparc
93593249ebfSmrg		vendor=`echo "$basic_machine" | sed 's/-.*//'`
93693249ebfSmrg		;;
93793249ebfSmrg
93893249ebfSmrg	*-*)
93993249ebfSmrg		# shellcheck disable=SC2162
94093249ebfSmrg		saved_IFS=$IFS
94193249ebfSmrg		IFS="-" read cpu vendor <<EOF
94293249ebfSmrg$basic_machine
94393249ebfSmrgEOF
94493249ebfSmrg		IFS=$saved_IFS
94593249ebfSmrg		;;
94693249ebfSmrg	# We use `pc' rather than `unknown'
94793249ebfSmrg	# because (1) that's what they normally are, and
94893249ebfSmrg	# (2) the word "unknown" tends to confuse beginning users.
94993249ebfSmrg	i*86 | x86_64)
95093249ebfSmrg		cpu=$basic_machine
95193249ebfSmrg		vendor=pc
95293249ebfSmrg		;;
95393249ebfSmrg	# These rules are duplicated from below for sake of the special case above;
95493249ebfSmrg	# i.e. things that normalized to x86 arches should also default to "pc"
95593249ebfSmrg	pc98)
95693249ebfSmrg		cpu=i386
95793249ebfSmrg		vendor=pc
95893249ebfSmrg		;;
95993249ebfSmrg	x64 | amd64)
96093249ebfSmrg		cpu=x86_64
96193249ebfSmrg		vendor=pc
96293249ebfSmrg		;;
96393249ebfSmrg	# Recognize the basic CPU types without company name.
96493249ebfSmrg	*)
96593249ebfSmrg		cpu=$basic_machine
96693249ebfSmrg		vendor=unknown
96793249ebfSmrg		;;
96893249ebfSmrgesac
96993249ebfSmrg
97093249ebfSmrgunset -v basic_machine
97193249ebfSmrg
97293249ebfSmrg# Decode basic machines in the full and proper CPU-Company form.
97393249ebfSmrgcase $cpu-$vendor in
97493249ebfSmrg	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
97593249ebfSmrg	# some cases the only manufacturer, in others, it is the most popular.
97693249ebfSmrg	craynv-unknown)
97793249ebfSmrg		vendor=cray
97893249ebfSmrg		basic_os=${basic_os:-unicosmp}
97993249ebfSmrg		;;
98093249ebfSmrg	c90-unknown | c90-cray)
98193249ebfSmrg		vendor=cray
98293249ebfSmrg		basic_os=${Basic_os:-unicos}
98393249ebfSmrg		;;
98493249ebfSmrg	fx80-unknown)
98593249ebfSmrg		vendor=alliant
98693249ebfSmrg		;;
98793249ebfSmrg	romp-unknown)
98893249ebfSmrg		vendor=ibm
98993249ebfSmrg		;;
99093249ebfSmrg	mmix-unknown)
99193249ebfSmrg		vendor=knuth
99293249ebfSmrg		;;
99393249ebfSmrg	microblaze-unknown | microblazeel-unknown)
99493249ebfSmrg		vendor=xilinx
99593249ebfSmrg		;;
99693249ebfSmrg	rs6000-unknown)
99793249ebfSmrg		vendor=ibm
99893249ebfSmrg		;;
99993249ebfSmrg	vax-unknown)
100093249ebfSmrg		vendor=dec
100193249ebfSmrg		;;
100293249ebfSmrg	pdp11-unknown)
100393249ebfSmrg		vendor=dec
100493249ebfSmrg		;;
100593249ebfSmrg	we32k-unknown)
100693249ebfSmrg		vendor=att
100793249ebfSmrg		;;
100893249ebfSmrg	cydra-unknown)
100993249ebfSmrg		vendor=cydrome
101093249ebfSmrg		;;
101193249ebfSmrg	i370-ibm*)
101293249ebfSmrg		vendor=ibm
101393249ebfSmrg		;;
101493249ebfSmrg	orion-unknown)
101593249ebfSmrg		vendor=highlevel
101693249ebfSmrg		;;
101793249ebfSmrg	xps-unknown | xps100-unknown)
101893249ebfSmrg		cpu=xps100
101993249ebfSmrg		vendor=honeywell
102093249ebfSmrg		;;
102193249ebfSmrg
102293249ebfSmrg	# Here we normalize CPU types with a missing or matching vendor
102393249ebfSmrg	armh-unknown | armh-alt)
102493249ebfSmrg		cpu=armv7l
102593249ebfSmrg		vendor=alt
102693249ebfSmrg		basic_os=${basic_os:-linux-gnueabihf}
102793249ebfSmrg		;;
102893249ebfSmrg	dpx20-unknown | dpx20-bull)
102993249ebfSmrg		cpu=rs6000
103093249ebfSmrg		vendor=bull
103193249ebfSmrg		basic_os=${basic_os:-bosx}
103293249ebfSmrg		;;
103393249ebfSmrg
103493249ebfSmrg	# Here we normalize CPU types irrespective of the vendor
103593249ebfSmrg	amd64-*)
103693249ebfSmrg		cpu=x86_64
103793249ebfSmrg		;;
103893249ebfSmrg	blackfin-*)
103993249ebfSmrg		cpu=bfin
104093249ebfSmrg		basic_os=linux
104193249ebfSmrg		;;
104293249ebfSmrg	c54x-*)
104393249ebfSmrg		cpu=tic54x
104493249ebfSmrg		;;
104593249ebfSmrg	c55x-*)
104693249ebfSmrg		cpu=tic55x
104793249ebfSmrg		;;
104893249ebfSmrg	c6x-*)
104993249ebfSmrg		cpu=tic6x
105093249ebfSmrg		;;
105193249ebfSmrg	e500v[12]-*)
105293249ebfSmrg		cpu=powerpc
105393249ebfSmrg		basic_os=${basic_os}"spe"
105493249ebfSmrg		;;
105593249ebfSmrg	mips3*-*)
105693249ebfSmrg		cpu=mips64
105793249ebfSmrg		;;
105893249ebfSmrg	ms1-*)
105993249ebfSmrg		cpu=mt
106093249ebfSmrg		;;
106193249ebfSmrg	m68knommu-*)
106293249ebfSmrg		cpu=m68k
106393249ebfSmrg		basic_os=linux
106493249ebfSmrg		;;
106593249ebfSmrg	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
106693249ebfSmrg		cpu=s12z
106793249ebfSmrg		;;
106893249ebfSmrg	openrisc-*)
106993249ebfSmrg		cpu=or32
107093249ebfSmrg		;;
107193249ebfSmrg	parisc-*)
107293249ebfSmrg		cpu=hppa
107393249ebfSmrg		basic_os=linux
107493249ebfSmrg		;;
107593249ebfSmrg	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
107693249ebfSmrg		cpu=i586
107793249ebfSmrg		;;
107893249ebfSmrg	pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
107993249ebfSmrg		cpu=i686
108093249ebfSmrg		;;
108193249ebfSmrg	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
108293249ebfSmrg		cpu=i686
108393249ebfSmrg		;;
108493249ebfSmrg	pentium4-*)
108593249ebfSmrg		cpu=i786
108693249ebfSmrg		;;
108793249ebfSmrg	pc98-*)
108893249ebfSmrg		cpu=i386
108993249ebfSmrg		;;
109093249ebfSmrg	ppc-* | ppcbe-*)
109193249ebfSmrg		cpu=powerpc
109293249ebfSmrg		;;
109393249ebfSmrg	ppcle-* | powerpclittle-*)
109493249ebfSmrg		cpu=powerpcle
109593249ebfSmrg		;;
109693249ebfSmrg	ppc64-*)
109793249ebfSmrg		cpu=powerpc64
109893249ebfSmrg		;;
109993249ebfSmrg	ppc64le-* | powerpc64little-*)
110093249ebfSmrg		cpu=powerpc64le
110193249ebfSmrg		;;
110293249ebfSmrg	sb1-*)
110393249ebfSmrg		cpu=mipsisa64sb1
110493249ebfSmrg		;;
110593249ebfSmrg	sb1el-*)
110693249ebfSmrg		cpu=mipsisa64sb1el
110793249ebfSmrg		;;
110893249ebfSmrg	sh5e[lb]-*)
110993249ebfSmrg		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
111093249ebfSmrg		;;
111193249ebfSmrg	spur-*)
111293249ebfSmrg		cpu=spur
111393249ebfSmrg		;;
111493249ebfSmrg	strongarm-* | thumb-*)
111593249ebfSmrg		cpu=arm
111693249ebfSmrg		;;
111793249ebfSmrg	tx39-*)
111893249ebfSmrg		cpu=mipstx39
111993249ebfSmrg		;;
112093249ebfSmrg	tx39el-*)
112193249ebfSmrg		cpu=mipstx39el
112293249ebfSmrg		;;
112393249ebfSmrg	x64-*)
112493249ebfSmrg		cpu=x86_64
112593249ebfSmrg		;;
112693249ebfSmrg	xscale-* | xscalee[bl]-*)
112793249ebfSmrg		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
112893249ebfSmrg		;;
112993249ebfSmrg	arm64-* | aarch64le-*)
113093249ebfSmrg		cpu=aarch64
113193249ebfSmrg		;;
113293249ebfSmrg
113393249ebfSmrg	# Recognize the canonical CPU Types that limit and/or modify the
113493249ebfSmrg	# company names they are paired with.
113593249ebfSmrg	cr16-*)
113693249ebfSmrg		basic_os=${basic_os:-elf}
113793249ebfSmrg		;;
113893249ebfSmrg	crisv32-* | etraxfs*-*)
113993249ebfSmrg		cpu=crisv32
114093249ebfSmrg		vendor=axis
114193249ebfSmrg		;;
114293249ebfSmrg	cris-* | etrax*-*)
114393249ebfSmrg		cpu=cris
114493249ebfSmrg		vendor=axis
114593249ebfSmrg		;;
114693249ebfSmrg	crx-*)
114793249ebfSmrg		basic_os=${basic_os:-elf}
114893249ebfSmrg		;;
114993249ebfSmrg	neo-tandem)
115093249ebfSmrg		cpu=neo
115193249ebfSmrg		vendor=tandem
115293249ebfSmrg		;;
115393249ebfSmrg	nse-tandem)
115493249ebfSmrg		cpu=nse
115593249ebfSmrg		vendor=tandem
115693249ebfSmrg		;;
115793249ebfSmrg	nsr-tandem)
115893249ebfSmrg		cpu=nsr
115993249ebfSmrg		vendor=tandem
116093249ebfSmrg		;;
116193249ebfSmrg	nsv-tandem)
116293249ebfSmrg		cpu=nsv
116393249ebfSmrg		vendor=tandem
116493249ebfSmrg		;;
116593249ebfSmrg	nsx-tandem)
116693249ebfSmrg		cpu=nsx
116793249ebfSmrg		vendor=tandem
116893249ebfSmrg		;;
116993249ebfSmrg	mipsallegrexel-sony)
117093249ebfSmrg		cpu=mipsallegrexel
117193249ebfSmrg		vendor=sony
117293249ebfSmrg		;;
117393249ebfSmrg	tile*-*)
117493249ebfSmrg		basic_os=${basic_os:-linux-gnu}
117593249ebfSmrg		;;
117693249ebfSmrg
117793249ebfSmrg	*)
117893249ebfSmrg		# Recognize the canonical CPU types that are allowed with any
117993249ebfSmrg		# company name.
118093249ebfSmrg		case $cpu in
118193249ebfSmrg			1750a | 580 \
118293249ebfSmrg			| a29k \
118393249ebfSmrg			| aarch64 | aarch64_be \
118493249ebfSmrg			| abacus \
118593249ebfSmrg			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
118693249ebfSmrg			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
118793249ebfSmrg			| alphapca5[67] | alpha64pca5[67] \
118893249ebfSmrg			| am33_2.0 \
118993249ebfSmrg			| amdgcn \
119093249ebfSmrg			| arc | arceb | arc32 | arc64 \
119193249ebfSmrg			| arm | arm[lb]e | arme[lb] | armv* \
119293249ebfSmrg			| avr | avr32 \
119393249ebfSmrg			| asmjs \
119493249ebfSmrg			| ba \
119593249ebfSmrg			| be32 | be64 \
119693249ebfSmrg			| bfin | bpf | bs2000 \
119793249ebfSmrg			| c[123]* | c30 | [cjt]90 | c4x \
119893249ebfSmrg			| c8051 | clipper | craynv | csky | cydra \
119993249ebfSmrg			| d10v | d30v | dlx | dsp16xx \
120093249ebfSmrg			| e2k | elxsi | epiphany \
120193249ebfSmrg			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
120293249ebfSmrg			| h8300 | h8500 \
120393249ebfSmrg			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
120493249ebfSmrg			| hexagon \
120593249ebfSmrg			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
120693249ebfSmrg			| ip2k | iq2000 \
120793249ebfSmrg			| k1om \
120893249ebfSmrg			| le32 | le64 \
120993249ebfSmrg			| lm32 \
121093249ebfSmrg			| loongarch32 | loongarch64 \
121193249ebfSmrg			| m32c | m32r | m32rle \
121293249ebfSmrg			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
121393249ebfSmrg			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
121493249ebfSmrg			| m88110 | m88k | maxq | mb | mcore | mep | metag \
121593249ebfSmrg			| microblaze | microblazeel \
121693249ebfSmrg			| mips | mipsbe | mipseb | mipsel | mipsle \
121793249ebfSmrg			| mips16 \
121893249ebfSmrg			| mips64 | mips64eb | mips64el \
121993249ebfSmrg			| mips64octeon | mips64octeonel \
122093249ebfSmrg			| mips64orion | mips64orionel \
122193249ebfSmrg			| mips64r5900 | mips64r5900el \
122293249ebfSmrg			| mips64vr | mips64vrel \
122393249ebfSmrg			| mips64vr4100 | mips64vr4100el \
122493249ebfSmrg			| mips64vr4300 | mips64vr4300el \
122593249ebfSmrg			| mips64vr5000 | mips64vr5000el \
122693249ebfSmrg			| mips64vr5900 | mips64vr5900el \
122793249ebfSmrg			| mipsisa32 | mipsisa32el \
122893249ebfSmrg			| mipsisa32r2 | mipsisa32r2el \
122993249ebfSmrg			| mipsisa32r3 | mipsisa32r3el \
123093249ebfSmrg			| mipsisa32r5 | mipsisa32r5el \
123193249ebfSmrg			| mipsisa32r6 | mipsisa32r6el \
123293249ebfSmrg			| mipsisa64 | mipsisa64el \
123393249ebfSmrg			| mipsisa64r2 | mipsisa64r2el \
123493249ebfSmrg			| mipsisa64r3 | mipsisa64r3el \
123593249ebfSmrg			| mipsisa64r5 | mipsisa64r5el \
123693249ebfSmrg			| mipsisa64r6 | mipsisa64r6el \
123793249ebfSmrg			| mipsisa64sb1 | mipsisa64sb1el \
123893249ebfSmrg			| mipsisa64sr71k | mipsisa64sr71kel \
123993249ebfSmrg			| mipsr5900 | mipsr5900el \
124093249ebfSmrg			| mipstx39 | mipstx39el \
124193249ebfSmrg			| mmix \
124293249ebfSmrg			| mn10200 | mn10300 \
124393249ebfSmrg			| moxie \
124493249ebfSmrg			| mt \
124593249ebfSmrg			| msp430 \
124693249ebfSmrg			| nds32 | nds32le | nds32be \
124793249ebfSmrg			| nfp \
124893249ebfSmrg			| nios | nios2 | nios2eb | nios2el \
124993249ebfSmrg			| none | np1 | ns16k | ns32k | nvptx \
125093249ebfSmrg			| open8 \
125193249ebfSmrg			| or1k* \
125293249ebfSmrg			| or32 \
125393249ebfSmrg			| orion \
125493249ebfSmrg			| picochip \
125593249ebfSmrg			| pdp10 | pdp11 | pj | pjl | pn | power \
125693249ebfSmrg			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
125793249ebfSmrg			| pru \
125893249ebfSmrg			| pyramid \
125993249ebfSmrg			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
126093249ebfSmrg			| rl78 | romp | rs6000 | rx \
126193249ebfSmrg			| s390 | s390x \
126293249ebfSmrg			| score \
126393249ebfSmrg			| sh | shl \
126493249ebfSmrg			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
126593249ebfSmrg			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
126693249ebfSmrg			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
126793249ebfSmrg			| sparclite \
126893249ebfSmrg			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
126993249ebfSmrg			| spu \
127093249ebfSmrg			| tahoe \
127193249ebfSmrg			| thumbv7* \
127293249ebfSmrg			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
127393249ebfSmrg			| tron \
127493249ebfSmrg			| ubicom32 \
127593249ebfSmrg			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
127693249ebfSmrg			| vax \
127793249ebfSmrg			| visium \
127893249ebfSmrg			| w65 \
127993249ebfSmrg			| wasm32 | wasm64 \
128093249ebfSmrg			| we32k \
128193249ebfSmrg			| x86 | x86_64 | xc16x | xgate | xps100 \
128293249ebfSmrg			| xstormy16 | xtensa* \
128393249ebfSmrg			| ymp \
128493249ebfSmrg			| z8k | z80)
128593249ebfSmrg				;;
128693249ebfSmrg
128793249ebfSmrg			*)
128893249ebfSmrg				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
128993249ebfSmrg				exit 1
129093249ebfSmrg				;;
129193249ebfSmrg		esac
129293249ebfSmrg		;;
129393249ebfSmrgesac
129493249ebfSmrg
129593249ebfSmrg# Here we canonicalize certain aliases for manufacturers.
129693249ebfSmrgcase $vendor in
129793249ebfSmrg	digital*)
129893249ebfSmrg		vendor=dec
129993249ebfSmrg		;;
130093249ebfSmrg	commodore*)
130193249ebfSmrg		vendor=cbm
130293249ebfSmrg		;;
130393249ebfSmrg	*)
130493249ebfSmrg		;;
130593249ebfSmrgesac
130693249ebfSmrg
130793249ebfSmrg# Decode manufacturer-specific aliases for certain operating systems.
130893249ebfSmrg
130993249ebfSmrgif test x$basic_os != x
131093249ebfSmrgthen
131193249ebfSmrg
131293249ebfSmrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
131393249ebfSmrg# set os.
131493249ebfSmrgcase $basic_os in
131593249ebfSmrg	gnu/linux*)
131693249ebfSmrg		kernel=linux
131793249ebfSmrg		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
131893249ebfSmrg		;;
131993249ebfSmrg	os2-emx)
132093249ebfSmrg		kernel=os2
132193249ebfSmrg		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
132293249ebfSmrg		;;
132393249ebfSmrg	nto-qnx*)
132493249ebfSmrg		kernel=nto
132593249ebfSmrg		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
132693249ebfSmrg		;;
132793249ebfSmrg	*-*)
132893249ebfSmrg		# shellcheck disable=SC2162
132993249ebfSmrg		saved_IFS=$IFS
133093249ebfSmrg		IFS="-" read kernel os <<EOF
133193249ebfSmrg$basic_os
133293249ebfSmrgEOF
133393249ebfSmrg		IFS=$saved_IFS
133493249ebfSmrg		;;
133593249ebfSmrg	# Default OS when just kernel was specified
133693249ebfSmrg	nto*)
133793249ebfSmrg		kernel=nto
133893249ebfSmrg		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
133993249ebfSmrg		;;
134093249ebfSmrg	linux*)
134193249ebfSmrg		kernel=linux
134293249ebfSmrg		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
134393249ebfSmrg		;;
134493249ebfSmrg	managarm*)
134593249ebfSmrg		kernel=managarm
134693249ebfSmrg		os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
134793249ebfSmrg		;;
134893249ebfSmrg	*)
134993249ebfSmrg		kernel=
135093249ebfSmrg		os=$basic_os
135193249ebfSmrg		;;
135293249ebfSmrgesac
135393249ebfSmrg
135493249ebfSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel,
135593249ebfSmrg# etc.)
135693249ebfSmrgcase $os in
135793249ebfSmrg	# First match some system type aliases that might get confused
135893249ebfSmrg	# with valid system types.
135993249ebfSmrg	# solaris* is a basic system type, with this one exception.
136093249ebfSmrg	auroraux)
136193249ebfSmrg		os=auroraux
136293249ebfSmrg		;;
136393249ebfSmrg	bluegene*)
136493249ebfSmrg		os=cnk
136593249ebfSmrg		;;
136693249ebfSmrg	solaris1 | solaris1.*)
136793249ebfSmrg		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
136893249ebfSmrg		;;
136993249ebfSmrg	solaris)
137093249ebfSmrg		os=solaris2
137193249ebfSmrg		;;
137293249ebfSmrg	unixware*)
137393249ebfSmrg		os=sysv4.2uw
137493249ebfSmrg		;;
137593249ebfSmrg	# es1800 is here to avoid being matched by es* (a different OS)
137693249ebfSmrg	es1800*)
137793249ebfSmrg		os=ose
137893249ebfSmrg		;;
137993249ebfSmrg	# Some version numbers need modification
138093249ebfSmrg	chorusos*)
138193249ebfSmrg		os=chorusos
138293249ebfSmrg		;;
138393249ebfSmrg	isc)
138493249ebfSmrg		os=isc2.2
138593249ebfSmrg		;;
138693249ebfSmrg	sco6)
138793249ebfSmrg		os=sco5v6
138893249ebfSmrg		;;
138993249ebfSmrg	sco5)
139093249ebfSmrg		os=sco3.2v5
139193249ebfSmrg		;;
139293249ebfSmrg	sco4)
139393249ebfSmrg		os=sco3.2v4
139493249ebfSmrg		;;
139593249ebfSmrg	sco3.2.[4-9]*)
139693249ebfSmrg		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
139793249ebfSmrg		;;
139893249ebfSmrg	sco*v* | scout)
139993249ebfSmrg		# Don't match below
140093249ebfSmrg		;;
140193249ebfSmrg	sco*)
140293249ebfSmrg		os=sco3.2v2
140393249ebfSmrg		;;
140493249ebfSmrg	psos*)
140593249ebfSmrg		os=psos
140693249ebfSmrg		;;
140793249ebfSmrg	qnx*)
140893249ebfSmrg		os=qnx
140993249ebfSmrg		;;
141093249ebfSmrg	hiux*)
141193249ebfSmrg		os=hiuxwe2
141293249ebfSmrg		;;
141393249ebfSmrg	lynx*178)
141493249ebfSmrg		os=lynxos178
141593249ebfSmrg		;;
141693249ebfSmrg	lynx*5)
141793249ebfSmrg		os=lynxos5
141893249ebfSmrg		;;
141993249ebfSmrg	lynxos*)
142093249ebfSmrg		# don't get caught up in next wildcard
142193249ebfSmrg		;;
142293249ebfSmrg	lynx*)
142393249ebfSmrg		os=lynxos
142493249ebfSmrg		;;
142593249ebfSmrg	mac[0-9]*)
142693249ebfSmrg		os=`echo "$os" | sed -e 's|mac|macos|'`
142793249ebfSmrg		;;
142893249ebfSmrg	opened*)
142993249ebfSmrg		os=openedition
143093249ebfSmrg		;;
143193249ebfSmrg	os400*)
143293249ebfSmrg		os=os400
143393249ebfSmrg		;;
143493249ebfSmrg	sunos5*)
143593249ebfSmrg		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
143693249ebfSmrg		;;
143793249ebfSmrg	sunos6*)
143893249ebfSmrg		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
143993249ebfSmrg		;;
144093249ebfSmrg	wince*)
144193249ebfSmrg		os=wince
144293249ebfSmrg		;;
144393249ebfSmrg	utek*)
144493249ebfSmrg		os=bsd
144593249ebfSmrg		;;
144693249ebfSmrg	dynix*)
144793249ebfSmrg		os=bsd
144893249ebfSmrg		;;
144993249ebfSmrg	acis*)
145093249ebfSmrg		os=aos
145193249ebfSmrg		;;
145293249ebfSmrg	atheos*)
145393249ebfSmrg		os=atheos
145493249ebfSmrg		;;
145593249ebfSmrg	syllable*)
145693249ebfSmrg		os=syllable
145793249ebfSmrg		;;
145893249ebfSmrg	386bsd)
145993249ebfSmrg		os=bsd
146093249ebfSmrg		;;
146193249ebfSmrg	ctix* | uts*)
146293249ebfSmrg		os=sysv
146393249ebfSmrg		;;
146493249ebfSmrg	nova*)
146593249ebfSmrg		os=rtmk-nova
146693249ebfSmrg		;;
146793249ebfSmrg	ns2)
146893249ebfSmrg		os=nextstep2
146993249ebfSmrg		;;
147093249ebfSmrg	# Preserve the version number of sinix5.
147193249ebfSmrg	sinix5.*)
147293249ebfSmrg		os=`echo "$os" | sed -e 's|sinix|sysv|'`
147393249ebfSmrg		;;
147493249ebfSmrg	sinix*)
147593249ebfSmrg		os=sysv4
147693249ebfSmrg		;;
147793249ebfSmrg	tpf*)
147893249ebfSmrg		os=tpf
147993249ebfSmrg		;;
148093249ebfSmrg	triton*)
148193249ebfSmrg		os=sysv3
148293249ebfSmrg		;;
148393249ebfSmrg	oss*)
148493249ebfSmrg		os=sysv3
148593249ebfSmrg		;;
148693249ebfSmrg	svr4*)
148793249ebfSmrg		os=sysv4
148893249ebfSmrg		;;
148993249ebfSmrg	svr3)
149093249ebfSmrg		os=sysv3
149193249ebfSmrg		;;
149293249ebfSmrg	sysvr4)
149393249ebfSmrg		os=sysv4
149493249ebfSmrg		;;
149593249ebfSmrg	ose*)
149693249ebfSmrg		os=ose
149793249ebfSmrg		;;
149893249ebfSmrg	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
149993249ebfSmrg		os=mint
150093249ebfSmrg		;;
150193249ebfSmrg	dicos*)
150293249ebfSmrg		os=dicos
150393249ebfSmrg		;;
150493249ebfSmrg	pikeos*)
150593249ebfSmrg		# Until real need of OS specific support for
150693249ebfSmrg		# particular features comes up, bare metal
150793249ebfSmrg		# configurations are quite functional.
150893249ebfSmrg		case $cpu in
150993249ebfSmrg		    arm*)
151093249ebfSmrg			os=eabi
151193249ebfSmrg			;;
151293249ebfSmrg		    *)
151393249ebfSmrg			os=elf
151493249ebfSmrg			;;
151593249ebfSmrg		esac
151693249ebfSmrg		;;
151793249ebfSmrg	*)
151893249ebfSmrg		# No normalization, but not necessarily accepted, that comes below.
151993249ebfSmrg		;;
152093249ebfSmrgesac
152193249ebfSmrg
152293249ebfSmrgelse
152393249ebfSmrg
152493249ebfSmrg# Here we handle the default operating systems that come with various machines.
152593249ebfSmrg# The value should be what the vendor currently ships out the door with their
152693249ebfSmrg# machine or put another way, the most popular os provided with the machine.
152793249ebfSmrg
152893249ebfSmrg# Note that if you're going to try to match "-MANUFACTURER" here (say,
152993249ebfSmrg# "-sun"), then you have to tell the case statement up towards the top
153093249ebfSmrg# that MANUFACTURER isn't an operating system.  Otherwise, code above
153193249ebfSmrg# will signal an error saying that MANUFACTURER isn't an operating
153293249ebfSmrg# system, and we'll never get to this point.
153393249ebfSmrg
153493249ebfSmrgkernel=
153593249ebfSmrgcase $cpu-$vendor in
153693249ebfSmrg	score-*)
153793249ebfSmrg		os=elf
153893249ebfSmrg		;;
153993249ebfSmrg	spu-*)
154093249ebfSmrg		os=elf
154193249ebfSmrg		;;
154293249ebfSmrg	*-acorn)
154393249ebfSmrg		os=riscix1.2
154493249ebfSmrg		;;
154593249ebfSmrg	arm*-rebel)
154693249ebfSmrg		kernel=linux
154793249ebfSmrg		os=gnu
154893249ebfSmrg		;;
154993249ebfSmrg	arm*-semi)
155093249ebfSmrg		os=aout
155193249ebfSmrg		;;
155293249ebfSmrg	c4x-* | tic4x-*)
155393249ebfSmrg		os=coff
155493249ebfSmrg		;;
155593249ebfSmrg	c8051-*)
155693249ebfSmrg		os=elf
155793249ebfSmrg		;;
155893249ebfSmrg	clipper-intergraph)
155993249ebfSmrg		os=clix
156093249ebfSmrg		;;
156193249ebfSmrg	hexagon-*)
156293249ebfSmrg		os=elf
156393249ebfSmrg		;;
156493249ebfSmrg	tic54x-*)
156593249ebfSmrg		os=coff
156693249ebfSmrg		;;
156793249ebfSmrg	tic55x-*)
156893249ebfSmrg		os=coff
156993249ebfSmrg		;;
157093249ebfSmrg	tic6x-*)
157193249ebfSmrg		os=coff
157293249ebfSmrg		;;
157393249ebfSmrg	# This must come before the *-dec entry.
157493249ebfSmrg	pdp10-*)
157593249ebfSmrg		os=tops20
157693249ebfSmrg		;;
157793249ebfSmrg	pdp11-*)
157893249ebfSmrg		os=none
157993249ebfSmrg		;;
158093249ebfSmrg	*-dec | vax-*)
158193249ebfSmrg		os=ultrix4.2
158293249ebfSmrg		;;
158393249ebfSmrg	m68*-apollo)
158493249ebfSmrg		os=domain
158593249ebfSmrg		;;
158693249ebfSmrg	i386-sun)
158793249ebfSmrg		os=sunos4.0.2
158893249ebfSmrg		;;
158993249ebfSmrg	m68000-sun)
159093249ebfSmrg		os=sunos3
159193249ebfSmrg		;;
159293249ebfSmrg	m68*-cisco)
159393249ebfSmrg		os=aout
159493249ebfSmrg		;;
159593249ebfSmrg	mep-*)
159693249ebfSmrg		os=elf
159793249ebfSmrg		;;
159893249ebfSmrg	mips*-cisco)
159993249ebfSmrg		os=elf
160093249ebfSmrg		;;
160193249ebfSmrg	mips*-*)
160293249ebfSmrg		os=elf
160393249ebfSmrg		;;
160493249ebfSmrg	or32-*)
160593249ebfSmrg		os=coff
160693249ebfSmrg		;;
160793249ebfSmrg	*-tti)	# must be before sparc entry or we get the wrong os.
160893249ebfSmrg		os=sysv3
160993249ebfSmrg		;;
161093249ebfSmrg	sparc-* | *-sun)
161193249ebfSmrg		os=sunos4.1.1
161293249ebfSmrg		;;
161393249ebfSmrg	pru-*)
161493249ebfSmrg		os=elf
161593249ebfSmrg		;;
161693249ebfSmrg	*-be)
161793249ebfSmrg		os=beos
161893249ebfSmrg		;;
161993249ebfSmrg	*-ibm)
162093249ebfSmrg		os=aix
162193249ebfSmrg		;;
162293249ebfSmrg	*-knuth)
162393249ebfSmrg		os=mmixware
162493249ebfSmrg		;;
162593249ebfSmrg	*-wec)
162693249ebfSmrg		os=proelf
162793249ebfSmrg		;;
162893249ebfSmrg	*-winbond)
162993249ebfSmrg		os=proelf
163093249ebfSmrg		;;
163193249ebfSmrg	*-oki)
163293249ebfSmrg		os=proelf
163393249ebfSmrg		;;
163493249ebfSmrg	*-hp)
163593249ebfSmrg		os=hpux
163693249ebfSmrg		;;
163793249ebfSmrg	*-hitachi)
163893249ebfSmrg		os=hiux
163993249ebfSmrg		;;
164093249ebfSmrg	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
164193249ebfSmrg		os=sysv
164293249ebfSmrg		;;
164393249ebfSmrg	*-cbm)
164493249ebfSmrg		os=amigaos
164593249ebfSmrg		;;
164693249ebfSmrg	*-dg)
164793249ebfSmrg		os=dgux
164893249ebfSmrg		;;
164993249ebfSmrg	*-dolphin)
165093249ebfSmrg		os=sysv3
165193249ebfSmrg		;;
165293249ebfSmrg	m68k-ccur)
165393249ebfSmrg		os=rtu
165493249ebfSmrg		;;
165593249ebfSmrg	m88k-omron*)
165693249ebfSmrg		os=luna
165793249ebfSmrg		;;
165893249ebfSmrg	*-next)
165993249ebfSmrg		os=nextstep
166093249ebfSmrg		;;
166193249ebfSmrg	*-sequent)
166293249ebfSmrg		os=ptx
166393249ebfSmrg		;;
166493249ebfSmrg	*-crds)
166593249ebfSmrg		os=unos
166693249ebfSmrg		;;
166793249ebfSmrg	*-ns)
166893249ebfSmrg		os=genix
166993249ebfSmrg		;;
167093249ebfSmrg	i370-*)
167193249ebfSmrg		os=mvs
167293249ebfSmrg		;;
167393249ebfSmrg	*-gould)
167493249ebfSmrg		os=sysv
167593249ebfSmrg		;;
167693249ebfSmrg	*-highlevel)
167793249ebfSmrg		os=bsd
167893249ebfSmrg		;;
167993249ebfSmrg	*-encore)
168093249ebfSmrg		os=bsd
168193249ebfSmrg		;;
168293249ebfSmrg	*-sgi)
168393249ebfSmrg		os=irix
168493249ebfSmrg		;;
168593249ebfSmrg	*-siemens)
168693249ebfSmrg		os=sysv4
168793249ebfSmrg		;;
168893249ebfSmrg	*-masscomp)
168993249ebfSmrg		os=rtu
169093249ebfSmrg		;;
169193249ebfSmrg	f30[01]-fujitsu | f700-fujitsu)
169293249ebfSmrg		os=uxpv
169393249ebfSmrg		;;
169493249ebfSmrg	*-rom68k)
169593249ebfSmrg		os=coff
169693249ebfSmrg		;;
169793249ebfSmrg	*-*bug)
169893249ebfSmrg		os=coff
169993249ebfSmrg		;;
170093249ebfSmrg	*-apple)
170193249ebfSmrg		os=macos
170293249ebfSmrg		;;
170393249ebfSmrg	*-atari*)
170493249ebfSmrg		os=mint
170593249ebfSmrg		;;
170693249ebfSmrg	*-wrs)
170793249ebfSmrg		os=vxworks
170893249ebfSmrg		;;
170993249ebfSmrg	*)
171093249ebfSmrg		os=none
171193249ebfSmrg		;;
171293249ebfSmrgesac
171393249ebfSmrg
171493249ebfSmrgfi
171593249ebfSmrg
171693249ebfSmrg# Now, validate our (potentially fixed-up) OS.
171793249ebfSmrgcase $os in
171893249ebfSmrg	# Sometimes we do "kernel-libc", so those need to count as OSes.
171993249ebfSmrg	musl* | newlib* | relibc* | uclibc*)
172093249ebfSmrg		;;
172193249ebfSmrg	# Likewise for "kernel-abi"
172293249ebfSmrg	eabi* | gnueabi*)
172393249ebfSmrg		;;
172493249ebfSmrg	# VxWorks passes extra cpu info in the 4th filed.
172593249ebfSmrg	simlinux | simwindows | spe)
172693249ebfSmrg		;;
172793249ebfSmrg	# Now accept the basic system types.
172893249ebfSmrg	# The portable systems comes first.
172993249ebfSmrg	# Each alternative MUST end in a * to match a version number.
173093249ebfSmrg	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
173193249ebfSmrg	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
173293249ebfSmrg	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
173393249ebfSmrg	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
173493249ebfSmrg	     | hiux* | abug | nacl* | netware* | windows* \
173593249ebfSmrg	     | os9* | macos* | osx* | ios* \
173693249ebfSmrg	     | mpw* | magic* | mmixware* | mon960* | lnews* \
173793249ebfSmrg	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
173893249ebfSmrg	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
173993249ebfSmrg	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
174093249ebfSmrg	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
174193249ebfSmrg	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
174293249ebfSmrg	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
174393249ebfSmrg	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
174493249ebfSmrg	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
174593249ebfSmrg	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
174693249ebfSmrg	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
174793249ebfSmrg	     | chorusrdb* | cegcc* | glidix* | serenity* \
174893249ebfSmrg	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
174993249ebfSmrg	     | midipix* | mingw32* | mingw64* | mint* \
175093249ebfSmrg	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
175193249ebfSmrg	     | interix* | uwin* | mks* | rhapsody* | darwin* \
175293249ebfSmrg	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
175393249ebfSmrg	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
175493249ebfSmrg	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
175593249ebfSmrg	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
175693249ebfSmrg	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
175793249ebfSmrg	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
175893249ebfSmrg	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
175993249ebfSmrg	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
176093249ebfSmrg	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
176193249ebfSmrg	     | fiwix* | mlibc* )
176293249ebfSmrg		;;
176393249ebfSmrg	# This one is extra strict with allowed versions
176493249ebfSmrg	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
176593249ebfSmrg		# Don't forget version if it is 3.2v4 or newer.
176693249ebfSmrg		;;
176793249ebfSmrg	none)
176893249ebfSmrg		;;
176993249ebfSmrg	kernel* )
177093249ebfSmrg		# Restricted further below
177193249ebfSmrg		;;
177293249ebfSmrg	*)
177393249ebfSmrg		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
177493249ebfSmrg		exit 1
177593249ebfSmrg		;;
177693249ebfSmrgesac
177793249ebfSmrg
177893249ebfSmrg# As a final step for OS-related things, validate the OS-kernel combination
177993249ebfSmrg# (given a valid OS), if there is a kernel.
178093249ebfSmrgcase $kernel-$os in
178193249ebfSmrg	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
178293249ebfSmrg		   | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
178393249ebfSmrg		;;
178493249ebfSmrg	uclinux-uclibc* )
178593249ebfSmrg		;;
178693249ebfSmrg	managarm-mlibc* | managarm-kernel* )
178793249ebfSmrg		;;
178893249ebfSmrg	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
178993249ebfSmrg		# These are just libc implementations, not actual OSes, and thus
179093249ebfSmrg		# require a kernel.
179193249ebfSmrg		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
179293249ebfSmrg		exit 1
179393249ebfSmrg		;;
179493249ebfSmrg	-kernel* )
179593249ebfSmrg		echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2
179693249ebfSmrg		exit 1
179793249ebfSmrg		;;
179893249ebfSmrg	*-kernel* )
179993249ebfSmrg		echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2
180093249ebfSmrg		exit 1
180193249ebfSmrg		;;
180293249ebfSmrg	kfreebsd*-gnu* | kopensolaris*-gnu*)
180393249ebfSmrg		;;
180493249ebfSmrg	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
180593249ebfSmrg		;;
180693249ebfSmrg	nto-qnx*)
180793249ebfSmrg		;;
180893249ebfSmrg	os2-emx)
180993249ebfSmrg		;;
181093249ebfSmrg	*-eabi* | *-gnueabi*)
181193249ebfSmrg		;;
181293249ebfSmrg	-*)
181393249ebfSmrg		# Blank kernel with real OS is always fine.
181493249ebfSmrg		;;
181593249ebfSmrg	*-*)
181693249ebfSmrg		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
181793249ebfSmrg		exit 1
181893249ebfSmrg		;;
181993249ebfSmrgesac
182093249ebfSmrg
182193249ebfSmrg# Here we handle the case where we know the os, and the CPU type, but not the
182293249ebfSmrg# manufacturer.  We pick the logical manufacturer.
182393249ebfSmrgcase $vendor in
182493249ebfSmrg	unknown)
182593249ebfSmrg		case $cpu-$os in
182693249ebfSmrg			*-riscix*)
182793249ebfSmrg				vendor=acorn
182893249ebfSmrg				;;
182993249ebfSmrg			*-sunos*)
183093249ebfSmrg				vendor=sun
183193249ebfSmrg				;;
183293249ebfSmrg			*-cnk* | *-aix*)
183393249ebfSmrg				vendor=ibm
183493249ebfSmrg				;;
183593249ebfSmrg			*-beos*)
183693249ebfSmrg				vendor=be
183793249ebfSmrg				;;
183893249ebfSmrg			*-hpux*)
183993249ebfSmrg				vendor=hp
184093249ebfSmrg				;;
184193249ebfSmrg			*-mpeix*)
184293249ebfSmrg				vendor=hp
184393249ebfSmrg				;;
184493249ebfSmrg			*-hiux*)
184593249ebfSmrg				vendor=hitachi
184693249ebfSmrg				;;
184793249ebfSmrg			*-unos*)
184893249ebfSmrg				vendor=crds
184993249ebfSmrg				;;
185093249ebfSmrg			*-dgux*)
185193249ebfSmrg				vendor=dg
185293249ebfSmrg				;;
185393249ebfSmrg			*-luna*)
185493249ebfSmrg				vendor=omron
185593249ebfSmrg				;;
185693249ebfSmrg			*-genix*)
185793249ebfSmrg				vendor=ns
185893249ebfSmrg				;;
185993249ebfSmrg			*-clix*)
186093249ebfSmrg				vendor=intergraph
186193249ebfSmrg				;;
186293249ebfSmrg			*-mvs* | *-opened*)
186393249ebfSmrg				vendor=ibm
186493249ebfSmrg				;;
186593249ebfSmrg			*-os400*)
186693249ebfSmrg				vendor=ibm
186793249ebfSmrg				;;
186893249ebfSmrg			s390-* | s390x-*)
186993249ebfSmrg				vendor=ibm
187093249ebfSmrg				;;
187193249ebfSmrg			*-ptx*)
187293249ebfSmrg				vendor=sequent
187393249ebfSmrg				;;
187493249ebfSmrg			*-tpf*)
187593249ebfSmrg				vendor=ibm
187693249ebfSmrg				;;
187793249ebfSmrg			*-vxsim* | *-vxworks* | *-windiss*)
187893249ebfSmrg				vendor=wrs
187993249ebfSmrg				;;
188093249ebfSmrg			*-aux*)
188193249ebfSmrg				vendor=apple
188293249ebfSmrg				;;
188393249ebfSmrg			*-hms*)
188493249ebfSmrg				vendor=hitachi
188593249ebfSmrg				;;
188693249ebfSmrg			*-mpw* | *-macos*)
188793249ebfSmrg				vendor=apple
188893249ebfSmrg				;;
188993249ebfSmrg			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
189093249ebfSmrg				vendor=atari
189193249ebfSmrg				;;
189293249ebfSmrg			*-vos*)
189393249ebfSmrg				vendor=stratus
189493249ebfSmrg				;;
189593249ebfSmrg		esac
189693249ebfSmrg		;;
189793249ebfSmrgesac
189893249ebfSmrg
189993249ebfSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os"
190093249ebfSmrgexit
190193249ebfSmrg
190293249ebfSmrg# Local variables:
190393249ebfSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
190493249ebfSmrg# time-stamp-start: "timestamp='"
190593249ebfSmrg# time-stamp-format: "%:y-%02m-%02d"
190693249ebfSmrg# time-stamp-end: "'"
190793249ebfSmrg# End:
1908