xref: /freebsd/contrib/sqlite3/config.sub (revision 70b56f4b92877578741e5aba2a72d6088cb13ecb)
1937a2000SPeter Wemm#! /bin/sh
2937a2000SPeter Wemm# Configuration validation subroutine script.
3*70b56f4bSCy Schubert#   Copyright 1992-2022 Free Software Foundation, Inc.
4937a2000SPeter Wemm
5*70b56f4bSCy Schubert# shellcheck disable=SC2006,SC2268 # see below for rationale
6*70b56f4bSCy Schubert
7*70b56f4bSCy Schuberttimestamp='2022-01-03'
8937a2000SPeter Wemm
9d915215eSBaptiste Daroussin# This file is free software; you can redistribute it and/or modify it
10d915215eSBaptiste Daroussin# under the terms of the GNU General Public License as published by
11*70b56f4bSCy Schubert# the Free Software Foundation, either version 3 of the License, or
12937a2000SPeter Wemm# (at your option) any later version.
13937a2000SPeter Wemm#
14d915215eSBaptiste Daroussin# This program is distributed in the hope that it will be useful, but
15d915215eSBaptiste Daroussin# WITHOUT ANY WARRANTY; without even the implied warranty of
16d915215eSBaptiste Daroussin# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17d915215eSBaptiste Daroussin# General Public License for more details.
18937a2000SPeter Wemm#
19937a2000SPeter Wemm# You should have received a copy of the GNU General Public License
20bca4681bSCy Schubert# along with this program; if not, see <https://www.gnu.org/licenses/>.
21937a2000SPeter Wemm#
22937a2000SPeter Wemm# As a special exception to the GNU General Public License, if you
23937a2000SPeter Wemm# distribute this file as part of a program that contains a
24937a2000SPeter Wemm# configuration script generated by Autoconf, you may include it under
25d915215eSBaptiste Daroussin# the same distribution terms that you use for the rest of that
26d915215eSBaptiste Daroussin# program.  This Exception is an additional permission under section 7
27d915215eSBaptiste Daroussin# of the GNU General Public License, version 3 ("GPLv3").
28937a2000SPeter Wemm
29937a2000SPeter Wemm
30d915215eSBaptiste Daroussin# Please send patches to <config-patches@gnu.org>.
31937a2000SPeter Wemm#
32937a2000SPeter Wemm# Configuration subroutine to validate and canonicalize a configuration type.
33937a2000SPeter Wemm# Supply the specified configuration type as an argument.
34937a2000SPeter Wemm# If it is invalid, we print an error message on stderr and exit with code 1.
35937a2000SPeter Wemm# Otherwise, we print the canonical config type on stdout and succeed.
36937a2000SPeter Wemm
378bc5c7c0SPeter Wemm# You can get the latest version of this script from:
38*70b56f4bSCy Schubert# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
398bc5c7c0SPeter Wemm
40937a2000SPeter Wemm# This file is supposed to be the same for all GNU packages
41937a2000SPeter Wemm# and recognize all the CPU types, system types and aliases
42937a2000SPeter Wemm# that are meaningful with *any* GNU software.
43937a2000SPeter Wemm# Each package is responsible for reporting which valid configurations
44937a2000SPeter Wemm# it does not support.  The user should be able to distinguish
45937a2000SPeter Wemm# a failure to support a valid configuration from a meaningless
46937a2000SPeter Wemm# configuration.
47937a2000SPeter Wemm
48937a2000SPeter Wemm# The goal of this file is to map all the various variations of a given
49937a2000SPeter Wemm# machine specification into a single specification in the form:
50937a2000SPeter Wemm#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
51937a2000SPeter Wemm# or in some cases, the newer four-part form:
52937a2000SPeter Wemm#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
53937a2000SPeter Wemm# It is wrong to echo any other type of specification.
54937a2000SPeter Wemm
55*70b56f4bSCy Schubert# The "shellcheck disable" line above the timestamp inhibits complaints
56*70b56f4bSCy Schubert# about features and limitations of the classic Bourne shell that were
57*70b56f4bSCy Schubert# superseded or lifted in POSIX.  However, this script identifies a wide
58*70b56f4bSCy Schubert# variety of pre-POSIX systems that do not have POSIX shells at all, and
59*70b56f4bSCy Schubert# even some reasonably current systems (Solaris 10 as case-in-point) still
60*70b56f4bSCy Schubert# have a pre-POSIX /bin/sh.
61*70b56f4bSCy Schubert
62937a2000SPeter Wemmme=`echo "$0" | sed -e 's,.*/,,'`
63937a2000SPeter Wemm
64937a2000SPeter Wemmusage="\
65bca4681bSCy SchubertUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
66937a2000SPeter Wemm
67937a2000SPeter WemmCanonicalize a configuration name.
68937a2000SPeter Wemm
69bca4681bSCy SchubertOptions:
70937a2000SPeter Wemm  -h, --help         print this help, then exit
71937a2000SPeter Wemm  -t, --time-stamp   print date of last modification, then exit
72937a2000SPeter Wemm  -v, --version      print version number, then exit
73937a2000SPeter Wemm
74937a2000SPeter WemmReport bugs and patches to <config-patches@gnu.org>."
75937a2000SPeter Wemm
76937a2000SPeter Wemmversion="\
77937a2000SPeter WemmGNU config.sub ($timestamp)
78937a2000SPeter Wemm
79*70b56f4bSCy SchubertCopyright 1992-2022 Free Software Foundation, Inc.
80937a2000SPeter Wemm
81937a2000SPeter WemmThis is free software; see the source for copying conditions.  There is NO
82937a2000SPeter Wemmwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83937a2000SPeter Wemm
84937a2000SPeter Wemmhelp="
85937a2000SPeter WemmTry \`$me --help' for more information."
86937a2000SPeter Wemm
87937a2000SPeter Wemm# Parse command line
88937a2000SPeter Wemmwhile test $# -gt 0 ; do
89937a2000SPeter Wemm  case $1 in
90937a2000SPeter Wemm    --time-stamp | --time* | -t )
91937a2000SPeter Wemm       echo "$timestamp" ; exit ;;
92937a2000SPeter Wemm    --version | -v )
93937a2000SPeter Wemm       echo "$version" ; exit ;;
94937a2000SPeter Wemm    --help | --h* | -h )
95937a2000SPeter Wemm       echo "$usage"; exit ;;
96937a2000SPeter Wemm    -- )     # Stop option processing
97937a2000SPeter Wemm       shift; break ;;
98937a2000SPeter Wemm    - )	# Use stdin as input.
99937a2000SPeter Wemm       break ;;
100937a2000SPeter Wemm    -* )
101*70b56f4bSCy Schubert       echo "$me: invalid option $1$help" >&2
102937a2000SPeter Wemm       exit 1 ;;
103937a2000SPeter Wemm
104937a2000SPeter Wemm    *local*)
105937a2000SPeter Wemm       # First pass through any local machine types.
106bca4681bSCy Schubert       echo "$1"
107937a2000SPeter Wemm       exit ;;
108937a2000SPeter Wemm
109937a2000SPeter Wemm    * )
110937a2000SPeter Wemm       break ;;
111937a2000SPeter Wemm  esac
112937a2000SPeter Wemmdone
113937a2000SPeter Wemm
114937a2000SPeter Wemmcase $# in
115937a2000SPeter Wemm 0) echo "$me: missing argument$help" >&2
116937a2000SPeter Wemm    exit 1;;
117937a2000SPeter Wemm 1) ;;
118937a2000SPeter Wemm *) echo "$me: too many arguments$help" >&2
119937a2000SPeter Wemm    exit 1;;
120937a2000SPeter Wemmesac
121937a2000SPeter Wemm
122*70b56f4bSCy Schubert# Split fields of configuration type
123*70b56f4bSCy Schubert# shellcheck disable=SC2162
124*70b56f4bSCy Schubertsaved_IFS=$IFS
125*70b56f4bSCy SchubertIFS="-" read field1 field2 field3 field4 <<EOF
126*70b56f4bSCy Schubert$1
127*70b56f4bSCy SchubertEOF
128*70b56f4bSCy SchubertIFS=$saved_IFS
129*70b56f4bSCy Schubert
130*70b56f4bSCy Schubert# Separate into logical components for further validation
131*70b56f4bSCy Schubertcase $1 in
132*70b56f4bSCy Schubert	*-*-*-*-*)
133*70b56f4bSCy Schubert		echo Invalid configuration \`"$1"\': more than four components >&2
134*70b56f4bSCy Schubert		exit 1
135*70b56f4bSCy Schubert		;;
136*70b56f4bSCy Schubert	*-*-*-*)
137*70b56f4bSCy Schubert		basic_machine=$field1-$field2
138*70b56f4bSCy Schubert		basic_os=$field3-$field4
139*70b56f4bSCy Schubert		;;
140*70b56f4bSCy Schubert	*-*-*)
141*70b56f4bSCy Schubert		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
142*70b56f4bSCy Schubert		# parts
143*70b56f4bSCy Schubert		maybe_os=$field2-$field3
144937a2000SPeter Wemm		case $maybe_os in
145*70b56f4bSCy Schubert			nto-qnx* | linux-* | uclinux-uclibc* \
146*70b56f4bSCy Schubert			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
147*70b56f4bSCy Schubert			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
148*70b56f4bSCy Schubert			| storm-chaos* | os2-emx* | rtmk-nova*)
149*70b56f4bSCy Schubert				basic_machine=$field1
150*70b56f4bSCy Schubert				basic_os=$maybe_os
151937a2000SPeter Wemm				;;
1528bc5c7c0SPeter Wemm			android-linux)
153*70b56f4bSCy Schubert				basic_machine=$field1-unknown
154*70b56f4bSCy Schubert				basic_os=linux-android
1558bc5c7c0SPeter Wemm				;;
156937a2000SPeter Wemm			*)
157*70b56f4bSCy Schubert				basic_machine=$field1-$field2
158*70b56f4bSCy Schubert				basic_os=$field3
159*70b56f4bSCy Schubert				;;
160*70b56f4bSCy Schubert		esac
161*70b56f4bSCy Schubert		;;
162*70b56f4bSCy Schubert	*-*)
163*70b56f4bSCy Schubert		# A lone config we happen to match not fitting any pattern
164*70b56f4bSCy Schubert		case $field1-$field2 in
165*70b56f4bSCy Schubert			decstation-3100)
166*70b56f4bSCy Schubert				basic_machine=mips-dec
167*70b56f4bSCy Schubert				basic_os=
168*70b56f4bSCy Schubert				;;
169*70b56f4bSCy Schubert			*-*)
170*70b56f4bSCy Schubert				# Second component is usually, but not always the OS
171*70b56f4bSCy Schubert				case $field2 in
172*70b56f4bSCy Schubert					# Prevent following clause from handling this valid os
173*70b56f4bSCy Schubert					sun*os*)
174*70b56f4bSCy Schubert						basic_machine=$field1
175*70b56f4bSCy Schubert						basic_os=$field2
176*70b56f4bSCy Schubert						;;
177*70b56f4bSCy Schubert					zephyr*)
178*70b56f4bSCy Schubert						basic_machine=$field1-unknown
179*70b56f4bSCy Schubert						basic_os=$field2
180*70b56f4bSCy Schubert						;;
181*70b56f4bSCy Schubert					# Manufacturers
182*70b56f4bSCy Schubert					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
183*70b56f4bSCy Schubert					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
184*70b56f4bSCy Schubert					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
185*70b56f4bSCy Schubert					| convergent* | ncr* | news | 32* | 3600* | 3100* \
186*70b56f4bSCy Schubert					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
187*70b56f4bSCy Schubert					| ultra | tti* | harris | dolphin | highlevel | gould \
188*70b56f4bSCy Schubert					| cbm | ns | masscomp | apple | axis | knuth | cray \
189*70b56f4bSCy Schubert					| microblaze* | sim | cisco \
190*70b56f4bSCy Schubert					| oki | wec | wrs | winbond)
191*70b56f4bSCy Schubert						basic_machine=$field1-$field2
192*70b56f4bSCy Schubert						basic_os=
193*70b56f4bSCy Schubert						;;
194*70b56f4bSCy Schubert					*)
195*70b56f4bSCy Schubert						basic_machine=$field1
196*70b56f4bSCy Schubert						basic_os=$field2
197*70b56f4bSCy Schubert						;;
198*70b56f4bSCy Schubert				esac
199*70b56f4bSCy Schubert			;;
200*70b56f4bSCy Schubert		esac
201*70b56f4bSCy Schubert		;;
202*70b56f4bSCy Schubert	*)
203*70b56f4bSCy Schubert		# Convert single-component short-hands not valid as part of
204*70b56f4bSCy Schubert		# multi-component configurations.
205*70b56f4bSCy Schubert		case $field1 in
206*70b56f4bSCy Schubert			386bsd)
207*70b56f4bSCy Schubert				basic_machine=i386-pc
208*70b56f4bSCy Schubert				basic_os=bsd
209*70b56f4bSCy Schubert				;;
210*70b56f4bSCy Schubert			a29khif)
211*70b56f4bSCy Schubert				basic_machine=a29k-amd
212*70b56f4bSCy Schubert				basic_os=udi
213*70b56f4bSCy Schubert				;;
214*70b56f4bSCy Schubert			adobe68k)
215*70b56f4bSCy Schubert				basic_machine=m68010-adobe
216*70b56f4bSCy Schubert				basic_os=scout
217*70b56f4bSCy Schubert				;;
218*70b56f4bSCy Schubert			alliant)
219*70b56f4bSCy Schubert				basic_machine=fx80-alliant
220*70b56f4bSCy Schubert				basic_os=
221*70b56f4bSCy Schubert				;;
222*70b56f4bSCy Schubert			altos | altos3068)
223*70b56f4bSCy Schubert				basic_machine=m68k-altos
224*70b56f4bSCy Schubert				basic_os=
225*70b56f4bSCy Schubert				;;
226*70b56f4bSCy Schubert			am29k)
227*70b56f4bSCy Schubert				basic_machine=a29k-none
228*70b56f4bSCy Schubert				basic_os=bsd
229*70b56f4bSCy Schubert				;;
230*70b56f4bSCy Schubert			amdahl)
231*70b56f4bSCy Schubert				basic_machine=580-amdahl
232*70b56f4bSCy Schubert				basic_os=sysv
233*70b56f4bSCy Schubert				;;
234*70b56f4bSCy Schubert			amiga)
235*70b56f4bSCy Schubert				basic_machine=m68k-unknown
236*70b56f4bSCy Schubert				basic_os=
237*70b56f4bSCy Schubert				;;
238*70b56f4bSCy Schubert			amigaos | amigados)
239*70b56f4bSCy Schubert				basic_machine=m68k-unknown
240*70b56f4bSCy Schubert				basic_os=amigaos
241*70b56f4bSCy Schubert				;;
242*70b56f4bSCy Schubert			amigaunix | amix)
243*70b56f4bSCy Schubert				basic_machine=m68k-unknown
244*70b56f4bSCy Schubert				basic_os=sysv4
245*70b56f4bSCy Schubert				;;
246*70b56f4bSCy Schubert			apollo68)
247*70b56f4bSCy Schubert				basic_machine=m68k-apollo
248*70b56f4bSCy Schubert				basic_os=sysv
249*70b56f4bSCy Schubert				;;
250*70b56f4bSCy Schubert			apollo68bsd)
251*70b56f4bSCy Schubert				basic_machine=m68k-apollo
252*70b56f4bSCy Schubert				basic_os=bsd
253*70b56f4bSCy Schubert				;;
254*70b56f4bSCy Schubert			aros)
255*70b56f4bSCy Schubert				basic_machine=i386-pc
256*70b56f4bSCy Schubert				basic_os=aros
257*70b56f4bSCy Schubert				;;
258*70b56f4bSCy Schubert			aux)
259*70b56f4bSCy Schubert				basic_machine=m68k-apple
260*70b56f4bSCy Schubert				basic_os=aux
261*70b56f4bSCy Schubert				;;
262*70b56f4bSCy Schubert			balance)
263*70b56f4bSCy Schubert				basic_machine=ns32k-sequent
264*70b56f4bSCy Schubert				basic_os=dynix
265*70b56f4bSCy Schubert				;;
266*70b56f4bSCy Schubert			blackfin)
267*70b56f4bSCy Schubert				basic_machine=bfin-unknown
268*70b56f4bSCy Schubert				basic_os=linux
269*70b56f4bSCy Schubert				;;
270*70b56f4bSCy Schubert			cegcc)
271*70b56f4bSCy Schubert				basic_machine=arm-unknown
272*70b56f4bSCy Schubert				basic_os=cegcc
273*70b56f4bSCy Schubert				;;
274*70b56f4bSCy Schubert			convex-c1)
275*70b56f4bSCy Schubert				basic_machine=c1-convex
276*70b56f4bSCy Schubert				basic_os=bsd
277*70b56f4bSCy Schubert				;;
278*70b56f4bSCy Schubert			convex-c2)
279*70b56f4bSCy Schubert				basic_machine=c2-convex
280*70b56f4bSCy Schubert				basic_os=bsd
281*70b56f4bSCy Schubert				;;
282*70b56f4bSCy Schubert			convex-c32)
283*70b56f4bSCy Schubert				basic_machine=c32-convex
284*70b56f4bSCy Schubert				basic_os=bsd
285*70b56f4bSCy Schubert				;;
286*70b56f4bSCy Schubert			convex-c34)
287*70b56f4bSCy Schubert				basic_machine=c34-convex
288*70b56f4bSCy Schubert				basic_os=bsd
289*70b56f4bSCy Schubert				;;
290*70b56f4bSCy Schubert			convex-c38)
291*70b56f4bSCy Schubert				basic_machine=c38-convex
292*70b56f4bSCy Schubert				basic_os=bsd
293*70b56f4bSCy Schubert				;;
294*70b56f4bSCy Schubert			cray)
295*70b56f4bSCy Schubert				basic_machine=j90-cray
296*70b56f4bSCy Schubert				basic_os=unicos
297*70b56f4bSCy Schubert				;;
298*70b56f4bSCy Schubert			crds | unos)
299*70b56f4bSCy Schubert				basic_machine=m68k-crds
300*70b56f4bSCy Schubert				basic_os=
301*70b56f4bSCy Schubert				;;
302*70b56f4bSCy Schubert			da30)
303*70b56f4bSCy Schubert				basic_machine=m68k-da30
304*70b56f4bSCy Schubert				basic_os=
305*70b56f4bSCy Schubert				;;
306*70b56f4bSCy Schubert			decstation | pmax | pmin | dec3100 | decstatn)
307*70b56f4bSCy Schubert				basic_machine=mips-dec
308*70b56f4bSCy Schubert				basic_os=
309*70b56f4bSCy Schubert				;;
310*70b56f4bSCy Schubert			delta88)
311*70b56f4bSCy Schubert				basic_machine=m88k-motorola
312*70b56f4bSCy Schubert				basic_os=sysv3
313*70b56f4bSCy Schubert				;;
314*70b56f4bSCy Schubert			dicos)
315*70b56f4bSCy Schubert				basic_machine=i686-pc
316*70b56f4bSCy Schubert				basic_os=dicos
317*70b56f4bSCy Schubert				;;
318*70b56f4bSCy Schubert			djgpp)
319*70b56f4bSCy Schubert				basic_machine=i586-pc
320*70b56f4bSCy Schubert				basic_os=msdosdjgpp
321*70b56f4bSCy Schubert				;;
322*70b56f4bSCy Schubert			ebmon29k)
323*70b56f4bSCy Schubert				basic_machine=a29k-amd
324*70b56f4bSCy Schubert				basic_os=ebmon
325*70b56f4bSCy Schubert				;;
326*70b56f4bSCy Schubert			es1800 | OSE68k | ose68k | ose | OSE)
327*70b56f4bSCy Schubert				basic_machine=m68k-ericsson
328*70b56f4bSCy Schubert				basic_os=ose
329*70b56f4bSCy Schubert				;;
330*70b56f4bSCy Schubert			gmicro)
331*70b56f4bSCy Schubert				basic_machine=tron-gmicro
332*70b56f4bSCy Schubert				basic_os=sysv
333*70b56f4bSCy Schubert				;;
334*70b56f4bSCy Schubert			go32)
335*70b56f4bSCy Schubert				basic_machine=i386-pc
336*70b56f4bSCy Schubert				basic_os=go32
337*70b56f4bSCy Schubert				;;
338*70b56f4bSCy Schubert			h8300hms)
339*70b56f4bSCy Schubert				basic_machine=h8300-hitachi
340*70b56f4bSCy Schubert				basic_os=hms
341*70b56f4bSCy Schubert				;;
342*70b56f4bSCy Schubert			h8300xray)
343*70b56f4bSCy Schubert				basic_machine=h8300-hitachi
344*70b56f4bSCy Schubert				basic_os=xray
345*70b56f4bSCy Schubert				;;
346*70b56f4bSCy Schubert			h8500hms)
347*70b56f4bSCy Schubert				basic_machine=h8500-hitachi
348*70b56f4bSCy Schubert				basic_os=hms
349*70b56f4bSCy Schubert				;;
350*70b56f4bSCy Schubert			harris)
351*70b56f4bSCy Schubert				basic_machine=m88k-harris
352*70b56f4bSCy Schubert				basic_os=sysv3
353*70b56f4bSCy Schubert				;;
354*70b56f4bSCy Schubert			hp300 | hp300hpux)
355*70b56f4bSCy Schubert				basic_machine=m68k-hp
356*70b56f4bSCy Schubert				basic_os=hpux
357*70b56f4bSCy Schubert				;;
358*70b56f4bSCy Schubert			hp300bsd)
359*70b56f4bSCy Schubert				basic_machine=m68k-hp
360*70b56f4bSCy Schubert				basic_os=bsd
361*70b56f4bSCy Schubert				;;
362*70b56f4bSCy Schubert			hppaosf)
363*70b56f4bSCy Schubert				basic_machine=hppa1.1-hp
364*70b56f4bSCy Schubert				basic_os=osf
365*70b56f4bSCy Schubert				;;
366*70b56f4bSCy Schubert			hppro)
367*70b56f4bSCy Schubert				basic_machine=hppa1.1-hp
368*70b56f4bSCy Schubert				basic_os=proelf
369*70b56f4bSCy Schubert				;;
370*70b56f4bSCy Schubert			i386mach)
371*70b56f4bSCy Schubert				basic_machine=i386-mach
372*70b56f4bSCy Schubert				basic_os=mach
373*70b56f4bSCy Schubert				;;
374*70b56f4bSCy Schubert			isi68 | isi)
375*70b56f4bSCy Schubert				basic_machine=m68k-isi
376*70b56f4bSCy Schubert				basic_os=sysv
377*70b56f4bSCy Schubert				;;
378*70b56f4bSCy Schubert			m68knommu)
379*70b56f4bSCy Schubert				basic_machine=m68k-unknown
380*70b56f4bSCy Schubert				basic_os=linux
381*70b56f4bSCy Schubert				;;
382*70b56f4bSCy Schubert			magnum | m3230)
383*70b56f4bSCy Schubert				basic_machine=mips-mips
384*70b56f4bSCy Schubert				basic_os=sysv
385*70b56f4bSCy Schubert				;;
386*70b56f4bSCy Schubert			merlin)
387*70b56f4bSCy Schubert				basic_machine=ns32k-utek
388*70b56f4bSCy Schubert				basic_os=sysv
389*70b56f4bSCy Schubert				;;
390*70b56f4bSCy Schubert			mingw64)
391*70b56f4bSCy Schubert				basic_machine=x86_64-pc
392*70b56f4bSCy Schubert				basic_os=mingw64
393*70b56f4bSCy Schubert				;;
394*70b56f4bSCy Schubert			mingw32)
395*70b56f4bSCy Schubert				basic_machine=i686-pc
396*70b56f4bSCy Schubert				basic_os=mingw32
397*70b56f4bSCy Schubert				;;
398*70b56f4bSCy Schubert			mingw32ce)
399*70b56f4bSCy Schubert				basic_machine=arm-unknown
400*70b56f4bSCy Schubert				basic_os=mingw32ce
401*70b56f4bSCy Schubert				;;
402*70b56f4bSCy Schubert			monitor)
403*70b56f4bSCy Schubert				basic_machine=m68k-rom68k
404*70b56f4bSCy Schubert				basic_os=coff
405*70b56f4bSCy Schubert				;;
406*70b56f4bSCy Schubert			morphos)
407*70b56f4bSCy Schubert				basic_machine=powerpc-unknown
408*70b56f4bSCy Schubert				basic_os=morphos
409*70b56f4bSCy Schubert				;;
410*70b56f4bSCy Schubert			moxiebox)
411*70b56f4bSCy Schubert				basic_machine=moxie-unknown
412*70b56f4bSCy Schubert				basic_os=moxiebox
413*70b56f4bSCy Schubert				;;
414*70b56f4bSCy Schubert			msdos)
415*70b56f4bSCy Schubert				basic_machine=i386-pc
416*70b56f4bSCy Schubert				basic_os=msdos
417*70b56f4bSCy Schubert				;;
418*70b56f4bSCy Schubert			msys)
419*70b56f4bSCy Schubert				basic_machine=i686-pc
420*70b56f4bSCy Schubert				basic_os=msys
421*70b56f4bSCy Schubert				;;
422*70b56f4bSCy Schubert			mvs)
423*70b56f4bSCy Schubert				basic_machine=i370-ibm
424*70b56f4bSCy Schubert				basic_os=mvs
425*70b56f4bSCy Schubert				;;
426*70b56f4bSCy Schubert			nacl)
427*70b56f4bSCy Schubert				basic_machine=le32-unknown
428*70b56f4bSCy Schubert				basic_os=nacl
429*70b56f4bSCy Schubert				;;
430*70b56f4bSCy Schubert			ncr3000)
431*70b56f4bSCy Schubert				basic_machine=i486-ncr
432*70b56f4bSCy Schubert				basic_os=sysv4
433*70b56f4bSCy Schubert				;;
434*70b56f4bSCy Schubert			netbsd386)
435*70b56f4bSCy Schubert				basic_machine=i386-pc
436*70b56f4bSCy Schubert				basic_os=netbsd
437*70b56f4bSCy Schubert				;;
438*70b56f4bSCy Schubert			netwinder)
439*70b56f4bSCy Schubert				basic_machine=armv4l-rebel
440*70b56f4bSCy Schubert				basic_os=linux
441*70b56f4bSCy Schubert				;;
442*70b56f4bSCy Schubert			news | news700 | news800 | news900)
443*70b56f4bSCy Schubert				basic_machine=m68k-sony
444*70b56f4bSCy Schubert				basic_os=newsos
445*70b56f4bSCy Schubert				;;
446*70b56f4bSCy Schubert			news1000)
447*70b56f4bSCy Schubert				basic_machine=m68030-sony
448*70b56f4bSCy Schubert				basic_os=newsos
449*70b56f4bSCy Schubert				;;
450*70b56f4bSCy Schubert			necv70)
451*70b56f4bSCy Schubert				basic_machine=v70-nec
452*70b56f4bSCy Schubert				basic_os=sysv
453*70b56f4bSCy Schubert				;;
454*70b56f4bSCy Schubert			nh3000)
455*70b56f4bSCy Schubert				basic_machine=m68k-harris
456*70b56f4bSCy Schubert				basic_os=cxux
457*70b56f4bSCy Schubert				;;
458*70b56f4bSCy Schubert			nh[45]000)
459*70b56f4bSCy Schubert				basic_machine=m88k-harris
460*70b56f4bSCy Schubert				basic_os=cxux
461*70b56f4bSCy Schubert				;;
462*70b56f4bSCy Schubert			nindy960)
463*70b56f4bSCy Schubert				basic_machine=i960-intel
464*70b56f4bSCy Schubert				basic_os=nindy
465*70b56f4bSCy Schubert				;;
466*70b56f4bSCy Schubert			mon960)
467*70b56f4bSCy Schubert				basic_machine=i960-intel
468*70b56f4bSCy Schubert				basic_os=mon960
469*70b56f4bSCy Schubert				;;
470*70b56f4bSCy Schubert			nonstopux)
471*70b56f4bSCy Schubert				basic_machine=mips-compaq
472*70b56f4bSCy Schubert				basic_os=nonstopux
473*70b56f4bSCy Schubert				;;
474*70b56f4bSCy Schubert			os400)
475*70b56f4bSCy Schubert				basic_machine=powerpc-ibm
476*70b56f4bSCy Schubert				basic_os=os400
477*70b56f4bSCy Schubert				;;
478*70b56f4bSCy Schubert			OSE68000 | ose68000)
479*70b56f4bSCy Schubert				basic_machine=m68000-ericsson
480*70b56f4bSCy Schubert				basic_os=ose
481*70b56f4bSCy Schubert				;;
482*70b56f4bSCy Schubert			os68k)
483*70b56f4bSCy Schubert				basic_machine=m68k-none
484*70b56f4bSCy Schubert				basic_os=os68k
485*70b56f4bSCy Schubert				;;
486*70b56f4bSCy Schubert			paragon)
487*70b56f4bSCy Schubert				basic_machine=i860-intel
488*70b56f4bSCy Schubert				basic_os=osf
489*70b56f4bSCy Schubert				;;
490*70b56f4bSCy Schubert			parisc)
491*70b56f4bSCy Schubert				basic_machine=hppa-unknown
492*70b56f4bSCy Schubert				basic_os=linux
493*70b56f4bSCy Schubert				;;
494*70b56f4bSCy Schubert			psp)
495*70b56f4bSCy Schubert				basic_machine=mipsallegrexel-sony
496*70b56f4bSCy Schubert				basic_os=psp
497*70b56f4bSCy Schubert				;;
498*70b56f4bSCy Schubert			pw32)
499*70b56f4bSCy Schubert				basic_machine=i586-unknown
500*70b56f4bSCy Schubert				basic_os=pw32
501*70b56f4bSCy Schubert				;;
502*70b56f4bSCy Schubert			rdos | rdos64)
503*70b56f4bSCy Schubert				basic_machine=x86_64-pc
504*70b56f4bSCy Schubert				basic_os=rdos
505*70b56f4bSCy Schubert				;;
506*70b56f4bSCy Schubert			rdos32)
507*70b56f4bSCy Schubert				basic_machine=i386-pc
508*70b56f4bSCy Schubert				basic_os=rdos
509*70b56f4bSCy Schubert				;;
510*70b56f4bSCy Schubert			rom68k)
511*70b56f4bSCy Schubert				basic_machine=m68k-rom68k
512*70b56f4bSCy Schubert				basic_os=coff
513*70b56f4bSCy Schubert				;;
514*70b56f4bSCy Schubert			sa29200)
515*70b56f4bSCy Schubert				basic_machine=a29k-amd
516*70b56f4bSCy Schubert				basic_os=udi
517*70b56f4bSCy Schubert				;;
518*70b56f4bSCy Schubert			sei)
519*70b56f4bSCy Schubert				basic_machine=mips-sei
520*70b56f4bSCy Schubert				basic_os=seiux
521*70b56f4bSCy Schubert				;;
522*70b56f4bSCy Schubert			sequent)
523*70b56f4bSCy Schubert				basic_machine=i386-sequent
524*70b56f4bSCy Schubert				basic_os=
525*70b56f4bSCy Schubert				;;
526*70b56f4bSCy Schubert			sps7)
527*70b56f4bSCy Schubert				basic_machine=m68k-bull
528*70b56f4bSCy Schubert				basic_os=sysv2
529*70b56f4bSCy Schubert				;;
530*70b56f4bSCy Schubert			st2000)
531*70b56f4bSCy Schubert				basic_machine=m68k-tandem
532*70b56f4bSCy Schubert				basic_os=
533*70b56f4bSCy Schubert				;;
534*70b56f4bSCy Schubert			stratus)
535*70b56f4bSCy Schubert				basic_machine=i860-stratus
536*70b56f4bSCy Schubert				basic_os=sysv4
537*70b56f4bSCy Schubert				;;
538*70b56f4bSCy Schubert			sun2)
539*70b56f4bSCy Schubert				basic_machine=m68000-sun
540*70b56f4bSCy Schubert				basic_os=
541*70b56f4bSCy Schubert				;;
542*70b56f4bSCy Schubert			sun2os3)
543*70b56f4bSCy Schubert				basic_machine=m68000-sun
544*70b56f4bSCy Schubert				basic_os=sunos3
545*70b56f4bSCy Schubert				;;
546*70b56f4bSCy Schubert			sun2os4)
547*70b56f4bSCy Schubert				basic_machine=m68000-sun
548*70b56f4bSCy Schubert				basic_os=sunos4
549*70b56f4bSCy Schubert				;;
550*70b56f4bSCy Schubert			sun3)
551*70b56f4bSCy Schubert				basic_machine=m68k-sun
552*70b56f4bSCy Schubert				basic_os=
553*70b56f4bSCy Schubert				;;
554*70b56f4bSCy Schubert			sun3os3)
555*70b56f4bSCy Schubert				basic_machine=m68k-sun
556*70b56f4bSCy Schubert				basic_os=sunos3
557*70b56f4bSCy Schubert				;;
558*70b56f4bSCy Schubert			sun3os4)
559*70b56f4bSCy Schubert				basic_machine=m68k-sun
560*70b56f4bSCy Schubert				basic_os=sunos4
561*70b56f4bSCy Schubert				;;
562*70b56f4bSCy Schubert			sun4)
563*70b56f4bSCy Schubert				basic_machine=sparc-sun
564*70b56f4bSCy Schubert				basic_os=
565*70b56f4bSCy Schubert				;;
566*70b56f4bSCy Schubert			sun4os3)
567*70b56f4bSCy Schubert				basic_machine=sparc-sun
568*70b56f4bSCy Schubert				basic_os=sunos3
569*70b56f4bSCy Schubert				;;
570*70b56f4bSCy Schubert			sun4os4)
571*70b56f4bSCy Schubert				basic_machine=sparc-sun
572*70b56f4bSCy Schubert				basic_os=sunos4
573*70b56f4bSCy Schubert				;;
574*70b56f4bSCy Schubert			sun4sol2)
575*70b56f4bSCy Schubert				basic_machine=sparc-sun
576*70b56f4bSCy Schubert				basic_os=solaris2
577*70b56f4bSCy Schubert				;;
578*70b56f4bSCy Schubert			sun386 | sun386i | roadrunner)
579*70b56f4bSCy Schubert				basic_machine=i386-sun
580*70b56f4bSCy Schubert				basic_os=
581*70b56f4bSCy Schubert				;;
582*70b56f4bSCy Schubert			sv1)
583*70b56f4bSCy Schubert				basic_machine=sv1-cray
584*70b56f4bSCy Schubert				basic_os=unicos
585*70b56f4bSCy Schubert				;;
586*70b56f4bSCy Schubert			symmetry)
587*70b56f4bSCy Schubert				basic_machine=i386-sequent
588*70b56f4bSCy Schubert				basic_os=dynix
589*70b56f4bSCy Schubert				;;
590*70b56f4bSCy Schubert			t3e)
591*70b56f4bSCy Schubert				basic_machine=alphaev5-cray
592*70b56f4bSCy Schubert				basic_os=unicos
593*70b56f4bSCy Schubert				;;
594*70b56f4bSCy Schubert			t90)
595*70b56f4bSCy Schubert				basic_machine=t90-cray
596*70b56f4bSCy Schubert				basic_os=unicos
597*70b56f4bSCy Schubert				;;
598*70b56f4bSCy Schubert			toad1)
599*70b56f4bSCy Schubert				basic_machine=pdp10-xkl
600*70b56f4bSCy Schubert				basic_os=tops20
601*70b56f4bSCy Schubert				;;
602*70b56f4bSCy Schubert			tpf)
603*70b56f4bSCy Schubert				basic_machine=s390x-ibm
604*70b56f4bSCy Schubert				basic_os=tpf
605*70b56f4bSCy Schubert				;;
606*70b56f4bSCy Schubert			udi29k)
607*70b56f4bSCy Schubert				basic_machine=a29k-amd
608*70b56f4bSCy Schubert				basic_os=udi
609*70b56f4bSCy Schubert				;;
610*70b56f4bSCy Schubert			ultra3)
611*70b56f4bSCy Schubert				basic_machine=a29k-nyu
612*70b56f4bSCy Schubert				basic_os=sym1
613*70b56f4bSCy Schubert				;;
614*70b56f4bSCy Schubert			v810 | necv810)
615*70b56f4bSCy Schubert				basic_machine=v810-nec
616*70b56f4bSCy Schubert				basic_os=none
617*70b56f4bSCy Schubert				;;
618*70b56f4bSCy Schubert			vaxv)
619*70b56f4bSCy Schubert				basic_machine=vax-dec
620*70b56f4bSCy Schubert				basic_os=sysv
621*70b56f4bSCy Schubert				;;
622*70b56f4bSCy Schubert			vms)
623*70b56f4bSCy Schubert				basic_machine=vax-dec
624*70b56f4bSCy Schubert				basic_os=vms
625*70b56f4bSCy Schubert				;;
626*70b56f4bSCy Schubert			vsta)
627*70b56f4bSCy Schubert				basic_machine=i386-pc
628*70b56f4bSCy Schubert				basic_os=vsta
629*70b56f4bSCy Schubert				;;
630*70b56f4bSCy Schubert			vxworks960)
631*70b56f4bSCy Schubert				basic_machine=i960-wrs
632*70b56f4bSCy Schubert				basic_os=vxworks
633*70b56f4bSCy Schubert				;;
634*70b56f4bSCy Schubert			vxworks68)
635*70b56f4bSCy Schubert				basic_machine=m68k-wrs
636*70b56f4bSCy Schubert				basic_os=vxworks
637*70b56f4bSCy Schubert				;;
638*70b56f4bSCy Schubert			vxworks29k)
639*70b56f4bSCy Schubert				basic_machine=a29k-wrs
640*70b56f4bSCy Schubert				basic_os=vxworks
641*70b56f4bSCy Schubert				;;
642*70b56f4bSCy Schubert			xbox)
643*70b56f4bSCy Schubert				basic_machine=i686-pc
644*70b56f4bSCy Schubert				basic_os=mingw32
645*70b56f4bSCy Schubert				;;
646*70b56f4bSCy Schubert			ymp)
647*70b56f4bSCy Schubert				basic_machine=ymp-cray
648*70b56f4bSCy Schubert				basic_os=unicos
649*70b56f4bSCy Schubert				;;
650*70b56f4bSCy Schubert			*)
651*70b56f4bSCy Schubert				basic_machine=$1
652*70b56f4bSCy Schubert				basic_os=
653*70b56f4bSCy Schubert				;;
654*70b56f4bSCy Schubert		esac
655937a2000SPeter Wemm		;;
656937a2000SPeter Wemmesac
657937a2000SPeter Wemm
658*70b56f4bSCy Schubert# Decode 1-component or ad-hoc basic machines
659937a2000SPeter Wemmcase $basic_machine in
660*70b56f4bSCy Schubert	# Here we handle the default manufacturer of certain CPU types.  It is in
661*70b56f4bSCy Schubert	# some cases the only manufacturer, in others, it is the most popular.
662*70b56f4bSCy Schubert	w89k)
663*70b56f4bSCy Schubert		cpu=hppa1.1
664*70b56f4bSCy Schubert		vendor=winbond
665*70b56f4bSCy Schubert		;;
666*70b56f4bSCy Schubert	op50n)
667*70b56f4bSCy Schubert		cpu=hppa1.1
668*70b56f4bSCy Schubert		vendor=oki
669*70b56f4bSCy Schubert		;;
670*70b56f4bSCy Schubert	op60c)
671*70b56f4bSCy Schubert		cpu=hppa1.1
672*70b56f4bSCy Schubert		vendor=oki
673*70b56f4bSCy Schubert		;;
674*70b56f4bSCy Schubert	ibm*)
675*70b56f4bSCy Schubert		cpu=i370
676*70b56f4bSCy Schubert		vendor=ibm
677*70b56f4bSCy Schubert		;;
678*70b56f4bSCy Schubert	orion105)
679*70b56f4bSCy Schubert		cpu=clipper
680*70b56f4bSCy Schubert		vendor=highlevel
681*70b56f4bSCy Schubert		;;
682*70b56f4bSCy Schubert	mac | mpw | mac-mpw)
683*70b56f4bSCy Schubert		cpu=m68k
684*70b56f4bSCy Schubert		vendor=apple
685*70b56f4bSCy Schubert		;;
686*70b56f4bSCy Schubert	pmac | pmac-mpw)
687*70b56f4bSCy Schubert		cpu=powerpc
688*70b56f4bSCy Schubert		vendor=apple
689*70b56f4bSCy Schubert		;;
690*70b56f4bSCy Schubert
691*70b56f4bSCy Schubert	# Recognize the various machine names and aliases which stand
692*70b56f4bSCy Schubert	# for a CPU type and a company and sometimes even an OS.
693*70b56f4bSCy Schubert	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
694*70b56f4bSCy Schubert		cpu=m68000
695*70b56f4bSCy Schubert		vendor=att
696*70b56f4bSCy Schubert		;;
697*70b56f4bSCy Schubert	3b*)
698*70b56f4bSCy Schubert		cpu=we32k
699*70b56f4bSCy Schubert		vendor=att
700*70b56f4bSCy Schubert		;;
701*70b56f4bSCy Schubert	bluegene*)
702*70b56f4bSCy Schubert		cpu=powerpc
703*70b56f4bSCy Schubert		vendor=ibm
704*70b56f4bSCy Schubert		basic_os=cnk
705*70b56f4bSCy Schubert		;;
706*70b56f4bSCy Schubert	decsystem10* | dec10*)
707*70b56f4bSCy Schubert		cpu=pdp10
708*70b56f4bSCy Schubert		vendor=dec
709*70b56f4bSCy Schubert		basic_os=tops10
710*70b56f4bSCy Schubert		;;
711*70b56f4bSCy Schubert	decsystem20* | dec20*)
712*70b56f4bSCy Schubert		cpu=pdp10
713*70b56f4bSCy Schubert		vendor=dec
714*70b56f4bSCy Schubert		basic_os=tops20
715*70b56f4bSCy Schubert		;;
716*70b56f4bSCy Schubert	delta | 3300 | motorola-3300 | motorola-delta \
717*70b56f4bSCy Schubert	      | 3300-motorola | delta-motorola)
718*70b56f4bSCy Schubert		cpu=m68k
719*70b56f4bSCy Schubert		vendor=motorola
720*70b56f4bSCy Schubert		;;
721*70b56f4bSCy Schubert	dpx2*)
722*70b56f4bSCy Schubert		cpu=m68k
723*70b56f4bSCy Schubert		vendor=bull
724*70b56f4bSCy Schubert		basic_os=sysv3
725*70b56f4bSCy Schubert		;;
726*70b56f4bSCy Schubert	encore | umax | mmax)
727*70b56f4bSCy Schubert		cpu=ns32k
728*70b56f4bSCy Schubert		vendor=encore
729*70b56f4bSCy Schubert		;;
730*70b56f4bSCy Schubert	elxsi)
731*70b56f4bSCy Schubert		cpu=elxsi
732*70b56f4bSCy Schubert		vendor=elxsi
733*70b56f4bSCy Schubert		basic_os=${basic_os:-bsd}
734*70b56f4bSCy Schubert		;;
735*70b56f4bSCy Schubert	fx2800)
736*70b56f4bSCy Schubert		cpu=i860
737*70b56f4bSCy Schubert		vendor=alliant
738*70b56f4bSCy Schubert		;;
739*70b56f4bSCy Schubert	genix)
740*70b56f4bSCy Schubert		cpu=ns32k
741*70b56f4bSCy Schubert		vendor=ns
742*70b56f4bSCy Schubert		;;
743*70b56f4bSCy Schubert	h3050r* | hiux*)
744*70b56f4bSCy Schubert		cpu=hppa1.1
745*70b56f4bSCy Schubert		vendor=hitachi
746*70b56f4bSCy Schubert		basic_os=hiuxwe2
747*70b56f4bSCy Schubert		;;
748*70b56f4bSCy Schubert	hp3k9[0-9][0-9] | hp9[0-9][0-9])
749*70b56f4bSCy Schubert		cpu=hppa1.0
750*70b56f4bSCy Schubert		vendor=hp
751*70b56f4bSCy Schubert		;;
752*70b56f4bSCy Schubert	hp9k2[0-9][0-9] | hp9k31[0-9])
753*70b56f4bSCy Schubert		cpu=m68000
754*70b56f4bSCy Schubert		vendor=hp
755*70b56f4bSCy Schubert		;;
756*70b56f4bSCy Schubert	hp9k3[2-9][0-9])
757*70b56f4bSCy Schubert		cpu=m68k
758*70b56f4bSCy Schubert		vendor=hp
759*70b56f4bSCy Schubert		;;
760*70b56f4bSCy Schubert	hp9k6[0-9][0-9] | hp6[0-9][0-9])
761*70b56f4bSCy Schubert		cpu=hppa1.0
762*70b56f4bSCy Schubert		vendor=hp
763*70b56f4bSCy Schubert		;;
764*70b56f4bSCy Schubert	hp9k7[0-79][0-9] | hp7[0-79][0-9])
765*70b56f4bSCy Schubert		cpu=hppa1.1
766*70b56f4bSCy Schubert		vendor=hp
767*70b56f4bSCy Schubert		;;
768*70b56f4bSCy Schubert	hp9k78[0-9] | hp78[0-9])
769*70b56f4bSCy Schubert		# FIXME: really hppa2.0-hp
770*70b56f4bSCy Schubert		cpu=hppa1.1
771*70b56f4bSCy Schubert		vendor=hp
772*70b56f4bSCy Schubert		;;
773*70b56f4bSCy Schubert	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
774*70b56f4bSCy Schubert		# FIXME: really hppa2.0-hp
775*70b56f4bSCy Schubert		cpu=hppa1.1
776*70b56f4bSCy Schubert		vendor=hp
777*70b56f4bSCy Schubert		;;
778*70b56f4bSCy Schubert	hp9k8[0-9][13679] | hp8[0-9][13679])
779*70b56f4bSCy Schubert		cpu=hppa1.1
780*70b56f4bSCy Schubert		vendor=hp
781*70b56f4bSCy Schubert		;;
782*70b56f4bSCy Schubert	hp9k8[0-9][0-9] | hp8[0-9][0-9])
783*70b56f4bSCy Schubert		cpu=hppa1.0
784*70b56f4bSCy Schubert		vendor=hp
785*70b56f4bSCy Schubert		;;
786*70b56f4bSCy Schubert	i*86v32)
787*70b56f4bSCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
788*70b56f4bSCy Schubert		vendor=pc
789*70b56f4bSCy Schubert		basic_os=sysv32
790*70b56f4bSCy Schubert		;;
791*70b56f4bSCy Schubert	i*86v4*)
792*70b56f4bSCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
793*70b56f4bSCy Schubert		vendor=pc
794*70b56f4bSCy Schubert		basic_os=sysv4
795*70b56f4bSCy Schubert		;;
796*70b56f4bSCy Schubert	i*86v)
797*70b56f4bSCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
798*70b56f4bSCy Schubert		vendor=pc
799*70b56f4bSCy Schubert		basic_os=sysv
800*70b56f4bSCy Schubert		;;
801*70b56f4bSCy Schubert	i*86sol2)
802*70b56f4bSCy Schubert		cpu=`echo "$1" | sed -e 's/86.*/86/'`
803*70b56f4bSCy Schubert		vendor=pc
804*70b56f4bSCy Schubert		basic_os=solaris2
805*70b56f4bSCy Schubert		;;
806*70b56f4bSCy Schubert	j90 | j90-cray)
807*70b56f4bSCy Schubert		cpu=j90
808*70b56f4bSCy Schubert		vendor=cray
809*70b56f4bSCy Schubert		basic_os=${basic_os:-unicos}
810*70b56f4bSCy Schubert		;;
811*70b56f4bSCy Schubert	iris | iris4d)
812*70b56f4bSCy Schubert		cpu=mips
813*70b56f4bSCy Schubert		vendor=sgi
814*70b56f4bSCy Schubert		case $basic_os in
815*70b56f4bSCy Schubert		    irix*)
816*70b56f4bSCy Schubert			;;
817*70b56f4bSCy Schubert		    *)
818*70b56f4bSCy Schubert			basic_os=irix4
819*70b56f4bSCy Schubert			;;
820*70b56f4bSCy Schubert		esac
821*70b56f4bSCy Schubert		;;
822*70b56f4bSCy Schubert	miniframe)
823*70b56f4bSCy Schubert		cpu=m68000
824*70b56f4bSCy Schubert		vendor=convergent
825*70b56f4bSCy Schubert		;;
826*70b56f4bSCy Schubert	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
827*70b56f4bSCy Schubert		cpu=m68k
828*70b56f4bSCy Schubert		vendor=atari
829*70b56f4bSCy Schubert		basic_os=mint
830*70b56f4bSCy Schubert		;;
831*70b56f4bSCy Schubert	news-3600 | risc-news)
832*70b56f4bSCy Schubert		cpu=mips
833*70b56f4bSCy Schubert		vendor=sony
834*70b56f4bSCy Schubert		basic_os=newsos
835*70b56f4bSCy Schubert		;;
836*70b56f4bSCy Schubert	next | m*-next)
837*70b56f4bSCy Schubert		cpu=m68k
838*70b56f4bSCy Schubert		vendor=next
839*70b56f4bSCy Schubert		case $basic_os in
840*70b56f4bSCy Schubert		    openstep*)
841*70b56f4bSCy Schubert		        ;;
842*70b56f4bSCy Schubert		    nextstep*)
843*70b56f4bSCy Schubert			;;
844*70b56f4bSCy Schubert		    ns2*)
845*70b56f4bSCy Schubert		      basic_os=nextstep2
846*70b56f4bSCy Schubert			;;
847*70b56f4bSCy Schubert		    *)
848*70b56f4bSCy Schubert		      basic_os=nextstep3
849*70b56f4bSCy Schubert			;;
850*70b56f4bSCy Schubert		esac
851*70b56f4bSCy Schubert		;;
852*70b56f4bSCy Schubert	np1)
853*70b56f4bSCy Schubert		cpu=np1
854*70b56f4bSCy Schubert		vendor=gould
855*70b56f4bSCy Schubert		;;
856*70b56f4bSCy Schubert	op50n-* | op60c-*)
857*70b56f4bSCy Schubert		cpu=hppa1.1
858*70b56f4bSCy Schubert		vendor=oki
859*70b56f4bSCy Schubert		basic_os=proelf
860*70b56f4bSCy Schubert		;;
861*70b56f4bSCy Schubert	pa-hitachi)
862*70b56f4bSCy Schubert		cpu=hppa1.1
863*70b56f4bSCy Schubert		vendor=hitachi
864*70b56f4bSCy Schubert		basic_os=hiuxwe2
865*70b56f4bSCy Schubert		;;
866*70b56f4bSCy Schubert	pbd)
867*70b56f4bSCy Schubert		cpu=sparc
868*70b56f4bSCy Schubert		vendor=tti
869*70b56f4bSCy Schubert		;;
870*70b56f4bSCy Schubert	pbb)
871*70b56f4bSCy Schubert		cpu=m68k
872*70b56f4bSCy Schubert		vendor=tti
873*70b56f4bSCy Schubert		;;
874*70b56f4bSCy Schubert	pc532)
875*70b56f4bSCy Schubert		cpu=ns32k
876*70b56f4bSCy Schubert		vendor=pc532
877*70b56f4bSCy Schubert		;;
878*70b56f4bSCy Schubert	pn)
879*70b56f4bSCy Schubert		cpu=pn
880*70b56f4bSCy Schubert		vendor=gould
881*70b56f4bSCy Schubert		;;
882*70b56f4bSCy Schubert	power)
883*70b56f4bSCy Schubert		cpu=power
884*70b56f4bSCy Schubert		vendor=ibm
885*70b56f4bSCy Schubert		;;
886*70b56f4bSCy Schubert	ps2)
887*70b56f4bSCy Schubert		cpu=i386
888*70b56f4bSCy Schubert		vendor=ibm
889*70b56f4bSCy Schubert		;;
890*70b56f4bSCy Schubert	rm[46]00)
891*70b56f4bSCy Schubert		cpu=mips
892*70b56f4bSCy Schubert		vendor=siemens
893*70b56f4bSCy Schubert		;;
894*70b56f4bSCy Schubert	rtpc | rtpc-*)
895*70b56f4bSCy Schubert		cpu=romp
896*70b56f4bSCy Schubert		vendor=ibm
897*70b56f4bSCy Schubert		;;
898*70b56f4bSCy Schubert	sde)
899*70b56f4bSCy Schubert		cpu=mipsisa32
900*70b56f4bSCy Schubert		vendor=sde
901*70b56f4bSCy Schubert		basic_os=${basic_os:-elf}
902*70b56f4bSCy Schubert		;;
903*70b56f4bSCy Schubert	simso-wrs)
904*70b56f4bSCy Schubert		cpu=sparclite
905*70b56f4bSCy Schubert		vendor=wrs
906*70b56f4bSCy Schubert		basic_os=vxworks
907*70b56f4bSCy Schubert		;;
908*70b56f4bSCy Schubert	tower | tower-32)
909*70b56f4bSCy Schubert		cpu=m68k
910*70b56f4bSCy Schubert		vendor=ncr
911*70b56f4bSCy Schubert		;;
912*70b56f4bSCy Schubert	vpp*|vx|vx-*)
913*70b56f4bSCy Schubert		cpu=f301
914*70b56f4bSCy Schubert		vendor=fujitsu
915*70b56f4bSCy Schubert		;;
916*70b56f4bSCy Schubert	w65)
917*70b56f4bSCy Schubert		cpu=w65
918*70b56f4bSCy Schubert		vendor=wdc
919*70b56f4bSCy Schubert		;;
920*70b56f4bSCy Schubert	w89k-*)
921*70b56f4bSCy Schubert		cpu=hppa1.1
922*70b56f4bSCy Schubert		vendor=winbond
923*70b56f4bSCy Schubert		basic_os=proelf
924*70b56f4bSCy Schubert		;;
925*70b56f4bSCy Schubert	none)
926*70b56f4bSCy Schubert		cpu=none
927*70b56f4bSCy Schubert		vendor=none
928*70b56f4bSCy Schubert		;;
929*70b56f4bSCy Schubert	leon|leon[3-9])
930*70b56f4bSCy Schubert		cpu=sparc
931*70b56f4bSCy Schubert		vendor=$basic_machine
932*70b56f4bSCy Schubert		;;
933*70b56f4bSCy Schubert	leon-*|leon[3-9]-*)
934*70b56f4bSCy Schubert		cpu=sparc
935*70b56f4bSCy Schubert		vendor=`echo "$basic_machine" | sed 's/-.*//'`
936*70b56f4bSCy Schubert		;;
937*70b56f4bSCy Schubert
938*70b56f4bSCy Schubert	*-*)
939*70b56f4bSCy Schubert		# shellcheck disable=SC2162
940*70b56f4bSCy Schubert		saved_IFS=$IFS
941*70b56f4bSCy Schubert		IFS="-" read cpu vendor <<EOF
942*70b56f4bSCy Schubert$basic_machine
943*70b56f4bSCy SchubertEOF
944*70b56f4bSCy Schubert		IFS=$saved_IFS
945*70b56f4bSCy Schubert		;;
946*70b56f4bSCy Schubert	# We use `pc' rather than `unknown'
947*70b56f4bSCy Schubert	# because (1) that's what they normally are, and
948*70b56f4bSCy Schubert	# (2) the word "unknown" tends to confuse beginning users.
949*70b56f4bSCy Schubert	i*86 | x86_64)
950*70b56f4bSCy Schubert		cpu=$basic_machine
951*70b56f4bSCy Schubert		vendor=pc
952*70b56f4bSCy Schubert		;;
953*70b56f4bSCy Schubert	# These rules are duplicated from below for sake of the special case above;
954*70b56f4bSCy Schubert	# i.e. things that normalized to x86 arches should also default to "pc"
955*70b56f4bSCy Schubert	pc98)
956*70b56f4bSCy Schubert		cpu=i386
957*70b56f4bSCy Schubert		vendor=pc
958*70b56f4bSCy Schubert		;;
959*70b56f4bSCy Schubert	x64 | amd64)
960*70b56f4bSCy Schubert		cpu=x86_64
961*70b56f4bSCy Schubert		vendor=pc
962*70b56f4bSCy Schubert		;;
963937a2000SPeter Wemm	# Recognize the basic CPU types without company name.
964*70b56f4bSCy Schubert	*)
965*70b56f4bSCy Schubert		cpu=$basic_machine
966*70b56f4bSCy Schubert		vendor=unknown
967*70b56f4bSCy Schubert		;;
968*70b56f4bSCy Schubertesac
969*70b56f4bSCy Schubert
970*70b56f4bSCy Schubertunset -v basic_machine
971*70b56f4bSCy Schubert
972*70b56f4bSCy Schubert# Decode basic machines in the full and proper CPU-Company form.
973*70b56f4bSCy Schubertcase $cpu-$vendor in
974*70b56f4bSCy Schubert	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
975*70b56f4bSCy Schubert	# some cases the only manufacturer, in others, it is the most popular.
976*70b56f4bSCy Schubert	craynv-unknown)
977*70b56f4bSCy Schubert		vendor=cray
978*70b56f4bSCy Schubert		basic_os=${basic_os:-unicosmp}
979*70b56f4bSCy Schubert		;;
980*70b56f4bSCy Schubert	c90-unknown | c90-cray)
981*70b56f4bSCy Schubert		vendor=cray
982*70b56f4bSCy Schubert		basic_os=${Basic_os:-unicos}
983*70b56f4bSCy Schubert		;;
984*70b56f4bSCy Schubert	fx80-unknown)
985*70b56f4bSCy Schubert		vendor=alliant
986*70b56f4bSCy Schubert		;;
987*70b56f4bSCy Schubert	romp-unknown)
988*70b56f4bSCy Schubert		vendor=ibm
989*70b56f4bSCy Schubert		;;
990*70b56f4bSCy Schubert	mmix-unknown)
991*70b56f4bSCy Schubert		vendor=knuth
992*70b56f4bSCy Schubert		;;
993*70b56f4bSCy Schubert	microblaze-unknown | microblazeel-unknown)
994*70b56f4bSCy Schubert		vendor=xilinx
995*70b56f4bSCy Schubert		;;
996*70b56f4bSCy Schubert	rs6000-unknown)
997*70b56f4bSCy Schubert		vendor=ibm
998*70b56f4bSCy Schubert		;;
999*70b56f4bSCy Schubert	vax-unknown)
1000*70b56f4bSCy Schubert		vendor=dec
1001*70b56f4bSCy Schubert		;;
1002*70b56f4bSCy Schubert	pdp11-unknown)
1003*70b56f4bSCy Schubert		vendor=dec
1004*70b56f4bSCy Schubert		;;
1005*70b56f4bSCy Schubert	we32k-unknown)
1006*70b56f4bSCy Schubert		vendor=att
1007*70b56f4bSCy Schubert		;;
1008*70b56f4bSCy Schubert	cydra-unknown)
1009*70b56f4bSCy Schubert		vendor=cydrome
1010*70b56f4bSCy Schubert		;;
1011*70b56f4bSCy Schubert	i370-ibm*)
1012*70b56f4bSCy Schubert		vendor=ibm
1013*70b56f4bSCy Schubert		;;
1014*70b56f4bSCy Schubert	orion-unknown)
1015*70b56f4bSCy Schubert		vendor=highlevel
1016*70b56f4bSCy Schubert		;;
1017*70b56f4bSCy Schubert	xps-unknown | xps100-unknown)
1018*70b56f4bSCy Schubert		cpu=xps100
1019*70b56f4bSCy Schubert		vendor=honeywell
1020*70b56f4bSCy Schubert		;;
1021*70b56f4bSCy Schubert
1022*70b56f4bSCy Schubert	# Here we normalize CPU types with a missing or matching vendor
1023*70b56f4bSCy Schubert	armh-unknown | armh-alt)
1024*70b56f4bSCy Schubert		cpu=armv7l
1025*70b56f4bSCy Schubert		vendor=alt
1026*70b56f4bSCy Schubert		basic_os=${basic_os:-linux-gnueabihf}
1027*70b56f4bSCy Schubert		;;
1028*70b56f4bSCy Schubert	dpx20-unknown | dpx20-bull)
1029*70b56f4bSCy Schubert		cpu=rs6000
1030*70b56f4bSCy Schubert		vendor=bull
1031*70b56f4bSCy Schubert		basic_os=${basic_os:-bosx}
1032*70b56f4bSCy Schubert		;;
1033*70b56f4bSCy Schubert
1034*70b56f4bSCy Schubert	# Here we normalize CPU types irrespective of the vendor
1035*70b56f4bSCy Schubert	amd64-*)
1036*70b56f4bSCy Schubert		cpu=x86_64
1037*70b56f4bSCy Schubert		;;
1038*70b56f4bSCy Schubert	blackfin-*)
1039*70b56f4bSCy Schubert		cpu=bfin
1040*70b56f4bSCy Schubert		basic_os=linux
1041*70b56f4bSCy Schubert		;;
1042*70b56f4bSCy Schubert	c54x-*)
1043*70b56f4bSCy Schubert		cpu=tic54x
1044*70b56f4bSCy Schubert		;;
1045*70b56f4bSCy Schubert	c55x-*)
1046*70b56f4bSCy Schubert		cpu=tic55x
1047*70b56f4bSCy Schubert		;;
1048*70b56f4bSCy Schubert	c6x-*)
1049*70b56f4bSCy Schubert		cpu=tic6x
1050*70b56f4bSCy Schubert		;;
1051*70b56f4bSCy Schubert	e500v[12]-*)
1052*70b56f4bSCy Schubert		cpu=powerpc
1053*70b56f4bSCy Schubert		basic_os=${basic_os}"spe"
1054*70b56f4bSCy Schubert		;;
1055*70b56f4bSCy Schubert	mips3*-*)
1056*70b56f4bSCy Schubert		cpu=mips64
1057*70b56f4bSCy Schubert		;;
1058*70b56f4bSCy Schubert	ms1-*)
1059*70b56f4bSCy Schubert		cpu=mt
1060*70b56f4bSCy Schubert		;;
1061*70b56f4bSCy Schubert	m68knommu-*)
1062*70b56f4bSCy Schubert		cpu=m68k
1063*70b56f4bSCy Schubert		basic_os=linux
1064*70b56f4bSCy Schubert		;;
1065*70b56f4bSCy Schubert	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1066*70b56f4bSCy Schubert		cpu=s12z
1067*70b56f4bSCy Schubert		;;
1068*70b56f4bSCy Schubert	openrisc-*)
1069*70b56f4bSCy Schubert		cpu=or32
1070*70b56f4bSCy Schubert		;;
1071*70b56f4bSCy Schubert	parisc-*)
1072*70b56f4bSCy Schubert		cpu=hppa
1073*70b56f4bSCy Schubert		basic_os=linux
1074*70b56f4bSCy Schubert		;;
1075*70b56f4bSCy Schubert	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1076*70b56f4bSCy Schubert		cpu=i586
1077*70b56f4bSCy Schubert		;;
1078*70b56f4bSCy Schubert	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1079*70b56f4bSCy Schubert		cpu=i686
1080*70b56f4bSCy Schubert		;;
1081*70b56f4bSCy Schubert	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1082*70b56f4bSCy Schubert		cpu=i686
1083*70b56f4bSCy Schubert		;;
1084*70b56f4bSCy Schubert	pentium4-*)
1085*70b56f4bSCy Schubert		cpu=i786
1086*70b56f4bSCy Schubert		;;
1087*70b56f4bSCy Schubert	pc98-*)
1088*70b56f4bSCy Schubert		cpu=i386
1089*70b56f4bSCy Schubert		;;
1090*70b56f4bSCy Schubert	ppc-* | ppcbe-*)
1091*70b56f4bSCy Schubert		cpu=powerpc
1092*70b56f4bSCy Schubert		;;
1093*70b56f4bSCy Schubert	ppcle-* | powerpclittle-*)
1094*70b56f4bSCy Schubert		cpu=powerpcle
1095*70b56f4bSCy Schubert		;;
1096*70b56f4bSCy Schubert	ppc64-*)
1097*70b56f4bSCy Schubert		cpu=powerpc64
1098*70b56f4bSCy Schubert		;;
1099*70b56f4bSCy Schubert	ppc64le-* | powerpc64little-*)
1100*70b56f4bSCy Schubert		cpu=powerpc64le
1101*70b56f4bSCy Schubert		;;
1102*70b56f4bSCy Schubert	sb1-*)
1103*70b56f4bSCy Schubert		cpu=mipsisa64sb1
1104*70b56f4bSCy Schubert		;;
1105*70b56f4bSCy Schubert	sb1el-*)
1106*70b56f4bSCy Schubert		cpu=mipsisa64sb1el
1107*70b56f4bSCy Schubert		;;
1108*70b56f4bSCy Schubert	sh5e[lb]-*)
1109*70b56f4bSCy Schubert		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1110*70b56f4bSCy Schubert		;;
1111*70b56f4bSCy Schubert	spur-*)
1112*70b56f4bSCy Schubert		cpu=spur
1113*70b56f4bSCy Schubert		;;
1114*70b56f4bSCy Schubert	strongarm-* | thumb-*)
1115*70b56f4bSCy Schubert		cpu=arm
1116*70b56f4bSCy Schubert		;;
1117*70b56f4bSCy Schubert	tx39-*)
1118*70b56f4bSCy Schubert		cpu=mipstx39
1119*70b56f4bSCy Schubert		;;
1120*70b56f4bSCy Schubert	tx39el-*)
1121*70b56f4bSCy Schubert		cpu=mipstx39el
1122*70b56f4bSCy Schubert		;;
1123*70b56f4bSCy Schubert	x64-*)
1124*70b56f4bSCy Schubert		cpu=x86_64
1125*70b56f4bSCy Schubert		;;
1126*70b56f4bSCy Schubert	xscale-* | xscalee[bl]-*)
1127*70b56f4bSCy Schubert		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1128*70b56f4bSCy Schubert		;;
1129*70b56f4bSCy Schubert	arm64-* | aarch64le-*)
1130*70b56f4bSCy Schubert		cpu=aarch64
1131*70b56f4bSCy Schubert		;;
1132*70b56f4bSCy Schubert
1133*70b56f4bSCy Schubert	# Recognize the canonical CPU Types that limit and/or modify the
1134*70b56f4bSCy Schubert	# company names they are paired with.
1135*70b56f4bSCy Schubert	cr16-*)
1136*70b56f4bSCy Schubert		basic_os=${basic_os:-elf}
1137*70b56f4bSCy Schubert		;;
1138*70b56f4bSCy Schubert	crisv32-* | etraxfs*-*)
1139*70b56f4bSCy Schubert		cpu=crisv32
1140*70b56f4bSCy Schubert		vendor=axis
1141*70b56f4bSCy Schubert		;;
1142*70b56f4bSCy Schubert	cris-* | etrax*-*)
1143*70b56f4bSCy Schubert		cpu=cris
1144*70b56f4bSCy Schubert		vendor=axis
1145*70b56f4bSCy Schubert		;;
1146*70b56f4bSCy Schubert	crx-*)
1147*70b56f4bSCy Schubert		basic_os=${basic_os:-elf}
1148*70b56f4bSCy Schubert		;;
1149*70b56f4bSCy Schubert	neo-tandem)
1150*70b56f4bSCy Schubert		cpu=neo
1151*70b56f4bSCy Schubert		vendor=tandem
1152*70b56f4bSCy Schubert		;;
1153*70b56f4bSCy Schubert	nse-tandem)
1154*70b56f4bSCy Schubert		cpu=nse
1155*70b56f4bSCy Schubert		vendor=tandem
1156*70b56f4bSCy Schubert		;;
1157*70b56f4bSCy Schubert	nsr-tandem)
1158*70b56f4bSCy Schubert		cpu=nsr
1159*70b56f4bSCy Schubert		vendor=tandem
1160*70b56f4bSCy Schubert		;;
1161*70b56f4bSCy Schubert	nsv-tandem)
1162*70b56f4bSCy Schubert		cpu=nsv
1163*70b56f4bSCy Schubert		vendor=tandem
1164*70b56f4bSCy Schubert		;;
1165*70b56f4bSCy Schubert	nsx-tandem)
1166*70b56f4bSCy Schubert		cpu=nsx
1167*70b56f4bSCy Schubert		vendor=tandem
1168*70b56f4bSCy Schubert		;;
1169*70b56f4bSCy Schubert	mipsallegrexel-sony)
1170*70b56f4bSCy Schubert		cpu=mipsallegrexel
1171*70b56f4bSCy Schubert		vendor=sony
1172*70b56f4bSCy Schubert		;;
1173*70b56f4bSCy Schubert	tile*-*)
1174*70b56f4bSCy Schubert		basic_os=${basic_os:-linux-gnu}
1175*70b56f4bSCy Schubert		;;
1176*70b56f4bSCy Schubert
1177*70b56f4bSCy Schubert	*)
1178*70b56f4bSCy Schubert		# Recognize the canonical CPU types that are allowed with any
1179*70b56f4bSCy Schubert		# company name.
1180*70b56f4bSCy Schubert		case $cpu in
1181937a2000SPeter Wemm			1750a | 580 \
1182937a2000SPeter Wemm			| a29k \
11838bc5c7c0SPeter Wemm			| aarch64 | aarch64_be \
1184*70b56f4bSCy Schubert			| abacus \
1185*70b56f4bSCy Schubert			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1186*70b56f4bSCy Schubert			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1187*70b56f4bSCy Schubert			| alphapca5[67] | alpha64pca5[67] \
1188937a2000SPeter Wemm			| am33_2.0 \
1189*70b56f4bSCy Schubert			| amdgcn \
1190*70b56f4bSCy Schubert			| arc | arceb | arc32 | arc64 \
1191*70b56f4bSCy Schubert			| arm | arm[lb]e | arme[lb] | armv* \
1192d915215eSBaptiste Daroussin			| avr | avr32 \
1193*70b56f4bSCy Schubert			| asmjs \
1194bca4681bSCy Schubert			| ba \
11958bc5c7c0SPeter Wemm			| be32 | be64 \
1196*70b56f4bSCy Schubert			| bfin | bpf | bs2000 \
1197*70b56f4bSCy Schubert			| c[123]* | c30 | [cjt]90 | c4x \
1198*70b56f4bSCy Schubert			| c8051 | clipper | craynv | csky | cydra \
1199937a2000SPeter Wemm			| d10v | d30v | dlx | dsp16xx \
1200*70b56f4bSCy Schubert			| e2k | elxsi | epiphany \
1201*70b56f4bSCy Schubert			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1202*70b56f4bSCy Schubert			| h8300 | h8500 \
1203*70b56f4bSCy Schubert			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
12048bc5c7c0SPeter Wemm			| hexagon \
1205*70b56f4bSCy Schubert			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1206937a2000SPeter Wemm			| ip2k | iq2000 \
1207d915215eSBaptiste Daroussin			| k1om \
12088bc5c7c0SPeter Wemm			| le32 | le64 \
12098bc5c7c0SPeter Wemm			| lm32 \
1210*70b56f4bSCy Schubert			| loongarch32 | loongarch64 | loongarchx32 \
1211*70b56f4bSCy Schubert			| m32c | m32r | m32rle \
1212*70b56f4bSCy Schubert			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1213*70b56f4bSCy Schubert			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1214*70b56f4bSCy Schubert			| m88110 | m88k | maxq | mb | mcore | mep | metag \
1215*70b56f4bSCy Schubert			| microblaze | microblazeel \
1216937a2000SPeter Wemm			| mips | mipsbe | mipseb | mipsel | mipsle \
1217937a2000SPeter Wemm			| mips16 \
1218*70b56f4bSCy Schubert			| mips64 | mips64eb | mips64el \
12198bc5c7c0SPeter Wemm			| mips64octeon | mips64octeonel \
1220937a2000SPeter Wemm			| mips64orion | mips64orionel \
12218bc5c7c0SPeter Wemm			| mips64r5900 | mips64r5900el \
12228bc5c7c0SPeter Wemm			| mips64vr | mips64vrel \
1223937a2000SPeter Wemm			| mips64vr4100 | mips64vr4100el \
1224937a2000SPeter Wemm			| mips64vr4300 | mips64vr4300el \
1225937a2000SPeter Wemm			| mips64vr5000 | mips64vr5000el \
1226937a2000SPeter Wemm			| mips64vr5900 | mips64vr5900el \
1227937a2000SPeter Wemm			| mipsisa32 | mipsisa32el \
1228937a2000SPeter Wemm			| mipsisa32r2 | mipsisa32r2el \
1229*70b56f4bSCy Schubert			| mipsisa32r3 | mipsisa32r3el \
1230*70b56f4bSCy Schubert			| mipsisa32r5 | mipsisa32r5el \
1231d915215eSBaptiste Daroussin			| mipsisa32r6 | mipsisa32r6el \
1232937a2000SPeter Wemm			| mipsisa64 | mipsisa64el \
1233937a2000SPeter Wemm			| mipsisa64r2 | mipsisa64r2el \
1234*70b56f4bSCy Schubert			| mipsisa64r3 | mipsisa64r3el \
1235*70b56f4bSCy Schubert			| mipsisa64r5 | mipsisa64r5el \
1236d915215eSBaptiste Daroussin			| mipsisa64r6 | mipsisa64r6el \
1237937a2000SPeter Wemm			| mipsisa64sb1 | mipsisa64sb1el \
1238937a2000SPeter Wemm			| mipsisa64sr71k | mipsisa64sr71kel \
1239d915215eSBaptiste Daroussin			| mipsr5900 | mipsr5900el \
1240937a2000SPeter Wemm			| mipstx39 | mipstx39el \
1241*70b56f4bSCy Schubert			| mmix \
1242937a2000SPeter Wemm			| mn10200 | mn10300 \
12438bc5c7c0SPeter Wemm			| moxie \
12448bc5c7c0SPeter Wemm			| mt \
1245937a2000SPeter Wemm			| msp430 \
12468bc5c7c0SPeter Wemm			| nds32 | nds32le | nds32be \
1247*70b56f4bSCy Schubert			| nfp \
1248d915215eSBaptiste Daroussin			| nios | nios2 | nios2eb | nios2el \
1249*70b56f4bSCy Schubert			| none | np1 | ns16k | ns32k | nvptx \
1250*70b56f4bSCy Schubert			| open8 \
1251*70b56f4bSCy Schubert			| or1k* \
1252*70b56f4bSCy Schubert			| or32 \
1253*70b56f4bSCy Schubert			| orion \
1254*70b56f4bSCy Schubert			| picochip \
1255*70b56f4bSCy Schubert			| pdp10 | pdp11 | pj | pjl | pn | power \
1256*70b56f4bSCy Schubert			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1257bca4681bSCy Schubert			| pru \
1258937a2000SPeter Wemm			| pyramid \
1259*70b56f4bSCy Schubert			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1260*70b56f4bSCy Schubert			| rl78 | romp | rs6000 | rx \
1261*70b56f4bSCy Schubert			| s390 | s390x \
12628bc5c7c0SPeter Wemm			| score \
1263*70b56f4bSCy Schubert			| sh | shl \
1264*70b56f4bSCy Schubert			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1265*70b56f4bSCy Schubert			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1266*70b56f4bSCy Schubert			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1267*70b56f4bSCy Schubert			| sparclite \
1268*70b56f4bSCy Schubert			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
12698bc5c7c0SPeter Wemm			| spu \
1270*70b56f4bSCy Schubert			| tahoe \
1271*70b56f4bSCy Schubert			| thumbv7* \
1272*70b56f4bSCy Schubert			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1273*70b56f4bSCy Schubert			| tron \
12748bc5c7c0SPeter Wemm			| ubicom32 \
1275*70b56f4bSCy Schubert			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1276*70b56f4bSCy Schubert			| vax \
1277d915215eSBaptiste Daroussin			| visium \
1278*70b56f4bSCy Schubert			| w65 \
1279*70b56f4bSCy Schubert			| wasm32 | wasm64 \
1280*70b56f4bSCy Schubert			| we32k \
1281*70b56f4bSCy Schubert			| x86 | x86_64 | xc16x | xgate | xps100 \
1282*70b56f4bSCy Schubert			| xstormy16 | xtensa* \
1283*70b56f4bSCy Schubert			| ymp \
12848bc5c7c0SPeter Wemm			| z8k | z80)
12858bc5c7c0SPeter Wemm				;;
12868bc5c7c0SPeter Wemm
1287*70b56f4bSCy Schubert			*)
1288*70b56f4bSCy Schubert				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1289937a2000SPeter Wemm				exit 1
1290937a2000SPeter Wemm				;;
1291937a2000SPeter Wemm		esac
1292937a2000SPeter Wemm		;;
1293937a2000SPeter Wemmesac
1294937a2000SPeter Wemm
1295937a2000SPeter Wemm# Here we canonicalize certain aliases for manufacturers.
1296*70b56f4bSCy Schubertcase $vendor in
1297*70b56f4bSCy Schubert	digital*)
1298*70b56f4bSCy Schubert		vendor=dec
1299937a2000SPeter Wemm		;;
1300*70b56f4bSCy Schubert	commodore*)
1301*70b56f4bSCy Schubert		vendor=cbm
1302937a2000SPeter Wemm		;;
1303937a2000SPeter Wemm	*)
1304937a2000SPeter Wemm		;;
1305937a2000SPeter Wemmesac
1306937a2000SPeter Wemm
1307937a2000SPeter Wemm# Decode manufacturer-specific aliases for certain operating systems.
1308937a2000SPeter Wemm
1309*70b56f4bSCy Schubertif test x$basic_os != x
1310937a2000SPeter Wemmthen
1311*70b56f4bSCy Schubert
1312*70b56f4bSCy Schubert# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
1313*70b56f4bSCy Schubert# set os.
1314*70b56f4bSCy Schubertcase $basic_os in
1315*70b56f4bSCy Schubert	gnu/linux*)
1316*70b56f4bSCy Schubert		kernel=linux
1317*70b56f4bSCy Schubert		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1318*70b56f4bSCy Schubert		;;
1319*70b56f4bSCy Schubert	os2-emx)
1320*70b56f4bSCy Schubert		kernel=os2
1321*70b56f4bSCy Schubert		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1322*70b56f4bSCy Schubert		;;
1323*70b56f4bSCy Schubert	nto-qnx*)
1324*70b56f4bSCy Schubert		kernel=nto
1325*70b56f4bSCy Schubert		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1326*70b56f4bSCy Schubert		;;
1327*70b56f4bSCy Schubert	*-*)
1328*70b56f4bSCy Schubert		# shellcheck disable=SC2162
1329*70b56f4bSCy Schubert		saved_IFS=$IFS
1330*70b56f4bSCy Schubert		IFS="-" read kernel os <<EOF
1331*70b56f4bSCy Schubert$basic_os
1332*70b56f4bSCy SchubertEOF
1333*70b56f4bSCy Schubert		IFS=$saved_IFS
1334*70b56f4bSCy Schubert		;;
1335*70b56f4bSCy Schubert	# Default OS when just kernel was specified
1336*70b56f4bSCy Schubert	nto*)
1337*70b56f4bSCy Schubert		kernel=nto
1338*70b56f4bSCy Schubert		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1339*70b56f4bSCy Schubert		;;
1340*70b56f4bSCy Schubert	linux*)
1341*70b56f4bSCy Schubert		kernel=linux
1342*70b56f4bSCy Schubert		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1343*70b56f4bSCy Schubert		;;
1344*70b56f4bSCy Schubert	*)
1345*70b56f4bSCy Schubert		kernel=
1346*70b56f4bSCy Schubert		os=$basic_os
1347*70b56f4bSCy Schubert		;;
1348*70b56f4bSCy Schubertesac
1349*70b56f4bSCy Schubert
1350*70b56f4bSCy Schubert# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1351*70b56f4bSCy Schubert# etc.)
1352937a2000SPeter Wemmcase $os in
1353bca4681bSCy Schubert	# First match some system type aliases that might get confused
1354bca4681bSCy Schubert	# with valid system types.
1355*70b56f4bSCy Schubert	# solaris* is a basic system type, with this one exception.
1356*70b56f4bSCy Schubert	auroraux)
1357*70b56f4bSCy Schubert		os=auroraux
13588bc5c7c0SPeter Wemm		;;
1359*70b56f4bSCy Schubert	bluegene*)
1360*70b56f4bSCy Schubert		os=cnk
1361937a2000SPeter Wemm		;;
1362*70b56f4bSCy Schubert	solaris1 | solaris1.*)
1363*70b56f4bSCy Schubert		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1364937a2000SPeter Wemm		;;
1365*70b56f4bSCy Schubert	solaris)
1366*70b56f4bSCy Schubert		os=solaris2
1367937a2000SPeter Wemm		;;
1368*70b56f4bSCy Schubert	unixware*)
1369*70b56f4bSCy Schubert		os=sysv4.2uw
1370937a2000SPeter Wemm		;;
1371bca4681bSCy Schubert	# es1800 is here to avoid being matched by es* (a different OS)
1372*70b56f4bSCy Schubert	es1800*)
1373*70b56f4bSCy Schubert		os=ose
1374bca4681bSCy Schubert		;;
1375*70b56f4bSCy Schubert	# Some version numbers need modification
1376*70b56f4bSCy Schubert	chorusos*)
1377*70b56f4bSCy Schubert		os=chorusos
1378937a2000SPeter Wemm		;;
1379*70b56f4bSCy Schubert	isc)
1380*70b56f4bSCy Schubert		os=isc2.2
1381937a2000SPeter Wemm		;;
1382*70b56f4bSCy Schubert	sco6)
1383*70b56f4bSCy Schubert		os=sco5v6
1384937a2000SPeter Wemm		;;
1385*70b56f4bSCy Schubert	sco5)
1386*70b56f4bSCy Schubert		os=sco3.2v5
1387937a2000SPeter Wemm		;;
1388*70b56f4bSCy Schubert	sco4)
1389*70b56f4bSCy Schubert		os=sco3.2v4
1390937a2000SPeter Wemm		;;
1391*70b56f4bSCy Schubert	sco3.2.[4-9]*)
1392*70b56f4bSCy Schubert		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
1393937a2000SPeter Wemm		;;
1394*70b56f4bSCy Schubert	sco*v* | scout)
1395*70b56f4bSCy Schubert		# Don't match below
1396937a2000SPeter Wemm		;;
1397*70b56f4bSCy Schubert	sco*)
1398*70b56f4bSCy Schubert		os=sco3.2v2
1399*70b56f4bSCy Schubert		;;
1400*70b56f4bSCy Schubert	psos*)
1401*70b56f4bSCy Schubert		os=psos
1402*70b56f4bSCy Schubert		;;
1403*70b56f4bSCy Schubert	qnx*)
1404*70b56f4bSCy Schubert		os=qnx
1405*70b56f4bSCy Schubert		;;
1406*70b56f4bSCy Schubert	hiux*)
1407*70b56f4bSCy Schubert		os=hiuxwe2
1408*70b56f4bSCy Schubert		;;
1409*70b56f4bSCy Schubert	lynx*178)
1410*70b56f4bSCy Schubert		os=lynxos178
1411*70b56f4bSCy Schubert		;;
1412*70b56f4bSCy Schubert	lynx*5)
1413*70b56f4bSCy Schubert		os=lynxos5
1414*70b56f4bSCy Schubert		;;
1415*70b56f4bSCy Schubert	lynxos*)
1416*70b56f4bSCy Schubert		# don't get caught up in next wildcard
1417*70b56f4bSCy Schubert		;;
1418*70b56f4bSCy Schubert	lynx*)
1419*70b56f4bSCy Schubert		os=lynxos
1420*70b56f4bSCy Schubert		;;
1421*70b56f4bSCy Schubert	mac[0-9]*)
1422bca4681bSCy Schubert		os=`echo "$os" | sed -e 's|mac|macos|'`
1423937a2000SPeter Wemm		;;
1424*70b56f4bSCy Schubert	opened*)
1425*70b56f4bSCy Schubert		os=openedition
1426937a2000SPeter Wemm		;;
1427*70b56f4bSCy Schubert	os400*)
1428*70b56f4bSCy Schubert		os=os400
1429937a2000SPeter Wemm		;;
1430*70b56f4bSCy Schubert	sunos5*)
1431bca4681bSCy Schubert		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1432937a2000SPeter Wemm		;;
1433*70b56f4bSCy Schubert	sunos6*)
1434bca4681bSCy Schubert		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1435937a2000SPeter Wemm		;;
1436*70b56f4bSCy Schubert	wince*)
1437*70b56f4bSCy Schubert		os=wince
1438937a2000SPeter Wemm		;;
1439*70b56f4bSCy Schubert	utek*)
1440*70b56f4bSCy Schubert		os=bsd
1441937a2000SPeter Wemm		;;
1442*70b56f4bSCy Schubert	dynix*)
1443*70b56f4bSCy Schubert		os=bsd
1444937a2000SPeter Wemm		;;
1445*70b56f4bSCy Schubert	acis*)
1446*70b56f4bSCy Schubert		os=aos
1447937a2000SPeter Wemm		;;
1448*70b56f4bSCy Schubert	atheos*)
1449*70b56f4bSCy Schubert		os=atheos
1450937a2000SPeter Wemm		;;
1451*70b56f4bSCy Schubert	syllable*)
1452*70b56f4bSCy Schubert		os=syllable
1453937a2000SPeter Wemm		;;
1454*70b56f4bSCy Schubert	386bsd)
1455*70b56f4bSCy Schubert		os=bsd
1456937a2000SPeter Wemm		;;
1457*70b56f4bSCy Schubert	ctix* | uts*)
1458*70b56f4bSCy Schubert		os=sysv
1459937a2000SPeter Wemm		;;
1460*70b56f4bSCy Schubert	nova*)
1461*70b56f4bSCy Schubert		os=rtmk-nova
1462937a2000SPeter Wemm		;;
1463*70b56f4bSCy Schubert	ns2)
1464*70b56f4bSCy Schubert		os=nextstep2
1465937a2000SPeter Wemm		;;
1466937a2000SPeter Wemm	# Preserve the version number of sinix5.
1467*70b56f4bSCy Schubert	sinix5.*)
1468*70b56f4bSCy Schubert		os=`echo "$os" | sed -e 's|sinix|sysv|'`
1469937a2000SPeter Wemm		;;
1470*70b56f4bSCy Schubert	sinix*)
1471*70b56f4bSCy Schubert		os=sysv4
1472937a2000SPeter Wemm		;;
1473*70b56f4bSCy Schubert	tpf*)
1474*70b56f4bSCy Schubert		os=tpf
1475937a2000SPeter Wemm		;;
1476*70b56f4bSCy Schubert	triton*)
1477*70b56f4bSCy Schubert		os=sysv3
1478937a2000SPeter Wemm		;;
1479*70b56f4bSCy Schubert	oss*)
1480*70b56f4bSCy Schubert		os=sysv3
1481937a2000SPeter Wemm		;;
1482*70b56f4bSCy Schubert	svr4*)
1483*70b56f4bSCy Schubert		os=sysv4
1484937a2000SPeter Wemm		;;
1485*70b56f4bSCy Schubert	svr3)
1486*70b56f4bSCy Schubert		os=sysv3
1487937a2000SPeter Wemm		;;
1488*70b56f4bSCy Schubert	sysvr4)
1489*70b56f4bSCy Schubert		os=sysv4
1490937a2000SPeter Wemm		;;
1491*70b56f4bSCy Schubert	ose*)
1492*70b56f4bSCy Schubert		os=ose
1493937a2000SPeter Wemm		;;
1494*70b56f4bSCy Schubert	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1495*70b56f4bSCy Schubert		os=mint
1496937a2000SPeter Wemm		;;
1497*70b56f4bSCy Schubert	dicos*)
1498*70b56f4bSCy Schubert		os=dicos
1499937a2000SPeter Wemm		;;
1500*70b56f4bSCy Schubert	pikeos*)
1501bca4681bSCy Schubert		# Until real need of OS specific support for
1502bca4681bSCy Schubert		# particular features comes up, bare metal
1503bca4681bSCy Schubert		# configurations are quite functional.
1504*70b56f4bSCy Schubert		case $cpu in
1505bca4681bSCy Schubert		    arm*)
1506*70b56f4bSCy Schubert			os=eabi
1507bca4681bSCy Schubert			;;
1508bca4681bSCy Schubert		    *)
1509*70b56f4bSCy Schubert			os=elf
1510bca4681bSCy Schubert			;;
1511bca4681bSCy Schubert		esac
1512bca4681bSCy Schubert		;;
1513937a2000SPeter Wemm	*)
1514*70b56f4bSCy Schubert		# No normalization, but not necessarily accepted, that comes below.
1515937a2000SPeter Wemm		;;
1516937a2000SPeter Wemmesac
1517*70b56f4bSCy Schubert
1518937a2000SPeter Wemmelse
1519937a2000SPeter Wemm
1520937a2000SPeter Wemm# Here we handle the default operating systems that come with various machines.
1521937a2000SPeter Wemm# The value should be what the vendor currently ships out the door with their
1522937a2000SPeter Wemm# machine or put another way, the most popular os provided with the machine.
1523937a2000SPeter Wemm
1524937a2000SPeter Wemm# Note that if you're going to try to match "-MANUFACTURER" here (say,
1525937a2000SPeter Wemm# "-sun"), then you have to tell the case statement up towards the top
1526937a2000SPeter Wemm# that MANUFACTURER isn't an operating system.  Otherwise, code above
1527937a2000SPeter Wemm# will signal an error saying that MANUFACTURER isn't an operating
1528937a2000SPeter Wemm# system, and we'll never get to this point.
1529937a2000SPeter Wemm
1530*70b56f4bSCy Schubertkernel=
1531*70b56f4bSCy Schubertcase $cpu-$vendor in
15328bc5c7c0SPeter Wemm	score-*)
1533*70b56f4bSCy Schubert		os=elf
15348bc5c7c0SPeter Wemm		;;
15358bc5c7c0SPeter Wemm	spu-*)
1536*70b56f4bSCy Schubert		os=elf
15378bc5c7c0SPeter Wemm		;;
1538937a2000SPeter Wemm	*-acorn)
1539*70b56f4bSCy Schubert		os=riscix1.2
1540937a2000SPeter Wemm		;;
1541937a2000SPeter Wemm	arm*-rebel)
1542*70b56f4bSCy Schubert		kernel=linux
1543*70b56f4bSCy Schubert		os=gnu
1544937a2000SPeter Wemm		;;
1545937a2000SPeter Wemm	arm*-semi)
1546*70b56f4bSCy Schubert		os=aout
1547937a2000SPeter Wemm		;;
1548937a2000SPeter Wemm	c4x-* | tic4x-*)
1549*70b56f4bSCy Schubert		os=coff
1550937a2000SPeter Wemm		;;
1551d915215eSBaptiste Daroussin	c8051-*)
1552*70b56f4bSCy Schubert		os=elf
1553*70b56f4bSCy Schubert		;;
1554*70b56f4bSCy Schubert	clipper-intergraph)
1555*70b56f4bSCy Schubert		os=clix
1556d915215eSBaptiste Daroussin		;;
1557d915215eSBaptiste Daroussin	hexagon-*)
1558*70b56f4bSCy Schubert		os=elf
1559d915215eSBaptiste Daroussin		;;
15608bc5c7c0SPeter Wemm	tic54x-*)
1561*70b56f4bSCy Schubert		os=coff
15628bc5c7c0SPeter Wemm		;;
15638bc5c7c0SPeter Wemm	tic55x-*)
1564*70b56f4bSCy Schubert		os=coff
15658bc5c7c0SPeter Wemm		;;
15668bc5c7c0SPeter Wemm	tic6x-*)
1567*70b56f4bSCy Schubert		os=coff
15688bc5c7c0SPeter Wemm		;;
1569937a2000SPeter Wemm	# This must come before the *-dec entry.
1570937a2000SPeter Wemm	pdp10-*)
1571*70b56f4bSCy Schubert		os=tops20
1572937a2000SPeter Wemm		;;
1573937a2000SPeter Wemm	pdp11-*)
1574*70b56f4bSCy Schubert		os=none
1575937a2000SPeter Wemm		;;
1576937a2000SPeter Wemm	*-dec | vax-*)
1577*70b56f4bSCy Schubert		os=ultrix4.2
1578937a2000SPeter Wemm		;;
1579937a2000SPeter Wemm	m68*-apollo)
1580*70b56f4bSCy Schubert		os=domain
1581937a2000SPeter Wemm		;;
1582937a2000SPeter Wemm	i386-sun)
1583*70b56f4bSCy Schubert		os=sunos4.0.2
1584937a2000SPeter Wemm		;;
1585937a2000SPeter Wemm	m68000-sun)
1586*70b56f4bSCy Schubert		os=sunos3
1587937a2000SPeter Wemm		;;
1588937a2000SPeter Wemm	m68*-cisco)
1589*70b56f4bSCy Schubert		os=aout
1590937a2000SPeter Wemm		;;
15918bc5c7c0SPeter Wemm	mep-*)
1592*70b56f4bSCy Schubert		os=elf
15938bc5c7c0SPeter Wemm		;;
1594937a2000SPeter Wemm	mips*-cisco)
1595*70b56f4bSCy Schubert		os=elf
1596937a2000SPeter Wemm		;;
1597937a2000SPeter Wemm	mips*-*)
1598*70b56f4bSCy Schubert		os=elf
1599937a2000SPeter Wemm		;;
1600937a2000SPeter Wemm	or32-*)
1601*70b56f4bSCy Schubert		os=coff
1602937a2000SPeter Wemm		;;
1603937a2000SPeter Wemm	*-tti)	# must be before sparc entry or we get the wrong os.
1604*70b56f4bSCy Schubert		os=sysv3
1605937a2000SPeter Wemm		;;
1606937a2000SPeter Wemm	sparc-* | *-sun)
1607*70b56f4bSCy Schubert		os=sunos4.1.1
1608937a2000SPeter Wemm		;;
1609bca4681bSCy Schubert	pru-*)
1610*70b56f4bSCy Schubert		os=elf
1611bca4681bSCy Schubert		;;
1612937a2000SPeter Wemm	*-be)
1613*70b56f4bSCy Schubert		os=beos
1614937a2000SPeter Wemm		;;
1615937a2000SPeter Wemm	*-ibm)
1616*70b56f4bSCy Schubert		os=aix
1617937a2000SPeter Wemm		;;
1618937a2000SPeter Wemm	*-knuth)
1619*70b56f4bSCy Schubert		os=mmixware
1620937a2000SPeter Wemm		;;
1621937a2000SPeter Wemm	*-wec)
1622*70b56f4bSCy Schubert		os=proelf
1623937a2000SPeter Wemm		;;
1624937a2000SPeter Wemm	*-winbond)
1625*70b56f4bSCy Schubert		os=proelf
1626937a2000SPeter Wemm		;;
1627937a2000SPeter Wemm	*-oki)
1628*70b56f4bSCy Schubert		os=proelf
1629937a2000SPeter Wemm		;;
1630937a2000SPeter Wemm	*-hp)
1631*70b56f4bSCy Schubert		os=hpux
1632937a2000SPeter Wemm		;;
1633937a2000SPeter Wemm	*-hitachi)
1634*70b56f4bSCy Schubert		os=hiux
1635937a2000SPeter Wemm		;;
1636937a2000SPeter Wemm	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1637*70b56f4bSCy Schubert		os=sysv
1638937a2000SPeter Wemm		;;
1639937a2000SPeter Wemm	*-cbm)
1640*70b56f4bSCy Schubert		os=amigaos
1641937a2000SPeter Wemm		;;
1642937a2000SPeter Wemm	*-dg)
1643*70b56f4bSCy Schubert		os=dgux
1644937a2000SPeter Wemm		;;
1645937a2000SPeter Wemm	*-dolphin)
1646*70b56f4bSCy Schubert		os=sysv3
1647937a2000SPeter Wemm		;;
1648937a2000SPeter Wemm	m68k-ccur)
1649*70b56f4bSCy Schubert		os=rtu
1650937a2000SPeter Wemm		;;
1651937a2000SPeter Wemm	m88k-omron*)
1652*70b56f4bSCy Schubert		os=luna
1653937a2000SPeter Wemm		;;
1654937a2000SPeter Wemm	*-next)
1655*70b56f4bSCy Schubert		os=nextstep
1656937a2000SPeter Wemm		;;
1657937a2000SPeter Wemm	*-sequent)
1658*70b56f4bSCy Schubert		os=ptx
1659937a2000SPeter Wemm		;;
1660937a2000SPeter Wemm	*-crds)
1661*70b56f4bSCy Schubert		os=unos
1662937a2000SPeter Wemm		;;
1663937a2000SPeter Wemm	*-ns)
1664*70b56f4bSCy Schubert		os=genix
1665937a2000SPeter Wemm		;;
1666937a2000SPeter Wemm	i370-*)
1667*70b56f4bSCy Schubert		os=mvs
1668937a2000SPeter Wemm		;;
1669937a2000SPeter Wemm	*-gould)
1670*70b56f4bSCy Schubert		os=sysv
1671937a2000SPeter Wemm		;;
1672937a2000SPeter Wemm	*-highlevel)
1673*70b56f4bSCy Schubert		os=bsd
1674937a2000SPeter Wemm		;;
1675937a2000SPeter Wemm	*-encore)
1676*70b56f4bSCy Schubert		os=bsd
1677937a2000SPeter Wemm		;;
1678937a2000SPeter Wemm	*-sgi)
1679*70b56f4bSCy Schubert		os=irix
1680937a2000SPeter Wemm		;;
1681937a2000SPeter Wemm	*-siemens)
1682*70b56f4bSCy Schubert		os=sysv4
1683937a2000SPeter Wemm		;;
1684937a2000SPeter Wemm	*-masscomp)
1685*70b56f4bSCy Schubert		os=rtu
1686937a2000SPeter Wemm		;;
1687937a2000SPeter Wemm	f30[01]-fujitsu | f700-fujitsu)
1688*70b56f4bSCy Schubert		os=uxpv
1689937a2000SPeter Wemm		;;
1690937a2000SPeter Wemm	*-rom68k)
1691*70b56f4bSCy Schubert		os=coff
1692937a2000SPeter Wemm		;;
1693937a2000SPeter Wemm	*-*bug)
1694*70b56f4bSCy Schubert		os=coff
1695937a2000SPeter Wemm		;;
1696937a2000SPeter Wemm	*-apple)
1697*70b56f4bSCy Schubert		os=macos
1698937a2000SPeter Wemm		;;
1699937a2000SPeter Wemm	*-atari*)
1700*70b56f4bSCy Schubert		os=mint
1701*70b56f4bSCy Schubert		;;
1702*70b56f4bSCy Schubert	*-wrs)
1703*70b56f4bSCy Schubert		os=vxworks
1704937a2000SPeter Wemm		;;
1705937a2000SPeter Wemm	*)
1706*70b56f4bSCy Schubert		os=none
1707937a2000SPeter Wemm		;;
1708937a2000SPeter Wemmesac
1709*70b56f4bSCy Schubert
1710937a2000SPeter Wemmfi
1711937a2000SPeter Wemm
1712*70b56f4bSCy Schubert# Now, validate our (potentially fixed-up) OS.
1713*70b56f4bSCy Schubertcase $os in
1714*70b56f4bSCy Schubert	# Sometimes we do "kernel-libc", so those need to count as OSes.
1715*70b56f4bSCy Schubert	musl* | newlib* | relibc* | uclibc*)
1716*70b56f4bSCy Schubert		;;
1717*70b56f4bSCy Schubert	# Likewise for "kernel-abi"
1718*70b56f4bSCy Schubert	eabi* | gnueabi*)
1719*70b56f4bSCy Schubert		;;
1720*70b56f4bSCy Schubert	# VxWorks passes extra cpu info in the 4th filed.
1721*70b56f4bSCy Schubert	simlinux | simwindows | spe)
1722*70b56f4bSCy Schubert		;;
1723*70b56f4bSCy Schubert	# Now accept the basic system types.
1724*70b56f4bSCy Schubert	# The portable systems comes first.
1725*70b56f4bSCy Schubert	# Each alternative MUST end in a * to match a version number.
1726*70b56f4bSCy Schubert	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1727*70b56f4bSCy Schubert	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1728*70b56f4bSCy Schubert	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1729*70b56f4bSCy Schubert	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1730*70b56f4bSCy Schubert	     | hiux* | abug | nacl* | netware* | windows* \
1731*70b56f4bSCy Schubert	     | os9* | macos* | osx* | ios* \
1732*70b56f4bSCy Schubert	     | mpw* | magic* | mmixware* | mon960* | lnews* \
1733*70b56f4bSCy Schubert	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1734*70b56f4bSCy Schubert	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
1735*70b56f4bSCy Schubert	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1736*70b56f4bSCy Schubert	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1737*70b56f4bSCy Schubert	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1738*70b56f4bSCy Schubert	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1739*70b56f4bSCy Schubert	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1740*70b56f4bSCy Schubert	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1741*70b56f4bSCy Schubert	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1742*70b56f4bSCy Schubert	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
1743*70b56f4bSCy Schubert	     | chorusrdb* | cegcc* | glidix* | serenity* \
1744*70b56f4bSCy Schubert	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1745*70b56f4bSCy Schubert	     | midipix* | mingw32* | mingw64* | mint* \
1746*70b56f4bSCy Schubert	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1747*70b56f4bSCy Schubert	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1748*70b56f4bSCy Schubert	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1749*70b56f4bSCy Schubert	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1750*70b56f4bSCy Schubert	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1751*70b56f4bSCy Schubert	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1752*70b56f4bSCy Schubert	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1753*70b56f4bSCy Schubert	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1754*70b56f4bSCy Schubert	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1755*70b56f4bSCy Schubert	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1756*70b56f4bSCy Schubert	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1757*70b56f4bSCy Schubert	     | fiwix* )
1758*70b56f4bSCy Schubert		;;
1759*70b56f4bSCy Schubert	# This one is extra strict with allowed versions
1760*70b56f4bSCy Schubert	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1761*70b56f4bSCy Schubert		# Don't forget version if it is 3.2v4 or newer.
1762*70b56f4bSCy Schubert		;;
1763*70b56f4bSCy Schubert	none)
1764*70b56f4bSCy Schubert		;;
1765*70b56f4bSCy Schubert	*)
1766*70b56f4bSCy Schubert		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1767*70b56f4bSCy Schubert		exit 1
1768*70b56f4bSCy Schubert		;;
1769*70b56f4bSCy Schubertesac
1770*70b56f4bSCy Schubert
1771*70b56f4bSCy Schubert# As a final step for OS-related things, validate the OS-kernel combination
1772*70b56f4bSCy Schubert# (given a valid OS), if there is a kernel.
1773*70b56f4bSCy Schubertcase $kernel-$os in
1774*70b56f4bSCy Schubert	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1775*70b56f4bSCy Schubert		   | linux-musl* | linux-relibc* | linux-uclibc* )
1776*70b56f4bSCy Schubert		;;
1777*70b56f4bSCy Schubert	uclinux-uclibc* )
1778*70b56f4bSCy Schubert		;;
1779*70b56f4bSCy Schubert	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
1780*70b56f4bSCy Schubert		# These are just libc implementations, not actual OSes, and thus
1781*70b56f4bSCy Schubert		# require a kernel.
1782*70b56f4bSCy Schubert		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1783*70b56f4bSCy Schubert		exit 1
1784*70b56f4bSCy Schubert		;;
1785*70b56f4bSCy Schubert	kfreebsd*-gnu* | kopensolaris*-gnu*)
1786*70b56f4bSCy Schubert		;;
1787*70b56f4bSCy Schubert	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1788*70b56f4bSCy Schubert		;;
1789*70b56f4bSCy Schubert	nto-qnx*)
1790*70b56f4bSCy Schubert		;;
1791*70b56f4bSCy Schubert	os2-emx)
1792*70b56f4bSCy Schubert		;;
1793*70b56f4bSCy Schubert	*-eabi* | *-gnueabi*)
1794*70b56f4bSCy Schubert		;;
1795*70b56f4bSCy Schubert	-*)
1796*70b56f4bSCy Schubert		# Blank kernel with real OS is always fine.
1797*70b56f4bSCy Schubert		;;
1798*70b56f4bSCy Schubert	*-*)
1799*70b56f4bSCy Schubert		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1800*70b56f4bSCy Schubert		exit 1
1801*70b56f4bSCy Schubert		;;
1802*70b56f4bSCy Schubertesac
1803*70b56f4bSCy Schubert
1804937a2000SPeter Wemm# Here we handle the case where we know the os, and the CPU type, but not the
1805937a2000SPeter Wemm# manufacturer.  We pick the logical manufacturer.
1806*70b56f4bSCy Schubertcase $vendor in
1807*70b56f4bSCy Schubert	unknown)
1808*70b56f4bSCy Schubert		case $cpu-$os in
1809*70b56f4bSCy Schubert			*-riscix*)
1810937a2000SPeter Wemm				vendor=acorn
1811937a2000SPeter Wemm				;;
1812*70b56f4bSCy Schubert			*-sunos*)
1813937a2000SPeter Wemm				vendor=sun
1814937a2000SPeter Wemm				;;
1815*70b56f4bSCy Schubert			*-cnk* | *-aix*)
1816937a2000SPeter Wemm				vendor=ibm
1817937a2000SPeter Wemm				;;
1818*70b56f4bSCy Schubert			*-beos*)
1819937a2000SPeter Wemm				vendor=be
1820937a2000SPeter Wemm				;;
1821*70b56f4bSCy Schubert			*-hpux*)
1822937a2000SPeter Wemm				vendor=hp
1823937a2000SPeter Wemm				;;
1824*70b56f4bSCy Schubert			*-mpeix*)
1825937a2000SPeter Wemm				vendor=hp
1826937a2000SPeter Wemm				;;
1827*70b56f4bSCy Schubert			*-hiux*)
1828937a2000SPeter Wemm				vendor=hitachi
1829937a2000SPeter Wemm				;;
1830*70b56f4bSCy Schubert			*-unos*)
1831937a2000SPeter Wemm				vendor=crds
1832937a2000SPeter Wemm				;;
1833*70b56f4bSCy Schubert			*-dgux*)
1834937a2000SPeter Wemm				vendor=dg
1835937a2000SPeter Wemm				;;
1836*70b56f4bSCy Schubert			*-luna*)
1837937a2000SPeter Wemm				vendor=omron
1838937a2000SPeter Wemm				;;
1839*70b56f4bSCy Schubert			*-genix*)
1840937a2000SPeter Wemm				vendor=ns
1841937a2000SPeter Wemm				;;
1842*70b56f4bSCy Schubert			*-clix*)
1843*70b56f4bSCy Schubert				vendor=intergraph
1844*70b56f4bSCy Schubert				;;
1845*70b56f4bSCy Schubert			*-mvs* | *-opened*)
1846937a2000SPeter Wemm				vendor=ibm
1847937a2000SPeter Wemm				;;
1848*70b56f4bSCy Schubert			*-os400*)
1849937a2000SPeter Wemm				vendor=ibm
1850937a2000SPeter Wemm				;;
1851*70b56f4bSCy Schubert			s390-* | s390x-*)
1852*70b56f4bSCy Schubert				vendor=ibm
1853*70b56f4bSCy Schubert				;;
1854*70b56f4bSCy Schubert			*-ptx*)
1855937a2000SPeter Wemm				vendor=sequent
1856937a2000SPeter Wemm				;;
1857*70b56f4bSCy Schubert			*-tpf*)
1858937a2000SPeter Wemm				vendor=ibm
1859937a2000SPeter Wemm				;;
1860*70b56f4bSCy Schubert			*-vxsim* | *-vxworks* | *-windiss*)
1861937a2000SPeter Wemm				vendor=wrs
1862937a2000SPeter Wemm				;;
1863*70b56f4bSCy Schubert			*-aux*)
1864937a2000SPeter Wemm				vendor=apple
1865937a2000SPeter Wemm				;;
1866*70b56f4bSCy Schubert			*-hms*)
1867937a2000SPeter Wemm				vendor=hitachi
1868937a2000SPeter Wemm				;;
1869*70b56f4bSCy Schubert			*-mpw* | *-macos*)
1870937a2000SPeter Wemm				vendor=apple
1871937a2000SPeter Wemm				;;
1872*70b56f4bSCy Schubert			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1873937a2000SPeter Wemm				vendor=atari
1874937a2000SPeter Wemm				;;
1875*70b56f4bSCy Schubert			*-vos*)
1876937a2000SPeter Wemm				vendor=stratus
1877937a2000SPeter Wemm				;;
1878937a2000SPeter Wemm		esac
1879937a2000SPeter Wemm		;;
1880937a2000SPeter Wemmesac
1881937a2000SPeter Wemm
1882*70b56f4bSCy Schubertecho "$cpu-$vendor-${kernel:+$kernel-}$os"
1883937a2000SPeter Wemmexit
1884937a2000SPeter Wemm
1885937a2000SPeter Wemm# Local variables:
1886*70b56f4bSCy Schubert# eval: (add-hook 'before-save-hook 'time-stamp)
1887937a2000SPeter Wemm# time-stamp-start: "timestamp='"
1888937a2000SPeter Wemm# time-stamp-format: "%:y-%02m-%02d"
1889937a2000SPeter Wemm# time-stamp-end: "'"
1890937a2000SPeter Wemm# End:
1891