config.sub revision 291ca6f5
129459361Smrg#! /bin/sh
229459361Smrg# Configuration validation subroutine script.
3291ca6f5Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
429459361Smrg
5291ca6f5Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6291ca6f5Smrg
7291ca6f5Smrgtimestamp='2021-08-14'
829459361Smrg
9f66e55a2Smrg# This file is free software; you can redistribute it and/or modify it
10f66e55a2Smrg# under the terms of the GNU General Public License as published by
11f66e55a2Smrg# the Free Software Foundation; either version 3 of the License, or
1229459361Smrg# (at your option) any later version.
1329459361Smrg#
14f66e55a2Smrg# This program is distributed in the hope that it will be useful, but
15f66e55a2Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16f66e55a2Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17f66e55a2Smrg# General Public License for more details.
1829459361Smrg#
1929459361Smrg# You should have received a copy of the GNU General Public License
2027935385Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2129459361Smrg#
2229459361Smrg# As a special exception to the GNU General Public License, if you
2329459361Smrg# distribute this file as part of a program that contains a
2429459361Smrg# configuration script generated by Autoconf, you may include it under
25f66e55a2Smrg# the same distribution terms that you use for the rest of that
26f66e55a2Smrg# program.  This Exception is an additional permission under section 7
27f66e55a2Smrg# of the GNU General Public License, version 3 ("GPLv3").
2829459361Smrg
2929459361Smrg
3027935385Smrg# Please send patches to <config-patches@gnu.org>.
3129459361Smrg#
3229459361Smrg# Configuration subroutine to validate and canonicalize a configuration type.
3329459361Smrg# Supply the specified configuration type as an argument.
3429459361Smrg# If it is invalid, we print an error message on stderr and exit with code 1.
3529459361Smrg# Otherwise, we print the canonical config type on stdout and succeed.
3629459361Smrg
37c3c9b392Smrg# You can get the latest version of this script from:
38291ca6f5Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
39c3c9b392Smrg
4029459361Smrg# This file is supposed to be the same for all GNU packages
4129459361Smrg# and recognize all the CPU types, system types and aliases
4229459361Smrg# that are meaningful with *any* GNU software.
4329459361Smrg# Each package is responsible for reporting which valid configurations
4429459361Smrg# it does not support.  The user should be able to distinguish
4529459361Smrg# a failure to support a valid configuration from a meaningless
4629459361Smrg# configuration.
4729459361Smrg
4829459361Smrg# The goal of this file is to map all the various variations of a given
4929459361Smrg# machine specification into a single specification in the form:
5029459361Smrg#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
5129459361Smrg# or in some cases, the newer four-part form:
5229459361Smrg#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
5329459361Smrg# It is wrong to echo any other type of specification.
5429459361Smrg
55291ca6f5Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
56291ca6f5Smrg# about features and limitations of the classic Bourne shell that were
57291ca6f5Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
58291ca6f5Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
59291ca6f5Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
60291ca6f5Smrg# have a pre-POSIX /bin/sh.
61291ca6f5Smrg
6229459361Smrgme=`echo "$0" | sed -e 's,.*/,,'`
6329459361Smrg
6429459361Smrgusage="\
6527935385SmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
6629459361Smrg
6729459361SmrgCanonicalize a configuration name.
6829459361Smrg
6927935385SmrgOptions:
7029459361Smrg  -h, --help         print this help, then exit
7129459361Smrg  -t, --time-stamp   print date of last modification, then exit
7229459361Smrg  -v, --version      print version number, then exit
7329459361Smrg
7429459361SmrgReport bugs and patches to <config-patches@gnu.org>."
7529459361Smrg
7629459361Smrgversion="\
7729459361SmrgGNU config.sub ($timestamp)
7829459361Smrg
79291ca6f5SmrgCopyright 1992-2021 Free Software Foundation, Inc.
8029459361Smrg
8129459361SmrgThis is free software; see the source for copying conditions.  There is NO
8229459361Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
8329459361Smrg
8429459361Smrghelp="
8529459361SmrgTry \`$me --help' for more information."
8629459361Smrg
8729459361Smrg# Parse command line
8829459361Smrgwhile test $# -gt 0 ; do
8929459361Smrg  case $1 in
9029459361Smrg    --time-stamp | --time* | -t )
9129459361Smrg       echo "$timestamp" ; exit ;;
9229459361Smrg    --version | -v )
9329459361Smrg       echo "$version" ; exit ;;
9429459361Smrg    --help | --h* | -h )
9529459361Smrg       echo "$usage"; exit ;;
9629459361Smrg    -- )     # Stop option processing
9729459361Smrg       shift; break ;;
9829459361Smrg    - )	# Use stdin as input.
9929459361Smrg       break ;;
10029459361Smrg    -* )
101291ca6f5Smrg       echo "$me: invalid option $1$help" >&2
10229459361Smrg       exit 1 ;;
10329459361Smrg
10429459361Smrg    *local*)
10529459361Smrg       # First pass through any local machine types.
10627935385Smrg       echo "$1"
10729459361Smrg       exit ;;
10829459361Smrg
10929459361Smrg    * )
11029459361Smrg       break ;;
11129459361Smrg  esac
11229459361Smrgdone
11329459361Smrg
11429459361Smrgcase $# in
11529459361Smrg 0) echo "$me: missing argument$help" >&2
11629459361Smrg    exit 1;;
11729459361Smrg 1) ;;
11829459361Smrg *) echo "$me: too many arguments$help" >&2
11929459361Smrg    exit 1;;
12029459361Smrgesac
12129459361Smrg
122291ca6f5Smrg# Split fields of configuration type
123291ca6f5Smrg# shellcheck disable=SC2162
124291ca6f5Smrgsaved_IFS=$IFS
125291ca6f5SmrgIFS="-" read field1 field2 field3 field4 <<EOF
126291ca6f5Smrg$1
127291ca6f5SmrgEOF
128291ca6f5SmrgIFS=$saved_IFS
12929459361Smrg
130291ca6f5Smrg# Separate into logical components for further validation
131291ca6f5Smrgcase $1 in
132291ca6f5Smrg	*-*-*-*-*)
133291ca6f5Smrg		echo Invalid configuration \`"$1"\': more than four components >&2
134291ca6f5Smrg		exit 1
135f66e55a2Smrg		;;
136291ca6f5Smrg	*-*-*-*)
137291ca6f5Smrg		basic_machine=$field1-$field2
138291ca6f5Smrg		basic_os=$field3-$field4
13929459361Smrg		;;
140291ca6f5Smrg	*-*-*)
141291ca6f5Smrg		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
142291ca6f5Smrg		# parts
143291ca6f5Smrg		maybe_os=$field2-$field3
144291ca6f5Smrg		case $maybe_os in
145291ca6f5Smrg			nto-qnx* | linux-* | uclinux-uclibc* \
146291ca6f5Smrg			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
147291ca6f5Smrg			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
148291ca6f5Smrg			| storm-chaos* | os2-emx* | rtmk-nova*)
149291ca6f5Smrg				basic_machine=$field1
150291ca6f5Smrg				basic_os=$maybe_os
151291ca6f5Smrg				;;
152291ca6f5Smrg			android-linux)
153291ca6f5Smrg				basic_machine=$field1-unknown
154291ca6f5Smrg				basic_os=linux-android
155291ca6f5Smrg				;;
156291ca6f5Smrg			*)
157291ca6f5Smrg				basic_machine=$field1-$field2
158291ca6f5Smrg				basic_os=$field3
159291ca6f5Smrg				;;
160291ca6f5Smrg		esac
16129459361Smrg		;;
162291ca6f5Smrg	*-*)
163291ca6f5Smrg		# A lone config we happen to match not fitting any pattern
164291ca6f5Smrg		case $field1-$field2 in
165291ca6f5Smrg			decstation-3100)
166291ca6f5Smrg				basic_machine=mips-dec
167291ca6f5Smrg				basic_os=
168291ca6f5Smrg				;;
169291ca6f5Smrg			*-*)
170291ca6f5Smrg				# Second component is usually, but not always the OS
171291ca6f5Smrg				case $field2 in
172291ca6f5Smrg					# Prevent following clause from handling this valid os
173291ca6f5Smrg					sun*os*)
174291ca6f5Smrg						basic_machine=$field1
175291ca6f5Smrg						basic_os=$field2
176291ca6f5Smrg						;;
177291ca6f5Smrg					zephyr*)
178291ca6f5Smrg						basic_machine=$field1-unknown
179291ca6f5Smrg						basic_os=$field2
180291ca6f5Smrg						;;
181291ca6f5Smrg					# Manufacturers
182291ca6f5Smrg					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
183291ca6f5Smrg					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
184291ca6f5Smrg					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
185291ca6f5Smrg					| convergent* | ncr* | news | 32* | 3600* | 3100* \
186291ca6f5Smrg					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
187291ca6f5Smrg					| ultra | tti* | harris | dolphin | highlevel | gould \
188291ca6f5Smrg					| cbm | ns | masscomp | apple | axis | knuth | cray \
189291ca6f5Smrg					| microblaze* | sim | cisco \
190291ca6f5Smrg					| oki | wec | wrs | winbond)
191291ca6f5Smrg						basic_machine=$field1-$field2
192291ca6f5Smrg						basic_os=
193291ca6f5Smrg						;;
194291ca6f5Smrg					*)
195291ca6f5Smrg						basic_machine=$field1
196291ca6f5Smrg						basic_os=$field2
197291ca6f5Smrg						;;
198291ca6f5Smrg				esac
199291ca6f5Smrg			;;
200291ca6f5Smrg		esac
20129459361Smrg		;;
202291ca6f5Smrg	*)
203291ca6f5Smrg		# Convert single-component short-hands not valid as part of
204291ca6f5Smrg		# multi-component configurations.
205291ca6f5Smrg		case $field1 in
206291ca6f5Smrg			386bsd)
207291ca6f5Smrg				basic_machine=i386-pc
208291ca6f5Smrg				basic_os=bsd
209291ca6f5Smrg				;;
210291ca6f5Smrg			a29khif)
211291ca6f5Smrg				basic_machine=a29k-amd
212291ca6f5Smrg				basic_os=udi
213291ca6f5Smrg				;;
214291ca6f5Smrg			adobe68k)
215291ca6f5Smrg				basic_machine=m68010-adobe
216291ca6f5Smrg				basic_os=scout
217291ca6f5Smrg				;;
218291ca6f5Smrg			alliant)
219291ca6f5Smrg				basic_machine=fx80-alliant
220291ca6f5Smrg				basic_os=
221291ca6f5Smrg				;;
222291ca6f5Smrg			altos | altos3068)
223291ca6f5Smrg				basic_machine=m68k-altos
224291ca6f5Smrg				basic_os=
225291ca6f5Smrg				;;
226291ca6f5Smrg			am29k)
227291ca6f5Smrg				basic_machine=a29k-none
228291ca6f5Smrg				basic_os=bsd
229291ca6f5Smrg				;;
230291ca6f5Smrg			amdahl)
231291ca6f5Smrg				basic_machine=580-amdahl
232291ca6f5Smrg				basic_os=sysv
233291ca6f5Smrg				;;
234291ca6f5Smrg			amiga)
235291ca6f5Smrg				basic_machine=m68k-unknown
236291ca6f5Smrg				basic_os=
237291ca6f5Smrg				;;
238291ca6f5Smrg			amigaos | amigados)
239291ca6f5Smrg				basic_machine=m68k-unknown
240291ca6f5Smrg				basic_os=amigaos
241291ca6f5Smrg				;;
242291ca6f5Smrg			amigaunix | amix)
243291ca6f5Smrg				basic_machine=m68k-unknown
244291ca6f5Smrg				basic_os=sysv4
245291ca6f5Smrg				;;
246291ca6f5Smrg			apollo68)
247291ca6f5Smrg				basic_machine=m68k-apollo
248291ca6f5Smrg				basic_os=sysv
249291ca6f5Smrg				;;
250291ca6f5Smrg			apollo68bsd)
251291ca6f5Smrg				basic_machine=m68k-apollo
252291ca6f5Smrg				basic_os=bsd
253291ca6f5Smrg				;;
254291ca6f5Smrg			aros)
255291ca6f5Smrg				basic_machine=i386-pc
256291ca6f5Smrg				basic_os=aros
257291ca6f5Smrg				;;
258291ca6f5Smrg			aux)
259291ca6f5Smrg				basic_machine=m68k-apple
260291ca6f5Smrg				basic_os=aux
261291ca6f5Smrg				;;
262291ca6f5Smrg			balance)
263291ca6f5Smrg				basic_machine=ns32k-sequent
264291ca6f5Smrg				basic_os=dynix
265291ca6f5Smrg				;;
266291ca6f5Smrg			blackfin)
267291ca6f5Smrg				basic_machine=bfin-unknown
268291ca6f5Smrg				basic_os=linux
269291ca6f5Smrg				;;
270291ca6f5Smrg			cegcc)
271291ca6f5Smrg				basic_machine=arm-unknown
272291ca6f5Smrg				basic_os=cegcc
273291ca6f5Smrg				;;
274291ca6f5Smrg			convex-c1)
275291ca6f5Smrg				basic_machine=c1-convex
276291ca6f5Smrg				basic_os=bsd
277291ca6f5Smrg				;;
278291ca6f5Smrg			convex-c2)
279291ca6f5Smrg				basic_machine=c2-convex
280291ca6f5Smrg				basic_os=bsd
281291ca6f5Smrg				;;
282291ca6f5Smrg			convex-c32)
283291ca6f5Smrg				basic_machine=c32-convex
284291ca6f5Smrg				basic_os=bsd
285291ca6f5Smrg				;;
286291ca6f5Smrg			convex-c34)
287291ca6f5Smrg				basic_machine=c34-convex
288291ca6f5Smrg				basic_os=bsd
289291ca6f5Smrg				;;
290291ca6f5Smrg			convex-c38)
291291ca6f5Smrg				basic_machine=c38-convex
292291ca6f5Smrg				basic_os=bsd
293291ca6f5Smrg				;;
294291ca6f5Smrg			cray)
295291ca6f5Smrg				basic_machine=j90-cray
296291ca6f5Smrg				basic_os=unicos
297291ca6f5Smrg				;;
298291ca6f5Smrg			crds | unos)
299291ca6f5Smrg				basic_machine=m68k-crds
300291ca6f5Smrg				basic_os=
301291ca6f5Smrg				;;
302291ca6f5Smrg			da30)
303291ca6f5Smrg				basic_machine=m68k-da30
304291ca6f5Smrg				basic_os=
305291ca6f5Smrg				;;
306291ca6f5Smrg			decstation | pmax | pmin | dec3100 | decstatn)
307291ca6f5Smrg				basic_machine=mips-dec
308291ca6f5Smrg				basic_os=
309291ca6f5Smrg				;;
310291ca6f5Smrg			delta88)
311291ca6f5Smrg				basic_machine=m88k-motorola
312291ca6f5Smrg				basic_os=sysv3
313291ca6f5Smrg				;;
314291ca6f5Smrg			dicos)
315291ca6f5Smrg				basic_machine=i686-pc
316291ca6f5Smrg				basic_os=dicos
317291ca6f5Smrg				;;
318291ca6f5Smrg			djgpp)
319291ca6f5Smrg				basic_machine=i586-pc
320291ca6f5Smrg				basic_os=msdosdjgpp
321291ca6f5Smrg				;;
322291ca6f5Smrg			ebmon29k)
323291ca6f5Smrg				basic_machine=a29k-amd
324291ca6f5Smrg				basic_os=ebmon
325291ca6f5Smrg				;;
326291ca6f5Smrg			es1800 | OSE68k | ose68k | ose | OSE)
327291ca6f5Smrg				basic_machine=m68k-ericsson
328291ca6f5Smrg				basic_os=ose
329291ca6f5Smrg				;;
330291ca6f5Smrg			gmicro)
331291ca6f5Smrg				basic_machine=tron-gmicro
332291ca6f5Smrg				basic_os=sysv
333291ca6f5Smrg				;;
334291ca6f5Smrg			go32)
335291ca6f5Smrg				basic_machine=i386-pc
336291ca6f5Smrg				basic_os=go32
337291ca6f5Smrg				;;
338291ca6f5Smrg			h8300hms)
339291ca6f5Smrg				basic_machine=h8300-hitachi
340291ca6f5Smrg				basic_os=hms
341291ca6f5Smrg				;;
342291ca6f5Smrg			h8300xray)
343291ca6f5Smrg				basic_machine=h8300-hitachi
344291ca6f5Smrg				basic_os=xray
345291ca6f5Smrg				;;
346291ca6f5Smrg			h8500hms)
347291ca6f5Smrg				basic_machine=h8500-hitachi
348291ca6f5Smrg				basic_os=hms
349291ca6f5Smrg				;;
350291ca6f5Smrg			harris)
351291ca6f5Smrg				basic_machine=m88k-harris
352291ca6f5Smrg				basic_os=sysv3
353291ca6f5Smrg				;;
354291ca6f5Smrg			hp300 | hp300hpux)
355291ca6f5Smrg				basic_machine=m68k-hp
356291ca6f5Smrg				basic_os=hpux
357291ca6f5Smrg				;;
358291ca6f5Smrg			hp300bsd)
359291ca6f5Smrg				basic_machine=m68k-hp
360291ca6f5Smrg				basic_os=bsd
361291ca6f5Smrg				;;
362291ca6f5Smrg			hppaosf)
363291ca6f5Smrg				basic_machine=hppa1.1-hp
364291ca6f5Smrg				basic_os=osf
365291ca6f5Smrg				;;
366291ca6f5Smrg			hppro)
367291ca6f5Smrg				basic_machine=hppa1.1-hp
368291ca6f5Smrg				basic_os=proelf
369291ca6f5Smrg				;;
370291ca6f5Smrg			i386mach)
371291ca6f5Smrg				basic_machine=i386-mach
372291ca6f5Smrg				basic_os=mach
373291ca6f5Smrg				;;
374291ca6f5Smrg			isi68 | isi)
375291ca6f5Smrg				basic_machine=m68k-isi
376291ca6f5Smrg				basic_os=sysv
377291ca6f5Smrg				;;
378291ca6f5Smrg			m68knommu)
379291ca6f5Smrg				basic_machine=m68k-unknown
380291ca6f5Smrg				basic_os=linux
381291ca6f5Smrg				;;
382291ca6f5Smrg			magnum | m3230)
383291ca6f5Smrg				basic_machine=mips-mips
384291ca6f5Smrg				basic_os=sysv
385291ca6f5Smrg				;;
386291ca6f5Smrg			merlin)
387291ca6f5Smrg				basic_machine=ns32k-utek
388291ca6f5Smrg				basic_os=sysv
389291ca6f5Smrg				;;
390291ca6f5Smrg			mingw64)
391291ca6f5Smrg				basic_machine=x86_64-pc
392291ca6f5Smrg				basic_os=mingw64
393291ca6f5Smrg				;;
394291ca6f5Smrg			mingw32)
395291ca6f5Smrg				basic_machine=i686-pc
396291ca6f5Smrg				basic_os=mingw32
397291ca6f5Smrg				;;
398291ca6f5Smrg			mingw32ce)
399291ca6f5Smrg				basic_machine=arm-unknown
400291ca6f5Smrg				basic_os=mingw32ce
401291ca6f5Smrg				;;
402291ca6f5Smrg			monitor)
403291ca6f5Smrg				basic_machine=m68k-rom68k
404291ca6f5Smrg				basic_os=coff
405291ca6f5Smrg				;;
406291ca6f5Smrg			morphos)
407291ca6f5Smrg				basic_machine=powerpc-unknown
408291ca6f5Smrg				basic_os=morphos
409291ca6f5Smrg				;;
410291ca6f5Smrg			moxiebox)
411291ca6f5Smrg				basic_machine=moxie-unknown
412291ca6f5Smrg				basic_os=moxiebox
413291ca6f5Smrg				;;
414291ca6f5Smrg			msdos)
415291ca6f5Smrg				basic_machine=i386-pc
416291ca6f5Smrg				basic_os=msdos
417291ca6f5Smrg				;;
418291ca6f5Smrg			msys)
419291ca6f5Smrg				basic_machine=i686-pc
420291ca6f5Smrg				basic_os=msys
421291ca6f5Smrg				;;
422291ca6f5Smrg			mvs)
423291ca6f5Smrg				basic_machine=i370-ibm
424291ca6f5Smrg				basic_os=mvs
425291ca6f5Smrg				;;
426291ca6f5Smrg			nacl)
427291ca6f5Smrg				basic_machine=le32-unknown
428291ca6f5Smrg				basic_os=nacl
429291ca6f5Smrg				;;
430291ca6f5Smrg			ncr3000)
431291ca6f5Smrg				basic_machine=i486-ncr
432291ca6f5Smrg				basic_os=sysv4
433291ca6f5Smrg				;;
434291ca6f5Smrg			netbsd386)
435291ca6f5Smrg				basic_machine=i386-pc
436291ca6f5Smrg				basic_os=netbsd
437291ca6f5Smrg				;;
438291ca6f5Smrg			netwinder)
439291ca6f5Smrg				basic_machine=armv4l-rebel
440291ca6f5Smrg				basic_os=linux
441291ca6f5Smrg				;;
442291ca6f5Smrg			news | news700 | news800 | news900)
443291ca6f5Smrg				basic_machine=m68k-sony
444291ca6f5Smrg				basic_os=newsos
445291ca6f5Smrg				;;
446291ca6f5Smrg			news1000)
447291ca6f5Smrg				basic_machine=m68030-sony
448291ca6f5Smrg				basic_os=newsos
449291ca6f5Smrg				;;
450291ca6f5Smrg			necv70)
451291ca6f5Smrg				basic_machine=v70-nec
452291ca6f5Smrg				basic_os=sysv
453291ca6f5Smrg				;;
454291ca6f5Smrg			nh3000)
455291ca6f5Smrg				basic_machine=m68k-harris
456291ca6f5Smrg				basic_os=cxux
457291ca6f5Smrg				;;
458291ca6f5Smrg			nh[45]000)
459291ca6f5Smrg				basic_machine=m88k-harris
460291ca6f5Smrg				basic_os=cxux
461291ca6f5Smrg				;;
462291ca6f5Smrg			nindy960)
463291ca6f5Smrg				basic_machine=i960-intel
464291ca6f5Smrg				basic_os=nindy
465291ca6f5Smrg				;;
466291ca6f5Smrg			mon960)
467291ca6f5Smrg				basic_machine=i960-intel
468291ca6f5Smrg				basic_os=mon960
469291ca6f5Smrg				;;
470291ca6f5Smrg			nonstopux)
471291ca6f5Smrg				basic_machine=mips-compaq
472291ca6f5Smrg				basic_os=nonstopux
473291ca6f5Smrg				;;
474291ca6f5Smrg			os400)
475291ca6f5Smrg				basic_machine=powerpc-ibm
476291ca6f5Smrg				basic_os=os400
477291ca6f5Smrg				;;
478291ca6f5Smrg			OSE68000 | ose68000)
479291ca6f5Smrg				basic_machine=m68000-ericsson
480291ca6f5Smrg				basic_os=ose
481291ca6f5Smrg				;;
482291ca6f5Smrg			os68k)
483291ca6f5Smrg				basic_machine=m68k-none
484291ca6f5Smrg				basic_os=os68k
485291ca6f5Smrg				;;
486291ca6f5Smrg			paragon)
487291ca6f5Smrg				basic_machine=i860-intel
488291ca6f5Smrg				basic_os=osf
489291ca6f5Smrg				;;
490291ca6f5Smrg			parisc)
491291ca6f5Smrg				basic_machine=hppa-unknown
492291ca6f5Smrg				basic_os=linux
493291ca6f5Smrg				;;
494291ca6f5Smrg			psp)
495291ca6f5Smrg				basic_machine=mipsallegrexel-sony
496291ca6f5Smrg				basic_os=psp
497291ca6f5Smrg				;;
498291ca6f5Smrg			pw32)
499291ca6f5Smrg				basic_machine=i586-unknown
500291ca6f5Smrg				basic_os=pw32
501291ca6f5Smrg				;;
502291ca6f5Smrg			rdos | rdos64)
503291ca6f5Smrg				basic_machine=x86_64-pc
504291ca6f5Smrg				basic_os=rdos
505291ca6f5Smrg				;;
506291ca6f5Smrg			rdos32)
507291ca6f5Smrg				basic_machine=i386-pc
508291ca6f5Smrg				basic_os=rdos
509291ca6f5Smrg				;;
510291ca6f5Smrg			rom68k)
511291ca6f5Smrg				basic_machine=m68k-rom68k
512291ca6f5Smrg				basic_os=coff
513291ca6f5Smrg				;;
514291ca6f5Smrg			sa29200)
515291ca6f5Smrg				basic_machine=a29k-amd
516291ca6f5Smrg				basic_os=udi
517291ca6f5Smrg				;;
518291ca6f5Smrg			sei)
519291ca6f5Smrg				basic_machine=mips-sei
520291ca6f5Smrg				basic_os=seiux
521291ca6f5Smrg				;;
522291ca6f5Smrg			sequent)
523291ca6f5Smrg				basic_machine=i386-sequent
524291ca6f5Smrg				basic_os=
525291ca6f5Smrg				;;
526291ca6f5Smrg			sps7)
527291ca6f5Smrg				basic_machine=m68k-bull
528291ca6f5Smrg				basic_os=sysv2
529291ca6f5Smrg				;;
530291ca6f5Smrg			st2000)
531291ca6f5Smrg				basic_machine=m68k-tandem
532291ca6f5Smrg				basic_os=
533291ca6f5Smrg				;;
534291ca6f5Smrg			stratus)
535291ca6f5Smrg				basic_machine=i860-stratus
536291ca6f5Smrg				basic_os=sysv4
537291ca6f5Smrg				;;
538291ca6f5Smrg			sun2)
539291ca6f5Smrg				basic_machine=m68000-sun
540291ca6f5Smrg				basic_os=
541291ca6f5Smrg				;;
542291ca6f5Smrg			sun2os3)
543291ca6f5Smrg				basic_machine=m68000-sun
544291ca6f5Smrg				basic_os=sunos3
545291ca6f5Smrg				;;
546291ca6f5Smrg			sun2os4)
547291ca6f5Smrg				basic_machine=m68000-sun
548291ca6f5Smrg				basic_os=sunos4
549291ca6f5Smrg				;;
550291ca6f5Smrg			sun3)
551291ca6f5Smrg				basic_machine=m68k-sun
552291ca6f5Smrg				basic_os=
553291ca6f5Smrg				;;
554291ca6f5Smrg			sun3os3)
555291ca6f5Smrg				basic_machine=m68k-sun
556291ca6f5Smrg				basic_os=sunos3
557291ca6f5Smrg				;;
558291ca6f5Smrg			sun3os4)
559291ca6f5Smrg				basic_machine=m68k-sun
560291ca6f5Smrg				basic_os=sunos4
561291ca6f5Smrg				;;
562291ca6f5Smrg			sun4)
563291ca6f5Smrg				basic_machine=sparc-sun
564291ca6f5Smrg				basic_os=
565291ca6f5Smrg				;;
566291ca6f5Smrg			sun4os3)
567291ca6f5Smrg				basic_machine=sparc-sun
568291ca6f5Smrg				basic_os=sunos3
569291ca6f5Smrg				;;
570291ca6f5Smrg			sun4os4)
571291ca6f5Smrg				basic_machine=sparc-sun
572291ca6f5Smrg				basic_os=sunos4
573291ca6f5Smrg				;;
574291ca6f5Smrg			sun4sol2)
575291ca6f5Smrg				basic_machine=sparc-sun
576291ca6f5Smrg				basic_os=solaris2
577291ca6f5Smrg				;;
578291ca6f5Smrg			sun386 | sun386i | roadrunner)
579291ca6f5Smrg				basic_machine=i386-sun
580291ca6f5Smrg				basic_os=
581291ca6f5Smrg				;;
582291ca6f5Smrg			sv1)
583291ca6f5Smrg				basic_machine=sv1-cray
584291ca6f5Smrg				basic_os=unicos
585291ca6f5Smrg				;;
586291ca6f5Smrg			symmetry)
587291ca6f5Smrg				basic_machine=i386-sequent
588291ca6f5Smrg				basic_os=dynix
589291ca6f5Smrg				;;
590291ca6f5Smrg			t3e)
591291ca6f5Smrg				basic_machine=alphaev5-cray
592291ca6f5Smrg				basic_os=unicos
593291ca6f5Smrg				;;
594291ca6f5Smrg			t90)
595291ca6f5Smrg				basic_machine=t90-cray
596291ca6f5Smrg				basic_os=unicos
597291ca6f5Smrg				;;
598291ca6f5Smrg			toad1)
599291ca6f5Smrg				basic_machine=pdp10-xkl
600291ca6f5Smrg				basic_os=tops20
601291ca6f5Smrg				;;
602291ca6f5Smrg			tpf)
603291ca6f5Smrg				basic_machine=s390x-ibm
604291ca6f5Smrg				basic_os=tpf
605291ca6f5Smrg				;;
606291ca6f5Smrg			udi29k)
607291ca6f5Smrg				basic_machine=a29k-amd
608291ca6f5Smrg				basic_os=udi
609291ca6f5Smrg				;;
610291ca6f5Smrg			ultra3)
611291ca6f5Smrg				basic_machine=a29k-nyu
612291ca6f5Smrg				basic_os=sym1
613291ca6f5Smrg				;;
614291ca6f5Smrg			v810 | necv810)
615291ca6f5Smrg				basic_machine=v810-nec
616291ca6f5Smrg				basic_os=none
617291ca6f5Smrg				;;
618291ca6f5Smrg			vaxv)
619291ca6f5Smrg				basic_machine=vax-dec
620291ca6f5Smrg				basic_os=sysv
621291ca6f5Smrg				;;
622291ca6f5Smrg			vms)
623291ca6f5Smrg				basic_machine=vax-dec
624291ca6f5Smrg				basic_os=vms
625291ca6f5Smrg				;;
626291ca6f5Smrg			vsta)
627291ca6f5Smrg				basic_machine=i386-pc
628291ca6f5Smrg				basic_os=vsta
629291ca6f5Smrg				;;
630291ca6f5Smrg			vxworks960)
631291ca6f5Smrg				basic_machine=i960-wrs
632291ca6f5Smrg				basic_os=vxworks
633291ca6f5Smrg				;;
634291ca6f5Smrg			vxworks68)
635291ca6f5Smrg				basic_machine=m68k-wrs
636291ca6f5Smrg				basic_os=vxworks
637291ca6f5Smrg				;;
638291ca6f5Smrg			vxworks29k)
639291ca6f5Smrg				basic_machine=a29k-wrs
640291ca6f5Smrg				basic_os=vxworks
641291ca6f5Smrg				;;
642291ca6f5Smrg			xbox)
643291ca6f5Smrg				basic_machine=i686-pc
644291ca6f5Smrg				basic_os=mingw32
645291ca6f5Smrg				;;
646291ca6f5Smrg			ymp)
647291ca6f5Smrg				basic_machine=ymp-cray
648291ca6f5Smrg				basic_os=unicos
649291ca6f5Smrg				;;
650291ca6f5Smrg			*)
651291ca6f5Smrg				basic_machine=$1
652291ca6f5Smrg				basic_os=
653291ca6f5Smrg				;;
654291ca6f5Smrg		esac
65529459361Smrg		;;
65629459361Smrgesac
65729459361Smrg
658291ca6f5Smrg# Decode 1-component or ad-hoc basic machines
65929459361Smrgcase $basic_machine in
660291ca6f5Smrg	# Here we handle the default manufacturer of certain CPU types.  It is in
661291ca6f5Smrg	# some cases the only manufacturer, in others, it is the most popular.
662291ca6f5Smrg	w89k)
663291ca6f5Smrg		cpu=hppa1.1
664291ca6f5Smrg		vendor=winbond
66527935385Smrg		;;
666291ca6f5Smrg	op50n)
667291ca6f5Smrg		cpu=hppa1.1
668291ca6f5Smrg		vendor=oki
66929459361Smrg		;;
670291ca6f5Smrg	op60c)
671291ca6f5Smrg		cpu=hppa1.1
672291ca6f5Smrg		vendor=oki
67329459361Smrg		;;
674291ca6f5Smrg	ibm*)
675291ca6f5Smrg		cpu=i370
676291ca6f5Smrg		vendor=ibm
67729459361Smrg		;;
678291ca6f5Smrg	orion105)
679291ca6f5Smrg		cpu=clipper
680291ca6f5Smrg		vendor=highlevel
681f66e55a2Smrg		;;
682291ca6f5Smrg	mac | mpw | mac-mpw)
683291ca6f5Smrg		cpu=m68k
684291ca6f5Smrg		vendor=apple
685f66e55a2Smrg		;;
686291ca6f5Smrg	pmac | pmac-mpw)
687291ca6f5Smrg		cpu=powerpc
688291ca6f5Smrg		vendor=apple
689f66e55a2Smrg		;;
690f66e55a2Smrg
69129459361Smrg	# Recognize the various machine names and aliases which stand
69229459361Smrg	# for a CPU type and a company and sometimes even an OS.
69329459361Smrg	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
694291ca6f5Smrg		cpu=m68000
695291ca6f5Smrg		vendor=att
69629459361Smrg		;;
69729459361Smrg	3b*)
698291ca6f5Smrg		cpu=we32k
699291ca6f5Smrg		vendor=att
7005715adc0Smrg		;;
701c3c9b392Smrg	bluegene*)
702291ca6f5Smrg		cpu=powerpc
703291ca6f5Smrg		vendor=ibm
704291ca6f5Smrg		basic_os=cnk
70529459361Smrg		;;
70629459361Smrg	decsystem10* | dec10*)
707291ca6f5Smrg		cpu=pdp10
708291ca6f5Smrg		vendor=dec
709291ca6f5Smrg		basic_os=tops10
71029459361Smrg		;;
71129459361Smrg	decsystem20* | dec20*)
712291ca6f5Smrg		cpu=pdp10
713291ca6f5Smrg		vendor=dec
714291ca6f5Smrg		basic_os=tops20
71529459361Smrg		;;
71629459361Smrg	delta | 3300 | motorola-3300 | motorola-delta \
71729459361Smrg	      | 3300-motorola | delta-motorola)
718291ca6f5Smrg		cpu=m68k
719291ca6f5Smrg		vendor=motorola
72029459361Smrg		;;
72127935385Smrg	dpx2*)
722291ca6f5Smrg		cpu=m68k
723291ca6f5Smrg		vendor=bull
724291ca6f5Smrg		basic_os=sysv3
72529459361Smrg		;;
72629459361Smrg	encore | umax | mmax)
727291ca6f5Smrg		cpu=ns32k
728291ca6f5Smrg		vendor=encore
72929459361Smrg		;;
730291ca6f5Smrg	elxsi)
731291ca6f5Smrg		cpu=elxsi
732291ca6f5Smrg		vendor=elxsi
733291ca6f5Smrg		basic_os=${basic_os:-bsd}
73429459361Smrg		;;
73529459361Smrg	fx2800)
736291ca6f5Smrg		cpu=i860
737291ca6f5Smrg		vendor=alliant
73829459361Smrg		;;
73929459361Smrg	genix)
740291ca6f5Smrg		cpu=ns32k
741291ca6f5Smrg		vendor=ns
74229459361Smrg		;;
74329459361Smrg	h3050r* | hiux*)
744291ca6f5Smrg		cpu=hppa1.1
745291ca6f5Smrg		vendor=hitachi
746291ca6f5Smrg		basic_os=hiuxwe2
74729459361Smrg		;;
74829459361Smrg	hp3k9[0-9][0-9] | hp9[0-9][0-9])
749291ca6f5Smrg		cpu=hppa1.0
750291ca6f5Smrg		vendor=hp
75129459361Smrg		;;
75229459361Smrg	hp9k2[0-9][0-9] | hp9k31[0-9])
753291ca6f5Smrg		cpu=m68000
754291ca6f5Smrg		vendor=hp
75529459361Smrg		;;
75629459361Smrg	hp9k3[2-9][0-9])
757291ca6f5Smrg		cpu=m68k
758291ca6f5Smrg		vendor=hp
75929459361Smrg		;;
76029459361Smrg	hp9k6[0-9][0-9] | hp6[0-9][0-9])
761291ca6f5Smrg		cpu=hppa1.0
762291ca6f5Smrg		vendor=hp
76329459361Smrg		;;
76429459361Smrg	hp9k7[0-79][0-9] | hp7[0-79][0-9])
765291ca6f5Smrg		cpu=hppa1.1
766291ca6f5Smrg		vendor=hp
76729459361Smrg		;;
76829459361Smrg	hp9k78[0-9] | hp78[0-9])
76929459361Smrg		# FIXME: really hppa2.0-hp
770291ca6f5Smrg		cpu=hppa1.1
771291ca6f5Smrg		vendor=hp
77229459361Smrg		;;
77329459361Smrg	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
77429459361Smrg		# FIXME: really hppa2.0-hp
775291ca6f5Smrg		cpu=hppa1.1
776291ca6f5Smrg		vendor=hp
77729459361Smrg		;;
77829459361Smrg	hp9k8[0-9][13679] | hp8[0-9][13679])
779291ca6f5Smrg		cpu=hppa1.1
780291ca6f5Smrg		vendor=hp
78129459361Smrg		;;
78229459361Smrg	hp9k8[0-9][0-9] | hp8[0-9][0-9])
783291ca6f5Smrg		cpu=hppa1.0
784291ca6f5Smrg		vendor=hp
78529459361Smrg		;;
78629459361Smrg	i*86v32)
787291ca6f5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
788291ca6f5Smrg		vendor=pc
789291ca6f5Smrg		basic_os=sysv32
79029459361Smrg		;;
79129459361Smrg	i*86v4*)
792291ca6f5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
793291ca6f5Smrg		vendor=pc
794291ca6f5Smrg		basic_os=sysv4
79529459361Smrg		;;
79629459361Smrg	i*86v)
797291ca6f5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
798291ca6f5Smrg		vendor=pc
799291ca6f5Smrg		basic_os=sysv
80029459361Smrg		;;
80129459361Smrg	i*86sol2)
802291ca6f5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
803291ca6f5Smrg		vendor=pc
804291ca6f5Smrg		basic_os=solaris2
80529459361Smrg		;;
806291ca6f5Smrg	j90 | j90-cray)
807291ca6f5Smrg		cpu=j90
808291ca6f5Smrg		vendor=cray
809291ca6f5Smrg		basic_os=${basic_os:-unicos}
81029459361Smrg		;;
81129459361Smrg	iris | iris4d)
812291ca6f5Smrg		cpu=mips
813291ca6f5Smrg		vendor=sgi
814291ca6f5Smrg		case $basic_os in
815291ca6f5Smrg		    irix*)
81629459361Smrg			;;
81729459361Smrg		    *)
818291ca6f5Smrg			basic_os=irix4
81929459361Smrg			;;
82029459361Smrg		esac
82129459361Smrg		;;
82229459361Smrg	miniframe)
823291ca6f5Smrg		cpu=m68000
824291ca6f5Smrg		vendor=convergent
82529459361Smrg		;;
826291ca6f5Smrg	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
827291ca6f5Smrg		cpu=m68k
828291ca6f5Smrg		vendor=atari
829291ca6f5Smrg		basic_os=mint
83029459361Smrg		;;
83129459361Smrg	news-3600 | risc-news)
832291ca6f5Smrg		cpu=mips
833291ca6f5Smrg		vendor=sony
834291ca6f5Smrg		basic_os=newsos
83529459361Smrg		;;
83627935385Smrg	next | m*-next)
837291ca6f5Smrg		cpu=m68k
838291ca6f5Smrg		vendor=next
839291ca6f5Smrg		case $basic_os in
840291ca6f5Smrg		    openstep*)
841291ca6f5Smrg		        ;;
842291ca6f5Smrg		    nextstep*)
84329459361Smrg			;;
844291ca6f5Smrg		    ns2*)
845291ca6f5Smrg		      basic_os=nextstep2
84629459361Smrg			;;
84729459361Smrg		    *)
848291ca6f5Smrg		      basic_os=nextstep3
84929459361Smrg			;;
85029459361Smrg		esac
85129459361Smrg		;;
85229459361Smrg	np1)
853291ca6f5Smrg		cpu=np1
854291ca6f5Smrg		vendor=gould
85527935385Smrg		;;
85629459361Smrg	op50n-* | op60c-*)
857291ca6f5Smrg		cpu=hppa1.1
858291ca6f5Smrg		vendor=oki
859291ca6f5Smrg		basic_os=proelf
86029459361Smrg		;;
86129459361Smrg	pa-hitachi)
862291ca6f5Smrg		cpu=hppa1.1
863291ca6f5Smrg		vendor=hitachi
864291ca6f5Smrg		basic_os=hiuxwe2
8655715adc0Smrg		;;
86629459361Smrg	pbd)
867291ca6f5Smrg		cpu=sparc
868291ca6f5Smrg		vendor=tti
86929459361Smrg		;;
87029459361Smrg	pbb)
871291ca6f5Smrg		cpu=m68k
872291ca6f5Smrg		vendor=tti
87329459361Smrg		;;
874291ca6f5Smrg	pc532)
875291ca6f5Smrg		cpu=ns32k
876291ca6f5Smrg		vendor=pc532
87729459361Smrg		;;
87829459361Smrg	pn)
879291ca6f5Smrg		cpu=pn
880291ca6f5Smrg		vendor=gould
88129459361Smrg		;;
882291ca6f5Smrg	power)
883291ca6f5Smrg		cpu=power
884291ca6f5Smrg		vendor=ibm
88529459361Smrg		;;
886291ca6f5Smrg	ps2)
887291ca6f5Smrg		cpu=i386
888291ca6f5Smrg		vendor=ibm
88929459361Smrg		;;
890291ca6f5Smrg	rm[46]00)
891291ca6f5Smrg		cpu=mips
892291ca6f5Smrg		vendor=siemens
89329459361Smrg		;;
894291ca6f5Smrg	rtpc | rtpc-*)
895291ca6f5Smrg		cpu=romp
896291ca6f5Smrg		vendor=ibm
89729459361Smrg		;;
898291ca6f5Smrg	sde)
899291ca6f5Smrg		cpu=mipsisa32
900291ca6f5Smrg		vendor=sde
901291ca6f5Smrg		basic_os=${basic_os:-elf}
90229459361Smrg		;;
903291ca6f5Smrg	simso-wrs)
904291ca6f5Smrg		cpu=sparclite
905291ca6f5Smrg		vendor=wrs
906291ca6f5Smrg		basic_os=vxworks
90729459361Smrg		;;
908291ca6f5Smrg	tower | tower-32)
909291ca6f5Smrg		cpu=m68k
910291ca6f5Smrg		vendor=ncr
91129459361Smrg		;;
912291ca6f5Smrg	vpp*|vx|vx-*)
913291ca6f5Smrg		cpu=f301
914291ca6f5Smrg		vendor=fujitsu
915f66e55a2Smrg		;;
916291ca6f5Smrg	w65)
917291ca6f5Smrg		cpu=w65
918291ca6f5Smrg		vendor=wdc
91929459361Smrg		;;
920291ca6f5Smrg	w89k-*)
921291ca6f5Smrg		cpu=hppa1.1
922291ca6f5Smrg		vendor=winbond
923291ca6f5Smrg		basic_os=proelf
92429459361Smrg		;;
925291ca6f5Smrg	none)
926291ca6f5Smrg		cpu=none
927291ca6f5Smrg		vendor=none
92829459361Smrg		;;
929291ca6f5Smrg	leon|leon[3-9])
930291ca6f5Smrg		cpu=sparc
931291ca6f5Smrg		vendor=$basic_machine
93229459361Smrg		;;
933291ca6f5Smrg	leon-*|leon[3-9]-*)
934291ca6f5Smrg		cpu=sparc
935291ca6f5Smrg		vendor=`echo "$basic_machine" | sed 's/-.*//'`
93629459361Smrg		;;
937291ca6f5Smrg
938291ca6f5Smrg	*-*)
939291ca6f5Smrg		# shellcheck disable=SC2162
940291ca6f5Smrg		saved_IFS=$IFS
941291ca6f5Smrg		IFS="-" read cpu vendor <<EOF
942291ca6f5Smrg$basic_machine
943291ca6f5SmrgEOF
944291ca6f5Smrg		IFS=$saved_IFS
94529459361Smrg		;;
946291ca6f5Smrg	# We use `pc' rather than `unknown'
947291ca6f5Smrg	# because (1) that's what they normally are, and
948291ca6f5Smrg	# (2) the word "unknown" tends to confuse beginning users.
949291ca6f5Smrg	i*86 | x86_64)
950291ca6f5Smrg		cpu=$basic_machine
951291ca6f5Smrg		vendor=pc
95229459361Smrg		;;
953291ca6f5Smrg	# These rules are duplicated from below for sake of the special case above;
954291ca6f5Smrg	# i.e. things that normalized to x86 arches should also default to "pc"
955291ca6f5Smrg	pc98)
956291ca6f5Smrg		cpu=i386
957291ca6f5Smrg		vendor=pc
95829459361Smrg		;;
959291ca6f5Smrg	x64 | amd64)
960291ca6f5Smrg		cpu=x86_64
961291ca6f5Smrg		vendor=pc
96229459361Smrg		;;
963291ca6f5Smrg	# Recognize the basic CPU types without company name.
964291ca6f5Smrg	*)
965291ca6f5Smrg		cpu=$basic_machine
966291ca6f5Smrg		vendor=unknown
96729459361Smrg		;;
968291ca6f5Smrgesac
969291ca6f5Smrg
970291ca6f5Smrgunset -v basic_machine
971291ca6f5Smrg
972291ca6f5Smrg# Decode basic machines in the full and proper CPU-Company form.
973291ca6f5Smrgcase $cpu-$vendor in
974291ca6f5Smrg	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
975291ca6f5Smrg	# some cases the only manufacturer, in others, it is the most popular.
976291ca6f5Smrg	craynv-unknown)
977291ca6f5Smrg		vendor=cray
978291ca6f5Smrg		basic_os=${basic_os:-unicosmp}
97929459361Smrg		;;
980291ca6f5Smrg	c90-unknown | c90-cray)
981291ca6f5Smrg		vendor=cray
982291ca6f5Smrg		basic_os=${Basic_os:-unicos}
98329459361Smrg		;;
984291ca6f5Smrg	fx80-unknown)
985291ca6f5Smrg		vendor=alliant
98629459361Smrg		;;
987291ca6f5Smrg	romp-unknown)
988291ca6f5Smrg		vendor=ibm
98929459361Smrg		;;
990291ca6f5Smrg	mmix-unknown)
991291ca6f5Smrg		vendor=knuth
99229459361Smrg		;;
993291ca6f5Smrg	microblaze-unknown | microblazeel-unknown)
994291ca6f5Smrg		vendor=xilinx
99529459361Smrg		;;
996291ca6f5Smrg	rs6000-unknown)
997291ca6f5Smrg		vendor=ibm
99829459361Smrg		;;
999291ca6f5Smrg	vax-unknown)
1000291ca6f5Smrg		vendor=dec
100129459361Smrg		;;
1002291ca6f5Smrg	pdp11-unknown)
1003291ca6f5Smrg		vendor=dec
1004f66e55a2Smrg		;;
1005291ca6f5Smrg	we32k-unknown)
1006291ca6f5Smrg		vendor=att
100729459361Smrg		;;
1008291ca6f5Smrg	cydra-unknown)
1009291ca6f5Smrg		vendor=cydrome
101029459361Smrg		;;
1011291ca6f5Smrg	i370-ibm*)
1012291ca6f5Smrg		vendor=ibm
101329459361Smrg		;;
1014291ca6f5Smrg	orion-unknown)
1015291ca6f5Smrg		vendor=highlevel
101629459361Smrg		;;
1017291ca6f5Smrg	xps-unknown | xps100-unknown)
1018291ca6f5Smrg		cpu=xps100
1019291ca6f5Smrg		vendor=honeywell
102029459361Smrg		;;
1021291ca6f5Smrg
1022291ca6f5Smrg	# Here we normalize CPU types with a missing or matching vendor
1023291ca6f5Smrg	dpx20-unknown | dpx20-bull)
1024291ca6f5Smrg		cpu=rs6000
1025291ca6f5Smrg		vendor=bull
1026291ca6f5Smrg		basic_os=${basic_os:-bosx}
102729459361Smrg		;;
1028291ca6f5Smrg
1029291ca6f5Smrg	# Here we normalize CPU types irrespective of the vendor
1030291ca6f5Smrg	amd64-*)
1031291ca6f5Smrg		cpu=x86_64
103229459361Smrg		;;
1033291ca6f5Smrg	blackfin-*)
1034291ca6f5Smrg		cpu=bfin
1035291ca6f5Smrg		basic_os=linux
103629459361Smrg		;;
1037291ca6f5Smrg	c54x-*)
1038291ca6f5Smrg		cpu=tic54x
103929459361Smrg		;;
1040291ca6f5Smrg	c55x-*)
1041291ca6f5Smrg		cpu=tic55x
104229459361Smrg		;;
1043291ca6f5Smrg	c6x-*)
1044291ca6f5Smrg		cpu=tic6x
104529459361Smrg		;;
1046291ca6f5Smrg	e500v[12]-*)
1047291ca6f5Smrg		cpu=powerpc
1048291ca6f5Smrg		basic_os=${basic_os}"spe"
104929459361Smrg		;;
1050291ca6f5Smrg	mips3*-*)
1051291ca6f5Smrg		cpu=mips64
105229459361Smrg		;;
1053291ca6f5Smrg	ms1-*)
1054291ca6f5Smrg		cpu=mt
105529459361Smrg		;;
1056291ca6f5Smrg	m68knommu-*)
1057291ca6f5Smrg		cpu=m68k
1058291ca6f5Smrg		basic_os=linux
105929459361Smrg		;;
1060291ca6f5Smrg	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1061291ca6f5Smrg		cpu=s12z
10625715adc0Smrg		;;
1063291ca6f5Smrg	openrisc-*)
1064291ca6f5Smrg		cpu=or32
106529459361Smrg		;;
1066291ca6f5Smrg	parisc-*)
1067291ca6f5Smrg		cpu=hppa
1068291ca6f5Smrg		basic_os=linux
106929459361Smrg		;;
1070291ca6f5Smrg	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1071291ca6f5Smrg		cpu=i586
107229459361Smrg		;;
1073291ca6f5Smrg	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1074291ca6f5Smrg		cpu=i686
107529459361Smrg		;;
1076291ca6f5Smrg	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1077291ca6f5Smrg		cpu=i686
107829459361Smrg		;;
1079291ca6f5Smrg	pentium4-*)
1080291ca6f5Smrg		cpu=i786
108129459361Smrg		;;
1082291ca6f5Smrg	pc98-*)
1083291ca6f5Smrg		cpu=i386
108429459361Smrg		;;
1085291ca6f5Smrg	ppc-* | ppcbe-*)
1086291ca6f5Smrg		cpu=powerpc
108729459361Smrg		;;
1088291ca6f5Smrg	ppcle-* | powerpclittle-*)
1089291ca6f5Smrg		cpu=powerpcle
109029459361Smrg		;;
1091291ca6f5Smrg	ppc64-*)
1092291ca6f5Smrg		cpu=powerpc64
109329459361Smrg		;;
1094291ca6f5Smrg	ppc64le-* | powerpc64little-*)
1095291ca6f5Smrg		cpu=powerpc64le
109629459361Smrg		;;
1097291ca6f5Smrg	sb1-*)
1098291ca6f5Smrg		cpu=mipsisa64sb1
109929459361Smrg		;;
1100291ca6f5Smrg	sb1el-*)
1101291ca6f5Smrg		cpu=mipsisa64sb1el
110229459361Smrg		;;
1103291ca6f5Smrg	sh5e[lb]-*)
1104291ca6f5Smrg		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
110529459361Smrg		;;
1106291ca6f5Smrg	spur-*)
1107291ca6f5Smrg		cpu=spur
110829459361Smrg		;;
1109291ca6f5Smrg	strongarm-* | thumb-*)
1110291ca6f5Smrg		cpu=arm
111129459361Smrg		;;
1112291ca6f5Smrg	tx39-*)
1113291ca6f5Smrg		cpu=mipstx39
111427935385Smrg		;;
1115291ca6f5Smrg	tx39el-*)
1116291ca6f5Smrg		cpu=mipstx39el
111729459361Smrg		;;
1118291ca6f5Smrg	x64-*)
1119291ca6f5Smrg		cpu=x86_64
112029459361Smrg		;;
1121f66e55a2Smrg	xscale-* | xscalee[bl]-*)
1122291ca6f5Smrg		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
112329459361Smrg		;;
1124291ca6f5Smrg	arm64-*)
1125291ca6f5Smrg		cpu=aarch64
112629459361Smrg		;;
112729459361Smrg
1128291ca6f5Smrg	# Recognize the canonical CPU Types that limit and/or modify the
1129291ca6f5Smrg	# company names they are paired with.
1130291ca6f5Smrg	cr16-*)
1131291ca6f5Smrg		basic_os=${basic_os:-elf}
113229459361Smrg		;;
1133291ca6f5Smrg	crisv32-* | etraxfs*-*)
1134291ca6f5Smrg		cpu=crisv32
1135291ca6f5Smrg		vendor=axis
113629459361Smrg		;;
1137291ca6f5Smrg	cris-* | etrax*-*)
1138291ca6f5Smrg		cpu=cris
1139291ca6f5Smrg		vendor=axis
114029459361Smrg		;;
1141291ca6f5Smrg	crx-*)
1142291ca6f5Smrg		basic_os=${basic_os:-elf}
114329459361Smrg		;;
1144291ca6f5Smrg	neo-tandem)
1145291ca6f5Smrg		cpu=neo
1146291ca6f5Smrg		vendor=tandem
114729459361Smrg		;;
1148291ca6f5Smrg	nse-tandem)
1149291ca6f5Smrg		cpu=nse
1150291ca6f5Smrg		vendor=tandem
115129459361Smrg		;;
1152291ca6f5Smrg	nsr-tandem)
1153291ca6f5Smrg		cpu=nsr
1154291ca6f5Smrg		vendor=tandem
115529459361Smrg		;;
1156291ca6f5Smrg	nsv-tandem)
1157291ca6f5Smrg		cpu=nsv
1158291ca6f5Smrg		vendor=tandem
115929459361Smrg		;;
1160291ca6f5Smrg	nsx-tandem)
1161291ca6f5Smrg		cpu=nsx
1162291ca6f5Smrg		vendor=tandem
116329459361Smrg		;;
1164291ca6f5Smrg	mipsallegrexel-sony)
1165291ca6f5Smrg		cpu=mipsallegrexel
1166291ca6f5Smrg		vendor=sony
116729459361Smrg		;;
1168291ca6f5Smrg	tile*-*)
1169291ca6f5Smrg		basic_os=${basic_os:-linux-gnu}
117029459361Smrg		;;
1171291ca6f5Smrg
117229459361Smrg	*)
1173291ca6f5Smrg		# Recognize the canonical CPU types that are allowed with any
1174291ca6f5Smrg		# company name.
1175291ca6f5Smrg		case $cpu in
1176291ca6f5Smrg			1750a | 580 \
1177291ca6f5Smrg			| a29k \
1178291ca6f5Smrg			| aarch64 | aarch64_be \
1179291ca6f5Smrg			| abacus \
1180291ca6f5Smrg			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1181291ca6f5Smrg			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1182291ca6f5Smrg			| alphapca5[67] | alpha64pca5[67] \
1183291ca6f5Smrg			| am33_2.0 \
1184291ca6f5Smrg			| amdgcn \
1185291ca6f5Smrg			| arc | arceb | arc32 | arc64 \
1186291ca6f5Smrg			| arm | arm[lb]e | arme[lb] | armv* \
1187291ca6f5Smrg			| avr | avr32 \
1188291ca6f5Smrg			| asmjs \
1189291ca6f5Smrg			| ba \
1190291ca6f5Smrg			| be32 | be64 \
1191291ca6f5Smrg			| bfin | bpf | bs2000 \
1192291ca6f5Smrg			| c[123]* | c30 | [cjt]90 | c4x \
1193291ca6f5Smrg			| c8051 | clipper | craynv | csky | cydra \
1194291ca6f5Smrg			| d10v | d30v | dlx | dsp16xx \
1195291ca6f5Smrg			| e2k | elxsi | epiphany \
1196291ca6f5Smrg			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1197291ca6f5Smrg			| h8300 | h8500 \
1198291ca6f5Smrg			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1199291ca6f5Smrg			| hexagon \
1200291ca6f5Smrg			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1201291ca6f5Smrg			| ip2k | iq2000 \
1202291ca6f5Smrg			| k1om \
1203291ca6f5Smrg			| le32 | le64 \
1204291ca6f5Smrg			| lm32 \
1205291ca6f5Smrg			| loongarch32 | loongarch64 | loongarchx32 \
1206291ca6f5Smrg			| m32c | m32r | m32rle \
1207291ca6f5Smrg			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1208291ca6f5Smrg			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1209291ca6f5Smrg			| m88110 | m88k | maxq | mb | mcore | mep | metag \
1210291ca6f5Smrg			| microblaze | microblazeel \
1211291ca6f5Smrg			| mips | mipsbe | mipseb | mipsel | mipsle \
1212291ca6f5Smrg			| mips16 \
1213291ca6f5Smrg			| mips64 | mips64eb | mips64el \
1214291ca6f5Smrg			| mips64octeon | mips64octeonel \
1215291ca6f5Smrg			| mips64orion | mips64orionel \
1216291ca6f5Smrg			| mips64r5900 | mips64r5900el \
1217291ca6f5Smrg			| mips64vr | mips64vrel \
1218291ca6f5Smrg			| mips64vr4100 | mips64vr4100el \
1219291ca6f5Smrg			| mips64vr4300 | mips64vr4300el \
1220291ca6f5Smrg			| mips64vr5000 | mips64vr5000el \
1221291ca6f5Smrg			| mips64vr5900 | mips64vr5900el \
1222291ca6f5Smrg			| mipsisa32 | mipsisa32el \
1223291ca6f5Smrg			| mipsisa32r2 | mipsisa32r2el \
1224291ca6f5Smrg			| mipsisa32r3 | mipsisa32r3el \
1225291ca6f5Smrg			| mipsisa32r5 | mipsisa32r5el \
1226291ca6f5Smrg			| mipsisa32r6 | mipsisa32r6el \
1227291ca6f5Smrg			| mipsisa64 | mipsisa64el \
1228291ca6f5Smrg			| mipsisa64r2 | mipsisa64r2el \
1229291ca6f5Smrg			| mipsisa64r3 | mipsisa64r3el \
1230291ca6f5Smrg			| mipsisa64r5 | mipsisa64r5el \
1231291ca6f5Smrg			| mipsisa64r6 | mipsisa64r6el \
1232291ca6f5Smrg			| mipsisa64sb1 | mipsisa64sb1el \
1233291ca6f5Smrg			| mipsisa64sr71k | mipsisa64sr71kel \
1234291ca6f5Smrg			| mipsr5900 | mipsr5900el \
1235291ca6f5Smrg			| mipstx39 | mipstx39el \
1236291ca6f5Smrg			| mmix \
1237291ca6f5Smrg			| mn10200 | mn10300 \
1238291ca6f5Smrg			| moxie \
1239291ca6f5Smrg			| mt \
1240291ca6f5Smrg			| msp430 \
1241291ca6f5Smrg			| nds32 | nds32le | nds32be \
1242291ca6f5Smrg			| nfp \
1243291ca6f5Smrg			| nios | nios2 | nios2eb | nios2el \
1244291ca6f5Smrg			| none | np1 | ns16k | ns32k | nvptx \
1245291ca6f5Smrg			| open8 \
1246291ca6f5Smrg			| or1k* \
1247291ca6f5Smrg			| or32 \
1248291ca6f5Smrg			| orion \
1249291ca6f5Smrg			| picochip \
1250291ca6f5Smrg			| pdp10 | pdp11 | pj | pjl | pn | power \
1251291ca6f5Smrg			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1252291ca6f5Smrg			| pru \
1253291ca6f5Smrg			| pyramid \
1254291ca6f5Smrg			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1255291ca6f5Smrg			| rl78 | romp | rs6000 | rx \
1256291ca6f5Smrg			| s390 | s390x \
1257291ca6f5Smrg			| score \
1258291ca6f5Smrg			| sh | shl \
1259291ca6f5Smrg			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1260291ca6f5Smrg			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1261291ca6f5Smrg			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1262291ca6f5Smrg			| sparclite \
1263291ca6f5Smrg			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1264291ca6f5Smrg			| spu \
1265291ca6f5Smrg			| tahoe \
1266291ca6f5Smrg			| thumbv7* \
1267291ca6f5Smrg			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1268291ca6f5Smrg			| tron \
1269291ca6f5Smrg			| ubicom32 \
1270291ca6f5Smrg			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1271291ca6f5Smrg			| vax \
1272291ca6f5Smrg			| visium \
1273291ca6f5Smrg			| w65 \
1274291ca6f5Smrg			| wasm32 | wasm64 \
1275291ca6f5Smrg			| we32k \
1276291ca6f5Smrg			| x86 | x86_64 | xc16x | xgate | xps100 \
1277291ca6f5Smrg			| xstormy16 | xtensa* \
1278291ca6f5Smrg			| ymp \
1279291ca6f5Smrg			| z8k | z80)
1280291ca6f5Smrg				;;
1281291ca6f5Smrg
1282291ca6f5Smrg			*)
1283291ca6f5Smrg				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1284291ca6f5Smrg				exit 1
1285291ca6f5Smrg				;;
1286291ca6f5Smrg		esac
128729459361Smrg		;;
128829459361Smrgesac
128929459361Smrg
129029459361Smrg# Here we canonicalize certain aliases for manufacturers.
1291291ca6f5Smrgcase $vendor in
1292291ca6f5Smrg	digital*)
1293291ca6f5Smrg		vendor=dec
129429459361Smrg		;;
1295291ca6f5Smrg	commodore*)
1296291ca6f5Smrg		vendor=cbm
129729459361Smrg		;;
129829459361Smrg	*)
129929459361Smrg		;;
130029459361Smrgesac
130129459361Smrg
130229459361Smrg# Decode manufacturer-specific aliases for certain operating systems.
130329459361Smrg
1304291ca6f5Smrgif test x$basic_os != x
130529459361Smrgthen
1306291ca6f5Smrg
1307291ca6f5Smrg# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
1308291ca6f5Smrg# set os.
1309291ca6f5Smrgcase $basic_os in
1310291ca6f5Smrg	gnu/linux*)
1311291ca6f5Smrg		kernel=linux
1312291ca6f5Smrg		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1313291ca6f5Smrg		;;
1314291ca6f5Smrg	os2-emx)
1315291ca6f5Smrg		kernel=os2
1316291ca6f5Smrg		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1317291ca6f5Smrg		;;
1318291ca6f5Smrg	nto-qnx*)
1319291ca6f5Smrg		kernel=nto
1320291ca6f5Smrg		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1321291ca6f5Smrg		;;
1322291ca6f5Smrg	*-*)
1323291ca6f5Smrg		# shellcheck disable=SC2162
1324291ca6f5Smrg		saved_IFS=$IFS
1325291ca6f5Smrg		IFS="-" read kernel os <<EOF
1326291ca6f5Smrg$basic_os
1327291ca6f5SmrgEOF
1328291ca6f5Smrg		IFS=$saved_IFS
1329291ca6f5Smrg		;;
1330291ca6f5Smrg	# Default OS when just kernel was specified
1331291ca6f5Smrg	nto*)
1332291ca6f5Smrg		kernel=nto
1333291ca6f5Smrg		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1334291ca6f5Smrg		;;
1335291ca6f5Smrg	linux*)
1336291ca6f5Smrg		kernel=linux
1337291ca6f5Smrg		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1338291ca6f5Smrg		;;
1339291ca6f5Smrg	*)
1340291ca6f5Smrg		kernel=
1341291ca6f5Smrg		os=$basic_os
1342291ca6f5Smrg		;;
1343291ca6f5Smrgesac
1344291ca6f5Smrg
1345291ca6f5Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1346291ca6f5Smrg# etc.)
134729459361Smrgcase $os in
134827935385Smrg	# First match some system type aliases that might get confused
134927935385Smrg	# with valid system types.
1350291ca6f5Smrg	# solaris* is a basic system type, with this one exception.
1351291ca6f5Smrg	auroraux)
1352291ca6f5Smrg		os=auroraux
1353c3c9b392Smrg		;;
1354291ca6f5Smrg	bluegene*)
1355291ca6f5Smrg		os=cnk
135629459361Smrg		;;
1357291ca6f5Smrg	solaris1 | solaris1.*)
1358291ca6f5Smrg		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
135929459361Smrg		;;
1360291ca6f5Smrg	solaris)
1361291ca6f5Smrg		os=solaris2
136229459361Smrg		;;
1363291ca6f5Smrg	unixware*)
1364291ca6f5Smrg		os=sysv4.2uw
136529459361Smrg		;;
136627935385Smrg	# es1800 is here to avoid being matched by es* (a different OS)
1367291ca6f5Smrg	es1800*)
1368291ca6f5Smrg		os=ose
136927935385Smrg		;;
1370291ca6f5Smrg	# Some version numbers need modification
1371291ca6f5Smrg	chorusos*)
1372291ca6f5Smrg		os=chorusos
137329459361Smrg		;;
1374291ca6f5Smrg	isc)
1375291ca6f5Smrg		os=isc2.2
137629459361Smrg		;;
1377291ca6f5Smrg	sco6)
1378291ca6f5Smrg		os=sco5v6
137929459361Smrg		;;
1380291ca6f5Smrg	sco5)
1381291ca6f5Smrg		os=sco3.2v5
138229459361Smrg		;;
1383291ca6f5Smrg	sco4)
1384291ca6f5Smrg		os=sco3.2v4
138529459361Smrg		;;
1386291ca6f5Smrg	sco3.2.[4-9]*)
1387291ca6f5Smrg		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
138829459361Smrg		;;
1389291ca6f5Smrg	sco*v* | scout)
1390291ca6f5Smrg		# Don't match below
139129459361Smrg		;;
1392291ca6f5Smrg	sco*)
1393291ca6f5Smrg		os=sco3.2v2
139429459361Smrg		;;
1395291ca6f5Smrg	psos*)
1396291ca6f5Smrg		os=psos
139729459361Smrg		;;
1398291ca6f5Smrg	qnx*)
1399291ca6f5Smrg		os=qnx
140029459361Smrg		;;
1401291ca6f5Smrg	hiux*)
1402291ca6f5Smrg		os=hiuxwe2
140329459361Smrg		;;
1404291ca6f5Smrg	lynx*178)
1405291ca6f5Smrg		os=lynxos178
140629459361Smrg		;;
1407291ca6f5Smrg	lynx*5)
1408291ca6f5Smrg		os=lynxos5
140929459361Smrg		;;
1410291ca6f5Smrg	lynxos*)
1411291ca6f5Smrg		# don't get caught up in next wildcard
141229459361Smrg		;;
1413291ca6f5Smrg	lynx*)
1414291ca6f5Smrg		os=lynxos
141529459361Smrg		;;
1416291ca6f5Smrg	mac[0-9]*)
1417291ca6f5Smrg		os=`echo "$os" | sed -e 's|mac|macos|'`
141829459361Smrg		;;
1419291ca6f5Smrg	opened*)
1420291ca6f5Smrg		os=openedition
142129459361Smrg		;;
1422291ca6f5Smrg	os400*)
1423291ca6f5Smrg		os=os400
142429459361Smrg		;;
1425291ca6f5Smrg	sunos5*)
1426291ca6f5Smrg		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
142729459361Smrg		;;
1428291ca6f5Smrg	sunos6*)
1429291ca6f5Smrg		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
143029459361Smrg		;;
1431291ca6f5Smrg	wince*)
1432291ca6f5Smrg		os=wince
143329459361Smrg		;;
1434291ca6f5Smrg	utek*)
1435291ca6f5Smrg		os=bsd
143629459361Smrg		;;
1437291ca6f5Smrg	dynix*)
1438291ca6f5Smrg		os=bsd
143929459361Smrg		;;
1440291ca6f5Smrg	acis*)
1441291ca6f5Smrg		os=aos
144229459361Smrg		;;
1443291ca6f5Smrg	atheos*)
1444291ca6f5Smrg		os=atheos
144529459361Smrg		;;
1446291ca6f5Smrg	syllable*)
1447291ca6f5Smrg		os=syllable
1448291ca6f5Smrg		;;
1449291ca6f5Smrg	386bsd)
1450291ca6f5Smrg		os=bsd
1451291ca6f5Smrg		;;
1452291ca6f5Smrg	ctix* | uts*)
1453291ca6f5Smrg		os=sysv
1454291ca6f5Smrg		;;
1455291ca6f5Smrg	nova*)
1456291ca6f5Smrg		os=rtmk-nova
1457291ca6f5Smrg		;;
1458291ca6f5Smrg	ns2)
1459291ca6f5Smrg		os=nextstep2
1460291ca6f5Smrg		;;
1461291ca6f5Smrg	# Preserve the version number of sinix5.
1462291ca6f5Smrg	sinix5.*)
1463291ca6f5Smrg		os=`echo "$os" | sed -e 's|sinix|sysv|'`
146429459361Smrg		;;
1465291ca6f5Smrg	sinix*)
1466291ca6f5Smrg		os=sysv4
146729459361Smrg		;;
1468291ca6f5Smrg	tpf*)
1469291ca6f5Smrg		os=tpf
147029459361Smrg		;;
1471291ca6f5Smrg	triton*)
1472291ca6f5Smrg		os=sysv3
147329459361Smrg		;;
1474291ca6f5Smrg	oss*)
1475291ca6f5Smrg		os=sysv3
147629459361Smrg		;;
1477291ca6f5Smrg	svr4*)
1478291ca6f5Smrg		os=sysv4
147929459361Smrg		;;
1480291ca6f5Smrg	svr3)
1481291ca6f5Smrg		os=sysv3
148229459361Smrg		;;
1483291ca6f5Smrg	sysvr4)
1484291ca6f5Smrg		os=sysv4
148529459361Smrg		;;
1486291ca6f5Smrg	ose*)
1487291ca6f5Smrg		os=ose
148829459361Smrg		;;
1489291ca6f5Smrg	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1490291ca6f5Smrg		os=mint
14915715adc0Smrg		;;
1492291ca6f5Smrg	dicos*)
1493291ca6f5Smrg		os=dicos
1494291ca6f5Smrg		;;
1495291ca6f5Smrg	pikeos*)
149627935385Smrg		# Until real need of OS specific support for
149727935385Smrg		# particular features comes up, bare metal
149827935385Smrg		# configurations are quite functional.
1499291ca6f5Smrg		case $cpu in
150027935385Smrg		    arm*)
1501291ca6f5Smrg			os=eabi
150227935385Smrg			;;
150327935385Smrg		    *)
1504291ca6f5Smrg			os=elf
150527935385Smrg			;;
150627935385Smrg		esac
150727935385Smrg		;;
150829459361Smrg	*)
1509291ca6f5Smrg		# No normalization, but not necessarily accepted, that comes below.
151029459361Smrg		;;
151129459361Smrgesac
1512291ca6f5Smrg
151329459361Smrgelse
151429459361Smrg
151529459361Smrg# Here we handle the default operating systems that come with various machines.
151629459361Smrg# The value should be what the vendor currently ships out the door with their
151729459361Smrg# machine or put another way, the most popular os provided with the machine.
151829459361Smrg
151929459361Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say,
152029459361Smrg# "-sun"), then you have to tell the case statement up towards the top
152129459361Smrg# that MANUFACTURER isn't an operating system.  Otherwise, code above
152229459361Smrg# will signal an error saying that MANUFACTURER isn't an operating
152329459361Smrg# system, and we'll never get to this point.
152429459361Smrg
1525291ca6f5Smrgkernel=
1526291ca6f5Smrgcase $cpu-$vendor in
1527f66e55a2Smrg	score-*)
1528291ca6f5Smrg		os=elf
152929459361Smrg		;;
1530f66e55a2Smrg	spu-*)
1531291ca6f5Smrg		os=elf
153229459361Smrg		;;
153329459361Smrg	*-acorn)
1534291ca6f5Smrg		os=riscix1.2
153529459361Smrg		;;
153629459361Smrg	arm*-rebel)
1537291ca6f5Smrg		kernel=linux
1538291ca6f5Smrg		os=gnu
153929459361Smrg		;;
154029459361Smrg	arm*-semi)
1541291ca6f5Smrg		os=aout
154229459361Smrg		;;
1543f66e55a2Smrg	c4x-* | tic4x-*)
1544291ca6f5Smrg		os=coff
1545f66e55a2Smrg		;;
154627935385Smrg	c8051-*)
1547291ca6f5Smrg		os=elf
1548291ca6f5Smrg		;;
1549291ca6f5Smrg	clipper-intergraph)
1550291ca6f5Smrg		os=clix
155127935385Smrg		;;
1552f66e55a2Smrg	hexagon-*)
1553291ca6f5Smrg		os=elf
155429459361Smrg		;;
1555c3c9b392Smrg	tic54x-*)
1556291ca6f5Smrg		os=coff
1557c3c9b392Smrg		;;
1558c3c9b392Smrg	tic55x-*)
1559291ca6f5Smrg		os=coff
1560c3c9b392Smrg		;;
1561c3c9b392Smrg	tic6x-*)
1562291ca6f5Smrg		os=coff
1563c3c9b392Smrg		;;
156429459361Smrg	# This must come before the *-dec entry.
156529459361Smrg	pdp10-*)
1566291ca6f5Smrg		os=tops20
156729459361Smrg		;;
156829459361Smrg	pdp11-*)
1569291ca6f5Smrg		os=none
157029459361Smrg		;;
157129459361Smrg	*-dec | vax-*)
1572291ca6f5Smrg		os=ultrix4.2
157329459361Smrg		;;
157429459361Smrg	m68*-apollo)
1575291ca6f5Smrg		os=domain
157629459361Smrg		;;
157729459361Smrg	i386-sun)
1578291ca6f5Smrg		os=sunos4.0.2
157929459361Smrg		;;
158029459361Smrg	m68000-sun)
1581291ca6f5Smrg		os=sunos3
158229459361Smrg		;;
158329459361Smrg	m68*-cisco)
1584291ca6f5Smrg		os=aout
158529459361Smrg		;;
1586f66e55a2Smrg	mep-*)
1587291ca6f5Smrg		os=elf
15885715adc0Smrg		;;
158929459361Smrg	mips*-cisco)
1590291ca6f5Smrg		os=elf
159129459361Smrg		;;
159229459361Smrg	mips*-*)
1593291ca6f5Smrg		os=elf
159429459361Smrg		;;
159529459361Smrg	or32-*)
1596291ca6f5Smrg		os=coff
159729459361Smrg		;;
159829459361Smrg	*-tti)	# must be before sparc entry or we get the wrong os.
1599291ca6f5Smrg		os=sysv3
160029459361Smrg		;;
160129459361Smrg	sparc-* | *-sun)
1602291ca6f5Smrg		os=sunos4.1.1
160329459361Smrg		;;
160427935385Smrg	pru-*)
1605291ca6f5Smrg		os=elf
160627935385Smrg		;;
160729459361Smrg	*-be)
1608291ca6f5Smrg		os=beos
160929459361Smrg		;;
161029459361Smrg	*-ibm)
1611291ca6f5Smrg		os=aix
161229459361Smrg		;;
1613f66e55a2Smrg	*-knuth)
1614291ca6f5Smrg		os=mmixware
161529459361Smrg		;;
161629459361Smrg	*-wec)
1617291ca6f5Smrg		os=proelf
161829459361Smrg		;;
161929459361Smrg	*-winbond)
1620291ca6f5Smrg		os=proelf
162129459361Smrg		;;
162229459361Smrg	*-oki)
1623291ca6f5Smrg		os=proelf
162429459361Smrg		;;
162529459361Smrg	*-hp)
1626291ca6f5Smrg		os=hpux
162729459361Smrg		;;
162829459361Smrg	*-hitachi)
1629291ca6f5Smrg		os=hiux
163029459361Smrg		;;
163129459361Smrg	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1632291ca6f5Smrg		os=sysv
163329459361Smrg		;;
163429459361Smrg	*-cbm)
1635291ca6f5Smrg		os=amigaos
163629459361Smrg		;;
163729459361Smrg	*-dg)
1638291ca6f5Smrg		os=dgux
163929459361Smrg		;;
164029459361Smrg	*-dolphin)
1641291ca6f5Smrg		os=sysv3
164229459361Smrg		;;
164329459361Smrg	m68k-ccur)
1644291ca6f5Smrg		os=rtu
164529459361Smrg		;;
164629459361Smrg	m88k-omron*)
1647291ca6f5Smrg		os=luna
164829459361Smrg		;;
164927935385Smrg	*-next)
1650291ca6f5Smrg		os=nextstep
165129459361Smrg		;;
165229459361Smrg	*-sequent)
1653291ca6f5Smrg		os=ptx
165429459361Smrg		;;
165529459361Smrg	*-crds)
1656291ca6f5Smrg		os=unos
165729459361Smrg		;;
165829459361Smrg	*-ns)
1659291ca6f5Smrg		os=genix
166029459361Smrg		;;
166129459361Smrg	i370-*)
1662291ca6f5Smrg		os=mvs
166329459361Smrg		;;
166429459361Smrg	*-gould)
1665291ca6f5Smrg		os=sysv
166629459361Smrg		;;
166729459361Smrg	*-highlevel)
1668291ca6f5Smrg		os=bsd
166929459361Smrg		;;
167029459361Smrg	*-encore)
1671291ca6f5Smrg		os=bsd
167229459361Smrg		;;
167329459361Smrg	*-sgi)
1674291ca6f5Smrg		os=irix
167529459361Smrg		;;
167629459361Smrg	*-siemens)
1677291ca6f5Smrg		os=sysv4
167829459361Smrg		;;
167929459361Smrg	*-masscomp)
1680291ca6f5Smrg		os=rtu
168129459361Smrg		;;
168229459361Smrg	f30[01]-fujitsu | f700-fujitsu)
1683291ca6f5Smrg		os=uxpv
168429459361Smrg		;;
168529459361Smrg	*-rom68k)
1686291ca6f5Smrg		os=coff
168729459361Smrg		;;
168829459361Smrg	*-*bug)
1689291ca6f5Smrg		os=coff
169029459361Smrg		;;
169129459361Smrg	*-apple)
1692291ca6f5Smrg		os=macos
169329459361Smrg		;;
169429459361Smrg	*-atari*)
1695291ca6f5Smrg		os=mint
1696291ca6f5Smrg		;;
1697291ca6f5Smrg	*-wrs)
1698291ca6f5Smrg		os=vxworks
169929459361Smrg		;;
170029459361Smrg	*)
1701291ca6f5Smrg		os=none
170229459361Smrg		;;
170329459361Smrgesac
1704291ca6f5Smrg
170529459361Smrgfi
170629459361Smrg
1707291ca6f5Smrg# Now, validate our (potentially fixed-up) OS.
1708291ca6f5Smrgcase $os in
1709291ca6f5Smrg	# Sometimes we do "kernel-libc", so those need to count as OSes.
1710291ca6f5Smrg	musl* | newlib* | relibc* | uclibc*)
1711291ca6f5Smrg		;;
1712291ca6f5Smrg	# Likewise for "kernel-abi"
1713291ca6f5Smrg	eabi* | gnueabi*)
1714291ca6f5Smrg		;;
1715291ca6f5Smrg	# VxWorks passes extra cpu info in the 4th filed.
1716291ca6f5Smrg	simlinux | simwindows | spe)
1717291ca6f5Smrg		;;
1718291ca6f5Smrg	# Now accept the basic system types.
1719291ca6f5Smrg	# The portable systems comes first.
1720291ca6f5Smrg	# Each alternative MUST end in a * to match a version number.
1721291ca6f5Smrg	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1722291ca6f5Smrg	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1723291ca6f5Smrg	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1724291ca6f5Smrg	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1725291ca6f5Smrg	     | hiux* | abug | nacl* | netware* | windows* \
1726291ca6f5Smrg	     | os9* | macos* | osx* | ios* \
1727291ca6f5Smrg	     | mpw* | magic* | mmixware* | mon960* | lnews* \
1728291ca6f5Smrg	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1729291ca6f5Smrg	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
1730291ca6f5Smrg	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1731291ca6f5Smrg	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1732291ca6f5Smrg	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1733291ca6f5Smrg	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1734291ca6f5Smrg	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1735291ca6f5Smrg	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1736291ca6f5Smrg	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1737291ca6f5Smrg	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
1738291ca6f5Smrg	     | chorusrdb* | cegcc* | glidix* | serenity* \
1739291ca6f5Smrg	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1740291ca6f5Smrg	     | midipix* | mingw32* | mingw64* | mint* \
1741291ca6f5Smrg	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1742291ca6f5Smrg	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1743291ca6f5Smrg	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1744291ca6f5Smrg	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1745291ca6f5Smrg	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1746291ca6f5Smrg	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1747291ca6f5Smrg	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1748291ca6f5Smrg	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1749291ca6f5Smrg	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1750291ca6f5Smrg	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1751291ca6f5Smrg	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
1752291ca6f5Smrg		;;
1753291ca6f5Smrg	# This one is extra strict with allowed versions
1754291ca6f5Smrg	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1755291ca6f5Smrg		# Don't forget version if it is 3.2v4 or newer.
1756291ca6f5Smrg		;;
1757291ca6f5Smrg	none)
1758291ca6f5Smrg		;;
1759291ca6f5Smrg	*)
1760291ca6f5Smrg		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1761291ca6f5Smrg		exit 1
1762291ca6f5Smrg		;;
1763291ca6f5Smrgesac
1764291ca6f5Smrg
1765291ca6f5Smrg# As a final step for OS-related things, validate the OS-kernel combination
1766291ca6f5Smrg# (given a valid OS), if there is a kernel.
1767291ca6f5Smrgcase $kernel-$os in
1768291ca6f5Smrg	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1769291ca6f5Smrg		   | linux-musl* | linux-relibc* | linux-uclibc* )
1770291ca6f5Smrg		;;
1771291ca6f5Smrg	uclinux-uclibc* )
1772291ca6f5Smrg		;;
1773291ca6f5Smrg	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
1774291ca6f5Smrg		# These are just libc implementations, not actual OSes, and thus
1775291ca6f5Smrg		# require a kernel.
1776291ca6f5Smrg		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1777291ca6f5Smrg		exit 1
1778291ca6f5Smrg		;;
1779291ca6f5Smrg	kfreebsd*-gnu* | kopensolaris*-gnu*)
1780291ca6f5Smrg		;;
1781291ca6f5Smrg	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1782291ca6f5Smrg		;;
1783291ca6f5Smrg	nto-qnx*)
1784291ca6f5Smrg		;;
1785291ca6f5Smrg	os2-emx)
1786291ca6f5Smrg		;;
1787291ca6f5Smrg	*-eabi* | *-gnueabi*)
1788291ca6f5Smrg		;;
1789291ca6f5Smrg	-*)
1790291ca6f5Smrg		# Blank kernel with real OS is always fine.
1791291ca6f5Smrg		;;
1792291ca6f5Smrg	*-*)
1793291ca6f5Smrg		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1794291ca6f5Smrg		exit 1
1795291ca6f5Smrg		;;
1796291ca6f5Smrgesac
1797291ca6f5Smrg
179829459361Smrg# Here we handle the case where we know the os, and the CPU type, but not the
179929459361Smrg# manufacturer.  We pick the logical manufacturer.
1800291ca6f5Smrgcase $vendor in
1801291ca6f5Smrg	unknown)
1802291ca6f5Smrg		case $cpu-$os in
1803291ca6f5Smrg			*-riscix*)
180429459361Smrg				vendor=acorn
180529459361Smrg				;;
1806291ca6f5Smrg			*-sunos*)
180729459361Smrg				vendor=sun
180829459361Smrg				;;
1809291ca6f5Smrg			*-cnk* | *-aix*)
181029459361Smrg				vendor=ibm
181129459361Smrg				;;
1812291ca6f5Smrg			*-beos*)
181329459361Smrg				vendor=be
181429459361Smrg				;;
1815291ca6f5Smrg			*-hpux*)
181629459361Smrg				vendor=hp
181729459361Smrg				;;
1818291ca6f5Smrg			*-mpeix*)
181929459361Smrg				vendor=hp
182029459361Smrg				;;
1821291ca6f5Smrg			*-hiux*)
182229459361Smrg				vendor=hitachi
182329459361Smrg				;;
1824291ca6f5Smrg			*-unos*)
182529459361Smrg				vendor=crds
182629459361Smrg				;;
1827291ca6f5Smrg			*-dgux*)
182829459361Smrg				vendor=dg
182929459361Smrg				;;
1830291ca6f5Smrg			*-luna*)
183129459361Smrg				vendor=omron
183229459361Smrg				;;
1833291ca6f5Smrg			*-genix*)
183429459361Smrg				vendor=ns
183529459361Smrg				;;
1836291ca6f5Smrg			*-clix*)
1837291ca6f5Smrg				vendor=intergraph
1838291ca6f5Smrg				;;
1839291ca6f5Smrg			*-mvs* | *-opened*)
1840291ca6f5Smrg				vendor=ibm
1841291ca6f5Smrg				;;
1842291ca6f5Smrg			*-os400*)
184329459361Smrg				vendor=ibm
184429459361Smrg				;;
1845291ca6f5Smrg			s390-* | s390x-*)
184629459361Smrg				vendor=ibm
184729459361Smrg				;;
1848291ca6f5Smrg			*-ptx*)
184929459361Smrg				vendor=sequent
185029459361Smrg				;;
1851291ca6f5Smrg			*-tpf*)
185229459361Smrg				vendor=ibm
185329459361Smrg				;;
1854291ca6f5Smrg			*-vxsim* | *-vxworks* | *-windiss*)
185529459361Smrg				vendor=wrs
185629459361Smrg				;;
1857291ca6f5Smrg			*-aux*)
185829459361Smrg				vendor=apple
185929459361Smrg				;;
1860291ca6f5Smrg			*-hms*)
186129459361Smrg				vendor=hitachi
186229459361Smrg				;;
1863291ca6f5Smrg			*-mpw* | *-macos*)
186429459361Smrg				vendor=apple
186529459361Smrg				;;
1866291ca6f5Smrg			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
186729459361Smrg				vendor=atari
186829459361Smrg				;;
1869291ca6f5Smrg			*-vos*)
187029459361Smrg				vendor=stratus
187129459361Smrg				;;
187229459361Smrg		esac
187329459361Smrg		;;
187429459361Smrgesac
187529459361Smrg
1876291ca6f5Smrgecho "$cpu-$vendor-${kernel:+$kernel-}$os"
187729459361Smrgexit
187829459361Smrg
187929459361Smrg# Local variables:
1880291ca6f5Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
188129459361Smrg# time-stamp-start: "timestamp='"
188229459361Smrg# time-stamp-format: "%:y-%02m-%02d"
188329459361Smrg# time-stamp-end: "'"
188429459361Smrg# End:
1885