xref: /freebsd/contrib/unbound/config.sub (revision 5685098846d7f11ad642d9804d94dc7429a7b212)
125039b37SCy Schubert#! /bin/sh
2b7579f77SDag-Erling Smørgrav# Configuration validation subroutine script.
3b76ef9a7SCy Schubert#   Copyright 1992-2024 Free Software Foundation, Inc.
4b7579f77SDag-Erling Smørgrav
5*56850988SCy Schubert# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale
65469a995SCy Schubert
7*56850988SCy Schuberttimestamp='2024-05-27'
8b7579f77SDag-Erling Smørgrav
9ff825849SDag-Erling Smørgrav# This file is free software; you can redistribute it and/or modify it
10ff825849SDag-Erling Smørgrav# under the terms of the GNU General Public License as published by
119cf5bc93SCy Schubert# the Free Software Foundation, either version 3 of the License, or
12b7579f77SDag-Erling Smørgrav# (at your option) any later version.
13b7579f77SDag-Erling Smørgrav#
14ff825849SDag-Erling Smørgrav# This program is distributed in the hope that it will be useful, but
15ff825849SDag-Erling Smørgrav# WITHOUT ANY WARRANTY; without even the implied warranty of
16ff825849SDag-Erling Smørgrav# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17ff825849SDag-Erling Smørgrav# General Public License for more details.
18b7579f77SDag-Erling Smørgrav#
19b7579f77SDag-Erling Smørgrav# You should have received a copy of the GNU General Public License
2025039b37SCy Schubert# along with this program; if not, see <https://www.gnu.org/licenses/>.
21b7579f77SDag-Erling Smørgrav#
22b7579f77SDag-Erling Smørgrav# As a special exception to the GNU General Public License, if you
23b7579f77SDag-Erling Smørgrav# distribute this file as part of a program that contains a
24b7579f77SDag-Erling Smørgrav# configuration script generated by Autoconf, you may include it under
25ff825849SDag-Erling Smørgrav# the same distribution terms that you use for the rest of that
26ff825849SDag-Erling Smørgrav# program.  This Exception is an additional permission under section 7
27ff825849SDag-Erling Smørgrav# of the GNU General Public License, version 3 ("GPLv3").
28b7579f77SDag-Erling Smørgrav
29b7579f77SDag-Erling Smørgrav
308157cbabSDag-Erling Smørgrav# Please send patches to <config-patches@gnu.org>.
31b7579f77SDag-Erling Smørgrav#
32b7579f77SDag-Erling Smørgrav# Configuration subroutine to validate and canonicalize a configuration type.
33b7579f77SDag-Erling Smørgrav# Supply the specified configuration type as an argument.
34b7579f77SDag-Erling Smørgrav# If it is invalid, we print an error message on stderr and exit with code 1.
35b7579f77SDag-Erling Smørgrav# Otherwise, we print the canonical config type on stdout and succeed.
36b7579f77SDag-Erling Smørgrav
37b7579f77SDag-Erling Smørgrav# You can get the latest version of this script from:
38369c6923SCy Schubert# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
39b7579f77SDag-Erling Smørgrav
40b7579f77SDag-Erling Smørgrav# This file is supposed to be the same for all GNU packages
41b7579f77SDag-Erling Smørgrav# and recognize all the CPU types, system types and aliases
42b7579f77SDag-Erling Smørgrav# that are meaningful with *any* GNU software.
43b7579f77SDag-Erling Smørgrav# Each package is responsible for reporting which valid configurations
44b7579f77SDag-Erling Smørgrav# it does not support.  The user should be able to distinguish
45b7579f77SDag-Erling Smørgrav# a failure to support a valid configuration from a meaningless
46b7579f77SDag-Erling Smørgrav# configuration.
47b7579f77SDag-Erling Smørgrav
48b7579f77SDag-Erling Smørgrav# The goal of this file is to map all the various variations of a given
49b7579f77SDag-Erling Smørgrav# machine specification into a single specification in the form:
50b7579f77SDag-Erling Smørgrav#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
51b7579f77SDag-Erling Smørgrav# or in some cases, the newer four-part form:
52b7579f77SDag-Erling Smørgrav#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
53b7579f77SDag-Erling Smørgrav# It is wrong to echo any other type of specification.
54b7579f77SDag-Erling Smørgrav
555469a995SCy Schubert# The "shellcheck disable" line above the timestamp inhibits complaints
565469a995SCy Schubert# about features and limitations of the classic Bourne shell that were
575469a995SCy Schubert# superseded or lifted in POSIX.  However, this script identifies a wide
585469a995SCy Schubert# variety of pre-POSIX systems that do not have POSIX shells at all, and
595469a995SCy Schubert# even some reasonably current systems (Solaris 10 as case-in-point) still
605469a995SCy Schubert# have a pre-POSIX /bin/sh.
615469a995SCy Schubert
625469a995SCy Schubertme=`echo "$0" | sed -e 's,.*/,,'`
63b7579f77SDag-Erling Smørgrav
64b7579f77SDag-Erling Smørgravusage="\
658157cbabSDag-Erling SmørgravUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
66b7579f77SDag-Erling Smørgrav
67b7579f77SDag-Erling SmørgravCanonicalize a configuration name.
68b7579f77SDag-Erling Smørgrav
6925039b37SCy SchubertOptions:
70b7579f77SDag-Erling Smørgrav  -h, --help         print this help, then exit
71b7579f77SDag-Erling Smørgrav  -t, --time-stamp   print date of last modification, then exit
72b7579f77SDag-Erling Smørgrav  -v, --version      print version number, then exit
73b7579f77SDag-Erling Smørgrav
74b7579f77SDag-Erling SmørgravReport bugs and patches to <config-patches@gnu.org>."
75b7579f77SDag-Erling Smørgrav
76b7579f77SDag-Erling Smørgravversion="\
77b7579f77SDag-Erling SmørgravGNU config.sub ($timestamp)
78b7579f77SDag-Erling Smørgrav
79b76ef9a7SCy SchubertCopyright 1992-2024 Free Software Foundation, Inc.
80b7579f77SDag-Erling Smørgrav
81b7579f77SDag-Erling SmørgravThis is free software; see the source for copying conditions.  There is NO
82b7579f77SDag-Erling Smørgravwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83b7579f77SDag-Erling Smørgrav
84b7579f77SDag-Erling Smørgravhelp="
858f76bb7dSCy SchubertTry '$me --help' for more information."
86b7579f77SDag-Erling Smørgrav
87b7579f77SDag-Erling Smørgrav# Parse command line
88b7579f77SDag-Erling Smørgravwhile test $# -gt 0 ; do
89b7579f77SDag-Erling Smørgrav  case $1 in
90b7579f77SDag-Erling Smørgrav    --time-stamp | --time* | -t )
91b7579f77SDag-Erling Smørgrav       echo "$timestamp" ; exit ;;
92b7579f77SDag-Erling Smørgrav    --version | -v )
93b7579f77SDag-Erling Smørgrav       echo "$version" ; exit ;;
94b7579f77SDag-Erling Smørgrav    --help | --h* | -h )
95b7579f77SDag-Erling Smørgrav       echo "$usage"; exit ;;
96b7579f77SDag-Erling Smørgrav    -- )     # Stop option processing
97b7579f77SDag-Erling Smørgrav       shift; break ;;
98b7579f77SDag-Erling Smørgrav    - )	# Use stdin as input.
99b7579f77SDag-Erling Smørgrav       break ;;
100b7579f77SDag-Erling Smørgrav    -* )
10125039b37SCy Schubert       echo "$me: invalid option $1$help" >&2
102b7579f77SDag-Erling Smørgrav       exit 1 ;;
103b7579f77SDag-Erling Smørgrav
104b7579f77SDag-Erling Smørgrav    *local*)
105b7579f77SDag-Erling Smørgrav       # First pass through any local machine types.
10625039b37SCy Schubert       echo "$1"
107b7579f77SDag-Erling Smørgrav       exit ;;
108b7579f77SDag-Erling Smørgrav
109b7579f77SDag-Erling Smørgrav    * )
110b7579f77SDag-Erling Smørgrav       break ;;
111b7579f77SDag-Erling Smørgrav  esac
112b7579f77SDag-Erling Smørgravdone
113b7579f77SDag-Erling Smørgrav
114b7579f77SDag-Erling Smørgravcase $# in
115b7579f77SDag-Erling Smørgrav 0) echo "$me: missing argument$help" >&2
116b7579f77SDag-Erling Smørgrav    exit 1;;
117b7579f77SDag-Erling Smørgrav 1) ;;
118b7579f77SDag-Erling Smørgrav *) echo "$me: too many arguments$help" >&2
119b7579f77SDag-Erling Smørgrav    exit 1;;
120b7579f77SDag-Erling Smørgravesac
121b7579f77SDag-Erling Smørgrav
12225039b37SCy Schubert# Split fields of configuration type
12324e36522SCy Schubertsaved_IFS=$IFS
12425039b37SCy SchubertIFS="-" read field1 field2 field3 field4 <<EOF
12525039b37SCy Schubert$1
12625039b37SCy SchubertEOF
12724e36522SCy SchubertIFS=$saved_IFS
12825039b37SCy Schubert
12925039b37SCy Schubert# Separate into logical components for further validation
13025039b37SCy Schubertcase $1 in
13125039b37SCy Schubert	*-*-*-*-*)
1328f76bb7dSCy Schubert		echo "Invalid configuration '$1': more than four components" >&2
13325039b37SCy Schubert		exit 1
13425039b37SCy Schubert		;;
13525039b37SCy Schubert	*-*-*-*)
13625039b37SCy Schubert		basic_machine=$field1-$field2
13725039b37SCy Schubert		basic_os=$field3-$field4
13825039b37SCy Schubert		;;
13925039b37SCy Schubert	*-*-*)
14025039b37SCy Schubert		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
14125039b37SCy Schubert		# parts
14225039b37SCy Schubert		maybe_os=$field2-$field3
143b7579f77SDag-Erling Smørgrav		case $maybe_os in
144*56850988SCy Schubert			  cloudabi*-eabi* \
145*56850988SCy Schubert			| kfreebsd*-gnu* \
146*56850988SCy Schubert			| knetbsd*-gnu* \
147*56850988SCy Schubert			| kopensolaris*-gnu* \
148*56850988SCy Schubert			| linux-* \
149*56850988SCy Schubert			| managarm-* \
150*56850988SCy Schubert			| netbsd*-eabi* \
151*56850988SCy Schubert			| netbsd*-gnu* \
152*56850988SCy Schubert			| nto-qnx* \
153*56850988SCy Schubert			| os2-emx* \
154*56850988SCy Schubert			| rtmk-nova* \
155*56850988SCy Schubert			| storm-chaos* \
156*56850988SCy Schubert			| uclinux-gnu* \
157*56850988SCy Schubert			| uclinux-uclibc* \
1588f76bb7dSCy Schubert			| windows-* )
15925039b37SCy Schubert				basic_machine=$field1
16025039b37SCy Schubert				basic_os=$maybe_os
161b7579f77SDag-Erling Smørgrav				;;
1628ed2b524SDag-Erling Smørgrav			android-linux)
16325039b37SCy Schubert				basic_machine=$field1-unknown
16425039b37SCy Schubert				basic_os=linux-android
1658ed2b524SDag-Erling Smørgrav				;;
166b7579f77SDag-Erling Smørgrav			*)
16725039b37SCy Schubert				basic_machine=$field1-$field2
16825039b37SCy Schubert				basic_os=$field3
16925039b37SCy Schubert				;;
17025039b37SCy Schubert		esac
17125039b37SCy Schubert		;;
17225039b37SCy Schubert	*-*)
17325039b37SCy Schubert		case $field1-$field2 in
174*56850988SCy Schubert			# Shorthands that happen to contain a single dash
175*56850988SCy Schubert			convex-c[12] | convex-c3[248])
176*56850988SCy Schubert				basic_machine=$field2-convex
177*56850988SCy Schubert				basic_os=
178*56850988SCy Schubert				;;
17925039b37SCy Schubert			decstation-3100)
18025039b37SCy Schubert				basic_machine=mips-dec
18125039b37SCy Schubert				basic_os=
18225039b37SCy Schubert				;;
18325039b37SCy Schubert			*-*)
18425039b37SCy Schubert				# Second component is usually, but not always the OS
18525039b37SCy Schubert				case $field2 in
186*56850988SCy Schubert					# Do not treat sunos as a manufacturer
18725039b37SCy Schubert					sun*os*)
18825039b37SCy Schubert						basic_machine=$field1
18925039b37SCy Schubert						basic_os=$field2
19025039b37SCy Schubert						;;
191*56850988SCy Schubert					# Manufacturers
192*56850988SCy Schubert					  3100* \
193*56850988SCy Schubert					| 32* \
194*56850988SCy Schubert					| 3300* \
195*56850988SCy Schubert					| 3600* \
196*56850988SCy Schubert					| 7300* \
197*56850988SCy Schubert					| acorn \
198*56850988SCy Schubert					| altos* \
199*56850988SCy Schubert					| apollo \
200*56850988SCy Schubert					| apple \
201*56850988SCy Schubert					| atari \
202*56850988SCy Schubert					| att* \
203*56850988SCy Schubert					| axis \
204*56850988SCy Schubert					| be \
205*56850988SCy Schubert					| bull \
206*56850988SCy Schubert					| cbm \
207*56850988SCy Schubert					| ccur \
208*56850988SCy Schubert					| cisco \
209*56850988SCy Schubert					| commodore \
210*56850988SCy Schubert					| convergent* \
211*56850988SCy Schubert					| convex* \
212*56850988SCy Schubert					| cray \
213*56850988SCy Schubert					| crds \
214*56850988SCy Schubert					| dec* \
215*56850988SCy Schubert					| delta* \
216*56850988SCy Schubert					| dg \
217*56850988SCy Schubert					| digital \
218*56850988SCy Schubert					| dolphin \
219*56850988SCy Schubert					| encore* \
220*56850988SCy Schubert					| gould \
221*56850988SCy Schubert					| harris \
222*56850988SCy Schubert					| highlevel \
223*56850988SCy Schubert					| hitachi* \
224*56850988SCy Schubert					| hp \
225*56850988SCy Schubert					| ibm* \
226*56850988SCy Schubert					| intergraph \
227*56850988SCy Schubert					| isi* \
228*56850988SCy Schubert					| knuth \
229*56850988SCy Schubert					| masscomp \
230*56850988SCy Schubert					| microblaze* \
231*56850988SCy Schubert					| mips* \
232*56850988SCy Schubert					| motorola* \
233*56850988SCy Schubert					| ncr* \
234*56850988SCy Schubert					| news \
235*56850988SCy Schubert					| next \
236*56850988SCy Schubert					| ns \
237*56850988SCy Schubert					| oki \
238*56850988SCy Schubert					| omron* \
239*56850988SCy Schubert					| pc533* \
240*56850988SCy Schubert					| rebel \
241*56850988SCy Schubert					| rom68k \
242*56850988SCy Schubert					| rombug \
243*56850988SCy Schubert					| semi \
244*56850988SCy Schubert					| sequent* \
245*56850988SCy Schubert					| siemens \
246*56850988SCy Schubert					| sgi* \
247*56850988SCy Schubert					| siemens \
248*56850988SCy Schubert					| sim \
249*56850988SCy Schubert					| sni \
250*56850988SCy Schubert					| sony* \
251*56850988SCy Schubert					| stratus \
252*56850988SCy Schubert					| sun \
253*56850988SCy Schubert					| sun[234]* \
254*56850988SCy Schubert					| tektronix \
255*56850988SCy Schubert					| tti* \
256*56850988SCy Schubert					| ultra \
257*56850988SCy Schubert					| unicom* \
258*56850988SCy Schubert					| wec \
259*56850988SCy Schubert					| winbond \
260*56850988SCy Schubert					| wrs)
261*56850988SCy Schubert						basic_machine=$field1-$field2
262*56850988SCy Schubert						basic_os=
263*56850988SCy Schubert						;;
26424e36522SCy Schubert					zephyr*)
26524e36522SCy Schubert						basic_machine=$field1-unknown
26624e36522SCy Schubert						basic_os=$field2
26724e36522SCy Schubert						;;
26825039b37SCy Schubert					*)
26925039b37SCy Schubert						basic_machine=$field1
27025039b37SCy Schubert						basic_os=$field2
27125039b37SCy Schubert						;;
27225039b37SCy Schubert				esac
27325039b37SCy Schubert			;;
27425039b37SCy Schubert		esac
27525039b37SCy Schubert		;;
27625039b37SCy Schubert	*)
27725039b37SCy Schubert		# Convert single-component short-hands not valid as part of
27825039b37SCy Schubert		# multi-component configurations.
27925039b37SCy Schubert		case $field1 in
28025039b37SCy Schubert			386bsd)
28125039b37SCy Schubert				basic_machine=i386-pc
28225039b37SCy Schubert				basic_os=bsd
28325039b37SCy Schubert				;;
28425039b37SCy Schubert			a29khif)
28525039b37SCy Schubert				basic_machine=a29k-amd
28625039b37SCy Schubert				basic_os=udi
28725039b37SCy Schubert				;;
28825039b37SCy Schubert			adobe68k)
28925039b37SCy Schubert				basic_machine=m68010-adobe
29025039b37SCy Schubert				basic_os=scout
29125039b37SCy Schubert				;;
29225039b37SCy Schubert			alliant)
29325039b37SCy Schubert				basic_machine=fx80-alliant
29425039b37SCy Schubert				basic_os=
29525039b37SCy Schubert				;;
29625039b37SCy Schubert			altos | altos3068)
29725039b37SCy Schubert				basic_machine=m68k-altos
29825039b37SCy Schubert				basic_os=
29925039b37SCy Schubert				;;
30025039b37SCy Schubert			am29k)
30125039b37SCy Schubert				basic_machine=a29k-none
30225039b37SCy Schubert				basic_os=bsd
30325039b37SCy Schubert				;;
30425039b37SCy Schubert			amdahl)
30525039b37SCy Schubert				basic_machine=580-amdahl
30625039b37SCy Schubert				basic_os=sysv
30725039b37SCy Schubert				;;
30825039b37SCy Schubert			amiga)
30925039b37SCy Schubert				basic_machine=m68k-unknown
31025039b37SCy Schubert				basic_os=
31125039b37SCy Schubert				;;
31225039b37SCy Schubert			amigaos | amigados)
31325039b37SCy Schubert				basic_machine=m68k-unknown
31425039b37SCy Schubert				basic_os=amigaos
31525039b37SCy Schubert				;;
31625039b37SCy Schubert			amigaunix | amix)
31725039b37SCy Schubert				basic_machine=m68k-unknown
31825039b37SCy Schubert				basic_os=sysv4
31925039b37SCy Schubert				;;
32025039b37SCy Schubert			apollo68)
32125039b37SCy Schubert				basic_machine=m68k-apollo
32225039b37SCy Schubert				basic_os=sysv
32325039b37SCy Schubert				;;
32425039b37SCy Schubert			apollo68bsd)
32525039b37SCy Schubert				basic_machine=m68k-apollo
32625039b37SCy Schubert				basic_os=bsd
32725039b37SCy Schubert				;;
32825039b37SCy Schubert			aros)
32925039b37SCy Schubert				basic_machine=i386-pc
33025039b37SCy Schubert				basic_os=aros
33125039b37SCy Schubert				;;
33225039b37SCy Schubert			aux)
33325039b37SCy Schubert				basic_machine=m68k-apple
33425039b37SCy Schubert				basic_os=aux
33525039b37SCy Schubert				;;
33625039b37SCy Schubert			balance)
33725039b37SCy Schubert				basic_machine=ns32k-sequent
33825039b37SCy Schubert				basic_os=dynix
33925039b37SCy Schubert				;;
34025039b37SCy Schubert			blackfin)
34125039b37SCy Schubert				basic_machine=bfin-unknown
34225039b37SCy Schubert				basic_os=linux
34325039b37SCy Schubert				;;
34425039b37SCy Schubert			cegcc)
34525039b37SCy Schubert				basic_machine=arm-unknown
34625039b37SCy Schubert				basic_os=cegcc
34725039b37SCy Schubert				;;
34825039b37SCy Schubert			cray)
34925039b37SCy Schubert				basic_machine=j90-cray
35025039b37SCy Schubert				basic_os=unicos
35125039b37SCy Schubert				;;
35225039b37SCy Schubert			crds | unos)
35325039b37SCy Schubert				basic_machine=m68k-crds
35425039b37SCy Schubert				basic_os=
35525039b37SCy Schubert				;;
35625039b37SCy Schubert			da30)
35725039b37SCy Schubert				basic_machine=m68k-da30
35825039b37SCy Schubert				basic_os=
35925039b37SCy Schubert				;;
36025039b37SCy Schubert			decstation | pmax | pmin | dec3100 | decstatn)
36125039b37SCy Schubert				basic_machine=mips-dec
36225039b37SCy Schubert				basic_os=
36325039b37SCy Schubert				;;
36425039b37SCy Schubert			delta88)
36525039b37SCy Schubert				basic_machine=m88k-motorola
36625039b37SCy Schubert				basic_os=sysv3
36725039b37SCy Schubert				;;
36825039b37SCy Schubert			dicos)
36925039b37SCy Schubert				basic_machine=i686-pc
37025039b37SCy Schubert				basic_os=dicos
37125039b37SCy Schubert				;;
37225039b37SCy Schubert			djgpp)
37325039b37SCy Schubert				basic_machine=i586-pc
37425039b37SCy Schubert				basic_os=msdosdjgpp
37525039b37SCy Schubert				;;
37625039b37SCy Schubert			ebmon29k)
37725039b37SCy Schubert				basic_machine=a29k-amd
37825039b37SCy Schubert				basic_os=ebmon
37925039b37SCy Schubert				;;
38025039b37SCy Schubert			es1800 | OSE68k | ose68k | ose | OSE)
38125039b37SCy Schubert				basic_machine=m68k-ericsson
38225039b37SCy Schubert				basic_os=ose
38325039b37SCy Schubert				;;
38425039b37SCy Schubert			gmicro)
38525039b37SCy Schubert				basic_machine=tron-gmicro
38625039b37SCy Schubert				basic_os=sysv
38725039b37SCy Schubert				;;
38825039b37SCy Schubert			go32)
38925039b37SCy Schubert				basic_machine=i386-pc
39025039b37SCy Schubert				basic_os=go32
39125039b37SCy Schubert				;;
39225039b37SCy Schubert			h8300hms)
39325039b37SCy Schubert				basic_machine=h8300-hitachi
39425039b37SCy Schubert				basic_os=hms
39525039b37SCy Schubert				;;
39625039b37SCy Schubert			h8300xray)
39725039b37SCy Schubert				basic_machine=h8300-hitachi
39825039b37SCy Schubert				basic_os=xray
39925039b37SCy Schubert				;;
40025039b37SCy Schubert			h8500hms)
40125039b37SCy Schubert				basic_machine=h8500-hitachi
40225039b37SCy Schubert				basic_os=hms
40325039b37SCy Schubert				;;
40425039b37SCy Schubert			harris)
40525039b37SCy Schubert				basic_machine=m88k-harris
40625039b37SCy Schubert				basic_os=sysv3
40725039b37SCy Schubert				;;
40825039b37SCy Schubert			hp300 | hp300hpux)
40925039b37SCy Schubert				basic_machine=m68k-hp
41025039b37SCy Schubert				basic_os=hpux
41125039b37SCy Schubert				;;
41225039b37SCy Schubert			hp300bsd)
41325039b37SCy Schubert				basic_machine=m68k-hp
41425039b37SCy Schubert				basic_os=bsd
41525039b37SCy Schubert				;;
41625039b37SCy Schubert			hppaosf)
41725039b37SCy Schubert				basic_machine=hppa1.1-hp
41825039b37SCy Schubert				basic_os=osf
41925039b37SCy Schubert				;;
42025039b37SCy Schubert			hppro)
42125039b37SCy Schubert				basic_machine=hppa1.1-hp
42225039b37SCy Schubert				basic_os=proelf
42325039b37SCy Schubert				;;
42425039b37SCy Schubert			i386mach)
42525039b37SCy Schubert				basic_machine=i386-mach
42625039b37SCy Schubert				basic_os=mach
42725039b37SCy Schubert				;;
42825039b37SCy Schubert			isi68 | isi)
42925039b37SCy Schubert				basic_machine=m68k-isi
43025039b37SCy Schubert				basic_os=sysv
43125039b37SCy Schubert				;;
43225039b37SCy Schubert			m68knommu)
43325039b37SCy Schubert				basic_machine=m68k-unknown
43425039b37SCy Schubert				basic_os=linux
43525039b37SCy Schubert				;;
43625039b37SCy Schubert			magnum | m3230)
43725039b37SCy Schubert				basic_machine=mips-mips
43825039b37SCy Schubert				basic_os=sysv
43925039b37SCy Schubert				;;
44025039b37SCy Schubert			merlin)
44125039b37SCy Schubert				basic_machine=ns32k-utek
44225039b37SCy Schubert				basic_os=sysv
44325039b37SCy Schubert				;;
44425039b37SCy Schubert			mingw64)
44525039b37SCy Schubert				basic_machine=x86_64-pc
44625039b37SCy Schubert				basic_os=mingw64
44725039b37SCy Schubert				;;
44825039b37SCy Schubert			mingw32)
44925039b37SCy Schubert				basic_machine=i686-pc
45025039b37SCy Schubert				basic_os=mingw32
45125039b37SCy Schubert				;;
45225039b37SCy Schubert			mingw32ce)
45325039b37SCy Schubert				basic_machine=arm-unknown
45425039b37SCy Schubert				basic_os=mingw32ce
45525039b37SCy Schubert				;;
45625039b37SCy Schubert			monitor)
45725039b37SCy Schubert				basic_machine=m68k-rom68k
45825039b37SCy Schubert				basic_os=coff
45925039b37SCy Schubert				;;
46025039b37SCy Schubert			morphos)
46125039b37SCy Schubert				basic_machine=powerpc-unknown
46225039b37SCy Schubert				basic_os=morphos
46325039b37SCy Schubert				;;
46425039b37SCy Schubert			moxiebox)
46525039b37SCy Schubert				basic_machine=moxie-unknown
46625039b37SCy Schubert				basic_os=moxiebox
46725039b37SCy Schubert				;;
46825039b37SCy Schubert			msdos)
46925039b37SCy Schubert				basic_machine=i386-pc
47025039b37SCy Schubert				basic_os=msdos
47125039b37SCy Schubert				;;
47225039b37SCy Schubert			msys)
47325039b37SCy Schubert				basic_machine=i686-pc
47425039b37SCy Schubert				basic_os=msys
47525039b37SCy Schubert				;;
47625039b37SCy Schubert			mvs)
47725039b37SCy Schubert				basic_machine=i370-ibm
47825039b37SCy Schubert				basic_os=mvs
47925039b37SCy Schubert				;;
48025039b37SCy Schubert			nacl)
48125039b37SCy Schubert				basic_machine=le32-unknown
48225039b37SCy Schubert				basic_os=nacl
48325039b37SCy Schubert				;;
48425039b37SCy Schubert			ncr3000)
48525039b37SCy Schubert				basic_machine=i486-ncr
48625039b37SCy Schubert				basic_os=sysv4
48725039b37SCy Schubert				;;
48825039b37SCy Schubert			netbsd386)
48925039b37SCy Schubert				basic_machine=i386-pc
49025039b37SCy Schubert				basic_os=netbsd
49125039b37SCy Schubert				;;
49225039b37SCy Schubert			netwinder)
49325039b37SCy Schubert				basic_machine=armv4l-rebel
49425039b37SCy Schubert				basic_os=linux
49525039b37SCy Schubert				;;
49625039b37SCy Schubert			news | news700 | news800 | news900)
49725039b37SCy Schubert				basic_machine=m68k-sony
49825039b37SCy Schubert				basic_os=newsos
49925039b37SCy Schubert				;;
50025039b37SCy Schubert			news1000)
50125039b37SCy Schubert				basic_machine=m68030-sony
50225039b37SCy Schubert				basic_os=newsos
50325039b37SCy Schubert				;;
50425039b37SCy Schubert			necv70)
50525039b37SCy Schubert				basic_machine=v70-nec
50625039b37SCy Schubert				basic_os=sysv
50725039b37SCy Schubert				;;
50825039b37SCy Schubert			nh3000)
50925039b37SCy Schubert				basic_machine=m68k-harris
51025039b37SCy Schubert				basic_os=cxux
51125039b37SCy Schubert				;;
51225039b37SCy Schubert			nh[45]000)
51325039b37SCy Schubert				basic_machine=m88k-harris
51425039b37SCy Schubert				basic_os=cxux
51525039b37SCy Schubert				;;
51625039b37SCy Schubert			nindy960)
51725039b37SCy Schubert				basic_machine=i960-intel
51825039b37SCy Schubert				basic_os=nindy
51925039b37SCy Schubert				;;
52025039b37SCy Schubert			mon960)
52125039b37SCy Schubert				basic_machine=i960-intel
52225039b37SCy Schubert				basic_os=mon960
52325039b37SCy Schubert				;;
52425039b37SCy Schubert			nonstopux)
52525039b37SCy Schubert				basic_machine=mips-compaq
52625039b37SCy Schubert				basic_os=nonstopux
52725039b37SCy Schubert				;;
52825039b37SCy Schubert			os400)
52925039b37SCy Schubert				basic_machine=powerpc-ibm
53025039b37SCy Schubert				basic_os=os400
53125039b37SCy Schubert				;;
53225039b37SCy Schubert			OSE68000 | ose68000)
53325039b37SCy Schubert				basic_machine=m68000-ericsson
53425039b37SCy Schubert				basic_os=ose
53525039b37SCy Schubert				;;
53625039b37SCy Schubert			os68k)
53725039b37SCy Schubert				basic_machine=m68k-none
53825039b37SCy Schubert				basic_os=os68k
53925039b37SCy Schubert				;;
54025039b37SCy Schubert			paragon)
54125039b37SCy Schubert				basic_machine=i860-intel
54225039b37SCy Schubert				basic_os=osf
54325039b37SCy Schubert				;;
54425039b37SCy Schubert			parisc)
54525039b37SCy Schubert				basic_machine=hppa-unknown
54625039b37SCy Schubert				basic_os=linux
54725039b37SCy Schubert				;;
54825039b37SCy Schubert			psp)
54925039b37SCy Schubert				basic_machine=mipsallegrexel-sony
55025039b37SCy Schubert				basic_os=psp
55125039b37SCy Schubert				;;
55225039b37SCy Schubert			pw32)
55325039b37SCy Schubert				basic_machine=i586-unknown
55425039b37SCy Schubert				basic_os=pw32
55525039b37SCy Schubert				;;
55625039b37SCy Schubert			rdos | rdos64)
55725039b37SCy Schubert				basic_machine=x86_64-pc
55825039b37SCy Schubert				basic_os=rdos
55925039b37SCy Schubert				;;
56025039b37SCy Schubert			rdos32)
56125039b37SCy Schubert				basic_machine=i386-pc
56225039b37SCy Schubert				basic_os=rdos
56325039b37SCy Schubert				;;
56425039b37SCy Schubert			rom68k)
56525039b37SCy Schubert				basic_machine=m68k-rom68k
56625039b37SCy Schubert				basic_os=coff
56725039b37SCy Schubert				;;
56825039b37SCy Schubert			sa29200)
56925039b37SCy Schubert				basic_machine=a29k-amd
57025039b37SCy Schubert				basic_os=udi
57125039b37SCy Schubert				;;
57225039b37SCy Schubert			sei)
57325039b37SCy Schubert				basic_machine=mips-sei
57425039b37SCy Schubert				basic_os=seiux
57525039b37SCy Schubert				;;
57625039b37SCy Schubert			sequent)
57725039b37SCy Schubert				basic_machine=i386-sequent
57825039b37SCy Schubert				basic_os=
57925039b37SCy Schubert				;;
58025039b37SCy Schubert			sps7)
58125039b37SCy Schubert				basic_machine=m68k-bull
58225039b37SCy Schubert				basic_os=sysv2
58325039b37SCy Schubert				;;
58425039b37SCy Schubert			st2000)
58525039b37SCy Schubert				basic_machine=m68k-tandem
58625039b37SCy Schubert				basic_os=
58725039b37SCy Schubert				;;
58825039b37SCy Schubert			stratus)
58925039b37SCy Schubert				basic_machine=i860-stratus
59025039b37SCy Schubert				basic_os=sysv4
59125039b37SCy Schubert				;;
59225039b37SCy Schubert			sun2)
59325039b37SCy Schubert				basic_machine=m68000-sun
59425039b37SCy Schubert				basic_os=
59525039b37SCy Schubert				;;
59625039b37SCy Schubert			sun2os3)
59725039b37SCy Schubert				basic_machine=m68000-sun
59825039b37SCy Schubert				basic_os=sunos3
59925039b37SCy Schubert				;;
60025039b37SCy Schubert			sun2os4)
60125039b37SCy Schubert				basic_machine=m68000-sun
60225039b37SCy Schubert				basic_os=sunos4
60325039b37SCy Schubert				;;
60425039b37SCy Schubert			sun3)
60525039b37SCy Schubert				basic_machine=m68k-sun
60625039b37SCy Schubert				basic_os=
60725039b37SCy Schubert				;;
60825039b37SCy Schubert			sun3os3)
60925039b37SCy Schubert				basic_machine=m68k-sun
61025039b37SCy Schubert				basic_os=sunos3
61125039b37SCy Schubert				;;
61225039b37SCy Schubert			sun3os4)
61325039b37SCy Schubert				basic_machine=m68k-sun
61425039b37SCy Schubert				basic_os=sunos4
61525039b37SCy Schubert				;;
61625039b37SCy Schubert			sun4)
61725039b37SCy Schubert				basic_machine=sparc-sun
61825039b37SCy Schubert				basic_os=
61925039b37SCy Schubert				;;
62025039b37SCy Schubert			sun4os3)
62125039b37SCy Schubert				basic_machine=sparc-sun
62225039b37SCy Schubert				basic_os=sunos3
62325039b37SCy Schubert				;;
62425039b37SCy Schubert			sun4os4)
62525039b37SCy Schubert				basic_machine=sparc-sun
62625039b37SCy Schubert				basic_os=sunos4
62725039b37SCy Schubert				;;
62825039b37SCy Schubert			sun4sol2)
62925039b37SCy Schubert				basic_machine=sparc-sun
63025039b37SCy Schubert				basic_os=solaris2
63125039b37SCy Schubert				;;
63225039b37SCy Schubert			sun386 | sun386i | roadrunner)
63325039b37SCy Schubert				basic_machine=i386-sun
63425039b37SCy Schubert				basic_os=
63525039b37SCy Schubert				;;
63625039b37SCy Schubert			sv1)
63725039b37SCy Schubert				basic_machine=sv1-cray
63825039b37SCy Schubert				basic_os=unicos
63925039b37SCy Schubert				;;
64025039b37SCy Schubert			symmetry)
64125039b37SCy Schubert				basic_machine=i386-sequent
64225039b37SCy Schubert				basic_os=dynix
64325039b37SCy Schubert				;;
64425039b37SCy Schubert			t3e)
64525039b37SCy Schubert				basic_machine=alphaev5-cray
64625039b37SCy Schubert				basic_os=unicos
64725039b37SCy Schubert				;;
64825039b37SCy Schubert			t90)
64925039b37SCy Schubert				basic_machine=t90-cray
65025039b37SCy Schubert				basic_os=unicos
65125039b37SCy Schubert				;;
65225039b37SCy Schubert			toad1)
65325039b37SCy Schubert				basic_machine=pdp10-xkl
65425039b37SCy Schubert				basic_os=tops20
65525039b37SCy Schubert				;;
65625039b37SCy Schubert			tpf)
65725039b37SCy Schubert				basic_machine=s390x-ibm
65825039b37SCy Schubert				basic_os=tpf
65925039b37SCy Schubert				;;
66025039b37SCy Schubert			udi29k)
66125039b37SCy Schubert				basic_machine=a29k-amd
66225039b37SCy Schubert				basic_os=udi
66325039b37SCy Schubert				;;
66425039b37SCy Schubert			ultra3)
66525039b37SCy Schubert				basic_machine=a29k-nyu
66625039b37SCy Schubert				basic_os=sym1
66725039b37SCy Schubert				;;
66825039b37SCy Schubert			v810 | necv810)
66925039b37SCy Schubert				basic_machine=v810-nec
67025039b37SCy Schubert				basic_os=none
67125039b37SCy Schubert				;;
67225039b37SCy Schubert			vaxv)
67325039b37SCy Schubert				basic_machine=vax-dec
67425039b37SCy Schubert				basic_os=sysv
67525039b37SCy Schubert				;;
67625039b37SCy Schubert			vms)
67725039b37SCy Schubert				basic_machine=vax-dec
67825039b37SCy Schubert				basic_os=vms
67925039b37SCy Schubert				;;
68025039b37SCy Schubert			vsta)
68125039b37SCy Schubert				basic_machine=i386-pc
68225039b37SCy Schubert				basic_os=vsta
68325039b37SCy Schubert				;;
68425039b37SCy Schubert			vxworks960)
68525039b37SCy Schubert				basic_machine=i960-wrs
68625039b37SCy Schubert				basic_os=vxworks
68725039b37SCy Schubert				;;
68825039b37SCy Schubert			vxworks68)
68925039b37SCy Schubert				basic_machine=m68k-wrs
69025039b37SCy Schubert				basic_os=vxworks
69125039b37SCy Schubert				;;
69225039b37SCy Schubert			vxworks29k)
69325039b37SCy Schubert				basic_machine=a29k-wrs
69425039b37SCy Schubert				basic_os=vxworks
69525039b37SCy Schubert				;;
69625039b37SCy Schubert			xbox)
69725039b37SCy Schubert				basic_machine=i686-pc
69825039b37SCy Schubert				basic_os=mingw32
69925039b37SCy Schubert				;;
70025039b37SCy Schubert			ymp)
70125039b37SCy Schubert				basic_machine=ymp-cray
70225039b37SCy Schubert				basic_os=unicos
70325039b37SCy Schubert				;;
70425039b37SCy Schubert			*)
70525039b37SCy Schubert				basic_machine=$1
70625039b37SCy Schubert				basic_os=
70725039b37SCy Schubert				;;
70825039b37SCy Schubert		esac
709b7579f77SDag-Erling Smørgrav		;;
710b7579f77SDag-Erling Smørgravesac
711b7579f77SDag-Erling Smørgrav
71225039b37SCy Schubert# Decode 1-component or ad-hoc basic machines
713b7579f77SDag-Erling Smørgravcase $basic_machine in
71425039b37SCy Schubert	# Here we handle the default manufacturer of certain CPU types.  It is in
71525039b37SCy Schubert	# some cases the only manufacturer, in others, it is the most popular.
71625039b37SCy Schubert	w89k)
71725039b37SCy Schubert		cpu=hppa1.1
71825039b37SCy Schubert		vendor=winbond
71925039b37SCy Schubert		;;
72025039b37SCy Schubert	op50n)
72125039b37SCy Schubert		cpu=hppa1.1
72225039b37SCy Schubert		vendor=oki
72325039b37SCy Schubert		;;
72425039b37SCy Schubert	op60c)
72525039b37SCy Schubert		cpu=hppa1.1
72625039b37SCy Schubert		vendor=oki
72725039b37SCy Schubert		;;
72825039b37SCy Schubert	ibm*)
72925039b37SCy Schubert		cpu=i370
73025039b37SCy Schubert		vendor=ibm
73125039b37SCy Schubert		;;
73225039b37SCy Schubert	orion105)
73325039b37SCy Schubert		cpu=clipper
73425039b37SCy Schubert		vendor=highlevel
73525039b37SCy Schubert		;;
73625039b37SCy Schubert	mac | mpw | mac-mpw)
73725039b37SCy Schubert		cpu=m68k
73825039b37SCy Schubert		vendor=apple
73925039b37SCy Schubert		;;
74025039b37SCy Schubert	pmac | pmac-mpw)
74125039b37SCy Schubert		cpu=powerpc
74225039b37SCy Schubert		vendor=apple
74325039b37SCy Schubert		;;
74425039b37SCy Schubert
74525039b37SCy Schubert	# Recognize the various machine names and aliases which stand
74625039b37SCy Schubert	# for a CPU type and a company and sometimes even an OS.
74725039b37SCy Schubert	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
74825039b37SCy Schubert		cpu=m68000
74925039b37SCy Schubert		vendor=att
75025039b37SCy Schubert		;;
75125039b37SCy Schubert	3b*)
75225039b37SCy Schubert		cpu=we32k
75325039b37SCy Schubert		vendor=att
75425039b37SCy Schubert		;;
75525039b37SCy Schubert	bluegene*)
75625039b37SCy Schubert		cpu=powerpc
75725039b37SCy Schubert		vendor=ibm
75825039b37SCy Schubert		basic_os=cnk
75925039b37SCy Schubert		;;
76025039b37SCy Schubert	decsystem10* | dec10*)
76125039b37SCy Schubert		cpu=pdp10
76225039b37SCy Schubert		vendor=dec
76325039b37SCy Schubert		basic_os=tops10
76425039b37SCy Schubert		;;
76525039b37SCy Schubert	decsystem20* | dec20*)
76625039b37SCy Schubert		cpu=pdp10
76725039b37SCy Schubert		vendor=dec
76825039b37SCy Schubert		basic_os=tops20
76925039b37SCy Schubert		;;
770*56850988SCy Schubert	delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300)
77125039b37SCy Schubert		cpu=m68k
77225039b37SCy Schubert		vendor=motorola
77325039b37SCy Schubert		;;
774*56850988SCy Schubert	# This used to be dpx2*, but that gets the RS6000-based
775*56850988SCy Schubert	# DPX/20 and the x86-based DPX/2-100 wrong.  See
776*56850988SCy Schubert	# https://oldskool.silicium.org/stations/bull_dpx20.htm
777*56850988SCy Schubert	# https://www.feb-patrimoine.com/english/bull_dpx2.htm
778*56850988SCy Schubert	# https://www.feb-patrimoine.com/english/unix_and_bull.htm
779*56850988SCy Schubert	dpx2 | dpx2[23]00 | dpx2[23]xx)
78025039b37SCy Schubert		cpu=m68k
78125039b37SCy Schubert		vendor=bull
782*56850988SCy Schubert		;;
783*56850988SCy Schubert	dpx2100 | dpx21xx)
784*56850988SCy Schubert		cpu=i386
785*56850988SCy Schubert		vendor=bull
786*56850988SCy Schubert		;;
787*56850988SCy Schubert	dpx20)
788*56850988SCy Schubert		cpu=rs6000
789*56850988SCy Schubert		vendor=bull
79025039b37SCy Schubert		;;
79125039b37SCy Schubert	encore | umax | mmax)
79225039b37SCy Schubert		cpu=ns32k
79325039b37SCy Schubert		vendor=encore
79425039b37SCy Schubert		;;
79525039b37SCy Schubert	elxsi)
79625039b37SCy Schubert		cpu=elxsi
79725039b37SCy Schubert		vendor=elxsi
79825039b37SCy Schubert		basic_os=${basic_os:-bsd}
79925039b37SCy Schubert		;;
80025039b37SCy Schubert	fx2800)
80125039b37SCy Schubert		cpu=i860
80225039b37SCy Schubert		vendor=alliant
80325039b37SCy Schubert		;;
80425039b37SCy Schubert	genix)
80525039b37SCy Schubert		cpu=ns32k
80625039b37SCy Schubert		vendor=ns
80725039b37SCy Schubert		;;
80825039b37SCy Schubert	h3050r* | hiux*)
80925039b37SCy Schubert		cpu=hppa1.1
81025039b37SCy Schubert		vendor=hitachi
81125039b37SCy Schubert		basic_os=hiuxwe2
81225039b37SCy Schubert		;;
81325039b37SCy Schubert	hp3k9[0-9][0-9] | hp9[0-9][0-9])
81425039b37SCy Schubert		cpu=hppa1.0
81525039b37SCy Schubert		vendor=hp
81625039b37SCy Schubert		;;
81725039b37SCy Schubert	hp9k2[0-9][0-9] | hp9k31[0-9])
81825039b37SCy Schubert		cpu=m68000
81925039b37SCy Schubert		vendor=hp
82025039b37SCy Schubert		;;
82125039b37SCy Schubert	hp9k3[2-9][0-9])
82225039b37SCy Schubert		cpu=m68k
82325039b37SCy Schubert		vendor=hp
82425039b37SCy Schubert		;;
82525039b37SCy Schubert	hp9k6[0-9][0-9] | hp6[0-9][0-9])
82625039b37SCy Schubert		cpu=hppa1.0
82725039b37SCy Schubert		vendor=hp
82825039b37SCy Schubert		;;
82925039b37SCy Schubert	hp9k7[0-79][0-9] | hp7[0-79][0-9])
83025039b37SCy Schubert		cpu=hppa1.1
83125039b37SCy Schubert		vendor=hp
83225039b37SCy Schubert		;;
83325039b37SCy Schubert	hp9k78[0-9] | hp78[0-9])
83425039b37SCy Schubert		# FIXME: really hppa2.0-hp
83525039b37SCy Schubert		cpu=hppa1.1
83625039b37SCy Schubert		vendor=hp
83725039b37SCy Schubert		;;
83825039b37SCy Schubert	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
83925039b37SCy Schubert		# FIXME: really hppa2.0-hp
84025039b37SCy Schubert		cpu=hppa1.1
84125039b37SCy Schubert		vendor=hp
84225039b37SCy Schubert		;;
84325039b37SCy Schubert	hp9k8[0-9][13679] | hp8[0-9][13679])
84425039b37SCy Schubert		cpu=hppa1.1
84525039b37SCy Schubert		vendor=hp
84625039b37SCy Schubert		;;
84725039b37SCy Schubert	hp9k8[0-9][0-9] | hp8[0-9][0-9])
84825039b37SCy Schubert		cpu=hppa1.0
84925039b37SCy Schubert		vendor=hp
85025039b37SCy Schubert		;;
85125039b37SCy Schubert	i*86v32)
8525469a995SCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
85325039b37SCy Schubert		vendor=pc
85425039b37SCy Schubert		basic_os=sysv32
85525039b37SCy Schubert		;;
85625039b37SCy Schubert	i*86v4*)
8575469a995SCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
85825039b37SCy Schubert		vendor=pc
85925039b37SCy Schubert		basic_os=sysv4
86025039b37SCy Schubert		;;
86125039b37SCy Schubert	i*86v)
8625469a995SCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
86325039b37SCy Schubert		vendor=pc
86425039b37SCy Schubert		basic_os=sysv
86525039b37SCy Schubert		;;
86625039b37SCy Schubert	i*86sol2)
8675469a995SCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
86825039b37SCy Schubert		vendor=pc
86925039b37SCy Schubert		basic_os=solaris2
87025039b37SCy Schubert		;;
87125039b37SCy Schubert	j90 | j90-cray)
87225039b37SCy Schubert		cpu=j90
87325039b37SCy Schubert		vendor=cray
87425039b37SCy Schubert		basic_os=${basic_os:-unicos}
87525039b37SCy Schubert		;;
87625039b37SCy Schubert	iris | iris4d)
87725039b37SCy Schubert		cpu=mips
87825039b37SCy Schubert		vendor=sgi
87925039b37SCy Schubert		case $basic_os in
88025039b37SCy Schubert		    irix*)
88125039b37SCy Schubert			;;
88225039b37SCy Schubert		    *)
88325039b37SCy Schubert			basic_os=irix4
88425039b37SCy Schubert			;;
88525039b37SCy Schubert		esac
88625039b37SCy Schubert		;;
88725039b37SCy Schubert	miniframe)
88825039b37SCy Schubert		cpu=m68000
88925039b37SCy Schubert		vendor=convergent
89025039b37SCy Schubert		;;
89125039b37SCy Schubert	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
89225039b37SCy Schubert		cpu=m68k
89325039b37SCy Schubert		vendor=atari
89425039b37SCy Schubert		basic_os=mint
89525039b37SCy Schubert		;;
89625039b37SCy Schubert	news-3600 | risc-news)
89725039b37SCy Schubert		cpu=mips
89825039b37SCy Schubert		vendor=sony
89925039b37SCy Schubert		basic_os=newsos
90025039b37SCy Schubert		;;
90125039b37SCy Schubert	next | m*-next)
90225039b37SCy Schubert		cpu=m68k
90325039b37SCy Schubert		vendor=next
90425039b37SCy Schubert		;;
90525039b37SCy Schubert	np1)
90625039b37SCy Schubert		cpu=np1
90725039b37SCy Schubert		vendor=gould
90825039b37SCy Schubert		;;
90925039b37SCy Schubert	op50n-* | op60c-*)
91025039b37SCy Schubert		cpu=hppa1.1
91125039b37SCy Schubert		vendor=oki
91225039b37SCy Schubert		basic_os=proelf
91325039b37SCy Schubert		;;
91425039b37SCy Schubert	pa-hitachi)
91525039b37SCy Schubert		cpu=hppa1.1
91625039b37SCy Schubert		vendor=hitachi
91725039b37SCy Schubert		basic_os=hiuxwe2
91825039b37SCy Schubert		;;
91925039b37SCy Schubert	pbd)
92025039b37SCy Schubert		cpu=sparc
92125039b37SCy Schubert		vendor=tti
92225039b37SCy Schubert		;;
92325039b37SCy Schubert	pbb)
92425039b37SCy Schubert		cpu=m68k
92525039b37SCy Schubert		vendor=tti
92625039b37SCy Schubert		;;
92725039b37SCy Schubert	pc532)
92825039b37SCy Schubert		cpu=ns32k
92925039b37SCy Schubert		vendor=pc532
93025039b37SCy Schubert		;;
93125039b37SCy Schubert	pn)
93225039b37SCy Schubert		cpu=pn
93325039b37SCy Schubert		vendor=gould
93425039b37SCy Schubert		;;
93525039b37SCy Schubert	power)
93625039b37SCy Schubert		cpu=power
93725039b37SCy Schubert		vendor=ibm
93825039b37SCy Schubert		;;
93925039b37SCy Schubert	ps2)
94025039b37SCy Schubert		cpu=i386
94125039b37SCy Schubert		vendor=ibm
94225039b37SCy Schubert		;;
94325039b37SCy Schubert	rm[46]00)
94425039b37SCy Schubert		cpu=mips
94525039b37SCy Schubert		vendor=siemens
94625039b37SCy Schubert		;;
94725039b37SCy Schubert	rtpc | rtpc-*)
94825039b37SCy Schubert		cpu=romp
94925039b37SCy Schubert		vendor=ibm
95025039b37SCy Schubert		;;
95125039b37SCy Schubert	sde)
95225039b37SCy Schubert		cpu=mipsisa32
95325039b37SCy Schubert		vendor=sde
95425039b37SCy Schubert		basic_os=${basic_os:-elf}
95525039b37SCy Schubert		;;
95625039b37SCy Schubert	simso-wrs)
95725039b37SCy Schubert		cpu=sparclite
95825039b37SCy Schubert		vendor=wrs
95925039b37SCy Schubert		basic_os=vxworks
96025039b37SCy Schubert		;;
96125039b37SCy Schubert	tower | tower-32)
96225039b37SCy Schubert		cpu=m68k
96325039b37SCy Schubert		vendor=ncr
96425039b37SCy Schubert		;;
96525039b37SCy Schubert	vpp*|vx|vx-*)
96625039b37SCy Schubert		cpu=f301
96725039b37SCy Schubert		vendor=fujitsu
96825039b37SCy Schubert		;;
96925039b37SCy Schubert	w65)
97025039b37SCy Schubert		cpu=w65
97125039b37SCy Schubert		vendor=wdc
97225039b37SCy Schubert		;;
97325039b37SCy Schubert	w89k-*)
97425039b37SCy Schubert		cpu=hppa1.1
97525039b37SCy Schubert		vendor=winbond
97625039b37SCy Schubert		basic_os=proelf
97725039b37SCy Schubert		;;
97825039b37SCy Schubert	none)
97925039b37SCy Schubert		cpu=none
98025039b37SCy Schubert		vendor=none
98125039b37SCy Schubert		;;
98225039b37SCy Schubert	leon|leon[3-9])
98325039b37SCy Schubert		cpu=sparc
98425039b37SCy Schubert		vendor=$basic_machine
98525039b37SCy Schubert		;;
98625039b37SCy Schubert	leon-*|leon[3-9]-*)
98725039b37SCy Schubert		cpu=sparc
9885469a995SCy Schubert		vendor=`echo "$basic_machine" | sed 's/-.*//'`
98925039b37SCy Schubert		;;
99025039b37SCy Schubert
99125039b37SCy Schubert	*-*)
99224e36522SCy Schubert		saved_IFS=$IFS
99325039b37SCy Schubert		IFS="-" read cpu vendor <<EOF
99425039b37SCy Schubert$basic_machine
99525039b37SCy SchubertEOF
99624e36522SCy Schubert		IFS=$saved_IFS
99725039b37SCy Schubert		;;
9988f76bb7dSCy Schubert	# We use 'pc' rather than 'unknown'
99925039b37SCy Schubert	# because (1) that's what they normally are, and
100025039b37SCy Schubert	# (2) the word "unknown" tends to confuse beginning users.
100125039b37SCy Schubert	i*86 | x86_64)
100225039b37SCy Schubert		cpu=$basic_machine
100325039b37SCy Schubert		vendor=pc
100425039b37SCy Schubert		;;
100525039b37SCy Schubert	# These rules are duplicated from below for sake of the special case above;
100625039b37SCy Schubert	# i.e. things that normalized to x86 arches should also default to "pc"
100725039b37SCy Schubert	pc98)
100825039b37SCy Schubert		cpu=i386
100925039b37SCy Schubert		vendor=pc
101025039b37SCy Schubert		;;
101125039b37SCy Schubert	x64 | amd64)
101225039b37SCy Schubert		cpu=x86_64
101325039b37SCy Schubert		vendor=pc
101425039b37SCy Schubert		;;
1015b7579f77SDag-Erling Smørgrav	# Recognize the basic CPU types without company name.
101625039b37SCy Schubert	*)
101725039b37SCy Schubert		cpu=$basic_machine
101825039b37SCy Schubert		vendor=unknown
101925039b37SCy Schubert		;;
102025039b37SCy Schubertesac
102125039b37SCy Schubert
102225039b37SCy Schubertunset -v basic_machine
102325039b37SCy Schubert
102425039b37SCy Schubert# Decode basic machines in the full and proper CPU-Company form.
102525039b37SCy Schubertcase $cpu-$vendor in
1026*56850988SCy Schubert	# Here we handle the default manufacturer of certain CPU types in canonical form.
1027*56850988SCy Schubert	# It is in some cases the only manufacturer, in others, it is the most popular.
1028*56850988SCy Schubert	c[12]-convex | c[12]-unknown | c3[248]-convex | c3[248]-unknown)
1029*56850988SCy Schubert		vendor=convex
1030*56850988SCy Schubert		basic_os=${basic_os:-bsd}
1031*56850988SCy Schubert		;;
103225039b37SCy Schubert	craynv-unknown)
103325039b37SCy Schubert		vendor=cray
103425039b37SCy Schubert		basic_os=${basic_os:-unicosmp}
103525039b37SCy Schubert		;;
103625039b37SCy Schubert	c90-unknown | c90-cray)
103725039b37SCy Schubert		vendor=cray
1038*56850988SCy Schubert		basic_os=${basic_os:-unicos}
103925039b37SCy Schubert		;;
104025039b37SCy Schubert	fx80-unknown)
104125039b37SCy Schubert		vendor=alliant
104225039b37SCy Schubert		;;
104325039b37SCy Schubert	romp-unknown)
104425039b37SCy Schubert		vendor=ibm
104525039b37SCy Schubert		;;
104625039b37SCy Schubert	mmix-unknown)
104725039b37SCy Schubert		vendor=knuth
104825039b37SCy Schubert		;;
104925039b37SCy Schubert	microblaze-unknown | microblazeel-unknown)
105025039b37SCy Schubert		vendor=xilinx
105125039b37SCy Schubert		;;
105225039b37SCy Schubert	rs6000-unknown)
105325039b37SCy Schubert		vendor=ibm
105425039b37SCy Schubert		;;
105525039b37SCy Schubert	vax-unknown)
105625039b37SCy Schubert		vendor=dec
105725039b37SCy Schubert		;;
105825039b37SCy Schubert	pdp11-unknown)
105925039b37SCy Schubert		vendor=dec
106025039b37SCy Schubert		;;
106125039b37SCy Schubert	we32k-unknown)
106225039b37SCy Schubert		vendor=att
106325039b37SCy Schubert		;;
106425039b37SCy Schubert	cydra-unknown)
106525039b37SCy Schubert		vendor=cydrome
106625039b37SCy Schubert		;;
106725039b37SCy Schubert	i370-ibm*)
106825039b37SCy Schubert		vendor=ibm
106925039b37SCy Schubert		;;
107025039b37SCy Schubert	orion-unknown)
107125039b37SCy Schubert		vendor=highlevel
107225039b37SCy Schubert		;;
107325039b37SCy Schubert	xps-unknown | xps100-unknown)
107425039b37SCy Schubert		cpu=xps100
107525039b37SCy Schubert		vendor=honeywell
107625039b37SCy Schubert		;;
107725039b37SCy Schubert
107825039b37SCy Schubert	# Here we normalize CPU types with a missing or matching vendor
10799cf5bc93SCy Schubert	armh-unknown | armh-alt)
10809cf5bc93SCy Schubert		cpu=armv7l
10819cf5bc93SCy Schubert		vendor=alt
10829cf5bc93SCy Schubert		basic_os=${basic_os:-linux-gnueabihf}
10839cf5bc93SCy Schubert		;;
1084*56850988SCy Schubert
1085*56850988SCy Schubert	# Normalized CPU+vendor pairs that imply an OS, if not otherwise specified
1086*56850988SCy Schubert	m68k-isi)
1087*56850988SCy Schubert		basic_os=${basic_os:-sysv}
1088*56850988SCy Schubert		;;
1089*56850988SCy Schubert	m68k-sony)
1090*56850988SCy Schubert		basic_os=${basic_os:-newsos}
1091*56850988SCy Schubert		;;
1092*56850988SCy Schubert	m68k-tektronix)
1093*56850988SCy Schubert		basic_os=${basic_os:-bsd}
1094*56850988SCy Schubert		;;
1095*56850988SCy Schubert	m88k-harris)
1096*56850988SCy Schubert		basic_os=${basic_os:-sysv3}
1097*56850988SCy Schubert		;;
1098*56850988SCy Schubert	i386-bull | m68k-bull)
1099*56850988SCy Schubert		basic_os=${basic_os:-sysv3}
1100*56850988SCy Schubert		;;
1101*56850988SCy Schubert	rs6000-bull)
110225039b37SCy Schubert		basic_os=${basic_os:-bosx}
110325039b37SCy Schubert		;;
1104*56850988SCy Schubert	mips-sni)
1105*56850988SCy Schubert		basic_os=${basic_os:-sysv4}
1106*56850988SCy Schubert		;;
110725039b37SCy Schubert
110825039b37SCy Schubert	# Here we normalize CPU types irrespective of the vendor
110925039b37SCy Schubert	amd64-*)
111025039b37SCy Schubert		cpu=x86_64
111125039b37SCy Schubert		;;
111225039b37SCy Schubert	blackfin-*)
111325039b37SCy Schubert		cpu=bfin
1114*56850988SCy Schubert		basic_os=${basic_os:-linux}
111525039b37SCy Schubert		;;
111625039b37SCy Schubert	c54x-*)
111725039b37SCy Schubert		cpu=tic54x
111825039b37SCy Schubert		;;
111925039b37SCy Schubert	c55x-*)
112025039b37SCy Schubert		cpu=tic55x
112125039b37SCy Schubert		;;
112225039b37SCy Schubert	c6x-*)
112325039b37SCy Schubert		cpu=tic6x
112425039b37SCy Schubert		;;
112525039b37SCy Schubert	e500v[12]-*)
112625039b37SCy Schubert		cpu=powerpc
112725039b37SCy Schubert		basic_os=${basic_os}"spe"
112825039b37SCy Schubert		;;
112925039b37SCy Schubert	mips3*-*)
113025039b37SCy Schubert		cpu=mips64
113125039b37SCy Schubert		;;
113225039b37SCy Schubert	ms1-*)
113325039b37SCy Schubert		cpu=mt
113425039b37SCy Schubert		;;
113525039b37SCy Schubert	m68knommu-*)
113625039b37SCy Schubert		cpu=m68k
1137*56850988SCy Schubert		basic_os=${basic_os:-linux}
113825039b37SCy Schubert		;;
113925039b37SCy Schubert	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
114025039b37SCy Schubert		cpu=s12z
114125039b37SCy Schubert		;;
114225039b37SCy Schubert	openrisc-*)
114325039b37SCy Schubert		cpu=or32
114425039b37SCy Schubert		;;
114525039b37SCy Schubert	parisc-*)
114625039b37SCy Schubert		cpu=hppa
1147*56850988SCy Schubert		basic_os=${basic_os:-linux}
114825039b37SCy Schubert		;;
114925039b37SCy Schubert	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
115025039b37SCy Schubert		cpu=i586
115125039b37SCy Schubert		;;
11528f76bb7dSCy Schubert	pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
115325039b37SCy Schubert		cpu=i686
115425039b37SCy Schubert		;;
115525039b37SCy Schubert	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
115625039b37SCy Schubert		cpu=i686
115725039b37SCy Schubert		;;
115825039b37SCy Schubert	pentium4-*)
115925039b37SCy Schubert		cpu=i786
116025039b37SCy Schubert		;;
116125039b37SCy Schubert	ppc-* | ppcbe-*)
116225039b37SCy Schubert		cpu=powerpc
116325039b37SCy Schubert		;;
116425039b37SCy Schubert	ppcle-* | powerpclittle-*)
116525039b37SCy Schubert		cpu=powerpcle
116625039b37SCy Schubert		;;
116725039b37SCy Schubert	ppc64-*)
116825039b37SCy Schubert		cpu=powerpc64
116925039b37SCy Schubert		;;
117025039b37SCy Schubert	ppc64le-* | powerpc64little-*)
117125039b37SCy Schubert		cpu=powerpc64le
117225039b37SCy Schubert		;;
117325039b37SCy Schubert	sb1-*)
117425039b37SCy Schubert		cpu=mipsisa64sb1
117525039b37SCy Schubert		;;
117625039b37SCy Schubert	sb1el-*)
117725039b37SCy Schubert		cpu=mipsisa64sb1el
117825039b37SCy Schubert		;;
117925039b37SCy Schubert	sh5e[lb]-*)
11805469a995SCy Schubert		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
118125039b37SCy Schubert		;;
118225039b37SCy Schubert	spur-*)
118325039b37SCy Schubert		cpu=spur
118425039b37SCy Schubert		;;
118525039b37SCy Schubert	strongarm-* | thumb-*)
118625039b37SCy Schubert		cpu=arm
118725039b37SCy Schubert		;;
118825039b37SCy Schubert	tx39-*)
118925039b37SCy Schubert		cpu=mipstx39
119025039b37SCy Schubert		;;
119125039b37SCy Schubert	tx39el-*)
119225039b37SCy Schubert		cpu=mipstx39el
119325039b37SCy Schubert		;;
119425039b37SCy Schubert	xscale-* | xscalee[bl]-*)
11955469a995SCy Schubert		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
119625039b37SCy Schubert		;;
11979cf5bc93SCy Schubert	arm64-* | aarch64le-*)
119825039b37SCy Schubert		cpu=aarch64
119925039b37SCy Schubert		;;
120025039b37SCy Schubert
120125039b37SCy Schubert	# Recognize the canonical CPU Types that limit and/or modify the
120225039b37SCy Schubert	# company names they are paired with.
120325039b37SCy Schubert	cr16-*)
120425039b37SCy Schubert		basic_os=${basic_os:-elf}
120525039b37SCy Schubert		;;
120625039b37SCy Schubert	crisv32-* | etraxfs*-*)
120725039b37SCy Schubert		cpu=crisv32
120825039b37SCy Schubert		vendor=axis
120925039b37SCy Schubert		;;
121025039b37SCy Schubert	cris-* | etrax*-*)
121125039b37SCy Schubert		cpu=cris
121225039b37SCy Schubert		vendor=axis
121325039b37SCy Schubert		;;
121425039b37SCy Schubert	crx-*)
121525039b37SCy Schubert		basic_os=${basic_os:-elf}
121625039b37SCy Schubert		;;
121725039b37SCy Schubert	neo-tandem)
121825039b37SCy Schubert		cpu=neo
121925039b37SCy Schubert		vendor=tandem
122025039b37SCy Schubert		;;
122125039b37SCy Schubert	nse-tandem)
122225039b37SCy Schubert		cpu=nse
122325039b37SCy Schubert		vendor=tandem
122425039b37SCy Schubert		;;
122525039b37SCy Schubert	nsr-tandem)
122625039b37SCy Schubert		cpu=nsr
122725039b37SCy Schubert		vendor=tandem
122825039b37SCy Schubert		;;
122925039b37SCy Schubert	nsv-tandem)
123025039b37SCy Schubert		cpu=nsv
123125039b37SCy Schubert		vendor=tandem
123225039b37SCy Schubert		;;
123325039b37SCy Schubert	nsx-tandem)
123425039b37SCy Schubert		cpu=nsx
123525039b37SCy Schubert		vendor=tandem
123625039b37SCy Schubert		;;
123725039b37SCy Schubert	mipsallegrexel-sony)
123825039b37SCy Schubert		cpu=mipsallegrexel
123925039b37SCy Schubert		vendor=sony
124025039b37SCy Schubert		;;
124125039b37SCy Schubert	tile*-*)
124225039b37SCy Schubert		basic_os=${basic_os:-linux-gnu}
124325039b37SCy Schubert		;;
124425039b37SCy Schubert
124525039b37SCy Schubert	*)
124625039b37SCy Schubert		# Recognize the canonical CPU types that are allowed with any
124725039b37SCy Schubert		# company name.
124825039b37SCy Schubert		case $cpu in
1249*56850988SCy Schubert			  1750a \
1250*56850988SCy Schubert			| 580 \
1251*56850988SCy Schubert			| [cjt]90 \
1252b7579f77SDag-Erling Smørgrav			| a29k \
1253*56850988SCy Schubert			| aarch64 \
1254*56850988SCy Schubert			| aarch64_be \
1255*56850988SCy Schubert			| aarch64c \
125625039b37SCy Schubert			| abacus \
1257*56850988SCy Schubert			| alpha \
1258*56850988SCy Schubert			| alpha64 \
1259*56850988SCy Schubert			| alpha64ev56 \
1260*56850988SCy Schubert			| alpha64ev6[78] \
1261*56850988SCy Schubert			| alpha64ev[4-8] \
1262*56850988SCy Schubert			| alpha64pca5[67] \
1263*56850988SCy Schubert			| alphaev56 \
1264*56850988SCy Schubert			| alphaev6[78] \
1265*56850988SCy Schubert			| alphaev[4-8] \
1266*56850988SCy Schubert			| alphapca5[67] \
1267b7579f77SDag-Erling Smørgrav			| am33_2.0 \
126825039b37SCy Schubert			| amdgcn \
1269*56850988SCy Schubert			| arc \
1270*56850988SCy Schubert			| arc32 \
1271*56850988SCy Schubert			| arc64 \
1272*56850988SCy Schubert			| arceb \
1273*56850988SCy Schubert			| arm \
1274*56850988SCy Schubert			| arm64e \
1275*56850988SCy Schubert			| arm64ec \
1276*56850988SCy Schubert			| arm[lb]e \
1277*56850988SCy Schubert			| arme[lb] \
1278*56850988SCy Schubert			| armv* \
127925039b37SCy Schubert			| asmjs \
1280*56850988SCy Schubert			| avr \
1281*56850988SCy Schubert			| avr32 \
12828157cbabSDag-Erling Smørgrav			| ba \
1283*56850988SCy Schubert			| be32 \
1284*56850988SCy Schubert			| be64 \
1285*56850988SCy Schubert			| bfin \
1286*56850988SCy Schubert			| bpf \
1287*56850988SCy Schubert			| bs2000 \
1288*56850988SCy Schubert			| c30 \
1289*56850988SCy Schubert			| c4x \
1290*56850988SCy Schubert			| c8051 \
1291*56850988SCy Schubert			| c[123]* \
1292*56850988SCy Schubert			| clipper \
1293*56850988SCy Schubert			| craynv \
1294*56850988SCy Schubert			| csky \
1295*56850988SCy Schubert			| cydra \
1296*56850988SCy Schubert			| d10v \
1297*56850988SCy Schubert			| d30v \
1298*56850988SCy Schubert			| dlx \
1299*56850988SCy Schubert			| dsp16xx \
1300*56850988SCy Schubert			| e2k \
1301*56850988SCy Schubert			| elxsi \
1302*56850988SCy Schubert			| epiphany \
1303*56850988SCy Schubert			| f30[01] \
1304*56850988SCy Schubert			| f700 \
1305*56850988SCy Schubert			| fido \
1306*56850988SCy Schubert			| fr30 \
1307*56850988SCy Schubert			| frv \
1308*56850988SCy Schubert			| ft32 \
1309*56850988SCy Schubert			| fx80 \
1310*56850988SCy Schubert			| h8300 \
1311*56850988SCy Schubert			| h8500 \
13128ed2b524SDag-Erling Smørgrav			| hexagon \
1313*56850988SCy Schubert			| hppa \
1314*56850988SCy Schubert			| hppa1.[01] \
1315*56850988SCy Schubert			| hppa2.0 \
1316*56850988SCy Schubert			| hppa2.0[nw] \
1317*56850988SCy Schubert			| hppa64 \
1318*56850988SCy Schubert			| i*86 \
1319*56850988SCy Schubert			| i370 \
1320*56850988SCy Schubert			| i860 \
1321*56850988SCy Schubert			| i960 \
1322*56850988SCy Schubert			| ia16 \
1323*56850988SCy Schubert			| ia64 \
1324*56850988SCy Schubert			| ip2k \
1325*56850988SCy Schubert			| iq2000 \
1326*56850988SCy Schubert			| javascript \
13278157cbabSDag-Erling Smørgrav			| k1om \
13288f76bb7dSCy Schubert			| kvx \
1329*56850988SCy Schubert			| le32 \
1330*56850988SCy Schubert			| le64 \
1331b7579f77SDag-Erling Smørgrav			| lm32 \
1332*56850988SCy Schubert			| loongarch32 \
1333*56850988SCy Schubert			| loongarch64 \
1334*56850988SCy Schubert			| m32c \
1335*56850988SCy Schubert			| m32r \
1336*56850988SCy Schubert			| m32rle \
1337*56850988SCy Schubert			| m5200 \
1338*56850988SCy Schubert			| m68000 \
1339*56850988SCy Schubert			| m680[012346]0 \
1340*56850988SCy Schubert			| m6811 \
1341*56850988SCy Schubert			| m6812 \
1342*56850988SCy Schubert			| m68360 \
1343*56850988SCy Schubert			| m683?2 \
1344*56850988SCy Schubert			| m68hc11 \
1345*56850988SCy Schubert			| m68hc12 \
1346*56850988SCy Schubert			| m68hcs12x \
1347*56850988SCy Schubert			| m68k \
1348*56850988SCy Schubert			| m88110 \
1349*56850988SCy Schubert			| m88k \
1350*56850988SCy Schubert			| maxq \
1351*56850988SCy Schubert			| mb \
1352*56850988SCy Schubert			| mcore \
1353*56850988SCy Schubert			| mep \
1354*56850988SCy Schubert			| metag \
1355*56850988SCy Schubert			| microblaze \
1356*56850988SCy Schubert			| microblazeel \
13578f76bb7dSCy Schubert			| mips* \
135825039b37SCy Schubert			| mmix \
1359*56850988SCy Schubert			| mn10200 \
1360*56850988SCy Schubert			| mn10300 \
1361b7579f77SDag-Erling Smørgrav			| moxie \
1362b7579f77SDag-Erling Smørgrav			| msp430 \
1363*56850988SCy Schubert			| mt \
1364b76ef9a7SCy Schubert			| nanomips* \
1365*56850988SCy Schubert			| nds32 \
1366*56850988SCy Schubert			| nds32be \
1367*56850988SCy Schubert			| nds32le \
136825039b37SCy Schubert			| nfp \
1369*56850988SCy Schubert			| nios \
1370*56850988SCy Schubert			| nios2 \
1371*56850988SCy Schubert			| nios2eb \
1372*56850988SCy Schubert			| nios2el \
1373*56850988SCy Schubert			| none \
1374*56850988SCy Schubert			| np1 \
1375*56850988SCy Schubert			| ns16k \
1376*56850988SCy Schubert			| ns32k \
1377*56850988SCy Schubert			| nvptx \
137825039b37SCy Schubert			| open8 \
137925039b37SCy Schubert			| or1k* \
138025039b37SCy Schubert			| or32 \
138125039b37SCy Schubert			| orion \
1382*56850988SCy Schubert			| pdp10 \
1383*56850988SCy Schubert			| pdp11 \
138425039b37SCy Schubert			| picochip \
1385*56850988SCy Schubert			| pj \
1386*56850988SCy Schubert			| pjl \
1387*56850988SCy Schubert			| pn \
1388*56850988SCy Schubert			| power \
1389*56850988SCy Schubert			| powerpc \
1390*56850988SCy Schubert			| powerpc64 \
1391*56850988SCy Schubert			| powerpc64le \
1392*56850988SCy Schubert			| powerpcle \
1393*56850988SCy Schubert			| powerpcspe \
139425039b37SCy Schubert			| pru \
1395b7579f77SDag-Erling Smørgrav			| pyramid \
1396*56850988SCy Schubert			| riscv \
1397*56850988SCy Schubert			| riscv32 \
1398*56850988SCy Schubert			| riscv32be \
1399*56850988SCy Schubert			| riscv64 \
1400*56850988SCy Schubert			| riscv64be \
1401*56850988SCy Schubert			| rl78 \
1402*56850988SCy Schubert			| romp \
1403*56850988SCy Schubert			| rs6000 \
1404*56850988SCy Schubert			| rx \
1405*56850988SCy Schubert			| s390 \
1406*56850988SCy Schubert			| s390x \
1407b7579f77SDag-Erling Smørgrav			| score \
1408*56850988SCy Schubert			| sh \
1409*56850988SCy Schubert			| sh64 \
1410*56850988SCy Schubert			| sh64le \
1411*56850988SCy Schubert			| sh[12345][lb]e \
1412*56850988SCy Schubert			| sh[1234] \
1413*56850988SCy Schubert			| sh[1234]e[lb] \
1414*56850988SCy Schubert			| sh[23]e \
1415*56850988SCy Schubert			| sh[23]ele \
1416*56850988SCy Schubert			| sh[24]a \
1417*56850988SCy Schubert			| sh[24]ae[lb] \
1418*56850988SCy Schubert			| sh[lb]e \
1419*56850988SCy Schubert			| she[lb] \
1420*56850988SCy Schubert			| shl \
1421*56850988SCy Schubert			| sparc \
1422*56850988SCy Schubert			| sparc64 \
1423*56850988SCy Schubert			| sparc64b \
1424*56850988SCy Schubert			| sparc64v \
1425*56850988SCy Schubert			| sparc86x \
1426*56850988SCy Schubert			| sparclet \
142725039b37SCy Schubert			| sparclite \
1428*56850988SCy Schubert			| sparcv8 \
1429*56850988SCy Schubert			| sparcv9 \
1430*56850988SCy Schubert			| sparcv9b \
1431*56850988SCy Schubert			| sparcv9v \
14328ed2b524SDag-Erling Smørgrav			| spu \
1433*56850988SCy Schubert			| sv1 \
1434*56850988SCy Schubert			| sx* \
143525039b37SCy Schubert			| tahoe \
1436369c6923SCy Schubert			| thumbv7* \
1437*56850988SCy Schubert			| tic30 \
1438*56850988SCy Schubert			| tic4x \
1439*56850988SCy Schubert			| tic54x \
1440*56850988SCy Schubert			| tic55x \
1441*56850988SCy Schubert			| tic6x \
1442*56850988SCy Schubert			| tic80 \
144325039b37SCy Schubert			| tron \
1444b7579f77SDag-Erling Smørgrav			| ubicom32 \
1445*56850988SCy Schubert			| v70 \
1446*56850988SCy Schubert			| v810 \
1447*56850988SCy Schubert			| v850 \
1448*56850988SCy Schubert			| v850e \
1449*56850988SCy Schubert			| v850e1 \
1450*56850988SCy Schubert			| v850e2 \
1451*56850988SCy Schubert			| v850e2v3 \
1452*56850988SCy Schubert			| v850es \
145325039b37SCy Schubert			| vax \
1454b76ef9a7SCy Schubert			| vc4 \
14558157cbabSDag-Erling Smørgrav			| visium \
145625039b37SCy Schubert			| w65 \
1457*56850988SCy Schubert			| wasm32 \
1458*56850988SCy Schubert			| wasm64 \
1459091e9e46SCy Schubert			| we32k \
1460*56850988SCy Schubert			| x86 \
1461*56850988SCy Schubert			| x86_64 \
1462*56850988SCy Schubert			| xc16x \
1463*56850988SCy Schubert			| xgate \
1464*56850988SCy Schubert			| xps100 \
1465*56850988SCy Schubert			| xstormy16 \
1466*56850988SCy Schubert			| xtensa* \
146725039b37SCy Schubert			| ymp \
1468*56850988SCy Schubert			| z80 \
1469*56850988SCy Schubert			| z8k)
1470b7579f77SDag-Erling Smørgrav				;;
1471b7579f77SDag-Erling Smørgrav
147225039b37SCy Schubert			*)
14738f76bb7dSCy Schubert				echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
1474b7579f77SDag-Erling Smørgrav				exit 1
1475b7579f77SDag-Erling Smørgrav				;;
1476b7579f77SDag-Erling Smørgrav		esac
1477b7579f77SDag-Erling Smørgrav		;;
1478b7579f77SDag-Erling Smørgravesac
1479b7579f77SDag-Erling Smørgrav
1480b7579f77SDag-Erling Smørgrav# Here we canonicalize certain aliases for manufacturers.
148125039b37SCy Schubertcase $vendor in
148225039b37SCy Schubert	digital*)
148325039b37SCy Schubert		vendor=dec
1484b7579f77SDag-Erling Smørgrav		;;
148525039b37SCy Schubert	commodore*)
148625039b37SCy Schubert		vendor=cbm
1487b7579f77SDag-Erling Smørgrav		;;
1488b7579f77SDag-Erling Smørgrav	*)
1489b7579f77SDag-Erling Smørgrav		;;
1490b7579f77SDag-Erling Smørgravesac
1491b7579f77SDag-Erling Smørgrav
1492b7579f77SDag-Erling Smørgrav# Decode manufacturer-specific aliases for certain operating systems.
1493b7579f77SDag-Erling Smørgrav
1494103ba509SCy Schubertif test x"$basic_os" != x
1495b7579f77SDag-Erling Smørgravthen
149625039b37SCy Schubert
14979cf5bc93SCy Schubert# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
149825039b37SCy Schubert# set os.
1499103ba509SCy Schubertobj=
150025039b37SCy Schubertcase $basic_os in
150125039b37SCy Schubert	gnu/linux*)
150225039b37SCy Schubert		kernel=linux
15035469a995SCy Schubert		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1504369c6923SCy Schubert		;;
1505369c6923SCy Schubert	os2-emx)
1506369c6923SCy Schubert		kernel=os2
15075469a995SCy Schubert		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1508b7579f77SDag-Erling Smørgrav		;;
150925039b37SCy Schubert	nto-qnx*)
151025039b37SCy Schubert		kernel=nto
15115469a995SCy Schubert		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
151225039b37SCy Schubert		;;
151325039b37SCy Schubert	*-*)
151424e36522SCy Schubert		saved_IFS=$IFS
151525039b37SCy Schubert		IFS="-" read kernel os <<EOF
151625039b37SCy Schubert$basic_os
151725039b37SCy SchubertEOF
151824e36522SCy Schubert		IFS=$saved_IFS
151925039b37SCy Schubert		;;
152025039b37SCy Schubert	# Default OS when just kernel was specified
152125039b37SCy Schubert	nto*)
152225039b37SCy Schubert		kernel=nto
15235469a995SCy Schubert		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
152425039b37SCy Schubert		;;
152525039b37SCy Schubert	linux*)
152625039b37SCy Schubert		kernel=linux
15275469a995SCy Schubert		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
152825039b37SCy Schubert		;;
1529865f46b2SCy Schubert	managarm*)
1530865f46b2SCy Schubert		kernel=managarm
1531865f46b2SCy Schubert		os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
1532865f46b2SCy Schubert		;;
153325039b37SCy Schubert	*)
153425039b37SCy Schubert		kernel=
153525039b37SCy Schubert		os=$basic_os
153625039b37SCy Schubert		;;
153725039b37SCy Schubertesac
153825039b37SCy Schubert
153925039b37SCy Schubert# Now, normalize the OS (knowing we just have one component, it's not a kernel,
154025039b37SCy Schubert# etc.)
154125039b37SCy Schubertcase $os in
154225039b37SCy Schubert	# First match some system type aliases that might get confused
154325039b37SCy Schubert	# with valid system types.
154425039b37SCy Schubert	# solaris* is a basic system type, with this one exception.
154525039b37SCy Schubert	auroraux)
154625039b37SCy Schubert		os=auroraux
154725039b37SCy Schubert		;;
154825039b37SCy Schubert	bluegene*)
154925039b37SCy Schubert		os=cnk
155025039b37SCy Schubert		;;
155125039b37SCy Schubert	solaris1 | solaris1.*)
15525469a995SCy Schubert		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1553b7579f77SDag-Erling Smørgrav		;;
155425039b37SCy Schubert	solaris)
155525039b37SCy Schubert		os=solaris2
1556b7579f77SDag-Erling Smørgrav		;;
155725039b37SCy Schubert	unixware*)
155825039b37SCy Schubert		os=sysv4.2uw
1559091e9e46SCy Schubert		;;
1560*56850988SCy Schubert	# The marketing names for NeXT's operating systems were
1561*56850988SCy Schubert	# NeXTSTEP, NeXTSTEP 2, OpenSTEP 3, OpenSTEP 4.  'openstep' is
1562*56850988SCy Schubert	# mapped to 'openstep3', but 'openstep1' and 'openstep2' are
1563*56850988SCy Schubert	# mapped to 'nextstep' and 'nextstep2', consistent with the
1564*56850988SCy Schubert	# treatment of SunOS/Solaris.
1565*56850988SCy Schubert	ns | ns1 | nextstep | nextstep1 | openstep1)
1566*56850988SCy Schubert		os=nextstep
1567*56850988SCy Schubert		;;
1568*56850988SCy Schubert	ns2 | nextstep2 | openstep2)
1569*56850988SCy Schubert		os=nextstep2
1570*56850988SCy Schubert		;;
1571*56850988SCy Schubert	ns3 | nextstep3 | openstep | openstep3)
1572*56850988SCy Schubert		os=openstep3
1573*56850988SCy Schubert		;;
1574*56850988SCy Schubert	ns4 | nextstep4 | openstep4)
1575*56850988SCy Schubert		os=openstep4
1576*56850988SCy Schubert		;;
157725039b37SCy Schubert	# es1800 is here to avoid being matched by es* (a different OS)
157825039b37SCy Schubert	es1800*)
157925039b37SCy Schubert		os=ose
1580b7579f77SDag-Erling Smørgrav		;;
158125039b37SCy Schubert	# Some version numbers need modification
158225039b37SCy Schubert	chorusos*)
158325039b37SCy Schubert		os=chorusos
1584b7579f77SDag-Erling Smørgrav		;;
158525039b37SCy Schubert	isc)
158625039b37SCy Schubert		os=isc2.2
1587b7579f77SDag-Erling Smørgrav		;;
158825039b37SCy Schubert	sco6)
158925039b37SCy Schubert		os=sco5v6
159025039b37SCy Schubert		;;
159125039b37SCy Schubert	sco5)
159225039b37SCy Schubert		os=sco3.2v5
159325039b37SCy Schubert		;;
159425039b37SCy Schubert	sco4)
159525039b37SCy Schubert		os=sco3.2v4
159625039b37SCy Schubert		;;
159725039b37SCy Schubert	sco3.2.[4-9]*)
15985469a995SCy Schubert		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
159925039b37SCy Schubert		;;
160025039b37SCy Schubert	sco*v* | scout)
160125039b37SCy Schubert		# Don't match below
160225039b37SCy Schubert		;;
160325039b37SCy Schubert	sco*)
160425039b37SCy Schubert		os=sco3.2v2
160525039b37SCy Schubert		;;
160625039b37SCy Schubert	psos*)
160725039b37SCy Schubert		os=psos
160825039b37SCy Schubert		;;
160925039b37SCy Schubert	qnx*)
1610c0caa2e2SCy Schubert		os=qnx
1611b7579f77SDag-Erling Smørgrav		;;
161225039b37SCy Schubert	hiux*)
161325039b37SCy Schubert		os=hiuxwe2
1614b7579f77SDag-Erling Smørgrav		;;
161525039b37SCy Schubert	lynx*178)
161625039b37SCy Schubert		os=lynxos178
1617b7579f77SDag-Erling Smørgrav		;;
161825039b37SCy Schubert	lynx*5)
161925039b37SCy Schubert		os=lynxos5
1620b7579f77SDag-Erling Smørgrav		;;
162125039b37SCy Schubert	lynxos*)
162225039b37SCy Schubert		# don't get caught up in next wildcard
1623b7579f77SDag-Erling Smørgrav		;;
162425039b37SCy Schubert	lynx*)
162525039b37SCy Schubert		os=lynxos
1626b7579f77SDag-Erling Smørgrav		;;
162725039b37SCy Schubert	mac[0-9]*)
16285469a995SCy Schubert		os=`echo "$os" | sed -e 's|mac|macos|'`
1629b7579f77SDag-Erling Smørgrav		;;
163025039b37SCy Schubert	opened*)
163125039b37SCy Schubert		os=openedition
1632b7579f77SDag-Erling Smørgrav		;;
163325039b37SCy Schubert	os400*)
163425039b37SCy Schubert		os=os400
1635b7579f77SDag-Erling Smørgrav		;;
163625039b37SCy Schubert	sunos5*)
16375469a995SCy Schubert		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1638b7579f77SDag-Erling Smørgrav		;;
163925039b37SCy Schubert	sunos6*)
16405469a995SCy Schubert		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1641b7579f77SDag-Erling Smørgrav		;;
164225039b37SCy Schubert	wince*)
164325039b37SCy Schubert		os=wince
1644b7579f77SDag-Erling Smørgrav		;;
164525039b37SCy Schubert	utek*)
164625039b37SCy Schubert		os=bsd
1647*56850988SCy Schubert		vendor=`echo "$vendor" | sed -e 's|^unknown$|tektronix|'`
1648091e9e46SCy Schubert		;;
164925039b37SCy Schubert	dynix*)
165025039b37SCy Schubert		os=bsd
1651091e9e46SCy Schubert		;;
165225039b37SCy Schubert	acis*)
165325039b37SCy Schubert		os=aos
1654b7579f77SDag-Erling Smørgrav		;;
165525039b37SCy Schubert	atheos*)
165625039b37SCy Schubert		os=atheos
1657b7579f77SDag-Erling Smørgrav		;;
165825039b37SCy Schubert	syllable*)
165925039b37SCy Schubert		os=syllable
1660b7579f77SDag-Erling Smørgrav		;;
166125039b37SCy Schubert	386bsd)
166225039b37SCy Schubert		os=bsd
1663b7579f77SDag-Erling Smørgrav		;;
1664*56850988SCy Schubert	ctix*)
1665*56850988SCy Schubert		os=sysv
1666*56850988SCy Schubert		vendor=`echo "$vendor" | sed -e 's|^unknown$|convergent|'`
1667*56850988SCy Schubert		;;
1668*56850988SCy Schubert	uts*)
166925039b37SCy Schubert		os=sysv
1670b7579f77SDag-Erling Smørgrav		;;
167125039b37SCy Schubert	nova*)
1672*56850988SCy Schubert		kernel=rtmk
1673*56850988SCy Schubert		os=nova
1674b7579f77SDag-Erling Smørgrav		;;
1675b7579f77SDag-Erling Smørgrav	# Preserve the version number of sinix5.
167625039b37SCy Schubert	sinix5.*)
16775469a995SCy Schubert		os=`echo "$os" | sed -e 's|sinix|sysv|'`
1678*56850988SCy Schubert		vendor=`echo "$vendor" | sed -e 's|^unknown$|sni|'`
1679b7579f77SDag-Erling Smørgrav		;;
168025039b37SCy Schubert	sinix*)
168125039b37SCy Schubert		os=sysv4
1682*56850988SCy Schubert		vendor=`echo "$vendor" | sed -e 's|^unknown$|sni|'`
1683b7579f77SDag-Erling Smørgrav		;;
168425039b37SCy Schubert	tpf*)
168525039b37SCy Schubert		os=tpf
1686b7579f77SDag-Erling Smørgrav		;;
168725039b37SCy Schubert	triton*)
168825039b37SCy Schubert		os=sysv3
1689b7579f77SDag-Erling Smørgrav		;;
169025039b37SCy Schubert	oss*)
169125039b37SCy Schubert		os=sysv3
1692b7579f77SDag-Erling Smørgrav		;;
169325039b37SCy Schubert	svr4*)
169425039b37SCy Schubert		os=sysv4
1695b7579f77SDag-Erling Smørgrav		;;
169625039b37SCy Schubert	svr3)
169725039b37SCy Schubert		os=sysv3
1698b7579f77SDag-Erling Smørgrav		;;
169925039b37SCy Schubert	sysvr4)
170025039b37SCy Schubert		os=sysv4
1701b7579f77SDag-Erling Smørgrav		;;
170225039b37SCy Schubert	ose*)
170325039b37SCy Schubert		os=ose
1704b7579f77SDag-Erling Smørgrav		;;
170525039b37SCy Schubert	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
170625039b37SCy Schubert		os=mint
1707b7579f77SDag-Erling Smørgrav		;;
170825039b37SCy Schubert	dicos*)
170925039b37SCy Schubert		os=dicos
1710091e9e46SCy Schubert		;;
171125039b37SCy Schubert	pikeos*)
171225039b37SCy Schubert		# Until real need of OS specific support for
171325039b37SCy Schubert		# particular features comes up, bare metal
171425039b37SCy Schubert		# configurations are quite functional.
171525039b37SCy Schubert		case $cpu in
171625039b37SCy Schubert		    arm*)
171725039b37SCy Schubert			os=eabi
1718b7579f77SDag-Erling Smørgrav			;;
1719b7579f77SDag-Erling Smørgrav		    *)
1720103ba509SCy Schubert			os=
1721103ba509SCy Schubert			obj=elf
1722b7579f77SDag-Erling Smørgrav			;;
1723b7579f77SDag-Erling Smørgrav		esac
172425039b37SCy Schubert		;;
1725103ba509SCy Schubert	aout* | coff* | elf* | pe*)
1726103ba509SCy Schubert		# These are machine code file formats, not OSes
1727103ba509SCy Schubert		obj=$os
1728103ba509SCy Schubert		os=
1729103ba509SCy Schubert		;;
173025039b37SCy Schubert	*)
173125039b37SCy Schubert		# No normalization, but not necessarily accepted, that comes below.
173225039b37SCy Schubert		;;
173325039b37SCy Schubertesac
173425039b37SCy Schubert
1735b7579f77SDag-Erling Smørgravelse
1736b7579f77SDag-Erling Smørgrav
1737b7579f77SDag-Erling Smørgrav# Here we handle the default operating systems that come with various machines.
1738b7579f77SDag-Erling Smørgrav# The value should be what the vendor currently ships out the door with their
1739b7579f77SDag-Erling Smørgrav# machine or put another way, the most popular os provided with the machine.
1740b7579f77SDag-Erling Smørgrav
1741b7579f77SDag-Erling Smørgrav# Note that if you're going to try to match "-MANUFACTURER" here (say,
1742b7579f77SDag-Erling Smørgrav# "-sun"), then you have to tell the case statement up towards the top
1743b7579f77SDag-Erling Smørgrav# that MANUFACTURER isn't an operating system.  Otherwise, code above
1744b7579f77SDag-Erling Smørgrav# will signal an error saying that MANUFACTURER isn't an operating
1745b7579f77SDag-Erling Smørgrav# system, and we'll never get to this point.
1746b7579f77SDag-Erling Smørgrav
174725039b37SCy Schubertkernel=
1748103ba509SCy Schubertobj=
174925039b37SCy Schubertcase $cpu-$vendor in
1750b7579f77SDag-Erling Smørgrav	score-*)
1751103ba509SCy Schubert		os=
1752103ba509SCy Schubert		obj=elf
1753b7579f77SDag-Erling Smørgrav		;;
1754b7579f77SDag-Erling Smørgrav	spu-*)
1755103ba509SCy Schubert		os=
1756103ba509SCy Schubert		obj=elf
1757b7579f77SDag-Erling Smørgrav		;;
1758b7579f77SDag-Erling Smørgrav	*-acorn)
175925039b37SCy Schubert		os=riscix1.2
1760b7579f77SDag-Erling Smørgrav		;;
1761b7579f77SDag-Erling Smørgrav	arm*-rebel)
176225039b37SCy Schubert		kernel=linux
176325039b37SCy Schubert		os=gnu
1764b7579f77SDag-Erling Smørgrav		;;
1765b7579f77SDag-Erling Smørgrav	arm*-semi)
1766103ba509SCy Schubert		os=
1767103ba509SCy Schubert		obj=aout
1768b7579f77SDag-Erling Smørgrav		;;
1769b7579f77SDag-Erling Smørgrav	c4x-* | tic4x-*)
1770103ba509SCy Schubert		os=
1771103ba509SCy Schubert		obj=coff
1772b7579f77SDag-Erling Smørgrav		;;
1773ff825849SDag-Erling Smørgrav	c8051-*)
1774103ba509SCy Schubert		os=
1775103ba509SCy Schubert		obj=elf
177625039b37SCy Schubert		;;
177725039b37SCy Schubert	clipper-intergraph)
177825039b37SCy Schubert		os=clix
1779ff825849SDag-Erling Smørgrav		;;
17808ed2b524SDag-Erling Smørgrav	hexagon-*)
1781103ba509SCy Schubert		os=
1782103ba509SCy Schubert		obj=elf
17838ed2b524SDag-Erling Smørgrav		;;
17848ed2b524SDag-Erling Smørgrav	tic54x-*)
1785103ba509SCy Schubert		os=
1786103ba509SCy Schubert		obj=coff
17878ed2b524SDag-Erling Smørgrav		;;
17888ed2b524SDag-Erling Smørgrav	tic55x-*)
1789103ba509SCy Schubert		os=
1790103ba509SCy Schubert		obj=coff
17918ed2b524SDag-Erling Smørgrav		;;
17928ed2b524SDag-Erling Smørgrav	tic6x-*)
1793103ba509SCy Schubert		os=
1794103ba509SCy Schubert		obj=coff
17958ed2b524SDag-Erling Smørgrav		;;
1796b7579f77SDag-Erling Smørgrav	# This must come before the *-dec entry.
1797b7579f77SDag-Erling Smørgrav	pdp10-*)
179825039b37SCy Schubert		os=tops20
1799b7579f77SDag-Erling Smørgrav		;;
1800b7579f77SDag-Erling Smørgrav	pdp11-*)
180125039b37SCy Schubert		os=none
1802b7579f77SDag-Erling Smørgrav		;;
1803b7579f77SDag-Erling Smørgrav	*-dec | vax-*)
180425039b37SCy Schubert		os=ultrix4.2
1805b7579f77SDag-Erling Smørgrav		;;
1806b7579f77SDag-Erling Smørgrav	m68*-apollo)
180725039b37SCy Schubert		os=domain
1808b7579f77SDag-Erling Smørgrav		;;
1809b7579f77SDag-Erling Smørgrav	i386-sun)
181025039b37SCy Schubert		os=sunos4.0.2
1811b7579f77SDag-Erling Smørgrav		;;
1812b7579f77SDag-Erling Smørgrav	m68000-sun)
181325039b37SCy Schubert		os=sunos3
1814b7579f77SDag-Erling Smørgrav		;;
1815b7579f77SDag-Erling Smørgrav	m68*-cisco)
1816103ba509SCy Schubert		os=
1817103ba509SCy Schubert		obj=aout
1818b7579f77SDag-Erling Smørgrav		;;
1819b7579f77SDag-Erling Smørgrav	mep-*)
1820103ba509SCy Schubert		os=
1821103ba509SCy Schubert		obj=elf
1822b7579f77SDag-Erling Smørgrav		;;
1823*56850988SCy Schubert	# The -sgi and -siemens entries must be before the mips- entry
1824*56850988SCy Schubert	# or we get the wrong os.
1825*56850988SCy Schubert	*-sgi)
1826*56850988SCy Schubert		os=irix
1827*56850988SCy Schubert		;;
1828*56850988SCy Schubert	*-siemens)
1829*56850988SCy Schubert		os=sysv4
1830*56850988SCy Schubert		;;
1831b7579f77SDag-Erling Smørgrav	mips*-cisco)
1832103ba509SCy Schubert		os=
1833103ba509SCy Schubert		obj=elf
1834b7579f77SDag-Erling Smørgrav		;;
1835b76ef9a7SCy Schubert	mips*-*|nanomips*-*)
1836103ba509SCy Schubert		os=
1837103ba509SCy Schubert		obj=elf
1838b7579f77SDag-Erling Smørgrav		;;
1839b7579f77SDag-Erling Smørgrav	or32-*)
1840103ba509SCy Schubert		os=
1841103ba509SCy Schubert		obj=coff
1842b7579f77SDag-Erling Smørgrav		;;
1843*56850988SCy Schubert	# This must be before the sparc-* entry or we get the wrong os.
1844*56850988SCy Schubert	*-tti)
184525039b37SCy Schubert		os=sysv3
1846b7579f77SDag-Erling Smørgrav		;;
1847b7579f77SDag-Erling Smørgrav	sparc-* | *-sun)
184825039b37SCy Schubert		os=sunos4.1.1
184925039b37SCy Schubert		;;
185025039b37SCy Schubert	pru-*)
1851103ba509SCy Schubert		os=
1852103ba509SCy Schubert		obj=elf
1853b7579f77SDag-Erling Smørgrav		;;
1854b7579f77SDag-Erling Smørgrav	*-be)
185525039b37SCy Schubert		os=beos
1856091e9e46SCy Schubert		;;
1857b7579f77SDag-Erling Smørgrav	*-ibm)
185825039b37SCy Schubert		os=aix
1859b7579f77SDag-Erling Smørgrav		;;
1860b7579f77SDag-Erling Smørgrav	*-knuth)
186125039b37SCy Schubert		os=mmixware
1862b7579f77SDag-Erling Smørgrav		;;
1863b7579f77SDag-Erling Smørgrav	*-wec)
186425039b37SCy Schubert		os=proelf
1865b7579f77SDag-Erling Smørgrav		;;
1866b7579f77SDag-Erling Smørgrav	*-winbond)
186725039b37SCy Schubert		os=proelf
1868b7579f77SDag-Erling Smørgrav		;;
1869b7579f77SDag-Erling Smørgrav	*-oki)
187025039b37SCy Schubert		os=proelf
1871b7579f77SDag-Erling Smørgrav		;;
1872b7579f77SDag-Erling Smørgrav	*-hp)
187325039b37SCy Schubert		os=hpux
1874b7579f77SDag-Erling Smørgrav		;;
1875b7579f77SDag-Erling Smørgrav	*-hitachi)
1876*56850988SCy Schubert		os=hiuxwe2
1877b7579f77SDag-Erling Smørgrav		;;
1878b7579f77SDag-Erling Smørgrav	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
187925039b37SCy Schubert		os=sysv
1880b7579f77SDag-Erling Smørgrav		;;
1881b7579f77SDag-Erling Smørgrav	*-cbm)
188225039b37SCy Schubert		os=amigaos
1883b7579f77SDag-Erling Smørgrav		;;
1884b7579f77SDag-Erling Smørgrav	*-dg)
188525039b37SCy Schubert		os=dgux
1886b7579f77SDag-Erling Smørgrav		;;
1887b7579f77SDag-Erling Smørgrav	*-dolphin)
188825039b37SCy Schubert		os=sysv3
1889b7579f77SDag-Erling Smørgrav		;;
1890b7579f77SDag-Erling Smørgrav	m68k-ccur)
189125039b37SCy Schubert		os=rtu
1892b7579f77SDag-Erling Smørgrav		;;
1893b7579f77SDag-Erling Smørgrav	m88k-omron*)
189425039b37SCy Schubert		os=luna
1895b7579f77SDag-Erling Smørgrav		;;
1896b7579f77SDag-Erling Smørgrav	*-next)
189725039b37SCy Schubert		os=nextstep
1898b7579f77SDag-Erling Smørgrav		;;
1899b7579f77SDag-Erling Smørgrav	*-sequent)
190025039b37SCy Schubert		os=ptx
1901b7579f77SDag-Erling Smørgrav		;;
1902b7579f77SDag-Erling Smørgrav	*-crds)
190325039b37SCy Schubert		os=unos
1904b7579f77SDag-Erling Smørgrav		;;
1905b7579f77SDag-Erling Smørgrav	*-ns)
190625039b37SCy Schubert		os=genix
1907b7579f77SDag-Erling Smørgrav		;;
1908b7579f77SDag-Erling Smørgrav	i370-*)
190925039b37SCy Schubert		os=mvs
1910091e9e46SCy Schubert		;;
1911b7579f77SDag-Erling Smørgrav	*-gould)
191225039b37SCy Schubert		os=sysv
1913b7579f77SDag-Erling Smørgrav		;;
1914b7579f77SDag-Erling Smørgrav	*-highlevel)
191525039b37SCy Schubert		os=bsd
1916b7579f77SDag-Erling Smørgrav		;;
1917b7579f77SDag-Erling Smørgrav	*-encore)
191825039b37SCy Schubert		os=bsd
1919b7579f77SDag-Erling Smørgrav		;;
1920b7579f77SDag-Erling Smørgrav	*-masscomp)
192125039b37SCy Schubert		os=rtu
1922b7579f77SDag-Erling Smørgrav		;;
1923b7579f77SDag-Erling Smørgrav	f30[01]-fujitsu | f700-fujitsu)
192425039b37SCy Schubert		os=uxpv
1925b7579f77SDag-Erling Smørgrav		;;
1926b7579f77SDag-Erling Smørgrav	*-rom68k)
1927103ba509SCy Schubert		os=
1928103ba509SCy Schubert		obj=coff
1929b7579f77SDag-Erling Smørgrav		;;
1930b7579f77SDag-Erling Smørgrav	*-*bug)
1931103ba509SCy Schubert		os=
1932103ba509SCy Schubert		obj=coff
1933b7579f77SDag-Erling Smørgrav		;;
1934b7579f77SDag-Erling Smørgrav	*-apple)
193525039b37SCy Schubert		os=macos
1936b7579f77SDag-Erling Smørgrav		;;
1937b7579f77SDag-Erling Smørgrav	*-atari*)
193825039b37SCy Schubert		os=mint
193925039b37SCy Schubert		;;
194025039b37SCy Schubert	*-wrs)
194125039b37SCy Schubert		os=vxworks
1942b7579f77SDag-Erling Smørgrav		;;
1943b7579f77SDag-Erling Smørgrav	*)
194425039b37SCy Schubert		os=none
1945b7579f77SDag-Erling Smørgrav		;;
1946b7579f77SDag-Erling Smørgravesac
194725039b37SCy Schubert
1948b7579f77SDag-Erling Smørgravfi
1949b7579f77SDag-Erling Smørgrav
1950103ba509SCy Schubert# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
1951103ba509SCy Schubert
195225039b37SCy Schubertcase $os in
1953f44e67d1SCy Schubert	# Sometimes we do "kernel-libc", so those need to count as OSes.
1954b76ef9a7SCy Schubert	llvm* | musl* | newlib* | relibc* | uclibc*)
195525039b37SCy Schubert		;;
1956f44e67d1SCy Schubert	# Likewise for "kernel-abi"
1957f44e67d1SCy Schubert	eabi* | gnueabi*)
1958f44e67d1SCy Schubert		;;
1959f44e67d1SCy Schubert	# VxWorks passes extra cpu info in the 4th filed.
1960f44e67d1SCy Schubert	simlinux | simwindows | spe)
196125039b37SCy Schubert		;;
1962103ba509SCy Schubert	# See `case $cpu-$os` validation below
1963103ba509SCy Schubert	ghcjs)
1964103ba509SCy Schubert		;;
196525039b37SCy Schubert	# Now accept the basic system types.
196625039b37SCy Schubert	# Each alternative MUST end in a * to match a version number.
1967*56850988SCy Schubert	  abug \
1968*56850988SCy Schubert	| aix* \
1969*56850988SCy Schubert	| amdhsa* \
1970*56850988SCy Schubert	| amigados* \
1971*56850988SCy Schubert	| amigaos* \
1972*56850988SCy Schubert	| android* \
1973*56850988SCy Schubert	| aof* \
1974*56850988SCy Schubert	| aos* \
1975*56850988SCy Schubert	| aros* \
1976*56850988SCy Schubert	| atheos* \
1977*56850988SCy Schubert	| auroraux* \
1978*56850988SCy Schubert	| aux* \
1979*56850988SCy Schubert	| beos* \
1980*56850988SCy Schubert	| bitrig* \
1981*56850988SCy Schubert	| bme* \
1982*56850988SCy Schubert	| bosx* \
1983*56850988SCy Schubert	| bsd* \
1984*56850988SCy Schubert	| cegcc* \
1985*56850988SCy Schubert	| chorusos* \
1986*56850988SCy Schubert	| chorusrdb* \
1987*56850988SCy Schubert	| clix* \
1988*56850988SCy Schubert	| cloudabi* \
1989*56850988SCy Schubert	| cnk* \
1990*56850988SCy Schubert	| conix* \
1991*56850988SCy Schubert	| cos* \
1992*56850988SCy Schubert	| cxux* \
1993*56850988SCy Schubert	| cygwin* \
1994*56850988SCy Schubert	| darwin* \
1995*56850988SCy Schubert	| dgux* \
1996*56850988SCy Schubert	| dicos* \
1997*56850988SCy Schubert	| dnix* \
1998*56850988SCy Schubert	| domain* \
1999*56850988SCy Schubert	| dragonfly* \
2000*56850988SCy Schubert	| drops* \
2001*56850988SCy Schubert	| ebmon* \
2002*56850988SCy Schubert	| ecoff* \
2003*56850988SCy Schubert	| ekkobsd* \
2004*56850988SCy Schubert	| emscripten* \
2005*56850988SCy Schubert	| emx* \
2006*56850988SCy Schubert	| es* \
2007*56850988SCy Schubert	| fiwix* \
2008*56850988SCy Schubert	| freebsd* \
2009*56850988SCy Schubert	| fuchsia* \
2010*56850988SCy Schubert	| genix* \
2011*56850988SCy Schubert	| genode* \
2012*56850988SCy Schubert	| glidix* \
2013*56850988SCy Schubert	| gnu* \
2014*56850988SCy Schubert	| go32* \
2015*56850988SCy Schubert	| haiku* \
2016*56850988SCy Schubert	| hcos* \
2017*56850988SCy Schubert	| hiux* \
2018*56850988SCy Schubert	| hms* \
2019*56850988SCy Schubert	| hpux* \
2020*56850988SCy Schubert	| ieee* \
2021*56850988SCy Schubert	| interix* \
2022*56850988SCy Schubert	| ios* \
2023*56850988SCy Schubert	| iris* \
2024*56850988SCy Schubert	| irix* \
2025*56850988SCy Schubert	| ironclad* \
2026*56850988SCy Schubert	| isc* \
2027*56850988SCy Schubert	| its* \
2028*56850988SCy Schubert	| l4re* \
2029*56850988SCy Schubert	| libertybsd* \
2030*56850988SCy Schubert	| lites* \
2031*56850988SCy Schubert	| lnews* \
2032*56850988SCy Schubert	| luna* \
2033*56850988SCy Schubert	| lynxos* \
2034*56850988SCy Schubert	| mach* \
2035*56850988SCy Schubert	| macos* \
2036*56850988SCy Schubert	| magic* \
2037*56850988SCy Schubert	| mbr* \
2038*56850988SCy Schubert	| midipix* \
2039*56850988SCy Schubert	| midnightbsd* \
2040*56850988SCy Schubert	| mingw32* \
2041*56850988SCy Schubert	| mingw64* \
2042*56850988SCy Schubert	| minix* \
2043*56850988SCy Schubert	| mint* \
2044*56850988SCy Schubert	| mirbsd* \
2045*56850988SCy Schubert	| mks* \
2046*56850988SCy Schubert	| mlibc* \
2047*56850988SCy Schubert	| mmixware* \
2048*56850988SCy Schubert	| mon960* \
2049*56850988SCy Schubert	| morphos* \
2050*56850988SCy Schubert	| moss* \
2051*56850988SCy Schubert	| moxiebox* \
2052*56850988SCy Schubert	| mpeix* \
2053*56850988SCy Schubert	| mpw* \
2054*56850988SCy Schubert	| msdos* \
2055*56850988SCy Schubert	| msys* \
2056*56850988SCy Schubert	| mvs* \
2057*56850988SCy Schubert	| nacl* \
2058*56850988SCy Schubert	| netbsd* \
2059*56850988SCy Schubert	| netware* \
2060*56850988SCy Schubert	| newsos* \
2061*56850988SCy Schubert	| nextstep* \
2062*56850988SCy Schubert	| nindy* \
2063*56850988SCy Schubert	| nonstopux* \
2064*56850988SCy Schubert	| nova* \
2065*56850988SCy Schubert	| nsk* \
2066*56850988SCy Schubert	| nucleus* \
2067*56850988SCy Schubert	| nx6 \
2068*56850988SCy Schubert	| nx7 \
2069*56850988SCy Schubert	| oabi* \
2070*56850988SCy Schubert	| ohos* \
2071*56850988SCy Schubert	| onefs* \
2072*56850988SCy Schubert	| openbsd* \
2073*56850988SCy Schubert	| openedition* \
2074*56850988SCy Schubert	| openstep* \
2075*56850988SCy Schubert	| os108* \
2076*56850988SCy Schubert	| os2* \
2077*56850988SCy Schubert	| os400* \
2078*56850988SCy Schubert	| os68k* \
2079*56850988SCy Schubert	| os9* \
2080*56850988SCy Schubert	| ose* \
2081*56850988SCy Schubert	| osf* \
2082*56850988SCy Schubert	| oskit* \
2083*56850988SCy Schubert	| osx* \
2084*56850988SCy Schubert	| palmos* \
2085*56850988SCy Schubert	| phoenix* \
2086*56850988SCy Schubert	| plan9* \
2087*56850988SCy Schubert	| powermax* \
2088*56850988SCy Schubert	| powerunix* \
2089*56850988SCy Schubert	| proelf* \
2090*56850988SCy Schubert	| psos* \
2091*56850988SCy Schubert	| psp* \
2092*56850988SCy Schubert	| ptx* \
2093*56850988SCy Schubert	| pw32* \
2094*56850988SCy Schubert	| qnx* \
2095*56850988SCy Schubert	| rdos* \
2096*56850988SCy Schubert	| redox* \
2097*56850988SCy Schubert	| rhapsody* \
2098*56850988SCy Schubert	| riscix* \
2099*56850988SCy Schubert	| riscos* \
2100*56850988SCy Schubert	| rtems* \
2101*56850988SCy Schubert	| rtmk* \
2102*56850988SCy Schubert	| rtu* \
2103*56850988SCy Schubert	| scout* \
2104*56850988SCy Schubert	| secbsd* \
2105*56850988SCy Schubert	| sei* \
2106*56850988SCy Schubert	| serenity* \
2107*56850988SCy Schubert	| sim* \
2108*56850988SCy Schubert	| skyos* \
2109*56850988SCy Schubert	| solaris* \
2110*56850988SCy Schubert	| solidbsd* \
2111*56850988SCy Schubert	| sortix* \
2112*56850988SCy Schubert	| storm-chaos* \
2113*56850988SCy Schubert	| sunos \
2114*56850988SCy Schubert	| sunos[34]* \
2115*56850988SCy Schubert	| superux* \
2116*56850988SCy Schubert	| syllable* \
2117*56850988SCy Schubert	| sym* \
2118*56850988SCy Schubert	| sysv* \
2119*56850988SCy Schubert	| tenex* \
2120*56850988SCy Schubert	| tirtos* \
2121*56850988SCy Schubert	| toppers* \
2122*56850988SCy Schubert	| tops10* \
2123*56850988SCy Schubert	| tops20* \
2124*56850988SCy Schubert	| tpf* \
2125*56850988SCy Schubert	| tvos* \
2126*56850988SCy Schubert	| twizzler* \
2127*56850988SCy Schubert	| uclinux* \
2128*56850988SCy Schubert	| udi* \
2129*56850988SCy Schubert	| udk* \
2130*56850988SCy Schubert	| ultrix* \
2131*56850988SCy Schubert	| unicos* \
2132*56850988SCy Schubert	| uniplus* \
2133*56850988SCy Schubert	| unleashed* \
2134*56850988SCy Schubert	| unos* \
2135*56850988SCy Schubert	| uwin* \
2136*56850988SCy Schubert	| uxpv* \
2137*56850988SCy Schubert	| v88r* \
2138*56850988SCy Schubert	|*vms* \
2139*56850988SCy Schubert	| vos* \
2140*56850988SCy Schubert	| vsta* \
2141*56850988SCy Schubert	| vxsim* \
2142*56850988SCy Schubert	| vxworks* \
2143*56850988SCy Schubert	| wasi* \
2144*56850988SCy Schubert	| watchos* \
2145*56850988SCy Schubert	| wince* \
2146*56850988SCy Schubert	| windiss* \
2147*56850988SCy Schubert	| windows* \
2148*56850988SCy Schubert	| winnt* \
2149*56850988SCy Schubert	| xenix* \
2150*56850988SCy Schubert	| xray* \
2151*56850988SCy Schubert	| zephyr* \
2152*56850988SCy Schubert	| zvmoe* )
215325039b37SCy Schubert		;;
215425039b37SCy Schubert	# This one is extra strict with allowed versions
215525039b37SCy Schubert	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
215625039b37SCy Schubert		# Don't forget version if it is 3.2v4 or newer.
215725039b37SCy Schubert		;;
2158b76ef9a7SCy Schubert	# This refers to builds using the UEFI calling convention
2159b76ef9a7SCy Schubert	# (which depends on the architecture) and PE file format.
2160b76ef9a7SCy Schubert	# Note that this is both a different calling convention and
2161b76ef9a7SCy Schubert	# different file format than that of GNU-EFI
2162b76ef9a7SCy Schubert	# (x86_64-w64-mingw32).
2163b76ef9a7SCy Schubert	uefi)
2164b76ef9a7SCy Schubert		;;
216525039b37SCy Schubert	none)
216625039b37SCy Schubert		;;
21678f76bb7dSCy Schubert	kernel* | msvc* )
2168865f46b2SCy Schubert		# Restricted further below
2169865f46b2SCy Schubert		;;
2170103ba509SCy Schubert	'')
2171103ba509SCy Schubert		if test x"$obj" = x
2172103ba509SCy Schubert		then
2173103ba509SCy Schubert			echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
2174103ba509SCy Schubert		fi
2175103ba509SCy Schubert		;;
217625039b37SCy Schubert	*)
21778f76bb7dSCy Schubert		echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
217825039b37SCy Schubert		exit 1
217925039b37SCy Schubert		;;
218025039b37SCy Schubertesac
218125039b37SCy Schubert
2182103ba509SCy Schubertcase $obj in
2183103ba509SCy Schubert	aout* | coff* | elf* | pe*)
2184103ba509SCy Schubert		;;
2185103ba509SCy Schubert	'')
2186103ba509SCy Schubert		# empty is fine
2187103ba509SCy Schubert		;;
2188103ba509SCy Schubert	*)
2189103ba509SCy Schubert		echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
2190103ba509SCy Schubert		exit 1
2191103ba509SCy Schubert		;;
2192103ba509SCy Schubertesac
2193103ba509SCy Schubert
2194103ba509SCy Schubert# Here we handle the constraint that a (synthetic) cpu and os are
2195103ba509SCy Schubert# valid only in combination with each other and nowhere else.
2196103ba509SCy Schubertcase $cpu-$os in
2197103ba509SCy Schubert	# The "javascript-unknown-ghcjs" triple is used by GHC; we
2198103ba509SCy Schubert	# accept it here in order to tolerate that, but reject any
2199103ba509SCy Schubert	# variations.
2200103ba509SCy Schubert	javascript-ghcjs)
2201103ba509SCy Schubert		;;
2202103ba509SCy Schubert	javascript-* | *-ghcjs)
2203103ba509SCy Schubert		echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
2204103ba509SCy Schubert		exit 1
2205103ba509SCy Schubert		;;
2206103ba509SCy Schubertesac
2207103ba509SCy Schubert
220825039b37SCy Schubert# As a final step for OS-related things, validate the OS-kernel combination
220925039b37SCy Schubert# (given a valid OS), if there is a kernel.
2210103ba509SCy Schubertcase $kernel-$os-$obj in
2211b76ef9a7SCy Schubert	linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \
2212b76ef9a7SCy Schubert		    | linux-mlibc*- | linux-musl*- | linux-newlib*- \
2213*56850988SCy Schubert		    | linux-relibc*- | linux-uclibc*- | linux-ohos*- )
221425039b37SCy Schubert		;;
2215*56850988SCy Schubert	uclinux-uclibc*- | uclinux-gnu*- )
2216c0caa2e2SCy Schubert		;;
2217103ba509SCy Schubert	managarm-mlibc*- | managarm-kernel*- )
2218865f46b2SCy Schubert		;;
2219103ba509SCy Schubert	windows*-msvc*-)
22208f76bb7dSCy Schubert		;;
2221b76ef9a7SCy Schubert	-dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \
2222b76ef9a7SCy Schubert		    | -uclibc*- )
222325039b37SCy Schubert		# These are just libc implementations, not actual OSes, and thus
222425039b37SCy Schubert		# require a kernel.
22258f76bb7dSCy Schubert		echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
222625039b37SCy Schubert		exit 1
222725039b37SCy Schubert		;;
2228103ba509SCy Schubert	-kernel*- )
22298f76bb7dSCy Schubert		echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
2230865f46b2SCy Schubert		exit 1
2231865f46b2SCy Schubert		;;
2232103ba509SCy Schubert	*-kernel*- )
22338f76bb7dSCy Schubert		echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
22348f76bb7dSCy Schubert		exit 1
22358f76bb7dSCy Schubert		;;
2236103ba509SCy Schubert	*-msvc*- )
22378f76bb7dSCy Schubert		echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
2238865f46b2SCy Schubert		exit 1
2239865f46b2SCy Schubert		;;
2240*56850988SCy Schubert	kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-)
224125039b37SCy Schubert		;;
2242103ba509SCy Schubert	vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
2243f44e67d1SCy Schubert		;;
2244103ba509SCy Schubert	nto-qnx*-)
224525039b37SCy Schubert		;;
2246103ba509SCy Schubert	os2-emx-)
2247369c6923SCy Schubert		;;
2248*56850988SCy Schubert	rtmk-nova-)
2249*56850988SCy Schubert		;;
2250103ba509SCy Schubert	*-eabi*- | *-gnueabi*-)
225125039b37SCy Schubert		;;
2252103ba509SCy Schubert	none--*)
22538f76bb7dSCy Schubert		# None (no kernel, i.e. freestanding / bare metal),
2254103ba509SCy Schubert		# can be paired with an machine code file format
22558f76bb7dSCy Schubert		;;
2256103ba509SCy Schubert	-*-)
225725039b37SCy Schubert		# Blank kernel with real OS is always fine.
225825039b37SCy Schubert		;;
2259103ba509SCy Schubert	--*)
2260103ba509SCy Schubert		# Blank kernel and OS with real machine code file format is always fine.
2261103ba509SCy Schubert		;;
2262103ba509SCy Schubert	*-*-*)
22638f76bb7dSCy Schubert		echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
226425039b37SCy Schubert		exit 1
226525039b37SCy Schubert		;;
226625039b37SCy Schubertesac
226725039b37SCy Schubert
2268b7579f77SDag-Erling Smørgrav# Here we handle the case where we know the os, and the CPU type, but not the
2269b7579f77SDag-Erling Smørgrav# manufacturer.  We pick the logical manufacturer.
227025039b37SCy Schubertcase $vendor in
227125039b37SCy Schubert	unknown)
227225039b37SCy Schubert		case $cpu-$os in
227325039b37SCy Schubert			*-riscix*)
2274b7579f77SDag-Erling Smørgrav				vendor=acorn
2275b7579f77SDag-Erling Smørgrav				;;
2276*56850988SCy Schubert			*-sunos* | *-solaris*)
2277b7579f77SDag-Erling Smørgrav				vendor=sun
2278b7579f77SDag-Erling Smørgrav				;;
227925039b37SCy Schubert			*-cnk* | *-aix*)
2280b7579f77SDag-Erling Smørgrav				vendor=ibm
2281b7579f77SDag-Erling Smørgrav				;;
228225039b37SCy Schubert			*-beos*)
2283b7579f77SDag-Erling Smørgrav				vendor=be
2284b7579f77SDag-Erling Smørgrav				;;
228525039b37SCy Schubert			*-hpux*)
2286b7579f77SDag-Erling Smørgrav				vendor=hp
2287b7579f77SDag-Erling Smørgrav				;;
228825039b37SCy Schubert			*-mpeix*)
2289b7579f77SDag-Erling Smørgrav				vendor=hp
2290b7579f77SDag-Erling Smørgrav				;;
229125039b37SCy Schubert			*-hiux*)
2292b7579f77SDag-Erling Smørgrav				vendor=hitachi
2293b7579f77SDag-Erling Smørgrav				;;
229425039b37SCy Schubert			*-unos*)
2295b7579f77SDag-Erling Smørgrav				vendor=crds
2296b7579f77SDag-Erling Smørgrav				;;
229725039b37SCy Schubert			*-dgux*)
2298b7579f77SDag-Erling Smørgrav				vendor=dg
2299b7579f77SDag-Erling Smørgrav				;;
230025039b37SCy Schubert			*-luna*)
2301b7579f77SDag-Erling Smørgrav				vendor=omron
2302b7579f77SDag-Erling Smørgrav				;;
230325039b37SCy Schubert			*-genix*)
2304b7579f77SDag-Erling Smørgrav				vendor=ns
2305b7579f77SDag-Erling Smørgrav				;;
230625039b37SCy Schubert			*-clix*)
230725039b37SCy Schubert				vendor=intergraph
230825039b37SCy Schubert				;;
230925039b37SCy Schubert			*-mvs* | *-opened*)
2310b7579f77SDag-Erling Smørgrav				vendor=ibm
2311b7579f77SDag-Erling Smørgrav				;;
231225039b37SCy Schubert			*-os400*)
2313b7579f77SDag-Erling Smørgrav				vendor=ibm
2314b7579f77SDag-Erling Smørgrav				;;
231525039b37SCy Schubert			s390-* | s390x-*)
231625039b37SCy Schubert				vendor=ibm
231725039b37SCy Schubert				;;
231825039b37SCy Schubert			*-ptx*)
2319b7579f77SDag-Erling Smørgrav				vendor=sequent
2320b7579f77SDag-Erling Smørgrav				;;
232125039b37SCy Schubert			*-tpf*)
2322b7579f77SDag-Erling Smørgrav				vendor=ibm
2323b7579f77SDag-Erling Smørgrav				;;
232425039b37SCy Schubert			*-vxsim* | *-vxworks* | *-windiss*)
2325b7579f77SDag-Erling Smørgrav				vendor=wrs
2326b7579f77SDag-Erling Smørgrav				;;
232725039b37SCy Schubert			*-aux*)
2328b7579f77SDag-Erling Smørgrav				vendor=apple
2329b7579f77SDag-Erling Smørgrav				;;
233025039b37SCy Schubert			*-hms*)
2331b7579f77SDag-Erling Smørgrav				vendor=hitachi
2332b7579f77SDag-Erling Smørgrav				;;
233325039b37SCy Schubert			*-mpw* | *-macos*)
2334b7579f77SDag-Erling Smørgrav				vendor=apple
2335b7579f77SDag-Erling Smørgrav				;;
233625039b37SCy Schubert			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
2337b7579f77SDag-Erling Smørgrav				vendor=atari
2338b7579f77SDag-Erling Smørgrav				;;
233925039b37SCy Schubert			*-vos*)
2340b7579f77SDag-Erling Smørgrav				vendor=stratus
2341b7579f77SDag-Erling Smørgrav				;;
2342b7579f77SDag-Erling Smørgrav		esac
2343b7579f77SDag-Erling Smørgrav		;;
2344b7579f77SDag-Erling Smørgravesac
2345b7579f77SDag-Erling Smørgrav
2346103ba509SCy Schubertecho "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
2347b7579f77SDag-Erling Smørgravexit
2348b7579f77SDag-Erling Smørgrav
2349b7579f77SDag-Erling Smørgrav# Local variables:
235025039b37SCy Schubert# eval: (add-hook 'before-save-hook 'time-stamp)
2351b7579f77SDag-Erling Smørgrav# time-stamp-start: "timestamp='"
2352b7579f77SDag-Erling Smørgrav# time-stamp-format: "%:y-%02m-%02d"
2353b7579f77SDag-Erling Smørgrav# time-stamp-end: "'"
2354b7579f77SDag-Erling Smørgrav# End:
2355