config.sub revision bdc460c5
114c0a534Smrg#! /bin/sh
214c0a534Smrg# Configuration validation subroutine script.
3bdc460c5Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
414c0a534Smrg
5bdc460c5Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6bdc460c5Smrg
7bdc460c5Smrgtimestamp='2021-08-14'
814c0a534Smrg
924047306Smrg# This file is free software; you can redistribute it and/or modify it
1024047306Smrg# under the terms of the GNU General Public License as published by
1124047306Smrg# the Free Software Foundation; either version 3 of the License, or
1214c0a534Smrg# (at your option) any later version.
1314c0a534Smrg#
1424047306Smrg# This program is distributed in the hope that it will be useful, but
1524047306Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1624047306Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1724047306Smrg# General Public License for more details.
1814c0a534Smrg#
1914c0a534Smrg# You should have received a copy of the GNU General Public License
20bdc460c5Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2114c0a534Smrg#
2214c0a534Smrg# As a special exception to the GNU General Public License, if you
2314c0a534Smrg# distribute this file as part of a program that contains a
2414c0a534Smrg# configuration script generated by Autoconf, you may include it under
2524047306Smrg# the same distribution terms that you use for the rest of that
2624047306Smrg# program.  This Exception is an additional permission under section 7
2724047306Smrg# of the GNU General Public License, version 3 ("GPLv3").
2814c0a534Smrg
2914c0a534Smrg
3024047306Smrg# Please send patches to <config-patches@gnu.org>.
3114c0a534Smrg#
3214c0a534Smrg# Configuration subroutine to validate and canonicalize a configuration type.
3314c0a534Smrg# Supply the specified configuration type as an argument.
3414c0a534Smrg# If it is invalid, we print an error message on stderr and exit with code 1.
3514c0a534Smrg# Otherwise, we print the canonical config type on stdout and succeed.
3614c0a534Smrg
37576bae58Smrg# You can get the latest version of this script from:
38bdc460c5Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
39576bae58Smrg
4014c0a534Smrg# This file is supposed to be the same for all GNU packages
4114c0a534Smrg# and recognize all the CPU types, system types and aliases
4214c0a534Smrg# that are meaningful with *any* GNU software.
4314c0a534Smrg# Each package is responsible for reporting which valid configurations
4414c0a534Smrg# it does not support.  The user should be able to distinguish
4514c0a534Smrg# a failure to support a valid configuration from a meaningless
4614c0a534Smrg# configuration.
4714c0a534Smrg
4814c0a534Smrg# The goal of this file is to map all the various variations of a given
4914c0a534Smrg# machine specification into a single specification in the form:
5014c0a534Smrg#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
5114c0a534Smrg# or in some cases, the newer four-part form:
5214c0a534Smrg#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
5314c0a534Smrg# It is wrong to echo any other type of specification.
5414c0a534Smrg
55bdc460c5Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
56bdc460c5Smrg# about features and limitations of the classic Bourne shell that were
57bdc460c5Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
58bdc460c5Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
59bdc460c5Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
60bdc460c5Smrg# have a pre-POSIX /bin/sh.
61bdc460c5Smrg
6214c0a534Smrgme=`echo "$0" | sed -e 's,.*/,,'`
6314c0a534Smrg
6414c0a534Smrgusage="\
65bdc460c5SmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
6614c0a534Smrg
6714c0a534SmrgCanonicalize a configuration name.
6814c0a534Smrg
69bdc460c5SmrgOptions:
7014c0a534Smrg  -h, --help         print this help, then exit
7114c0a534Smrg  -t, --time-stamp   print date of last modification, then exit
7214c0a534Smrg  -v, --version      print version number, then exit
7314c0a534Smrg
7414c0a534SmrgReport bugs and patches to <config-patches@gnu.org>."
7514c0a534Smrg
7614c0a534Smrgversion="\
7714c0a534SmrgGNU config.sub ($timestamp)
7814c0a534Smrg
79bdc460c5SmrgCopyright 1992-2021 Free Software Foundation, Inc.
8014c0a534Smrg
8114c0a534SmrgThis is free software; see the source for copying conditions.  There is NO
8214c0a534Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
8314c0a534Smrg
8414c0a534Smrghelp="
8514c0a534SmrgTry \`$me --help' for more information."
8614c0a534Smrg
8714c0a534Smrg# Parse command line
8814c0a534Smrgwhile test $# -gt 0 ; do
8914c0a534Smrg  case $1 in
9014c0a534Smrg    --time-stamp | --time* | -t )
9114c0a534Smrg       echo "$timestamp" ; exit ;;
9214c0a534Smrg    --version | -v )
9314c0a534Smrg       echo "$version" ; exit ;;
9414c0a534Smrg    --help | --h* | -h )
9514c0a534Smrg       echo "$usage"; exit ;;
9614c0a534Smrg    -- )     # Stop option processing
9714c0a534Smrg       shift; break ;;
9814c0a534Smrg    - )	# Use stdin as input.
9914c0a534Smrg       break ;;
10014c0a534Smrg    -* )
101bdc460c5Smrg       echo "$me: invalid option $1$help" >&2
10214c0a534Smrg       exit 1 ;;
10314c0a534Smrg
10414c0a534Smrg    *local*)
10514c0a534Smrg       # First pass through any local machine types.
106bdc460c5Smrg       echo "$1"
10714c0a534Smrg       exit ;;
10814c0a534Smrg
10914c0a534Smrg    * )
11014c0a534Smrg       break ;;
11114c0a534Smrg  esac
11214c0a534Smrgdone
11314c0a534Smrg
11414c0a534Smrgcase $# in
11514c0a534Smrg 0) echo "$me: missing argument$help" >&2
11614c0a534Smrg    exit 1;;
11714c0a534Smrg 1) ;;
11814c0a534Smrg *) echo "$me: too many arguments$help" >&2
11914c0a534Smrg    exit 1;;
12014c0a534Smrgesac
12114c0a534Smrg
122bdc460c5Smrg# Split fields of configuration type
123bdc460c5Smrg# shellcheck disable=SC2162
124bdc460c5Smrgsaved_IFS=$IFS
125bdc460c5SmrgIFS="-" read field1 field2 field3 field4 <<EOF
126bdc460c5Smrg$1
127bdc460c5SmrgEOF
128bdc460c5SmrgIFS=$saved_IFS
12914c0a534Smrg
130bdc460c5Smrg# Separate into logical components for further validation
131bdc460c5Smrgcase $1 in
132bdc460c5Smrg	*-*-*-*-*)
133bdc460c5Smrg		echo Invalid configuration \`"$1"\': more than four components >&2
134bdc460c5Smrg		exit 1
13514c0a534Smrg		;;
136bdc460c5Smrg	*-*-*-*)
137bdc460c5Smrg		basic_machine=$field1-$field2
138bdc460c5Smrg		basic_os=$field3-$field4
13914c0a534Smrg		;;
140bdc460c5Smrg	*-*-*)
141bdc460c5Smrg		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
142bdc460c5Smrg		# parts
143bdc460c5Smrg		maybe_os=$field2-$field3
144bdc460c5Smrg		case $maybe_os in
145bdc460c5Smrg			nto-qnx* | linux-* | uclinux-uclibc* \
146bdc460c5Smrg			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
147bdc460c5Smrg			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
148bdc460c5Smrg			| storm-chaos* | os2-emx* | rtmk-nova*)
149bdc460c5Smrg				basic_machine=$field1
150bdc460c5Smrg				basic_os=$maybe_os
151bdc460c5Smrg				;;
152bdc460c5Smrg			android-linux)
153bdc460c5Smrg				basic_machine=$field1-unknown
154bdc460c5Smrg				basic_os=linux-android
155bdc460c5Smrg				;;
156bdc460c5Smrg			*)
157bdc460c5Smrg				basic_machine=$field1-$field2
158bdc460c5Smrg				basic_os=$field3
159bdc460c5Smrg				;;
160bdc460c5Smrg		esac
16114c0a534Smrg		;;
162bdc460c5Smrg	*-*)
163bdc460c5Smrg		# A lone config we happen to match not fitting any pattern
164bdc460c5Smrg		case $field1-$field2 in
165bdc460c5Smrg			decstation-3100)
166bdc460c5Smrg				basic_machine=mips-dec
167bdc460c5Smrg				basic_os=
168bdc460c5Smrg				;;
169bdc460c5Smrg			*-*)
170bdc460c5Smrg				# Second component is usually, but not always the OS
171bdc460c5Smrg				case $field2 in
172bdc460c5Smrg					# Prevent following clause from handling this valid os
173bdc460c5Smrg					sun*os*)
174bdc460c5Smrg						basic_machine=$field1
175bdc460c5Smrg						basic_os=$field2
176bdc460c5Smrg						;;
177bdc460c5Smrg					zephyr*)
178bdc460c5Smrg						basic_machine=$field1-unknown
179bdc460c5Smrg						basic_os=$field2
180bdc460c5Smrg						;;
181bdc460c5Smrg					# Manufacturers
182bdc460c5Smrg					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
183bdc460c5Smrg					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
184bdc460c5Smrg					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
185bdc460c5Smrg					| convergent* | ncr* | news | 32* | 3600* | 3100* \
186bdc460c5Smrg					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
187bdc460c5Smrg					| ultra | tti* | harris | dolphin | highlevel | gould \
188bdc460c5Smrg					| cbm | ns | masscomp | apple | axis | knuth | cray \
189bdc460c5Smrg					| microblaze* | sim | cisco \
190bdc460c5Smrg					| oki | wec | wrs | winbond)
191bdc460c5Smrg						basic_machine=$field1-$field2
192bdc460c5Smrg						basic_os=
193bdc460c5Smrg						;;
194bdc460c5Smrg					*)
195bdc460c5Smrg						basic_machine=$field1
196bdc460c5Smrg						basic_os=$field2
197bdc460c5Smrg						;;
198bdc460c5Smrg				esac
199bdc460c5Smrg			;;
200bdc460c5Smrg		esac
20114c0a534Smrg		;;
202bdc460c5Smrg	*)
203bdc460c5Smrg		# Convert single-component short-hands not valid as part of
204bdc460c5Smrg		# multi-component configurations.
205bdc460c5Smrg		case $field1 in
206bdc460c5Smrg			386bsd)
207bdc460c5Smrg				basic_machine=i386-pc
208bdc460c5Smrg				basic_os=bsd
209bdc460c5Smrg				;;
210bdc460c5Smrg			a29khif)
211bdc460c5Smrg				basic_machine=a29k-amd
212bdc460c5Smrg				basic_os=udi
213bdc460c5Smrg				;;
214bdc460c5Smrg			adobe68k)
215bdc460c5Smrg				basic_machine=m68010-adobe
216bdc460c5Smrg				basic_os=scout
217bdc460c5Smrg				;;
218bdc460c5Smrg			alliant)
219bdc460c5Smrg				basic_machine=fx80-alliant
220bdc460c5Smrg				basic_os=
221bdc460c5Smrg				;;
222bdc460c5Smrg			altos | altos3068)
223bdc460c5Smrg				basic_machine=m68k-altos
224bdc460c5Smrg				basic_os=
225bdc460c5Smrg				;;
226bdc460c5Smrg			am29k)
227bdc460c5Smrg				basic_machine=a29k-none
228bdc460c5Smrg				basic_os=bsd
229bdc460c5Smrg				;;
230bdc460c5Smrg			amdahl)
231bdc460c5Smrg				basic_machine=580-amdahl
232bdc460c5Smrg				basic_os=sysv
233bdc460c5Smrg				;;
234bdc460c5Smrg			amiga)
235bdc460c5Smrg				basic_machine=m68k-unknown
236bdc460c5Smrg				basic_os=
237bdc460c5Smrg				;;
238bdc460c5Smrg			amigaos | amigados)
239bdc460c5Smrg				basic_machine=m68k-unknown
240bdc460c5Smrg				basic_os=amigaos
241bdc460c5Smrg				;;
242bdc460c5Smrg			amigaunix | amix)
243bdc460c5Smrg				basic_machine=m68k-unknown
244bdc460c5Smrg				basic_os=sysv4
245bdc460c5Smrg				;;
246bdc460c5Smrg			apollo68)
247bdc460c5Smrg				basic_machine=m68k-apollo
248bdc460c5Smrg				basic_os=sysv
249bdc460c5Smrg				;;
250bdc460c5Smrg			apollo68bsd)
251bdc460c5Smrg				basic_machine=m68k-apollo
252bdc460c5Smrg				basic_os=bsd
253bdc460c5Smrg				;;
254bdc460c5Smrg			aros)
255bdc460c5Smrg				basic_machine=i386-pc
256bdc460c5Smrg				basic_os=aros
257bdc460c5Smrg				;;
258bdc460c5Smrg			aux)
259bdc460c5Smrg				basic_machine=m68k-apple
260bdc460c5Smrg				basic_os=aux
261bdc460c5Smrg				;;
262bdc460c5Smrg			balance)
263bdc460c5Smrg				basic_machine=ns32k-sequent
264bdc460c5Smrg				basic_os=dynix
265bdc460c5Smrg				;;
266bdc460c5Smrg			blackfin)
267bdc460c5Smrg				basic_machine=bfin-unknown
268bdc460c5Smrg				basic_os=linux
269bdc460c5Smrg				;;
270bdc460c5Smrg			cegcc)
271bdc460c5Smrg				basic_machine=arm-unknown
272bdc460c5Smrg				basic_os=cegcc
273bdc460c5Smrg				;;
274bdc460c5Smrg			convex-c1)
275bdc460c5Smrg				basic_machine=c1-convex
276bdc460c5Smrg				basic_os=bsd
277bdc460c5Smrg				;;
278bdc460c5Smrg			convex-c2)
279bdc460c5Smrg				basic_machine=c2-convex
280bdc460c5Smrg				basic_os=bsd
281bdc460c5Smrg				;;
282bdc460c5Smrg			convex-c32)
283bdc460c5Smrg				basic_machine=c32-convex
284bdc460c5Smrg				basic_os=bsd
285bdc460c5Smrg				;;
286bdc460c5Smrg			convex-c34)
287bdc460c5Smrg				basic_machine=c34-convex
288bdc460c5Smrg				basic_os=bsd
289bdc460c5Smrg				;;
290bdc460c5Smrg			convex-c38)
291bdc460c5Smrg				basic_machine=c38-convex
292bdc460c5Smrg				basic_os=bsd
293bdc460c5Smrg				;;
294bdc460c5Smrg			cray)
295bdc460c5Smrg				basic_machine=j90-cray
296bdc460c5Smrg				basic_os=unicos
297bdc460c5Smrg				;;
298bdc460c5Smrg			crds | unos)
299bdc460c5Smrg				basic_machine=m68k-crds
300bdc460c5Smrg				basic_os=
301bdc460c5Smrg				;;
302bdc460c5Smrg			da30)
303bdc460c5Smrg				basic_machine=m68k-da30
304bdc460c5Smrg				basic_os=
305bdc460c5Smrg				;;
306bdc460c5Smrg			decstation | pmax | pmin | dec3100 | decstatn)
307bdc460c5Smrg				basic_machine=mips-dec
308bdc460c5Smrg				basic_os=
309bdc460c5Smrg				;;
310bdc460c5Smrg			delta88)
311bdc460c5Smrg				basic_machine=m88k-motorola
312bdc460c5Smrg				basic_os=sysv3
313bdc460c5Smrg				;;
314bdc460c5Smrg			dicos)
315bdc460c5Smrg				basic_machine=i686-pc
316bdc460c5Smrg				basic_os=dicos
317bdc460c5Smrg				;;
318bdc460c5Smrg			djgpp)
319bdc460c5Smrg				basic_machine=i586-pc
320bdc460c5Smrg				basic_os=msdosdjgpp
321bdc460c5Smrg				;;
322bdc460c5Smrg			ebmon29k)
323bdc460c5Smrg				basic_machine=a29k-amd
324bdc460c5Smrg				basic_os=ebmon
325bdc460c5Smrg				;;
326bdc460c5Smrg			es1800 | OSE68k | ose68k | ose | OSE)
327bdc460c5Smrg				basic_machine=m68k-ericsson
328bdc460c5Smrg				basic_os=ose
329bdc460c5Smrg				;;
330bdc460c5Smrg			gmicro)
331bdc460c5Smrg				basic_machine=tron-gmicro
332bdc460c5Smrg				basic_os=sysv
333bdc460c5Smrg				;;
334bdc460c5Smrg			go32)
335bdc460c5Smrg				basic_machine=i386-pc
336bdc460c5Smrg				basic_os=go32
337bdc460c5Smrg				;;
338bdc460c5Smrg			h8300hms)
339bdc460c5Smrg				basic_machine=h8300-hitachi
340bdc460c5Smrg				basic_os=hms
341bdc460c5Smrg				;;
342bdc460c5Smrg			h8300xray)
343bdc460c5Smrg				basic_machine=h8300-hitachi
344bdc460c5Smrg				basic_os=xray
345bdc460c5Smrg				;;
346bdc460c5Smrg			h8500hms)
347bdc460c5Smrg				basic_machine=h8500-hitachi
348bdc460c5Smrg				basic_os=hms
349bdc460c5Smrg				;;
350bdc460c5Smrg			harris)
351bdc460c5Smrg				basic_machine=m88k-harris
352bdc460c5Smrg				basic_os=sysv3
353bdc460c5Smrg				;;
354bdc460c5Smrg			hp300 | hp300hpux)
355bdc460c5Smrg				basic_machine=m68k-hp
356bdc460c5Smrg				basic_os=hpux
357bdc460c5Smrg				;;
358bdc460c5Smrg			hp300bsd)
359bdc460c5Smrg				basic_machine=m68k-hp
360bdc460c5Smrg				basic_os=bsd
361bdc460c5Smrg				;;
362bdc460c5Smrg			hppaosf)
363bdc460c5Smrg				basic_machine=hppa1.1-hp
364bdc460c5Smrg				basic_os=osf
365bdc460c5Smrg				;;
366bdc460c5Smrg			hppro)
367bdc460c5Smrg				basic_machine=hppa1.1-hp
368bdc460c5Smrg				basic_os=proelf
369bdc460c5Smrg				;;
370bdc460c5Smrg			i386mach)
371bdc460c5Smrg				basic_machine=i386-mach
372bdc460c5Smrg				basic_os=mach
373bdc460c5Smrg				;;
374bdc460c5Smrg			isi68 | isi)
375bdc460c5Smrg				basic_machine=m68k-isi
376bdc460c5Smrg				basic_os=sysv
377bdc460c5Smrg				;;
378bdc460c5Smrg			m68knommu)
379bdc460c5Smrg				basic_machine=m68k-unknown
380bdc460c5Smrg				basic_os=linux
381bdc460c5Smrg				;;
382bdc460c5Smrg			magnum | m3230)
383bdc460c5Smrg				basic_machine=mips-mips
384bdc460c5Smrg				basic_os=sysv
385bdc460c5Smrg				;;
386bdc460c5Smrg			merlin)
387bdc460c5Smrg				basic_machine=ns32k-utek
388bdc460c5Smrg				basic_os=sysv
389bdc460c5Smrg				;;
390bdc460c5Smrg			mingw64)
391bdc460c5Smrg				basic_machine=x86_64-pc
392bdc460c5Smrg				basic_os=mingw64
393bdc460c5Smrg				;;
394bdc460c5Smrg			mingw32)
395bdc460c5Smrg				basic_machine=i686-pc
396bdc460c5Smrg				basic_os=mingw32
397bdc460c5Smrg				;;
398bdc460c5Smrg			mingw32ce)
399bdc460c5Smrg				basic_machine=arm-unknown
400bdc460c5Smrg				basic_os=mingw32ce
401bdc460c5Smrg				;;
402bdc460c5Smrg			monitor)
403bdc460c5Smrg				basic_machine=m68k-rom68k
404bdc460c5Smrg				basic_os=coff
405bdc460c5Smrg				;;
406bdc460c5Smrg			morphos)
407bdc460c5Smrg				basic_machine=powerpc-unknown
408bdc460c5Smrg				basic_os=morphos
409bdc460c5Smrg				;;
410bdc460c5Smrg			moxiebox)
411bdc460c5Smrg				basic_machine=moxie-unknown
412bdc460c5Smrg				basic_os=moxiebox
413bdc460c5Smrg				;;
414bdc460c5Smrg			msdos)
415bdc460c5Smrg				basic_machine=i386-pc
416bdc460c5Smrg				basic_os=msdos
417bdc460c5Smrg				;;
418bdc460c5Smrg			msys)
419bdc460c5Smrg				basic_machine=i686-pc
420bdc460c5Smrg				basic_os=msys
421bdc460c5Smrg				;;
422bdc460c5Smrg			mvs)
423bdc460c5Smrg				basic_machine=i370-ibm
424bdc460c5Smrg				basic_os=mvs
425bdc460c5Smrg				;;
426bdc460c5Smrg			nacl)
427bdc460c5Smrg				basic_machine=le32-unknown
428bdc460c5Smrg				basic_os=nacl
429bdc460c5Smrg				;;
430bdc460c5Smrg			ncr3000)
431bdc460c5Smrg				basic_machine=i486-ncr
432bdc460c5Smrg				basic_os=sysv4
433bdc460c5Smrg				;;
434bdc460c5Smrg			netbsd386)
435bdc460c5Smrg				basic_machine=i386-pc
436bdc460c5Smrg				basic_os=netbsd
437bdc460c5Smrg				;;
438bdc460c5Smrg			netwinder)
439bdc460c5Smrg				basic_machine=armv4l-rebel
440bdc460c5Smrg				basic_os=linux
441bdc460c5Smrg				;;
442bdc460c5Smrg			news | news700 | news800 | news900)
443bdc460c5Smrg				basic_machine=m68k-sony
444bdc460c5Smrg				basic_os=newsos
445bdc460c5Smrg				;;
446bdc460c5Smrg			news1000)
447bdc460c5Smrg				basic_machine=m68030-sony
448bdc460c5Smrg				basic_os=newsos
449bdc460c5Smrg				;;
450bdc460c5Smrg			necv70)
451bdc460c5Smrg				basic_machine=v70-nec
452bdc460c5Smrg				basic_os=sysv
453bdc460c5Smrg				;;
454bdc460c5Smrg			nh3000)
455bdc460c5Smrg				basic_machine=m68k-harris
456bdc460c5Smrg				basic_os=cxux
457bdc460c5Smrg				;;
458bdc460c5Smrg			nh[45]000)
459bdc460c5Smrg				basic_machine=m88k-harris
460bdc460c5Smrg				basic_os=cxux
461bdc460c5Smrg				;;
462bdc460c5Smrg			nindy960)
463bdc460c5Smrg				basic_machine=i960-intel
464bdc460c5Smrg				basic_os=nindy
465bdc460c5Smrg				;;
466bdc460c5Smrg			mon960)
467bdc460c5Smrg				basic_machine=i960-intel
468bdc460c5Smrg				basic_os=mon960
469bdc460c5Smrg				;;
470bdc460c5Smrg			nonstopux)
471bdc460c5Smrg				basic_machine=mips-compaq
472bdc460c5Smrg				basic_os=nonstopux
473bdc460c5Smrg				;;
474bdc460c5Smrg			os400)
475bdc460c5Smrg				basic_machine=powerpc-ibm
476bdc460c5Smrg				basic_os=os400
477bdc460c5Smrg				;;
478bdc460c5Smrg			OSE68000 | ose68000)
479bdc460c5Smrg				basic_machine=m68000-ericsson
480bdc460c5Smrg				basic_os=ose
481bdc460c5Smrg				;;
482bdc460c5Smrg			os68k)
483bdc460c5Smrg				basic_machine=m68k-none
484bdc460c5Smrg				basic_os=os68k
485bdc460c5Smrg				;;
486bdc460c5Smrg			paragon)
487bdc460c5Smrg				basic_machine=i860-intel
488bdc460c5Smrg				basic_os=osf
489bdc460c5Smrg				;;
490bdc460c5Smrg			parisc)
491bdc460c5Smrg				basic_machine=hppa-unknown
492bdc460c5Smrg				basic_os=linux
493bdc460c5Smrg				;;
494bdc460c5Smrg			psp)
495bdc460c5Smrg				basic_machine=mipsallegrexel-sony
496bdc460c5Smrg				basic_os=psp
497bdc460c5Smrg				;;
498bdc460c5Smrg			pw32)
499bdc460c5Smrg				basic_machine=i586-unknown
500bdc460c5Smrg				basic_os=pw32
501bdc460c5Smrg				;;
502bdc460c5Smrg			rdos | rdos64)
503bdc460c5Smrg				basic_machine=x86_64-pc
504bdc460c5Smrg				basic_os=rdos
505bdc460c5Smrg				;;
506bdc460c5Smrg			rdos32)
507bdc460c5Smrg				basic_machine=i386-pc
508bdc460c5Smrg				basic_os=rdos
509bdc460c5Smrg				;;
510bdc460c5Smrg			rom68k)
511bdc460c5Smrg				basic_machine=m68k-rom68k
512bdc460c5Smrg				basic_os=coff
513bdc460c5Smrg				;;
514bdc460c5Smrg			sa29200)
515bdc460c5Smrg				basic_machine=a29k-amd
516bdc460c5Smrg				basic_os=udi
517bdc460c5Smrg				;;
518bdc460c5Smrg			sei)
519bdc460c5Smrg				basic_machine=mips-sei
520bdc460c5Smrg				basic_os=seiux
521bdc460c5Smrg				;;
522bdc460c5Smrg			sequent)
523bdc460c5Smrg				basic_machine=i386-sequent
524bdc460c5Smrg				basic_os=
525bdc460c5Smrg				;;
526bdc460c5Smrg			sps7)
527bdc460c5Smrg				basic_machine=m68k-bull
528bdc460c5Smrg				basic_os=sysv2
529bdc460c5Smrg				;;
530bdc460c5Smrg			st2000)
531bdc460c5Smrg				basic_machine=m68k-tandem
532bdc460c5Smrg				basic_os=
533bdc460c5Smrg				;;
534bdc460c5Smrg			stratus)
535bdc460c5Smrg				basic_machine=i860-stratus
536bdc460c5Smrg				basic_os=sysv4
537bdc460c5Smrg				;;
538bdc460c5Smrg			sun2)
539bdc460c5Smrg				basic_machine=m68000-sun
540bdc460c5Smrg				basic_os=
541bdc460c5Smrg				;;
542bdc460c5Smrg			sun2os3)
543bdc460c5Smrg				basic_machine=m68000-sun
544bdc460c5Smrg				basic_os=sunos3
545bdc460c5Smrg				;;
546bdc460c5Smrg			sun2os4)
547bdc460c5Smrg				basic_machine=m68000-sun
548bdc460c5Smrg				basic_os=sunos4
549bdc460c5Smrg				;;
550bdc460c5Smrg			sun3)
551bdc460c5Smrg				basic_machine=m68k-sun
552bdc460c5Smrg				basic_os=
553bdc460c5Smrg				;;
554bdc460c5Smrg			sun3os3)
555bdc460c5Smrg				basic_machine=m68k-sun
556bdc460c5Smrg				basic_os=sunos3
557bdc460c5Smrg				;;
558bdc460c5Smrg			sun3os4)
559bdc460c5Smrg				basic_machine=m68k-sun
560bdc460c5Smrg				basic_os=sunos4
561bdc460c5Smrg				;;
562bdc460c5Smrg			sun4)
563bdc460c5Smrg				basic_machine=sparc-sun
564bdc460c5Smrg				basic_os=
565bdc460c5Smrg				;;
566bdc460c5Smrg			sun4os3)
567bdc460c5Smrg				basic_machine=sparc-sun
568bdc460c5Smrg				basic_os=sunos3
569bdc460c5Smrg				;;
570bdc460c5Smrg			sun4os4)
571bdc460c5Smrg				basic_machine=sparc-sun
572bdc460c5Smrg				basic_os=sunos4
573bdc460c5Smrg				;;
574bdc460c5Smrg			sun4sol2)
575bdc460c5Smrg				basic_machine=sparc-sun
576bdc460c5Smrg				basic_os=solaris2
577bdc460c5Smrg				;;
578bdc460c5Smrg			sun386 | sun386i | roadrunner)
579bdc460c5Smrg				basic_machine=i386-sun
580bdc460c5Smrg				basic_os=
581bdc460c5Smrg				;;
582bdc460c5Smrg			sv1)
583bdc460c5Smrg				basic_machine=sv1-cray
584bdc460c5Smrg				basic_os=unicos
585bdc460c5Smrg				;;
586bdc460c5Smrg			symmetry)
587bdc460c5Smrg				basic_machine=i386-sequent
588bdc460c5Smrg				basic_os=dynix
589bdc460c5Smrg				;;
590bdc460c5Smrg			t3e)
591bdc460c5Smrg				basic_machine=alphaev5-cray
592bdc460c5Smrg				basic_os=unicos
593bdc460c5Smrg				;;
594bdc460c5Smrg			t90)
595bdc460c5Smrg				basic_machine=t90-cray
596bdc460c5Smrg				basic_os=unicos
597bdc460c5Smrg				;;
598bdc460c5Smrg			toad1)
599bdc460c5Smrg				basic_machine=pdp10-xkl
600bdc460c5Smrg				basic_os=tops20
601bdc460c5Smrg				;;
602bdc460c5Smrg			tpf)
603bdc460c5Smrg				basic_machine=s390x-ibm
604bdc460c5Smrg				basic_os=tpf
605bdc460c5Smrg				;;
606bdc460c5Smrg			udi29k)
607bdc460c5Smrg				basic_machine=a29k-amd
608bdc460c5Smrg				basic_os=udi
609bdc460c5Smrg				;;
610bdc460c5Smrg			ultra3)
611bdc460c5Smrg				basic_machine=a29k-nyu
612bdc460c5Smrg				basic_os=sym1
613bdc460c5Smrg				;;
614bdc460c5Smrg			v810 | necv810)
615bdc460c5Smrg				basic_machine=v810-nec
616bdc460c5Smrg				basic_os=none
617bdc460c5Smrg				;;
618bdc460c5Smrg			vaxv)
619bdc460c5Smrg				basic_machine=vax-dec
620bdc460c5Smrg				basic_os=sysv
621bdc460c5Smrg				;;
622bdc460c5Smrg			vms)
623bdc460c5Smrg				basic_machine=vax-dec
624bdc460c5Smrg				basic_os=vms
625bdc460c5Smrg				;;
626bdc460c5Smrg			vsta)
627bdc460c5Smrg				basic_machine=i386-pc
628bdc460c5Smrg				basic_os=vsta
629bdc460c5Smrg				;;
630bdc460c5Smrg			vxworks960)
631bdc460c5Smrg				basic_machine=i960-wrs
632bdc460c5Smrg				basic_os=vxworks
633bdc460c5Smrg				;;
634bdc460c5Smrg			vxworks68)
635bdc460c5Smrg				basic_machine=m68k-wrs
636bdc460c5Smrg				basic_os=vxworks
637bdc460c5Smrg				;;
638bdc460c5Smrg			vxworks29k)
639bdc460c5Smrg				basic_machine=a29k-wrs
640bdc460c5Smrg				basic_os=vxworks
641bdc460c5Smrg				;;
642bdc460c5Smrg			xbox)
643bdc460c5Smrg				basic_machine=i686-pc
644bdc460c5Smrg				basic_os=mingw32
645bdc460c5Smrg				;;
646bdc460c5Smrg			ymp)
647bdc460c5Smrg				basic_machine=ymp-cray
648bdc460c5Smrg				basic_os=unicos
649bdc460c5Smrg				;;
650bdc460c5Smrg			*)
651bdc460c5Smrg				basic_machine=$1
652bdc460c5Smrg				basic_os=
653bdc460c5Smrg				;;
654bdc460c5Smrg		esac
65514c0a534Smrg		;;
65614c0a534Smrgesac
65714c0a534Smrg
658bdc460c5Smrg# Decode 1-component or ad-hoc basic machines
65914c0a534Smrgcase $basic_machine in
660bdc460c5Smrg	# Here we handle the default manufacturer of certain CPU types.  It is in
661bdc460c5Smrg	# some cases the only manufacturer, in others, it is the most popular.
662bdc460c5Smrg	w89k)
663bdc460c5Smrg		cpu=hppa1.1
664bdc460c5Smrg		vendor=winbond
66524047306Smrg		;;
666bdc460c5Smrg	op50n)
667bdc460c5Smrg		cpu=hppa1.1
668bdc460c5Smrg		vendor=oki
66914c0a534Smrg		;;
670bdc460c5Smrg	op60c)
671bdc460c5Smrg		cpu=hppa1.1
672bdc460c5Smrg		vendor=oki
67314c0a534Smrg		;;
674bdc460c5Smrg	ibm*)
675bdc460c5Smrg		cpu=i370
676bdc460c5Smrg		vendor=ibm
677bf2eeab3Smrg		;;
678bdc460c5Smrg	orion105)
679bdc460c5Smrg		cpu=clipper
680bdc460c5Smrg		vendor=highlevel
68124047306Smrg		;;
682bdc460c5Smrg	mac | mpw | mac-mpw)
683bdc460c5Smrg		cpu=m68k
684bdc460c5Smrg		vendor=apple
68524047306Smrg		;;
686bdc460c5Smrg	pmac | pmac-mpw)
687bdc460c5Smrg		cpu=powerpc
688bdc460c5Smrg		vendor=apple
68924047306Smrg		;;
69024047306Smrg
69114c0a534Smrg	# Recognize the various machine names and aliases which stand
69214c0a534Smrg	# for a CPU type and a company and sometimes even an OS.
69314c0a534Smrg	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
694bdc460c5Smrg		cpu=m68000
695bdc460c5Smrg		vendor=att
69614c0a534Smrg		;;
69714c0a534Smrg	3b*)
698bdc460c5Smrg		cpu=we32k
699bdc460c5Smrg		vendor=att
700bf2eeab3Smrg		;;
701576bae58Smrg	bluegene*)
702bdc460c5Smrg		cpu=powerpc
703bdc460c5Smrg		vendor=ibm
704bdc460c5Smrg		basic_os=cnk
70514c0a534Smrg		;;
70614c0a534Smrg	decsystem10* | dec10*)
707bdc460c5Smrg		cpu=pdp10
708bdc460c5Smrg		vendor=dec
709bdc460c5Smrg		basic_os=tops10
71014c0a534Smrg		;;
71114c0a534Smrg	decsystem20* | dec20*)
712bdc460c5Smrg		cpu=pdp10
713bdc460c5Smrg		vendor=dec
714bdc460c5Smrg		basic_os=tops20
71514c0a534Smrg		;;
71614c0a534Smrg	delta | 3300 | motorola-3300 | motorola-delta \
71714c0a534Smrg	      | 3300-motorola | delta-motorola)
718bdc460c5Smrg		cpu=m68k
719bdc460c5Smrg		vendor=motorola
72014c0a534Smrg		;;
721bdc460c5Smrg	dpx2*)
722bdc460c5Smrg		cpu=m68k
723bdc460c5Smrg		vendor=bull
724bdc460c5Smrg		basic_os=sysv3
72514c0a534Smrg		;;
72614c0a534Smrg	encore | umax | mmax)
727bdc460c5Smrg		cpu=ns32k
728bdc460c5Smrg		vendor=encore
72914c0a534Smrg		;;
730bdc460c5Smrg	elxsi)
731bdc460c5Smrg		cpu=elxsi
732bdc460c5Smrg		vendor=elxsi
733bdc460c5Smrg		basic_os=${basic_os:-bsd}
73414c0a534Smrg		;;
73514c0a534Smrg	fx2800)
736bdc460c5Smrg		cpu=i860
737bdc460c5Smrg		vendor=alliant
73814c0a534Smrg		;;
73914c0a534Smrg	genix)
740bdc460c5Smrg		cpu=ns32k
741bdc460c5Smrg		vendor=ns
74214c0a534Smrg		;;
74314c0a534Smrg	h3050r* | hiux*)
744bdc460c5Smrg		cpu=hppa1.1
745bdc460c5Smrg		vendor=hitachi
746bdc460c5Smrg		basic_os=hiuxwe2
74714c0a534Smrg		;;
74814c0a534Smrg	hp3k9[0-9][0-9] | hp9[0-9][0-9])
749bdc460c5Smrg		cpu=hppa1.0
750bdc460c5Smrg		vendor=hp
75114c0a534Smrg		;;
75214c0a534Smrg	hp9k2[0-9][0-9] | hp9k31[0-9])
753bdc460c5Smrg		cpu=m68000
754bdc460c5Smrg		vendor=hp
75514c0a534Smrg		;;
75614c0a534Smrg	hp9k3[2-9][0-9])
757bdc460c5Smrg		cpu=m68k
758bdc460c5Smrg		vendor=hp
75914c0a534Smrg		;;
76014c0a534Smrg	hp9k6[0-9][0-9] | hp6[0-9][0-9])
761bdc460c5Smrg		cpu=hppa1.0
762bdc460c5Smrg		vendor=hp
76314c0a534Smrg		;;
76414c0a534Smrg	hp9k7[0-79][0-9] | hp7[0-79][0-9])
765bdc460c5Smrg		cpu=hppa1.1
766bdc460c5Smrg		vendor=hp
76714c0a534Smrg		;;
76814c0a534Smrg	hp9k78[0-9] | hp78[0-9])
76914c0a534Smrg		# FIXME: really hppa2.0-hp
770bdc460c5Smrg		cpu=hppa1.1
771bdc460c5Smrg		vendor=hp
77214c0a534Smrg		;;
77314c0a534Smrg	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
77414c0a534Smrg		# FIXME: really hppa2.0-hp
775bdc460c5Smrg		cpu=hppa1.1
776bdc460c5Smrg		vendor=hp
77714c0a534Smrg		;;
77814c0a534Smrg	hp9k8[0-9][13679] | hp8[0-9][13679])
779bdc460c5Smrg		cpu=hppa1.1
780bdc460c5Smrg		vendor=hp
78114c0a534Smrg		;;
78214c0a534Smrg	hp9k8[0-9][0-9] | hp8[0-9][0-9])
783bdc460c5Smrg		cpu=hppa1.0
784bdc460c5Smrg		vendor=hp
78514c0a534Smrg		;;
78614c0a534Smrg	i*86v32)
787bdc460c5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
788bdc460c5Smrg		vendor=pc
789bdc460c5Smrg		basic_os=sysv32
79014c0a534Smrg		;;
79114c0a534Smrg	i*86v4*)
792bdc460c5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
793bdc460c5Smrg		vendor=pc
794bdc460c5Smrg		basic_os=sysv4
79514c0a534Smrg		;;
79614c0a534Smrg	i*86v)
797bdc460c5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
798bdc460c5Smrg		vendor=pc
799bdc460c5Smrg		basic_os=sysv
80014c0a534Smrg		;;
80114c0a534Smrg	i*86sol2)
802bdc460c5Smrg		cpu=`echo "$1" | sed -e 's/86.*/86/'`
803bdc460c5Smrg		vendor=pc
804bdc460c5Smrg		basic_os=solaris2
80514c0a534Smrg		;;
806bdc460c5Smrg	j90 | j90-cray)
807bdc460c5Smrg		cpu=j90
808bdc460c5Smrg		vendor=cray
809bdc460c5Smrg		basic_os=${basic_os:-unicos}
81014c0a534Smrg		;;
81114c0a534Smrg	iris | iris4d)
812bdc460c5Smrg		cpu=mips
813bdc460c5Smrg		vendor=sgi
814bdc460c5Smrg		case $basic_os in
815bdc460c5Smrg		    irix*)
81614c0a534Smrg			;;
81714c0a534Smrg		    *)
818bdc460c5Smrg			basic_os=irix4
81914c0a534Smrg			;;
82014c0a534Smrg		esac
82114c0a534Smrg		;;
82214c0a534Smrg	miniframe)
823bdc460c5Smrg		cpu=m68000
824bdc460c5Smrg		vendor=convergent
82524047306Smrg		;;
826bdc460c5Smrg	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
827bdc460c5Smrg		cpu=m68k
828bdc460c5Smrg		vendor=atari
829bdc460c5Smrg		basic_os=mint
83014c0a534Smrg		;;
83114c0a534Smrg	news-3600 | risc-news)
832bdc460c5Smrg		cpu=mips
833bdc460c5Smrg		vendor=sony
834bdc460c5Smrg		basic_os=newsos
835bdc460c5Smrg		;;
836bdc460c5Smrg	next | m*-next)
837bdc460c5Smrg		cpu=m68k
838bdc460c5Smrg		vendor=next
839bdc460c5Smrg		case $basic_os in
840bdc460c5Smrg		    openstep*)
841bdc460c5Smrg		        ;;
842bdc460c5Smrg		    nextstep*)
84314c0a534Smrg			;;
844bdc460c5Smrg		    ns2*)
845bdc460c5Smrg		      basic_os=nextstep2
84614c0a534Smrg			;;
84714c0a534Smrg		    *)
848bdc460c5Smrg		      basic_os=nextstep3
84914c0a534Smrg			;;
85014c0a534Smrg		esac
85114c0a534Smrg		;;
85214c0a534Smrg	np1)
853bdc460c5Smrg		cpu=np1
854bdc460c5Smrg		vendor=gould
85514c0a534Smrg		;;
85614c0a534Smrg	op50n-* | op60c-*)
857bdc460c5Smrg		cpu=hppa1.1
858bdc460c5Smrg		vendor=oki
859bdc460c5Smrg		basic_os=proelf
86014c0a534Smrg		;;
86114c0a534Smrg	pa-hitachi)
862bdc460c5Smrg		cpu=hppa1.1
863bdc460c5Smrg		vendor=hitachi
864bdc460c5Smrg		basic_os=hiuxwe2
865bf2eeab3Smrg		;;
86614c0a534Smrg	pbd)
867bdc460c5Smrg		cpu=sparc
868bdc460c5Smrg		vendor=tti
86914c0a534Smrg		;;
87014c0a534Smrg	pbb)
871bdc460c5Smrg		cpu=m68k
872bdc460c5Smrg		vendor=tti
873bf2eeab3Smrg		;;
874bdc460c5Smrg	pc532)
875bdc460c5Smrg		cpu=ns32k
876bdc460c5Smrg		vendor=pc532
87714c0a534Smrg		;;
87814c0a534Smrg	pn)
879bdc460c5Smrg		cpu=pn
880bdc460c5Smrg		vendor=gould
88114c0a534Smrg		;;
882bdc460c5Smrg	power)
883bdc460c5Smrg		cpu=power
884bdc460c5Smrg		vendor=ibm
88514c0a534Smrg		;;
88614c0a534Smrg	ps2)
887bdc460c5Smrg		cpu=i386
888bdc460c5Smrg		vendor=ibm
88914c0a534Smrg		;;
89014c0a534Smrg	rm[46]00)
891bdc460c5Smrg		cpu=mips
892bdc460c5Smrg		vendor=siemens
89314c0a534Smrg		;;
89414c0a534Smrg	rtpc | rtpc-*)
895bdc460c5Smrg		cpu=romp
896bdc460c5Smrg		vendor=ibm
89714c0a534Smrg		;;
898bdc460c5Smrg	sde)
899bdc460c5Smrg		cpu=mipsisa32
900bdc460c5Smrg		vendor=sde
901bdc460c5Smrg		basic_os=${basic_os:-elf}
90214c0a534Smrg		;;
903bdc460c5Smrg	simso-wrs)
904bdc460c5Smrg		cpu=sparclite
905bdc460c5Smrg		vendor=wrs
906bdc460c5Smrg		basic_os=vxworks
90714c0a534Smrg		;;
908bdc460c5Smrg	tower | tower-32)
909bdc460c5Smrg		cpu=m68k
910bdc460c5Smrg		vendor=ncr
911bf2eeab3Smrg		;;
912bdc460c5Smrg	vpp*|vx|vx-*)
913bdc460c5Smrg		cpu=f301
914bdc460c5Smrg		vendor=fujitsu
91514c0a534Smrg		;;
916bdc460c5Smrg	w65)
917bdc460c5Smrg		cpu=w65
918bdc460c5Smrg		vendor=wdc
91914c0a534Smrg		;;
920bdc460c5Smrg	w89k-*)
921bdc460c5Smrg		cpu=hppa1.1
922bdc460c5Smrg		vendor=winbond
923bdc460c5Smrg		basic_os=proelf
92414c0a534Smrg		;;
925bdc460c5Smrg	none)
926bdc460c5Smrg		cpu=none
927bdc460c5Smrg		vendor=none
928bf2eeab3Smrg		;;
929bdc460c5Smrg	leon|leon[3-9])
930bdc460c5Smrg		cpu=sparc
931bdc460c5Smrg		vendor=$basic_machine
93214c0a534Smrg		;;
933bdc460c5Smrg	leon-*|leon[3-9]-*)
934bdc460c5Smrg		cpu=sparc
935bdc460c5Smrg		vendor=`echo "$basic_machine" | sed 's/-.*//'`
93614c0a534Smrg		;;
937bdc460c5Smrg
938bdc460c5Smrg	*-*)
939bdc460c5Smrg		# shellcheck disable=SC2162
940bdc460c5Smrg		saved_IFS=$IFS
941bdc460c5Smrg		IFS="-" read cpu vendor <<EOF
942bdc460c5Smrg$basic_machine
943bdc460c5SmrgEOF
944bdc460c5Smrg		IFS=$saved_IFS
94514c0a534Smrg		;;
946bdc460c5Smrg	# We use `pc' rather than `unknown'
947bdc460c5Smrg	# because (1) that's what they normally are, and
948bdc460c5Smrg	# (2) the word "unknown" tends to confuse beginning users.
949bdc460c5Smrg	i*86 | x86_64)
950bdc460c5Smrg		cpu=$basic_machine
951bdc460c5Smrg		vendor=pc
95214c0a534Smrg		;;
953bdc460c5Smrg	# These rules are duplicated from below for sake of the special case above;
954bdc460c5Smrg	# i.e. things that normalized to x86 arches should also default to "pc"
955bdc460c5Smrg	pc98)
956bdc460c5Smrg		cpu=i386
957bdc460c5Smrg		vendor=pc
95814c0a534Smrg		;;
959bdc460c5Smrg	x64 | amd64)
960bdc460c5Smrg		cpu=x86_64
961bdc460c5Smrg		vendor=pc
96214c0a534Smrg		;;
963bdc460c5Smrg	# Recognize the basic CPU types without company name.
964bdc460c5Smrg	*)
965bdc460c5Smrg		cpu=$basic_machine
966bdc460c5Smrg		vendor=unknown
96724047306Smrg		;;
968bdc460c5Smrgesac
969bdc460c5Smrg
970bdc460c5Smrgunset -v basic_machine
971bdc460c5Smrg
972bdc460c5Smrg# Decode basic machines in the full and proper CPU-Company form.
973bdc460c5Smrgcase $cpu-$vendor in
974bdc460c5Smrg	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
975bdc460c5Smrg	# some cases the only manufacturer, in others, it is the most popular.
976bdc460c5Smrg	craynv-unknown)
977bdc460c5Smrg		vendor=cray
978bdc460c5Smrg		basic_os=${basic_os:-unicosmp}
97914c0a534Smrg		;;
980bdc460c5Smrg	c90-unknown | c90-cray)
981bdc460c5Smrg		vendor=cray
982bdc460c5Smrg		basic_os=${Basic_os:-unicos}
98314c0a534Smrg		;;
984bdc460c5Smrg	fx80-unknown)
985bdc460c5Smrg		vendor=alliant
98614c0a534Smrg		;;
987bdc460c5Smrg	romp-unknown)
988bdc460c5Smrg		vendor=ibm
98914c0a534Smrg		;;
990bdc460c5Smrg	mmix-unknown)
991bdc460c5Smrg		vendor=knuth
99214c0a534Smrg		;;
993bdc460c5Smrg	microblaze-unknown | microblazeel-unknown)
994bdc460c5Smrg		vendor=xilinx
99514c0a534Smrg		;;
996bdc460c5Smrg	rs6000-unknown)
997bdc460c5Smrg		vendor=ibm
99814c0a534Smrg		;;
999bdc460c5Smrg	vax-unknown)
1000bdc460c5Smrg		vendor=dec
100114c0a534Smrg		;;
1002bdc460c5Smrg	pdp11-unknown)
1003bdc460c5Smrg		vendor=dec
100414c0a534Smrg		;;
1005bdc460c5Smrg	we32k-unknown)
1006bdc460c5Smrg		vendor=att
100714c0a534Smrg		;;
1008bdc460c5Smrg	cydra-unknown)
1009bdc460c5Smrg		vendor=cydrome
101014c0a534Smrg		;;
1011bdc460c5Smrg	i370-ibm*)
1012bdc460c5Smrg		vendor=ibm
101314c0a534Smrg		;;
1014bdc460c5Smrg	orion-unknown)
1015bdc460c5Smrg		vendor=highlevel
101614c0a534Smrg		;;
1017bdc460c5Smrg	xps-unknown | xps100-unknown)
1018bdc460c5Smrg		cpu=xps100
1019bdc460c5Smrg		vendor=honeywell
102014c0a534Smrg		;;
1021bdc460c5Smrg
1022bdc460c5Smrg	# Here we normalize CPU types with a missing or matching vendor
1023bdc460c5Smrg	dpx20-unknown | dpx20-bull)
1024bdc460c5Smrg		cpu=rs6000
1025bdc460c5Smrg		vendor=bull
1026bdc460c5Smrg		basic_os=${basic_os:-bosx}
102714c0a534Smrg		;;
1028bdc460c5Smrg
1029bdc460c5Smrg	# Here we normalize CPU types irrespective of the vendor
1030bdc460c5Smrg	amd64-*)
1031bdc460c5Smrg		cpu=x86_64
1032bf2eeab3Smrg		;;
1033bdc460c5Smrg	blackfin-*)
1034bdc460c5Smrg		cpu=bfin
1035bdc460c5Smrg		basic_os=linux
103614c0a534Smrg		;;
1037bdc460c5Smrg	c54x-*)
1038bdc460c5Smrg		cpu=tic54x
103914c0a534Smrg		;;
1040bdc460c5Smrg	c55x-*)
1041bdc460c5Smrg		cpu=tic55x
104214c0a534Smrg		;;
1043bdc460c5Smrg	c6x-*)
1044bdc460c5Smrg		cpu=tic6x
104514c0a534Smrg		;;
1046bdc460c5Smrg	e500v[12]-*)
1047bdc460c5Smrg		cpu=powerpc
1048bdc460c5Smrg		basic_os=${basic_os}"spe"
104914c0a534Smrg		;;
1050bdc460c5Smrg	mips3*-*)
1051bdc460c5Smrg		cpu=mips64
105214c0a534Smrg		;;
1053bdc460c5Smrg	ms1-*)
1054bdc460c5Smrg		cpu=mt
105514c0a534Smrg		;;
1056bdc460c5Smrg	m68knommu-*)
1057bdc460c5Smrg		cpu=m68k
1058bdc460c5Smrg		basic_os=linux
105914c0a534Smrg		;;
1060bdc460c5Smrg	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1061bdc460c5Smrg		cpu=s12z
106214c0a534Smrg		;;
1063bdc460c5Smrg	openrisc-*)
1064bdc460c5Smrg		cpu=or32
106514c0a534Smrg		;;
1066bdc460c5Smrg	parisc-*)
1067bdc460c5Smrg		cpu=hppa
1068bdc460c5Smrg		basic_os=linux
106914c0a534Smrg		;;
1070bdc460c5Smrg	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1071bdc460c5Smrg		cpu=i586
107214c0a534Smrg		;;
1073bdc460c5Smrg	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1074bdc460c5Smrg		cpu=i686
107514c0a534Smrg		;;
1076bdc460c5Smrg	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1077bdc460c5Smrg		cpu=i686
107814c0a534Smrg		;;
1079bdc460c5Smrg	pentium4-*)
1080bdc460c5Smrg		cpu=i786
108114c0a534Smrg		;;
1082bdc460c5Smrg	pc98-*)
1083bdc460c5Smrg		cpu=i386
108414c0a534Smrg		;;
1085bdc460c5Smrg	ppc-* | ppcbe-*)
1086bdc460c5Smrg		cpu=powerpc
108714c0a534Smrg		;;
1088bdc460c5Smrg	ppcle-* | powerpclittle-*)
1089bdc460c5Smrg		cpu=powerpcle
109014c0a534Smrg		;;
1091bdc460c5Smrg	ppc64-*)
1092bdc460c5Smrg		cpu=powerpc64
109324047306Smrg		;;
1094bdc460c5Smrg	ppc64le-* | powerpc64little-*)
1095bdc460c5Smrg		cpu=powerpc64le
109614c0a534Smrg		;;
1097bdc460c5Smrg	sb1-*)
1098bdc460c5Smrg		cpu=mipsisa64sb1
109914c0a534Smrg		;;
1100bdc460c5Smrg	sb1el-*)
1101bdc460c5Smrg		cpu=mipsisa64sb1el
1102bf2eeab3Smrg		;;
1103bdc460c5Smrg	sh5e[lb]-*)
1104bdc460c5Smrg		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
110514c0a534Smrg		;;
1106bdc460c5Smrg	spur-*)
1107bdc460c5Smrg		cpu=spur
110814c0a534Smrg		;;
1109bdc460c5Smrg	strongarm-* | thumb-*)
1110bdc460c5Smrg		cpu=arm
111114c0a534Smrg		;;
1112bdc460c5Smrg	tx39-*)
1113bdc460c5Smrg		cpu=mipstx39
111414c0a534Smrg		;;
1115bdc460c5Smrg	tx39el-*)
1116bdc460c5Smrg		cpu=mipstx39el
111714c0a534Smrg		;;
1118bdc460c5Smrg	x64-*)
1119bdc460c5Smrg		cpu=x86_64
112014c0a534Smrg		;;
1121bdc460c5Smrg	xscale-* | xscalee[bl]-*)
1122bdc460c5Smrg		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
112314c0a534Smrg		;;
1124bdc460c5Smrg	arm64-*)
1125bdc460c5Smrg		cpu=aarch64
112614c0a534Smrg		;;
1127bdc460c5Smrg
1128bdc460c5Smrg	# Recognize the canonical CPU Types that limit and/or modify the
1129bdc460c5Smrg	# company names they are paired with.
1130bdc460c5Smrg	cr16-*)
1131bdc460c5Smrg		basic_os=${basic_os:-elf}
113214c0a534Smrg		;;
1133bdc460c5Smrg	crisv32-* | etraxfs*-*)
1134bdc460c5Smrg		cpu=crisv32
1135bdc460c5Smrg		vendor=axis
113614c0a534Smrg		;;
1137bdc460c5Smrg	cris-* | etrax*-*)
1138bdc460c5Smrg		cpu=cris
1139bdc460c5Smrg		vendor=axis
114014c0a534Smrg		;;
1141bdc460c5Smrg	crx-*)
1142bdc460c5Smrg		basic_os=${basic_os:-elf}
114314c0a534Smrg		;;
1144bdc460c5Smrg	neo-tandem)
1145bdc460c5Smrg		cpu=neo
1146bdc460c5Smrg		vendor=tandem
114714c0a534Smrg		;;
1148bdc460c5Smrg	nse-tandem)
1149bdc460c5Smrg		cpu=nse
1150bdc460c5Smrg		vendor=tandem
115114c0a534Smrg		;;
1152bdc460c5Smrg	nsr-tandem)
1153bdc460c5Smrg		cpu=nsr
1154bdc460c5Smrg		vendor=tandem
115514c0a534Smrg		;;
1156bdc460c5Smrg	nsv-tandem)
1157bdc460c5Smrg		cpu=nsv
1158bdc460c5Smrg		vendor=tandem
115914c0a534Smrg		;;
1160bdc460c5Smrg	nsx-tandem)
1161bdc460c5Smrg		cpu=nsx
1162bdc460c5Smrg		vendor=tandem
116314c0a534Smrg		;;
1164bdc460c5Smrg	mipsallegrexel-sony)
1165bdc460c5Smrg		cpu=mipsallegrexel
1166bdc460c5Smrg		vendor=sony
116714c0a534Smrg		;;
1168bdc460c5Smrg	tile*-*)
1169bdc460c5Smrg		basic_os=${basic_os:-linux-gnu}
117014c0a534Smrg		;;
1171bdc460c5Smrg
117214c0a534Smrg	*)
1173bdc460c5Smrg		# Recognize the canonical CPU types that are allowed with any
1174bdc460c5Smrg		# company name.
1175bdc460c5Smrg		case $cpu in
1176bdc460c5Smrg			1750a | 580 \
1177bdc460c5Smrg			| a29k \
1178bdc460c5Smrg			| aarch64 | aarch64_be \
1179bdc460c5Smrg			| abacus \
1180bdc460c5Smrg			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1181bdc460c5Smrg			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1182bdc460c5Smrg			| alphapca5[67] | alpha64pca5[67] \
1183bdc460c5Smrg			| am33_2.0 \
1184bdc460c5Smrg			| amdgcn \
1185bdc460c5Smrg			| arc | arceb | arc32 | arc64 \
1186bdc460c5Smrg			| arm | arm[lb]e | arme[lb] | armv* \
1187bdc460c5Smrg			| avr | avr32 \
1188bdc460c5Smrg			| asmjs \
1189bdc460c5Smrg			| ba \
1190bdc460c5Smrg			| be32 | be64 \
1191bdc460c5Smrg			| bfin | bpf | bs2000 \
1192bdc460c5Smrg			| c[123]* | c30 | [cjt]90 | c4x \
1193bdc460c5Smrg			| c8051 | clipper | craynv | csky | cydra \
1194bdc460c5Smrg			| d10v | d30v | dlx | dsp16xx \
1195bdc460c5Smrg			| e2k | elxsi | epiphany \
1196bdc460c5Smrg			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1197bdc460c5Smrg			| h8300 | h8500 \
1198bdc460c5Smrg			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1199bdc460c5Smrg			| hexagon \
1200bdc460c5Smrg			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1201bdc460c5Smrg			| ip2k | iq2000 \
1202bdc460c5Smrg			| k1om \
1203bdc460c5Smrg			| le32 | le64 \
1204bdc460c5Smrg			| lm32 \
1205bdc460c5Smrg			| loongarch32 | loongarch64 | loongarchx32 \
1206bdc460c5Smrg			| m32c | m32r | m32rle \
1207bdc460c5Smrg			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1208bdc460c5Smrg			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1209bdc460c5Smrg			| m88110 | m88k | maxq | mb | mcore | mep | metag \
1210bdc460c5Smrg			| microblaze | microblazeel \
1211bdc460c5Smrg			| mips | mipsbe | mipseb | mipsel | mipsle \
1212bdc460c5Smrg			| mips16 \
1213bdc460c5Smrg			| mips64 | mips64eb | mips64el \
1214bdc460c5Smrg			| mips64octeon | mips64octeonel \
1215bdc460c5Smrg			| mips64orion | mips64orionel \
1216bdc460c5Smrg			| mips64r5900 | mips64r5900el \
1217bdc460c5Smrg			| mips64vr | mips64vrel \
1218bdc460c5Smrg			| mips64vr4100 | mips64vr4100el \
1219bdc460c5Smrg			| mips64vr4300 | mips64vr4300el \
1220bdc460c5Smrg			| mips64vr5000 | mips64vr5000el \
1221bdc460c5Smrg			| mips64vr5900 | mips64vr5900el \
1222bdc460c5Smrg			| mipsisa32 | mipsisa32el \
1223bdc460c5Smrg			| mipsisa32r2 | mipsisa32r2el \
1224bdc460c5Smrg			| mipsisa32r3 | mipsisa32r3el \
1225bdc460c5Smrg			| mipsisa32r5 | mipsisa32r5el \
1226bdc460c5Smrg			| mipsisa32r6 | mipsisa32r6el \
1227bdc460c5Smrg			| mipsisa64 | mipsisa64el \
1228bdc460c5Smrg			| mipsisa64r2 | mipsisa64r2el \
1229bdc460c5Smrg			| mipsisa64r3 | mipsisa64r3el \
1230bdc460c5Smrg			| mipsisa64r5 | mipsisa64r5el \
1231bdc460c5Smrg			| mipsisa64r6 | mipsisa64r6el \
1232bdc460c5Smrg			| mipsisa64sb1 | mipsisa64sb1el \
1233bdc460c5Smrg			| mipsisa64sr71k | mipsisa64sr71kel \
1234bdc460c5Smrg			| mipsr5900 | mipsr5900el \
1235bdc460c5Smrg			| mipstx39 | mipstx39el \
1236bdc460c5Smrg			| mmix \
1237bdc460c5Smrg			| mn10200 | mn10300 \
1238bdc460c5Smrg			| moxie \
1239bdc460c5Smrg			| mt \
1240bdc460c5Smrg			| msp430 \
1241bdc460c5Smrg			| nds32 | nds32le | nds32be \
1242bdc460c5Smrg			| nfp \
1243bdc460c5Smrg			| nios | nios2 | nios2eb | nios2el \
1244bdc460c5Smrg			| none | np1 | ns16k | ns32k | nvptx \
1245bdc460c5Smrg			| open8 \
1246bdc460c5Smrg			| or1k* \
1247bdc460c5Smrg			| or32 \
1248bdc460c5Smrg			| orion \
1249bdc460c5Smrg			| picochip \
1250bdc460c5Smrg			| pdp10 | pdp11 | pj | pjl | pn | power \
1251bdc460c5Smrg			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1252bdc460c5Smrg			| pru \
1253bdc460c5Smrg			| pyramid \
1254bdc460c5Smrg			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1255bdc460c5Smrg			| rl78 | romp | rs6000 | rx \
1256bdc460c5Smrg			| s390 | s390x \
1257bdc460c5Smrg			| score \
1258bdc460c5Smrg			| sh | shl \
1259bdc460c5Smrg			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1260bdc460c5Smrg			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1261bdc460c5Smrg			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1262bdc460c5Smrg			| sparclite \
1263bdc460c5Smrg			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1264bdc460c5Smrg			| spu \
1265bdc460c5Smrg			| tahoe \
1266bdc460c5Smrg			| thumbv7* \
1267bdc460c5Smrg			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1268bdc460c5Smrg			| tron \
1269bdc460c5Smrg			| ubicom32 \
1270bdc460c5Smrg			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1271bdc460c5Smrg			| vax \
1272bdc460c5Smrg			| visium \
1273bdc460c5Smrg			| w65 \
1274bdc460c5Smrg			| wasm32 | wasm64 \
1275bdc460c5Smrg			| we32k \
1276bdc460c5Smrg			| x86 | x86_64 | xc16x | xgate | xps100 \
1277bdc460c5Smrg			| xstormy16 | xtensa* \
1278bdc460c5Smrg			| ymp \
1279bdc460c5Smrg			| z8k | z80)
1280bdc460c5Smrg				;;
1281bdc460c5Smrg
1282bdc460c5Smrg			*)
1283bdc460c5Smrg				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1284bdc460c5Smrg				exit 1
1285bdc460c5Smrg				;;
1286bdc460c5Smrg		esac
128714c0a534Smrg		;;
128814c0a534Smrgesac
128914c0a534Smrg
129014c0a534Smrg# Here we canonicalize certain aliases for manufacturers.
1291bdc460c5Smrgcase $vendor in
1292bdc460c5Smrg	digital*)
1293bdc460c5Smrg		vendor=dec
129414c0a534Smrg		;;
1295bdc460c5Smrg	commodore*)
1296bdc460c5Smrg		vendor=cbm
129714c0a534Smrg		;;
129814c0a534Smrg	*)
129914c0a534Smrg		;;
130014c0a534Smrgesac
130114c0a534Smrg
130214c0a534Smrg# Decode manufacturer-specific aliases for certain operating systems.
130314c0a534Smrg
1304bdc460c5Smrgif test x$basic_os != x
130514c0a534Smrgthen
1306bdc460c5Smrg
1307bdc460c5Smrg# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
1308bdc460c5Smrg# set os.
1309bdc460c5Smrgcase $basic_os in
1310bdc460c5Smrg	gnu/linux*)
1311bdc460c5Smrg		kernel=linux
1312bdc460c5Smrg		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1313bdc460c5Smrg		;;
1314bdc460c5Smrg	os2-emx)
1315bdc460c5Smrg		kernel=os2
1316bdc460c5Smrg		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1317bdc460c5Smrg		;;
1318bdc460c5Smrg	nto-qnx*)
1319bdc460c5Smrg		kernel=nto
1320bdc460c5Smrg		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1321bdc460c5Smrg		;;
1322bdc460c5Smrg	*-*)
1323bdc460c5Smrg		# shellcheck disable=SC2162
1324bdc460c5Smrg		saved_IFS=$IFS
1325bdc460c5Smrg		IFS="-" read kernel os <<EOF
1326bdc460c5Smrg$basic_os
1327bdc460c5SmrgEOF
1328bdc460c5Smrg		IFS=$saved_IFS
1329bdc460c5Smrg		;;
1330bdc460c5Smrg	# Default OS when just kernel was specified
1331bdc460c5Smrg	nto*)
1332bdc460c5Smrg		kernel=nto
1333bdc460c5Smrg		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1334bdc460c5Smrg		;;
1335bdc460c5Smrg	linux*)
1336bdc460c5Smrg		kernel=linux
1337bdc460c5Smrg		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1338bdc460c5Smrg		;;
1339bdc460c5Smrg	*)
1340bdc460c5Smrg		kernel=
1341bdc460c5Smrg		os=$basic_os
1342bdc460c5Smrg		;;
1343bdc460c5Smrgesac
1344bdc460c5Smrg
1345bdc460c5Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1346bdc460c5Smrg# etc.)
134714c0a534Smrgcase $os in
1348bdc460c5Smrg	# First match some system type aliases that might get confused
1349bdc460c5Smrg	# with valid system types.
1350bdc460c5Smrg	# solaris* is a basic system type, with this one exception.
1351bdc460c5Smrg	auroraux)
1352bdc460c5Smrg		os=auroraux
1353576bae58Smrg		;;
1354bdc460c5Smrg	bluegene*)
1355bdc460c5Smrg		os=cnk
135614c0a534Smrg		;;
1357bdc460c5Smrg	solaris1 | solaris1.*)
1358bdc460c5Smrg		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
135914c0a534Smrg		;;
1360bdc460c5Smrg	solaris)
1361bdc460c5Smrg		os=solaris2
136214c0a534Smrg		;;
1363bdc460c5Smrg	unixware*)
1364bdc460c5Smrg		os=sysv4.2uw
136514c0a534Smrg		;;
1366bdc460c5Smrg	# es1800 is here to avoid being matched by es* (a different OS)
1367bdc460c5Smrg	es1800*)
1368bdc460c5Smrg		os=ose
136914c0a534Smrg		;;
1370bdc460c5Smrg	# Some version numbers need modification
1371bdc460c5Smrg	chorusos*)
1372bdc460c5Smrg		os=chorusos
137314c0a534Smrg		;;
1374bdc460c5Smrg	isc)
1375bdc460c5Smrg		os=isc2.2
137614c0a534Smrg		;;
1377bdc460c5Smrg	sco6)
1378bdc460c5Smrg		os=sco5v6
137914c0a534Smrg		;;
1380bdc460c5Smrg	sco5)
1381bdc460c5Smrg		os=sco3.2v5
138214c0a534Smrg		;;
1383bdc460c5Smrg	sco4)
1384bdc460c5Smrg		os=sco3.2v4
138514c0a534Smrg		;;
1386bdc460c5Smrg	sco3.2.[4-9]*)
1387bdc460c5Smrg		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
138814c0a534Smrg		;;
1389bdc460c5Smrg	sco*v* | scout)
1390bdc460c5Smrg		# Don't match below
139114c0a534Smrg		;;
1392bdc460c5Smrg	sco*)
1393bdc460c5Smrg		os=sco3.2v2
139414c0a534Smrg		;;
1395bdc460c5Smrg	psos*)
1396bdc460c5Smrg		os=psos
139714c0a534Smrg		;;
1398bdc460c5Smrg	qnx*)
1399bdc460c5Smrg		os=qnx
140014c0a534Smrg		;;
1401bdc460c5Smrg	hiux*)
1402bdc460c5Smrg		os=hiuxwe2
140314c0a534Smrg		;;
1404bdc460c5Smrg	lynx*178)
1405bdc460c5Smrg		os=lynxos178
140614c0a534Smrg		;;
1407bdc460c5Smrg	lynx*5)
1408bdc460c5Smrg		os=lynxos5
140914c0a534Smrg		;;
1410bdc460c5Smrg	lynxos*)
1411bdc460c5Smrg		# don't get caught up in next wildcard
141214c0a534Smrg		;;
1413bdc460c5Smrg	lynx*)
1414bdc460c5Smrg		os=lynxos
141514c0a534Smrg		;;
1416bdc460c5Smrg	mac[0-9]*)
1417bdc460c5Smrg		os=`echo "$os" | sed -e 's|mac|macos|'`
141814c0a534Smrg		;;
1419bdc460c5Smrg	opened*)
1420bdc460c5Smrg		os=openedition
142114c0a534Smrg		;;
1422bdc460c5Smrg	os400*)
1423bdc460c5Smrg		os=os400
142414c0a534Smrg		;;
1425bdc460c5Smrg	sunos5*)
1426bdc460c5Smrg		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
142714c0a534Smrg		;;
1428bdc460c5Smrg	sunos6*)
1429bdc460c5Smrg		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
143014c0a534Smrg		;;
1431bdc460c5Smrg	wince*)
1432bdc460c5Smrg		os=wince
143314c0a534Smrg		;;
1434bdc460c5Smrg	utek*)
1435bdc460c5Smrg		os=bsd
143614c0a534Smrg		;;
1437bdc460c5Smrg	dynix*)
1438bdc460c5Smrg		os=bsd
143914c0a534Smrg		;;
1440bdc460c5Smrg	acis*)
1441bdc460c5Smrg		os=aos
144214c0a534Smrg		;;
1443bdc460c5Smrg	atheos*)
1444bdc460c5Smrg		os=atheos
144514c0a534Smrg		;;
1446bdc460c5Smrg	syllable*)
1447bdc460c5Smrg		os=syllable
144814c0a534Smrg		;;
1449bdc460c5Smrg	386bsd)
1450bdc460c5Smrg		os=bsd
145114c0a534Smrg		;;
1452bdc460c5Smrg	ctix* | uts*)
1453bdc460c5Smrg		os=sysv
145414c0a534Smrg		;;
1455bdc460c5Smrg	nova*)
1456bdc460c5Smrg		os=rtmk-nova
145714c0a534Smrg		;;
1458bdc460c5Smrg	ns2)
1459bdc460c5Smrg		os=nextstep2
146014c0a534Smrg		;;
1461bdc460c5Smrg	# Preserve the version number of sinix5.
1462bdc460c5Smrg	sinix5.*)
1463bdc460c5Smrg		os=`echo "$os" | sed -e 's|sinix|sysv|'`
146414c0a534Smrg		;;
1465bdc460c5Smrg	sinix*)
1466bdc460c5Smrg		os=sysv4
146714c0a534Smrg		;;
1468bdc460c5Smrg	tpf*)
1469bdc460c5Smrg		os=tpf
147014c0a534Smrg		;;
1471bdc460c5Smrg	triton*)
1472bdc460c5Smrg		os=sysv3
147314c0a534Smrg		;;
1474bdc460c5Smrg	oss*)
1475bdc460c5Smrg		os=sysv3
147614c0a534Smrg		;;
1477bdc460c5Smrg	svr4*)
1478bdc460c5Smrg		os=sysv4
147914c0a534Smrg		;;
1480bdc460c5Smrg	svr3)
1481bdc460c5Smrg		os=sysv3
148214c0a534Smrg		;;
1483bdc460c5Smrg	sysvr4)
1484bdc460c5Smrg		os=sysv4
148514c0a534Smrg		;;
1486bdc460c5Smrg	ose*)
1487bdc460c5Smrg		os=ose
148814c0a534Smrg		;;
1489bdc460c5Smrg	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1490bdc460c5Smrg		os=mint
1491bf2eeab3Smrg		;;
1492bdc460c5Smrg	dicos*)
1493bdc460c5Smrg		os=dicos
149424047306Smrg		;;
1495bdc460c5Smrg	pikeos*)
1496bdc460c5Smrg		# Until real need of OS specific support for
1497bdc460c5Smrg		# particular features comes up, bare metal
1498bdc460c5Smrg		# configurations are quite functional.
1499bdc460c5Smrg		case $cpu in
1500bdc460c5Smrg		    arm*)
1501bdc460c5Smrg			os=eabi
1502bdc460c5Smrg			;;
1503bdc460c5Smrg		    *)
1504bdc460c5Smrg			os=elf
1505bdc460c5Smrg			;;
1506bdc460c5Smrg		esac
150714c0a534Smrg		;;
150814c0a534Smrg	*)
1509bdc460c5Smrg		# No normalization, but not necessarily accepted, that comes below.
151014c0a534Smrg		;;
151114c0a534Smrgesac
1512bdc460c5Smrg
151314c0a534Smrgelse
151414c0a534Smrg
151514c0a534Smrg# Here we handle the default operating systems that come with various machines.
151614c0a534Smrg# The value should be what the vendor currently ships out the door with their
151714c0a534Smrg# machine or put another way, the most popular os provided with the machine.
151814c0a534Smrg
151914c0a534Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say,
152014c0a534Smrg# "-sun"), then you have to tell the case statement up towards the top
152114c0a534Smrg# that MANUFACTURER isn't an operating system.  Otherwise, code above
152214c0a534Smrg# will signal an error saying that MANUFACTURER isn't an operating
152314c0a534Smrg# system, and we'll never get to this point.
152414c0a534Smrg
1525bdc460c5Smrgkernel=
1526bdc460c5Smrgcase $cpu-$vendor in
152724047306Smrg	score-*)
1528bdc460c5Smrg		os=elf
1529bf2eeab3Smrg		;;
153024047306Smrg	spu-*)
1531bdc460c5Smrg		os=elf
1532bf2eeab3Smrg		;;
153314c0a534Smrg	*-acorn)
1534bdc460c5Smrg		os=riscix1.2
153514c0a534Smrg		;;
153614c0a534Smrg	arm*-rebel)
1537bdc460c5Smrg		kernel=linux
1538bdc460c5Smrg		os=gnu
153914c0a534Smrg		;;
154014c0a534Smrg	arm*-semi)
1541bdc460c5Smrg		os=aout
154214c0a534Smrg		;;
154324047306Smrg	c4x-* | tic4x-*)
1544bdc460c5Smrg		os=coff
154524047306Smrg		;;
154624047306Smrg	c8051-*)
1547bdc460c5Smrg		os=elf
1548bdc460c5Smrg		;;
1549bdc460c5Smrg	clipper-intergraph)
1550bdc460c5Smrg		os=clix
155124047306Smrg		;;
155224047306Smrg	hexagon-*)
1553bdc460c5Smrg		os=elf
1554bf2eeab3Smrg		;;
1555576bae58Smrg	tic54x-*)
1556bdc460c5Smrg		os=coff
1557576bae58Smrg		;;
1558576bae58Smrg	tic55x-*)
1559bdc460c5Smrg		os=coff
1560576bae58Smrg		;;
1561576bae58Smrg	tic6x-*)
1562bdc460c5Smrg		os=coff
1563576bae58Smrg		;;
156414c0a534Smrg	# This must come before the *-dec entry.
156514c0a534Smrg	pdp10-*)
1566bdc460c5Smrg		os=tops20
156714c0a534Smrg		;;
156814c0a534Smrg	pdp11-*)
1569bdc460c5Smrg		os=none
157014c0a534Smrg		;;
157114c0a534Smrg	*-dec | vax-*)
1572bdc460c5Smrg		os=ultrix4.2
157314c0a534Smrg		;;
157414c0a534Smrg	m68*-apollo)
1575bdc460c5Smrg		os=domain
157614c0a534Smrg		;;
157714c0a534Smrg	i386-sun)
1578bdc460c5Smrg		os=sunos4.0.2
157914c0a534Smrg		;;
158014c0a534Smrg	m68000-sun)
1581bdc460c5Smrg		os=sunos3
158214c0a534Smrg		;;
158314c0a534Smrg	m68*-cisco)
1584bdc460c5Smrg		os=aout
158514c0a534Smrg		;;
158624047306Smrg	mep-*)
1587bdc460c5Smrg		os=elf
1588bf2eeab3Smrg		;;
158914c0a534Smrg	mips*-cisco)
1590bdc460c5Smrg		os=elf
159114c0a534Smrg		;;
159214c0a534Smrg	mips*-*)
1593bdc460c5Smrg		os=elf
159414c0a534Smrg		;;
159514c0a534Smrg	or32-*)
1596bdc460c5Smrg		os=coff
159714c0a534Smrg		;;
159814c0a534Smrg	*-tti)	# must be before sparc entry or we get the wrong os.
1599bdc460c5Smrg		os=sysv3
160014c0a534Smrg		;;
160114c0a534Smrg	sparc-* | *-sun)
1602bdc460c5Smrg		os=sunos4.1.1
160314c0a534Smrg		;;
1604bdc460c5Smrg	pru-*)
1605bdc460c5Smrg		os=elf
160614c0a534Smrg		;;
1607bdc460c5Smrg	*-be)
1608bdc460c5Smrg		os=beos
160914c0a534Smrg		;;
161014c0a534Smrg	*-ibm)
1611bdc460c5Smrg		os=aix
161214c0a534Smrg		;;
161324047306Smrg	*-knuth)
1614bdc460c5Smrg		os=mmixware
161514c0a534Smrg		;;
161614c0a534Smrg	*-wec)
1617bdc460c5Smrg		os=proelf
161814c0a534Smrg		;;
161914c0a534Smrg	*-winbond)
1620bdc460c5Smrg		os=proelf
162114c0a534Smrg		;;
162214c0a534Smrg	*-oki)
1623bdc460c5Smrg		os=proelf
162414c0a534Smrg		;;
162514c0a534Smrg	*-hp)
1626bdc460c5Smrg		os=hpux
162714c0a534Smrg		;;
162814c0a534Smrg	*-hitachi)
1629bdc460c5Smrg		os=hiux
163014c0a534Smrg		;;
163114c0a534Smrg	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1632bdc460c5Smrg		os=sysv
163314c0a534Smrg		;;
163414c0a534Smrg	*-cbm)
1635bdc460c5Smrg		os=amigaos
163614c0a534Smrg		;;
163714c0a534Smrg	*-dg)
1638bdc460c5Smrg		os=dgux
163914c0a534Smrg		;;
164014c0a534Smrg	*-dolphin)
1641bdc460c5Smrg		os=sysv3
164214c0a534Smrg		;;
164314c0a534Smrg	m68k-ccur)
1644bdc460c5Smrg		os=rtu
164514c0a534Smrg		;;
164614c0a534Smrg	m88k-omron*)
1647bdc460c5Smrg		os=luna
164814c0a534Smrg		;;
1649bdc460c5Smrg	*-next)
1650bdc460c5Smrg		os=nextstep
165114c0a534Smrg		;;
165214c0a534Smrg	*-sequent)
1653bdc460c5Smrg		os=ptx
165414c0a534Smrg		;;
165514c0a534Smrg	*-crds)
1656bdc460c5Smrg		os=unos
165714c0a534Smrg		;;
165814c0a534Smrg	*-ns)
1659bdc460c5Smrg		os=genix
166014c0a534Smrg		;;
166114c0a534Smrg	i370-*)
1662bdc460c5Smrg		os=mvs
166314c0a534Smrg		;;
166414c0a534Smrg	*-gould)
1665bdc460c5Smrg		os=sysv
166614c0a534Smrg		;;
166714c0a534Smrg	*-highlevel)
1668bdc460c5Smrg		os=bsd
166914c0a534Smrg		;;
167014c0a534Smrg	*-encore)
1671bdc460c5Smrg		os=bsd
167214c0a534Smrg		;;
167314c0a534Smrg	*-sgi)
1674bdc460c5Smrg		os=irix
167514c0a534Smrg		;;
167614c0a534Smrg	*-siemens)
1677bdc460c5Smrg		os=sysv4
167814c0a534Smrg		;;
167914c0a534Smrg	*-masscomp)
1680bdc460c5Smrg		os=rtu
168114c0a534Smrg		;;
168214c0a534Smrg	f30[01]-fujitsu | f700-fujitsu)
1683bdc460c5Smrg		os=uxpv
168414c0a534Smrg		;;
168514c0a534Smrg	*-rom68k)
1686bdc460c5Smrg		os=coff
168714c0a534Smrg		;;
168814c0a534Smrg	*-*bug)
1689bdc460c5Smrg		os=coff
169014c0a534Smrg		;;
169114c0a534Smrg	*-apple)
1692bdc460c5Smrg		os=macos
169314c0a534Smrg		;;
169414c0a534Smrg	*-atari*)
1695bdc460c5Smrg		os=mint
1696bdc460c5Smrg		;;
1697bdc460c5Smrg	*-wrs)
1698bdc460c5Smrg		os=vxworks
169914c0a534Smrg		;;
170014c0a534Smrg	*)
1701bdc460c5Smrg		os=none
170214c0a534Smrg		;;
170314c0a534Smrgesac
1704bdc460c5Smrg
170514c0a534Smrgfi
170614c0a534Smrg
1707bdc460c5Smrg# Now, validate our (potentially fixed-up) OS.
1708bdc460c5Smrgcase $os in
1709bdc460c5Smrg	# Sometimes we do "kernel-libc", so those need to count as OSes.
1710bdc460c5Smrg	musl* | newlib* | relibc* | uclibc*)
1711bdc460c5Smrg		;;
1712bdc460c5Smrg	# Likewise for "kernel-abi"
1713bdc460c5Smrg	eabi* | gnueabi*)
1714bdc460c5Smrg		;;
1715bdc460c5Smrg	# VxWorks passes extra cpu info in the 4th filed.
1716bdc460c5Smrg	simlinux | simwindows | spe)
1717bdc460c5Smrg		;;
1718bdc460c5Smrg	# Now accept the basic system types.
1719bdc460c5Smrg	# The portable systems comes first.
1720bdc460c5Smrg	# Each alternative MUST end in a * to match a version number.
1721bdc460c5Smrg	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1722bdc460c5Smrg	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1723bdc460c5Smrg	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1724bdc460c5Smrg	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1725bdc460c5Smrg	     | hiux* | abug | nacl* | netware* | windows* \
1726bdc460c5Smrg	     | os9* | macos* | osx* | ios* \
1727bdc460c5Smrg	     | mpw* | magic* | mmixware* | mon960* | lnews* \
1728bdc460c5Smrg	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1729bdc460c5Smrg	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
1730bdc460c5Smrg	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1731bdc460c5Smrg	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1732bdc460c5Smrg	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1733bdc460c5Smrg	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1734bdc460c5Smrg	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1735bdc460c5Smrg	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1736bdc460c5Smrg	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1737bdc460c5Smrg	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
1738bdc460c5Smrg	     | chorusrdb* | cegcc* | glidix* | serenity* \
1739bdc460c5Smrg	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1740bdc460c5Smrg	     | midipix* | mingw32* | mingw64* | mint* \
1741bdc460c5Smrg	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1742bdc460c5Smrg	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1743bdc460c5Smrg	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1744bdc460c5Smrg	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1745bdc460c5Smrg	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1746bdc460c5Smrg	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1747bdc460c5Smrg	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1748bdc460c5Smrg	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1749bdc460c5Smrg	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1750bdc460c5Smrg	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1751bdc460c5Smrg	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
1752bdc460c5Smrg		;;
1753bdc460c5Smrg	# This one is extra strict with allowed versions
1754bdc460c5Smrg	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1755bdc460c5Smrg		# Don't forget version if it is 3.2v4 or newer.
1756bdc460c5Smrg		;;
1757bdc460c5Smrg	none)
1758bdc460c5Smrg		;;
1759bdc460c5Smrg	*)
1760bdc460c5Smrg		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1761bdc460c5Smrg		exit 1
1762bdc460c5Smrg		;;
1763bdc460c5Smrgesac
1764bdc460c5Smrg
1765bdc460c5Smrg# As a final step for OS-related things, validate the OS-kernel combination
1766bdc460c5Smrg# (given a valid OS), if there is a kernel.
1767bdc460c5Smrgcase $kernel-$os in
1768bdc460c5Smrg	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1769bdc460c5Smrg		   | linux-musl* | linux-relibc* | linux-uclibc* )
1770bdc460c5Smrg		;;
1771bdc460c5Smrg	uclinux-uclibc* )
1772bdc460c5Smrg		;;
1773bdc460c5Smrg	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
1774bdc460c5Smrg		# These are just libc implementations, not actual OSes, and thus
1775bdc460c5Smrg		# require a kernel.
1776bdc460c5Smrg		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1777bdc460c5Smrg		exit 1
1778bdc460c5Smrg		;;
1779bdc460c5Smrg	kfreebsd*-gnu* | kopensolaris*-gnu*)
1780bdc460c5Smrg		;;
1781bdc460c5Smrg	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1782bdc460c5Smrg		;;
1783bdc460c5Smrg	nto-qnx*)
1784bdc460c5Smrg		;;
1785bdc460c5Smrg	os2-emx)
1786bdc460c5Smrg		;;
1787bdc460c5Smrg	*-eabi* | *-gnueabi*)
1788bdc460c5Smrg		;;
1789bdc460c5Smrg	-*)
1790bdc460c5Smrg		# Blank kernel with real OS is always fine.
1791bdc460c5Smrg		;;
1792bdc460c5Smrg	*-*)
1793bdc460c5Smrg		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1794bdc460c5Smrg		exit 1
1795bdc460c5Smrg		;;
1796bdc460c5Smrgesac
1797bdc460c5Smrg
179814c0a534Smrg# Here we handle the case where we know the os, and the CPU type, but not the
179914c0a534Smrg# manufacturer.  We pick the logical manufacturer.
1800bdc460c5Smrgcase $vendor in
1801bdc460c5Smrg	unknown)
1802bdc460c5Smrg		case $cpu-$os in
1803bdc460c5Smrg			*-riscix*)
180414c0a534Smrg				vendor=acorn
180514c0a534Smrg				;;
1806bdc460c5Smrg			*-sunos*)
180714c0a534Smrg				vendor=sun
180814c0a534Smrg				;;
1809bdc460c5Smrg			*-cnk* | *-aix*)
181014c0a534Smrg				vendor=ibm
181114c0a534Smrg				;;
1812bdc460c5Smrg			*-beos*)
181314c0a534Smrg				vendor=be
181414c0a534Smrg				;;
1815bdc460c5Smrg			*-hpux*)
181614c0a534Smrg				vendor=hp
181714c0a534Smrg				;;
1818bdc460c5Smrg			*-mpeix*)
181914c0a534Smrg				vendor=hp
182014c0a534Smrg				;;
1821bdc460c5Smrg			*-hiux*)
182214c0a534Smrg				vendor=hitachi
182314c0a534Smrg				;;
1824bdc460c5Smrg			*-unos*)
182514c0a534Smrg				vendor=crds
182614c0a534Smrg				;;
1827bdc460c5Smrg			*-dgux*)
182814c0a534Smrg				vendor=dg
182914c0a534Smrg				;;
1830bdc460c5Smrg			*-luna*)
183114c0a534Smrg				vendor=omron
183214c0a534Smrg				;;
1833bdc460c5Smrg			*-genix*)
183414c0a534Smrg				vendor=ns
183514c0a534Smrg				;;
1836bdc460c5Smrg			*-clix*)
1837bdc460c5Smrg				vendor=intergraph
1838bdc460c5Smrg				;;
1839bdc460c5Smrg			*-mvs* | *-opened*)
1840bdc460c5Smrg				vendor=ibm
1841bdc460c5Smrg				;;
1842bdc460c5Smrg			*-os400*)
184314c0a534Smrg				vendor=ibm
184414c0a534Smrg				;;
1845bdc460c5Smrg			s390-* | s390x-*)
184614c0a534Smrg				vendor=ibm
184714c0a534Smrg				;;
1848bdc460c5Smrg			*-ptx*)
184914c0a534Smrg				vendor=sequent
185014c0a534Smrg				;;
1851bdc460c5Smrg			*-tpf*)
185214c0a534Smrg				vendor=ibm
185314c0a534Smrg				;;
1854bdc460c5Smrg			*-vxsim* | *-vxworks* | *-windiss*)
185514c0a534Smrg				vendor=wrs
185614c0a534Smrg				;;
1857bdc460c5Smrg			*-aux*)
185814c0a534Smrg				vendor=apple
185914c0a534Smrg				;;
1860bdc460c5Smrg			*-hms*)
186114c0a534Smrg				vendor=hitachi
186214c0a534Smrg				;;
1863bdc460c5Smrg			*-mpw* | *-macos*)
186414c0a534Smrg				vendor=apple
186514c0a534Smrg				;;
1866bdc460c5Smrg			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
186714c0a534Smrg				vendor=atari
186814c0a534Smrg				;;
1869bdc460c5Smrg			*-vos*)
187014c0a534Smrg				vendor=stratus
187114c0a534Smrg				;;
187214c0a534Smrg		esac
187314c0a534Smrg		;;
187414c0a534Smrgesac
187514c0a534Smrg
1876bdc460c5Smrgecho "$cpu-$vendor-${kernel:+$kernel-}$os"
187714c0a534Smrgexit
187814c0a534Smrg
187914c0a534Smrg# Local variables:
1880bdc460c5Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
188114c0a534Smrg# time-stamp-start: "timestamp='"
188214c0a534Smrg# time-stamp-format: "%:y-%02m-%02d"
188314c0a534Smrg# time-stamp-end: "'"
188414c0a534Smrg# End:
1885