xref: /aosp_15_r20/external/mtools/config.sub (revision d5c9a868b113e0ec0db2f27bc2ce8a253e77c4b0)
1*d5c9a868SElliott Hughes#! /bin/sh
2*d5c9a868SElliott Hughes# Configuration validation subroutine script.
3*d5c9a868SElliott Hughes#   Copyright 1992-2022 Free Software Foundation, Inc.
4*d5c9a868SElliott Hughes
5*d5c9a868SElliott Hughes# shellcheck disable=SC2006,SC2268 # see below for rationale
6*d5c9a868SElliott Hughes
7*d5c9a868SElliott Hughestimestamp='2022-01-03'
8*d5c9a868SElliott Hughes
9*d5c9a868SElliott Hughes# This file is free software; you can redistribute it and/or modify it
10*d5c9a868SElliott Hughes# under the terms of the GNU General Public License as published by
11*d5c9a868SElliott Hughes# the Free Software Foundation, either version 3 of the License, or
12*d5c9a868SElliott Hughes# (at your option) any later version.
13*d5c9a868SElliott Hughes#
14*d5c9a868SElliott Hughes# This program is distributed in the hope that it will be useful, but
15*d5c9a868SElliott Hughes# WITHOUT ANY WARRANTY; without even the implied warranty of
16*d5c9a868SElliott Hughes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17*d5c9a868SElliott Hughes# General Public License for more details.
18*d5c9a868SElliott Hughes#
19*d5c9a868SElliott Hughes# You should have received a copy of the GNU General Public License
20*d5c9a868SElliott Hughes# along with this program; if not, see <https://www.gnu.org/licenses/>.
21*d5c9a868SElliott Hughes#
22*d5c9a868SElliott Hughes# As a special exception to the GNU General Public License, if you
23*d5c9a868SElliott Hughes# distribute this file as part of a program that contains a
24*d5c9a868SElliott Hughes# configuration script generated by Autoconf, you may include it under
25*d5c9a868SElliott Hughes# the same distribution terms that you use for the rest of that
26*d5c9a868SElliott Hughes# program.  This Exception is an additional permission under section 7
27*d5c9a868SElliott Hughes# of the GNU General Public License, version 3 ("GPLv3").
28*d5c9a868SElliott Hughes
29*d5c9a868SElliott Hughes
30*d5c9a868SElliott Hughes# Please send patches to <[email protected]>.
31*d5c9a868SElliott Hughes#
32*d5c9a868SElliott Hughes# Configuration subroutine to validate and canonicalize a configuration type.
33*d5c9a868SElliott Hughes# Supply the specified configuration type as an argument.
34*d5c9a868SElliott Hughes# If it is invalid, we print an error message on stderr and exit with code 1.
35*d5c9a868SElliott Hughes# Otherwise, we print the canonical config type on stdout and succeed.
36*d5c9a868SElliott Hughes
37*d5c9a868SElliott Hughes# You can get the latest version of this script from:
38*d5c9a868SElliott Hughes# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
39*d5c9a868SElliott Hughes
40*d5c9a868SElliott Hughes# This file is supposed to be the same for all GNU packages
41*d5c9a868SElliott Hughes# and recognize all the CPU types, system types and aliases
42*d5c9a868SElliott Hughes# that are meaningful with *any* GNU software.
43*d5c9a868SElliott Hughes# Each package is responsible for reporting which valid configurations
44*d5c9a868SElliott Hughes# it does not support.  The user should be able to distinguish
45*d5c9a868SElliott Hughes# a failure to support a valid configuration from a meaningless
46*d5c9a868SElliott Hughes# configuration.
47*d5c9a868SElliott Hughes
48*d5c9a868SElliott Hughes# The goal of this file is to map all the various variations of a given
49*d5c9a868SElliott Hughes# machine specification into a single specification in the form:
50*d5c9a868SElliott Hughes#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
51*d5c9a868SElliott Hughes# or in some cases, the newer four-part form:
52*d5c9a868SElliott Hughes#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
53*d5c9a868SElliott Hughes# It is wrong to echo any other type of specification.
54*d5c9a868SElliott Hughes
55*d5c9a868SElliott Hughes# The "shellcheck disable" line above the timestamp inhibits complaints
56*d5c9a868SElliott Hughes# about features and limitations of the classic Bourne shell that were
57*d5c9a868SElliott Hughes# superseded or lifted in POSIX.  However, this script identifies a wide
58*d5c9a868SElliott Hughes# variety of pre-POSIX systems that do not have POSIX shells at all, and
59*d5c9a868SElliott Hughes# even some reasonably current systems (Solaris 10 as case-in-point) still
60*d5c9a868SElliott Hughes# have a pre-POSIX /bin/sh.
61*d5c9a868SElliott Hughes
62*d5c9a868SElliott Hughesme=`echo "$0" | sed -e 's,.*/,,'`
63*d5c9a868SElliott Hughes
64*d5c9a868SElliott Hughesusage="\
65*d5c9a868SElliott HughesUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
66*d5c9a868SElliott Hughes
67*d5c9a868SElliott HughesCanonicalize a configuration name.
68*d5c9a868SElliott Hughes
69*d5c9a868SElliott HughesOptions:
70*d5c9a868SElliott Hughes  -h, --help         print this help, then exit
71*d5c9a868SElliott Hughes  -t, --time-stamp   print date of last modification, then exit
72*d5c9a868SElliott Hughes  -v, --version      print version number, then exit
73*d5c9a868SElliott Hughes
74*d5c9a868SElliott HughesReport bugs and patches to <[email protected]>."
75*d5c9a868SElliott Hughes
76*d5c9a868SElliott Hughesversion="\
77*d5c9a868SElliott HughesGNU config.sub ($timestamp)
78*d5c9a868SElliott Hughes
79*d5c9a868SElliott HughesCopyright 1992-2022 Free Software Foundation, Inc.
80*d5c9a868SElliott Hughes
81*d5c9a868SElliott HughesThis is free software; see the source for copying conditions.  There is NO
82*d5c9a868SElliott Hugheswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83*d5c9a868SElliott Hughes
84*d5c9a868SElliott Hugheshelp="
85*d5c9a868SElliott HughesTry \`$me --help' for more information."
86*d5c9a868SElliott Hughes
87*d5c9a868SElliott Hughes# Parse command line
88*d5c9a868SElliott Hugheswhile test $# -gt 0 ; do
89*d5c9a868SElliott Hughes  case $1 in
90*d5c9a868SElliott Hughes    --time-stamp | --time* | -t )
91*d5c9a868SElliott Hughes       echo "$timestamp" ; exit ;;
92*d5c9a868SElliott Hughes    --version | -v )
93*d5c9a868SElliott Hughes       echo "$version" ; exit ;;
94*d5c9a868SElliott Hughes    --help | --h* | -h )
95*d5c9a868SElliott Hughes       echo "$usage"; exit ;;
96*d5c9a868SElliott Hughes    -- )     # Stop option processing
97*d5c9a868SElliott Hughes       shift; break ;;
98*d5c9a868SElliott Hughes    - )	# Use stdin as input.
99*d5c9a868SElliott Hughes       break ;;
100*d5c9a868SElliott Hughes    -* )
101*d5c9a868SElliott Hughes       echo "$me: invalid option $1$help" >&2
102*d5c9a868SElliott Hughes       exit 1 ;;
103*d5c9a868SElliott Hughes
104*d5c9a868SElliott Hughes    *local*)
105*d5c9a868SElliott Hughes       # First pass through any local machine types.
106*d5c9a868SElliott Hughes       echo "$1"
107*d5c9a868SElliott Hughes       exit ;;
108*d5c9a868SElliott Hughes
109*d5c9a868SElliott Hughes    * )
110*d5c9a868SElliott Hughes       break ;;
111*d5c9a868SElliott Hughes  esac
112*d5c9a868SElliott Hughesdone
113*d5c9a868SElliott Hughes
114*d5c9a868SElliott Hughescase $# in
115*d5c9a868SElliott Hughes 0) echo "$me: missing argument$help" >&2
116*d5c9a868SElliott Hughes    exit 1;;
117*d5c9a868SElliott Hughes 1) ;;
118*d5c9a868SElliott Hughes *) echo "$me: too many arguments$help" >&2
119*d5c9a868SElliott Hughes    exit 1;;
120*d5c9a868SElliott Hughesesac
121*d5c9a868SElliott Hughes
122*d5c9a868SElliott Hughes# Split fields of configuration type
123*d5c9a868SElliott Hughes# shellcheck disable=SC2162
124*d5c9a868SElliott Hughessaved_IFS=$IFS
125*d5c9a868SElliott HughesIFS="-" read field1 field2 field3 field4 <<EOF
126*d5c9a868SElliott Hughes$1
127*d5c9a868SElliott HughesEOF
128*d5c9a868SElliott HughesIFS=$saved_IFS
129*d5c9a868SElliott Hughes
130*d5c9a868SElliott Hughes# Separate into logical components for further validation
131*d5c9a868SElliott Hughescase $1 in
132*d5c9a868SElliott Hughes	*-*-*-*-*)
133*d5c9a868SElliott Hughes		echo Invalid configuration \`"$1"\': more than four components >&2
134*d5c9a868SElliott Hughes		exit 1
135*d5c9a868SElliott Hughes		;;
136*d5c9a868SElliott Hughes	*-*-*-*)
137*d5c9a868SElliott Hughes		basic_machine=$field1-$field2
138*d5c9a868SElliott Hughes		basic_os=$field3-$field4
139*d5c9a868SElliott Hughes		;;
140*d5c9a868SElliott Hughes	*-*-*)
141*d5c9a868SElliott Hughes		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
142*d5c9a868SElliott Hughes		# parts
143*d5c9a868SElliott Hughes		maybe_os=$field2-$field3
144*d5c9a868SElliott Hughes		case $maybe_os in
145*d5c9a868SElliott Hughes			nto-qnx* | linux-* | uclinux-uclibc* \
146*d5c9a868SElliott Hughes			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
147*d5c9a868SElliott Hughes			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
148*d5c9a868SElliott Hughes			| storm-chaos* | os2-emx* | rtmk-nova*)
149*d5c9a868SElliott Hughes				basic_machine=$field1
150*d5c9a868SElliott Hughes				basic_os=$maybe_os
151*d5c9a868SElliott Hughes				;;
152*d5c9a868SElliott Hughes			android-linux)
153*d5c9a868SElliott Hughes				basic_machine=$field1-unknown
154*d5c9a868SElliott Hughes				basic_os=linux-android
155*d5c9a868SElliott Hughes				;;
156*d5c9a868SElliott Hughes			*)
157*d5c9a868SElliott Hughes				basic_machine=$field1-$field2
158*d5c9a868SElliott Hughes				basic_os=$field3
159*d5c9a868SElliott Hughes				;;
160*d5c9a868SElliott Hughes		esac
161*d5c9a868SElliott Hughes		;;
162*d5c9a868SElliott Hughes	*-*)
163*d5c9a868SElliott Hughes		# A lone config we happen to match not fitting any pattern
164*d5c9a868SElliott Hughes		case $field1-$field2 in
165*d5c9a868SElliott Hughes			decstation-3100)
166*d5c9a868SElliott Hughes				basic_machine=mips-dec
167*d5c9a868SElliott Hughes				basic_os=
168*d5c9a868SElliott Hughes				;;
169*d5c9a868SElliott Hughes			*-*)
170*d5c9a868SElliott Hughes				# Second component is usually, but not always the OS
171*d5c9a868SElliott Hughes				case $field2 in
172*d5c9a868SElliott Hughes					# Prevent following clause from handling this valid os
173*d5c9a868SElliott Hughes					sun*os*)
174*d5c9a868SElliott Hughes						basic_machine=$field1
175*d5c9a868SElliott Hughes						basic_os=$field2
176*d5c9a868SElliott Hughes						;;
177*d5c9a868SElliott Hughes					zephyr*)
178*d5c9a868SElliott Hughes						basic_machine=$field1-unknown
179*d5c9a868SElliott Hughes						basic_os=$field2
180*d5c9a868SElliott Hughes						;;
181*d5c9a868SElliott Hughes					# Manufacturers
182*d5c9a868SElliott Hughes					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
183*d5c9a868SElliott Hughes					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
184*d5c9a868SElliott Hughes					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
185*d5c9a868SElliott Hughes					| convergent* | ncr* | news | 32* | 3600* | 3100* \
186*d5c9a868SElliott Hughes					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
187*d5c9a868SElliott Hughes					| ultra | tti* | harris | dolphin | highlevel | gould \
188*d5c9a868SElliott Hughes					| cbm | ns | masscomp | apple | axis | knuth | cray \
189*d5c9a868SElliott Hughes					| microblaze* | sim | cisco \
190*d5c9a868SElliott Hughes					| oki | wec | wrs | winbond)
191*d5c9a868SElliott Hughes						basic_machine=$field1-$field2
192*d5c9a868SElliott Hughes						basic_os=
193*d5c9a868SElliott Hughes						;;
194*d5c9a868SElliott Hughes					*)
195*d5c9a868SElliott Hughes						basic_machine=$field1
196*d5c9a868SElliott Hughes						basic_os=$field2
197*d5c9a868SElliott Hughes						;;
198*d5c9a868SElliott Hughes				esac
199*d5c9a868SElliott Hughes			;;
200*d5c9a868SElliott Hughes		esac
201*d5c9a868SElliott Hughes		;;
202*d5c9a868SElliott Hughes	*)
203*d5c9a868SElliott Hughes		# Convert single-component short-hands not valid as part of
204*d5c9a868SElliott Hughes		# multi-component configurations.
205*d5c9a868SElliott Hughes		case $field1 in
206*d5c9a868SElliott Hughes			386bsd)
207*d5c9a868SElliott Hughes				basic_machine=i386-pc
208*d5c9a868SElliott Hughes				basic_os=bsd
209*d5c9a868SElliott Hughes				;;
210*d5c9a868SElliott Hughes			a29khif)
211*d5c9a868SElliott Hughes				basic_machine=a29k-amd
212*d5c9a868SElliott Hughes				basic_os=udi
213*d5c9a868SElliott Hughes				;;
214*d5c9a868SElliott Hughes			adobe68k)
215*d5c9a868SElliott Hughes				basic_machine=m68010-adobe
216*d5c9a868SElliott Hughes				basic_os=scout
217*d5c9a868SElliott Hughes				;;
218*d5c9a868SElliott Hughes			alliant)
219*d5c9a868SElliott Hughes				basic_machine=fx80-alliant
220*d5c9a868SElliott Hughes				basic_os=
221*d5c9a868SElliott Hughes				;;
222*d5c9a868SElliott Hughes			altos | altos3068)
223*d5c9a868SElliott Hughes				basic_machine=m68k-altos
224*d5c9a868SElliott Hughes				basic_os=
225*d5c9a868SElliott Hughes				;;
226*d5c9a868SElliott Hughes			am29k)
227*d5c9a868SElliott Hughes				basic_machine=a29k-none
228*d5c9a868SElliott Hughes				basic_os=bsd
229*d5c9a868SElliott Hughes				;;
230*d5c9a868SElliott Hughes			amdahl)
231*d5c9a868SElliott Hughes				basic_machine=580-amdahl
232*d5c9a868SElliott Hughes				basic_os=sysv
233*d5c9a868SElliott Hughes				;;
234*d5c9a868SElliott Hughes			amiga)
235*d5c9a868SElliott Hughes				basic_machine=m68k-unknown
236*d5c9a868SElliott Hughes				basic_os=
237*d5c9a868SElliott Hughes				;;
238*d5c9a868SElliott Hughes			amigaos | amigados)
239*d5c9a868SElliott Hughes				basic_machine=m68k-unknown
240*d5c9a868SElliott Hughes				basic_os=amigaos
241*d5c9a868SElliott Hughes				;;
242*d5c9a868SElliott Hughes			amigaunix | amix)
243*d5c9a868SElliott Hughes				basic_machine=m68k-unknown
244*d5c9a868SElliott Hughes				basic_os=sysv4
245*d5c9a868SElliott Hughes				;;
246*d5c9a868SElliott Hughes			apollo68)
247*d5c9a868SElliott Hughes				basic_machine=m68k-apollo
248*d5c9a868SElliott Hughes				basic_os=sysv
249*d5c9a868SElliott Hughes				;;
250*d5c9a868SElliott Hughes			apollo68bsd)
251*d5c9a868SElliott Hughes				basic_machine=m68k-apollo
252*d5c9a868SElliott Hughes				basic_os=bsd
253*d5c9a868SElliott Hughes				;;
254*d5c9a868SElliott Hughes			aros)
255*d5c9a868SElliott Hughes				basic_machine=i386-pc
256*d5c9a868SElliott Hughes				basic_os=aros
257*d5c9a868SElliott Hughes				;;
258*d5c9a868SElliott Hughes			aux)
259*d5c9a868SElliott Hughes				basic_machine=m68k-apple
260*d5c9a868SElliott Hughes				basic_os=aux
261*d5c9a868SElliott Hughes				;;
262*d5c9a868SElliott Hughes			balance)
263*d5c9a868SElliott Hughes				basic_machine=ns32k-sequent
264*d5c9a868SElliott Hughes				basic_os=dynix
265*d5c9a868SElliott Hughes				;;
266*d5c9a868SElliott Hughes			blackfin)
267*d5c9a868SElliott Hughes				basic_machine=bfin-unknown
268*d5c9a868SElliott Hughes				basic_os=linux
269*d5c9a868SElliott Hughes				;;
270*d5c9a868SElliott Hughes			cegcc)
271*d5c9a868SElliott Hughes				basic_machine=arm-unknown
272*d5c9a868SElliott Hughes				basic_os=cegcc
273*d5c9a868SElliott Hughes				;;
274*d5c9a868SElliott Hughes			convex-c1)
275*d5c9a868SElliott Hughes				basic_machine=c1-convex
276*d5c9a868SElliott Hughes				basic_os=bsd
277*d5c9a868SElliott Hughes				;;
278*d5c9a868SElliott Hughes			convex-c2)
279*d5c9a868SElliott Hughes				basic_machine=c2-convex
280*d5c9a868SElliott Hughes				basic_os=bsd
281*d5c9a868SElliott Hughes				;;
282*d5c9a868SElliott Hughes			convex-c32)
283*d5c9a868SElliott Hughes				basic_machine=c32-convex
284*d5c9a868SElliott Hughes				basic_os=bsd
285*d5c9a868SElliott Hughes				;;
286*d5c9a868SElliott Hughes			convex-c34)
287*d5c9a868SElliott Hughes				basic_machine=c34-convex
288*d5c9a868SElliott Hughes				basic_os=bsd
289*d5c9a868SElliott Hughes				;;
290*d5c9a868SElliott Hughes			convex-c38)
291*d5c9a868SElliott Hughes				basic_machine=c38-convex
292*d5c9a868SElliott Hughes				basic_os=bsd
293*d5c9a868SElliott Hughes				;;
294*d5c9a868SElliott Hughes			cray)
295*d5c9a868SElliott Hughes				basic_machine=j90-cray
296*d5c9a868SElliott Hughes				basic_os=unicos
297*d5c9a868SElliott Hughes				;;
298*d5c9a868SElliott Hughes			crds | unos)
299*d5c9a868SElliott Hughes				basic_machine=m68k-crds
300*d5c9a868SElliott Hughes				basic_os=
301*d5c9a868SElliott Hughes				;;
302*d5c9a868SElliott Hughes			da30)
303*d5c9a868SElliott Hughes				basic_machine=m68k-da30
304*d5c9a868SElliott Hughes				basic_os=
305*d5c9a868SElliott Hughes				;;
306*d5c9a868SElliott Hughes			decstation | pmax | pmin | dec3100 | decstatn)
307*d5c9a868SElliott Hughes				basic_machine=mips-dec
308*d5c9a868SElliott Hughes				basic_os=
309*d5c9a868SElliott Hughes				;;
310*d5c9a868SElliott Hughes			delta88)
311*d5c9a868SElliott Hughes				basic_machine=m88k-motorola
312*d5c9a868SElliott Hughes				basic_os=sysv3
313*d5c9a868SElliott Hughes				;;
314*d5c9a868SElliott Hughes			dicos)
315*d5c9a868SElliott Hughes				basic_machine=i686-pc
316*d5c9a868SElliott Hughes				basic_os=dicos
317*d5c9a868SElliott Hughes				;;
318*d5c9a868SElliott Hughes			djgpp)
319*d5c9a868SElliott Hughes				basic_machine=i586-pc
320*d5c9a868SElliott Hughes				basic_os=msdosdjgpp
321*d5c9a868SElliott Hughes				;;
322*d5c9a868SElliott Hughes			ebmon29k)
323*d5c9a868SElliott Hughes				basic_machine=a29k-amd
324*d5c9a868SElliott Hughes				basic_os=ebmon
325*d5c9a868SElliott Hughes				;;
326*d5c9a868SElliott Hughes			es1800 | OSE68k | ose68k | ose | OSE)
327*d5c9a868SElliott Hughes				basic_machine=m68k-ericsson
328*d5c9a868SElliott Hughes				basic_os=ose
329*d5c9a868SElliott Hughes				;;
330*d5c9a868SElliott Hughes			gmicro)
331*d5c9a868SElliott Hughes				basic_machine=tron-gmicro
332*d5c9a868SElliott Hughes				basic_os=sysv
333*d5c9a868SElliott Hughes				;;
334*d5c9a868SElliott Hughes			go32)
335*d5c9a868SElliott Hughes				basic_machine=i386-pc
336*d5c9a868SElliott Hughes				basic_os=go32
337*d5c9a868SElliott Hughes				;;
338*d5c9a868SElliott Hughes			h8300hms)
339*d5c9a868SElliott Hughes				basic_machine=h8300-hitachi
340*d5c9a868SElliott Hughes				basic_os=hms
341*d5c9a868SElliott Hughes				;;
342*d5c9a868SElliott Hughes			h8300xray)
343*d5c9a868SElliott Hughes				basic_machine=h8300-hitachi
344*d5c9a868SElliott Hughes				basic_os=xray
345*d5c9a868SElliott Hughes				;;
346*d5c9a868SElliott Hughes			h8500hms)
347*d5c9a868SElliott Hughes				basic_machine=h8500-hitachi
348*d5c9a868SElliott Hughes				basic_os=hms
349*d5c9a868SElliott Hughes				;;
350*d5c9a868SElliott Hughes			harris)
351*d5c9a868SElliott Hughes				basic_machine=m88k-harris
352*d5c9a868SElliott Hughes				basic_os=sysv3
353*d5c9a868SElliott Hughes				;;
354*d5c9a868SElliott Hughes			hp300 | hp300hpux)
355*d5c9a868SElliott Hughes				basic_machine=m68k-hp
356*d5c9a868SElliott Hughes				basic_os=hpux
357*d5c9a868SElliott Hughes				;;
358*d5c9a868SElliott Hughes			hp300bsd)
359*d5c9a868SElliott Hughes				basic_machine=m68k-hp
360*d5c9a868SElliott Hughes				basic_os=bsd
361*d5c9a868SElliott Hughes				;;
362*d5c9a868SElliott Hughes			hppaosf)
363*d5c9a868SElliott Hughes				basic_machine=hppa1.1-hp
364*d5c9a868SElliott Hughes				basic_os=osf
365*d5c9a868SElliott Hughes				;;
366*d5c9a868SElliott Hughes			hppro)
367*d5c9a868SElliott Hughes				basic_machine=hppa1.1-hp
368*d5c9a868SElliott Hughes				basic_os=proelf
369*d5c9a868SElliott Hughes				;;
370*d5c9a868SElliott Hughes			i386mach)
371*d5c9a868SElliott Hughes				basic_machine=i386-mach
372*d5c9a868SElliott Hughes				basic_os=mach
373*d5c9a868SElliott Hughes				;;
374*d5c9a868SElliott Hughes			isi68 | isi)
375*d5c9a868SElliott Hughes				basic_machine=m68k-isi
376*d5c9a868SElliott Hughes				basic_os=sysv
377*d5c9a868SElliott Hughes				;;
378*d5c9a868SElliott Hughes			m68knommu)
379*d5c9a868SElliott Hughes				basic_machine=m68k-unknown
380*d5c9a868SElliott Hughes				basic_os=linux
381*d5c9a868SElliott Hughes				;;
382*d5c9a868SElliott Hughes			magnum | m3230)
383*d5c9a868SElliott Hughes				basic_machine=mips-mips
384*d5c9a868SElliott Hughes				basic_os=sysv
385*d5c9a868SElliott Hughes				;;
386*d5c9a868SElliott Hughes			merlin)
387*d5c9a868SElliott Hughes				basic_machine=ns32k-utek
388*d5c9a868SElliott Hughes				basic_os=sysv
389*d5c9a868SElliott Hughes				;;
390*d5c9a868SElliott Hughes			mingw64)
391*d5c9a868SElliott Hughes				basic_machine=x86_64-pc
392*d5c9a868SElliott Hughes				basic_os=mingw64
393*d5c9a868SElliott Hughes				;;
394*d5c9a868SElliott Hughes			mingw32)
395*d5c9a868SElliott Hughes				basic_machine=i686-pc
396*d5c9a868SElliott Hughes				basic_os=mingw32
397*d5c9a868SElliott Hughes				;;
398*d5c9a868SElliott Hughes			mingw32ce)
399*d5c9a868SElliott Hughes				basic_machine=arm-unknown
400*d5c9a868SElliott Hughes				basic_os=mingw32ce
401*d5c9a868SElliott Hughes				;;
402*d5c9a868SElliott Hughes			monitor)
403*d5c9a868SElliott Hughes				basic_machine=m68k-rom68k
404*d5c9a868SElliott Hughes				basic_os=coff
405*d5c9a868SElliott Hughes				;;
406*d5c9a868SElliott Hughes			morphos)
407*d5c9a868SElliott Hughes				basic_machine=powerpc-unknown
408*d5c9a868SElliott Hughes				basic_os=morphos
409*d5c9a868SElliott Hughes				;;
410*d5c9a868SElliott Hughes			moxiebox)
411*d5c9a868SElliott Hughes				basic_machine=moxie-unknown
412*d5c9a868SElliott Hughes				basic_os=moxiebox
413*d5c9a868SElliott Hughes				;;
414*d5c9a868SElliott Hughes			msdos)
415*d5c9a868SElliott Hughes				basic_machine=i386-pc
416*d5c9a868SElliott Hughes				basic_os=msdos
417*d5c9a868SElliott Hughes				;;
418*d5c9a868SElliott Hughes			msys)
419*d5c9a868SElliott Hughes				basic_machine=i686-pc
420*d5c9a868SElliott Hughes				basic_os=msys
421*d5c9a868SElliott Hughes				;;
422*d5c9a868SElliott Hughes			mvs)
423*d5c9a868SElliott Hughes				basic_machine=i370-ibm
424*d5c9a868SElliott Hughes				basic_os=mvs
425*d5c9a868SElliott Hughes				;;
426*d5c9a868SElliott Hughes			nacl)
427*d5c9a868SElliott Hughes				basic_machine=le32-unknown
428*d5c9a868SElliott Hughes				basic_os=nacl
429*d5c9a868SElliott Hughes				;;
430*d5c9a868SElliott Hughes			ncr3000)
431*d5c9a868SElliott Hughes				basic_machine=i486-ncr
432*d5c9a868SElliott Hughes				basic_os=sysv4
433*d5c9a868SElliott Hughes				;;
434*d5c9a868SElliott Hughes			netbsd386)
435*d5c9a868SElliott Hughes				basic_machine=i386-pc
436*d5c9a868SElliott Hughes				basic_os=netbsd
437*d5c9a868SElliott Hughes				;;
438*d5c9a868SElliott Hughes			netwinder)
439*d5c9a868SElliott Hughes				basic_machine=armv4l-rebel
440*d5c9a868SElliott Hughes				basic_os=linux
441*d5c9a868SElliott Hughes				;;
442*d5c9a868SElliott Hughes			news | news700 | news800 | news900)
443*d5c9a868SElliott Hughes				basic_machine=m68k-sony
444*d5c9a868SElliott Hughes				basic_os=newsos
445*d5c9a868SElliott Hughes				;;
446*d5c9a868SElliott Hughes			news1000)
447*d5c9a868SElliott Hughes				basic_machine=m68030-sony
448*d5c9a868SElliott Hughes				basic_os=newsos
449*d5c9a868SElliott Hughes				;;
450*d5c9a868SElliott Hughes			necv70)
451*d5c9a868SElliott Hughes				basic_machine=v70-nec
452*d5c9a868SElliott Hughes				basic_os=sysv
453*d5c9a868SElliott Hughes				;;
454*d5c9a868SElliott Hughes			nh3000)
455*d5c9a868SElliott Hughes				basic_machine=m68k-harris
456*d5c9a868SElliott Hughes				basic_os=cxux
457*d5c9a868SElliott Hughes				;;
458*d5c9a868SElliott Hughes			nh[45]000)
459*d5c9a868SElliott Hughes				basic_machine=m88k-harris
460*d5c9a868SElliott Hughes				basic_os=cxux
461*d5c9a868SElliott Hughes				;;
462*d5c9a868SElliott Hughes			nindy960)
463*d5c9a868SElliott Hughes				basic_machine=i960-intel
464*d5c9a868SElliott Hughes				basic_os=nindy
465*d5c9a868SElliott Hughes				;;
466*d5c9a868SElliott Hughes			mon960)
467*d5c9a868SElliott Hughes				basic_machine=i960-intel
468*d5c9a868SElliott Hughes				basic_os=mon960
469*d5c9a868SElliott Hughes				;;
470*d5c9a868SElliott Hughes			nonstopux)
471*d5c9a868SElliott Hughes				basic_machine=mips-compaq
472*d5c9a868SElliott Hughes				basic_os=nonstopux
473*d5c9a868SElliott Hughes				;;
474*d5c9a868SElliott Hughes			os400)
475*d5c9a868SElliott Hughes				basic_machine=powerpc-ibm
476*d5c9a868SElliott Hughes				basic_os=os400
477*d5c9a868SElliott Hughes				;;
478*d5c9a868SElliott Hughes			OSE68000 | ose68000)
479*d5c9a868SElliott Hughes				basic_machine=m68000-ericsson
480*d5c9a868SElliott Hughes				basic_os=ose
481*d5c9a868SElliott Hughes				;;
482*d5c9a868SElliott Hughes			os68k)
483*d5c9a868SElliott Hughes				basic_machine=m68k-none
484*d5c9a868SElliott Hughes				basic_os=os68k
485*d5c9a868SElliott Hughes				;;
486*d5c9a868SElliott Hughes			paragon)
487*d5c9a868SElliott Hughes				basic_machine=i860-intel
488*d5c9a868SElliott Hughes				basic_os=osf
489*d5c9a868SElliott Hughes				;;
490*d5c9a868SElliott Hughes			parisc)
491*d5c9a868SElliott Hughes				basic_machine=hppa-unknown
492*d5c9a868SElliott Hughes				basic_os=linux
493*d5c9a868SElliott Hughes				;;
494*d5c9a868SElliott Hughes			psp)
495*d5c9a868SElliott Hughes				basic_machine=mipsallegrexel-sony
496*d5c9a868SElliott Hughes				basic_os=psp
497*d5c9a868SElliott Hughes				;;
498*d5c9a868SElliott Hughes			pw32)
499*d5c9a868SElliott Hughes				basic_machine=i586-unknown
500*d5c9a868SElliott Hughes				basic_os=pw32
501*d5c9a868SElliott Hughes				;;
502*d5c9a868SElliott Hughes			rdos | rdos64)
503*d5c9a868SElliott Hughes				basic_machine=x86_64-pc
504*d5c9a868SElliott Hughes				basic_os=rdos
505*d5c9a868SElliott Hughes				;;
506*d5c9a868SElliott Hughes			rdos32)
507*d5c9a868SElliott Hughes				basic_machine=i386-pc
508*d5c9a868SElliott Hughes				basic_os=rdos
509*d5c9a868SElliott Hughes				;;
510*d5c9a868SElliott Hughes			rom68k)
511*d5c9a868SElliott Hughes				basic_machine=m68k-rom68k
512*d5c9a868SElliott Hughes				basic_os=coff
513*d5c9a868SElliott Hughes				;;
514*d5c9a868SElliott Hughes			sa29200)
515*d5c9a868SElliott Hughes				basic_machine=a29k-amd
516*d5c9a868SElliott Hughes				basic_os=udi
517*d5c9a868SElliott Hughes				;;
518*d5c9a868SElliott Hughes			sei)
519*d5c9a868SElliott Hughes				basic_machine=mips-sei
520*d5c9a868SElliott Hughes				basic_os=seiux
521*d5c9a868SElliott Hughes				;;
522*d5c9a868SElliott Hughes			sequent)
523*d5c9a868SElliott Hughes				basic_machine=i386-sequent
524*d5c9a868SElliott Hughes				basic_os=
525*d5c9a868SElliott Hughes				;;
526*d5c9a868SElliott Hughes			sps7)
527*d5c9a868SElliott Hughes				basic_machine=m68k-bull
528*d5c9a868SElliott Hughes				basic_os=sysv2
529*d5c9a868SElliott Hughes				;;
530*d5c9a868SElliott Hughes			st2000)
531*d5c9a868SElliott Hughes				basic_machine=m68k-tandem
532*d5c9a868SElliott Hughes				basic_os=
533*d5c9a868SElliott Hughes				;;
534*d5c9a868SElliott Hughes			stratus)
535*d5c9a868SElliott Hughes				basic_machine=i860-stratus
536*d5c9a868SElliott Hughes				basic_os=sysv4
537*d5c9a868SElliott Hughes				;;
538*d5c9a868SElliott Hughes			sun2)
539*d5c9a868SElliott Hughes				basic_machine=m68000-sun
540*d5c9a868SElliott Hughes				basic_os=
541*d5c9a868SElliott Hughes				;;
542*d5c9a868SElliott Hughes			sun2os3)
543*d5c9a868SElliott Hughes				basic_machine=m68000-sun
544*d5c9a868SElliott Hughes				basic_os=sunos3
545*d5c9a868SElliott Hughes				;;
546*d5c9a868SElliott Hughes			sun2os4)
547*d5c9a868SElliott Hughes				basic_machine=m68000-sun
548*d5c9a868SElliott Hughes				basic_os=sunos4
549*d5c9a868SElliott Hughes				;;
550*d5c9a868SElliott Hughes			sun3)
551*d5c9a868SElliott Hughes				basic_machine=m68k-sun
552*d5c9a868SElliott Hughes				basic_os=
553*d5c9a868SElliott Hughes				;;
554*d5c9a868SElliott Hughes			sun3os3)
555*d5c9a868SElliott Hughes				basic_machine=m68k-sun
556*d5c9a868SElliott Hughes				basic_os=sunos3
557*d5c9a868SElliott Hughes				;;
558*d5c9a868SElliott Hughes			sun3os4)
559*d5c9a868SElliott Hughes				basic_machine=m68k-sun
560*d5c9a868SElliott Hughes				basic_os=sunos4
561*d5c9a868SElliott Hughes				;;
562*d5c9a868SElliott Hughes			sun4)
563*d5c9a868SElliott Hughes				basic_machine=sparc-sun
564*d5c9a868SElliott Hughes				basic_os=
565*d5c9a868SElliott Hughes				;;
566*d5c9a868SElliott Hughes			sun4os3)
567*d5c9a868SElliott Hughes				basic_machine=sparc-sun
568*d5c9a868SElliott Hughes				basic_os=sunos3
569*d5c9a868SElliott Hughes				;;
570*d5c9a868SElliott Hughes			sun4os4)
571*d5c9a868SElliott Hughes				basic_machine=sparc-sun
572*d5c9a868SElliott Hughes				basic_os=sunos4
573*d5c9a868SElliott Hughes				;;
574*d5c9a868SElliott Hughes			sun4sol2)
575*d5c9a868SElliott Hughes				basic_machine=sparc-sun
576*d5c9a868SElliott Hughes				basic_os=solaris2
577*d5c9a868SElliott Hughes				;;
578*d5c9a868SElliott Hughes			sun386 | sun386i | roadrunner)
579*d5c9a868SElliott Hughes				basic_machine=i386-sun
580*d5c9a868SElliott Hughes				basic_os=
581*d5c9a868SElliott Hughes				;;
582*d5c9a868SElliott Hughes			sv1)
583*d5c9a868SElliott Hughes				basic_machine=sv1-cray
584*d5c9a868SElliott Hughes				basic_os=unicos
585*d5c9a868SElliott Hughes				;;
586*d5c9a868SElliott Hughes			symmetry)
587*d5c9a868SElliott Hughes				basic_machine=i386-sequent
588*d5c9a868SElliott Hughes				basic_os=dynix
589*d5c9a868SElliott Hughes				;;
590*d5c9a868SElliott Hughes			t3e)
591*d5c9a868SElliott Hughes				basic_machine=alphaev5-cray
592*d5c9a868SElliott Hughes				basic_os=unicos
593*d5c9a868SElliott Hughes				;;
594*d5c9a868SElliott Hughes			t90)
595*d5c9a868SElliott Hughes				basic_machine=t90-cray
596*d5c9a868SElliott Hughes				basic_os=unicos
597*d5c9a868SElliott Hughes				;;
598*d5c9a868SElliott Hughes			toad1)
599*d5c9a868SElliott Hughes				basic_machine=pdp10-xkl
600*d5c9a868SElliott Hughes				basic_os=tops20
601*d5c9a868SElliott Hughes				;;
602*d5c9a868SElliott Hughes			tpf)
603*d5c9a868SElliott Hughes				basic_machine=s390x-ibm
604*d5c9a868SElliott Hughes				basic_os=tpf
605*d5c9a868SElliott Hughes				;;
606*d5c9a868SElliott Hughes			udi29k)
607*d5c9a868SElliott Hughes				basic_machine=a29k-amd
608*d5c9a868SElliott Hughes				basic_os=udi
609*d5c9a868SElliott Hughes				;;
610*d5c9a868SElliott Hughes			ultra3)
611*d5c9a868SElliott Hughes				basic_machine=a29k-nyu
612*d5c9a868SElliott Hughes				basic_os=sym1
613*d5c9a868SElliott Hughes				;;
614*d5c9a868SElliott Hughes			v810 | necv810)
615*d5c9a868SElliott Hughes				basic_machine=v810-nec
616*d5c9a868SElliott Hughes				basic_os=none
617*d5c9a868SElliott Hughes				;;
618*d5c9a868SElliott Hughes			vaxv)
619*d5c9a868SElliott Hughes				basic_machine=vax-dec
620*d5c9a868SElliott Hughes				basic_os=sysv
621*d5c9a868SElliott Hughes				;;
622*d5c9a868SElliott Hughes			vms)
623*d5c9a868SElliott Hughes				basic_machine=vax-dec
624*d5c9a868SElliott Hughes				basic_os=vms
625*d5c9a868SElliott Hughes				;;
626*d5c9a868SElliott Hughes			vsta)
627*d5c9a868SElliott Hughes				basic_machine=i386-pc
628*d5c9a868SElliott Hughes				basic_os=vsta
629*d5c9a868SElliott Hughes				;;
630*d5c9a868SElliott Hughes			vxworks960)
631*d5c9a868SElliott Hughes				basic_machine=i960-wrs
632*d5c9a868SElliott Hughes				basic_os=vxworks
633*d5c9a868SElliott Hughes				;;
634*d5c9a868SElliott Hughes			vxworks68)
635*d5c9a868SElliott Hughes				basic_machine=m68k-wrs
636*d5c9a868SElliott Hughes				basic_os=vxworks
637*d5c9a868SElliott Hughes				;;
638*d5c9a868SElliott Hughes			vxworks29k)
639*d5c9a868SElliott Hughes				basic_machine=a29k-wrs
640*d5c9a868SElliott Hughes				basic_os=vxworks
641*d5c9a868SElliott Hughes				;;
642*d5c9a868SElliott Hughes			xbox)
643*d5c9a868SElliott Hughes				basic_machine=i686-pc
644*d5c9a868SElliott Hughes				basic_os=mingw32
645*d5c9a868SElliott Hughes				;;
646*d5c9a868SElliott Hughes			ymp)
647*d5c9a868SElliott Hughes				basic_machine=ymp-cray
648*d5c9a868SElliott Hughes				basic_os=unicos
649*d5c9a868SElliott Hughes				;;
650*d5c9a868SElliott Hughes			*)
651*d5c9a868SElliott Hughes				basic_machine=$1
652*d5c9a868SElliott Hughes				basic_os=
653*d5c9a868SElliott Hughes				;;
654*d5c9a868SElliott Hughes		esac
655*d5c9a868SElliott Hughes		;;
656*d5c9a868SElliott Hughesesac
657*d5c9a868SElliott Hughes
658*d5c9a868SElliott Hughes# Decode 1-component or ad-hoc basic machines
659*d5c9a868SElliott Hughescase $basic_machine in
660*d5c9a868SElliott Hughes	# Here we handle the default manufacturer of certain CPU types.  It is in
661*d5c9a868SElliott Hughes	# some cases the only manufacturer, in others, it is the most popular.
662*d5c9a868SElliott Hughes	w89k)
663*d5c9a868SElliott Hughes		cpu=hppa1.1
664*d5c9a868SElliott Hughes		vendor=winbond
665*d5c9a868SElliott Hughes		;;
666*d5c9a868SElliott Hughes	op50n)
667*d5c9a868SElliott Hughes		cpu=hppa1.1
668*d5c9a868SElliott Hughes		vendor=oki
669*d5c9a868SElliott Hughes		;;
670*d5c9a868SElliott Hughes	op60c)
671*d5c9a868SElliott Hughes		cpu=hppa1.1
672*d5c9a868SElliott Hughes		vendor=oki
673*d5c9a868SElliott Hughes		;;
674*d5c9a868SElliott Hughes	ibm*)
675*d5c9a868SElliott Hughes		cpu=i370
676*d5c9a868SElliott Hughes		vendor=ibm
677*d5c9a868SElliott Hughes		;;
678*d5c9a868SElliott Hughes	orion105)
679*d5c9a868SElliott Hughes		cpu=clipper
680*d5c9a868SElliott Hughes		vendor=highlevel
681*d5c9a868SElliott Hughes		;;
682*d5c9a868SElliott Hughes	mac | mpw | mac-mpw)
683*d5c9a868SElliott Hughes		cpu=m68k
684*d5c9a868SElliott Hughes		vendor=apple
685*d5c9a868SElliott Hughes		;;
686*d5c9a868SElliott Hughes	pmac | pmac-mpw)
687*d5c9a868SElliott Hughes		cpu=powerpc
688*d5c9a868SElliott Hughes		vendor=apple
689*d5c9a868SElliott Hughes		;;
690*d5c9a868SElliott Hughes
691*d5c9a868SElliott Hughes	# Recognize the various machine names and aliases which stand
692*d5c9a868SElliott Hughes	# for a CPU type and a company and sometimes even an OS.
693*d5c9a868SElliott Hughes	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
694*d5c9a868SElliott Hughes		cpu=m68000
695*d5c9a868SElliott Hughes		vendor=att
696*d5c9a868SElliott Hughes		;;
697*d5c9a868SElliott Hughes	3b*)
698*d5c9a868SElliott Hughes		cpu=we32k
699*d5c9a868SElliott Hughes		vendor=att
700*d5c9a868SElliott Hughes		;;
701*d5c9a868SElliott Hughes	bluegene*)
702*d5c9a868SElliott Hughes		cpu=powerpc
703*d5c9a868SElliott Hughes		vendor=ibm
704*d5c9a868SElliott Hughes		basic_os=cnk
705*d5c9a868SElliott Hughes		;;
706*d5c9a868SElliott Hughes	decsystem10* | dec10*)
707*d5c9a868SElliott Hughes		cpu=pdp10
708*d5c9a868SElliott Hughes		vendor=dec
709*d5c9a868SElliott Hughes		basic_os=tops10
710*d5c9a868SElliott Hughes		;;
711*d5c9a868SElliott Hughes	decsystem20* | dec20*)
712*d5c9a868SElliott Hughes		cpu=pdp10
713*d5c9a868SElliott Hughes		vendor=dec
714*d5c9a868SElliott Hughes		basic_os=tops20
715*d5c9a868SElliott Hughes		;;
716*d5c9a868SElliott Hughes	delta | 3300 | motorola-3300 | motorola-delta \
717*d5c9a868SElliott Hughes	      | 3300-motorola | delta-motorola)
718*d5c9a868SElliott Hughes		cpu=m68k
719*d5c9a868SElliott Hughes		vendor=motorola
720*d5c9a868SElliott Hughes		;;
721*d5c9a868SElliott Hughes	dpx2*)
722*d5c9a868SElliott Hughes		cpu=m68k
723*d5c9a868SElliott Hughes		vendor=bull
724*d5c9a868SElliott Hughes		basic_os=sysv3
725*d5c9a868SElliott Hughes		;;
726*d5c9a868SElliott Hughes	encore | umax | mmax)
727*d5c9a868SElliott Hughes		cpu=ns32k
728*d5c9a868SElliott Hughes		vendor=encore
729*d5c9a868SElliott Hughes		;;
730*d5c9a868SElliott Hughes	elxsi)
731*d5c9a868SElliott Hughes		cpu=elxsi
732*d5c9a868SElliott Hughes		vendor=elxsi
733*d5c9a868SElliott Hughes		basic_os=${basic_os:-bsd}
734*d5c9a868SElliott Hughes		;;
735*d5c9a868SElliott Hughes	fx2800)
736*d5c9a868SElliott Hughes		cpu=i860
737*d5c9a868SElliott Hughes		vendor=alliant
738*d5c9a868SElliott Hughes		;;
739*d5c9a868SElliott Hughes	genix)
740*d5c9a868SElliott Hughes		cpu=ns32k
741*d5c9a868SElliott Hughes		vendor=ns
742*d5c9a868SElliott Hughes		;;
743*d5c9a868SElliott Hughes	h3050r* | hiux*)
744*d5c9a868SElliott Hughes		cpu=hppa1.1
745*d5c9a868SElliott Hughes		vendor=hitachi
746*d5c9a868SElliott Hughes		basic_os=hiuxwe2
747*d5c9a868SElliott Hughes		;;
748*d5c9a868SElliott Hughes	hp3k9[0-9][0-9] | hp9[0-9][0-9])
749*d5c9a868SElliott Hughes		cpu=hppa1.0
750*d5c9a868SElliott Hughes		vendor=hp
751*d5c9a868SElliott Hughes		;;
752*d5c9a868SElliott Hughes	hp9k2[0-9][0-9] | hp9k31[0-9])
753*d5c9a868SElliott Hughes		cpu=m68000
754*d5c9a868SElliott Hughes		vendor=hp
755*d5c9a868SElliott Hughes		;;
756*d5c9a868SElliott Hughes	hp9k3[2-9][0-9])
757*d5c9a868SElliott Hughes		cpu=m68k
758*d5c9a868SElliott Hughes		vendor=hp
759*d5c9a868SElliott Hughes		;;
760*d5c9a868SElliott Hughes	hp9k6[0-9][0-9] | hp6[0-9][0-9])
761*d5c9a868SElliott Hughes		cpu=hppa1.0
762*d5c9a868SElliott Hughes		vendor=hp
763*d5c9a868SElliott Hughes		;;
764*d5c9a868SElliott Hughes	hp9k7[0-79][0-9] | hp7[0-79][0-9])
765*d5c9a868SElliott Hughes		cpu=hppa1.1
766*d5c9a868SElliott Hughes		vendor=hp
767*d5c9a868SElliott Hughes		;;
768*d5c9a868SElliott Hughes	hp9k78[0-9] | hp78[0-9])
769*d5c9a868SElliott Hughes		# FIXME: really hppa2.0-hp
770*d5c9a868SElliott Hughes		cpu=hppa1.1
771*d5c9a868SElliott Hughes		vendor=hp
772*d5c9a868SElliott Hughes		;;
773*d5c9a868SElliott Hughes	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
774*d5c9a868SElliott Hughes		# FIXME: really hppa2.0-hp
775*d5c9a868SElliott Hughes		cpu=hppa1.1
776*d5c9a868SElliott Hughes		vendor=hp
777*d5c9a868SElliott Hughes		;;
778*d5c9a868SElliott Hughes	hp9k8[0-9][13679] | hp8[0-9][13679])
779*d5c9a868SElliott Hughes		cpu=hppa1.1
780*d5c9a868SElliott Hughes		vendor=hp
781*d5c9a868SElliott Hughes		;;
782*d5c9a868SElliott Hughes	hp9k8[0-9][0-9] | hp8[0-9][0-9])
783*d5c9a868SElliott Hughes		cpu=hppa1.0
784*d5c9a868SElliott Hughes		vendor=hp
785*d5c9a868SElliott Hughes		;;
786*d5c9a868SElliott Hughes	i*86v32)
787*d5c9a868SElliott Hughes		cpu=`echo "$1" | sed -e 's/86.*/86/'`
788*d5c9a868SElliott Hughes		vendor=pc
789*d5c9a868SElliott Hughes		basic_os=sysv32
790*d5c9a868SElliott Hughes		;;
791*d5c9a868SElliott Hughes	i*86v4*)
792*d5c9a868SElliott Hughes		cpu=`echo "$1" | sed -e 's/86.*/86/'`
793*d5c9a868SElliott Hughes		vendor=pc
794*d5c9a868SElliott Hughes		basic_os=sysv4
795*d5c9a868SElliott Hughes		;;
796*d5c9a868SElliott Hughes	i*86v)
797*d5c9a868SElliott Hughes		cpu=`echo "$1" | sed -e 's/86.*/86/'`
798*d5c9a868SElliott Hughes		vendor=pc
799*d5c9a868SElliott Hughes		basic_os=sysv
800*d5c9a868SElliott Hughes		;;
801*d5c9a868SElliott Hughes	i*86sol2)
802*d5c9a868SElliott Hughes		cpu=`echo "$1" | sed -e 's/86.*/86/'`
803*d5c9a868SElliott Hughes		vendor=pc
804*d5c9a868SElliott Hughes		basic_os=solaris2
805*d5c9a868SElliott Hughes		;;
806*d5c9a868SElliott Hughes	j90 | j90-cray)
807*d5c9a868SElliott Hughes		cpu=j90
808*d5c9a868SElliott Hughes		vendor=cray
809*d5c9a868SElliott Hughes		basic_os=${basic_os:-unicos}
810*d5c9a868SElliott Hughes		;;
811*d5c9a868SElliott Hughes	iris | iris4d)
812*d5c9a868SElliott Hughes		cpu=mips
813*d5c9a868SElliott Hughes		vendor=sgi
814*d5c9a868SElliott Hughes		case $basic_os in
815*d5c9a868SElliott Hughes		    irix*)
816*d5c9a868SElliott Hughes			;;
817*d5c9a868SElliott Hughes		    *)
818*d5c9a868SElliott Hughes			basic_os=irix4
819*d5c9a868SElliott Hughes			;;
820*d5c9a868SElliott Hughes		esac
821*d5c9a868SElliott Hughes		;;
822*d5c9a868SElliott Hughes	miniframe)
823*d5c9a868SElliott Hughes		cpu=m68000
824*d5c9a868SElliott Hughes		vendor=convergent
825*d5c9a868SElliott Hughes		;;
826*d5c9a868SElliott Hughes	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
827*d5c9a868SElliott Hughes		cpu=m68k
828*d5c9a868SElliott Hughes		vendor=atari
829*d5c9a868SElliott Hughes		basic_os=mint
830*d5c9a868SElliott Hughes		;;
831*d5c9a868SElliott Hughes	news-3600 | risc-news)
832*d5c9a868SElliott Hughes		cpu=mips
833*d5c9a868SElliott Hughes		vendor=sony
834*d5c9a868SElliott Hughes		basic_os=newsos
835*d5c9a868SElliott Hughes		;;
836*d5c9a868SElliott Hughes	next | m*-next)
837*d5c9a868SElliott Hughes		cpu=m68k
838*d5c9a868SElliott Hughes		vendor=next
839*d5c9a868SElliott Hughes		case $basic_os in
840*d5c9a868SElliott Hughes		    openstep*)
841*d5c9a868SElliott Hughes		        ;;
842*d5c9a868SElliott Hughes		    nextstep*)
843*d5c9a868SElliott Hughes			;;
844*d5c9a868SElliott Hughes		    ns2*)
845*d5c9a868SElliott Hughes		      basic_os=nextstep2
846*d5c9a868SElliott Hughes			;;
847*d5c9a868SElliott Hughes		    *)
848*d5c9a868SElliott Hughes		      basic_os=nextstep3
849*d5c9a868SElliott Hughes			;;
850*d5c9a868SElliott Hughes		esac
851*d5c9a868SElliott Hughes		;;
852*d5c9a868SElliott Hughes	np1)
853*d5c9a868SElliott Hughes		cpu=np1
854*d5c9a868SElliott Hughes		vendor=gould
855*d5c9a868SElliott Hughes		;;
856*d5c9a868SElliott Hughes	op50n-* | op60c-*)
857*d5c9a868SElliott Hughes		cpu=hppa1.1
858*d5c9a868SElliott Hughes		vendor=oki
859*d5c9a868SElliott Hughes		basic_os=proelf
860*d5c9a868SElliott Hughes		;;
861*d5c9a868SElliott Hughes	pa-hitachi)
862*d5c9a868SElliott Hughes		cpu=hppa1.1
863*d5c9a868SElliott Hughes		vendor=hitachi
864*d5c9a868SElliott Hughes		basic_os=hiuxwe2
865*d5c9a868SElliott Hughes		;;
866*d5c9a868SElliott Hughes	pbd)
867*d5c9a868SElliott Hughes		cpu=sparc
868*d5c9a868SElliott Hughes		vendor=tti
869*d5c9a868SElliott Hughes		;;
870*d5c9a868SElliott Hughes	pbb)
871*d5c9a868SElliott Hughes		cpu=m68k
872*d5c9a868SElliott Hughes		vendor=tti
873*d5c9a868SElliott Hughes		;;
874*d5c9a868SElliott Hughes	pc532)
875*d5c9a868SElliott Hughes		cpu=ns32k
876*d5c9a868SElliott Hughes		vendor=pc532
877*d5c9a868SElliott Hughes		;;
878*d5c9a868SElliott Hughes	pn)
879*d5c9a868SElliott Hughes		cpu=pn
880*d5c9a868SElliott Hughes		vendor=gould
881*d5c9a868SElliott Hughes		;;
882*d5c9a868SElliott Hughes	power)
883*d5c9a868SElliott Hughes		cpu=power
884*d5c9a868SElliott Hughes		vendor=ibm
885*d5c9a868SElliott Hughes		;;
886*d5c9a868SElliott Hughes	ps2)
887*d5c9a868SElliott Hughes		cpu=i386
888*d5c9a868SElliott Hughes		vendor=ibm
889*d5c9a868SElliott Hughes		;;
890*d5c9a868SElliott Hughes	rm[46]00)
891*d5c9a868SElliott Hughes		cpu=mips
892*d5c9a868SElliott Hughes		vendor=siemens
893*d5c9a868SElliott Hughes		;;
894*d5c9a868SElliott Hughes	rtpc | rtpc-*)
895*d5c9a868SElliott Hughes		cpu=romp
896*d5c9a868SElliott Hughes		vendor=ibm
897*d5c9a868SElliott Hughes		;;
898*d5c9a868SElliott Hughes	sde)
899*d5c9a868SElliott Hughes		cpu=mipsisa32
900*d5c9a868SElliott Hughes		vendor=sde
901*d5c9a868SElliott Hughes		basic_os=${basic_os:-elf}
902*d5c9a868SElliott Hughes		;;
903*d5c9a868SElliott Hughes	simso-wrs)
904*d5c9a868SElliott Hughes		cpu=sparclite
905*d5c9a868SElliott Hughes		vendor=wrs
906*d5c9a868SElliott Hughes		basic_os=vxworks
907*d5c9a868SElliott Hughes		;;
908*d5c9a868SElliott Hughes	tower | tower-32)
909*d5c9a868SElliott Hughes		cpu=m68k
910*d5c9a868SElliott Hughes		vendor=ncr
911*d5c9a868SElliott Hughes		;;
912*d5c9a868SElliott Hughes	vpp*|vx|vx-*)
913*d5c9a868SElliott Hughes		cpu=f301
914*d5c9a868SElliott Hughes		vendor=fujitsu
915*d5c9a868SElliott Hughes		;;
916*d5c9a868SElliott Hughes	w65)
917*d5c9a868SElliott Hughes		cpu=w65
918*d5c9a868SElliott Hughes		vendor=wdc
919*d5c9a868SElliott Hughes		;;
920*d5c9a868SElliott Hughes	w89k-*)
921*d5c9a868SElliott Hughes		cpu=hppa1.1
922*d5c9a868SElliott Hughes		vendor=winbond
923*d5c9a868SElliott Hughes		basic_os=proelf
924*d5c9a868SElliott Hughes		;;
925*d5c9a868SElliott Hughes	none)
926*d5c9a868SElliott Hughes		cpu=none
927*d5c9a868SElliott Hughes		vendor=none
928*d5c9a868SElliott Hughes		;;
929*d5c9a868SElliott Hughes	leon|leon[3-9])
930*d5c9a868SElliott Hughes		cpu=sparc
931*d5c9a868SElliott Hughes		vendor=$basic_machine
932*d5c9a868SElliott Hughes		;;
933*d5c9a868SElliott Hughes	leon-*|leon[3-9]-*)
934*d5c9a868SElliott Hughes		cpu=sparc
935*d5c9a868SElliott Hughes		vendor=`echo "$basic_machine" | sed 's/-.*//'`
936*d5c9a868SElliott Hughes		;;
937*d5c9a868SElliott Hughes
938*d5c9a868SElliott Hughes	*-*)
939*d5c9a868SElliott Hughes		# shellcheck disable=SC2162
940*d5c9a868SElliott Hughes		saved_IFS=$IFS
941*d5c9a868SElliott Hughes		IFS="-" read cpu vendor <<EOF
942*d5c9a868SElliott Hughes$basic_machine
943*d5c9a868SElliott HughesEOF
944*d5c9a868SElliott Hughes		IFS=$saved_IFS
945*d5c9a868SElliott Hughes		;;
946*d5c9a868SElliott Hughes	# We use `pc' rather than `unknown'
947*d5c9a868SElliott Hughes	# because (1) that's what they normally are, and
948*d5c9a868SElliott Hughes	# (2) the word "unknown" tends to confuse beginning users.
949*d5c9a868SElliott Hughes	i*86 | x86_64)
950*d5c9a868SElliott Hughes		cpu=$basic_machine
951*d5c9a868SElliott Hughes		vendor=pc
952*d5c9a868SElliott Hughes		;;
953*d5c9a868SElliott Hughes	# These rules are duplicated from below for sake of the special case above;
954*d5c9a868SElliott Hughes	# i.e. things that normalized to x86 arches should also default to "pc"
955*d5c9a868SElliott Hughes	pc98)
956*d5c9a868SElliott Hughes		cpu=i386
957*d5c9a868SElliott Hughes		vendor=pc
958*d5c9a868SElliott Hughes		;;
959*d5c9a868SElliott Hughes	x64 | amd64)
960*d5c9a868SElliott Hughes		cpu=x86_64
961*d5c9a868SElliott Hughes		vendor=pc
962*d5c9a868SElliott Hughes		;;
963*d5c9a868SElliott Hughes	# Recognize the basic CPU types without company name.
964*d5c9a868SElliott Hughes	*)
965*d5c9a868SElliott Hughes		cpu=$basic_machine
966*d5c9a868SElliott Hughes		vendor=unknown
967*d5c9a868SElliott Hughes		;;
968*d5c9a868SElliott Hughesesac
969*d5c9a868SElliott Hughes
970*d5c9a868SElliott Hughesunset -v basic_machine
971*d5c9a868SElliott Hughes
972*d5c9a868SElliott Hughes# Decode basic machines in the full and proper CPU-Company form.
973*d5c9a868SElliott Hughescase $cpu-$vendor in
974*d5c9a868SElliott Hughes	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
975*d5c9a868SElliott Hughes	# some cases the only manufacturer, in others, it is the most popular.
976*d5c9a868SElliott Hughes	craynv-unknown)
977*d5c9a868SElliott Hughes		vendor=cray
978*d5c9a868SElliott Hughes		basic_os=${basic_os:-unicosmp}
979*d5c9a868SElliott Hughes		;;
980*d5c9a868SElliott Hughes	c90-unknown | c90-cray)
981*d5c9a868SElliott Hughes		vendor=cray
982*d5c9a868SElliott Hughes		basic_os=${Basic_os:-unicos}
983*d5c9a868SElliott Hughes		;;
984*d5c9a868SElliott Hughes	fx80-unknown)
985*d5c9a868SElliott Hughes		vendor=alliant
986*d5c9a868SElliott Hughes		;;
987*d5c9a868SElliott Hughes	romp-unknown)
988*d5c9a868SElliott Hughes		vendor=ibm
989*d5c9a868SElliott Hughes		;;
990*d5c9a868SElliott Hughes	mmix-unknown)
991*d5c9a868SElliott Hughes		vendor=knuth
992*d5c9a868SElliott Hughes		;;
993*d5c9a868SElliott Hughes	microblaze-unknown | microblazeel-unknown)
994*d5c9a868SElliott Hughes		vendor=xilinx
995*d5c9a868SElliott Hughes		;;
996*d5c9a868SElliott Hughes	rs6000-unknown)
997*d5c9a868SElliott Hughes		vendor=ibm
998*d5c9a868SElliott Hughes		;;
999*d5c9a868SElliott Hughes	vax-unknown)
1000*d5c9a868SElliott Hughes		vendor=dec
1001*d5c9a868SElliott Hughes		;;
1002*d5c9a868SElliott Hughes	pdp11-unknown)
1003*d5c9a868SElliott Hughes		vendor=dec
1004*d5c9a868SElliott Hughes		;;
1005*d5c9a868SElliott Hughes	we32k-unknown)
1006*d5c9a868SElliott Hughes		vendor=att
1007*d5c9a868SElliott Hughes		;;
1008*d5c9a868SElliott Hughes	cydra-unknown)
1009*d5c9a868SElliott Hughes		vendor=cydrome
1010*d5c9a868SElliott Hughes		;;
1011*d5c9a868SElliott Hughes	i370-ibm*)
1012*d5c9a868SElliott Hughes		vendor=ibm
1013*d5c9a868SElliott Hughes		;;
1014*d5c9a868SElliott Hughes	orion-unknown)
1015*d5c9a868SElliott Hughes		vendor=highlevel
1016*d5c9a868SElliott Hughes		;;
1017*d5c9a868SElliott Hughes	xps-unknown | xps100-unknown)
1018*d5c9a868SElliott Hughes		cpu=xps100
1019*d5c9a868SElliott Hughes		vendor=honeywell
1020*d5c9a868SElliott Hughes		;;
1021*d5c9a868SElliott Hughes
1022*d5c9a868SElliott Hughes	# Here we normalize CPU types with a missing or matching vendor
1023*d5c9a868SElliott Hughes	armh-unknown | armh-alt)
1024*d5c9a868SElliott Hughes		cpu=armv7l
1025*d5c9a868SElliott Hughes		vendor=alt
1026*d5c9a868SElliott Hughes		basic_os=${basic_os:-linux-gnueabihf}
1027*d5c9a868SElliott Hughes		;;
1028*d5c9a868SElliott Hughes	dpx20-unknown | dpx20-bull)
1029*d5c9a868SElliott Hughes		cpu=rs6000
1030*d5c9a868SElliott Hughes		vendor=bull
1031*d5c9a868SElliott Hughes		basic_os=${basic_os:-bosx}
1032*d5c9a868SElliott Hughes		;;
1033*d5c9a868SElliott Hughes
1034*d5c9a868SElliott Hughes	# Here we normalize CPU types irrespective of the vendor
1035*d5c9a868SElliott Hughes	amd64-*)
1036*d5c9a868SElliott Hughes		cpu=x86_64
1037*d5c9a868SElliott Hughes		;;
1038*d5c9a868SElliott Hughes	blackfin-*)
1039*d5c9a868SElliott Hughes		cpu=bfin
1040*d5c9a868SElliott Hughes		basic_os=linux
1041*d5c9a868SElliott Hughes		;;
1042*d5c9a868SElliott Hughes	c54x-*)
1043*d5c9a868SElliott Hughes		cpu=tic54x
1044*d5c9a868SElliott Hughes		;;
1045*d5c9a868SElliott Hughes	c55x-*)
1046*d5c9a868SElliott Hughes		cpu=tic55x
1047*d5c9a868SElliott Hughes		;;
1048*d5c9a868SElliott Hughes	c6x-*)
1049*d5c9a868SElliott Hughes		cpu=tic6x
1050*d5c9a868SElliott Hughes		;;
1051*d5c9a868SElliott Hughes	e500v[12]-*)
1052*d5c9a868SElliott Hughes		cpu=powerpc
1053*d5c9a868SElliott Hughes		basic_os=${basic_os}"spe"
1054*d5c9a868SElliott Hughes		;;
1055*d5c9a868SElliott Hughes	mips3*-*)
1056*d5c9a868SElliott Hughes		cpu=mips64
1057*d5c9a868SElliott Hughes		;;
1058*d5c9a868SElliott Hughes	ms1-*)
1059*d5c9a868SElliott Hughes		cpu=mt
1060*d5c9a868SElliott Hughes		;;
1061*d5c9a868SElliott Hughes	m68knommu-*)
1062*d5c9a868SElliott Hughes		cpu=m68k
1063*d5c9a868SElliott Hughes		basic_os=linux
1064*d5c9a868SElliott Hughes		;;
1065*d5c9a868SElliott Hughes	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1066*d5c9a868SElliott Hughes		cpu=s12z
1067*d5c9a868SElliott Hughes		;;
1068*d5c9a868SElliott Hughes	openrisc-*)
1069*d5c9a868SElliott Hughes		cpu=or32
1070*d5c9a868SElliott Hughes		;;
1071*d5c9a868SElliott Hughes	parisc-*)
1072*d5c9a868SElliott Hughes		cpu=hppa
1073*d5c9a868SElliott Hughes		basic_os=linux
1074*d5c9a868SElliott Hughes		;;
1075*d5c9a868SElliott Hughes	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1076*d5c9a868SElliott Hughes		cpu=i586
1077*d5c9a868SElliott Hughes		;;
1078*d5c9a868SElliott Hughes	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1079*d5c9a868SElliott Hughes		cpu=i686
1080*d5c9a868SElliott Hughes		;;
1081*d5c9a868SElliott Hughes	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1082*d5c9a868SElliott Hughes		cpu=i686
1083*d5c9a868SElliott Hughes		;;
1084*d5c9a868SElliott Hughes	pentium4-*)
1085*d5c9a868SElliott Hughes		cpu=i786
1086*d5c9a868SElliott Hughes		;;
1087*d5c9a868SElliott Hughes	pc98-*)
1088*d5c9a868SElliott Hughes		cpu=i386
1089*d5c9a868SElliott Hughes		;;
1090*d5c9a868SElliott Hughes	ppc-* | ppcbe-*)
1091*d5c9a868SElliott Hughes		cpu=powerpc
1092*d5c9a868SElliott Hughes		;;
1093*d5c9a868SElliott Hughes	ppcle-* | powerpclittle-*)
1094*d5c9a868SElliott Hughes		cpu=powerpcle
1095*d5c9a868SElliott Hughes		;;
1096*d5c9a868SElliott Hughes	ppc64-*)
1097*d5c9a868SElliott Hughes		cpu=powerpc64
1098*d5c9a868SElliott Hughes		;;
1099*d5c9a868SElliott Hughes	ppc64le-* | powerpc64little-*)
1100*d5c9a868SElliott Hughes		cpu=powerpc64le
1101*d5c9a868SElliott Hughes		;;
1102*d5c9a868SElliott Hughes	sb1-*)
1103*d5c9a868SElliott Hughes		cpu=mipsisa64sb1
1104*d5c9a868SElliott Hughes		;;
1105*d5c9a868SElliott Hughes	sb1el-*)
1106*d5c9a868SElliott Hughes		cpu=mipsisa64sb1el
1107*d5c9a868SElliott Hughes		;;
1108*d5c9a868SElliott Hughes	sh5e[lb]-*)
1109*d5c9a868SElliott Hughes		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1110*d5c9a868SElliott Hughes		;;
1111*d5c9a868SElliott Hughes	spur-*)
1112*d5c9a868SElliott Hughes		cpu=spur
1113*d5c9a868SElliott Hughes		;;
1114*d5c9a868SElliott Hughes	strongarm-* | thumb-*)
1115*d5c9a868SElliott Hughes		cpu=arm
1116*d5c9a868SElliott Hughes		;;
1117*d5c9a868SElliott Hughes	tx39-*)
1118*d5c9a868SElliott Hughes		cpu=mipstx39
1119*d5c9a868SElliott Hughes		;;
1120*d5c9a868SElliott Hughes	tx39el-*)
1121*d5c9a868SElliott Hughes		cpu=mipstx39el
1122*d5c9a868SElliott Hughes		;;
1123*d5c9a868SElliott Hughes	x64-*)
1124*d5c9a868SElliott Hughes		cpu=x86_64
1125*d5c9a868SElliott Hughes		;;
1126*d5c9a868SElliott Hughes	xscale-* | xscalee[bl]-*)
1127*d5c9a868SElliott Hughes		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1128*d5c9a868SElliott Hughes		;;
1129*d5c9a868SElliott Hughes	arm64-* | aarch64le-*)
1130*d5c9a868SElliott Hughes		cpu=aarch64
1131*d5c9a868SElliott Hughes		;;
1132*d5c9a868SElliott Hughes
1133*d5c9a868SElliott Hughes	# Recognize the canonical CPU Types that limit and/or modify the
1134*d5c9a868SElliott Hughes	# company names they are paired with.
1135*d5c9a868SElliott Hughes	cr16-*)
1136*d5c9a868SElliott Hughes		basic_os=${basic_os:-elf}
1137*d5c9a868SElliott Hughes		;;
1138*d5c9a868SElliott Hughes	crisv32-* | etraxfs*-*)
1139*d5c9a868SElliott Hughes		cpu=crisv32
1140*d5c9a868SElliott Hughes		vendor=axis
1141*d5c9a868SElliott Hughes		;;
1142*d5c9a868SElliott Hughes	cris-* | etrax*-*)
1143*d5c9a868SElliott Hughes		cpu=cris
1144*d5c9a868SElliott Hughes		vendor=axis
1145*d5c9a868SElliott Hughes		;;
1146*d5c9a868SElliott Hughes	crx-*)
1147*d5c9a868SElliott Hughes		basic_os=${basic_os:-elf}
1148*d5c9a868SElliott Hughes		;;
1149*d5c9a868SElliott Hughes	neo-tandem)
1150*d5c9a868SElliott Hughes		cpu=neo
1151*d5c9a868SElliott Hughes		vendor=tandem
1152*d5c9a868SElliott Hughes		;;
1153*d5c9a868SElliott Hughes	nse-tandem)
1154*d5c9a868SElliott Hughes		cpu=nse
1155*d5c9a868SElliott Hughes		vendor=tandem
1156*d5c9a868SElliott Hughes		;;
1157*d5c9a868SElliott Hughes	nsr-tandem)
1158*d5c9a868SElliott Hughes		cpu=nsr
1159*d5c9a868SElliott Hughes		vendor=tandem
1160*d5c9a868SElliott Hughes		;;
1161*d5c9a868SElliott Hughes	nsv-tandem)
1162*d5c9a868SElliott Hughes		cpu=nsv
1163*d5c9a868SElliott Hughes		vendor=tandem
1164*d5c9a868SElliott Hughes		;;
1165*d5c9a868SElliott Hughes	nsx-tandem)
1166*d5c9a868SElliott Hughes		cpu=nsx
1167*d5c9a868SElliott Hughes		vendor=tandem
1168*d5c9a868SElliott Hughes		;;
1169*d5c9a868SElliott Hughes	mipsallegrexel-sony)
1170*d5c9a868SElliott Hughes		cpu=mipsallegrexel
1171*d5c9a868SElliott Hughes		vendor=sony
1172*d5c9a868SElliott Hughes		;;
1173*d5c9a868SElliott Hughes	tile*-*)
1174*d5c9a868SElliott Hughes		basic_os=${basic_os:-linux-gnu}
1175*d5c9a868SElliott Hughes		;;
1176*d5c9a868SElliott Hughes
1177*d5c9a868SElliott Hughes	*)
1178*d5c9a868SElliott Hughes		# Recognize the canonical CPU types that are allowed with any
1179*d5c9a868SElliott Hughes		# company name.
1180*d5c9a868SElliott Hughes		case $cpu in
1181*d5c9a868SElliott Hughes			1750a | 580 \
1182*d5c9a868SElliott Hughes			| a29k \
1183*d5c9a868SElliott Hughes			| aarch64 | aarch64_be \
1184*d5c9a868SElliott Hughes			| abacus \
1185*d5c9a868SElliott Hughes			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1186*d5c9a868SElliott Hughes			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1187*d5c9a868SElliott Hughes			| alphapca5[67] | alpha64pca5[67] \
1188*d5c9a868SElliott Hughes			| am33_2.0 \
1189*d5c9a868SElliott Hughes			| amdgcn \
1190*d5c9a868SElliott Hughes			| arc | arceb | arc32 | arc64 \
1191*d5c9a868SElliott Hughes			| arm | arm[lb]e | arme[lb] | armv* \
1192*d5c9a868SElliott Hughes			| avr | avr32 \
1193*d5c9a868SElliott Hughes			| asmjs \
1194*d5c9a868SElliott Hughes			| ba \
1195*d5c9a868SElliott Hughes			| be32 | be64 \
1196*d5c9a868SElliott Hughes			| bfin | bpf | bs2000 \
1197*d5c9a868SElliott Hughes			| c[123]* | c30 | [cjt]90 | c4x \
1198*d5c9a868SElliott Hughes			| c8051 | clipper | craynv | csky | cydra \
1199*d5c9a868SElliott Hughes			| d10v | d30v | dlx | dsp16xx \
1200*d5c9a868SElliott Hughes			| e2k | elxsi | epiphany \
1201*d5c9a868SElliott Hughes			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1202*d5c9a868SElliott Hughes			| h8300 | h8500 \
1203*d5c9a868SElliott Hughes			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1204*d5c9a868SElliott Hughes			| hexagon \
1205*d5c9a868SElliott Hughes			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1206*d5c9a868SElliott Hughes			| ip2k | iq2000 \
1207*d5c9a868SElliott Hughes			| k1om \
1208*d5c9a868SElliott Hughes			| le32 | le64 \
1209*d5c9a868SElliott Hughes			| lm32 \
1210*d5c9a868SElliott Hughes			| loongarch32 | loongarch64 | loongarchx32 \
1211*d5c9a868SElliott Hughes			| m32c | m32r | m32rle \
1212*d5c9a868SElliott Hughes			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1213*d5c9a868SElliott Hughes			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1214*d5c9a868SElliott Hughes			| m88110 | m88k | maxq | mb | mcore | mep | metag \
1215*d5c9a868SElliott Hughes			| microblaze | microblazeel \
1216*d5c9a868SElliott Hughes			| mips | mipsbe | mipseb | mipsel | mipsle \
1217*d5c9a868SElliott Hughes			| mips16 \
1218*d5c9a868SElliott Hughes			| mips64 | mips64eb | mips64el \
1219*d5c9a868SElliott Hughes			| mips64octeon | mips64octeonel \
1220*d5c9a868SElliott Hughes			| mips64orion | mips64orionel \
1221*d5c9a868SElliott Hughes			| mips64r5900 | mips64r5900el \
1222*d5c9a868SElliott Hughes			| mips64vr | mips64vrel \
1223*d5c9a868SElliott Hughes			| mips64vr4100 | mips64vr4100el \
1224*d5c9a868SElliott Hughes			| mips64vr4300 | mips64vr4300el \
1225*d5c9a868SElliott Hughes			| mips64vr5000 | mips64vr5000el \
1226*d5c9a868SElliott Hughes			| mips64vr5900 | mips64vr5900el \
1227*d5c9a868SElliott Hughes			| mipsisa32 | mipsisa32el \
1228*d5c9a868SElliott Hughes			| mipsisa32r2 | mipsisa32r2el \
1229*d5c9a868SElliott Hughes			| mipsisa32r3 | mipsisa32r3el \
1230*d5c9a868SElliott Hughes			| mipsisa32r5 | mipsisa32r5el \
1231*d5c9a868SElliott Hughes			| mipsisa32r6 | mipsisa32r6el \
1232*d5c9a868SElliott Hughes			| mipsisa64 | mipsisa64el \
1233*d5c9a868SElliott Hughes			| mipsisa64r2 | mipsisa64r2el \
1234*d5c9a868SElliott Hughes			| mipsisa64r3 | mipsisa64r3el \
1235*d5c9a868SElliott Hughes			| mipsisa64r5 | mipsisa64r5el \
1236*d5c9a868SElliott Hughes			| mipsisa64r6 | mipsisa64r6el \
1237*d5c9a868SElliott Hughes			| mipsisa64sb1 | mipsisa64sb1el \
1238*d5c9a868SElliott Hughes			| mipsisa64sr71k | mipsisa64sr71kel \
1239*d5c9a868SElliott Hughes			| mipsr5900 | mipsr5900el \
1240*d5c9a868SElliott Hughes			| mipstx39 | mipstx39el \
1241*d5c9a868SElliott Hughes			| mmix \
1242*d5c9a868SElliott Hughes			| mn10200 | mn10300 \
1243*d5c9a868SElliott Hughes			| moxie \
1244*d5c9a868SElliott Hughes			| mt \
1245*d5c9a868SElliott Hughes			| msp430 \
1246*d5c9a868SElliott Hughes			| nds32 | nds32le | nds32be \
1247*d5c9a868SElliott Hughes			| nfp \
1248*d5c9a868SElliott Hughes			| nios | nios2 | nios2eb | nios2el \
1249*d5c9a868SElliott Hughes			| none | np1 | ns16k | ns32k | nvptx \
1250*d5c9a868SElliott Hughes			| open8 \
1251*d5c9a868SElliott Hughes			| or1k* \
1252*d5c9a868SElliott Hughes			| or32 \
1253*d5c9a868SElliott Hughes			| orion \
1254*d5c9a868SElliott Hughes			| picochip \
1255*d5c9a868SElliott Hughes			| pdp10 | pdp11 | pj | pjl | pn | power \
1256*d5c9a868SElliott Hughes			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1257*d5c9a868SElliott Hughes			| pru \
1258*d5c9a868SElliott Hughes			| pyramid \
1259*d5c9a868SElliott Hughes			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1260*d5c9a868SElliott Hughes			| rl78 | romp | rs6000 | rx \
1261*d5c9a868SElliott Hughes			| s390 | s390x \
1262*d5c9a868SElliott Hughes			| score \
1263*d5c9a868SElliott Hughes			| sh | shl \
1264*d5c9a868SElliott Hughes			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1265*d5c9a868SElliott Hughes			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1266*d5c9a868SElliott Hughes			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1267*d5c9a868SElliott Hughes			| sparclite \
1268*d5c9a868SElliott Hughes			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1269*d5c9a868SElliott Hughes			| spu \
1270*d5c9a868SElliott Hughes			| tahoe \
1271*d5c9a868SElliott Hughes			| thumbv7* \
1272*d5c9a868SElliott Hughes			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1273*d5c9a868SElliott Hughes			| tron \
1274*d5c9a868SElliott Hughes			| ubicom32 \
1275*d5c9a868SElliott Hughes			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1276*d5c9a868SElliott Hughes			| vax \
1277*d5c9a868SElliott Hughes			| visium \
1278*d5c9a868SElliott Hughes			| w65 \
1279*d5c9a868SElliott Hughes			| wasm32 | wasm64 \
1280*d5c9a868SElliott Hughes			| we32k \
1281*d5c9a868SElliott Hughes			| x86 | x86_64 | xc16x | xgate | xps100 \
1282*d5c9a868SElliott Hughes			| xstormy16 | xtensa* \
1283*d5c9a868SElliott Hughes			| ymp \
1284*d5c9a868SElliott Hughes			| z8k | z80)
1285*d5c9a868SElliott Hughes				;;
1286*d5c9a868SElliott Hughes
1287*d5c9a868SElliott Hughes			*)
1288*d5c9a868SElliott Hughes				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1289*d5c9a868SElliott Hughes				exit 1
1290*d5c9a868SElliott Hughes				;;
1291*d5c9a868SElliott Hughes		esac
1292*d5c9a868SElliott Hughes		;;
1293*d5c9a868SElliott Hughesesac
1294*d5c9a868SElliott Hughes
1295*d5c9a868SElliott Hughes# Here we canonicalize certain aliases for manufacturers.
1296*d5c9a868SElliott Hughescase $vendor in
1297*d5c9a868SElliott Hughes	digital*)
1298*d5c9a868SElliott Hughes		vendor=dec
1299*d5c9a868SElliott Hughes		;;
1300*d5c9a868SElliott Hughes	commodore*)
1301*d5c9a868SElliott Hughes		vendor=cbm
1302*d5c9a868SElliott Hughes		;;
1303*d5c9a868SElliott Hughes	*)
1304*d5c9a868SElliott Hughes		;;
1305*d5c9a868SElliott Hughesesac
1306*d5c9a868SElliott Hughes
1307*d5c9a868SElliott Hughes# Decode manufacturer-specific aliases for certain operating systems.
1308*d5c9a868SElliott Hughes
1309*d5c9a868SElliott Hughesif test x$basic_os != x
1310*d5c9a868SElliott Hughesthen
1311*d5c9a868SElliott Hughes
1312*d5c9a868SElliott Hughes# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
1313*d5c9a868SElliott Hughes# set os.
1314*d5c9a868SElliott Hughescase $basic_os in
1315*d5c9a868SElliott Hughes	gnu/linux*)
1316*d5c9a868SElliott Hughes		kernel=linux
1317*d5c9a868SElliott Hughes		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1318*d5c9a868SElliott Hughes		;;
1319*d5c9a868SElliott Hughes	os2-emx)
1320*d5c9a868SElliott Hughes		kernel=os2
1321*d5c9a868SElliott Hughes		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1322*d5c9a868SElliott Hughes		;;
1323*d5c9a868SElliott Hughes	nto-qnx*)
1324*d5c9a868SElliott Hughes		kernel=nto
1325*d5c9a868SElliott Hughes		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1326*d5c9a868SElliott Hughes		;;
1327*d5c9a868SElliott Hughes	*-*)
1328*d5c9a868SElliott Hughes		# shellcheck disable=SC2162
1329*d5c9a868SElliott Hughes		saved_IFS=$IFS
1330*d5c9a868SElliott Hughes		IFS="-" read kernel os <<EOF
1331*d5c9a868SElliott Hughes$basic_os
1332*d5c9a868SElliott HughesEOF
1333*d5c9a868SElliott Hughes		IFS=$saved_IFS
1334*d5c9a868SElliott Hughes		;;
1335*d5c9a868SElliott Hughes	# Default OS when just kernel was specified
1336*d5c9a868SElliott Hughes	nto*)
1337*d5c9a868SElliott Hughes		kernel=nto
1338*d5c9a868SElliott Hughes		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1339*d5c9a868SElliott Hughes		;;
1340*d5c9a868SElliott Hughes	linux*)
1341*d5c9a868SElliott Hughes		kernel=linux
1342*d5c9a868SElliott Hughes		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1343*d5c9a868SElliott Hughes		;;
1344*d5c9a868SElliott Hughes	*)
1345*d5c9a868SElliott Hughes		kernel=
1346*d5c9a868SElliott Hughes		os=$basic_os
1347*d5c9a868SElliott Hughes		;;
1348*d5c9a868SElliott Hughesesac
1349*d5c9a868SElliott Hughes
1350*d5c9a868SElliott Hughes# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1351*d5c9a868SElliott Hughes# etc.)
1352*d5c9a868SElliott Hughescase $os in
1353*d5c9a868SElliott Hughes	# First match some system type aliases that might get confused
1354*d5c9a868SElliott Hughes	# with valid system types.
1355*d5c9a868SElliott Hughes	# solaris* is a basic system type, with this one exception.
1356*d5c9a868SElliott Hughes	auroraux)
1357*d5c9a868SElliott Hughes		os=auroraux
1358*d5c9a868SElliott Hughes		;;
1359*d5c9a868SElliott Hughes	bluegene*)
1360*d5c9a868SElliott Hughes		os=cnk
1361*d5c9a868SElliott Hughes		;;
1362*d5c9a868SElliott Hughes	solaris1 | solaris1.*)
1363*d5c9a868SElliott Hughes		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1364*d5c9a868SElliott Hughes		;;
1365*d5c9a868SElliott Hughes	solaris)
1366*d5c9a868SElliott Hughes		os=solaris2
1367*d5c9a868SElliott Hughes		;;
1368*d5c9a868SElliott Hughes	unixware*)
1369*d5c9a868SElliott Hughes		os=sysv4.2uw
1370*d5c9a868SElliott Hughes		;;
1371*d5c9a868SElliott Hughes	# es1800 is here to avoid being matched by es* (a different OS)
1372*d5c9a868SElliott Hughes	es1800*)
1373*d5c9a868SElliott Hughes		os=ose
1374*d5c9a868SElliott Hughes		;;
1375*d5c9a868SElliott Hughes	# Some version numbers need modification
1376*d5c9a868SElliott Hughes	chorusos*)
1377*d5c9a868SElliott Hughes		os=chorusos
1378*d5c9a868SElliott Hughes		;;
1379*d5c9a868SElliott Hughes	isc)
1380*d5c9a868SElliott Hughes		os=isc2.2
1381*d5c9a868SElliott Hughes		;;
1382*d5c9a868SElliott Hughes	sco6)
1383*d5c9a868SElliott Hughes		os=sco5v6
1384*d5c9a868SElliott Hughes		;;
1385*d5c9a868SElliott Hughes	sco5)
1386*d5c9a868SElliott Hughes		os=sco3.2v5
1387*d5c9a868SElliott Hughes		;;
1388*d5c9a868SElliott Hughes	sco4)
1389*d5c9a868SElliott Hughes		os=sco3.2v4
1390*d5c9a868SElliott Hughes		;;
1391*d5c9a868SElliott Hughes	sco3.2.[4-9]*)
1392*d5c9a868SElliott Hughes		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
1393*d5c9a868SElliott Hughes		;;
1394*d5c9a868SElliott Hughes	sco*v* | scout)
1395*d5c9a868SElliott Hughes		# Don't match below
1396*d5c9a868SElliott Hughes		;;
1397*d5c9a868SElliott Hughes	sco*)
1398*d5c9a868SElliott Hughes		os=sco3.2v2
1399*d5c9a868SElliott Hughes		;;
1400*d5c9a868SElliott Hughes	psos*)
1401*d5c9a868SElliott Hughes		os=psos
1402*d5c9a868SElliott Hughes		;;
1403*d5c9a868SElliott Hughes	qnx*)
1404*d5c9a868SElliott Hughes		os=qnx
1405*d5c9a868SElliott Hughes		;;
1406*d5c9a868SElliott Hughes	hiux*)
1407*d5c9a868SElliott Hughes		os=hiuxwe2
1408*d5c9a868SElliott Hughes		;;
1409*d5c9a868SElliott Hughes	lynx*178)
1410*d5c9a868SElliott Hughes		os=lynxos178
1411*d5c9a868SElliott Hughes		;;
1412*d5c9a868SElliott Hughes	lynx*5)
1413*d5c9a868SElliott Hughes		os=lynxos5
1414*d5c9a868SElliott Hughes		;;
1415*d5c9a868SElliott Hughes	lynxos*)
1416*d5c9a868SElliott Hughes		# don't get caught up in next wildcard
1417*d5c9a868SElliott Hughes		;;
1418*d5c9a868SElliott Hughes	lynx*)
1419*d5c9a868SElliott Hughes		os=lynxos
1420*d5c9a868SElliott Hughes		;;
1421*d5c9a868SElliott Hughes	mac[0-9]*)
1422*d5c9a868SElliott Hughes		os=`echo "$os" | sed -e 's|mac|macos|'`
1423*d5c9a868SElliott Hughes		;;
1424*d5c9a868SElliott Hughes	opened*)
1425*d5c9a868SElliott Hughes		os=openedition
1426*d5c9a868SElliott Hughes		;;
1427*d5c9a868SElliott Hughes	os400*)
1428*d5c9a868SElliott Hughes		os=os400
1429*d5c9a868SElliott Hughes		;;
1430*d5c9a868SElliott Hughes	sunos5*)
1431*d5c9a868SElliott Hughes		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1432*d5c9a868SElliott Hughes		;;
1433*d5c9a868SElliott Hughes	sunos6*)
1434*d5c9a868SElliott Hughes		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1435*d5c9a868SElliott Hughes		;;
1436*d5c9a868SElliott Hughes	wince*)
1437*d5c9a868SElliott Hughes		os=wince
1438*d5c9a868SElliott Hughes		;;
1439*d5c9a868SElliott Hughes	utek*)
1440*d5c9a868SElliott Hughes		os=bsd
1441*d5c9a868SElliott Hughes		;;
1442*d5c9a868SElliott Hughes	dynix*)
1443*d5c9a868SElliott Hughes		os=bsd
1444*d5c9a868SElliott Hughes		;;
1445*d5c9a868SElliott Hughes	acis*)
1446*d5c9a868SElliott Hughes		os=aos
1447*d5c9a868SElliott Hughes		;;
1448*d5c9a868SElliott Hughes	atheos*)
1449*d5c9a868SElliott Hughes		os=atheos
1450*d5c9a868SElliott Hughes		;;
1451*d5c9a868SElliott Hughes	syllable*)
1452*d5c9a868SElliott Hughes		os=syllable
1453*d5c9a868SElliott Hughes		;;
1454*d5c9a868SElliott Hughes	386bsd)
1455*d5c9a868SElliott Hughes		os=bsd
1456*d5c9a868SElliott Hughes		;;
1457*d5c9a868SElliott Hughes	ctix* | uts*)
1458*d5c9a868SElliott Hughes		os=sysv
1459*d5c9a868SElliott Hughes		;;
1460*d5c9a868SElliott Hughes	nova*)
1461*d5c9a868SElliott Hughes		os=rtmk-nova
1462*d5c9a868SElliott Hughes		;;
1463*d5c9a868SElliott Hughes	ns2)
1464*d5c9a868SElliott Hughes		os=nextstep2
1465*d5c9a868SElliott Hughes		;;
1466*d5c9a868SElliott Hughes	# Preserve the version number of sinix5.
1467*d5c9a868SElliott Hughes	sinix5.*)
1468*d5c9a868SElliott Hughes		os=`echo "$os" | sed -e 's|sinix|sysv|'`
1469*d5c9a868SElliott Hughes		;;
1470*d5c9a868SElliott Hughes	sinix*)
1471*d5c9a868SElliott Hughes		os=sysv4
1472*d5c9a868SElliott Hughes		;;
1473*d5c9a868SElliott Hughes	tpf*)
1474*d5c9a868SElliott Hughes		os=tpf
1475*d5c9a868SElliott Hughes		;;
1476*d5c9a868SElliott Hughes	triton*)
1477*d5c9a868SElliott Hughes		os=sysv3
1478*d5c9a868SElliott Hughes		;;
1479*d5c9a868SElliott Hughes	oss*)
1480*d5c9a868SElliott Hughes		os=sysv3
1481*d5c9a868SElliott Hughes		;;
1482*d5c9a868SElliott Hughes	svr4*)
1483*d5c9a868SElliott Hughes		os=sysv4
1484*d5c9a868SElliott Hughes		;;
1485*d5c9a868SElliott Hughes	svr3)
1486*d5c9a868SElliott Hughes		os=sysv3
1487*d5c9a868SElliott Hughes		;;
1488*d5c9a868SElliott Hughes	sysvr4)
1489*d5c9a868SElliott Hughes		os=sysv4
1490*d5c9a868SElliott Hughes		;;
1491*d5c9a868SElliott Hughes	ose*)
1492*d5c9a868SElliott Hughes		os=ose
1493*d5c9a868SElliott Hughes		;;
1494*d5c9a868SElliott Hughes	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1495*d5c9a868SElliott Hughes		os=mint
1496*d5c9a868SElliott Hughes		;;
1497*d5c9a868SElliott Hughes	dicos*)
1498*d5c9a868SElliott Hughes		os=dicos
1499*d5c9a868SElliott Hughes		;;
1500*d5c9a868SElliott Hughes	pikeos*)
1501*d5c9a868SElliott Hughes		# Until real need of OS specific support for
1502*d5c9a868SElliott Hughes		# particular features comes up, bare metal
1503*d5c9a868SElliott Hughes		# configurations are quite functional.
1504*d5c9a868SElliott Hughes		case $cpu in
1505*d5c9a868SElliott Hughes		    arm*)
1506*d5c9a868SElliott Hughes			os=eabi
1507*d5c9a868SElliott Hughes			;;
1508*d5c9a868SElliott Hughes		    *)
1509*d5c9a868SElliott Hughes			os=elf
1510*d5c9a868SElliott Hughes			;;
1511*d5c9a868SElliott Hughes		esac
1512*d5c9a868SElliott Hughes		;;
1513*d5c9a868SElliott Hughes	*)
1514*d5c9a868SElliott Hughes		# No normalization, but not necessarily accepted, that comes below.
1515*d5c9a868SElliott Hughes		;;
1516*d5c9a868SElliott Hughesesac
1517*d5c9a868SElliott Hughes
1518*d5c9a868SElliott Hugheselse
1519*d5c9a868SElliott Hughes
1520*d5c9a868SElliott Hughes# Here we handle the default operating systems that come with various machines.
1521*d5c9a868SElliott Hughes# The value should be what the vendor currently ships out the door with their
1522*d5c9a868SElliott Hughes# machine or put another way, the most popular os provided with the machine.
1523*d5c9a868SElliott Hughes
1524*d5c9a868SElliott Hughes# Note that if you're going to try to match "-MANUFACTURER" here (say,
1525*d5c9a868SElliott Hughes# "-sun"), then you have to tell the case statement up towards the top
1526*d5c9a868SElliott Hughes# that MANUFACTURER isn't an operating system.  Otherwise, code above
1527*d5c9a868SElliott Hughes# will signal an error saying that MANUFACTURER isn't an operating
1528*d5c9a868SElliott Hughes# system, and we'll never get to this point.
1529*d5c9a868SElliott Hughes
1530*d5c9a868SElliott Hugheskernel=
1531*d5c9a868SElliott Hughescase $cpu-$vendor in
1532*d5c9a868SElliott Hughes	score-*)
1533*d5c9a868SElliott Hughes		os=elf
1534*d5c9a868SElliott Hughes		;;
1535*d5c9a868SElliott Hughes	spu-*)
1536*d5c9a868SElliott Hughes		os=elf
1537*d5c9a868SElliott Hughes		;;
1538*d5c9a868SElliott Hughes	*-acorn)
1539*d5c9a868SElliott Hughes		os=riscix1.2
1540*d5c9a868SElliott Hughes		;;
1541*d5c9a868SElliott Hughes	arm*-rebel)
1542*d5c9a868SElliott Hughes		kernel=linux
1543*d5c9a868SElliott Hughes		os=gnu
1544*d5c9a868SElliott Hughes		;;
1545*d5c9a868SElliott Hughes	arm*-semi)
1546*d5c9a868SElliott Hughes		os=aout
1547*d5c9a868SElliott Hughes		;;
1548*d5c9a868SElliott Hughes	c4x-* | tic4x-*)
1549*d5c9a868SElliott Hughes		os=coff
1550*d5c9a868SElliott Hughes		;;
1551*d5c9a868SElliott Hughes	c8051-*)
1552*d5c9a868SElliott Hughes		os=elf
1553*d5c9a868SElliott Hughes		;;
1554*d5c9a868SElliott Hughes	clipper-intergraph)
1555*d5c9a868SElliott Hughes		os=clix
1556*d5c9a868SElliott Hughes		;;
1557*d5c9a868SElliott Hughes	hexagon-*)
1558*d5c9a868SElliott Hughes		os=elf
1559*d5c9a868SElliott Hughes		;;
1560*d5c9a868SElliott Hughes	tic54x-*)
1561*d5c9a868SElliott Hughes		os=coff
1562*d5c9a868SElliott Hughes		;;
1563*d5c9a868SElliott Hughes	tic55x-*)
1564*d5c9a868SElliott Hughes		os=coff
1565*d5c9a868SElliott Hughes		;;
1566*d5c9a868SElliott Hughes	tic6x-*)
1567*d5c9a868SElliott Hughes		os=coff
1568*d5c9a868SElliott Hughes		;;
1569*d5c9a868SElliott Hughes	# This must come before the *-dec entry.
1570*d5c9a868SElliott Hughes	pdp10-*)
1571*d5c9a868SElliott Hughes		os=tops20
1572*d5c9a868SElliott Hughes		;;
1573*d5c9a868SElliott Hughes	pdp11-*)
1574*d5c9a868SElliott Hughes		os=none
1575*d5c9a868SElliott Hughes		;;
1576*d5c9a868SElliott Hughes	*-dec | vax-*)
1577*d5c9a868SElliott Hughes		os=ultrix4.2
1578*d5c9a868SElliott Hughes		;;
1579*d5c9a868SElliott Hughes	m68*-apollo)
1580*d5c9a868SElliott Hughes		os=domain
1581*d5c9a868SElliott Hughes		;;
1582*d5c9a868SElliott Hughes	i386-sun)
1583*d5c9a868SElliott Hughes		os=sunos4.0.2
1584*d5c9a868SElliott Hughes		;;
1585*d5c9a868SElliott Hughes	m68000-sun)
1586*d5c9a868SElliott Hughes		os=sunos3
1587*d5c9a868SElliott Hughes		;;
1588*d5c9a868SElliott Hughes	m68*-cisco)
1589*d5c9a868SElliott Hughes		os=aout
1590*d5c9a868SElliott Hughes		;;
1591*d5c9a868SElliott Hughes	mep-*)
1592*d5c9a868SElliott Hughes		os=elf
1593*d5c9a868SElliott Hughes		;;
1594*d5c9a868SElliott Hughes	mips*-cisco)
1595*d5c9a868SElliott Hughes		os=elf
1596*d5c9a868SElliott Hughes		;;
1597*d5c9a868SElliott Hughes	mips*-*)
1598*d5c9a868SElliott Hughes		os=elf
1599*d5c9a868SElliott Hughes		;;
1600*d5c9a868SElliott Hughes	or32-*)
1601*d5c9a868SElliott Hughes		os=coff
1602*d5c9a868SElliott Hughes		;;
1603*d5c9a868SElliott Hughes	*-tti)	# must be before sparc entry or we get the wrong os.
1604*d5c9a868SElliott Hughes		os=sysv3
1605*d5c9a868SElliott Hughes		;;
1606*d5c9a868SElliott Hughes	sparc-* | *-sun)
1607*d5c9a868SElliott Hughes		os=sunos4.1.1
1608*d5c9a868SElliott Hughes		;;
1609*d5c9a868SElliott Hughes	pru-*)
1610*d5c9a868SElliott Hughes		os=elf
1611*d5c9a868SElliott Hughes		;;
1612*d5c9a868SElliott Hughes	*-be)
1613*d5c9a868SElliott Hughes		os=beos
1614*d5c9a868SElliott Hughes		;;
1615*d5c9a868SElliott Hughes	*-ibm)
1616*d5c9a868SElliott Hughes		os=aix
1617*d5c9a868SElliott Hughes		;;
1618*d5c9a868SElliott Hughes	*-knuth)
1619*d5c9a868SElliott Hughes		os=mmixware
1620*d5c9a868SElliott Hughes		;;
1621*d5c9a868SElliott Hughes	*-wec)
1622*d5c9a868SElliott Hughes		os=proelf
1623*d5c9a868SElliott Hughes		;;
1624*d5c9a868SElliott Hughes	*-winbond)
1625*d5c9a868SElliott Hughes		os=proelf
1626*d5c9a868SElliott Hughes		;;
1627*d5c9a868SElliott Hughes	*-oki)
1628*d5c9a868SElliott Hughes		os=proelf
1629*d5c9a868SElliott Hughes		;;
1630*d5c9a868SElliott Hughes	*-hp)
1631*d5c9a868SElliott Hughes		os=hpux
1632*d5c9a868SElliott Hughes		;;
1633*d5c9a868SElliott Hughes	*-hitachi)
1634*d5c9a868SElliott Hughes		os=hiux
1635*d5c9a868SElliott Hughes		;;
1636*d5c9a868SElliott Hughes	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1637*d5c9a868SElliott Hughes		os=sysv
1638*d5c9a868SElliott Hughes		;;
1639*d5c9a868SElliott Hughes	*-cbm)
1640*d5c9a868SElliott Hughes		os=amigaos
1641*d5c9a868SElliott Hughes		;;
1642*d5c9a868SElliott Hughes	*-dg)
1643*d5c9a868SElliott Hughes		os=dgux
1644*d5c9a868SElliott Hughes		;;
1645*d5c9a868SElliott Hughes	*-dolphin)
1646*d5c9a868SElliott Hughes		os=sysv3
1647*d5c9a868SElliott Hughes		;;
1648*d5c9a868SElliott Hughes	m68k-ccur)
1649*d5c9a868SElliott Hughes		os=rtu
1650*d5c9a868SElliott Hughes		;;
1651*d5c9a868SElliott Hughes	m88k-omron*)
1652*d5c9a868SElliott Hughes		os=luna
1653*d5c9a868SElliott Hughes		;;
1654*d5c9a868SElliott Hughes	*-next)
1655*d5c9a868SElliott Hughes		os=nextstep
1656*d5c9a868SElliott Hughes		;;
1657*d5c9a868SElliott Hughes	*-sequent)
1658*d5c9a868SElliott Hughes		os=ptx
1659*d5c9a868SElliott Hughes		;;
1660*d5c9a868SElliott Hughes	*-crds)
1661*d5c9a868SElliott Hughes		os=unos
1662*d5c9a868SElliott Hughes		;;
1663*d5c9a868SElliott Hughes	*-ns)
1664*d5c9a868SElliott Hughes		os=genix
1665*d5c9a868SElliott Hughes		;;
1666*d5c9a868SElliott Hughes	i370-*)
1667*d5c9a868SElliott Hughes		os=mvs
1668*d5c9a868SElliott Hughes		;;
1669*d5c9a868SElliott Hughes	*-gould)
1670*d5c9a868SElliott Hughes		os=sysv
1671*d5c9a868SElliott Hughes		;;
1672*d5c9a868SElliott Hughes	*-highlevel)
1673*d5c9a868SElliott Hughes		os=bsd
1674*d5c9a868SElliott Hughes		;;
1675*d5c9a868SElliott Hughes	*-encore)
1676*d5c9a868SElliott Hughes		os=bsd
1677*d5c9a868SElliott Hughes		;;
1678*d5c9a868SElliott Hughes	*-sgi)
1679*d5c9a868SElliott Hughes		os=irix
1680*d5c9a868SElliott Hughes		;;
1681*d5c9a868SElliott Hughes	*-siemens)
1682*d5c9a868SElliott Hughes		os=sysv4
1683*d5c9a868SElliott Hughes		;;
1684*d5c9a868SElliott Hughes	*-masscomp)
1685*d5c9a868SElliott Hughes		os=rtu
1686*d5c9a868SElliott Hughes		;;
1687*d5c9a868SElliott Hughes	f30[01]-fujitsu | f700-fujitsu)
1688*d5c9a868SElliott Hughes		os=uxpv
1689*d5c9a868SElliott Hughes		;;
1690*d5c9a868SElliott Hughes	*-rom68k)
1691*d5c9a868SElliott Hughes		os=coff
1692*d5c9a868SElliott Hughes		;;
1693*d5c9a868SElliott Hughes	*-*bug)
1694*d5c9a868SElliott Hughes		os=coff
1695*d5c9a868SElliott Hughes		;;
1696*d5c9a868SElliott Hughes	*-apple)
1697*d5c9a868SElliott Hughes		os=macos
1698*d5c9a868SElliott Hughes		;;
1699*d5c9a868SElliott Hughes	*-atari*)
1700*d5c9a868SElliott Hughes		os=mint
1701*d5c9a868SElliott Hughes		;;
1702*d5c9a868SElliott Hughes	*-wrs)
1703*d5c9a868SElliott Hughes		os=vxworks
1704*d5c9a868SElliott Hughes		;;
1705*d5c9a868SElliott Hughes	*)
1706*d5c9a868SElliott Hughes		os=none
1707*d5c9a868SElliott Hughes		;;
1708*d5c9a868SElliott Hughesesac
1709*d5c9a868SElliott Hughes
1710*d5c9a868SElliott Hughesfi
1711*d5c9a868SElliott Hughes
1712*d5c9a868SElliott Hughes# Now, validate our (potentially fixed-up) OS.
1713*d5c9a868SElliott Hughescase $os in
1714*d5c9a868SElliott Hughes	# Sometimes we do "kernel-libc", so those need to count as OSes.
1715*d5c9a868SElliott Hughes	musl* | newlib* | relibc* | uclibc*)
1716*d5c9a868SElliott Hughes		;;
1717*d5c9a868SElliott Hughes	# Likewise for "kernel-abi"
1718*d5c9a868SElliott Hughes	eabi* | gnueabi*)
1719*d5c9a868SElliott Hughes		;;
1720*d5c9a868SElliott Hughes	# VxWorks passes extra cpu info in the 4th filed.
1721*d5c9a868SElliott Hughes	simlinux | simwindows | spe)
1722*d5c9a868SElliott Hughes		;;
1723*d5c9a868SElliott Hughes	# Now accept the basic system types.
1724*d5c9a868SElliott Hughes	# The portable systems comes first.
1725*d5c9a868SElliott Hughes	# Each alternative MUST end in a * to match a version number.
1726*d5c9a868SElliott Hughes	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1727*d5c9a868SElliott Hughes	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1728*d5c9a868SElliott Hughes	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1729*d5c9a868SElliott Hughes	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1730*d5c9a868SElliott Hughes	     | hiux* | abug | nacl* | netware* | windows* \
1731*d5c9a868SElliott Hughes	     | os9* | macos* | osx* | ios* \
1732*d5c9a868SElliott Hughes	     | mpw* | magic* | mmixware* | mon960* | lnews* \
1733*d5c9a868SElliott Hughes	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1734*d5c9a868SElliott Hughes	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
1735*d5c9a868SElliott Hughes	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1736*d5c9a868SElliott Hughes	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1737*d5c9a868SElliott Hughes	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1738*d5c9a868SElliott Hughes	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1739*d5c9a868SElliott Hughes	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1740*d5c9a868SElliott Hughes	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1741*d5c9a868SElliott Hughes	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1742*d5c9a868SElliott Hughes	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
1743*d5c9a868SElliott Hughes	     | chorusrdb* | cegcc* | glidix* | serenity* \
1744*d5c9a868SElliott Hughes	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1745*d5c9a868SElliott Hughes	     | midipix* | mingw32* | mingw64* | mint* \
1746*d5c9a868SElliott Hughes	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1747*d5c9a868SElliott Hughes	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1748*d5c9a868SElliott Hughes	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1749*d5c9a868SElliott Hughes	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1750*d5c9a868SElliott Hughes	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1751*d5c9a868SElliott Hughes	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1752*d5c9a868SElliott Hughes	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1753*d5c9a868SElliott Hughes	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1754*d5c9a868SElliott Hughes	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1755*d5c9a868SElliott Hughes	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1756*d5c9a868SElliott Hughes	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1757*d5c9a868SElliott Hughes	     | fiwix* )
1758*d5c9a868SElliott Hughes		;;
1759*d5c9a868SElliott Hughes	# This one is extra strict with allowed versions
1760*d5c9a868SElliott Hughes	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1761*d5c9a868SElliott Hughes		# Don't forget version if it is 3.2v4 or newer.
1762*d5c9a868SElliott Hughes		;;
1763*d5c9a868SElliott Hughes	none)
1764*d5c9a868SElliott Hughes		;;
1765*d5c9a868SElliott Hughes	*)
1766*d5c9a868SElliott Hughes		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1767*d5c9a868SElliott Hughes		exit 1
1768*d5c9a868SElliott Hughes		;;
1769*d5c9a868SElliott Hughesesac
1770*d5c9a868SElliott Hughes
1771*d5c9a868SElliott Hughes# As a final step for OS-related things, validate the OS-kernel combination
1772*d5c9a868SElliott Hughes# (given a valid OS), if there is a kernel.
1773*d5c9a868SElliott Hughescase $kernel-$os in
1774*d5c9a868SElliott Hughes	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1775*d5c9a868SElliott Hughes		   | linux-musl* | linux-relibc* | linux-uclibc* )
1776*d5c9a868SElliott Hughes		;;
1777*d5c9a868SElliott Hughes	uclinux-uclibc* )
1778*d5c9a868SElliott Hughes		;;
1779*d5c9a868SElliott Hughes	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
1780*d5c9a868SElliott Hughes		# These are just libc implementations, not actual OSes, and thus
1781*d5c9a868SElliott Hughes		# require a kernel.
1782*d5c9a868SElliott Hughes		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1783*d5c9a868SElliott Hughes		exit 1
1784*d5c9a868SElliott Hughes		;;
1785*d5c9a868SElliott Hughes	kfreebsd*-gnu* | kopensolaris*-gnu*)
1786*d5c9a868SElliott Hughes		;;
1787*d5c9a868SElliott Hughes	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1788*d5c9a868SElliott Hughes		;;
1789*d5c9a868SElliott Hughes	nto-qnx*)
1790*d5c9a868SElliott Hughes		;;
1791*d5c9a868SElliott Hughes	os2-emx)
1792*d5c9a868SElliott Hughes		;;
1793*d5c9a868SElliott Hughes	*-eabi* | *-gnueabi*)
1794*d5c9a868SElliott Hughes		;;
1795*d5c9a868SElliott Hughes	-*)
1796*d5c9a868SElliott Hughes		# Blank kernel with real OS is always fine.
1797*d5c9a868SElliott Hughes		;;
1798*d5c9a868SElliott Hughes	*-*)
1799*d5c9a868SElliott Hughes		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1800*d5c9a868SElliott Hughes		exit 1
1801*d5c9a868SElliott Hughes		;;
1802*d5c9a868SElliott Hughesesac
1803*d5c9a868SElliott Hughes
1804*d5c9a868SElliott Hughes# Here we handle the case where we know the os, and the CPU type, but not the
1805*d5c9a868SElliott Hughes# manufacturer.  We pick the logical manufacturer.
1806*d5c9a868SElliott Hughescase $vendor in
1807*d5c9a868SElliott Hughes	unknown)
1808*d5c9a868SElliott Hughes		case $cpu-$os in
1809*d5c9a868SElliott Hughes			*-riscix*)
1810*d5c9a868SElliott Hughes				vendor=acorn
1811*d5c9a868SElliott Hughes				;;
1812*d5c9a868SElliott Hughes			*-sunos*)
1813*d5c9a868SElliott Hughes				vendor=sun
1814*d5c9a868SElliott Hughes				;;
1815*d5c9a868SElliott Hughes			*-cnk* | *-aix*)
1816*d5c9a868SElliott Hughes				vendor=ibm
1817*d5c9a868SElliott Hughes				;;
1818*d5c9a868SElliott Hughes			*-beos*)
1819*d5c9a868SElliott Hughes				vendor=be
1820*d5c9a868SElliott Hughes				;;
1821*d5c9a868SElliott Hughes			*-hpux*)
1822*d5c9a868SElliott Hughes				vendor=hp
1823*d5c9a868SElliott Hughes				;;
1824*d5c9a868SElliott Hughes			*-mpeix*)
1825*d5c9a868SElliott Hughes				vendor=hp
1826*d5c9a868SElliott Hughes				;;
1827*d5c9a868SElliott Hughes			*-hiux*)
1828*d5c9a868SElliott Hughes				vendor=hitachi
1829*d5c9a868SElliott Hughes				;;
1830*d5c9a868SElliott Hughes			*-unos*)
1831*d5c9a868SElliott Hughes				vendor=crds
1832*d5c9a868SElliott Hughes				;;
1833*d5c9a868SElliott Hughes			*-dgux*)
1834*d5c9a868SElliott Hughes				vendor=dg
1835*d5c9a868SElliott Hughes				;;
1836*d5c9a868SElliott Hughes			*-luna*)
1837*d5c9a868SElliott Hughes				vendor=omron
1838*d5c9a868SElliott Hughes				;;
1839*d5c9a868SElliott Hughes			*-genix*)
1840*d5c9a868SElliott Hughes				vendor=ns
1841*d5c9a868SElliott Hughes				;;
1842*d5c9a868SElliott Hughes			*-clix*)
1843*d5c9a868SElliott Hughes				vendor=intergraph
1844*d5c9a868SElliott Hughes				;;
1845*d5c9a868SElliott Hughes			*-mvs* | *-opened*)
1846*d5c9a868SElliott Hughes				vendor=ibm
1847*d5c9a868SElliott Hughes				;;
1848*d5c9a868SElliott Hughes			*-os400*)
1849*d5c9a868SElliott Hughes				vendor=ibm
1850*d5c9a868SElliott Hughes				;;
1851*d5c9a868SElliott Hughes			s390-* | s390x-*)
1852*d5c9a868SElliott Hughes				vendor=ibm
1853*d5c9a868SElliott Hughes				;;
1854*d5c9a868SElliott Hughes			*-ptx*)
1855*d5c9a868SElliott Hughes				vendor=sequent
1856*d5c9a868SElliott Hughes				;;
1857*d5c9a868SElliott Hughes			*-tpf*)
1858*d5c9a868SElliott Hughes				vendor=ibm
1859*d5c9a868SElliott Hughes				;;
1860*d5c9a868SElliott Hughes			*-vxsim* | *-vxworks* | *-windiss*)
1861*d5c9a868SElliott Hughes				vendor=wrs
1862*d5c9a868SElliott Hughes				;;
1863*d5c9a868SElliott Hughes			*-aux*)
1864*d5c9a868SElliott Hughes				vendor=apple
1865*d5c9a868SElliott Hughes				;;
1866*d5c9a868SElliott Hughes			*-hms*)
1867*d5c9a868SElliott Hughes				vendor=hitachi
1868*d5c9a868SElliott Hughes				;;
1869*d5c9a868SElliott Hughes			*-mpw* | *-macos*)
1870*d5c9a868SElliott Hughes				vendor=apple
1871*d5c9a868SElliott Hughes				;;
1872*d5c9a868SElliott Hughes			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1873*d5c9a868SElliott Hughes				vendor=atari
1874*d5c9a868SElliott Hughes				;;
1875*d5c9a868SElliott Hughes			*-vos*)
1876*d5c9a868SElliott Hughes				vendor=stratus
1877*d5c9a868SElliott Hughes				;;
1878*d5c9a868SElliott Hughes		esac
1879*d5c9a868SElliott Hughes		;;
1880*d5c9a868SElliott Hughesesac
1881*d5c9a868SElliott Hughes
1882*d5c9a868SElliott Hughesecho "$cpu-$vendor-${kernel:+$kernel-}$os"
1883*d5c9a868SElliott Hughesexit
1884*d5c9a868SElliott Hughes
1885*d5c9a868SElliott Hughes# Local variables:
1886*d5c9a868SElliott Hughes# eval: (add-hook 'before-save-hook 'time-stamp)
1887*d5c9a868SElliott Hughes# time-stamp-start: "timestamp='"
1888*d5c9a868SElliott Hughes# time-stamp-format: "%:y-%02m-%02d"
1889*d5c9a868SElliott Hughes# time-stamp-end: "'"
1890*d5c9a868SElliott Hughes# End:
1891