xref: /freebsd/crypto/openssh/config.sub (revision f374ba41)
1ce3adf43SDag-Erling Smørgrav#! /bin/sh
2ce3adf43SDag-Erling Smørgrav# Configuration validation subroutine script.
3f374ba41SEd Maste#   Copyright 1992-2022 Free Software Foundation, Inc.
4ce3adf43SDag-Erling Smørgrav
5f374ba41SEd Maste# shellcheck disable=SC2006,SC2268 # see below for rationale
6f374ba41SEd Maste
7f374ba41SEd Mastetimestamp='2022-09-17'
8ce3adf43SDag-Erling Smørgrav
9ca86bcf2SDag-Erling Smørgrav# This file is free software; you can redistribute it and/or modify it
10ca86bcf2SDag-Erling Smørgrav# under the terms of the GNU General Public License as published by
11f374ba41SEd Maste# the Free Software Foundation, either version 3 of the License, or
12ce3adf43SDag-Erling Smørgrav# (at your option) any later version.
13ce3adf43SDag-Erling Smørgrav#
14ca86bcf2SDag-Erling Smørgrav# This program is distributed in the hope that it will be useful, but
15ca86bcf2SDag-Erling Smørgrav# WITHOUT ANY WARRANTY; without even the implied warranty of
16ca86bcf2SDag-Erling Smørgrav# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17ca86bcf2SDag-Erling Smørgrav# General Public License for more details.
18ce3adf43SDag-Erling Smørgrav#
19ce3adf43SDag-Erling Smørgrav# You should have received a copy of the GNU General Public License
2019261079SEd Maste# along with this program; if not, see <https://www.gnu.org/licenses/>.
21ce3adf43SDag-Erling Smørgrav#
22ce3adf43SDag-Erling Smørgrav# As a special exception to the GNU General Public License, if you
23ce3adf43SDag-Erling Smørgrav# distribute this file as part of a program that contains a
24ce3adf43SDag-Erling Smørgrav# configuration script generated by Autoconf, you may include it under
25ca86bcf2SDag-Erling Smørgrav# the same distribution terms that you use for the rest of that
26ca86bcf2SDag-Erling Smørgrav# program.  This Exception is an additional permission under section 7
27ca86bcf2SDag-Erling Smørgrav# of the GNU General Public License, version 3 ("GPLv3").
28ce3adf43SDag-Erling Smørgrav
29ce3adf43SDag-Erling Smørgrav
30ca86bcf2SDag-Erling Smørgrav# Please send patches to <config-patches@gnu.org>.
31ce3adf43SDag-Erling Smørgrav#
32ce3adf43SDag-Erling Smørgrav# Configuration subroutine to validate and canonicalize a configuration type.
33ce3adf43SDag-Erling Smørgrav# Supply the specified configuration type as an argument.
34ce3adf43SDag-Erling Smørgrav# If it is invalid, we print an error message on stderr and exit with code 1.
35ce3adf43SDag-Erling Smørgrav# Otherwise, we print the canonical config type on stdout and succeed.
36ce3adf43SDag-Erling Smørgrav
37ce3adf43SDag-Erling Smørgrav# You can get the latest version of this script from:
38f374ba41SEd Maste# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
39ce3adf43SDag-Erling Smørgrav
40ce3adf43SDag-Erling Smørgrav# This file is supposed to be the same for all GNU packages
41ce3adf43SDag-Erling Smørgrav# and recognize all the CPU types, system types and aliases
42ce3adf43SDag-Erling Smørgrav# that are meaningful with *any* GNU software.
43ce3adf43SDag-Erling Smørgrav# Each package is responsible for reporting which valid configurations
44ce3adf43SDag-Erling Smørgrav# it does not support.  The user should be able to distinguish
45ce3adf43SDag-Erling Smørgrav# a failure to support a valid configuration from a meaningless
46ce3adf43SDag-Erling Smørgrav# configuration.
47ce3adf43SDag-Erling Smørgrav
48ce3adf43SDag-Erling Smørgrav# The goal of this file is to map all the various variations of a given
49ce3adf43SDag-Erling Smørgrav# machine specification into a single specification in the form:
50ce3adf43SDag-Erling Smørgrav#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
51ce3adf43SDag-Erling Smørgrav# or in some cases, the newer four-part form:
52ce3adf43SDag-Erling Smørgrav#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
53ce3adf43SDag-Erling Smørgrav# It is wrong to echo any other type of specification.
54ce3adf43SDag-Erling Smørgrav
55f374ba41SEd Maste# The "shellcheck disable" line above the timestamp inhibits complaints
56f374ba41SEd Maste# about features and limitations of the classic Bourne shell that were
57f374ba41SEd Maste# superseded or lifted in POSIX.  However, this script identifies a wide
58f374ba41SEd Maste# variety of pre-POSIX systems that do not have POSIX shells at all, and
59f374ba41SEd Maste# even some reasonably current systems (Solaris 10 as case-in-point) still
60f374ba41SEd Maste# have a pre-POSIX /bin/sh.
61f374ba41SEd Maste
62ce3adf43SDag-Erling Smørgravme=`echo "$0" | sed -e 's,.*/,,'`
63ce3adf43SDag-Erling Smørgrav
64ce3adf43SDag-Erling Smørgravusage="\
65ca86bcf2SDag-Erling SmørgravUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
66ce3adf43SDag-Erling Smørgrav
67ce3adf43SDag-Erling SmørgravCanonicalize a configuration name.
68ce3adf43SDag-Erling Smørgrav
6919261079SEd MasteOptions:
70ce3adf43SDag-Erling Smørgrav  -h, --help         print this help, then exit
71ce3adf43SDag-Erling Smørgrav  -t, --time-stamp   print date of last modification, then exit
72ce3adf43SDag-Erling Smørgrav  -v, --version      print version number, then exit
73ce3adf43SDag-Erling Smørgrav
74ce3adf43SDag-Erling SmørgravReport bugs and patches to <config-patches@gnu.org>."
75ce3adf43SDag-Erling Smørgrav
76ce3adf43SDag-Erling Smørgravversion="\
77ce3adf43SDag-Erling SmørgravGNU config.sub ($timestamp)
78ce3adf43SDag-Erling Smørgrav
79f374ba41SEd MasteCopyright 1992-2022 Free Software Foundation, Inc.
80ce3adf43SDag-Erling Smørgrav
81ce3adf43SDag-Erling SmørgravThis is free software; see the source for copying conditions.  There is NO
82ce3adf43SDag-Erling Smørgravwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83ce3adf43SDag-Erling Smørgrav
84ce3adf43SDag-Erling Smørgravhelp="
85ce3adf43SDag-Erling SmørgravTry \`$me --help' for more information."
86ce3adf43SDag-Erling Smørgrav
87ce3adf43SDag-Erling Smørgrav# Parse command line
88ce3adf43SDag-Erling Smørgravwhile test $# -gt 0 ; do
89ce3adf43SDag-Erling Smørgrav  case $1 in
90ce3adf43SDag-Erling Smørgrav    --time-stamp | --time* | -t )
91ce3adf43SDag-Erling Smørgrav       echo "$timestamp" ; exit ;;
92ce3adf43SDag-Erling Smørgrav    --version | -v )
93ce3adf43SDag-Erling Smørgrav       echo "$version" ; exit ;;
94ce3adf43SDag-Erling Smørgrav    --help | --h* | -h )
95ce3adf43SDag-Erling Smørgrav       echo "$usage"; exit ;;
96ce3adf43SDag-Erling Smørgrav    -- )     # Stop option processing
97ce3adf43SDag-Erling Smørgrav       shift; break ;;
98ce3adf43SDag-Erling Smørgrav    - )	# Use stdin as input.
99ce3adf43SDag-Erling Smørgrav       break ;;
100ce3adf43SDag-Erling Smørgrav    -* )
10119261079SEd Maste       echo "$me: invalid option $1$help" >&2
102ce3adf43SDag-Erling Smørgrav       exit 1 ;;
103ce3adf43SDag-Erling Smørgrav
104ce3adf43SDag-Erling Smørgrav    *local*)
105ce3adf43SDag-Erling Smørgrav       # First pass through any local machine types.
10619261079SEd Maste       echo "$1"
107ce3adf43SDag-Erling Smørgrav       exit ;;
108ce3adf43SDag-Erling Smørgrav
109ce3adf43SDag-Erling Smørgrav    * )
110ce3adf43SDag-Erling Smørgrav       break ;;
111ce3adf43SDag-Erling Smørgrav  esac
112ce3adf43SDag-Erling Smørgravdone
113ce3adf43SDag-Erling Smørgrav
114ce3adf43SDag-Erling Smørgravcase $# in
115ce3adf43SDag-Erling Smørgrav 0) echo "$me: missing argument$help" >&2
116ce3adf43SDag-Erling Smørgrav    exit 1;;
117ce3adf43SDag-Erling Smørgrav 1) ;;
118ce3adf43SDag-Erling Smørgrav *) echo "$me: too many arguments$help" >&2
119ce3adf43SDag-Erling Smørgrav    exit 1;;
120ce3adf43SDag-Erling Smørgravesac
121ce3adf43SDag-Erling Smørgrav
12219261079SEd Maste# Split fields of configuration type
12319261079SEd Maste# shellcheck disable=SC2162
124f374ba41SEd Mastesaved_IFS=$IFS
12519261079SEd MasteIFS="-" read field1 field2 field3 field4 <<EOF
12619261079SEd Maste$1
12719261079SEd MasteEOF
128f374ba41SEd MasteIFS=$saved_IFS
12919261079SEd Maste
13019261079SEd Maste# Separate into logical components for further validation
13119261079SEd Mastecase $1 in
13219261079SEd Maste	*-*-*-*-*)
13319261079SEd Maste		echo Invalid configuration \`"$1"\': more than four components >&2
13419261079SEd Maste		exit 1
13519261079SEd Maste		;;
13619261079SEd Maste	*-*-*-*)
13719261079SEd Maste		basic_machine=$field1-$field2
138f374ba41SEd Maste		basic_os=$field3-$field4
13919261079SEd Maste		;;
14019261079SEd Maste	*-*-*)
14119261079SEd Maste		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
14219261079SEd Maste		# parts
14319261079SEd Maste		maybe_os=$field2-$field3
144ce3adf43SDag-Erling Smørgrav		case $maybe_os in
145f374ba41SEd Maste			nto-qnx* | linux-* | uclinux-uclibc* \
14619261079SEd Maste			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
14719261079SEd Maste			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
148f374ba41SEd Maste			| storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
14919261079SEd Maste				basic_machine=$field1
150f374ba41SEd Maste				basic_os=$maybe_os
151ce3adf43SDag-Erling Smørgrav				;;
152ce3adf43SDag-Erling Smørgrav			android-linux)
15319261079SEd Maste				basic_machine=$field1-unknown
154f374ba41SEd Maste				basic_os=linux-android
155ce3adf43SDag-Erling Smørgrav				;;
156ce3adf43SDag-Erling Smørgrav			*)
15719261079SEd Maste				basic_machine=$field1-$field2
158f374ba41SEd Maste				basic_os=$field3
15919261079SEd Maste				;;
16019261079SEd Maste		esac
16119261079SEd Maste		;;
16219261079SEd Maste	*-*)
16319261079SEd Maste		# A lone config we happen to match not fitting any pattern
16419261079SEd Maste		case $field1-$field2 in
16519261079SEd Maste			decstation-3100)
16619261079SEd Maste				basic_machine=mips-dec
167f374ba41SEd Maste				basic_os=
16819261079SEd Maste				;;
16919261079SEd Maste			*-*)
17019261079SEd Maste				# Second component is usually, but not always the OS
17119261079SEd Maste				case $field2 in
17219261079SEd Maste					# Prevent following clause from handling this valid os
17319261079SEd Maste					sun*os*)
17419261079SEd Maste						basic_machine=$field1
175f374ba41SEd Maste						basic_os=$field2
176f374ba41SEd Maste						;;
177f374ba41SEd Maste					zephyr*)
178f374ba41SEd Maste						basic_machine=$field1-unknown
179f374ba41SEd Maste						basic_os=$field2
18019261079SEd Maste						;;
18119261079SEd Maste					# Manufacturers
18219261079SEd Maste					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
18319261079SEd Maste					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
18419261079SEd Maste					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
18519261079SEd Maste					| convergent* | ncr* | news | 32* | 3600* | 3100* \
18619261079SEd Maste					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
18719261079SEd Maste					| ultra | tti* | harris | dolphin | highlevel | gould \
18819261079SEd Maste					| cbm | ns | masscomp | apple | axis | knuth | cray \
18919261079SEd Maste					| microblaze* | sim | cisco \
19019261079SEd Maste					| oki | wec | wrs | winbond)
19119261079SEd Maste						basic_machine=$field1-$field2
192f374ba41SEd Maste						basic_os=
19319261079SEd Maste						;;
19419261079SEd Maste					*)
19519261079SEd Maste						basic_machine=$field1
196f374ba41SEd Maste						basic_os=$field2
19719261079SEd Maste						;;
19819261079SEd Maste				esac
19919261079SEd Maste			;;
20019261079SEd Maste		esac
20119261079SEd Maste		;;
20219261079SEd Maste	*)
20319261079SEd Maste		# Convert single-component short-hands not valid as part of
20419261079SEd Maste		# multi-component configurations.
20519261079SEd Maste		case $field1 in
20619261079SEd Maste			386bsd)
20719261079SEd Maste				basic_machine=i386-pc
208f374ba41SEd Maste				basic_os=bsd
20919261079SEd Maste				;;
21019261079SEd Maste			a29khif)
21119261079SEd Maste				basic_machine=a29k-amd
212f374ba41SEd Maste				basic_os=udi
21319261079SEd Maste				;;
21419261079SEd Maste			adobe68k)
21519261079SEd Maste				basic_machine=m68010-adobe
216f374ba41SEd Maste				basic_os=scout
21719261079SEd Maste				;;
21819261079SEd Maste			alliant)
21919261079SEd Maste				basic_machine=fx80-alliant
220f374ba41SEd Maste				basic_os=
22119261079SEd Maste				;;
22219261079SEd Maste			altos | altos3068)
22319261079SEd Maste				basic_machine=m68k-altos
224f374ba41SEd Maste				basic_os=
22519261079SEd Maste				;;
22619261079SEd Maste			am29k)
22719261079SEd Maste				basic_machine=a29k-none
228f374ba41SEd Maste				basic_os=bsd
22919261079SEd Maste				;;
23019261079SEd Maste			amdahl)
23119261079SEd Maste				basic_machine=580-amdahl
232f374ba41SEd Maste				basic_os=sysv
23319261079SEd Maste				;;
23419261079SEd Maste			amiga)
23519261079SEd Maste				basic_machine=m68k-unknown
236f374ba41SEd Maste				basic_os=
23719261079SEd Maste				;;
23819261079SEd Maste			amigaos | amigados)
23919261079SEd Maste				basic_machine=m68k-unknown
240f374ba41SEd Maste				basic_os=amigaos
24119261079SEd Maste				;;
24219261079SEd Maste			amigaunix | amix)
24319261079SEd Maste				basic_machine=m68k-unknown
244f374ba41SEd Maste				basic_os=sysv4
24519261079SEd Maste				;;
24619261079SEd Maste			apollo68)
24719261079SEd Maste				basic_machine=m68k-apollo
248f374ba41SEd Maste				basic_os=sysv
24919261079SEd Maste				;;
25019261079SEd Maste			apollo68bsd)
25119261079SEd Maste				basic_machine=m68k-apollo
252f374ba41SEd Maste				basic_os=bsd
25319261079SEd Maste				;;
25419261079SEd Maste			aros)
25519261079SEd Maste				basic_machine=i386-pc
256f374ba41SEd Maste				basic_os=aros
25719261079SEd Maste				;;
25819261079SEd Maste			aux)
25919261079SEd Maste				basic_machine=m68k-apple
260f374ba41SEd Maste				basic_os=aux
26119261079SEd Maste				;;
26219261079SEd Maste			balance)
26319261079SEd Maste				basic_machine=ns32k-sequent
264f374ba41SEd Maste				basic_os=dynix
26519261079SEd Maste				;;
26619261079SEd Maste			blackfin)
26719261079SEd Maste				basic_machine=bfin-unknown
268f374ba41SEd Maste				basic_os=linux
26919261079SEd Maste				;;
27019261079SEd Maste			cegcc)
27119261079SEd Maste				basic_machine=arm-unknown
272f374ba41SEd Maste				basic_os=cegcc
27319261079SEd Maste				;;
27419261079SEd Maste			convex-c1)
27519261079SEd Maste				basic_machine=c1-convex
276f374ba41SEd Maste				basic_os=bsd
27719261079SEd Maste				;;
27819261079SEd Maste			convex-c2)
27919261079SEd Maste				basic_machine=c2-convex
280f374ba41SEd Maste				basic_os=bsd
28119261079SEd Maste				;;
28219261079SEd Maste			convex-c32)
28319261079SEd Maste				basic_machine=c32-convex
284f374ba41SEd Maste				basic_os=bsd
28519261079SEd Maste				;;
28619261079SEd Maste			convex-c34)
28719261079SEd Maste				basic_machine=c34-convex
288f374ba41SEd Maste				basic_os=bsd
28919261079SEd Maste				;;
29019261079SEd Maste			convex-c38)
29119261079SEd Maste				basic_machine=c38-convex
292f374ba41SEd Maste				basic_os=bsd
29319261079SEd Maste				;;
29419261079SEd Maste			cray)
29519261079SEd Maste				basic_machine=j90-cray
296f374ba41SEd Maste				basic_os=unicos
29719261079SEd Maste				;;
29819261079SEd Maste			crds | unos)
29919261079SEd Maste				basic_machine=m68k-crds
300f374ba41SEd Maste				basic_os=
30119261079SEd Maste				;;
30219261079SEd Maste			da30)
30319261079SEd Maste				basic_machine=m68k-da30
304f374ba41SEd Maste				basic_os=
30519261079SEd Maste				;;
30619261079SEd Maste			decstation | pmax | pmin | dec3100 | decstatn)
30719261079SEd Maste				basic_machine=mips-dec
308f374ba41SEd Maste				basic_os=
30919261079SEd Maste				;;
31019261079SEd Maste			delta88)
31119261079SEd Maste				basic_machine=m88k-motorola
312f374ba41SEd Maste				basic_os=sysv3
31319261079SEd Maste				;;
31419261079SEd Maste			dicos)
31519261079SEd Maste				basic_machine=i686-pc
316f374ba41SEd Maste				basic_os=dicos
31719261079SEd Maste				;;
31819261079SEd Maste			djgpp)
31919261079SEd Maste				basic_machine=i586-pc
320f374ba41SEd Maste				basic_os=msdosdjgpp
32119261079SEd Maste				;;
32219261079SEd Maste			ebmon29k)
32319261079SEd Maste				basic_machine=a29k-amd
324f374ba41SEd Maste				basic_os=ebmon
32519261079SEd Maste				;;
32619261079SEd Maste			es1800 | OSE68k | ose68k | ose | OSE)
32719261079SEd Maste				basic_machine=m68k-ericsson
328f374ba41SEd Maste				basic_os=ose
32919261079SEd Maste				;;
33019261079SEd Maste			gmicro)
33119261079SEd Maste				basic_machine=tron-gmicro
332f374ba41SEd Maste				basic_os=sysv
33319261079SEd Maste				;;
33419261079SEd Maste			go32)
33519261079SEd Maste				basic_machine=i386-pc
336f374ba41SEd Maste				basic_os=go32
33719261079SEd Maste				;;
33819261079SEd Maste			h8300hms)
33919261079SEd Maste				basic_machine=h8300-hitachi
340f374ba41SEd Maste				basic_os=hms
34119261079SEd Maste				;;
34219261079SEd Maste			h8300xray)
34319261079SEd Maste				basic_machine=h8300-hitachi
344f374ba41SEd Maste				basic_os=xray
34519261079SEd Maste				;;
34619261079SEd Maste			h8500hms)
34719261079SEd Maste				basic_machine=h8500-hitachi
348f374ba41SEd Maste				basic_os=hms
34919261079SEd Maste				;;
35019261079SEd Maste			harris)
35119261079SEd Maste				basic_machine=m88k-harris
352f374ba41SEd Maste				basic_os=sysv3
35319261079SEd Maste				;;
35419261079SEd Maste			hp300 | hp300hpux)
35519261079SEd Maste				basic_machine=m68k-hp
356f374ba41SEd Maste				basic_os=hpux
35719261079SEd Maste				;;
35819261079SEd Maste			hp300bsd)
35919261079SEd Maste				basic_machine=m68k-hp
360f374ba41SEd Maste				basic_os=bsd
36119261079SEd Maste				;;
36219261079SEd Maste			hppaosf)
36319261079SEd Maste				basic_machine=hppa1.1-hp
364f374ba41SEd Maste				basic_os=osf
36519261079SEd Maste				;;
36619261079SEd Maste			hppro)
36719261079SEd Maste				basic_machine=hppa1.1-hp
368f374ba41SEd Maste				basic_os=proelf
36919261079SEd Maste				;;
37019261079SEd Maste			i386mach)
37119261079SEd Maste				basic_machine=i386-mach
372f374ba41SEd Maste				basic_os=mach
37319261079SEd Maste				;;
37419261079SEd Maste			isi68 | isi)
37519261079SEd Maste				basic_machine=m68k-isi
376f374ba41SEd Maste				basic_os=sysv
37719261079SEd Maste				;;
37819261079SEd Maste			m68knommu)
37919261079SEd Maste				basic_machine=m68k-unknown
380f374ba41SEd Maste				basic_os=linux
38119261079SEd Maste				;;
38219261079SEd Maste			magnum | m3230)
38319261079SEd Maste				basic_machine=mips-mips
384f374ba41SEd Maste				basic_os=sysv
38519261079SEd Maste				;;
38619261079SEd Maste			merlin)
38719261079SEd Maste				basic_machine=ns32k-utek
388f374ba41SEd Maste				basic_os=sysv
38919261079SEd Maste				;;
39019261079SEd Maste			mingw64)
39119261079SEd Maste				basic_machine=x86_64-pc
392f374ba41SEd Maste				basic_os=mingw64
39319261079SEd Maste				;;
39419261079SEd Maste			mingw32)
39519261079SEd Maste				basic_machine=i686-pc
396f374ba41SEd Maste				basic_os=mingw32
39719261079SEd Maste				;;
39819261079SEd Maste			mingw32ce)
39919261079SEd Maste				basic_machine=arm-unknown
400f374ba41SEd Maste				basic_os=mingw32ce
40119261079SEd Maste				;;
40219261079SEd Maste			monitor)
40319261079SEd Maste				basic_machine=m68k-rom68k
404f374ba41SEd Maste				basic_os=coff
40519261079SEd Maste				;;
40619261079SEd Maste			morphos)
40719261079SEd Maste				basic_machine=powerpc-unknown
408f374ba41SEd Maste				basic_os=morphos
40919261079SEd Maste				;;
41019261079SEd Maste			moxiebox)
41119261079SEd Maste				basic_machine=moxie-unknown
412f374ba41SEd Maste				basic_os=moxiebox
41319261079SEd Maste				;;
41419261079SEd Maste			msdos)
41519261079SEd Maste				basic_machine=i386-pc
416f374ba41SEd Maste				basic_os=msdos
41719261079SEd Maste				;;
41819261079SEd Maste			msys)
41919261079SEd Maste				basic_machine=i686-pc
420f374ba41SEd Maste				basic_os=msys
42119261079SEd Maste				;;
42219261079SEd Maste			mvs)
42319261079SEd Maste				basic_machine=i370-ibm
424f374ba41SEd Maste				basic_os=mvs
42519261079SEd Maste				;;
42619261079SEd Maste			nacl)
42719261079SEd Maste				basic_machine=le32-unknown
428f374ba41SEd Maste				basic_os=nacl
42919261079SEd Maste				;;
43019261079SEd Maste			ncr3000)
43119261079SEd Maste				basic_machine=i486-ncr
432f374ba41SEd Maste				basic_os=sysv4
43319261079SEd Maste				;;
43419261079SEd Maste			netbsd386)
43519261079SEd Maste				basic_machine=i386-pc
436f374ba41SEd Maste				basic_os=netbsd
43719261079SEd Maste				;;
43819261079SEd Maste			netwinder)
43919261079SEd Maste				basic_machine=armv4l-rebel
440f374ba41SEd Maste				basic_os=linux
44119261079SEd Maste				;;
44219261079SEd Maste			news | news700 | news800 | news900)
44319261079SEd Maste				basic_machine=m68k-sony
444f374ba41SEd Maste				basic_os=newsos
44519261079SEd Maste				;;
44619261079SEd Maste			news1000)
44719261079SEd Maste				basic_machine=m68030-sony
448f374ba41SEd Maste				basic_os=newsos
44919261079SEd Maste				;;
45019261079SEd Maste			necv70)
45119261079SEd Maste				basic_machine=v70-nec
452f374ba41SEd Maste				basic_os=sysv
45319261079SEd Maste				;;
45419261079SEd Maste			nh3000)
45519261079SEd Maste				basic_machine=m68k-harris
456f374ba41SEd Maste				basic_os=cxux
45719261079SEd Maste				;;
45819261079SEd Maste			nh[45]000)
45919261079SEd Maste				basic_machine=m88k-harris
460f374ba41SEd Maste				basic_os=cxux
46119261079SEd Maste				;;
46219261079SEd Maste			nindy960)
46319261079SEd Maste				basic_machine=i960-intel
464f374ba41SEd Maste				basic_os=nindy
46519261079SEd Maste				;;
46619261079SEd Maste			mon960)
46719261079SEd Maste				basic_machine=i960-intel
468f374ba41SEd Maste				basic_os=mon960
46919261079SEd Maste				;;
47019261079SEd Maste			nonstopux)
47119261079SEd Maste				basic_machine=mips-compaq
472f374ba41SEd Maste				basic_os=nonstopux
47319261079SEd Maste				;;
47419261079SEd Maste			os400)
47519261079SEd Maste				basic_machine=powerpc-ibm
476f374ba41SEd Maste				basic_os=os400
47719261079SEd Maste				;;
47819261079SEd Maste			OSE68000 | ose68000)
47919261079SEd Maste				basic_machine=m68000-ericsson
480f374ba41SEd Maste				basic_os=ose
48119261079SEd Maste				;;
48219261079SEd Maste			os68k)
48319261079SEd Maste				basic_machine=m68k-none
484f374ba41SEd Maste				basic_os=os68k
48519261079SEd Maste				;;
48619261079SEd Maste			paragon)
48719261079SEd Maste				basic_machine=i860-intel
488f374ba41SEd Maste				basic_os=osf
48919261079SEd Maste				;;
49019261079SEd Maste			parisc)
49119261079SEd Maste				basic_machine=hppa-unknown
492f374ba41SEd Maste				basic_os=linux
493f374ba41SEd Maste				;;
494f374ba41SEd Maste			psp)
495f374ba41SEd Maste				basic_machine=mipsallegrexel-sony
496f374ba41SEd Maste				basic_os=psp
49719261079SEd Maste				;;
49819261079SEd Maste			pw32)
49919261079SEd Maste				basic_machine=i586-unknown
500f374ba41SEd Maste				basic_os=pw32
50119261079SEd Maste				;;
50219261079SEd Maste			rdos | rdos64)
50319261079SEd Maste				basic_machine=x86_64-pc
504f374ba41SEd Maste				basic_os=rdos
50519261079SEd Maste				;;
50619261079SEd Maste			rdos32)
50719261079SEd Maste				basic_machine=i386-pc
508f374ba41SEd Maste				basic_os=rdos
50919261079SEd Maste				;;
51019261079SEd Maste			rom68k)
51119261079SEd Maste				basic_machine=m68k-rom68k
512f374ba41SEd Maste				basic_os=coff
51319261079SEd Maste				;;
51419261079SEd Maste			sa29200)
51519261079SEd Maste				basic_machine=a29k-amd
516f374ba41SEd Maste				basic_os=udi
51719261079SEd Maste				;;
51819261079SEd Maste			sei)
51919261079SEd Maste				basic_machine=mips-sei
520f374ba41SEd Maste				basic_os=seiux
52119261079SEd Maste				;;
52219261079SEd Maste			sequent)
52319261079SEd Maste				basic_machine=i386-sequent
524f374ba41SEd Maste				basic_os=
52519261079SEd Maste				;;
52619261079SEd Maste			sps7)
52719261079SEd Maste				basic_machine=m68k-bull
528f374ba41SEd Maste				basic_os=sysv2
52919261079SEd Maste				;;
53019261079SEd Maste			st2000)
53119261079SEd Maste				basic_machine=m68k-tandem
532f374ba41SEd Maste				basic_os=
53319261079SEd Maste				;;
53419261079SEd Maste			stratus)
53519261079SEd Maste				basic_machine=i860-stratus
536f374ba41SEd Maste				basic_os=sysv4
53719261079SEd Maste				;;
53819261079SEd Maste			sun2)
53919261079SEd Maste				basic_machine=m68000-sun
540f374ba41SEd Maste				basic_os=
54119261079SEd Maste				;;
54219261079SEd Maste			sun2os3)
54319261079SEd Maste				basic_machine=m68000-sun
544f374ba41SEd Maste				basic_os=sunos3
54519261079SEd Maste				;;
54619261079SEd Maste			sun2os4)
54719261079SEd Maste				basic_machine=m68000-sun
548f374ba41SEd Maste				basic_os=sunos4
54919261079SEd Maste				;;
55019261079SEd Maste			sun3)
55119261079SEd Maste				basic_machine=m68k-sun
552f374ba41SEd Maste				basic_os=
55319261079SEd Maste				;;
55419261079SEd Maste			sun3os3)
55519261079SEd Maste				basic_machine=m68k-sun
556f374ba41SEd Maste				basic_os=sunos3
55719261079SEd Maste				;;
55819261079SEd Maste			sun3os4)
55919261079SEd Maste				basic_machine=m68k-sun
560f374ba41SEd Maste				basic_os=sunos4
56119261079SEd Maste				;;
56219261079SEd Maste			sun4)
56319261079SEd Maste				basic_machine=sparc-sun
564f374ba41SEd Maste				basic_os=
56519261079SEd Maste				;;
56619261079SEd Maste			sun4os3)
56719261079SEd Maste				basic_machine=sparc-sun
568f374ba41SEd Maste				basic_os=sunos3
56919261079SEd Maste				;;
57019261079SEd Maste			sun4os4)
57119261079SEd Maste				basic_machine=sparc-sun
572f374ba41SEd Maste				basic_os=sunos4
57319261079SEd Maste				;;
57419261079SEd Maste			sun4sol2)
57519261079SEd Maste				basic_machine=sparc-sun
576f374ba41SEd Maste				basic_os=solaris2
57719261079SEd Maste				;;
57819261079SEd Maste			sun386 | sun386i | roadrunner)
57919261079SEd Maste				basic_machine=i386-sun
580f374ba41SEd Maste				basic_os=
58119261079SEd Maste				;;
58219261079SEd Maste			sv1)
58319261079SEd Maste				basic_machine=sv1-cray
584f374ba41SEd Maste				basic_os=unicos
58519261079SEd Maste				;;
58619261079SEd Maste			symmetry)
58719261079SEd Maste				basic_machine=i386-sequent
588f374ba41SEd Maste				basic_os=dynix
58919261079SEd Maste				;;
59019261079SEd Maste			t3e)
59119261079SEd Maste				basic_machine=alphaev5-cray
592f374ba41SEd Maste				basic_os=unicos
59319261079SEd Maste				;;
59419261079SEd Maste			t90)
59519261079SEd Maste				basic_machine=t90-cray
596f374ba41SEd Maste				basic_os=unicos
59719261079SEd Maste				;;
59819261079SEd Maste			toad1)
59919261079SEd Maste				basic_machine=pdp10-xkl
600f374ba41SEd Maste				basic_os=tops20
60119261079SEd Maste				;;
60219261079SEd Maste			tpf)
60319261079SEd Maste				basic_machine=s390x-ibm
604f374ba41SEd Maste				basic_os=tpf
60519261079SEd Maste				;;
60619261079SEd Maste			udi29k)
60719261079SEd Maste				basic_machine=a29k-amd
608f374ba41SEd Maste				basic_os=udi
60919261079SEd Maste				;;
61019261079SEd Maste			ultra3)
61119261079SEd Maste				basic_machine=a29k-nyu
612f374ba41SEd Maste				basic_os=sym1
61319261079SEd Maste				;;
61419261079SEd Maste			v810 | necv810)
61519261079SEd Maste				basic_machine=v810-nec
616f374ba41SEd Maste				basic_os=none
61719261079SEd Maste				;;
61819261079SEd Maste			vaxv)
61919261079SEd Maste				basic_machine=vax-dec
620f374ba41SEd Maste				basic_os=sysv
62119261079SEd Maste				;;
62219261079SEd Maste			vms)
62319261079SEd Maste				basic_machine=vax-dec
624f374ba41SEd Maste				basic_os=vms
62519261079SEd Maste				;;
62619261079SEd Maste			vsta)
62719261079SEd Maste				basic_machine=i386-pc
628f374ba41SEd Maste				basic_os=vsta
62919261079SEd Maste				;;
63019261079SEd Maste			vxworks960)
63119261079SEd Maste				basic_machine=i960-wrs
632f374ba41SEd Maste				basic_os=vxworks
63319261079SEd Maste				;;
63419261079SEd Maste			vxworks68)
63519261079SEd Maste				basic_machine=m68k-wrs
636f374ba41SEd Maste				basic_os=vxworks
63719261079SEd Maste				;;
63819261079SEd Maste			vxworks29k)
63919261079SEd Maste				basic_machine=a29k-wrs
640f374ba41SEd Maste				basic_os=vxworks
64119261079SEd Maste				;;
64219261079SEd Maste			xbox)
64319261079SEd Maste				basic_machine=i686-pc
644f374ba41SEd Maste				basic_os=mingw32
64519261079SEd Maste				;;
64619261079SEd Maste			ymp)
64719261079SEd Maste				basic_machine=ymp-cray
648f374ba41SEd Maste				basic_os=unicos
64919261079SEd Maste				;;
65019261079SEd Maste			*)
65119261079SEd Maste				basic_machine=$1
652f374ba41SEd Maste				basic_os=
65319261079SEd Maste				;;
65419261079SEd Maste		esac
655ce3adf43SDag-Erling Smørgrav		;;
656ce3adf43SDag-Erling Smørgravesac
657ce3adf43SDag-Erling Smørgrav
65819261079SEd Maste# Decode 1-component or ad-hoc basic machines
659ce3adf43SDag-Erling Smørgravcase $basic_machine in
66019261079SEd Maste	# Here we handle the default manufacturer of certain CPU types.  It is in
66119261079SEd Maste	# some cases the only manufacturer, in others, it is the most popular.
66219261079SEd Maste	w89k)
66319261079SEd Maste		cpu=hppa1.1
66419261079SEd Maste		vendor=winbond
66519261079SEd Maste		;;
66619261079SEd Maste	op50n)
66719261079SEd Maste		cpu=hppa1.1
66819261079SEd Maste		vendor=oki
66919261079SEd Maste		;;
67019261079SEd Maste	op60c)
67119261079SEd Maste		cpu=hppa1.1
67219261079SEd Maste		vendor=oki
67319261079SEd Maste		;;
67419261079SEd Maste	ibm*)
67519261079SEd Maste		cpu=i370
67619261079SEd Maste		vendor=ibm
67719261079SEd Maste		;;
67819261079SEd Maste	orion105)
67919261079SEd Maste		cpu=clipper
68019261079SEd Maste		vendor=highlevel
68119261079SEd Maste		;;
68219261079SEd Maste	mac | mpw | mac-mpw)
68319261079SEd Maste		cpu=m68k
68419261079SEd Maste		vendor=apple
68519261079SEd Maste		;;
68619261079SEd Maste	pmac | pmac-mpw)
68719261079SEd Maste		cpu=powerpc
68819261079SEd Maste		vendor=apple
68919261079SEd Maste		;;
69019261079SEd Maste
69119261079SEd Maste	# Recognize the various machine names and aliases which stand
69219261079SEd Maste	# for a CPU type and a company and sometimes even an OS.
69319261079SEd Maste	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
69419261079SEd Maste		cpu=m68000
69519261079SEd Maste		vendor=att
69619261079SEd Maste		;;
69719261079SEd Maste	3b*)
69819261079SEd Maste		cpu=we32k
69919261079SEd Maste		vendor=att
70019261079SEd Maste		;;
70119261079SEd Maste	bluegene*)
70219261079SEd Maste		cpu=powerpc
70319261079SEd Maste		vendor=ibm
704f374ba41SEd Maste		basic_os=cnk
70519261079SEd Maste		;;
70619261079SEd Maste	decsystem10* | dec10*)
70719261079SEd Maste		cpu=pdp10
70819261079SEd Maste		vendor=dec
709f374ba41SEd Maste		basic_os=tops10
71019261079SEd Maste		;;
71119261079SEd Maste	decsystem20* | dec20*)
71219261079SEd Maste		cpu=pdp10
71319261079SEd Maste		vendor=dec
714f374ba41SEd Maste		basic_os=tops20
71519261079SEd Maste		;;
71619261079SEd Maste	delta | 3300 | motorola-3300 | motorola-delta \
71719261079SEd Maste	      | 3300-motorola | delta-motorola)
71819261079SEd Maste		cpu=m68k
71919261079SEd Maste		vendor=motorola
72019261079SEd Maste		;;
72119261079SEd Maste	dpx2*)
72219261079SEd Maste		cpu=m68k
72319261079SEd Maste		vendor=bull
724f374ba41SEd Maste		basic_os=sysv3
72519261079SEd Maste		;;
72619261079SEd Maste	encore | umax | mmax)
72719261079SEd Maste		cpu=ns32k
72819261079SEd Maste		vendor=encore
72919261079SEd Maste		;;
73019261079SEd Maste	elxsi)
73119261079SEd Maste		cpu=elxsi
73219261079SEd Maste		vendor=elxsi
733f374ba41SEd Maste		basic_os=${basic_os:-bsd}
73419261079SEd Maste		;;
73519261079SEd Maste	fx2800)
73619261079SEd Maste		cpu=i860
73719261079SEd Maste		vendor=alliant
73819261079SEd Maste		;;
73919261079SEd Maste	genix)
74019261079SEd Maste		cpu=ns32k
74119261079SEd Maste		vendor=ns
74219261079SEd Maste		;;
74319261079SEd Maste	h3050r* | hiux*)
74419261079SEd Maste		cpu=hppa1.1
74519261079SEd Maste		vendor=hitachi
746f374ba41SEd Maste		basic_os=hiuxwe2
74719261079SEd Maste		;;
74819261079SEd Maste	hp3k9[0-9][0-9] | hp9[0-9][0-9])
74919261079SEd Maste		cpu=hppa1.0
75019261079SEd Maste		vendor=hp
75119261079SEd Maste		;;
75219261079SEd Maste	hp9k2[0-9][0-9] | hp9k31[0-9])
75319261079SEd Maste		cpu=m68000
75419261079SEd Maste		vendor=hp
75519261079SEd Maste		;;
75619261079SEd Maste	hp9k3[2-9][0-9])
75719261079SEd Maste		cpu=m68k
75819261079SEd Maste		vendor=hp
75919261079SEd Maste		;;
76019261079SEd Maste	hp9k6[0-9][0-9] | hp6[0-9][0-9])
76119261079SEd Maste		cpu=hppa1.0
76219261079SEd Maste		vendor=hp
76319261079SEd Maste		;;
76419261079SEd Maste	hp9k7[0-79][0-9] | hp7[0-79][0-9])
76519261079SEd Maste		cpu=hppa1.1
76619261079SEd Maste		vendor=hp
76719261079SEd Maste		;;
76819261079SEd Maste	hp9k78[0-9] | hp78[0-9])
76919261079SEd Maste		# FIXME: really hppa2.0-hp
77019261079SEd Maste		cpu=hppa1.1
77119261079SEd Maste		vendor=hp
77219261079SEd Maste		;;
77319261079SEd Maste	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
77419261079SEd Maste		# FIXME: really hppa2.0-hp
77519261079SEd Maste		cpu=hppa1.1
77619261079SEd Maste		vendor=hp
77719261079SEd Maste		;;
77819261079SEd Maste	hp9k8[0-9][13679] | hp8[0-9][13679])
77919261079SEd Maste		cpu=hppa1.1
78019261079SEd Maste		vendor=hp
78119261079SEd Maste		;;
78219261079SEd Maste	hp9k8[0-9][0-9] | hp8[0-9][0-9])
78319261079SEd Maste		cpu=hppa1.0
78419261079SEd Maste		vendor=hp
78519261079SEd Maste		;;
78619261079SEd Maste	i*86v32)
78719261079SEd Maste		cpu=`echo "$1" | sed -e 's/86.*/86/'`
78819261079SEd Maste		vendor=pc
789f374ba41SEd Maste		basic_os=sysv32
79019261079SEd Maste		;;
79119261079SEd Maste	i*86v4*)
79219261079SEd Maste		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79319261079SEd Maste		vendor=pc
794f374ba41SEd Maste		basic_os=sysv4
79519261079SEd Maste		;;
79619261079SEd Maste	i*86v)
79719261079SEd Maste		cpu=`echo "$1" | sed -e 's/86.*/86/'`
79819261079SEd Maste		vendor=pc
799f374ba41SEd Maste		basic_os=sysv
80019261079SEd Maste		;;
80119261079SEd Maste	i*86sol2)
80219261079SEd Maste		cpu=`echo "$1" | sed -e 's/86.*/86/'`
80319261079SEd Maste		vendor=pc
804f374ba41SEd Maste		basic_os=solaris2
80519261079SEd Maste		;;
80619261079SEd Maste	j90 | j90-cray)
80719261079SEd Maste		cpu=j90
80819261079SEd Maste		vendor=cray
809f374ba41SEd Maste		basic_os=${basic_os:-unicos}
81019261079SEd Maste		;;
81119261079SEd Maste	iris | iris4d)
81219261079SEd Maste		cpu=mips
81319261079SEd Maste		vendor=sgi
814f374ba41SEd Maste		case $basic_os in
81519261079SEd Maste		    irix*)
81619261079SEd Maste			;;
81719261079SEd Maste		    *)
818f374ba41SEd Maste			basic_os=irix4
81919261079SEd Maste			;;
82019261079SEd Maste		esac
82119261079SEd Maste		;;
82219261079SEd Maste	miniframe)
82319261079SEd Maste		cpu=m68000
82419261079SEd Maste		vendor=convergent
82519261079SEd Maste		;;
82619261079SEd Maste	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
82719261079SEd Maste		cpu=m68k
82819261079SEd Maste		vendor=atari
829f374ba41SEd Maste		basic_os=mint
83019261079SEd Maste		;;
83119261079SEd Maste	news-3600 | risc-news)
83219261079SEd Maste		cpu=mips
83319261079SEd Maste		vendor=sony
834f374ba41SEd Maste		basic_os=newsos
83519261079SEd Maste		;;
83619261079SEd Maste	next | m*-next)
83719261079SEd Maste		cpu=m68k
83819261079SEd Maste		vendor=next
839f374ba41SEd Maste		case $basic_os in
84019261079SEd Maste		    openstep*)
84119261079SEd Maste		        ;;
84219261079SEd Maste		    nextstep*)
84319261079SEd Maste			;;
84419261079SEd Maste		    ns2*)
845f374ba41SEd Maste		      basic_os=nextstep2
84619261079SEd Maste			;;
84719261079SEd Maste		    *)
848f374ba41SEd Maste		      basic_os=nextstep3
84919261079SEd Maste			;;
85019261079SEd Maste		esac
85119261079SEd Maste		;;
85219261079SEd Maste	np1)
85319261079SEd Maste		cpu=np1
85419261079SEd Maste		vendor=gould
85519261079SEd Maste		;;
85619261079SEd Maste	op50n-* | op60c-*)
85719261079SEd Maste		cpu=hppa1.1
85819261079SEd Maste		vendor=oki
859f374ba41SEd Maste		basic_os=proelf
86019261079SEd Maste		;;
86119261079SEd Maste	pa-hitachi)
86219261079SEd Maste		cpu=hppa1.1
86319261079SEd Maste		vendor=hitachi
864f374ba41SEd Maste		basic_os=hiuxwe2
86519261079SEd Maste		;;
86619261079SEd Maste	pbd)
86719261079SEd Maste		cpu=sparc
86819261079SEd Maste		vendor=tti
86919261079SEd Maste		;;
87019261079SEd Maste	pbb)
87119261079SEd Maste		cpu=m68k
87219261079SEd Maste		vendor=tti
87319261079SEd Maste		;;
87419261079SEd Maste	pc532)
87519261079SEd Maste		cpu=ns32k
87619261079SEd Maste		vendor=pc532
87719261079SEd Maste		;;
87819261079SEd Maste	pn)
87919261079SEd Maste		cpu=pn
88019261079SEd Maste		vendor=gould
88119261079SEd Maste		;;
88219261079SEd Maste	power)
88319261079SEd Maste		cpu=power
88419261079SEd Maste		vendor=ibm
88519261079SEd Maste		;;
88619261079SEd Maste	ps2)
88719261079SEd Maste		cpu=i386
88819261079SEd Maste		vendor=ibm
88919261079SEd Maste		;;
89019261079SEd Maste	rm[46]00)
89119261079SEd Maste		cpu=mips
89219261079SEd Maste		vendor=siemens
89319261079SEd Maste		;;
89419261079SEd Maste	rtpc | rtpc-*)
89519261079SEd Maste		cpu=romp
89619261079SEd Maste		vendor=ibm
89719261079SEd Maste		;;
89819261079SEd Maste	sde)
89919261079SEd Maste		cpu=mipsisa32
90019261079SEd Maste		vendor=sde
901f374ba41SEd Maste		basic_os=${basic_os:-elf}
90219261079SEd Maste		;;
90319261079SEd Maste	simso-wrs)
90419261079SEd Maste		cpu=sparclite
90519261079SEd Maste		vendor=wrs
906f374ba41SEd Maste		basic_os=vxworks
90719261079SEd Maste		;;
90819261079SEd Maste	tower | tower-32)
90919261079SEd Maste		cpu=m68k
91019261079SEd Maste		vendor=ncr
91119261079SEd Maste		;;
91219261079SEd Maste	vpp*|vx|vx-*)
91319261079SEd Maste		cpu=f301
91419261079SEd Maste		vendor=fujitsu
91519261079SEd Maste		;;
91619261079SEd Maste	w65)
91719261079SEd Maste		cpu=w65
91819261079SEd Maste		vendor=wdc
91919261079SEd Maste		;;
92019261079SEd Maste	w89k-*)
92119261079SEd Maste		cpu=hppa1.1
92219261079SEd Maste		vendor=winbond
923f374ba41SEd Maste		basic_os=proelf
92419261079SEd Maste		;;
92519261079SEd Maste	none)
92619261079SEd Maste		cpu=none
92719261079SEd Maste		vendor=none
92819261079SEd Maste		;;
92919261079SEd Maste	leon|leon[3-9])
93019261079SEd Maste		cpu=sparc
93119261079SEd Maste		vendor=$basic_machine
93219261079SEd Maste		;;
93319261079SEd Maste	leon-*|leon[3-9]-*)
93419261079SEd Maste		cpu=sparc
93519261079SEd Maste		vendor=`echo "$basic_machine" | sed 's/-.*//'`
93619261079SEd Maste		;;
93719261079SEd Maste
93819261079SEd Maste	*-*)
93919261079SEd Maste		# shellcheck disable=SC2162
940f374ba41SEd Maste		saved_IFS=$IFS
94119261079SEd Maste		IFS="-" read cpu vendor <<EOF
94219261079SEd Maste$basic_machine
94319261079SEd MasteEOF
944f374ba41SEd Maste		IFS=$saved_IFS
94519261079SEd Maste		;;
94619261079SEd Maste	# We use `pc' rather than `unknown'
94719261079SEd Maste	# because (1) that's what they normally are, and
94819261079SEd Maste	# (2) the word "unknown" tends to confuse beginning users.
94919261079SEd Maste	i*86 | x86_64)
95019261079SEd Maste		cpu=$basic_machine
95119261079SEd Maste		vendor=pc
95219261079SEd Maste		;;
95319261079SEd Maste	# These rules are duplicated from below for sake of the special case above;
95419261079SEd Maste	# i.e. things that normalized to x86 arches should also default to "pc"
95519261079SEd Maste	pc98)
95619261079SEd Maste		cpu=i386
95719261079SEd Maste		vendor=pc
95819261079SEd Maste		;;
95919261079SEd Maste	x64 | amd64)
96019261079SEd Maste		cpu=x86_64
96119261079SEd Maste		vendor=pc
96219261079SEd Maste		;;
963ce3adf43SDag-Erling Smørgrav	# Recognize the basic CPU types without company name.
96419261079SEd Maste	*)
96519261079SEd Maste		cpu=$basic_machine
96619261079SEd Maste		vendor=unknown
96719261079SEd Maste		;;
96819261079SEd Masteesac
96919261079SEd Maste
97019261079SEd Masteunset -v basic_machine
97119261079SEd Maste
97219261079SEd Maste# Decode basic machines in the full and proper CPU-Company form.
97319261079SEd Mastecase $cpu-$vendor in
97419261079SEd Maste	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
97519261079SEd Maste	# some cases the only manufacturer, in others, it is the most popular.
97619261079SEd Maste	craynv-unknown)
97719261079SEd Maste		vendor=cray
978f374ba41SEd Maste		basic_os=${basic_os:-unicosmp}
97919261079SEd Maste		;;
98019261079SEd Maste	c90-unknown | c90-cray)
98119261079SEd Maste		vendor=cray
982f374ba41SEd Maste		basic_os=${Basic_os:-unicos}
98319261079SEd Maste		;;
98419261079SEd Maste	fx80-unknown)
98519261079SEd Maste		vendor=alliant
98619261079SEd Maste		;;
98719261079SEd Maste	romp-unknown)
98819261079SEd Maste		vendor=ibm
98919261079SEd Maste		;;
99019261079SEd Maste	mmix-unknown)
99119261079SEd Maste		vendor=knuth
99219261079SEd Maste		;;
99319261079SEd Maste	microblaze-unknown | microblazeel-unknown)
99419261079SEd Maste		vendor=xilinx
99519261079SEd Maste		;;
99619261079SEd Maste	rs6000-unknown)
99719261079SEd Maste		vendor=ibm
99819261079SEd Maste		;;
99919261079SEd Maste	vax-unknown)
100019261079SEd Maste		vendor=dec
100119261079SEd Maste		;;
100219261079SEd Maste	pdp11-unknown)
100319261079SEd Maste		vendor=dec
100419261079SEd Maste		;;
100519261079SEd Maste	we32k-unknown)
100619261079SEd Maste		vendor=att
100719261079SEd Maste		;;
100819261079SEd Maste	cydra-unknown)
100919261079SEd Maste		vendor=cydrome
101019261079SEd Maste		;;
101119261079SEd Maste	i370-ibm*)
101219261079SEd Maste		vendor=ibm
101319261079SEd Maste		;;
101419261079SEd Maste	orion-unknown)
101519261079SEd Maste		vendor=highlevel
101619261079SEd Maste		;;
101719261079SEd Maste	xps-unknown | xps100-unknown)
101819261079SEd Maste		cpu=xps100
101919261079SEd Maste		vendor=honeywell
102019261079SEd Maste		;;
102119261079SEd Maste
102219261079SEd Maste	# Here we normalize CPU types with a missing or matching vendor
1023f374ba41SEd Maste	armh-unknown | armh-alt)
1024f374ba41SEd Maste		cpu=armv7l
1025f374ba41SEd Maste		vendor=alt
1026f374ba41SEd Maste		basic_os=${basic_os:-linux-gnueabihf}
1027f374ba41SEd Maste		;;
102819261079SEd Maste	dpx20-unknown | dpx20-bull)
102919261079SEd Maste		cpu=rs6000
103019261079SEd Maste		vendor=bull
1031f374ba41SEd Maste		basic_os=${basic_os:-bosx}
103219261079SEd Maste		;;
103319261079SEd Maste
103419261079SEd Maste	# Here we normalize CPU types irrespective of the vendor
103519261079SEd Maste	amd64-*)
103619261079SEd Maste		cpu=x86_64
103719261079SEd Maste		;;
103819261079SEd Maste	blackfin-*)
103919261079SEd Maste		cpu=bfin
1040f374ba41SEd Maste		basic_os=linux
104119261079SEd Maste		;;
104219261079SEd Maste	c54x-*)
104319261079SEd Maste		cpu=tic54x
104419261079SEd Maste		;;
104519261079SEd Maste	c55x-*)
104619261079SEd Maste		cpu=tic55x
104719261079SEd Maste		;;
104819261079SEd Maste	c6x-*)
104919261079SEd Maste		cpu=tic6x
105019261079SEd Maste		;;
105119261079SEd Maste	e500v[12]-*)
105219261079SEd Maste		cpu=powerpc
1053f374ba41SEd Maste		basic_os=${basic_os}"spe"
105419261079SEd Maste		;;
105519261079SEd Maste	mips3*-*)
105619261079SEd Maste		cpu=mips64
105719261079SEd Maste		;;
105819261079SEd Maste	ms1-*)
105919261079SEd Maste		cpu=mt
106019261079SEd Maste		;;
106119261079SEd Maste	m68knommu-*)
106219261079SEd Maste		cpu=m68k
1063f374ba41SEd Maste		basic_os=linux
106419261079SEd Maste		;;
106519261079SEd Maste	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
106619261079SEd Maste		cpu=s12z
106719261079SEd Maste		;;
106819261079SEd Maste	openrisc-*)
106919261079SEd Maste		cpu=or32
107019261079SEd Maste		;;
107119261079SEd Maste	parisc-*)
107219261079SEd Maste		cpu=hppa
1073f374ba41SEd Maste		basic_os=linux
107419261079SEd Maste		;;
107519261079SEd Maste	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
107619261079SEd Maste		cpu=i586
107719261079SEd Maste		;;
107819261079SEd Maste	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
107919261079SEd Maste		cpu=i686
108019261079SEd Maste		;;
108119261079SEd Maste	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
108219261079SEd Maste		cpu=i686
108319261079SEd Maste		;;
108419261079SEd Maste	pentium4-*)
108519261079SEd Maste		cpu=i786
108619261079SEd Maste		;;
108719261079SEd Maste	pc98-*)
108819261079SEd Maste		cpu=i386
108919261079SEd Maste		;;
109019261079SEd Maste	ppc-* | ppcbe-*)
109119261079SEd Maste		cpu=powerpc
109219261079SEd Maste		;;
109319261079SEd Maste	ppcle-* | powerpclittle-*)
109419261079SEd Maste		cpu=powerpcle
109519261079SEd Maste		;;
109619261079SEd Maste	ppc64-*)
109719261079SEd Maste		cpu=powerpc64
109819261079SEd Maste		;;
109919261079SEd Maste	ppc64le-* | powerpc64little-*)
110019261079SEd Maste		cpu=powerpc64le
110119261079SEd Maste		;;
110219261079SEd Maste	sb1-*)
110319261079SEd Maste		cpu=mipsisa64sb1
110419261079SEd Maste		;;
110519261079SEd Maste	sb1el-*)
110619261079SEd Maste		cpu=mipsisa64sb1el
110719261079SEd Maste		;;
110819261079SEd Maste	sh5e[lb]-*)
110919261079SEd Maste		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
111019261079SEd Maste		;;
111119261079SEd Maste	spur-*)
111219261079SEd Maste		cpu=spur
111319261079SEd Maste		;;
111419261079SEd Maste	strongarm-* | thumb-*)
111519261079SEd Maste		cpu=arm
111619261079SEd Maste		;;
111719261079SEd Maste	tx39-*)
111819261079SEd Maste		cpu=mipstx39
111919261079SEd Maste		;;
112019261079SEd Maste	tx39el-*)
112119261079SEd Maste		cpu=mipstx39el
112219261079SEd Maste		;;
112319261079SEd Maste	x64-*)
112419261079SEd Maste		cpu=x86_64
112519261079SEd Maste		;;
112619261079SEd Maste	xscale-* | xscalee[bl]-*)
112719261079SEd Maste		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
112819261079SEd Maste		;;
1129f374ba41SEd Maste	arm64-* | aarch64le-*)
1130f374ba41SEd Maste		cpu=aarch64
1131f374ba41SEd Maste		;;
113219261079SEd Maste
113319261079SEd Maste	# Recognize the canonical CPU Types that limit and/or modify the
113419261079SEd Maste	# company names they are paired with.
113519261079SEd Maste	cr16-*)
1136f374ba41SEd Maste		basic_os=${basic_os:-elf}
113719261079SEd Maste		;;
113819261079SEd Maste	crisv32-* | etraxfs*-*)
113919261079SEd Maste		cpu=crisv32
114019261079SEd Maste		vendor=axis
114119261079SEd Maste		;;
114219261079SEd Maste	cris-* | etrax*-*)
114319261079SEd Maste		cpu=cris
114419261079SEd Maste		vendor=axis
114519261079SEd Maste		;;
114619261079SEd Maste	crx-*)
1147f374ba41SEd Maste		basic_os=${basic_os:-elf}
114819261079SEd Maste		;;
114919261079SEd Maste	neo-tandem)
115019261079SEd Maste		cpu=neo
115119261079SEd Maste		vendor=tandem
115219261079SEd Maste		;;
115319261079SEd Maste	nse-tandem)
115419261079SEd Maste		cpu=nse
115519261079SEd Maste		vendor=tandem
115619261079SEd Maste		;;
115719261079SEd Maste	nsr-tandem)
115819261079SEd Maste		cpu=nsr
115919261079SEd Maste		vendor=tandem
116019261079SEd Maste		;;
116119261079SEd Maste	nsv-tandem)
116219261079SEd Maste		cpu=nsv
116319261079SEd Maste		vendor=tandem
116419261079SEd Maste		;;
116519261079SEd Maste	nsx-tandem)
116619261079SEd Maste		cpu=nsx
116719261079SEd Maste		vendor=tandem
116819261079SEd Maste		;;
1169f374ba41SEd Maste	mipsallegrexel-sony)
1170f374ba41SEd Maste		cpu=mipsallegrexel
1171f374ba41SEd Maste		vendor=sony
117219261079SEd Maste		;;
117319261079SEd Maste	tile*-*)
1174f374ba41SEd Maste		basic_os=${basic_os:-linux-gnu}
117519261079SEd Maste		;;
117619261079SEd Maste
117719261079SEd Maste	*)
117819261079SEd Maste		# Recognize the canonical CPU types that are allowed with any
117919261079SEd Maste		# company name.
118019261079SEd Maste		case $cpu in
1181ce3adf43SDag-Erling Smørgrav			1750a | 580 \
1182ce3adf43SDag-Erling Smørgrav			| a29k \
1183ce3adf43SDag-Erling Smørgrav			| aarch64 | aarch64_be \
118419261079SEd Maste			| abacus \
118519261079SEd Maste			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
118619261079SEd Maste			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
118719261079SEd Maste			| alphapca5[67] | alpha64pca5[67] \
1188ce3adf43SDag-Erling Smørgrav			| am33_2.0 \
118919261079SEd Maste			| amdgcn \
1190f374ba41SEd Maste			| arc | arceb | arc32 | arc64 \
119119261079SEd Maste			| arm | arm[lb]e | arme[lb] | armv* \
1192ce3adf43SDag-Erling Smørgrav			| avr | avr32 \
119319261079SEd Maste			| asmjs \
1194ca86bcf2SDag-Erling Smørgrav			| ba \
1195ce3adf43SDag-Erling Smørgrav			| be32 | be64 \
119619261079SEd Maste			| bfin | bpf | bs2000 \
119719261079SEd Maste			| c[123]* | c30 | [cjt]90 | c4x \
119819261079SEd Maste			| c8051 | clipper | craynv | csky | cydra \
1199ce3adf43SDag-Erling Smørgrav			| d10v | d30v | dlx | dsp16xx \
120019261079SEd Maste			| e2k | elxsi | epiphany \
120119261079SEd Maste			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
120219261079SEd Maste			| h8300 | h8500 \
120319261079SEd Maste			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1204ce3adf43SDag-Erling Smørgrav			| hexagon \
120519261079SEd Maste			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1206ce3adf43SDag-Erling Smørgrav			| ip2k | iq2000 \
1207ca86bcf2SDag-Erling Smørgrav			| k1om \
1208ce3adf43SDag-Erling Smørgrav			| le32 | le64 \
1209ce3adf43SDag-Erling Smørgrav			| lm32 \
1210f374ba41SEd Maste			| loongarch32 | loongarch64 \
121119261079SEd Maste			| m32c | m32r | m32rle \
121219261079SEd Maste			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
121319261079SEd Maste			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
121419261079SEd Maste			| m88110 | m88k | maxq | mb | mcore | mep | metag \
121519261079SEd Maste			| microblaze | microblazeel \
1216ce3adf43SDag-Erling Smørgrav			| mips | mipsbe | mipseb | mipsel | mipsle \
1217ce3adf43SDag-Erling Smørgrav			| mips16 \
121819261079SEd Maste			| mips64 | mips64eb | mips64el \
1219ce3adf43SDag-Erling Smørgrav			| mips64octeon | mips64octeonel \
1220ce3adf43SDag-Erling Smørgrav			| mips64orion | mips64orionel \
1221ce3adf43SDag-Erling Smørgrav			| mips64r5900 | mips64r5900el \
1222ce3adf43SDag-Erling Smørgrav			| mips64vr | mips64vrel \
1223ce3adf43SDag-Erling Smørgrav			| mips64vr4100 | mips64vr4100el \
1224ce3adf43SDag-Erling Smørgrav			| mips64vr4300 | mips64vr4300el \
1225ce3adf43SDag-Erling Smørgrav			| mips64vr5000 | mips64vr5000el \
1226ce3adf43SDag-Erling Smørgrav			| mips64vr5900 | mips64vr5900el \
1227ce3adf43SDag-Erling Smørgrav			| mipsisa32 | mipsisa32el \
1228ce3adf43SDag-Erling Smørgrav			| mipsisa32r2 | mipsisa32r2el \
1229f374ba41SEd Maste			| mipsisa32r3 | mipsisa32r3el \
1230f374ba41SEd Maste			| mipsisa32r5 | mipsisa32r5el \
1231ca86bcf2SDag-Erling Smørgrav			| mipsisa32r6 | mipsisa32r6el \
1232ce3adf43SDag-Erling Smørgrav			| mipsisa64 | mipsisa64el \
1233ce3adf43SDag-Erling Smørgrav			| mipsisa64r2 | mipsisa64r2el \
1234f374ba41SEd Maste			| mipsisa64r3 | mipsisa64r3el \
1235f374ba41SEd Maste			| mipsisa64r5 | mipsisa64r5el \
1236ca86bcf2SDag-Erling Smørgrav			| mipsisa64r6 | mipsisa64r6el \
1237ce3adf43SDag-Erling Smørgrav			| mipsisa64sb1 | mipsisa64sb1el \
1238ce3adf43SDag-Erling Smørgrav			| mipsisa64sr71k | mipsisa64sr71kel \
1239ca86bcf2SDag-Erling Smørgrav			| mipsr5900 | mipsr5900el \
1240ce3adf43SDag-Erling Smørgrav			| mipstx39 | mipstx39el \
124119261079SEd Maste			| mmix \
1242ce3adf43SDag-Erling Smørgrav			| mn10200 | mn10300 \
1243ce3adf43SDag-Erling Smørgrav			| moxie \
1244ce3adf43SDag-Erling Smørgrav			| mt \
1245ce3adf43SDag-Erling Smørgrav			| msp430 \
1246ce3adf43SDag-Erling Smørgrav			| nds32 | nds32le | nds32be \
124719261079SEd Maste			| nfp \
1248ca86bcf2SDag-Erling Smørgrav			| nios | nios2 | nios2eb | nios2el \
124919261079SEd Maste			| none | np1 | ns16k | ns32k | nvptx \
125019261079SEd Maste			| open8 \
125119261079SEd Maste			| or1k* \
125219261079SEd Maste			| or32 \
125319261079SEd Maste			| orion \
125419261079SEd Maste			| picochip \
125519261079SEd Maste			| pdp10 | pdp11 | pj | pjl | pn | power \
125619261079SEd Maste			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
125719261079SEd Maste			| pru \
1258ce3adf43SDag-Erling Smørgrav			| pyramid \
1259f374ba41SEd Maste			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
126019261079SEd Maste			| rl78 | romp | rs6000 | rx \
1261f374ba41SEd Maste			| s390 | s390x \
1262ce3adf43SDag-Erling Smørgrav			| score \
126319261079SEd Maste			| sh | shl \
126419261079SEd Maste			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
126519261079SEd Maste			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
126619261079SEd Maste			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
126719261079SEd Maste			| sparclite \
126819261079SEd Maste			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1269ce3adf43SDag-Erling Smørgrav			| spu \
127019261079SEd Maste			| tahoe \
1271f374ba41SEd Maste			| thumbv7* \
127219261079SEd Maste			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
127319261079SEd Maste			| tron \
1274ce3adf43SDag-Erling Smørgrav			| ubicom32 \
127519261079SEd Maste			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
127619261079SEd Maste			| vax \
1277ca86bcf2SDag-Erling Smørgrav			| visium \
127819261079SEd Maste			| w65 \
127919261079SEd Maste			| wasm32 | wasm64 \
1280ce3adf43SDag-Erling Smørgrav			| we32k \
128119261079SEd Maste			| x86 | x86_64 | xc16x | xgate | xps100 \
128219261079SEd Maste			| xstormy16 | xtensa* \
128319261079SEd Maste			| ymp \
1284ce3adf43SDag-Erling Smørgrav			| z8k | z80)
1285ce3adf43SDag-Erling Smørgrav				;;
1286ce3adf43SDag-Erling Smørgrav
128719261079SEd Maste			*)
128819261079SEd Maste				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1289ce3adf43SDag-Erling Smørgrav				exit 1
1290ce3adf43SDag-Erling Smørgrav				;;
1291ce3adf43SDag-Erling Smørgrav		esac
1292ce3adf43SDag-Erling Smørgrav		;;
1293ce3adf43SDag-Erling Smørgravesac
1294ce3adf43SDag-Erling Smørgrav
1295ce3adf43SDag-Erling Smørgrav# Here we canonicalize certain aliases for manufacturers.
129619261079SEd Mastecase $vendor in
129719261079SEd Maste	digital*)
129819261079SEd Maste		vendor=dec
1299ce3adf43SDag-Erling Smørgrav		;;
130019261079SEd Maste	commodore*)
130119261079SEd Maste		vendor=cbm
1302ce3adf43SDag-Erling Smørgrav		;;
1303ce3adf43SDag-Erling Smørgrav	*)
1304ce3adf43SDag-Erling Smørgrav		;;
1305ce3adf43SDag-Erling Smørgravesac
1306ce3adf43SDag-Erling Smørgrav
1307ce3adf43SDag-Erling Smørgrav# Decode manufacturer-specific aliases for certain operating systems.
1308ce3adf43SDag-Erling Smørgrav
1309f374ba41SEd Masteif test x$basic_os != x
1310ce3adf43SDag-Erling Smørgravthen
1311f374ba41SEd Maste
1312f374ba41SEd Maste# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
1313f374ba41SEd Maste# set os.
1314f374ba41SEd Mastecase $basic_os in
1315f374ba41SEd Maste	gnu/linux*)
1316f374ba41SEd Maste		kernel=linux
1317f374ba41SEd Maste		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1318f374ba41SEd Maste		;;
1319f374ba41SEd Maste	os2-emx)
1320f374ba41SEd Maste		kernel=os2
1321f374ba41SEd Maste		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1322f374ba41SEd Maste		;;
1323f374ba41SEd Maste	nto-qnx*)
1324f374ba41SEd Maste		kernel=nto
1325f374ba41SEd Maste		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1326f374ba41SEd Maste		;;
1327f374ba41SEd Maste	*-*)
1328f374ba41SEd Maste		# shellcheck disable=SC2162
1329f374ba41SEd Maste		saved_IFS=$IFS
1330f374ba41SEd Maste		IFS="-" read kernel os <<EOF
1331f374ba41SEd Maste$basic_os
1332f374ba41SEd MasteEOF
1333f374ba41SEd Maste		IFS=$saved_IFS
1334f374ba41SEd Maste		;;
1335f374ba41SEd Maste	# Default OS when just kernel was specified
1336f374ba41SEd Maste	nto*)
1337f374ba41SEd Maste		kernel=nto
1338f374ba41SEd Maste		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1339f374ba41SEd Maste		;;
1340f374ba41SEd Maste	linux*)
1341f374ba41SEd Maste		kernel=linux
1342f374ba41SEd Maste		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1343f374ba41SEd Maste		;;
1344f374ba41SEd Maste	managarm*)
1345f374ba41SEd Maste		kernel=managarm
1346f374ba41SEd Maste		os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
1347f374ba41SEd Maste		;;
1348f374ba41SEd Maste	*)
1349f374ba41SEd Maste		kernel=
1350f374ba41SEd Maste		os=$basic_os
1351f374ba41SEd Maste		;;
1352f374ba41SEd Masteesac
1353f374ba41SEd Maste
1354f374ba41SEd Maste# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1355f374ba41SEd Maste# etc.)
1356ce3adf43SDag-Erling Smørgravcase $os in
135719261079SEd Maste	# First match some system type aliases that might get confused
135819261079SEd Maste	# with valid system types.
135919261079SEd Maste	# solaris* is a basic system type, with this one exception.
136019261079SEd Maste	auroraux)
136119261079SEd Maste		os=auroraux
1362ce3adf43SDag-Erling Smørgrav		;;
136319261079SEd Maste	bluegene*)
136419261079SEd Maste		os=cnk
136519261079SEd Maste		;;
136619261079SEd Maste	solaris1 | solaris1.*)
1367f374ba41SEd Maste		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1368ce3adf43SDag-Erling Smørgrav		;;
136919261079SEd Maste	solaris)
137019261079SEd Maste		os=solaris2
1371ce3adf43SDag-Erling Smørgrav		;;
137219261079SEd Maste	unixware*)
137319261079SEd Maste		os=sysv4.2uw
1374ce3adf43SDag-Erling Smørgrav		;;
137519261079SEd Maste	# es1800 is here to avoid being matched by es* (a different OS)
137619261079SEd Maste	es1800*)
137719261079SEd Maste		os=ose
137819261079SEd Maste		;;
137919261079SEd Maste	# Some version numbers need modification
138019261079SEd Maste	chorusos*)
138119261079SEd Maste		os=chorusos
138219261079SEd Maste		;;
138319261079SEd Maste	isc)
138419261079SEd Maste		os=isc2.2
138519261079SEd Maste		;;
138619261079SEd Maste	sco6)
138719261079SEd Maste		os=sco5v6
138819261079SEd Maste		;;
138919261079SEd Maste	sco5)
139019261079SEd Maste		os=sco3.2v5
139119261079SEd Maste		;;
139219261079SEd Maste	sco4)
139319261079SEd Maste		os=sco3.2v4
139419261079SEd Maste		;;
139519261079SEd Maste	sco3.2.[4-9]*)
1396f374ba41SEd Maste		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
139719261079SEd Maste		;;
1398f374ba41SEd Maste	sco*v* | scout)
139919261079SEd Maste		# Don't match below
140019261079SEd Maste		;;
140119261079SEd Maste	sco*)
140219261079SEd Maste		os=sco3.2v2
140319261079SEd Maste		;;
140419261079SEd Maste	psos*)
140519261079SEd Maste		os=psos
140619261079SEd Maste		;;
140719261079SEd Maste	qnx*)
1408f374ba41SEd Maste		os=qnx
1409ce3adf43SDag-Erling Smørgrav		;;
141019261079SEd Maste	hiux*)
141119261079SEd Maste		os=hiuxwe2
1412ce3adf43SDag-Erling Smørgrav		;;
141319261079SEd Maste	lynx*178)
141419261079SEd Maste		os=lynxos178
1415ce3adf43SDag-Erling Smørgrav		;;
141619261079SEd Maste	lynx*5)
141719261079SEd Maste		os=lynxos5
1418ce3adf43SDag-Erling Smørgrav		;;
1419f374ba41SEd Maste	lynxos*)
1420f374ba41SEd Maste		# don't get caught up in next wildcard
1421f374ba41SEd Maste		;;
142219261079SEd Maste	lynx*)
142319261079SEd Maste		os=lynxos
1424ce3adf43SDag-Erling Smørgrav		;;
1425f374ba41SEd Maste	mac[0-9]*)
142619261079SEd Maste		os=`echo "$os" | sed -e 's|mac|macos|'`
1427ce3adf43SDag-Erling Smørgrav		;;
142819261079SEd Maste	opened*)
142919261079SEd Maste		os=openedition
1430ce3adf43SDag-Erling Smørgrav		;;
143119261079SEd Maste	os400*)
143219261079SEd Maste		os=os400
1433ce3adf43SDag-Erling Smørgrav		;;
143419261079SEd Maste	sunos5*)
143519261079SEd Maste		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1436ce3adf43SDag-Erling Smørgrav		;;
143719261079SEd Maste	sunos6*)
143819261079SEd Maste		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1439ce3adf43SDag-Erling Smørgrav		;;
144019261079SEd Maste	wince*)
144119261079SEd Maste		os=wince
1442ce3adf43SDag-Erling Smørgrav		;;
144319261079SEd Maste	utek*)
144419261079SEd Maste		os=bsd
1445ce3adf43SDag-Erling Smørgrav		;;
144619261079SEd Maste	dynix*)
144719261079SEd Maste		os=bsd
1448ce3adf43SDag-Erling Smørgrav		;;
144919261079SEd Maste	acis*)
145019261079SEd Maste		os=aos
1451ce3adf43SDag-Erling Smørgrav		;;
145219261079SEd Maste	atheos*)
145319261079SEd Maste		os=atheos
1454ce3adf43SDag-Erling Smørgrav		;;
145519261079SEd Maste	syllable*)
145619261079SEd Maste		os=syllable
1457ce3adf43SDag-Erling Smørgrav		;;
145819261079SEd Maste	386bsd)
145919261079SEd Maste		os=bsd
1460ce3adf43SDag-Erling Smørgrav		;;
146119261079SEd Maste	ctix* | uts*)
146219261079SEd Maste		os=sysv
1463ce3adf43SDag-Erling Smørgrav		;;
146419261079SEd Maste	nova*)
146519261079SEd Maste		os=rtmk-nova
146619261079SEd Maste		;;
146719261079SEd Maste	ns2)
146819261079SEd Maste		os=nextstep2
1469ce3adf43SDag-Erling Smørgrav		;;
1470ce3adf43SDag-Erling Smørgrav	# Preserve the version number of sinix5.
147119261079SEd Maste	sinix5.*)
1472f374ba41SEd Maste		os=`echo "$os" | sed -e 's|sinix|sysv|'`
1473ce3adf43SDag-Erling Smørgrav		;;
147419261079SEd Maste	sinix*)
147519261079SEd Maste		os=sysv4
1476ce3adf43SDag-Erling Smørgrav		;;
147719261079SEd Maste	tpf*)
147819261079SEd Maste		os=tpf
1479ce3adf43SDag-Erling Smørgrav		;;
148019261079SEd Maste	triton*)
148119261079SEd Maste		os=sysv3
1482ce3adf43SDag-Erling Smørgrav		;;
148319261079SEd Maste	oss*)
148419261079SEd Maste		os=sysv3
1485ce3adf43SDag-Erling Smørgrav		;;
148619261079SEd Maste	svr4*)
148719261079SEd Maste		os=sysv4
1488ce3adf43SDag-Erling Smørgrav		;;
148919261079SEd Maste	svr3)
149019261079SEd Maste		os=sysv3
1491ce3adf43SDag-Erling Smørgrav		;;
149219261079SEd Maste	sysvr4)
149319261079SEd Maste		os=sysv4
1494ce3adf43SDag-Erling Smørgrav		;;
149519261079SEd Maste	ose*)
149619261079SEd Maste		os=ose
1497ce3adf43SDag-Erling Smørgrav		;;
149819261079SEd Maste	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
149919261079SEd Maste		os=mint
1500ce3adf43SDag-Erling Smørgrav		;;
150119261079SEd Maste	dicos*)
150219261079SEd Maste		os=dicos
1503ce3adf43SDag-Erling Smørgrav		;;
150419261079SEd Maste	pikeos*)
150519261079SEd Maste		# Until real need of OS specific support for
150619261079SEd Maste		# particular features comes up, bare metal
150719261079SEd Maste		# configurations are quite functional.
150819261079SEd Maste		case $cpu in
150919261079SEd Maste		    arm*)
151019261079SEd Maste			os=eabi
1511ce3adf43SDag-Erling Smørgrav			;;
1512ce3adf43SDag-Erling Smørgrav		    *)
151319261079SEd Maste			os=elf
151419261079SEd Maste			;;
151519261079SEd Maste		esac
151619261079SEd Maste		;;
151719261079SEd Maste	*)
1518f374ba41SEd Maste		# No normalization, but not necessarily accepted, that comes below.
1519ce3adf43SDag-Erling Smørgrav		;;
1520ce3adf43SDag-Erling Smørgravesac
1521f374ba41SEd Maste
1522ce3adf43SDag-Erling Smørgravelse
1523ce3adf43SDag-Erling Smørgrav
1524ce3adf43SDag-Erling Smørgrav# Here we handle the default operating systems that come with various machines.
1525ce3adf43SDag-Erling Smørgrav# The value should be what the vendor currently ships out the door with their
1526ce3adf43SDag-Erling Smørgrav# machine or put another way, the most popular os provided with the machine.
1527ce3adf43SDag-Erling Smørgrav
1528ce3adf43SDag-Erling Smørgrav# Note that if you're going to try to match "-MANUFACTURER" here (say,
1529ce3adf43SDag-Erling Smørgrav# "-sun"), then you have to tell the case statement up towards the top
1530ce3adf43SDag-Erling Smørgrav# that MANUFACTURER isn't an operating system.  Otherwise, code above
1531ce3adf43SDag-Erling Smørgrav# will signal an error saying that MANUFACTURER isn't an operating
1532ce3adf43SDag-Erling Smørgrav# system, and we'll never get to this point.
1533ce3adf43SDag-Erling Smørgrav
1534f374ba41SEd Mastekernel=
153519261079SEd Mastecase $cpu-$vendor in
1536ce3adf43SDag-Erling Smørgrav	score-*)
153719261079SEd Maste		os=elf
1538ce3adf43SDag-Erling Smørgrav		;;
1539ce3adf43SDag-Erling Smørgrav	spu-*)
154019261079SEd Maste		os=elf
1541ce3adf43SDag-Erling Smørgrav		;;
1542ce3adf43SDag-Erling Smørgrav	*-acorn)
154319261079SEd Maste		os=riscix1.2
1544ce3adf43SDag-Erling Smørgrav		;;
1545ce3adf43SDag-Erling Smørgrav	arm*-rebel)
1546f374ba41SEd Maste		kernel=linux
1547f374ba41SEd Maste		os=gnu
1548ce3adf43SDag-Erling Smørgrav		;;
1549ce3adf43SDag-Erling Smørgrav	arm*-semi)
155019261079SEd Maste		os=aout
1551ce3adf43SDag-Erling Smørgrav		;;
1552ce3adf43SDag-Erling Smørgrav	c4x-* | tic4x-*)
155319261079SEd Maste		os=coff
1554ce3adf43SDag-Erling Smørgrav		;;
1555ca86bcf2SDag-Erling Smørgrav	c8051-*)
155619261079SEd Maste		os=elf
155719261079SEd Maste		;;
155819261079SEd Maste	clipper-intergraph)
155919261079SEd Maste		os=clix
1560ca86bcf2SDag-Erling Smørgrav		;;
1561ce3adf43SDag-Erling Smørgrav	hexagon-*)
156219261079SEd Maste		os=elf
1563ce3adf43SDag-Erling Smørgrav		;;
1564ce3adf43SDag-Erling Smørgrav	tic54x-*)
156519261079SEd Maste		os=coff
1566ce3adf43SDag-Erling Smørgrav		;;
1567ce3adf43SDag-Erling Smørgrav	tic55x-*)
156819261079SEd Maste		os=coff
1569ce3adf43SDag-Erling Smørgrav		;;
1570ce3adf43SDag-Erling Smørgrav	tic6x-*)
157119261079SEd Maste		os=coff
1572ce3adf43SDag-Erling Smørgrav		;;
1573ce3adf43SDag-Erling Smørgrav	# This must come before the *-dec entry.
1574ce3adf43SDag-Erling Smørgrav	pdp10-*)
157519261079SEd Maste		os=tops20
1576ce3adf43SDag-Erling Smørgrav		;;
1577ce3adf43SDag-Erling Smørgrav	pdp11-*)
157819261079SEd Maste		os=none
1579ce3adf43SDag-Erling Smørgrav		;;
1580ce3adf43SDag-Erling Smørgrav	*-dec | vax-*)
158119261079SEd Maste		os=ultrix4.2
1582ce3adf43SDag-Erling Smørgrav		;;
1583ce3adf43SDag-Erling Smørgrav	m68*-apollo)
158419261079SEd Maste		os=domain
1585ce3adf43SDag-Erling Smørgrav		;;
1586ce3adf43SDag-Erling Smørgrav	i386-sun)
158719261079SEd Maste		os=sunos4.0.2
1588ce3adf43SDag-Erling Smørgrav		;;
1589ce3adf43SDag-Erling Smørgrav	m68000-sun)
159019261079SEd Maste		os=sunos3
1591ce3adf43SDag-Erling Smørgrav		;;
1592ce3adf43SDag-Erling Smørgrav	m68*-cisco)
159319261079SEd Maste		os=aout
1594ce3adf43SDag-Erling Smørgrav		;;
1595ce3adf43SDag-Erling Smørgrav	mep-*)
159619261079SEd Maste		os=elf
1597ce3adf43SDag-Erling Smørgrav		;;
1598ce3adf43SDag-Erling Smørgrav	mips*-cisco)
159919261079SEd Maste		os=elf
1600ce3adf43SDag-Erling Smørgrav		;;
1601ce3adf43SDag-Erling Smørgrav	mips*-*)
160219261079SEd Maste		os=elf
1603ce3adf43SDag-Erling Smørgrav		;;
1604ce3adf43SDag-Erling Smørgrav	or32-*)
160519261079SEd Maste		os=coff
1606ce3adf43SDag-Erling Smørgrav		;;
1607ce3adf43SDag-Erling Smørgrav	*-tti)	# must be before sparc entry or we get the wrong os.
160819261079SEd Maste		os=sysv3
1609ce3adf43SDag-Erling Smørgrav		;;
1610ce3adf43SDag-Erling Smørgrav	sparc-* | *-sun)
161119261079SEd Maste		os=sunos4.1.1
161219261079SEd Maste		;;
161319261079SEd Maste	pru-*)
161419261079SEd Maste		os=elf
1615ce3adf43SDag-Erling Smørgrav		;;
1616ce3adf43SDag-Erling Smørgrav	*-be)
161719261079SEd Maste		os=beos
1618ce3adf43SDag-Erling Smørgrav		;;
1619ce3adf43SDag-Erling Smørgrav	*-ibm)
162019261079SEd Maste		os=aix
1621ce3adf43SDag-Erling Smørgrav		;;
1622ce3adf43SDag-Erling Smørgrav	*-knuth)
162319261079SEd Maste		os=mmixware
1624ce3adf43SDag-Erling Smørgrav		;;
1625ce3adf43SDag-Erling Smørgrav	*-wec)
162619261079SEd Maste		os=proelf
1627ce3adf43SDag-Erling Smørgrav		;;
1628ce3adf43SDag-Erling Smørgrav	*-winbond)
162919261079SEd Maste		os=proelf
1630ce3adf43SDag-Erling Smørgrav		;;
1631ce3adf43SDag-Erling Smørgrav	*-oki)
163219261079SEd Maste		os=proelf
1633ce3adf43SDag-Erling Smørgrav		;;
1634ce3adf43SDag-Erling Smørgrav	*-hp)
163519261079SEd Maste		os=hpux
1636ce3adf43SDag-Erling Smørgrav		;;
1637ce3adf43SDag-Erling Smørgrav	*-hitachi)
163819261079SEd Maste		os=hiux
1639ce3adf43SDag-Erling Smørgrav		;;
1640ce3adf43SDag-Erling Smørgrav	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
164119261079SEd Maste		os=sysv
1642ce3adf43SDag-Erling Smørgrav		;;
1643ce3adf43SDag-Erling Smørgrav	*-cbm)
164419261079SEd Maste		os=amigaos
1645ce3adf43SDag-Erling Smørgrav		;;
1646ce3adf43SDag-Erling Smørgrav	*-dg)
164719261079SEd Maste		os=dgux
1648ce3adf43SDag-Erling Smørgrav		;;
1649ce3adf43SDag-Erling Smørgrav	*-dolphin)
165019261079SEd Maste		os=sysv3
1651ce3adf43SDag-Erling Smørgrav		;;
1652ce3adf43SDag-Erling Smørgrav	m68k-ccur)
165319261079SEd Maste		os=rtu
1654ce3adf43SDag-Erling Smørgrav		;;
1655ce3adf43SDag-Erling Smørgrav	m88k-omron*)
165619261079SEd Maste		os=luna
1657ce3adf43SDag-Erling Smørgrav		;;
1658ce3adf43SDag-Erling Smørgrav	*-next)
165919261079SEd Maste		os=nextstep
1660ce3adf43SDag-Erling Smørgrav		;;
1661ce3adf43SDag-Erling Smørgrav	*-sequent)
166219261079SEd Maste		os=ptx
1663ce3adf43SDag-Erling Smørgrav		;;
1664ce3adf43SDag-Erling Smørgrav	*-crds)
166519261079SEd Maste		os=unos
1666ce3adf43SDag-Erling Smørgrav		;;
1667ce3adf43SDag-Erling Smørgrav	*-ns)
166819261079SEd Maste		os=genix
1669ce3adf43SDag-Erling Smørgrav		;;
1670ce3adf43SDag-Erling Smørgrav	i370-*)
167119261079SEd Maste		os=mvs
1672ce3adf43SDag-Erling Smørgrav		;;
1673ce3adf43SDag-Erling Smørgrav	*-gould)
167419261079SEd Maste		os=sysv
1675ce3adf43SDag-Erling Smørgrav		;;
1676ce3adf43SDag-Erling Smørgrav	*-highlevel)
167719261079SEd Maste		os=bsd
1678ce3adf43SDag-Erling Smørgrav		;;
1679ce3adf43SDag-Erling Smørgrav	*-encore)
168019261079SEd Maste		os=bsd
1681ce3adf43SDag-Erling Smørgrav		;;
1682ce3adf43SDag-Erling Smørgrav	*-sgi)
168319261079SEd Maste		os=irix
1684ce3adf43SDag-Erling Smørgrav		;;
1685ce3adf43SDag-Erling Smørgrav	*-siemens)
168619261079SEd Maste		os=sysv4
1687ce3adf43SDag-Erling Smørgrav		;;
1688ce3adf43SDag-Erling Smørgrav	*-masscomp)
168919261079SEd Maste		os=rtu
1690ce3adf43SDag-Erling Smørgrav		;;
1691ce3adf43SDag-Erling Smørgrav	f30[01]-fujitsu | f700-fujitsu)
169219261079SEd Maste		os=uxpv
1693ce3adf43SDag-Erling Smørgrav		;;
1694ce3adf43SDag-Erling Smørgrav	*-rom68k)
169519261079SEd Maste		os=coff
1696ce3adf43SDag-Erling Smørgrav		;;
1697ce3adf43SDag-Erling Smørgrav	*-*bug)
169819261079SEd Maste		os=coff
1699ce3adf43SDag-Erling Smørgrav		;;
1700ce3adf43SDag-Erling Smørgrav	*-apple)
170119261079SEd Maste		os=macos
1702ce3adf43SDag-Erling Smørgrav		;;
1703ce3adf43SDag-Erling Smørgrav	*-atari*)
170419261079SEd Maste		os=mint
170519261079SEd Maste		;;
170619261079SEd Maste	*-wrs)
170719261079SEd Maste		os=vxworks
1708ce3adf43SDag-Erling Smørgrav		;;
1709ce3adf43SDag-Erling Smørgrav	*)
171019261079SEd Maste		os=none
1711ce3adf43SDag-Erling Smørgrav		;;
1712ce3adf43SDag-Erling Smørgravesac
1713f374ba41SEd Maste
1714ce3adf43SDag-Erling Smørgravfi
1715ce3adf43SDag-Erling Smørgrav
1716f374ba41SEd Maste# Now, validate our (potentially fixed-up) OS.
1717f374ba41SEd Mastecase $os in
1718f374ba41SEd Maste	# Sometimes we do "kernel-libc", so those need to count as OSes.
1719f374ba41SEd Maste	musl* | newlib* | relibc* | uclibc*)
1720f374ba41SEd Maste		;;
1721f374ba41SEd Maste	# Likewise for "kernel-abi"
1722f374ba41SEd Maste	eabi* | gnueabi*)
1723f374ba41SEd Maste		;;
1724f374ba41SEd Maste	# VxWorks passes extra cpu info in the 4th filed.
1725f374ba41SEd Maste	simlinux | simwindows | spe)
1726f374ba41SEd Maste		;;
1727f374ba41SEd Maste	# Now accept the basic system types.
1728f374ba41SEd Maste	# The portable systems comes first.
1729f374ba41SEd Maste	# Each alternative MUST end in a * to match a version number.
1730f374ba41SEd Maste	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1731f374ba41SEd Maste	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1732f374ba41SEd Maste	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1733f374ba41SEd Maste	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1734f374ba41SEd Maste	     | hiux* | abug | nacl* | netware* | windows* \
1735f374ba41SEd Maste	     | os9* | macos* | osx* | ios* \
1736f374ba41SEd Maste	     | mpw* | magic* | mmixware* | mon960* | lnews* \
1737f374ba41SEd Maste	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1738f374ba41SEd Maste	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
1739f374ba41SEd Maste	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1740f374ba41SEd Maste	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1741f374ba41SEd Maste	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1742f374ba41SEd Maste	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1743f374ba41SEd Maste	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1744f374ba41SEd Maste	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1745f374ba41SEd Maste	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1746f374ba41SEd Maste	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
1747f374ba41SEd Maste	     | chorusrdb* | cegcc* | glidix* | serenity* \
1748f374ba41SEd Maste	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1749f374ba41SEd Maste	     | midipix* | mingw32* | mingw64* | mint* \
1750f374ba41SEd Maste	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1751f374ba41SEd Maste	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1752f374ba41SEd Maste	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1753f374ba41SEd Maste	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1754f374ba41SEd Maste	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1755f374ba41SEd Maste	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1756f374ba41SEd Maste	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1757f374ba41SEd Maste	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1758f374ba41SEd Maste	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1759f374ba41SEd Maste	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1760f374ba41SEd Maste	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1761f374ba41SEd Maste	     | fiwix* | mlibc* )
1762f374ba41SEd Maste		;;
1763f374ba41SEd Maste	# This one is extra strict with allowed versions
1764f374ba41SEd Maste	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1765f374ba41SEd Maste		# Don't forget version if it is 3.2v4 or newer.
1766f374ba41SEd Maste		;;
1767f374ba41SEd Maste	none)
1768f374ba41SEd Maste		;;
1769f374ba41SEd Maste	kernel* )
1770f374ba41SEd Maste		# Restricted further below
1771f374ba41SEd Maste		;;
1772f374ba41SEd Maste	*)
1773f374ba41SEd Maste		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1774f374ba41SEd Maste		exit 1
1775f374ba41SEd Maste		;;
1776f374ba41SEd Masteesac
1777f374ba41SEd Maste
1778f374ba41SEd Maste# As a final step for OS-related things, validate the OS-kernel combination
1779f374ba41SEd Maste# (given a valid OS), if there is a kernel.
1780f374ba41SEd Mastecase $kernel-$os in
1781f374ba41SEd Maste	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1782f374ba41SEd Maste		   | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
1783f374ba41SEd Maste		;;
1784f374ba41SEd Maste	uclinux-uclibc* )
1785f374ba41SEd Maste		;;
1786f374ba41SEd Maste	managarm-mlibc* | managarm-kernel* )
1787f374ba41SEd Maste		;;
1788f374ba41SEd Maste	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
1789f374ba41SEd Maste		# These are just libc implementations, not actual OSes, and thus
1790f374ba41SEd Maste		# require a kernel.
1791f374ba41SEd Maste		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1792f374ba41SEd Maste		exit 1
1793f374ba41SEd Maste		;;
1794f374ba41SEd Maste	-kernel* )
1795f374ba41SEd Maste		echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2
1796f374ba41SEd Maste		exit 1
1797f374ba41SEd Maste		;;
1798f374ba41SEd Maste	*-kernel* )
1799f374ba41SEd Maste		echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2
1800f374ba41SEd Maste		exit 1
1801f374ba41SEd Maste		;;
1802f374ba41SEd Maste	kfreebsd*-gnu* | kopensolaris*-gnu*)
1803f374ba41SEd Maste		;;
1804f374ba41SEd Maste	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1805f374ba41SEd Maste		;;
1806f374ba41SEd Maste	nto-qnx*)
1807f374ba41SEd Maste		;;
1808f374ba41SEd Maste	os2-emx)
1809f374ba41SEd Maste		;;
1810f374ba41SEd Maste	*-eabi* | *-gnueabi*)
1811f374ba41SEd Maste		;;
1812f374ba41SEd Maste	-*)
1813f374ba41SEd Maste		# Blank kernel with real OS is always fine.
1814f374ba41SEd Maste		;;
1815f374ba41SEd Maste	*-*)
1816f374ba41SEd Maste		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1817f374ba41SEd Maste		exit 1
1818f374ba41SEd Maste		;;
1819f374ba41SEd Masteesac
1820f374ba41SEd Maste
1821ce3adf43SDag-Erling Smørgrav# Here we handle the case where we know the os, and the CPU type, but not the
1822ce3adf43SDag-Erling Smørgrav# manufacturer.  We pick the logical manufacturer.
182319261079SEd Mastecase $vendor in
182419261079SEd Maste	unknown)
1825f374ba41SEd Maste		case $cpu-$os in
1826f374ba41SEd Maste			*-riscix*)
1827ce3adf43SDag-Erling Smørgrav				vendor=acorn
1828ce3adf43SDag-Erling Smørgrav				;;
1829f374ba41SEd Maste			*-sunos*)
1830ce3adf43SDag-Erling Smørgrav				vendor=sun
1831ce3adf43SDag-Erling Smørgrav				;;
1832f374ba41SEd Maste			*-cnk* | *-aix*)
1833ce3adf43SDag-Erling Smørgrav				vendor=ibm
1834ce3adf43SDag-Erling Smørgrav				;;
1835f374ba41SEd Maste			*-beos*)
1836ce3adf43SDag-Erling Smørgrav				vendor=be
1837ce3adf43SDag-Erling Smørgrav				;;
1838f374ba41SEd Maste			*-hpux*)
1839ce3adf43SDag-Erling Smørgrav				vendor=hp
1840ce3adf43SDag-Erling Smørgrav				;;
1841f374ba41SEd Maste			*-mpeix*)
1842ce3adf43SDag-Erling Smørgrav				vendor=hp
1843ce3adf43SDag-Erling Smørgrav				;;
1844f374ba41SEd Maste			*-hiux*)
1845ce3adf43SDag-Erling Smørgrav				vendor=hitachi
1846ce3adf43SDag-Erling Smørgrav				;;
1847f374ba41SEd Maste			*-unos*)
1848ce3adf43SDag-Erling Smørgrav				vendor=crds
1849ce3adf43SDag-Erling Smørgrav				;;
1850f374ba41SEd Maste			*-dgux*)
1851ce3adf43SDag-Erling Smørgrav				vendor=dg
1852ce3adf43SDag-Erling Smørgrav				;;
1853f374ba41SEd Maste			*-luna*)
1854ce3adf43SDag-Erling Smørgrav				vendor=omron
1855ce3adf43SDag-Erling Smørgrav				;;
1856f374ba41SEd Maste			*-genix*)
1857ce3adf43SDag-Erling Smørgrav				vendor=ns
1858ce3adf43SDag-Erling Smørgrav				;;
1859f374ba41SEd Maste			*-clix*)
186019261079SEd Maste				vendor=intergraph
186119261079SEd Maste				;;
1862f374ba41SEd Maste			*-mvs* | *-opened*)
1863ce3adf43SDag-Erling Smørgrav				vendor=ibm
1864ce3adf43SDag-Erling Smørgrav				;;
1865f374ba41SEd Maste			*-os400*)
1866ce3adf43SDag-Erling Smørgrav				vendor=ibm
1867ce3adf43SDag-Erling Smørgrav				;;
1868f374ba41SEd Maste			s390-* | s390x-*)
1869f374ba41SEd Maste				vendor=ibm
1870f374ba41SEd Maste				;;
1871f374ba41SEd Maste			*-ptx*)
1872ce3adf43SDag-Erling Smørgrav				vendor=sequent
1873ce3adf43SDag-Erling Smørgrav				;;
1874f374ba41SEd Maste			*-tpf*)
1875ce3adf43SDag-Erling Smørgrav				vendor=ibm
1876ce3adf43SDag-Erling Smørgrav				;;
1877f374ba41SEd Maste			*-vxsim* | *-vxworks* | *-windiss*)
1878ce3adf43SDag-Erling Smørgrav				vendor=wrs
1879ce3adf43SDag-Erling Smørgrav				;;
1880f374ba41SEd Maste			*-aux*)
1881ce3adf43SDag-Erling Smørgrav				vendor=apple
1882ce3adf43SDag-Erling Smørgrav				;;
1883f374ba41SEd Maste			*-hms*)
1884ce3adf43SDag-Erling Smørgrav				vendor=hitachi
1885ce3adf43SDag-Erling Smørgrav				;;
1886f374ba41SEd Maste			*-mpw* | *-macos*)
1887ce3adf43SDag-Erling Smørgrav				vendor=apple
1888ce3adf43SDag-Erling Smørgrav				;;
1889f374ba41SEd Maste			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1890ce3adf43SDag-Erling Smørgrav				vendor=atari
1891ce3adf43SDag-Erling Smørgrav				;;
1892f374ba41SEd Maste			*-vos*)
1893ce3adf43SDag-Erling Smørgrav				vendor=stratus
1894ce3adf43SDag-Erling Smørgrav				;;
1895ce3adf43SDag-Erling Smørgrav		esac
1896ce3adf43SDag-Erling Smørgrav		;;
1897ce3adf43SDag-Erling Smørgravesac
1898ce3adf43SDag-Erling Smørgrav
1899f374ba41SEd Masteecho "$cpu-$vendor-${kernel:+$kernel-}$os"
1900ce3adf43SDag-Erling Smørgravexit
1901ce3adf43SDag-Erling Smørgrav
1902ce3adf43SDag-Erling Smørgrav# Local variables:
190319261079SEd Maste# eval: (add-hook 'before-save-hook 'time-stamp)
1904ce3adf43SDag-Erling Smørgrav# time-stamp-start: "timestamp='"
1905ce3adf43SDag-Erling Smørgrav# time-stamp-format: "%:y-%02m-%02d"
1906ce3adf43SDag-Erling Smørgrav# time-stamp-end: "'"
1907ce3adf43SDag-Erling Smørgrav# End:
1908