config.sub revision 084f91cc
19bd41f2cSmrg#! /bin/sh
29bd41f2cSmrg# Configuration validation subroutine script.
3084f91ccSmrg#   Copyright 1992-2022 Free Software Foundation, Inc.
49bd41f2cSmrg
5084f91ccSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
69bd41f2cSmrg
7084f91ccSmrgtimestamp='2022-01-03'
8084f91ccSmrg
9084f91ccSmrg# This file is free software; you can redistribute it and/or modify it
10084f91ccSmrg# under the terms of the GNU General Public License as published by
11084f91ccSmrg# the Free Software Foundation, either version 3 of the License, or
129bd41f2cSmrg# (at your option) any later version.
139bd41f2cSmrg#
14084f91ccSmrg# This program is distributed in the hope that it will be useful, but
15084f91ccSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16084f91ccSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17084f91ccSmrg# General Public License for more details.
189bd41f2cSmrg#
199bd41f2cSmrg# You should have received a copy of the GNU General Public License
20084f91ccSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
219bd41f2cSmrg#
229bd41f2cSmrg# As a special exception to the GNU General Public License, if you
239bd41f2cSmrg# distribute this file as part of a program that contains a
249bd41f2cSmrg# configuration script generated by Autoconf, you may include it under
25084f91ccSmrg# the same distribution terms that you use for the rest of that
26084f91ccSmrg# program.  This Exception is an additional permission under section 7
27084f91ccSmrg# of the GNU General Public License, version 3 ("GPLv3").
289bd41f2cSmrg
299bd41f2cSmrg
30084f91ccSmrg# Please send patches to <config-patches@gnu.org>.
319bd41f2cSmrg#
329bd41f2cSmrg# Configuration subroutine to validate and canonicalize a configuration type.
339bd41f2cSmrg# Supply the specified configuration type as an argument.
349bd41f2cSmrg# If it is invalid, we print an error message on stderr and exit with code 1.
359bd41f2cSmrg# Otherwise, we print the canonical config type on stdout and succeed.
369bd41f2cSmrg
370da4cdccSmrg# You can get the latest version of this script from:
38084f91ccSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
390da4cdccSmrg
409bd41f2cSmrg# This file is supposed to be the same for all GNU packages
419bd41f2cSmrg# and recognize all the CPU types, system types and aliases
429bd41f2cSmrg# that are meaningful with *any* GNU software.
439bd41f2cSmrg# Each package is responsible for reporting which valid configurations
449bd41f2cSmrg# it does not support.  The user should be able to distinguish
459bd41f2cSmrg# a failure to support a valid configuration from a meaningless
469bd41f2cSmrg# configuration.
479bd41f2cSmrg
489bd41f2cSmrg# The goal of this file is to map all the various variations of a given
499bd41f2cSmrg# machine specification into a single specification in the form:
509bd41f2cSmrg#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
519bd41f2cSmrg# or in some cases, the newer four-part form:
529bd41f2cSmrg#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
539bd41f2cSmrg# It is wrong to echo any other type of specification.
549bd41f2cSmrg
55084f91ccSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
56084f91ccSmrg# about features and limitations of the classic Bourne shell that were
57084f91ccSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
58084f91ccSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
59084f91ccSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
60084f91ccSmrg# have a pre-POSIX /bin/sh.
61084f91ccSmrg
629bd41f2cSmrgme=`echo "$0" | sed -e 's,.*/,,'`
639bd41f2cSmrg
649bd41f2cSmrgusage="\
65084f91ccSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
669bd41f2cSmrg
679bd41f2cSmrgCanonicalize a configuration name.
689bd41f2cSmrg
69084f91ccSmrgOptions:
709bd41f2cSmrg  -h, --help         print this help, then exit
719bd41f2cSmrg  -t, --time-stamp   print date of last modification, then exit
729bd41f2cSmrg  -v, --version      print version number, then exit
739bd41f2cSmrg
749bd41f2cSmrgReport bugs and patches to <config-patches@gnu.org>."
759bd41f2cSmrg
769bd41f2cSmrgversion="\
779bd41f2cSmrgGNU config.sub ($timestamp)
789bd41f2cSmrg
79084f91ccSmrgCopyright 1992-2022 Free Software Foundation, Inc.
809bd41f2cSmrg
819bd41f2cSmrgThis is free software; see the source for copying conditions.  There is NO
829bd41f2cSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
839bd41f2cSmrg
849bd41f2cSmrghelp="
859bd41f2cSmrgTry \`$me --help' for more information."
869bd41f2cSmrg
879bd41f2cSmrg# Parse command line
889bd41f2cSmrgwhile test $# -gt 0 ; do
899bd41f2cSmrg  case $1 in
909bd41f2cSmrg    --time-stamp | --time* | -t )
919bd41f2cSmrg       echo "$timestamp" ; exit ;;
929bd41f2cSmrg    --version | -v )
939bd41f2cSmrg       echo "$version" ; exit ;;
949bd41f2cSmrg    --help | --h* | -h )
959bd41f2cSmrg       echo "$usage"; exit ;;
969bd41f2cSmrg    -- )     # Stop option processing
979bd41f2cSmrg       shift; break ;;
989bd41f2cSmrg    - )	# Use stdin as input.
999bd41f2cSmrg       break ;;
1009bd41f2cSmrg    -* )
101084f91ccSmrg       echo "$me: invalid option $1$help" >&2
1029bd41f2cSmrg       exit 1 ;;
1039bd41f2cSmrg
1049bd41f2cSmrg    *local*)
1059bd41f2cSmrg       # First pass through any local machine types.
106084f91ccSmrg       echo "$1"
1079bd41f2cSmrg       exit ;;
1089bd41f2cSmrg
1099bd41f2cSmrg    * )
1109bd41f2cSmrg       break ;;
1119bd41f2cSmrg  esac
1129bd41f2cSmrgdone
1139bd41f2cSmrg
1149bd41f2cSmrgcase $# in
1159bd41f2cSmrg 0) echo "$me: missing argument$help" >&2
1169bd41f2cSmrg    exit 1;;
1179bd41f2cSmrg 1) ;;
1189bd41f2cSmrg *) echo "$me: too many arguments$help" >&2
1199bd41f2cSmrg    exit 1;;
1209bd41f2cSmrgesac
1219bd41f2cSmrg
122084f91ccSmrg# Split fields of configuration type
123084f91ccSmrg# shellcheck disable=SC2162
124084f91ccSmrgsaved_IFS=$IFS
125084f91ccSmrgIFS="-" read field1 field2 field3 field4 <<EOF
126084f91ccSmrg$1
127084f91ccSmrgEOF
128084f91ccSmrgIFS=$saved_IFS
1299bd41f2cSmrg
130084f91ccSmrg# Separate into logical components for further validation
131084f91ccSmrgcase $1 in
132084f91ccSmrg	*-*-*-*-*)
133084f91ccSmrg		echo Invalid configuration \`"$1"\': more than four components >&2
134084f91ccSmrg		exit 1
1359bd41f2cSmrg		;;
136084f91ccSmrg	*-*-*-*)
137084f91ccSmrg		basic_machine=$field1-$field2
138084f91ccSmrg		basic_os=$field3-$field4
1399bd41f2cSmrg		;;
140084f91ccSmrg	*-*-*)
141084f91ccSmrg		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
142084f91ccSmrg		# parts
143084f91ccSmrg		maybe_os=$field2-$field3
144084f91ccSmrg		case $maybe_os in
145084f91ccSmrg			nto-qnx* | linux-* | uclinux-uclibc* \
146084f91ccSmrg			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
147084f91ccSmrg			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
148084f91ccSmrg			| storm-chaos* | os2-emx* | rtmk-nova*)
149084f91ccSmrg				basic_machine=$field1
150084f91ccSmrg				basic_os=$maybe_os
151084f91ccSmrg				;;
152084f91ccSmrg			android-linux)
153084f91ccSmrg				basic_machine=$field1-unknown
154084f91ccSmrg				basic_os=linux-android
155084f91ccSmrg				;;
156084f91ccSmrg			*)
157084f91ccSmrg				basic_machine=$field1-$field2
158084f91ccSmrg				basic_os=$field3
159084f91ccSmrg				;;
160084f91ccSmrg		esac
1619bd41f2cSmrg		;;
162084f91ccSmrg	*-*)
163084f91ccSmrg		# A lone config we happen to match not fitting any pattern
164084f91ccSmrg		case $field1-$field2 in
165084f91ccSmrg			decstation-3100)
166084f91ccSmrg				basic_machine=mips-dec
167084f91ccSmrg				basic_os=
168084f91ccSmrg				;;
169084f91ccSmrg			*-*)
170084f91ccSmrg				# Second component is usually, but not always the OS
171084f91ccSmrg				case $field2 in
172084f91ccSmrg					# Prevent following clause from handling this valid os
173084f91ccSmrg					sun*os*)
174084f91ccSmrg						basic_machine=$field1
175084f91ccSmrg						basic_os=$field2
176084f91ccSmrg						;;
177084f91ccSmrg					zephyr*)
178084f91ccSmrg						basic_machine=$field1-unknown
179084f91ccSmrg						basic_os=$field2
180084f91ccSmrg						;;
181084f91ccSmrg					# Manufacturers
182084f91ccSmrg					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
183084f91ccSmrg					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
184084f91ccSmrg					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
185084f91ccSmrg					| convergent* | ncr* | news | 32* | 3600* | 3100* \
186084f91ccSmrg					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
187084f91ccSmrg					| ultra | tti* | harris | dolphin | highlevel | gould \
188084f91ccSmrg					| cbm | ns | masscomp | apple | axis | knuth | cray \
189084f91ccSmrg					| microblaze* | sim | cisco \
190084f91ccSmrg					| oki | wec | wrs | winbond)
191084f91ccSmrg						basic_machine=$field1-$field2
192084f91ccSmrg						basic_os=
193084f91ccSmrg						;;
194084f91ccSmrg					*)
195084f91ccSmrg						basic_machine=$field1
196084f91ccSmrg						basic_os=$field2
197084f91ccSmrg						;;
198084f91ccSmrg				esac
199084f91ccSmrg			;;
200084f91ccSmrg		esac
2019bd41f2cSmrg		;;
202084f91ccSmrg	*)
203084f91ccSmrg		# Convert single-component short-hands not valid as part of
204084f91ccSmrg		# multi-component configurations.
205084f91ccSmrg		case $field1 in
206084f91ccSmrg			386bsd)
207084f91ccSmrg				basic_machine=i386-pc
208084f91ccSmrg				basic_os=bsd
209084f91ccSmrg				;;
210084f91ccSmrg			a29khif)
211084f91ccSmrg				basic_machine=a29k-amd
212084f91ccSmrg				basic_os=udi
213084f91ccSmrg				;;
214084f91ccSmrg			adobe68k)
215084f91ccSmrg				basic_machine=m68010-adobe
216084f91ccSmrg				basic_os=scout
217084f91ccSmrg				;;
218084f91ccSmrg			alliant)
219084f91ccSmrg				basic_machine=fx80-alliant
220084f91ccSmrg				basic_os=
221084f91ccSmrg				;;
222084f91ccSmrg			altos | altos3068)
223084f91ccSmrg				basic_machine=m68k-altos
224084f91ccSmrg				basic_os=
225084f91ccSmrg				;;
226084f91ccSmrg			am29k)
227084f91ccSmrg				basic_machine=a29k-none
228084f91ccSmrg				basic_os=bsd
229084f91ccSmrg				;;
230084f91ccSmrg			amdahl)
231084f91ccSmrg				basic_machine=580-amdahl
232084f91ccSmrg				basic_os=sysv
233084f91ccSmrg				;;
234084f91ccSmrg			amiga)
235084f91ccSmrg				basic_machine=m68k-unknown
236084f91ccSmrg				basic_os=
237084f91ccSmrg				;;
238084f91ccSmrg			amigaos | amigados)
239084f91ccSmrg				basic_machine=m68k-unknown
240084f91ccSmrg				basic_os=amigaos
241084f91ccSmrg				;;
242084f91ccSmrg			amigaunix | amix)
243084f91ccSmrg				basic_machine=m68k-unknown
244084f91ccSmrg				basic_os=sysv4
245084f91ccSmrg				;;
246084f91ccSmrg			apollo68)
247084f91ccSmrg				basic_machine=m68k-apollo
248084f91ccSmrg				basic_os=sysv
249084f91ccSmrg				;;
250084f91ccSmrg			apollo68bsd)
251084f91ccSmrg				basic_machine=m68k-apollo
252084f91ccSmrg				basic_os=bsd
253084f91ccSmrg				;;
254084f91ccSmrg			aros)
255084f91ccSmrg				basic_machine=i386-pc
256084f91ccSmrg				basic_os=aros
257084f91ccSmrg				;;
258084f91ccSmrg			aux)
259084f91ccSmrg				basic_machine=m68k-apple
260084f91ccSmrg				basic_os=aux
261084f91ccSmrg				;;
262084f91ccSmrg			balance)
263084f91ccSmrg				basic_machine=ns32k-sequent
264084f91ccSmrg				basic_os=dynix
265084f91ccSmrg				;;
266084f91ccSmrg			blackfin)
267084f91ccSmrg				basic_machine=bfin-unknown
268084f91ccSmrg				basic_os=linux
269084f91ccSmrg				;;
270084f91ccSmrg			cegcc)
271084f91ccSmrg				basic_machine=arm-unknown
272084f91ccSmrg				basic_os=cegcc
273084f91ccSmrg				;;
274084f91ccSmrg			convex-c1)
275084f91ccSmrg				basic_machine=c1-convex
276084f91ccSmrg				basic_os=bsd
277084f91ccSmrg				;;
278084f91ccSmrg			convex-c2)
279084f91ccSmrg				basic_machine=c2-convex
280084f91ccSmrg				basic_os=bsd
281084f91ccSmrg				;;
282084f91ccSmrg			convex-c32)
283084f91ccSmrg				basic_machine=c32-convex
284084f91ccSmrg				basic_os=bsd
285084f91ccSmrg				;;
286084f91ccSmrg			convex-c34)
287084f91ccSmrg				basic_machine=c34-convex
288084f91ccSmrg				basic_os=bsd
289084f91ccSmrg				;;
290084f91ccSmrg			convex-c38)
291084f91ccSmrg				basic_machine=c38-convex
292084f91ccSmrg				basic_os=bsd
293084f91ccSmrg				;;
294084f91ccSmrg			cray)
295084f91ccSmrg				basic_machine=j90-cray
296084f91ccSmrg				basic_os=unicos
297084f91ccSmrg				;;
298084f91ccSmrg			crds | unos)
299084f91ccSmrg				basic_machine=m68k-crds
300084f91ccSmrg				basic_os=
301084f91ccSmrg				;;
302084f91ccSmrg			da30)
303084f91ccSmrg				basic_machine=m68k-da30
304084f91ccSmrg				basic_os=
305084f91ccSmrg				;;
306084f91ccSmrg			decstation | pmax | pmin | dec3100 | decstatn)
307084f91ccSmrg				basic_machine=mips-dec
308084f91ccSmrg				basic_os=
309084f91ccSmrg				;;
310084f91ccSmrg			delta88)
311084f91ccSmrg				basic_machine=m88k-motorola
312084f91ccSmrg				basic_os=sysv3
313084f91ccSmrg				;;
314084f91ccSmrg			dicos)
315084f91ccSmrg				basic_machine=i686-pc
316084f91ccSmrg				basic_os=dicos
317084f91ccSmrg				;;
318084f91ccSmrg			djgpp)
319084f91ccSmrg				basic_machine=i586-pc
320084f91ccSmrg				basic_os=msdosdjgpp
321084f91ccSmrg				;;
322084f91ccSmrg			ebmon29k)
323084f91ccSmrg				basic_machine=a29k-amd
324084f91ccSmrg				basic_os=ebmon
325084f91ccSmrg				;;
326084f91ccSmrg			es1800 | OSE68k | ose68k | ose | OSE)
327084f91ccSmrg				basic_machine=m68k-ericsson
328084f91ccSmrg				basic_os=ose
329084f91ccSmrg				;;
330084f91ccSmrg			gmicro)
331084f91ccSmrg				basic_machine=tron-gmicro
332084f91ccSmrg				basic_os=sysv
333084f91ccSmrg				;;
334084f91ccSmrg			go32)
335084f91ccSmrg				basic_machine=i386-pc
336084f91ccSmrg				basic_os=go32
337084f91ccSmrg				;;
338084f91ccSmrg			h8300hms)
339084f91ccSmrg				basic_machine=h8300-hitachi
340084f91ccSmrg				basic_os=hms
341084f91ccSmrg				;;
342084f91ccSmrg			h8300xray)
343084f91ccSmrg				basic_machine=h8300-hitachi
344084f91ccSmrg				basic_os=xray
345084f91ccSmrg				;;
346084f91ccSmrg			h8500hms)
347084f91ccSmrg				basic_machine=h8500-hitachi
348084f91ccSmrg				basic_os=hms
349084f91ccSmrg				;;
350084f91ccSmrg			harris)
351084f91ccSmrg				basic_machine=m88k-harris
352084f91ccSmrg				basic_os=sysv3
353084f91ccSmrg				;;
354084f91ccSmrg			hp300 | hp300hpux)
355084f91ccSmrg				basic_machine=m68k-hp
356084f91ccSmrg				basic_os=hpux
357084f91ccSmrg				;;
358084f91ccSmrg			hp300bsd)
359084f91ccSmrg				basic_machine=m68k-hp
360084f91ccSmrg				basic_os=bsd
361084f91ccSmrg				;;
362084f91ccSmrg			hppaosf)
363084f91ccSmrg				basic_machine=hppa1.1-hp
364084f91ccSmrg				basic_os=osf
365084f91ccSmrg				;;
366084f91ccSmrg			hppro)
367084f91ccSmrg				basic_machine=hppa1.1-hp
368084f91ccSmrg				basic_os=proelf
369084f91ccSmrg				;;
370084f91ccSmrg			i386mach)
371084f91ccSmrg				basic_machine=i386-mach
372084f91ccSmrg				basic_os=mach
373084f91ccSmrg				;;
374084f91ccSmrg			isi68 | isi)
375084f91ccSmrg				basic_machine=m68k-isi
376084f91ccSmrg				basic_os=sysv
377084f91ccSmrg				;;
378084f91ccSmrg			m68knommu)
379084f91ccSmrg				basic_machine=m68k-unknown
380084f91ccSmrg				basic_os=linux
381084f91ccSmrg				;;
382084f91ccSmrg			magnum | m3230)
383084f91ccSmrg				basic_machine=mips-mips
384084f91ccSmrg				basic_os=sysv
385084f91ccSmrg				;;
386084f91ccSmrg			merlin)
387084f91ccSmrg				basic_machine=ns32k-utek
388084f91ccSmrg				basic_os=sysv
389084f91ccSmrg				;;
390084f91ccSmrg			mingw64)
391084f91ccSmrg				basic_machine=x86_64-pc
392084f91ccSmrg				basic_os=mingw64
393084f91ccSmrg				;;
394084f91ccSmrg			mingw32)
395084f91ccSmrg				basic_machine=i686-pc
396084f91ccSmrg				basic_os=mingw32
397084f91ccSmrg				;;
398084f91ccSmrg			mingw32ce)
399084f91ccSmrg				basic_machine=arm-unknown
400084f91ccSmrg				basic_os=mingw32ce
401084f91ccSmrg				;;
402084f91ccSmrg			monitor)
403084f91ccSmrg				basic_machine=m68k-rom68k
404084f91ccSmrg				basic_os=coff
405084f91ccSmrg				;;
406084f91ccSmrg			morphos)
407084f91ccSmrg				basic_machine=powerpc-unknown
408084f91ccSmrg				basic_os=morphos
409084f91ccSmrg				;;
410084f91ccSmrg			moxiebox)
411084f91ccSmrg				basic_machine=moxie-unknown
412084f91ccSmrg				basic_os=moxiebox
413084f91ccSmrg				;;
414084f91ccSmrg			msdos)
415084f91ccSmrg				basic_machine=i386-pc
416084f91ccSmrg				basic_os=msdos
417084f91ccSmrg				;;
418084f91ccSmrg			msys)
419084f91ccSmrg				basic_machine=i686-pc
420084f91ccSmrg				basic_os=msys
421084f91ccSmrg				;;
422084f91ccSmrg			mvs)
423084f91ccSmrg				basic_machine=i370-ibm
424084f91ccSmrg				basic_os=mvs
425084f91ccSmrg				;;
426084f91ccSmrg			nacl)
427084f91ccSmrg				basic_machine=le32-unknown
428084f91ccSmrg				basic_os=nacl
429084f91ccSmrg				;;
430084f91ccSmrg			ncr3000)
431084f91ccSmrg				basic_machine=i486-ncr
432084f91ccSmrg				basic_os=sysv4
433084f91ccSmrg				;;
434084f91ccSmrg			netbsd386)
435084f91ccSmrg				basic_machine=i386-pc
436084f91ccSmrg				basic_os=netbsd
437084f91ccSmrg				;;
438084f91ccSmrg			netwinder)
439084f91ccSmrg				basic_machine=armv4l-rebel
440084f91ccSmrg				basic_os=linux
441084f91ccSmrg				;;
442084f91ccSmrg			news | news700 | news800 | news900)
443084f91ccSmrg				basic_machine=m68k-sony
444084f91ccSmrg				basic_os=newsos
445084f91ccSmrg				;;
446084f91ccSmrg			news1000)
447084f91ccSmrg				basic_machine=m68030-sony
448084f91ccSmrg				basic_os=newsos
449084f91ccSmrg				;;
450084f91ccSmrg			necv70)
451084f91ccSmrg				basic_machine=v70-nec
452084f91ccSmrg				basic_os=sysv
453084f91ccSmrg				;;
454084f91ccSmrg			nh3000)
455084f91ccSmrg				basic_machine=m68k-harris
456084f91ccSmrg				basic_os=cxux
457084f91ccSmrg				;;
458084f91ccSmrg			nh[45]000)
459084f91ccSmrg				basic_machine=m88k-harris
460084f91ccSmrg				basic_os=cxux
461084f91ccSmrg				;;
462084f91ccSmrg			nindy960)
463084f91ccSmrg				basic_machine=i960-intel
464084f91ccSmrg				basic_os=nindy
465084f91ccSmrg				;;
466084f91ccSmrg			mon960)
467084f91ccSmrg				basic_machine=i960-intel
468084f91ccSmrg				basic_os=mon960
469084f91ccSmrg				;;
470084f91ccSmrg			nonstopux)
471084f91ccSmrg				basic_machine=mips-compaq
472084f91ccSmrg				basic_os=nonstopux
473084f91ccSmrg				;;
474084f91ccSmrg			os400)
475084f91ccSmrg				basic_machine=powerpc-ibm
476084f91ccSmrg				basic_os=os400
477084f91ccSmrg				;;
478084f91ccSmrg			OSE68000 | ose68000)
479084f91ccSmrg				basic_machine=m68000-ericsson
480084f91ccSmrg				basic_os=ose
481084f91ccSmrg				;;
482084f91ccSmrg			os68k)
483084f91ccSmrg				basic_machine=m68k-none
484084f91ccSmrg				basic_os=os68k
485084f91ccSmrg				;;
486084f91ccSmrg			paragon)
487084f91ccSmrg				basic_machine=i860-intel
488084f91ccSmrg				basic_os=osf
489084f91ccSmrg				;;
490084f91ccSmrg			parisc)
491084f91ccSmrg				basic_machine=hppa-unknown
492084f91ccSmrg				basic_os=linux
493084f91ccSmrg				;;
494084f91ccSmrg			psp)
495084f91ccSmrg				basic_machine=mipsallegrexel-sony
496084f91ccSmrg				basic_os=psp
497084f91ccSmrg				;;
498084f91ccSmrg			pw32)
499084f91ccSmrg				basic_machine=i586-unknown
500084f91ccSmrg				basic_os=pw32
501084f91ccSmrg				;;
502084f91ccSmrg			rdos | rdos64)
503084f91ccSmrg				basic_machine=x86_64-pc
504084f91ccSmrg				basic_os=rdos
505084f91ccSmrg				;;
506084f91ccSmrg			rdos32)
507084f91ccSmrg				basic_machine=i386-pc
508084f91ccSmrg				basic_os=rdos
509084f91ccSmrg				;;
510084f91ccSmrg			rom68k)
511084f91ccSmrg				basic_machine=m68k-rom68k
512084f91ccSmrg				basic_os=coff
513084f91ccSmrg				;;
514084f91ccSmrg			sa29200)
515084f91ccSmrg				basic_machine=a29k-amd
516084f91ccSmrg				basic_os=udi
517084f91ccSmrg				;;
518084f91ccSmrg			sei)
519084f91ccSmrg				basic_machine=mips-sei
520084f91ccSmrg				basic_os=seiux
521084f91ccSmrg				;;
522084f91ccSmrg			sequent)
523084f91ccSmrg				basic_machine=i386-sequent
524084f91ccSmrg				basic_os=
525084f91ccSmrg				;;
526084f91ccSmrg			sps7)
527084f91ccSmrg				basic_machine=m68k-bull
528084f91ccSmrg				basic_os=sysv2
529084f91ccSmrg				;;
530084f91ccSmrg			st2000)
531084f91ccSmrg				basic_machine=m68k-tandem
532084f91ccSmrg				basic_os=
533084f91ccSmrg				;;
534084f91ccSmrg			stratus)
535084f91ccSmrg				basic_machine=i860-stratus
536084f91ccSmrg				basic_os=sysv4
537084f91ccSmrg				;;
538084f91ccSmrg			sun2)
539084f91ccSmrg				basic_machine=m68000-sun
540084f91ccSmrg				basic_os=
541084f91ccSmrg				;;
542084f91ccSmrg			sun2os3)
543084f91ccSmrg				basic_machine=m68000-sun
544084f91ccSmrg				basic_os=sunos3
545084f91ccSmrg				;;
546084f91ccSmrg			sun2os4)
547084f91ccSmrg				basic_machine=m68000-sun
548084f91ccSmrg				basic_os=sunos4
549084f91ccSmrg				;;
550084f91ccSmrg			sun3)
551084f91ccSmrg				basic_machine=m68k-sun
552084f91ccSmrg				basic_os=
553084f91ccSmrg				;;
554084f91ccSmrg			sun3os3)
555084f91ccSmrg				basic_machine=m68k-sun
556084f91ccSmrg				basic_os=sunos3
557084f91ccSmrg				;;
558084f91ccSmrg			sun3os4)
559084f91ccSmrg				basic_machine=m68k-sun
560084f91ccSmrg				basic_os=sunos4
561084f91ccSmrg				;;
562084f91ccSmrg			sun4)
563084f91ccSmrg				basic_machine=sparc-sun
564084f91ccSmrg				basic_os=
565084f91ccSmrg				;;
566084f91ccSmrg			sun4os3)
567084f91ccSmrg				basic_machine=sparc-sun
568084f91ccSmrg				basic_os=sunos3
569084f91ccSmrg				;;
570084f91ccSmrg			sun4os4)
571084f91ccSmrg				basic_machine=sparc-sun
572084f91ccSmrg				basic_os=sunos4
573084f91ccSmrg				;;
574084f91ccSmrg			sun4sol2)
575084f91ccSmrg				basic_machine=sparc-sun
576084f91ccSmrg				basic_os=solaris2
577084f91ccSmrg				;;
578084f91ccSmrg			sun386 | sun386i | roadrunner)
579084f91ccSmrg				basic_machine=i386-sun
580084f91ccSmrg				basic_os=
581084f91ccSmrg				;;
582084f91ccSmrg			sv1)
583084f91ccSmrg				basic_machine=sv1-cray
584084f91ccSmrg				basic_os=unicos
585084f91ccSmrg				;;
586084f91ccSmrg			symmetry)
587084f91ccSmrg				basic_machine=i386-sequent
588084f91ccSmrg				basic_os=dynix
589084f91ccSmrg				;;
590084f91ccSmrg			t3e)
591084f91ccSmrg				basic_machine=alphaev5-cray
592084f91ccSmrg				basic_os=unicos
593084f91ccSmrg				;;
594084f91ccSmrg			t90)
595084f91ccSmrg				basic_machine=t90-cray
596084f91ccSmrg				basic_os=unicos
597084f91ccSmrg				;;
598084f91ccSmrg			toad1)
599084f91ccSmrg				basic_machine=pdp10-xkl
600084f91ccSmrg				basic_os=tops20
601084f91ccSmrg				;;
602084f91ccSmrg			tpf)
603084f91ccSmrg				basic_machine=s390x-ibm
604084f91ccSmrg				basic_os=tpf
605084f91ccSmrg				;;
606084f91ccSmrg			udi29k)
607084f91ccSmrg				basic_machine=a29k-amd
608084f91ccSmrg				basic_os=udi
609084f91ccSmrg				;;
610084f91ccSmrg			ultra3)
611084f91ccSmrg				basic_machine=a29k-nyu
612084f91ccSmrg				basic_os=sym1
613084f91ccSmrg				;;
614084f91ccSmrg			v810 | necv810)
615084f91ccSmrg				basic_machine=v810-nec
616084f91ccSmrg				basic_os=none
617084f91ccSmrg				;;
618084f91ccSmrg			vaxv)
619084f91ccSmrg				basic_machine=vax-dec
620084f91ccSmrg				basic_os=sysv
621084f91ccSmrg				;;
622084f91ccSmrg			vms)
623084f91ccSmrg				basic_machine=vax-dec
624084f91ccSmrg				basic_os=vms
625084f91ccSmrg				;;
626084f91ccSmrg			vsta)
627084f91ccSmrg				basic_machine=i386-pc
628084f91ccSmrg				basic_os=vsta
629084f91ccSmrg				;;
630084f91ccSmrg			vxworks960)
631084f91ccSmrg				basic_machine=i960-wrs
632084f91ccSmrg				basic_os=vxworks
633084f91ccSmrg				;;
634084f91ccSmrg			vxworks68)
635084f91ccSmrg				basic_machine=m68k-wrs
636084f91ccSmrg				basic_os=vxworks
637084f91ccSmrg				;;
638084f91ccSmrg			vxworks29k)
639084f91ccSmrg				basic_machine=a29k-wrs
640084f91ccSmrg				basic_os=vxworks
641084f91ccSmrg				;;
642084f91ccSmrg			xbox)
643084f91ccSmrg				basic_machine=i686-pc
644084f91ccSmrg				basic_os=mingw32
645084f91ccSmrg				;;
646084f91ccSmrg			ymp)
647084f91ccSmrg				basic_machine=ymp-cray
648084f91ccSmrg				basic_os=unicos
649084f91ccSmrg				;;
650084f91ccSmrg			*)
651084f91ccSmrg				basic_machine=$1
652084f91ccSmrg				basic_os=
653084f91ccSmrg				;;
654084f91ccSmrg		esac
6559bd41f2cSmrg		;;
6569bd41f2cSmrgesac
6579bd41f2cSmrg
658084f91ccSmrg# Decode 1-component or ad-hoc basic machines
6599bd41f2cSmrgcase $basic_machine in
660084f91ccSmrg	# Here we handle the default manufacturer of certain CPU types.  It is in
661084f91ccSmrg	# some cases the only manufacturer, in others, it is the most popular.
662084f91ccSmrg	w89k)
663084f91ccSmrg		cpu=hppa1.1
664084f91ccSmrg		vendor=winbond
6659bd41f2cSmrg		;;
666084f91ccSmrg	op50n)
667084f91ccSmrg		cpu=hppa1.1
668084f91ccSmrg		vendor=oki
6690da4cdccSmrg		;;
670084f91ccSmrg	op60c)
671084f91ccSmrg		cpu=hppa1.1
672084f91ccSmrg		vendor=oki
6730da4cdccSmrg		;;
674084f91ccSmrg	ibm*)
675084f91ccSmrg		cpu=i370
676084f91ccSmrg		vendor=ibm
6770da4cdccSmrg		;;
678084f91ccSmrg	orion105)
679084f91ccSmrg		cpu=clipper
680084f91ccSmrg		vendor=highlevel
6810da4cdccSmrg		;;
682084f91ccSmrg	mac | mpw | mac-mpw)
683084f91ccSmrg		cpu=m68k
684084f91ccSmrg		vendor=apple
6859bd41f2cSmrg		;;
686084f91ccSmrg	pmac | pmac-mpw)
687084f91ccSmrg		cpu=powerpc
688084f91ccSmrg		vendor=apple
689d075918cSmrg		;;
690084f91ccSmrg
6919bd41f2cSmrg	# Recognize the various machine names and aliases which stand
6929bd41f2cSmrg	# for a CPU type and a company and sometimes even an OS.
6939bd41f2cSmrg	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
694084f91ccSmrg		cpu=m68000
695084f91ccSmrg		vendor=att
6969bd41f2cSmrg		;;
6979bd41f2cSmrg	3b*)
698084f91ccSmrg		cpu=we32k
699084f91ccSmrg		vendor=att
7009418810dSmrg		;;
7010da4cdccSmrg	bluegene*)
702084f91ccSmrg		cpu=powerpc
703084f91ccSmrg		vendor=ibm
704084f91ccSmrg		basic_os=cnk
7059bd41f2cSmrg		;;
7069bd41f2cSmrg	decsystem10* | dec10*)
707084f91ccSmrg		cpu=pdp10
708084f91ccSmrg		vendor=dec
709084f91ccSmrg		basic_os=tops10
7109bd41f2cSmrg		;;
7119bd41f2cSmrg	decsystem20* | dec20*)
712084f91ccSmrg		cpu=pdp10
713084f91ccSmrg		vendor=dec
714084f91ccSmrg		basic_os=tops20
7159bd41f2cSmrg		;;
7169bd41f2cSmrg	delta | 3300 | motorola-3300 | motorola-delta \
7179bd41f2cSmrg	      | 3300-motorola | delta-motorola)
718084f91ccSmrg		cpu=m68k
719084f91ccSmrg		vendor=motorola
7209bd41f2cSmrg		;;
721084f91ccSmrg	dpx2*)
722084f91ccSmrg		cpu=m68k
723084f91ccSmrg		vendor=bull
724084f91ccSmrg		basic_os=sysv3
7259bd41f2cSmrg		;;
7269bd41f2cSmrg	encore | umax | mmax)
727084f91ccSmrg		cpu=ns32k
728084f91ccSmrg		vendor=encore
7299bd41f2cSmrg		;;
730084f91ccSmrg	elxsi)
731084f91ccSmrg		cpu=elxsi
732084f91ccSmrg		vendor=elxsi
733084f91ccSmrg		basic_os=${basic_os:-bsd}
7349bd41f2cSmrg		;;
7359bd41f2cSmrg	fx2800)
736084f91ccSmrg		cpu=i860
737084f91ccSmrg		vendor=alliant
7389bd41f2cSmrg		;;
7399bd41f2cSmrg	genix)
740084f91ccSmrg		cpu=ns32k
741084f91ccSmrg		vendor=ns
7429bd41f2cSmrg		;;
7439bd41f2cSmrg	h3050r* | hiux*)
744084f91ccSmrg		cpu=hppa1.1
745084f91ccSmrg		vendor=hitachi
746084f91ccSmrg		basic_os=hiuxwe2
7479bd41f2cSmrg		;;
7489bd41f2cSmrg	hp3k9[0-9][0-9] | hp9[0-9][0-9])
749084f91ccSmrg		cpu=hppa1.0
750084f91ccSmrg		vendor=hp
7519bd41f2cSmrg		;;
7529bd41f2cSmrg	hp9k2[0-9][0-9] | hp9k31[0-9])
753084f91ccSmrg		cpu=m68000
754084f91ccSmrg		vendor=hp
7559bd41f2cSmrg		;;
7569bd41f2cSmrg	hp9k3[2-9][0-9])
757084f91ccSmrg		cpu=m68k
758084f91ccSmrg		vendor=hp
7599bd41f2cSmrg		;;
7609bd41f2cSmrg	hp9k6[0-9][0-9] | hp6[0-9][0-9])
761084f91ccSmrg		cpu=hppa1.0
762084f91ccSmrg		vendor=hp
7639bd41f2cSmrg		;;
7649bd41f2cSmrg	hp9k7[0-79][0-9] | hp7[0-79][0-9])
765084f91ccSmrg		cpu=hppa1.1
766084f91ccSmrg		vendor=hp
7679bd41f2cSmrg		;;
7689bd41f2cSmrg	hp9k78[0-9] | hp78[0-9])
7699bd41f2cSmrg		# FIXME: really hppa2.0-hp
770084f91ccSmrg		cpu=hppa1.1
771084f91ccSmrg		vendor=hp
7729bd41f2cSmrg		;;
7739bd41f2cSmrg	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
7749bd41f2cSmrg		# FIXME: really hppa2.0-hp
775084f91ccSmrg		cpu=hppa1.1
776084f91ccSmrg		vendor=hp
7779bd41f2cSmrg		;;
7789bd41f2cSmrg	hp9k8[0-9][13679] | hp8[0-9][13679])
779084f91ccSmrg		cpu=hppa1.1
780084f91ccSmrg		vendor=hp
7819bd41f2cSmrg		;;
7829bd41f2cSmrg	hp9k8[0-9][0-9] | hp8[0-9][0-9])
783084f91ccSmrg		cpu=hppa1.0
784084f91ccSmrg		vendor=hp
7859bd41f2cSmrg		;;
7869bd41f2cSmrg	i*86v32)
787084f91ccSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
788084f91ccSmrg		vendor=pc
789084f91ccSmrg		basic_os=sysv32
7909bd41f2cSmrg		;;
7919bd41f2cSmrg	i*86v4*)
792084f91ccSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
793084f91ccSmrg		vendor=pc
794084f91ccSmrg		basic_os=sysv4
7959bd41f2cSmrg		;;
7969bd41f2cSmrg	i*86v)
797084f91ccSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
798084f91ccSmrg		vendor=pc
799084f91ccSmrg		basic_os=sysv
8009bd41f2cSmrg		;;
8019bd41f2cSmrg	i*86sol2)
802084f91ccSmrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
803084f91ccSmrg		vendor=pc
804084f91ccSmrg		basic_os=solaris2
8059bd41f2cSmrg		;;
806084f91ccSmrg	j90 | j90-cray)
807084f91ccSmrg		cpu=j90
808084f91ccSmrg		vendor=cray
809084f91ccSmrg		basic_os=${basic_os:-unicos}
8109bd41f2cSmrg		;;
8119bd41f2cSmrg	iris | iris4d)
812084f91ccSmrg		cpu=mips
813084f91ccSmrg		vendor=sgi
814084f91ccSmrg		case $basic_os in
815084f91ccSmrg		    irix*)
8169bd41f2cSmrg			;;
8179bd41f2cSmrg		    *)
818084f91ccSmrg			basic_os=irix4
8199bd41f2cSmrg			;;
8209bd41f2cSmrg		esac
8219bd41f2cSmrg		;;
8229bd41f2cSmrg	miniframe)
823084f91ccSmrg		cpu=m68000
824084f91ccSmrg		vendor=convergent
8259bd41f2cSmrg		;;
826084f91ccSmrg	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
827084f91ccSmrg		cpu=m68k
828084f91ccSmrg		vendor=atari
829084f91ccSmrg		basic_os=mint
8309bd41f2cSmrg		;;
831084f91ccSmrg	mipsEE* | ee)
832084f91ccSmrg		cpu=mips64r5900el
833084f91ccSmrg		vendor=scei
834084f91ccSmrg		case $os in
835084f91ccSmrg		    linux*)
836084f91ccSmrg			;;
837084f91ccSmrg		    *)
838084f91ccSmrg			os=elf
839084f91ccSmrg			;;
840084f91ccSmrg		esac
8419bd41f2cSmrg		;;
842084f91ccSmrg	iop)
843084f91ccSmrg		cpu=mipsel
844084f91ccSmrg		vendor=scei
845084f91ccSmrg		os=irx
8469bd41f2cSmrg		;;
847084f91ccSmrg	dvp)
848084f91ccSmrg		cpu=dvp
849084f91ccSmrg		vendor=scei
850084f91ccSmrg		os=elf
8519bd41f2cSmrg		;;
8529bd41f2cSmrg	news-3600 | risc-news)
853084f91ccSmrg		cpu=mips
854084f91ccSmrg		vendor=sony
855084f91ccSmrg		basic_os=newsos
856084f91ccSmrg		;;
857084f91ccSmrg	next | m*-next)
858084f91ccSmrg		cpu=m68k
859084f91ccSmrg		vendor=next
860084f91ccSmrg		case $basic_os in
861084f91ccSmrg		    openstep*)
862084f91ccSmrg		        ;;
863084f91ccSmrg		    nextstep*)
8649bd41f2cSmrg			;;
865084f91ccSmrg		    ns2*)
866084f91ccSmrg		      basic_os=nextstep2
8679bd41f2cSmrg			;;
8689bd41f2cSmrg		    *)
869084f91ccSmrg		      basic_os=nextstep3
8709bd41f2cSmrg			;;
8719bd41f2cSmrg		esac
8729bd41f2cSmrg		;;
8739bd41f2cSmrg	np1)
874084f91ccSmrg		cpu=np1
875084f91ccSmrg		vendor=gould
8769bd41f2cSmrg		;;
8779bd41f2cSmrg	op50n-* | op60c-*)
878084f91ccSmrg		cpu=hppa1.1
879084f91ccSmrg		vendor=oki
880084f91ccSmrg		basic_os=proelf
8819bd41f2cSmrg		;;
8829bd41f2cSmrg	pa-hitachi)
883084f91ccSmrg		cpu=hppa1.1
884084f91ccSmrg		vendor=hitachi
885084f91ccSmrg		basic_os=hiuxwe2
8869418810dSmrg		;;
8879bd41f2cSmrg	pbd)
888084f91ccSmrg		cpu=sparc
889084f91ccSmrg		vendor=tti
8909bd41f2cSmrg		;;
8919bd41f2cSmrg	pbb)
892084f91ccSmrg		cpu=m68k
893084f91ccSmrg		vendor=tti
8949418810dSmrg		;;
895084f91ccSmrg	pc532)
896084f91ccSmrg		cpu=ns32k
897084f91ccSmrg		vendor=pc532
8989bd41f2cSmrg		;;
8999bd41f2cSmrg	pn)
900084f91ccSmrg		cpu=pn
901084f91ccSmrg		vendor=gould
9029bd41f2cSmrg		;;
903084f91ccSmrg	power)
904084f91ccSmrg		cpu=power
905084f91ccSmrg		vendor=ibm
9069bd41f2cSmrg		;;
9079bd41f2cSmrg	ps2)
908084f91ccSmrg		cpu=i386
909084f91ccSmrg		vendor=ibm
9109bd41f2cSmrg		;;
9119bd41f2cSmrg	rm[46]00)
912084f91ccSmrg		cpu=mips
913084f91ccSmrg		vendor=siemens
9149bd41f2cSmrg		;;
9159bd41f2cSmrg	rtpc | rtpc-*)
916084f91ccSmrg		cpu=romp
917084f91ccSmrg		vendor=ibm
9189bd41f2cSmrg		;;
919084f91ccSmrg	sde)
920084f91ccSmrg		cpu=mipsisa32
921084f91ccSmrg		vendor=sde
922084f91ccSmrg		basic_os=${basic_os:-elf}
9239bd41f2cSmrg		;;
924084f91ccSmrg	simso-wrs)
925084f91ccSmrg		cpu=sparclite
926084f91ccSmrg		vendor=wrs
927084f91ccSmrg		basic_os=vxworks
9289bd41f2cSmrg		;;
929084f91ccSmrg	tower | tower-32)
930084f91ccSmrg		cpu=m68k
931084f91ccSmrg		vendor=ncr
9329bd41f2cSmrg		;;
933084f91ccSmrg	vpp*|vx|vx-*)
934084f91ccSmrg		cpu=f301
935084f91ccSmrg		vendor=fujitsu
9369418810dSmrg		;;
937084f91ccSmrg	w65)
938084f91ccSmrg		cpu=w65
939084f91ccSmrg		vendor=wdc
9409bd41f2cSmrg		;;
941084f91ccSmrg	w89k-*)
942084f91ccSmrg		cpu=hppa1.1
943084f91ccSmrg		vendor=winbond
944084f91ccSmrg		basic_os=proelf
9459bd41f2cSmrg		;;
946084f91ccSmrg	none)
947084f91ccSmrg		cpu=none
948084f91ccSmrg		vendor=none
9499bd41f2cSmrg		;;
950084f91ccSmrg	leon|leon[3-9])
951084f91ccSmrg		cpu=sparc
952084f91ccSmrg		vendor=$basic_machine
9539418810dSmrg		;;
954084f91ccSmrg	leon-*|leon[3-9]-*)
955084f91ccSmrg		cpu=sparc
956084f91ccSmrg		vendor=`echo "$basic_machine" | sed 's/-.*//'`
9579bd41f2cSmrg		;;
958084f91ccSmrg
959084f91ccSmrg	*-*)
960084f91ccSmrg		# shellcheck disable=SC2162
961084f91ccSmrg		saved_IFS=$IFS
962084f91ccSmrg		IFS="-" read cpu vendor <<EOF
963084f91ccSmrg$basic_machine
964084f91ccSmrgEOF
965084f91ccSmrg		IFS=$saved_IFS
9669bd41f2cSmrg		;;
967084f91ccSmrg	# We use `pc' rather than `unknown'
968084f91ccSmrg	# because (1) that's what they normally are, and
969084f91ccSmrg	# (2) the word "unknown" tends to confuse beginning users.
970084f91ccSmrg	i*86 | x86_64)
971084f91ccSmrg		cpu=$basic_machine
972084f91ccSmrg		vendor=pc
9739bd41f2cSmrg		;;
974084f91ccSmrg	# These rules are duplicated from below for sake of the special case above;
975084f91ccSmrg	# i.e. things that normalized to x86 arches should also default to "pc"
976084f91ccSmrg	pc98)
977084f91ccSmrg		cpu=i386
978084f91ccSmrg		vendor=pc
9799bd41f2cSmrg		;;
980084f91ccSmrg	x64 | amd64)
981084f91ccSmrg		cpu=x86_64
982084f91ccSmrg		vendor=pc
9839bd41f2cSmrg		;;
984084f91ccSmrg	# Recognize the basic CPU types without company name.
985084f91ccSmrg	*)
986084f91ccSmrg		cpu=$basic_machine
987084f91ccSmrg		vendor=unknown
9889bd41f2cSmrg		;;
989084f91ccSmrgesac
990084f91ccSmrg
991084f91ccSmrgunset -v basic_machine
992084f91ccSmrg
993084f91ccSmrg# Decode basic machines in the full and proper CPU-Company form.
994084f91ccSmrgcase $cpu-$vendor in
995084f91ccSmrg	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
996084f91ccSmrg	# some cases the only manufacturer, in others, it is the most popular.
997084f91ccSmrg	craynv-unknown)
998084f91ccSmrg		vendor=cray
999084f91ccSmrg		basic_os=${basic_os:-unicosmp}
10000da4cdccSmrg		;;
1001084f91ccSmrg	c90-unknown | c90-cray)
1002084f91ccSmrg		vendor=cray
1003084f91ccSmrg		basic_os=${Basic_os:-unicos}
10049bd41f2cSmrg		;;
1005084f91ccSmrg	fx80-unknown)
1006084f91ccSmrg		vendor=alliant
10079bd41f2cSmrg		;;
1008084f91ccSmrg	romp-unknown)
1009084f91ccSmrg		vendor=ibm
10109bd41f2cSmrg		;;
1011084f91ccSmrg	mmix-unknown)
1012084f91ccSmrg		vendor=knuth
10139bd41f2cSmrg		;;
1014084f91ccSmrg	microblaze-unknown | microblazeel-unknown)
1015084f91ccSmrg		vendor=xilinx
10169bd41f2cSmrg		;;
1017084f91ccSmrg	rs6000-unknown)
1018084f91ccSmrg		vendor=ibm
10199bd41f2cSmrg		;;
1020084f91ccSmrg	vax-unknown)
1021084f91ccSmrg		vendor=dec
10229bd41f2cSmrg		;;
1023084f91ccSmrg	pdp11-unknown)
1024084f91ccSmrg		vendor=dec
10259bd41f2cSmrg		;;
1026084f91ccSmrg	we32k-unknown)
1027084f91ccSmrg		vendor=att
10289bd41f2cSmrg		;;
1029084f91ccSmrg	cydra-unknown)
1030084f91ccSmrg		vendor=cydrome
10319bd41f2cSmrg		;;
1032084f91ccSmrg	i370-ibm*)
1033084f91ccSmrg		vendor=ibm
10349bd41f2cSmrg		;;
1035084f91ccSmrg	orion-unknown)
1036084f91ccSmrg		vendor=highlevel
10379bd41f2cSmrg		;;
1038084f91ccSmrg	xps-unknown | xps100-unknown)
1039084f91ccSmrg		cpu=xps100
1040084f91ccSmrg		vendor=honeywell
10419bd41f2cSmrg		;;
1042084f91ccSmrg
1043084f91ccSmrg	# Here we normalize CPU types with a missing or matching vendor
1044084f91ccSmrg	armh-unknown | armh-alt)
1045084f91ccSmrg		cpu=armv7l
1046084f91ccSmrg		vendor=alt
1047084f91ccSmrg		basic_os=${basic_os:-linux-gnueabihf}
10489bd41f2cSmrg		;;
1049084f91ccSmrg	dpx20-unknown | dpx20-bull)
1050084f91ccSmrg		cpu=rs6000
1051084f91ccSmrg		vendor=bull
1052084f91ccSmrg		basic_os=${basic_os:-bosx}
10539bd41f2cSmrg		;;
1054084f91ccSmrg
1055084f91ccSmrg	# Here we normalize CPU types irrespective of the vendor
1056084f91ccSmrg	amd64-*)
1057084f91ccSmrg		cpu=x86_64
10589418810dSmrg		;;
1059084f91ccSmrg	blackfin-*)
1060084f91ccSmrg		cpu=bfin
1061084f91ccSmrg		basic_os=linux
10629bd41f2cSmrg		;;
1063084f91ccSmrg	c54x-*)
1064084f91ccSmrg		cpu=tic54x
10659bd41f2cSmrg		;;
1066084f91ccSmrg	c55x-*)
1067084f91ccSmrg		cpu=tic55x
10689bd41f2cSmrg		;;
1069084f91ccSmrg	c6x-*)
1070084f91ccSmrg		cpu=tic6x
10719bd41f2cSmrg		;;
1072084f91ccSmrg	e500v[12]-*)
1073084f91ccSmrg		cpu=powerpc
1074084f91ccSmrg		basic_os=${basic_os}"spe"
10759bd41f2cSmrg		;;
1076084f91ccSmrg	mips3*-*)
1077084f91ccSmrg		cpu=mips64
10789bd41f2cSmrg		;;
1079084f91ccSmrg	ms1-*)
1080084f91ccSmrg		cpu=mt
10819bd41f2cSmrg		;;
1082084f91ccSmrg	m68knommu-*)
1083084f91ccSmrg		cpu=m68k
1084084f91ccSmrg		basic_os=linux
10859bd41f2cSmrg		;;
1086084f91ccSmrg	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1087084f91ccSmrg		cpu=s12z
10889bd41f2cSmrg		;;
1089084f91ccSmrg	openrisc-*)
1090084f91ccSmrg		cpu=or32
10919bd41f2cSmrg		;;
1092084f91ccSmrg	parisc-*)
1093084f91ccSmrg		cpu=hppa
1094084f91ccSmrg		basic_os=linux
10959bd41f2cSmrg		;;
1096084f91ccSmrg	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1097084f91ccSmrg		cpu=i586
10989bd41f2cSmrg		;;
1099084f91ccSmrg	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1100084f91ccSmrg		cpu=i686
11019bd41f2cSmrg		;;
1102084f91ccSmrg	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1103084f91ccSmrg		cpu=i686
11049bd41f2cSmrg		;;
1105084f91ccSmrg	pentium4-*)
1106084f91ccSmrg		cpu=i786
11079bd41f2cSmrg		;;
1108084f91ccSmrg	pc98-*)
1109084f91ccSmrg		cpu=i386
11109bd41f2cSmrg		;;
1111084f91ccSmrg	ppc-* | ppcbe-*)
1112084f91ccSmrg		cpu=powerpc
11139bd41f2cSmrg		;;
1114084f91ccSmrg	ppcle-* | powerpclittle-*)
1115084f91ccSmrg		cpu=powerpcle
11169bd41f2cSmrg		;;
1117084f91ccSmrg	ppc64-*)
1118084f91ccSmrg		cpu=powerpc64
11190da4cdccSmrg		;;
1120084f91ccSmrg	ppc64le-* | powerpc64little-*)
1121084f91ccSmrg		cpu=powerpc64le
11229bd41f2cSmrg		;;
1123084f91ccSmrg	sb1-*)
1124084f91ccSmrg		cpu=mipsisa64sb1
11259bd41f2cSmrg		;;
1126084f91ccSmrg	sb1el-*)
1127084f91ccSmrg		cpu=mipsisa64sb1el
11289418810dSmrg		;;
1129084f91ccSmrg	sh5e[lb]-*)
1130084f91ccSmrg		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
11319bd41f2cSmrg		;;
1132084f91ccSmrg	spur-*)
1133084f91ccSmrg		cpu=spur
11349bd41f2cSmrg		;;
1135084f91ccSmrg	strongarm-* | thumb-*)
1136084f91ccSmrg		cpu=arm
11379bd41f2cSmrg		;;
1138084f91ccSmrg	tx39-*)
1139084f91ccSmrg		cpu=mipstx39
11409bd41f2cSmrg		;;
1141084f91ccSmrg	tx39el-*)
1142084f91ccSmrg		cpu=mipstx39el
11439bd41f2cSmrg		;;
1144084f91ccSmrg	x64-*)
1145084f91ccSmrg		cpu=x86_64
11469bd41f2cSmrg		;;
1147084f91ccSmrg	xscale-* | xscalee[bl]-*)
1148084f91ccSmrg		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
11499bd41f2cSmrg		;;
1150084f91ccSmrg	arm64-* | aarch64le-*)
1151084f91ccSmrg		cpu=aarch64
11529bd41f2cSmrg		;;
1153084f91ccSmrg
1154084f91ccSmrg	# Recognize the canonical CPU Types that limit and/or modify the
1155084f91ccSmrg	# company names they are paired with.
1156084f91ccSmrg	cr16-*)
1157084f91ccSmrg		basic_os=${basic_os:-elf}
11589bd41f2cSmrg		;;
1159084f91ccSmrg	crisv32-* | etraxfs*-*)
1160084f91ccSmrg		cpu=crisv32
1161084f91ccSmrg		vendor=axis
11629bd41f2cSmrg		;;
1163084f91ccSmrg	cris-* | etrax*-*)
1164084f91ccSmrg		cpu=cris
1165084f91ccSmrg		vendor=axis
11669bd41f2cSmrg		;;
1167084f91ccSmrg	crx-*)
1168084f91ccSmrg		basic_os=${basic_os:-elf}
11699bd41f2cSmrg		;;
1170084f91ccSmrg	neo-tandem)
1171084f91ccSmrg		cpu=neo
1172084f91ccSmrg		vendor=tandem
11739bd41f2cSmrg		;;
1174084f91ccSmrg	nse-tandem)
1175084f91ccSmrg		cpu=nse
1176084f91ccSmrg		vendor=tandem
11779bd41f2cSmrg		;;
1178084f91ccSmrg	nsr-tandem)
1179084f91ccSmrg		cpu=nsr
1180084f91ccSmrg		vendor=tandem
11819bd41f2cSmrg		;;
1182084f91ccSmrg	nsv-tandem)
1183084f91ccSmrg		cpu=nsv
1184084f91ccSmrg		vendor=tandem
11859bd41f2cSmrg		;;
1186084f91ccSmrg	nsx-tandem)
1187084f91ccSmrg		cpu=nsx
1188084f91ccSmrg		vendor=tandem
11899bd41f2cSmrg		;;
1190084f91ccSmrg	mipsallegrexel-sony)
1191084f91ccSmrg		cpu=mipsallegrexel
1192084f91ccSmrg		vendor=sony
11939bd41f2cSmrg		;;
1194084f91ccSmrg	tile*-*)
1195084f91ccSmrg		basic_os=${basic_os:-linux-gnu}
11969bd41f2cSmrg		;;
1197084f91ccSmrg
11989bd41f2cSmrg	*)
1199084f91ccSmrg		# Recognize the canonical CPU types that are allowed with any
1200084f91ccSmrg		# company name.
1201084f91ccSmrg		case $cpu in
1202084f91ccSmrg			1750a | 580 \
1203084f91ccSmrg			| a29k \
1204084f91ccSmrg			| aarch64 | aarch64_be \
1205084f91ccSmrg			| abacus \
1206084f91ccSmrg			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1207084f91ccSmrg			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1208084f91ccSmrg			| alphapca5[67] | alpha64pca5[67] \
1209084f91ccSmrg			| am33_2.0 \
1210084f91ccSmrg			| amdgcn \
1211084f91ccSmrg			| arc | arceb | arc32 | arc64 \
1212084f91ccSmrg			| arm | arm[lb]e | arme[lb] | armv* \
1213084f91ccSmrg			| avr | avr32 \
1214084f91ccSmrg			| asmjs \
1215084f91ccSmrg			| ba \
1216084f91ccSmrg			| be32 | be64 \
1217084f91ccSmrg			| bfin | bpf | bs2000 \
1218084f91ccSmrg			| c[123]* | c30 | [cjt]90 | c4x \
1219084f91ccSmrg			| c8051 | clipper | craynv | csky | cydra \
1220084f91ccSmrg			| d10v | d30v | dlx | dsp16xx | dvp \
1221084f91ccSmrg			| e2k | elxsi | epiphany \
1222084f91ccSmrg			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1223084f91ccSmrg			| h8300 | h8500 \
1224084f91ccSmrg			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1225084f91ccSmrg			| hexagon \
1226084f91ccSmrg			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1227084f91ccSmrg			| ip2k | iq2000 \
1228084f91ccSmrg			| k1om \
1229084f91ccSmrg			| le32 | le64 \
1230084f91ccSmrg			| lm32 \
1231084f91ccSmrg			| loongarch32 | loongarch64 | loongarchx32 \
1232084f91ccSmrg			| m32c | m32r | m32rle \
1233084f91ccSmrg			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1234084f91ccSmrg			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1235084f91ccSmrg			| m88110 | m88k | maxq | mb | mcore | mep | metag \
1236084f91ccSmrg			| microblaze | microblazeel \
1237084f91ccSmrg			| mips | mipsbe | mipseb | mipsel | mipsle \
1238084f91ccSmrg			| mips16 \
1239084f91ccSmrg			| mips64 | mips64eb | mips64el \
1240084f91ccSmrg			| mips64octeon | mips64octeonel \
1241084f91ccSmrg			| mips64orion | mips64orionel \
1242084f91ccSmrg			| mips64r5900 | mips64r5900el \
1243084f91ccSmrg			| mips64vr | mips64vrel \
1244084f91ccSmrg			| mips64vr4100 | mips64vr4100el \
1245084f91ccSmrg			| mips64vr4300 | mips64vr4300el \
1246084f91ccSmrg			| mips64vr5000 | mips64vr5000el \
1247084f91ccSmrg			| mips64vr5900 | mips64vr5900el \
1248084f91ccSmrg			| mipsisa32 | mipsisa32el \
1249084f91ccSmrg			| mipsisa32r2 | mipsisa32r2el \
1250084f91ccSmrg			| mipsisa32r3 | mipsisa32r3el \
1251084f91ccSmrg			| mipsisa32r5 | mipsisa32r5el \
1252084f91ccSmrg			| mipsisa32r6 | mipsisa32r6el \
1253084f91ccSmrg			| mipsisa64 | mipsisa64el \
1254084f91ccSmrg			| mipsisa64r2 | mipsisa64r2el \
1255084f91ccSmrg			| mipsisa64r3 | mipsisa64r3el \
1256084f91ccSmrg			| mipsisa64r5 | mipsisa64r5el \
1257084f91ccSmrg			| mipsisa64r6 | mipsisa64r6el \
1258084f91ccSmrg			| mipsisa64sb1 | mipsisa64sb1el \
1259084f91ccSmrg			| mipsisa64sr71k | mipsisa64sr71kel \
1260084f91ccSmrg			| mipsr5900 | mipsr5900el \
1261084f91ccSmrg			| mipstx39 | mipstx39el \
1262084f91ccSmrg			| mmix \
1263084f91ccSmrg			| mn10200 | mn10300 \
1264084f91ccSmrg			| moxie \
1265084f91ccSmrg			| mt \
1266084f91ccSmrg			| msp430 \
1267084f91ccSmrg			| nds32 | nds32le | nds32be \
1268084f91ccSmrg			| nfp \
1269084f91ccSmrg			| nios | nios2 | nios2eb | nios2el \
1270084f91ccSmrg			| none | np1 | ns16k | ns32k | nvptx \
1271084f91ccSmrg			| open8 \
1272084f91ccSmrg			| or1k* \
1273084f91ccSmrg			| or32 \
1274084f91ccSmrg			| orion \
1275084f91ccSmrg			| picochip \
1276084f91ccSmrg			| pdp10 | pdp11 | pj | pjl | pn | power \
1277084f91ccSmrg			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1278084f91ccSmrg			| pru \
1279084f91ccSmrg			| pyramid \
1280084f91ccSmrg			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1281084f91ccSmrg			| rl78 | romp | rs6000 | rx \
1282084f91ccSmrg			| s390 | s390x \
1283084f91ccSmrg			| score \
1284084f91ccSmrg			| sh | shl \
1285084f91ccSmrg			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1286084f91ccSmrg			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1287084f91ccSmrg			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1288084f91ccSmrg			| sparclite \
1289084f91ccSmrg			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1290084f91ccSmrg			| spu \
1291084f91ccSmrg			| tahoe \
1292084f91ccSmrg			| thumbv7* \
1293084f91ccSmrg			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1294084f91ccSmrg			| tron \
1295084f91ccSmrg			| ubicom32 \
1296084f91ccSmrg			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1297084f91ccSmrg			| vax \
1298084f91ccSmrg			| visium \
1299084f91ccSmrg			| w65 \
1300084f91ccSmrg			| wasm32 | wasm64 \
1301084f91ccSmrg			| we32k \
1302084f91ccSmrg			| x86 | x86_64 | xc16x | xgate | xps100 \
1303084f91ccSmrg			| xstormy16 | xtensa* \
1304084f91ccSmrg			| ymp \
1305084f91ccSmrg			| z8k | z80)
1306084f91ccSmrg				;;
1307084f91ccSmrg
1308084f91ccSmrg			*)
1309084f91ccSmrg				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1310084f91ccSmrg				exit 1
1311084f91ccSmrg				;;
1312084f91ccSmrg		esac
13139bd41f2cSmrg		;;
13149bd41f2cSmrgesac
13159bd41f2cSmrg
13169bd41f2cSmrg# Here we canonicalize certain aliases for manufacturers.
1317084f91ccSmrgcase $vendor in
1318084f91ccSmrg	digital*)
1319084f91ccSmrg		vendor=dec
13209bd41f2cSmrg		;;
1321084f91ccSmrg	commodore*)
1322084f91ccSmrg		vendor=cbm
13239bd41f2cSmrg		;;
13249bd41f2cSmrg	*)
13259bd41f2cSmrg		;;
13269bd41f2cSmrgesac
13279bd41f2cSmrg
13289bd41f2cSmrg# Decode manufacturer-specific aliases for certain operating systems.
13299bd41f2cSmrg
1330084f91ccSmrgif test x$basic_os != x
13319bd41f2cSmrgthen
1332084f91ccSmrg
1333084f91ccSmrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
1334084f91ccSmrg# set os.
1335084f91ccSmrgcase $basic_os in
1336084f91ccSmrg	gnu/linux*)
1337084f91ccSmrg		kernel=linux
1338084f91ccSmrg		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1339084f91ccSmrg		;;
1340084f91ccSmrg	os2-emx)
1341084f91ccSmrg		kernel=os2
1342084f91ccSmrg		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1343084f91ccSmrg		;;
1344084f91ccSmrg	nto-qnx*)
1345084f91ccSmrg		kernel=nto
1346084f91ccSmrg		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1347084f91ccSmrg		;;
1348084f91ccSmrg	*-*)
1349084f91ccSmrg		# shellcheck disable=SC2162
1350084f91ccSmrg		saved_IFS=$IFS
1351084f91ccSmrg		IFS="-" read kernel os <<EOF
1352084f91ccSmrg$basic_os
1353084f91ccSmrgEOF
1354084f91ccSmrg		IFS=$saved_IFS
1355084f91ccSmrg		;;
1356084f91ccSmrg	# Default OS when just kernel was specified
1357084f91ccSmrg	nto*)
1358084f91ccSmrg		kernel=nto
1359084f91ccSmrg		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1360084f91ccSmrg		;;
1361084f91ccSmrg	linux*)
1362084f91ccSmrg		kernel=linux
1363084f91ccSmrg		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
13640da4cdccSmrg		;;
1365084f91ccSmrg	*)
1366084f91ccSmrg		kernel=
1367084f91ccSmrg		os=$basic_os
13689bd41f2cSmrg		;;
1369084f91ccSmrgesac
1370084f91ccSmrg
1371084f91ccSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1372084f91ccSmrg# etc.)
1373084f91ccSmrgcase $os in
1374084f91ccSmrg	# First match some system type aliases that might get confused
1375084f91ccSmrg	# with valid system types.
1376084f91ccSmrg	# solaris* is a basic system type, with this one exception.
1377084f91ccSmrg	auroraux)
1378084f91ccSmrg		os=auroraux
13799bd41f2cSmrg		;;
1380084f91ccSmrg	bluegene*)
1381084f91ccSmrg		os=cnk
13829bd41f2cSmrg		;;
1383084f91ccSmrg	solaris1 | solaris1.*)
1384084f91ccSmrg		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
13859bd41f2cSmrg		;;
1386084f91ccSmrg	solaris)
1387084f91ccSmrg		os=solaris2
13889bd41f2cSmrg		;;
1389084f91ccSmrg	unixware*)
1390084f91ccSmrg		os=sysv4.2uw
13919bd41f2cSmrg		;;
1392084f91ccSmrg	# es1800 is here to avoid being matched by es* (a different OS)
1393084f91ccSmrg	es1800*)
1394084f91ccSmrg		os=ose
13959bd41f2cSmrg		;;
1396084f91ccSmrg	# Some version numbers need modification
1397084f91ccSmrg	chorusos*)
1398084f91ccSmrg		os=chorusos
13999bd41f2cSmrg		;;
1400084f91ccSmrg	isc)
1401084f91ccSmrg		os=isc2.2
14029bd41f2cSmrg		;;
1403084f91ccSmrg	sco6)
1404084f91ccSmrg		os=sco5v6
14059bd41f2cSmrg		;;
1406084f91ccSmrg	sco5)
1407084f91ccSmrg		os=sco3.2v5
14089bd41f2cSmrg		;;
1409084f91ccSmrg	sco4)
1410084f91ccSmrg		os=sco3.2v4
14119bd41f2cSmrg		;;
1412084f91ccSmrg	sco3.2.[4-9]*)
1413084f91ccSmrg		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
14149bd41f2cSmrg		;;
1415084f91ccSmrg	sco*v* | scout)
1416084f91ccSmrg		# Don't match below
14179bd41f2cSmrg		;;
1418084f91ccSmrg	sco*)
1419084f91ccSmrg		os=sco3.2v2
14209bd41f2cSmrg		;;
1421084f91ccSmrg	psos*)
1422084f91ccSmrg		os=psos
14239bd41f2cSmrg		;;
1424084f91ccSmrg	qnx*)
1425084f91ccSmrg		os=qnx
14269bd41f2cSmrg		;;
1427084f91ccSmrg	hiux*)
1428084f91ccSmrg		os=hiuxwe2
14299bd41f2cSmrg		;;
1430084f91ccSmrg	lynx*178)
1431084f91ccSmrg		os=lynxos178
14329bd41f2cSmrg		;;
1433084f91ccSmrg	lynx*5)
1434084f91ccSmrg		os=lynxos5
14359bd41f2cSmrg		;;
1436084f91ccSmrg	lynxos*)
1437084f91ccSmrg		# don't get caught up in next wildcard
14389bd41f2cSmrg		;;
1439084f91ccSmrg	lynx*)
1440084f91ccSmrg		os=lynxos
14419bd41f2cSmrg		;;
1442084f91ccSmrg	mac[0-9]*)
1443084f91ccSmrg		os=`echo "$os" | sed -e 's|mac|macos|'`
14449bd41f2cSmrg		;;
1445084f91ccSmrg	opened*)
1446084f91ccSmrg		os=openedition
14479bd41f2cSmrg		;;
1448084f91ccSmrg	os400*)
1449084f91ccSmrg		os=os400
14509bd41f2cSmrg		;;
1451084f91ccSmrg	sunos5*)
1452084f91ccSmrg		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
14539bd41f2cSmrg		;;
1454084f91ccSmrg	sunos6*)
1455084f91ccSmrg		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
14569bd41f2cSmrg		;;
1457084f91ccSmrg	wince*)
1458084f91ccSmrg		os=wince
14599bd41f2cSmrg		;;
1460084f91ccSmrg	utek*)
1461084f91ccSmrg		os=bsd
14629bd41f2cSmrg		;;
1463084f91ccSmrg	dynix*)
1464084f91ccSmrg		os=bsd
14659bd41f2cSmrg		;;
1466084f91ccSmrg	acis*)
1467084f91ccSmrg		os=aos
14689bd41f2cSmrg		;;
1469084f91ccSmrg	atheos*)
1470084f91ccSmrg		os=atheos
14719bd41f2cSmrg		;;
1472084f91ccSmrg	syllable*)
1473084f91ccSmrg		os=syllable
14749bd41f2cSmrg		;;
1475084f91ccSmrg	386bsd)
1476084f91ccSmrg		os=bsd
1477084f91ccSmrg		;;
1478084f91ccSmrg	ctix* | uts*)
1479084f91ccSmrg		os=sysv
14809bd41f2cSmrg		;;
1481084f91ccSmrg	nova*)
1482084f91ccSmrg		os=rtmk-nova
14839bd41f2cSmrg		;;
1484084f91ccSmrg	ns2)
1485084f91ccSmrg		os=nextstep2
14869bd41f2cSmrg		;;
1487084f91ccSmrg	# Preserve the version number of sinix5.
1488084f91ccSmrg	sinix5.*)
1489084f91ccSmrg		os=`echo "$os" | sed -e 's|sinix|sysv|'`
14909bd41f2cSmrg		;;
1491084f91ccSmrg	sinix*)
1492084f91ccSmrg		os=sysv4
14939bd41f2cSmrg		;;
1494084f91ccSmrg	tpf*)
1495084f91ccSmrg		os=tpf
14969bd41f2cSmrg		;;
1497084f91ccSmrg	triton*)
1498084f91ccSmrg		os=sysv3
14999bd41f2cSmrg		;;
1500084f91ccSmrg	oss*)
1501084f91ccSmrg		os=sysv3
15029bd41f2cSmrg		;;
1503084f91ccSmrg	svr4*)
1504084f91ccSmrg		os=sysv4
15059bd41f2cSmrg		;;
1506084f91ccSmrg	svr3)
1507084f91ccSmrg		os=sysv3
15089bd41f2cSmrg		;;
1509084f91ccSmrg	sysvr4)
1510084f91ccSmrg		os=sysv4
15119bd41f2cSmrg		;;
1512084f91ccSmrg	ose*)
1513084f91ccSmrg		os=ose
15149bd41f2cSmrg		;;
1515084f91ccSmrg	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1516084f91ccSmrg		os=mint
15179418810dSmrg		;;
1518084f91ccSmrg	dicos*)
1519084f91ccSmrg		os=dicos
15200da4cdccSmrg		;;
1521084f91ccSmrg	pikeos*)
1522084f91ccSmrg		# Until real need of OS specific support for
1523084f91ccSmrg		# particular features comes up, bare metal
1524084f91ccSmrg		# configurations are quite functional.
1525084f91ccSmrg		case $cpu in
1526084f91ccSmrg		    arm*)
1527084f91ccSmrg			os=eabi
1528084f91ccSmrg			;;
1529084f91ccSmrg		    *)
1530084f91ccSmrg			os=elf
1531084f91ccSmrg			;;
1532084f91ccSmrg		esac
15339bd41f2cSmrg		;;
15349bd41f2cSmrg	*)
1535084f91ccSmrg		# No normalization, but not necessarily accepted, that comes below.
15369bd41f2cSmrg		;;
15379bd41f2cSmrgesac
1538084f91ccSmrg
15399bd41f2cSmrgelse
15409bd41f2cSmrg
15419bd41f2cSmrg# Here we handle the default operating systems that come with various machines.
15429bd41f2cSmrg# The value should be what the vendor currently ships out the door with their
15439bd41f2cSmrg# machine or put another way, the most popular os provided with the machine.
15449bd41f2cSmrg
15459bd41f2cSmrg# Note that if you're going to try to match "-MANUFACTURER" here (say,
15469bd41f2cSmrg# "-sun"), then you have to tell the case statement up towards the top
15479bd41f2cSmrg# that MANUFACTURER isn't an operating system.  Otherwise, code above
15489bd41f2cSmrg# will signal an error saying that MANUFACTURER isn't an operating
15499bd41f2cSmrg# system, and we'll never get to this point.
15509bd41f2cSmrg
1551084f91ccSmrgkernel=
1552084f91ccSmrgcase $cpu-$vendor in
15530da4cdccSmrg	score-*)
1554084f91ccSmrg		os=elf
15559418810dSmrg		;;
15560da4cdccSmrg	spu-*)
1557084f91ccSmrg		os=elf
15589418810dSmrg		;;
15599bd41f2cSmrg	*-acorn)
1560084f91ccSmrg		os=riscix1.2
15619bd41f2cSmrg		;;
15629bd41f2cSmrg	arm*-rebel)
1563084f91ccSmrg		kernel=linux
1564084f91ccSmrg		os=gnu
15659bd41f2cSmrg		;;
15669bd41f2cSmrg	arm*-semi)
1567084f91ccSmrg		os=aout
15689bd41f2cSmrg		;;
15690da4cdccSmrg	c4x-* | tic4x-*)
1570084f91ccSmrg		os=coff
1571084f91ccSmrg		;;
1572084f91ccSmrg	c8051-*)
1573084f91ccSmrg		os=elf
1574084f91ccSmrg		;;
1575084f91ccSmrg	clipper-intergraph)
1576084f91ccSmrg		os=clix
1577084f91ccSmrg		;;
1578084f91ccSmrg	hexagon-*)
1579084f91ccSmrg		os=elf
15800da4cdccSmrg		;;
15810da4cdccSmrg	tic54x-*)
1582084f91ccSmrg		os=coff
15830da4cdccSmrg		;;
15840da4cdccSmrg	tic55x-*)
1585084f91ccSmrg		os=coff
15860da4cdccSmrg		;;
15870da4cdccSmrg	tic6x-*)
1588084f91ccSmrg		os=coff
15899418810dSmrg		;;
15909bd41f2cSmrg	# This must come before the *-dec entry.
15919bd41f2cSmrg	pdp10-*)
1592084f91ccSmrg		os=tops20
15939bd41f2cSmrg		;;
15949bd41f2cSmrg	pdp11-*)
1595084f91ccSmrg		os=none
15969bd41f2cSmrg		;;
15979bd41f2cSmrg	*-dec | vax-*)
1598084f91ccSmrg		os=ultrix4.2
15999bd41f2cSmrg		;;
16009bd41f2cSmrg	m68*-apollo)
1601084f91ccSmrg		os=domain
16029bd41f2cSmrg		;;
16039bd41f2cSmrg	i386-sun)
1604084f91ccSmrg		os=sunos4.0.2
16059bd41f2cSmrg		;;
16069bd41f2cSmrg	m68000-sun)
1607084f91ccSmrg		os=sunos3
16089bd41f2cSmrg		;;
16099bd41f2cSmrg	m68*-cisco)
1610084f91ccSmrg		os=aout
16119bd41f2cSmrg		;;
16120da4cdccSmrg	mep-*)
1613084f91ccSmrg		os=elf
16149418810dSmrg		;;
16159bd41f2cSmrg	mips*-cisco)
1616084f91ccSmrg		os=elf
16179bd41f2cSmrg		;;
16189bd41f2cSmrg	mips*-*)
1619084f91ccSmrg		os=elf
16209bd41f2cSmrg		;;
16219bd41f2cSmrg	or32-*)
1622084f91ccSmrg		os=coff
16239bd41f2cSmrg		;;
16249bd41f2cSmrg	*-tti)	# must be before sparc entry or we get the wrong os.
1625084f91ccSmrg		os=sysv3
16269bd41f2cSmrg		;;
16279bd41f2cSmrg	sparc-* | *-sun)
1628084f91ccSmrg		os=sunos4.1.1
16299bd41f2cSmrg		;;
1630084f91ccSmrg	pru-*)
1631084f91ccSmrg		os=elf
16329bd41f2cSmrg		;;
1633084f91ccSmrg	*-be)
1634084f91ccSmrg		os=beos
16359bd41f2cSmrg		;;
16369bd41f2cSmrg	*-ibm)
1637084f91ccSmrg		os=aix
16389bd41f2cSmrg		;;
16390da4cdccSmrg	*-knuth)
1640084f91ccSmrg		os=mmixware
16419bd41f2cSmrg		;;
16429bd41f2cSmrg	*-wec)
1643084f91ccSmrg		os=proelf
16449bd41f2cSmrg		;;
16459bd41f2cSmrg	*-winbond)
1646084f91ccSmrg		os=proelf
16479bd41f2cSmrg		;;
16489bd41f2cSmrg	*-oki)
1649084f91ccSmrg		os=proelf
16509bd41f2cSmrg		;;
16519bd41f2cSmrg	*-hp)
1652084f91ccSmrg		os=hpux
16539bd41f2cSmrg		;;
16549bd41f2cSmrg	*-hitachi)
1655084f91ccSmrg		os=hiux
16569bd41f2cSmrg		;;
16579bd41f2cSmrg	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1658084f91ccSmrg		os=sysv
16599bd41f2cSmrg		;;
16609bd41f2cSmrg	*-cbm)
1661084f91ccSmrg		os=amigaos
16629bd41f2cSmrg		;;
16639bd41f2cSmrg	*-dg)
1664084f91ccSmrg		os=dgux
16659bd41f2cSmrg		;;
16669bd41f2cSmrg	*-dolphin)
1667084f91ccSmrg		os=sysv3
16689bd41f2cSmrg		;;
16699bd41f2cSmrg	m68k-ccur)
1670084f91ccSmrg		os=rtu
16719bd41f2cSmrg		;;
16729bd41f2cSmrg	m88k-omron*)
1673084f91ccSmrg		os=luna
16749bd41f2cSmrg		;;
1675084f91ccSmrg	*-next)
1676084f91ccSmrg		os=nextstep
16779bd41f2cSmrg		;;
16789bd41f2cSmrg	*-sequent)
1679084f91ccSmrg		os=ptx
16809bd41f2cSmrg		;;
16819bd41f2cSmrg	*-crds)
1682084f91ccSmrg		os=unos
16839bd41f2cSmrg		;;
16849bd41f2cSmrg	*-ns)
1685084f91ccSmrg		os=genix
16869bd41f2cSmrg		;;
16879bd41f2cSmrg	i370-*)
1688084f91ccSmrg		os=mvs
16899bd41f2cSmrg		;;
16909bd41f2cSmrg	*-gould)
1691084f91ccSmrg		os=sysv
16929bd41f2cSmrg		;;
16939bd41f2cSmrg	*-highlevel)
1694084f91ccSmrg		os=bsd
16959bd41f2cSmrg		;;
16969bd41f2cSmrg	*-encore)
1697084f91ccSmrg		os=bsd
16989bd41f2cSmrg		;;
16999bd41f2cSmrg	*-sgi)
1700084f91ccSmrg		os=irix
17019bd41f2cSmrg		;;
17029bd41f2cSmrg	*-siemens)
1703084f91ccSmrg		os=sysv4
17049bd41f2cSmrg		;;
17059bd41f2cSmrg	*-masscomp)
1706084f91ccSmrg		os=rtu
17079bd41f2cSmrg		;;
17089bd41f2cSmrg	f30[01]-fujitsu | f700-fujitsu)
1709084f91ccSmrg		os=uxpv
17109bd41f2cSmrg		;;
17119bd41f2cSmrg	*-rom68k)
1712084f91ccSmrg		os=coff
17139bd41f2cSmrg		;;
17149bd41f2cSmrg	*-*bug)
1715084f91ccSmrg		os=coff
17169bd41f2cSmrg		;;
17179bd41f2cSmrg	*-apple)
1718084f91ccSmrg		os=macos
17199bd41f2cSmrg		;;
17209bd41f2cSmrg	*-atari*)
1721084f91ccSmrg		os=mint
1722084f91ccSmrg		;;
1723084f91ccSmrg	*-wrs)
1724084f91ccSmrg		os=vxworks
17259bd41f2cSmrg		;;
17269bd41f2cSmrg	*)
1727084f91ccSmrg		os=none
17289bd41f2cSmrg		;;
17299bd41f2cSmrgesac
1730084f91ccSmrg
17319bd41f2cSmrgfi
17329bd41f2cSmrg
1733084f91ccSmrg# Now, validate our (potentially fixed-up) OS.
1734084f91ccSmrgcase $os in
1735084f91ccSmrg	# Sometimes we do "kernel-libc", so those need to count as OSes.
1736084f91ccSmrg	musl* | newlib* | relibc* | uclibc*)
1737084f91ccSmrg		;;
1738084f91ccSmrg	# Likewise for "kernel-abi"
1739084f91ccSmrg	eabi* | gnueabi*)
1740084f91ccSmrg		;;
1741084f91ccSmrg	# VxWorks passes extra cpu info in the 4th filed.
1742084f91ccSmrg	simlinux | simwindows | spe)
1743084f91ccSmrg		;;
1744084f91ccSmrg	# Now accept the basic system types.
1745084f91ccSmrg	# The portable systems comes first.
1746084f91ccSmrg	# Each alternative MUST end in a * to match a version number.
1747084f91ccSmrg	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1748084f91ccSmrg	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1749084f91ccSmrg	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1750084f91ccSmrg	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1751084f91ccSmrg	     | hiux* | abug | nacl* | netware* | windows* \
1752084f91ccSmrg	     | os9* | macos* | osx* | ios* \
1753084f91ccSmrg	     | mpw* | magic* | mmixware* | mon960* | lnews* \
1754084f91ccSmrg	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1755084f91ccSmrg	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
1756084f91ccSmrg	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1757084f91ccSmrg	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1758084f91ccSmrg	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1759084f91ccSmrg	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1760084f91ccSmrg	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1761084f91ccSmrg	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1762084f91ccSmrg	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1763084f91ccSmrg	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
1764084f91ccSmrg	     | chorusrdb* | cegcc* | glidix* | serenity* \
1765084f91ccSmrg	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1766084f91ccSmrg	     | midipix* | mingw32* | mingw64* | mint* \
1767084f91ccSmrg	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1768084f91ccSmrg	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1769084f91ccSmrg	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1770084f91ccSmrg	     | storm-chaos* | tops10* | tenex* | tops20* | its* | irx* \
1771084f91ccSmrg	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1772084f91ccSmrg	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1773084f91ccSmrg	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1774084f91ccSmrg	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1775084f91ccSmrg	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1776084f91ccSmrg	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1777084f91ccSmrg	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1778084f91ccSmrg	     | fiwix* )
1779084f91ccSmrg		;;
1780084f91ccSmrg	# This one is extra strict with allowed versions
1781084f91ccSmrg	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1782084f91ccSmrg		# Don't forget version if it is 3.2v4 or newer.
1783084f91ccSmrg		;;
1784084f91ccSmrg	none)
1785084f91ccSmrg		;;
1786084f91ccSmrg	*)
1787084f91ccSmrg		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1788084f91ccSmrg		exit 1
1789084f91ccSmrg		;;
1790084f91ccSmrgesac
1791084f91ccSmrg
1792084f91ccSmrg# As a final step for OS-related things, validate the OS-kernel combination
1793084f91ccSmrg# (given a valid OS), if there is a kernel.
1794084f91ccSmrgcase $kernel-$os in
1795084f91ccSmrg	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1796084f91ccSmrg		   | linux-musl* | linux-relibc* | linux-uclibc* )
1797084f91ccSmrg		;;
1798084f91ccSmrg	uclinux-uclibc* )
1799084f91ccSmrg		;;
1800084f91ccSmrg	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
1801084f91ccSmrg		# These are just libc implementations, not actual OSes, and thus
1802084f91ccSmrg		# require a kernel.
1803084f91ccSmrg		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1804084f91ccSmrg		exit 1
1805084f91ccSmrg		;;
1806084f91ccSmrg	kfreebsd*-gnu* | kopensolaris*-gnu*)
1807084f91ccSmrg		;;
1808084f91ccSmrg	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1809084f91ccSmrg		;;
1810084f91ccSmrg	nto-qnx*)
1811084f91ccSmrg		;;
1812084f91ccSmrg	os2-emx)
1813084f91ccSmrg		;;
1814084f91ccSmrg	*-eabi* | *-gnueabi*)
1815084f91ccSmrg		;;
1816084f91ccSmrg	-*)
1817084f91ccSmrg		# Blank kernel with real OS is always fine.
1818084f91ccSmrg		;;
1819084f91ccSmrg	*-*)
1820084f91ccSmrg		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1821084f91ccSmrg		exit 1
1822084f91ccSmrg		;;
1823084f91ccSmrgesac
1824084f91ccSmrg
18259bd41f2cSmrg# Here we handle the case where we know the os, and the CPU type, but not the
18269bd41f2cSmrg# manufacturer.  We pick the logical manufacturer.
1827084f91ccSmrgcase $vendor in
1828084f91ccSmrg	unknown)
1829084f91ccSmrg		case $cpu-$os in
1830084f91ccSmrg			*-riscix*)
18319bd41f2cSmrg				vendor=acorn
18329bd41f2cSmrg				;;
1833084f91ccSmrg			*-sunos*)
18349bd41f2cSmrg				vendor=sun
18359bd41f2cSmrg				;;
1836084f91ccSmrg			*-cnk* | *-aix*)
18379bd41f2cSmrg				vendor=ibm
18389bd41f2cSmrg				;;
1839084f91ccSmrg			*-beos*)
18409bd41f2cSmrg				vendor=be
18419bd41f2cSmrg				;;
1842084f91ccSmrg			*-hpux*)
18439bd41f2cSmrg				vendor=hp
18449bd41f2cSmrg				;;
1845084f91ccSmrg			*-mpeix*)
18469bd41f2cSmrg				vendor=hp
18479bd41f2cSmrg				;;
1848084f91ccSmrg			*-hiux*)
18499bd41f2cSmrg				vendor=hitachi
18509bd41f2cSmrg				;;
1851084f91ccSmrg			*-unos*)
18529bd41f2cSmrg				vendor=crds
18539bd41f2cSmrg				;;
1854084f91ccSmrg			*-dgux*)
18559bd41f2cSmrg				vendor=dg
18569bd41f2cSmrg				;;
1857084f91ccSmrg			*-luna*)
18589bd41f2cSmrg				vendor=omron
18599bd41f2cSmrg				;;
1860084f91ccSmrg			*-genix*)
18619bd41f2cSmrg				vendor=ns
18629bd41f2cSmrg				;;
1863084f91ccSmrg			*-clix*)
1864084f91ccSmrg				vendor=intergraph
1865084f91ccSmrg				;;
1866084f91ccSmrg			*-mvs* | *-opened*)
1867084f91ccSmrg				vendor=ibm
1868084f91ccSmrg				;;
1869084f91ccSmrg			*-os400*)
18709bd41f2cSmrg				vendor=ibm
18719bd41f2cSmrg				;;
1872084f91ccSmrg			s390-* | s390x-*)
18739bd41f2cSmrg				vendor=ibm
18749bd41f2cSmrg				;;
1875084f91ccSmrg			*-ptx*)
18769bd41f2cSmrg				vendor=sequent
18779bd41f2cSmrg				;;
1878084f91ccSmrg			*-tpf*)
18799bd41f2cSmrg				vendor=ibm
18809bd41f2cSmrg				;;
1881084f91ccSmrg			*-vxsim* | *-vxworks* | *-windiss*)
18829bd41f2cSmrg				vendor=wrs
18839bd41f2cSmrg				;;
1884084f91ccSmrg			*-aux*)
18859bd41f2cSmrg				vendor=apple
18869bd41f2cSmrg				;;
1887084f91ccSmrg			*-hms*)
18889bd41f2cSmrg				vendor=hitachi
18899bd41f2cSmrg				;;
1890084f91ccSmrg			*-mpw* | *-macos*)
18919bd41f2cSmrg				vendor=apple
18929bd41f2cSmrg				;;
1893084f91ccSmrg			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
18949bd41f2cSmrg				vendor=atari
18959bd41f2cSmrg				;;
1896084f91ccSmrg			*-vos*)
18979bd41f2cSmrg				vendor=stratus
18989bd41f2cSmrg				;;
18999bd41f2cSmrg		esac
19009bd41f2cSmrg		;;
19019bd41f2cSmrgesac
19029bd41f2cSmrg
1903084f91ccSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os"
19049bd41f2cSmrgexit
19059bd41f2cSmrg
19069bd41f2cSmrg# Local variables:
1907084f91ccSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
19089bd41f2cSmrg# time-stamp-start: "timestamp='"
19099bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d"
19109bd41f2cSmrg# time-stamp-end: "'"
19119bd41f2cSmrg# End:
1912