1267843Sdelphij#! /bin/sh
2267843Sdelphij# Configuration validation subroutine script.
3360521Sdelphij#   Copyright 1992-2019 Free Software Foundation, Inc.
4267843Sdelphij
5360521Sdelphijtimestamp='2019-01-05'
6267843Sdelphij
7309847Sdelphij# This file is free software; you can redistribute it and/or modify it
8309847Sdelphij# under the terms of the GNU General Public License as published by
9309847Sdelphij# the Free Software Foundation; either version 3 of the License, or
10267843Sdelphij# (at your option) any later version.
11267843Sdelphij#
12309847Sdelphij# This program is distributed in the hope that it will be useful, but
13309847Sdelphij# WITHOUT ANY WARRANTY; without even the implied warranty of
14309847Sdelphij# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15309847Sdelphij# General Public License for more details.
16267843Sdelphij#
17267843Sdelphij# You should have received a copy of the GNU General Public License
18360521Sdelphij# along with this program; if not, see <https://www.gnu.org/licenses/>.
19267843Sdelphij#
20267843Sdelphij# As a special exception to the GNU General Public License, if you
21267843Sdelphij# distribute this file as part of a program that contains a
22267843Sdelphij# configuration script generated by Autoconf, you may include it under
23309847Sdelphij# the same distribution terms that you use for the rest of that
24309847Sdelphij# program.  This Exception is an additional permission under section 7
25309847Sdelphij# of the GNU General Public License, version 3 ("GPLv3").
26267843Sdelphij
27267843Sdelphij
28309847Sdelphij# Please send patches to <config-patches@gnu.org>.
29267843Sdelphij#
30267843Sdelphij# Configuration subroutine to validate and canonicalize a configuration type.
31267843Sdelphij# Supply the specified configuration type as an argument.
32267843Sdelphij# If it is invalid, we print an error message on stderr and exit with code 1.
33267843Sdelphij# Otherwise, we print the canonical config type on stdout and succeed.
34267843Sdelphij
35267843Sdelphij# You can get the latest version of this script from:
36360521Sdelphij# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
37267843Sdelphij
38267843Sdelphij# This file is supposed to be the same for all GNU packages
39267843Sdelphij# and recognize all the CPU types, system types and aliases
40267843Sdelphij# that are meaningful with *any* GNU software.
41267843Sdelphij# Each package is responsible for reporting which valid configurations
42267843Sdelphij# it does not support.  The user should be able to distinguish
43267843Sdelphij# a failure to support a valid configuration from a meaningless
44267843Sdelphij# configuration.
45267843Sdelphij
46267843Sdelphij# The goal of this file is to map all the various variations of a given
47267843Sdelphij# machine specification into a single specification in the form:
48267843Sdelphij#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
49267843Sdelphij# or in some cases, the newer four-part form:
50267843Sdelphij#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
51267843Sdelphij# It is wrong to echo any other type of specification.
52267843Sdelphij
53267843Sdelphijme=`echo "$0" | sed -e 's,.*/,,'`
54267843Sdelphij
55267843Sdelphijusage="\
56328874SeadlerUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
57267843Sdelphij
58267843SdelphijCanonicalize a configuration name.
59267843Sdelphij
60360521SdelphijOptions:
61267843Sdelphij  -h, --help         print this help, then exit
62267843Sdelphij  -t, --time-stamp   print date of last modification, then exit
63267843Sdelphij  -v, --version      print version number, then exit
64267843Sdelphij
65267843SdelphijReport bugs and patches to <config-patches@gnu.org>."
66267843Sdelphij
67267843Sdelphijversion="\
68267843SdelphijGNU config.sub ($timestamp)
69267843Sdelphij
70360521SdelphijCopyright 1992-2019 Free Software Foundation, Inc.
71267843Sdelphij
72267843SdelphijThis is free software; see the source for copying conditions.  There is NO
73267843Sdelphijwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
74267843Sdelphij
75267843Sdelphijhelp="
76267843SdelphijTry \`$me --help' for more information."
77267843Sdelphij
78267843Sdelphij# Parse command line
79267843Sdelphijwhile test $# -gt 0 ; do
80267843Sdelphij  case $1 in
81267843Sdelphij    --time-stamp | --time* | -t )
82267843Sdelphij       echo "$timestamp" ; exit ;;
83267843Sdelphij    --version | -v )
84267843Sdelphij       echo "$version" ; exit ;;
85267843Sdelphij    --help | --h* | -h )
86267843Sdelphij       echo "$usage"; exit ;;
87267843Sdelphij    -- )     # Stop option processing
88267843Sdelphij       shift; break ;;
89267843Sdelphij    - )	# Use stdin as input.
90267843Sdelphij       break ;;
91267843Sdelphij    -* )
92360521Sdelphij       echo "$me: invalid option $1$help" >&2
93267843Sdelphij       exit 1 ;;
94267843Sdelphij
95267843Sdelphij    *local*)
96267843Sdelphij       # First pass through any local machine types.
97360521Sdelphij       echo "$1"
98267843Sdelphij       exit ;;
99267843Sdelphij
100267843Sdelphij    * )
101267843Sdelphij       break ;;
102267843Sdelphij  esac
103267843Sdelphijdone
104267843Sdelphij
105267843Sdelphijcase $# in
106267843Sdelphij 0) echo "$me: missing argument$help" >&2
107267843Sdelphij    exit 1;;
108267843Sdelphij 1) ;;
109267843Sdelphij *) echo "$me: too many arguments$help" >&2
110267843Sdelphij    exit 1;;
111267843Sdelphijesac
112267843Sdelphij
113360521Sdelphij# Split fields of configuration type
114360521Sdelphij# shellcheck disable=SC2162
115360521SdelphijIFS="-" read field1 field2 field3 field4 <<EOF
116360521Sdelphij$1
117360521SdelphijEOF
118267843Sdelphij
119360521Sdelphij# Separate into logical components for further validation
120360521Sdelphijcase $1 in
121360521Sdelphij	*-*-*-*-*)
122360521Sdelphij		echo Invalid configuration \`"$1"\': more than four components >&2
123360521Sdelphij		exit 1
124267843Sdelphij		;;
125360521Sdelphij	*-*-*-*)
126360521Sdelphij		basic_machine=$field1-$field2
127360521Sdelphij		os=$field3-$field4
128267843Sdelphij		;;
129360521Sdelphij	*-*-*)
130360521Sdelphij		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
131360521Sdelphij		# parts
132360521Sdelphij		maybe_os=$field2-$field3
133360521Sdelphij		case $maybe_os in
134360521Sdelphij			nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
135360521Sdelphij			| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
136360521Sdelphij			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
137360521Sdelphij			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
138360521Sdelphij			| storm-chaos* | os2-emx* | rtmk-nova*)
139360521Sdelphij				basic_machine=$field1
140360521Sdelphij				os=$maybe_os
141360521Sdelphij				;;
142360521Sdelphij			android-linux)
143360521Sdelphij				basic_machine=$field1-unknown
144360521Sdelphij				os=linux-android
145360521Sdelphij				;;
146360521Sdelphij			*)
147360521Sdelphij				basic_machine=$field1-$field2
148360521Sdelphij				os=$field3
149360521Sdelphij				;;
150360521Sdelphij		esac
151267843Sdelphij		;;
152360521Sdelphij	*-*)
153360521Sdelphij		# A lone config we happen to match not fitting any pattern
154360521Sdelphij		case $field1-$field2 in
155360521Sdelphij			decstation-3100)
156360521Sdelphij				basic_machine=mips-dec
157360521Sdelphij				os=
158360521Sdelphij				;;
159360521Sdelphij			*-*)
160360521Sdelphij				# Second component is usually, but not always the OS
161360521Sdelphij				case $field2 in
162360521Sdelphij					# Prevent following clause from handling this valid os
163360521Sdelphij					sun*os*)
164360521Sdelphij						basic_machine=$field1
165360521Sdelphij						os=$field2
166360521Sdelphij						;;
167360521Sdelphij					# Manufacturers
168360521Sdelphij					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
169360521Sdelphij					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
170360521Sdelphij					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
171360521Sdelphij					| convergent* | ncr* | news | 32* | 3600* | 3100* \
172360521Sdelphij					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
173360521Sdelphij					| ultra | tti* | harris | dolphin | highlevel | gould \
174360521Sdelphij					| cbm | ns | masscomp | apple | axis | knuth | cray \
175360521Sdelphij					| microblaze* | sim | cisco \
176360521Sdelphij					| oki | wec | wrs | winbond)
177360521Sdelphij						basic_machine=$field1-$field2
178360521Sdelphij						os=
179360521Sdelphij						;;
180360521Sdelphij					*)
181360521Sdelphij						basic_machine=$field1
182360521Sdelphij						os=$field2
183360521Sdelphij						;;
184360521Sdelphij				esac
185360521Sdelphij			;;
186360521Sdelphij		esac
187267843Sdelphij		;;
188360521Sdelphij	*)
189360521Sdelphij		# Convert single-component short-hands not valid as part of
190360521Sdelphij		# multi-component configurations.
191360521Sdelphij		case $field1 in
192360521Sdelphij			386bsd)
193360521Sdelphij				basic_machine=i386-pc
194360521Sdelphij				os=bsd
195360521Sdelphij				;;
196360521Sdelphij			a29khif)
197360521Sdelphij				basic_machine=a29k-amd
198360521Sdelphij				os=udi
199360521Sdelphij				;;
200360521Sdelphij			adobe68k)
201360521Sdelphij				basic_machine=m68010-adobe
202360521Sdelphij				os=scout
203360521Sdelphij				;;
204360521Sdelphij			alliant)
205360521Sdelphij				basic_machine=fx80-alliant
206360521Sdelphij				os=
207360521Sdelphij				;;
208360521Sdelphij			altos | altos3068)
209360521Sdelphij				basic_machine=m68k-altos
210360521Sdelphij				os=
211360521Sdelphij				;;
212360521Sdelphij			am29k)
213360521Sdelphij				basic_machine=a29k-none
214360521Sdelphij				os=bsd
215360521Sdelphij				;;
216360521Sdelphij			amdahl)
217360521Sdelphij				basic_machine=580-amdahl
218360521Sdelphij				os=sysv
219360521Sdelphij				;;
220360521Sdelphij			amiga)
221360521Sdelphij				basic_machine=m68k-unknown
222360521Sdelphij				os=
223360521Sdelphij				;;
224360521Sdelphij			amigaos | amigados)
225360521Sdelphij				basic_machine=m68k-unknown
226360521Sdelphij				os=amigaos
227360521Sdelphij				;;
228360521Sdelphij			amigaunix | amix)
229360521Sdelphij				basic_machine=m68k-unknown
230360521Sdelphij				os=sysv4
231360521Sdelphij				;;
232360521Sdelphij			apollo68)
233360521Sdelphij				basic_machine=m68k-apollo
234360521Sdelphij				os=sysv
235360521Sdelphij				;;
236360521Sdelphij			apollo68bsd)
237360521Sdelphij				basic_machine=m68k-apollo
238360521Sdelphij				os=bsd
239360521Sdelphij				;;
240360521Sdelphij			aros)
241360521Sdelphij				basic_machine=i386-pc
242360521Sdelphij				os=aros
243360521Sdelphij				;;
244360521Sdelphij			aux)
245360521Sdelphij				basic_machine=m68k-apple
246360521Sdelphij				os=aux
247360521Sdelphij				;;
248360521Sdelphij			balance)
249360521Sdelphij				basic_machine=ns32k-sequent
250360521Sdelphij				os=dynix
251360521Sdelphij				;;
252360521Sdelphij			blackfin)
253360521Sdelphij				basic_machine=bfin-unknown
254360521Sdelphij				os=linux
255360521Sdelphij				;;
256360521Sdelphij			cegcc)
257360521Sdelphij				basic_machine=arm-unknown
258360521Sdelphij				os=cegcc
259360521Sdelphij				;;
260360521Sdelphij			convex-c1)
261360521Sdelphij				basic_machine=c1-convex
262360521Sdelphij				os=bsd
263360521Sdelphij				;;
264360521Sdelphij			convex-c2)
265360521Sdelphij				basic_machine=c2-convex
266360521Sdelphij				os=bsd
267360521Sdelphij				;;
268360521Sdelphij			convex-c32)
269360521Sdelphij				basic_machine=c32-convex
270360521Sdelphij				os=bsd
271360521Sdelphij				;;
272360521Sdelphij			convex-c34)
273360521Sdelphij				basic_machine=c34-convex
274360521Sdelphij				os=bsd
275360521Sdelphij				;;
276360521Sdelphij			convex-c38)
277360521Sdelphij				basic_machine=c38-convex
278360521Sdelphij				os=bsd
279360521Sdelphij				;;
280360521Sdelphij			cray)
281360521Sdelphij				basic_machine=j90-cray
282360521Sdelphij				os=unicos
283360521Sdelphij				;;
284360521Sdelphij			crds | unos)
285360521Sdelphij				basic_machine=m68k-crds
286360521Sdelphij				os=
287360521Sdelphij				;;
288360521Sdelphij			da30)
289360521Sdelphij				basic_machine=m68k-da30
290360521Sdelphij				os=
291360521Sdelphij				;;
292360521Sdelphij			decstation | pmax | pmin | dec3100 | decstatn)
293360521Sdelphij				basic_machine=mips-dec
294360521Sdelphij				os=
295360521Sdelphij				;;
296360521Sdelphij			delta88)
297360521Sdelphij				basic_machine=m88k-motorola
298360521Sdelphij				os=sysv3
299360521Sdelphij				;;
300360521Sdelphij			dicos)
301360521Sdelphij				basic_machine=i686-pc
302360521Sdelphij				os=dicos
303360521Sdelphij				;;
304360521Sdelphij			djgpp)
305360521Sdelphij				basic_machine=i586-pc
306360521Sdelphij				os=msdosdjgpp
307360521Sdelphij				;;
308360521Sdelphij			ebmon29k)
309360521Sdelphij				basic_machine=a29k-amd
310360521Sdelphij				os=ebmon
311360521Sdelphij				;;
312360521Sdelphij			es1800 | OSE68k | ose68k | ose | OSE)
313360521Sdelphij				basic_machine=m68k-ericsson
314360521Sdelphij				os=ose
315360521Sdelphij				;;
316360521Sdelphij			gmicro)
317360521Sdelphij				basic_machine=tron-gmicro
318360521Sdelphij				os=sysv
319360521Sdelphij				;;
320360521Sdelphij			go32)
321360521Sdelphij				basic_machine=i386-pc
322360521Sdelphij				os=go32
323360521Sdelphij				;;
324360521Sdelphij			h8300hms)
325360521Sdelphij				basic_machine=h8300-hitachi
326360521Sdelphij				os=hms
327360521Sdelphij				;;
328360521Sdelphij			h8300xray)
329360521Sdelphij				basic_machine=h8300-hitachi
330360521Sdelphij				os=xray
331360521Sdelphij				;;
332360521Sdelphij			h8500hms)
333360521Sdelphij				basic_machine=h8500-hitachi
334360521Sdelphij				os=hms
335360521Sdelphij				;;
336360521Sdelphij			harris)
337360521Sdelphij				basic_machine=m88k-harris
338360521Sdelphij				os=sysv3
339360521Sdelphij				;;
340360521Sdelphij			hp300)
341360521Sdelphij				basic_machine=m68k-hp
342360521Sdelphij				;;
343360521Sdelphij			hp300bsd)
344360521Sdelphij				basic_machine=m68k-hp
345360521Sdelphij				os=bsd
346360521Sdelphij				;;
347360521Sdelphij			hp300hpux)
348360521Sdelphij				basic_machine=m68k-hp
349360521Sdelphij				os=hpux
350360521Sdelphij				;;
351360521Sdelphij			hppaosf)
352360521Sdelphij				basic_machine=hppa1.1-hp
353360521Sdelphij				os=osf
354360521Sdelphij				;;
355360521Sdelphij			hppro)
356360521Sdelphij				basic_machine=hppa1.1-hp
357360521Sdelphij				os=proelf
358360521Sdelphij				;;
359360521Sdelphij			i386mach)
360360521Sdelphij				basic_machine=i386-mach
361360521Sdelphij				os=mach
362360521Sdelphij				;;
363360521Sdelphij			vsta)
364360521Sdelphij				basic_machine=i386-pc
365360521Sdelphij				os=vsta
366360521Sdelphij				;;
367360521Sdelphij			isi68 | isi)
368360521Sdelphij				basic_machine=m68k-isi
369360521Sdelphij				os=sysv
370360521Sdelphij				;;
371360521Sdelphij			m68knommu)
372360521Sdelphij				basic_machine=m68k-unknown
373360521Sdelphij				os=linux
374360521Sdelphij				;;
375360521Sdelphij			magnum | m3230)
376360521Sdelphij				basic_machine=mips-mips
377360521Sdelphij				os=sysv
378360521Sdelphij				;;
379360521Sdelphij			merlin)
380360521Sdelphij				basic_machine=ns32k-utek
381360521Sdelphij				os=sysv
382360521Sdelphij				;;
383360521Sdelphij			mingw64)
384360521Sdelphij				basic_machine=x86_64-pc
385360521Sdelphij				os=mingw64
386360521Sdelphij				;;
387360521Sdelphij			mingw32)
388360521Sdelphij				basic_machine=i686-pc
389360521Sdelphij				os=mingw32
390360521Sdelphij				;;
391360521Sdelphij			mingw32ce)
392360521Sdelphij				basic_machine=arm-unknown
393360521Sdelphij				os=mingw32ce
394360521Sdelphij				;;
395360521Sdelphij			monitor)
396360521Sdelphij				basic_machine=m68k-rom68k
397360521Sdelphij				os=coff
398360521Sdelphij				;;
399360521Sdelphij			morphos)
400360521Sdelphij				basic_machine=powerpc-unknown
401360521Sdelphij				os=morphos
402360521Sdelphij				;;
403360521Sdelphij			moxiebox)
404360521Sdelphij				basic_machine=moxie-unknown
405360521Sdelphij				os=moxiebox
406360521Sdelphij				;;
407360521Sdelphij			msdos)
408360521Sdelphij				basic_machine=i386-pc
409360521Sdelphij				os=msdos
410360521Sdelphij				;;
411360521Sdelphij			msys)
412360521Sdelphij				basic_machine=i686-pc
413360521Sdelphij				os=msys
414360521Sdelphij				;;
415360521Sdelphij			mvs)
416360521Sdelphij				basic_machine=i370-ibm
417360521Sdelphij				os=mvs
418360521Sdelphij				;;
419360521Sdelphij			nacl)
420360521Sdelphij				basic_machine=le32-unknown
421360521Sdelphij				os=nacl
422360521Sdelphij				;;
423360521Sdelphij			ncr3000)
424360521Sdelphij				basic_machine=i486-ncr
425360521Sdelphij				os=sysv4
426360521Sdelphij				;;
427360521Sdelphij			netbsd386)
428360521Sdelphij				basic_machine=i386-pc
429360521Sdelphij				os=netbsd
430360521Sdelphij				;;
431360521Sdelphij			netwinder)
432360521Sdelphij				basic_machine=armv4l-rebel
433360521Sdelphij				os=linux
434360521Sdelphij				;;
435360521Sdelphij			news | news700 | news800 | news900)
436360521Sdelphij				basic_machine=m68k-sony
437360521Sdelphij				os=newsos
438360521Sdelphij				;;
439360521Sdelphij			news1000)
440360521Sdelphij				basic_machine=m68030-sony
441360521Sdelphij				os=newsos
442360521Sdelphij				;;
443360521Sdelphij			necv70)
444360521Sdelphij				basic_machine=v70-nec
445360521Sdelphij				os=sysv
446360521Sdelphij				;;
447360521Sdelphij			nh3000)
448360521Sdelphij				basic_machine=m68k-harris
449360521Sdelphij				os=cxux
450360521Sdelphij				;;
451360521Sdelphij			nh[45]000)
452360521Sdelphij				basic_machine=m88k-harris
453360521Sdelphij				os=cxux
454360521Sdelphij				;;
455360521Sdelphij			nindy960)
456360521Sdelphij				basic_machine=i960-intel
457360521Sdelphij				os=nindy
458360521Sdelphij				;;
459360521Sdelphij			mon960)
460360521Sdelphij				basic_machine=i960-intel
461360521Sdelphij				os=mon960
462360521Sdelphij				;;
463360521Sdelphij			nonstopux)
464360521Sdelphij				basic_machine=mips-compaq
465360521Sdelphij				os=nonstopux
466360521Sdelphij				;;
467360521Sdelphij			os400)
468360521Sdelphij				basic_machine=powerpc-ibm
469360521Sdelphij				os=os400
470360521Sdelphij				;;
471360521Sdelphij			OSE68000 | ose68000)
472360521Sdelphij				basic_machine=m68000-ericsson
473360521Sdelphij				os=ose
474360521Sdelphij				;;
475360521Sdelphij			os68k)
476360521Sdelphij				basic_machine=m68k-none
477360521Sdelphij				os=os68k
478360521Sdelphij				;;
479360521Sdelphij			paragon)
480360521Sdelphij				basic_machine=i860-intel
481360521Sdelphij				os=osf
482360521Sdelphij				;;
483360521Sdelphij			parisc)
484360521Sdelphij				basic_machine=hppa-unknown
485360521Sdelphij				os=linux
486360521Sdelphij				;;
487360521Sdelphij			pw32)
488360521Sdelphij				basic_machine=i586-unknown
489360521Sdelphij				os=pw32
490360521Sdelphij				;;
491360521Sdelphij			rdos | rdos64)
492360521Sdelphij				basic_machine=x86_64-pc
493360521Sdelphij				os=rdos
494360521Sdelphij				;;
495360521Sdelphij			rdos32)
496360521Sdelphij				basic_machine=i386-pc
497360521Sdelphij				os=rdos
498360521Sdelphij				;;
499360521Sdelphij			rom68k)
500360521Sdelphij				basic_machine=m68k-rom68k
501360521Sdelphij				os=coff
502360521Sdelphij				;;
503360521Sdelphij			sa29200)
504360521Sdelphij				basic_machine=a29k-amd
505360521Sdelphij				os=udi
506360521Sdelphij				;;
507360521Sdelphij			sei)
508360521Sdelphij				basic_machine=mips-sei
509360521Sdelphij				os=seiux
510360521Sdelphij				;;
511360521Sdelphij			sequent)
512360521Sdelphij				basic_machine=i386-sequent
513360521Sdelphij				os=
514360521Sdelphij				;;
515360521Sdelphij			sps7)
516360521Sdelphij				basic_machine=m68k-bull
517360521Sdelphij				os=sysv2
518360521Sdelphij				;;
519360521Sdelphij			st2000)
520360521Sdelphij				basic_machine=m68k-tandem
521360521Sdelphij				os=
522360521Sdelphij				;;
523360521Sdelphij			stratus)
524360521Sdelphij				basic_machine=i860-stratus
525360521Sdelphij				os=sysv4
526360521Sdelphij				;;
527360521Sdelphij			sun2)
528360521Sdelphij				basic_machine=m68000-sun
529360521Sdelphij				os=
530360521Sdelphij				;;
531360521Sdelphij			sun2os3)
532360521Sdelphij				basic_machine=m68000-sun
533360521Sdelphij				os=sunos3
534360521Sdelphij				;;
535360521Sdelphij			sun2os4)
536360521Sdelphij				basic_machine=m68000-sun
537360521Sdelphij				os=sunos4
538360521Sdelphij				;;
539360521Sdelphij			sun3)
540360521Sdelphij				basic_machine=m68k-sun
541360521Sdelphij				os=
542360521Sdelphij				;;
543360521Sdelphij			sun3os3)
544360521Sdelphij				basic_machine=m68k-sun
545360521Sdelphij				os=sunos3
546360521Sdelphij				;;
547360521Sdelphij			sun3os4)
548360521Sdelphij				basic_machine=m68k-sun
549360521Sdelphij				os=sunos4
550360521Sdelphij				;;
551360521Sdelphij			sun4)
552360521Sdelphij				basic_machine=sparc-sun
553360521Sdelphij				os=
554360521Sdelphij				;;
555360521Sdelphij			sun4os3)
556360521Sdelphij				basic_machine=sparc-sun
557360521Sdelphij				os=sunos3
558360521Sdelphij				;;
559360521Sdelphij			sun4os4)
560360521Sdelphij				basic_machine=sparc-sun
561360521Sdelphij				os=sunos4
562360521Sdelphij				;;
563360521Sdelphij			sun4sol2)
564360521Sdelphij				basic_machine=sparc-sun
565360521Sdelphij				os=solaris2
566360521Sdelphij				;;
567360521Sdelphij			sun386 | sun386i | roadrunner)
568360521Sdelphij				basic_machine=i386-sun
569360521Sdelphij				os=
570360521Sdelphij				;;
571360521Sdelphij			sv1)
572360521Sdelphij				basic_machine=sv1-cray
573360521Sdelphij				os=unicos
574360521Sdelphij				;;
575360521Sdelphij			symmetry)
576360521Sdelphij				basic_machine=i386-sequent
577360521Sdelphij				os=dynix
578360521Sdelphij				;;
579360521Sdelphij			t3e)
580360521Sdelphij				basic_machine=alphaev5-cray
581360521Sdelphij				os=unicos
582360521Sdelphij				;;
583360521Sdelphij			t90)
584360521Sdelphij				basic_machine=t90-cray
585360521Sdelphij				os=unicos
586360521Sdelphij				;;
587360521Sdelphij			toad1)
588360521Sdelphij				basic_machine=pdp10-xkl
589360521Sdelphij				os=tops20
590360521Sdelphij				;;
591360521Sdelphij			tpf)
592360521Sdelphij				basic_machine=s390x-ibm
593360521Sdelphij				os=tpf
594360521Sdelphij				;;
595360521Sdelphij			udi29k)
596360521Sdelphij				basic_machine=a29k-amd
597360521Sdelphij				os=udi
598360521Sdelphij				;;
599360521Sdelphij			ultra3)
600360521Sdelphij				basic_machine=a29k-nyu
601360521Sdelphij				os=sym1
602360521Sdelphij				;;
603360521Sdelphij			v810 | necv810)
604360521Sdelphij				basic_machine=v810-nec
605360521Sdelphij				os=none
606360521Sdelphij				;;
607360521Sdelphij			vaxv)
608360521Sdelphij				basic_machine=vax-dec
609360521Sdelphij				os=sysv
610360521Sdelphij				;;
611360521Sdelphij			vms)
612360521Sdelphij				basic_machine=vax-dec
613360521Sdelphij				os=vms
614360521Sdelphij				;;
615360521Sdelphij			vxworks960)
616360521Sdelphij				basic_machine=i960-wrs
617360521Sdelphij				os=vxworks
618360521Sdelphij				;;
619360521Sdelphij			vxworks68)
620360521Sdelphij				basic_machine=m68k-wrs
621360521Sdelphij				os=vxworks
622360521Sdelphij				;;
623360521Sdelphij			vxworks29k)
624360521Sdelphij				basic_machine=a29k-wrs
625360521Sdelphij				os=vxworks
626360521Sdelphij				;;
627360521Sdelphij			xbox)
628360521Sdelphij				basic_machine=i686-pc
629360521Sdelphij				os=mingw32
630360521Sdelphij				;;
631360521Sdelphij			ymp)
632360521Sdelphij				basic_machine=ymp-cray
633360521Sdelphij				os=unicos
634360521Sdelphij				;;
635360521Sdelphij			*)
636360521Sdelphij				basic_machine=$1
637360521Sdelphij				os=
638360521Sdelphij				;;
639360521Sdelphij		esac
640267843Sdelphij		;;
641267843Sdelphijesac
642267843Sdelphij
643360521Sdelphij# Decode 1-component or ad-hoc basic machines
644267843Sdelphijcase $basic_machine in
645360521Sdelphij	# Here we handle the default manufacturer of certain CPU types.  It is in
646360521Sdelphij	# some cases the only manufacturer, in others, it is the most popular.
647360521Sdelphij	w89k)
648360521Sdelphij		cpu=hppa1.1
649360521Sdelphij		vendor=winbond
650267843Sdelphij		;;
651360521Sdelphij	op50n)
652360521Sdelphij		cpu=hppa1.1
653360521Sdelphij		vendor=oki
654267843Sdelphij		;;
655360521Sdelphij	op60c)
656360521Sdelphij		cpu=hppa1.1
657360521Sdelphij		vendor=oki
658267843Sdelphij		;;
659360521Sdelphij	ibm*)
660360521Sdelphij		cpu=i370
661360521Sdelphij		vendor=ibm
662267843Sdelphij		;;
663360521Sdelphij	orion105)
664360521Sdelphij		cpu=clipper
665360521Sdelphij		vendor=highlevel
666309847Sdelphij		;;
667360521Sdelphij	mac | mpw | mac-mpw)
668360521Sdelphij		cpu=m68k
669360521Sdelphij		vendor=apple
670267843Sdelphij		;;
671360521Sdelphij	pmac | pmac-mpw)
672360521Sdelphij		cpu=powerpc
673360521Sdelphij		vendor=apple
674267843Sdelphij		;;
675267843Sdelphij
676267843Sdelphij	# Recognize the various machine names and aliases which stand
677267843Sdelphij	# for a CPU type and a company and sometimes even an OS.
678267843Sdelphij	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
679360521Sdelphij		cpu=m68000
680360521Sdelphij		vendor=att
681267843Sdelphij		;;
682267843Sdelphij	3b*)
683360521Sdelphij		cpu=we32k
684360521Sdelphij		vendor=att
685267843Sdelphij		;;
686267843Sdelphij	bluegene*)
687360521Sdelphij		cpu=powerpc
688360521Sdelphij		vendor=ibm
689360521Sdelphij		os=cnk
690267843Sdelphij		;;
691267843Sdelphij	decsystem10* | dec10*)
692360521Sdelphij		cpu=pdp10
693360521Sdelphij		vendor=dec
694360521Sdelphij		os=tops10
695267843Sdelphij		;;
696267843Sdelphij	decsystem20* | dec20*)
697360521Sdelphij		cpu=pdp10
698360521Sdelphij		vendor=dec
699360521Sdelphij		os=tops20
700267843Sdelphij		;;
701267843Sdelphij	delta | 3300 | motorola-3300 | motorola-delta \
702267843Sdelphij	      | 3300-motorola | delta-motorola)
703360521Sdelphij		cpu=m68k
704360521Sdelphij		vendor=motorola
705267843Sdelphij		;;
706360521Sdelphij	dpx2*)
707360521Sdelphij		cpu=m68k
708360521Sdelphij		vendor=bull
709360521Sdelphij		os=sysv3
710267843Sdelphij		;;
711360521Sdelphij	encore | umax | mmax)
712360521Sdelphij		cpu=ns32k
713360521Sdelphij		vendor=encore
714267843Sdelphij		;;
715267843Sdelphij	elxsi)
716360521Sdelphij		cpu=elxsi
717360521Sdelphij		vendor=elxsi
718360521Sdelphij		os=${os:-bsd}
719267843Sdelphij		;;
720267843Sdelphij	fx2800)
721360521Sdelphij		cpu=i860
722360521Sdelphij		vendor=alliant
723267843Sdelphij		;;
724267843Sdelphij	genix)
725360521Sdelphij		cpu=ns32k
726360521Sdelphij		vendor=ns
727267843Sdelphij		;;
728267843Sdelphij	h3050r* | hiux*)
729360521Sdelphij		cpu=hppa1.1
730360521Sdelphij		vendor=hitachi
731360521Sdelphij		os=hiuxwe2
732267843Sdelphij		;;
733267843Sdelphij	hp3k9[0-9][0-9] | hp9[0-9][0-9])
734360521Sdelphij		cpu=hppa1.0
735360521Sdelphij		vendor=hp
736267843Sdelphij		;;
737267843Sdelphij	hp9k2[0-9][0-9] | hp9k31[0-9])
738360521Sdelphij		cpu=m68000
739360521Sdelphij		vendor=hp
740267843Sdelphij		;;
741267843Sdelphij	hp9k3[2-9][0-9])
742360521Sdelphij		cpu=m68k
743360521Sdelphij		vendor=hp
744267843Sdelphij		;;
745267843Sdelphij	hp9k6[0-9][0-9] | hp6[0-9][0-9])
746360521Sdelphij		cpu=hppa1.0
747360521Sdelphij		vendor=hp
748267843Sdelphij		;;
749267843Sdelphij	hp9k7[0-79][0-9] | hp7[0-79][0-9])
750360521Sdelphij		cpu=hppa1.1
751360521Sdelphij		vendor=hp
752267843Sdelphij		;;
753267843Sdelphij	hp9k78[0-9] | hp78[0-9])
754267843Sdelphij		# FIXME: really hppa2.0-hp
755360521Sdelphij		cpu=hppa1.1
756360521Sdelphij		vendor=hp
757267843Sdelphij		;;
758267843Sdelphij	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
759267843Sdelphij		# FIXME: really hppa2.0-hp
760360521Sdelphij		cpu=hppa1.1
761360521Sdelphij		vendor=hp
762267843Sdelphij		;;
763267843Sdelphij	hp9k8[0-9][13679] | hp8[0-9][13679])
764360521Sdelphij		cpu=hppa1.1
765360521Sdelphij		vendor=hp
766267843Sdelphij		;;
767267843Sdelphij	hp9k8[0-9][0-9] | hp8[0-9][0-9])
768360521Sdelphij		cpu=hppa1.0
769360521Sdelphij		vendor=hp
770267843Sdelphij		;;
771267843Sdelphij	i*86v32)
772360521Sdelphij		cpu=`echo "$1" | sed -e 's/86.*/86/'`
773360521Sdelphij		vendor=pc
774360521Sdelphij		os=sysv32
775267843Sdelphij		;;
776267843Sdelphij	i*86v4*)
777360521Sdelphij		cpu=`echo "$1" | sed -e 's/86.*/86/'`
778360521Sdelphij		vendor=pc
779360521Sdelphij		os=sysv4
780267843Sdelphij		;;
781267843Sdelphij	i*86v)
782360521Sdelphij		cpu=`echo "$1" | sed -e 's/86.*/86/'`
783360521Sdelphij		vendor=pc
784360521Sdelphij		os=sysv
785267843Sdelphij		;;
786267843Sdelphij	i*86sol2)
787360521Sdelphij		cpu=`echo "$1" | sed -e 's/86.*/86/'`
788360521Sdelphij		vendor=pc
789360521Sdelphij		os=solaris2
790267843Sdelphij		;;
791360521Sdelphij	j90 | j90-cray)
792360521Sdelphij		cpu=j90
793360521Sdelphij		vendor=cray
794360521Sdelphij		os=${os:-unicos}
795267843Sdelphij		;;
796267843Sdelphij	iris | iris4d)
797360521Sdelphij		cpu=mips
798360521Sdelphij		vendor=sgi
799267843Sdelphij		case $os in
800360521Sdelphij		    irix*)
801267843Sdelphij			;;
802267843Sdelphij		    *)
803360521Sdelphij			os=irix4
804267843Sdelphij			;;
805267843Sdelphij		esac
806267843Sdelphij		;;
807267843Sdelphij	miniframe)
808360521Sdelphij		cpu=m68000
809360521Sdelphij		vendor=convergent
810267843Sdelphij		;;
811360521Sdelphij	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
812360521Sdelphij		cpu=m68k
813360521Sdelphij		vendor=atari
814360521Sdelphij		os=mint
815267843Sdelphij		;;
816267843Sdelphij	news-3600 | risc-news)
817360521Sdelphij		cpu=mips
818360521Sdelphij		vendor=sony
819360521Sdelphij		os=newsos
820267843Sdelphij		;;
821360521Sdelphij	next | m*-next)
822360521Sdelphij		cpu=m68k
823360521Sdelphij		vendor=next
824267843Sdelphij		case $os in
825360521Sdelphij		    nextstep* )
826267843Sdelphij			;;
827360521Sdelphij		    ns2*)
828360521Sdelphij		      os=nextstep2
829267843Sdelphij			;;
830267843Sdelphij		    *)
831360521Sdelphij		      os=nextstep3
832267843Sdelphij			;;
833267843Sdelphij		esac
834267843Sdelphij		;;
835267843Sdelphij	np1)
836360521Sdelphij		cpu=np1
837360521Sdelphij		vendor=gould
838267843Sdelphij		;;
839267843Sdelphij	op50n-* | op60c-*)
840360521Sdelphij		cpu=hppa1.1
841360521Sdelphij		vendor=oki
842360521Sdelphij		os=proelf
843267843Sdelphij		;;
844267843Sdelphij	pa-hitachi)
845360521Sdelphij		cpu=hppa1.1
846360521Sdelphij		vendor=hitachi
847360521Sdelphij		os=hiuxwe2
848267843Sdelphij		;;
849267843Sdelphij	pbd)
850360521Sdelphij		cpu=sparc
851360521Sdelphij		vendor=tti
852267843Sdelphij		;;
853267843Sdelphij	pbb)
854360521Sdelphij		cpu=m68k
855360521Sdelphij		vendor=tti
856267843Sdelphij		;;
857360521Sdelphij	pc532)
858360521Sdelphij		cpu=ns32k
859360521Sdelphij		vendor=pc532
860267843Sdelphij		;;
861267843Sdelphij	pn)
862360521Sdelphij		cpu=pn
863360521Sdelphij		vendor=gould
864267843Sdelphij		;;
865360521Sdelphij	power)
866360521Sdelphij		cpu=power
867360521Sdelphij		vendor=ibm
868267843Sdelphij		;;
869267843Sdelphij	ps2)
870360521Sdelphij		cpu=i386
871360521Sdelphij		vendor=ibm
872267843Sdelphij		;;
873267843Sdelphij	rm[46]00)
874360521Sdelphij		cpu=mips
875360521Sdelphij		vendor=siemens
876267843Sdelphij		;;
877267843Sdelphij	rtpc | rtpc-*)
878360521Sdelphij		cpu=romp
879360521Sdelphij		vendor=ibm
880267843Sdelphij		;;
881360521Sdelphij	sde)
882360521Sdelphij		cpu=mipsisa32
883360521Sdelphij		vendor=sde
884360521Sdelphij		os=${os:-elf}
885267843Sdelphij		;;
886360521Sdelphij	simso-wrs)
887360521Sdelphij		cpu=sparclite
888360521Sdelphij		vendor=wrs
889360521Sdelphij		os=vxworks
890267843Sdelphij		;;
891360521Sdelphij	tower | tower-32)
892360521Sdelphij		cpu=m68k
893360521Sdelphij		vendor=ncr
894267843Sdelphij		;;
895360521Sdelphij	vpp*|vx|vx-*)
896360521Sdelphij		cpu=f301
897360521Sdelphij		vendor=fujitsu
898267843Sdelphij		;;
899360521Sdelphij	w65)
900360521Sdelphij		cpu=w65
901360521Sdelphij		vendor=wdc
902267843Sdelphij		;;
903360521Sdelphij	w89k-*)
904360521Sdelphij		cpu=hppa1.1
905360521Sdelphij		vendor=winbond
906360521Sdelphij		os=proelf
907267843Sdelphij		;;
908360521Sdelphij	none)
909360521Sdelphij		cpu=none
910360521Sdelphij		vendor=none
911267843Sdelphij		;;
912360521Sdelphij	leon|leon[3-9])
913360521Sdelphij		cpu=sparc
914360521Sdelphij		vendor=$basic_machine
915267843Sdelphij		;;
916360521Sdelphij	leon-*|leon[3-9]-*)
917360521Sdelphij		cpu=sparc
918360521Sdelphij		vendor=`echo "$basic_machine" | sed 's/-.*//'`
919267843Sdelphij		;;
920360521Sdelphij
921360521Sdelphij	*-*)
922360521Sdelphij		# shellcheck disable=SC2162
923360521Sdelphij		IFS="-" read cpu vendor <<EOF
924360521Sdelphij$basic_machine
925360521SdelphijEOF
926267843Sdelphij		;;
927360521Sdelphij	# We use `pc' rather than `unknown'
928360521Sdelphij	# because (1) that's what they normally are, and
929360521Sdelphij	# (2) the word "unknown" tends to confuse beginning users.
930360521Sdelphij	i*86 | x86_64)
931360521Sdelphij		cpu=$basic_machine
932360521Sdelphij		vendor=pc
933267843Sdelphij		;;
934360521Sdelphij	# These rules are duplicated from below for sake of the special case above;
935360521Sdelphij	# i.e. things that normalized to x86 arches should also default to "pc"
936360521Sdelphij	pc98)
937360521Sdelphij		cpu=i386
938360521Sdelphij		vendor=pc
939267843Sdelphij		;;
940360521Sdelphij	x64 | amd64)
941360521Sdelphij		cpu=x86_64
942360521Sdelphij		vendor=pc
943267843Sdelphij		;;
944360521Sdelphij	# Recognize the basic CPU types without company name.
945360521Sdelphij	*)
946360521Sdelphij		cpu=$basic_machine
947360521Sdelphij		vendor=unknown
948267843Sdelphij		;;
949360521Sdelphijesac
950360521Sdelphij
951360521Sdelphijunset -v basic_machine
952360521Sdelphij
953360521Sdelphij# Decode basic machines in the full and proper CPU-Company form.
954360521Sdelphijcase $cpu-$vendor in
955360521Sdelphij	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
956360521Sdelphij	# some cases the only manufacturer, in others, it is the most popular.
957360521Sdelphij	craynv-unknown)
958360521Sdelphij		vendor=cray
959360521Sdelphij		os=${os:-unicosmp}
960267843Sdelphij		;;
961360521Sdelphij	c90-unknown | c90-cray)
962360521Sdelphij		vendor=cray
963360521Sdelphij		os=${os:-unicos}
964267843Sdelphij		;;
965360521Sdelphij	fx80-unknown)
966360521Sdelphij		vendor=alliant
967267843Sdelphij		;;
968360521Sdelphij	romp-unknown)
969360521Sdelphij		vendor=ibm
970267843Sdelphij		;;
971360521Sdelphij	mmix-unknown)
972360521Sdelphij		vendor=knuth
973267843Sdelphij		;;
974360521Sdelphij	microblaze-unknown | microblazeel-unknown)
975360521Sdelphij		vendor=xilinx
976267843Sdelphij		;;
977360521Sdelphij	rs6000-unknown)
978360521Sdelphij		vendor=ibm
979267843Sdelphij		;;
980360521Sdelphij	vax-unknown)
981360521Sdelphij		vendor=dec
982267843Sdelphij		;;
983360521Sdelphij	pdp11-unknown)
984360521Sdelphij		vendor=dec
985267843Sdelphij		;;
986360521Sdelphij	we32k-unknown)
987360521Sdelphij		vendor=att
988267843Sdelphij		;;
989360521Sdelphij	cydra-unknown)
990360521Sdelphij		vendor=cydrome
991267843Sdelphij		;;
992360521Sdelphij	i370-ibm*)
993360521Sdelphij		vendor=ibm
994267843Sdelphij		;;
995360521Sdelphij	orion-unknown)
996360521Sdelphij		vendor=highlevel
997267843Sdelphij		;;
998360521Sdelphij	xps-unknown | xps100-unknown)
999360521Sdelphij		cpu=xps100
1000360521Sdelphij		vendor=honeywell
1001267843Sdelphij		;;
1002360521Sdelphij
1003360521Sdelphij	# Here we normalize CPU types with a missing or matching vendor
1004360521Sdelphij	dpx20-unknown | dpx20-bull)
1005360521Sdelphij		cpu=rs6000
1006360521Sdelphij		vendor=bull
1007360521Sdelphij		os=${os:-bosx}
1008267843Sdelphij		;;
1009360521Sdelphij
1010360521Sdelphij	# Here we normalize CPU types irrespective of the vendor
1011360521Sdelphij	amd64-*)
1012360521Sdelphij		cpu=x86_64
1013267843Sdelphij		;;
1014360521Sdelphij	blackfin-*)
1015360521Sdelphij		cpu=bfin
1016360521Sdelphij		os=linux
1017267843Sdelphij		;;
1018360521Sdelphij	c54x-*)
1019360521Sdelphij		cpu=tic54x
1020267843Sdelphij		;;
1021360521Sdelphij	c55x-*)
1022360521Sdelphij		cpu=tic55x
1023267843Sdelphij		;;
1024360521Sdelphij	c6x-*)
1025360521Sdelphij		cpu=tic6x
1026267843Sdelphij		;;
1027360521Sdelphij	e500v[12]-*)
1028360521Sdelphij		cpu=powerpc
1029360521Sdelphij		os=$os"spe"
1030267843Sdelphij		;;
1031360521Sdelphij	mips3*-*)
1032360521Sdelphij		cpu=mips64
1033267843Sdelphij		;;
1034360521Sdelphij	ms1-*)
1035360521Sdelphij		cpu=mt
1036267843Sdelphij		;;
1037360521Sdelphij	m68knommu-*)
1038360521Sdelphij		cpu=m68k
1039360521Sdelphij		os=linux
1040267843Sdelphij		;;
1041360521Sdelphij	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1042360521Sdelphij		cpu=s12z
1043267843Sdelphij		;;
1044360521Sdelphij	openrisc-*)
1045360521Sdelphij		cpu=or32
1046267843Sdelphij		;;
1047360521Sdelphij	parisc-*)
1048360521Sdelphij		cpu=hppa
1049360521Sdelphij		os=linux
1050267843Sdelphij		;;
1051360521Sdelphij	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1052360521Sdelphij		cpu=i586
1053267843Sdelphij		;;
1054360521Sdelphij	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1055360521Sdelphij		cpu=i686
1056267843Sdelphij		;;
1057360521Sdelphij	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1058360521Sdelphij		cpu=i686
1059267843Sdelphij		;;
1060360521Sdelphij	pentium4-*)
1061360521Sdelphij		cpu=i786
1062267843Sdelphij		;;
1063360521Sdelphij	pc98-*)
1064360521Sdelphij		cpu=i386
1065267843Sdelphij		;;
1066360521Sdelphij	ppc-* | ppcbe-*)
1067360521Sdelphij		cpu=powerpc
1068267843Sdelphij		;;
1069360521Sdelphij	ppcle-* | powerpclittle-*)
1070360521Sdelphij		cpu=powerpcle
1071267843Sdelphij		;;
1072360521Sdelphij	ppc64-*)
1073360521Sdelphij		cpu=powerpc64
1074267843Sdelphij		;;
1075360521Sdelphij	ppc64le-* | powerpc64little-*)
1076360521Sdelphij		cpu=powerpc64le
1077267843Sdelphij		;;
1078360521Sdelphij	sb1-*)
1079360521Sdelphij		cpu=mipsisa64sb1
1080267843Sdelphij		;;
1081360521Sdelphij	sb1el-*)
1082360521Sdelphij		cpu=mipsisa64sb1el
1083267843Sdelphij		;;
1084360521Sdelphij	sh5e[lb]-*)
1085360521Sdelphij		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1086267843Sdelphij		;;
1087360521Sdelphij	spur-*)
1088360521Sdelphij		cpu=spur
1089267843Sdelphij		;;
1090360521Sdelphij	strongarm-* | thumb-*)
1091360521Sdelphij		cpu=arm
1092267843Sdelphij		;;
1093360521Sdelphij	tx39-*)
1094360521Sdelphij		cpu=mipstx39
1095267843Sdelphij		;;
1096360521Sdelphij	tx39el-*)
1097360521Sdelphij		cpu=mipstx39el
1098267843Sdelphij		;;
1099360521Sdelphij	x64-*)
1100360521Sdelphij		cpu=x86_64
1101267843Sdelphij		;;
1102360521Sdelphij	xscale-* | xscalee[bl]-*)
1103360521Sdelphij		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1104267843Sdelphij		;;
1105360521Sdelphij
1106360521Sdelphij	# Recognize the canonical CPU Types that limit and/or modify the
1107360521Sdelphij	# company names they are paired with.
1108360521Sdelphij	cr16-*)
1109360521Sdelphij		os=${os:-elf}
1110267843Sdelphij		;;
1111360521Sdelphij	crisv32-* | etraxfs*-*)
1112360521Sdelphij		cpu=crisv32
1113360521Sdelphij		vendor=axis
1114267843Sdelphij		;;
1115360521Sdelphij	cris-* | etrax*-*)
1116360521Sdelphij		cpu=cris
1117360521Sdelphij		vendor=axis
1118267843Sdelphij		;;
1119360521Sdelphij	crx-*)
1120360521Sdelphij		os=${os:-elf}
1121267843Sdelphij		;;
1122360521Sdelphij	neo-tandem)
1123360521Sdelphij		cpu=neo
1124360521Sdelphij		vendor=tandem
1125267843Sdelphij		;;
1126360521Sdelphij	nse-tandem)
1127360521Sdelphij		cpu=nse
1128360521Sdelphij		vendor=tandem
1129267843Sdelphij		;;
1130360521Sdelphij	nsr-tandem)
1131360521Sdelphij		cpu=nsr
1132360521Sdelphij		vendor=tandem
1133267843Sdelphij		;;
1134360521Sdelphij	nsv-tandem)
1135360521Sdelphij		cpu=nsv
1136360521Sdelphij		vendor=tandem
1137267843Sdelphij		;;
1138360521Sdelphij	nsx-tandem)
1139360521Sdelphij		cpu=nsx
1140360521Sdelphij		vendor=tandem
1141267843Sdelphij		;;
1142360521Sdelphij	s390-*)
1143360521Sdelphij		cpu=s390
1144360521Sdelphij		vendor=ibm
1145267843Sdelphij		;;
1146360521Sdelphij	s390x-*)
1147360521Sdelphij		cpu=s390x
1148360521Sdelphij		vendor=ibm
1149267843Sdelphij		;;
1150360521Sdelphij	tile*-*)
1151360521Sdelphij		os=${os:-linux-gnu}
1152267843Sdelphij		;;
1153360521Sdelphij
1154267843Sdelphij	*)
1155360521Sdelphij		# Recognize the canonical CPU types that are allowed with any
1156360521Sdelphij		# company name.
1157360521Sdelphij		case $cpu in
1158360521Sdelphij			1750a | 580 \
1159360521Sdelphij			| a29k \
1160360521Sdelphij			| aarch64 | aarch64_be \
1161360521Sdelphij			| abacus \
1162360521Sdelphij			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1163360521Sdelphij			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1164360521Sdelphij			| alphapca5[67] | alpha64pca5[67] \
1165360521Sdelphij			| am33_2.0 \
1166360521Sdelphij			| amdgcn \
1167360521Sdelphij			| arc | arceb \
1168360521Sdelphij			| arm  | arm[lb]e | arme[lb] | armv* \
1169360521Sdelphij			| avr | avr32 \
1170360521Sdelphij			| asmjs \
1171360521Sdelphij			| ba \
1172360521Sdelphij			| be32 | be64 \
1173360521Sdelphij			| bfin | bs2000 \
1174360521Sdelphij			| c[123]* | c30 | [cjt]90 | c4x \
1175360521Sdelphij			| c8051 | clipper | craynv | csky | cydra \
1176360521Sdelphij			| d10v | d30v | dlx | dsp16xx \
1177360521Sdelphij			| e2k | elxsi | epiphany \
1178360521Sdelphij			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1179360521Sdelphij			| h8300 | h8500 \
1180360521Sdelphij			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1181360521Sdelphij			| hexagon \
1182360521Sdelphij			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
1183360521Sdelphij			| ip2k | iq2000 \
1184360521Sdelphij			| k1om \
1185360521Sdelphij			| le32 | le64 \
1186360521Sdelphij			| lm32 \
1187360521Sdelphij			| m32c | m32r | m32rle \
1188360521Sdelphij			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1189360521Sdelphij			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1190360521Sdelphij			| m88110 | m88k | maxq | mb | mcore | mep | metag \
1191360521Sdelphij			| microblaze | microblazeel \
1192360521Sdelphij			| mips | mipsbe | mipseb | mipsel | mipsle \
1193360521Sdelphij			| mips16 \
1194360521Sdelphij			| mips64 | mips64eb | mips64el \
1195360521Sdelphij			| mips64octeon | mips64octeonel \
1196360521Sdelphij			| mips64orion | mips64orionel \
1197360521Sdelphij			| mips64r5900 | mips64r5900el \
1198360521Sdelphij			| mips64vr | mips64vrel \
1199360521Sdelphij			| mips64vr4100 | mips64vr4100el \
1200360521Sdelphij			| mips64vr4300 | mips64vr4300el \
1201360521Sdelphij			| mips64vr5000 | mips64vr5000el \
1202360521Sdelphij			| mips64vr5900 | mips64vr5900el \
1203360521Sdelphij			| mipsisa32 | mipsisa32el \
1204360521Sdelphij			| mipsisa32r2 | mipsisa32r2el \
1205360521Sdelphij			| mipsisa32r6 | mipsisa32r6el \
1206360521Sdelphij			| mipsisa64 | mipsisa64el \
1207360521Sdelphij			| mipsisa64r2 | mipsisa64r2el \
1208360521Sdelphij			| mipsisa64r6 | mipsisa64r6el \
1209360521Sdelphij			| mipsisa64sb1 | mipsisa64sb1el \
1210360521Sdelphij			| mipsisa64sr71k | mipsisa64sr71kel \
1211360521Sdelphij			| mipsr5900 | mipsr5900el \
1212360521Sdelphij			| mipstx39 | mipstx39el \
1213360521Sdelphij			| mmix \
1214360521Sdelphij			| mn10200 | mn10300 \
1215360521Sdelphij			| moxie \
1216360521Sdelphij			| mt \
1217360521Sdelphij			| msp430 \
1218360521Sdelphij			| nds32 | nds32le | nds32be \
1219360521Sdelphij			| nfp \
1220360521Sdelphij			| nios | nios2 | nios2eb | nios2el \
1221360521Sdelphij			| none | np1 | ns16k | ns32k | nvptx \
1222360521Sdelphij			| open8 \
1223360521Sdelphij			| or1k* \
1224360521Sdelphij			| or32 \
1225360521Sdelphij			| orion \
1226360521Sdelphij			| picochip \
1227360521Sdelphij			| pdp10 | pdp11 | pj | pjl | pn | power \
1228360521Sdelphij			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1229360521Sdelphij			| pru \
1230360521Sdelphij			| pyramid \
1231360521Sdelphij			| riscv | riscv32 | riscv64 \
1232360521Sdelphij			| rl78 | romp | rs6000 | rx \
1233360521Sdelphij			| score \
1234360521Sdelphij			| sh | shl \
1235360521Sdelphij			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1236360521Sdelphij			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1237360521Sdelphij			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1238360521Sdelphij			| sparclite \
1239360521Sdelphij			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1240360521Sdelphij			| spu \
1241360521Sdelphij			| tahoe \
1242360521Sdelphij			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1243360521Sdelphij			| tron \
1244360521Sdelphij			| ubicom32 \
1245360521Sdelphij			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1246360521Sdelphij			| vax \
1247360521Sdelphij			| visium \
1248360521Sdelphij			| w65 | wasm32 \
1249360521Sdelphij			| we32k \
1250360521Sdelphij			| x86 | x86_64 | xc16x | xgate | xps100 \
1251360521Sdelphij			| xstormy16 | xtensa* \
1252360521Sdelphij			| ymp \
1253360521Sdelphij			| z8k | z80)
1254360521Sdelphij				;;
1255360521Sdelphij
1256360521Sdelphij			*)
1257360521Sdelphij				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1258360521Sdelphij				exit 1
1259360521Sdelphij				;;
1260360521Sdelphij		esac
1261267843Sdelphij		;;
1262267843Sdelphijesac
1263267843Sdelphij
1264267843Sdelphij# Here we canonicalize certain aliases for manufacturers.
1265360521Sdelphijcase $vendor in
1266360521Sdelphij	digital*)
1267360521Sdelphij		vendor=dec
1268267843Sdelphij		;;
1269360521Sdelphij	commodore*)
1270360521Sdelphij		vendor=cbm
1271267843Sdelphij		;;
1272267843Sdelphij	*)
1273267843Sdelphij		;;
1274267843Sdelphijesac
1275267843Sdelphij
1276267843Sdelphij# Decode manufacturer-specific aliases for certain operating systems.
1277267843Sdelphij
1278360521Sdelphijif [ x$os != x ]
1279267843Sdelphijthen
1280267843Sdelphijcase $os in
1281360521Sdelphij	# First match some system type aliases that might get confused
1282360521Sdelphij	# with valid system types.
1283360521Sdelphij	# solaris* is a basic system type, with this one exception.
1284360521Sdelphij	auroraux)
1285360521Sdelphij		os=auroraux
1286267843Sdelphij		;;
1287360521Sdelphij	bluegene*)
1288360521Sdelphij		os=cnk
1289360521Sdelphij		;;
1290360521Sdelphij	solaris1 | solaris1.*)
1291267843Sdelphij		os=`echo $os | sed -e 's|solaris1|sunos4|'`
1292267843Sdelphij		;;
1293360521Sdelphij	solaris)
1294360521Sdelphij		os=solaris2
1295267843Sdelphij		;;
1296360521Sdelphij	unixware*)
1297360521Sdelphij		os=sysv4.2uw
1298267843Sdelphij		;;
1299360521Sdelphij	gnu/linux*)
1300267843Sdelphij		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1301267843Sdelphij		;;
1302360521Sdelphij	# es1800 is here to avoid being matched by es* (a different OS)
1303360521Sdelphij	es1800*)
1304360521Sdelphij		os=ose
1305360521Sdelphij		;;
1306360521Sdelphij	# Some version numbers need modification
1307360521Sdelphij	chorusos*)
1308360521Sdelphij		os=chorusos
1309360521Sdelphij		;;
1310360521Sdelphij	isc)
1311360521Sdelphij		os=isc2.2
1312360521Sdelphij		;;
1313360521Sdelphij	sco6)
1314360521Sdelphij		os=sco5v6
1315360521Sdelphij		;;
1316360521Sdelphij	sco5)
1317360521Sdelphij		os=sco3.2v5
1318360521Sdelphij		;;
1319360521Sdelphij	sco4)
1320360521Sdelphij		os=sco3.2v4
1321360521Sdelphij		;;
1322360521Sdelphij	sco3.2.[4-9]*)
1323360521Sdelphij		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
1324360521Sdelphij		;;
1325360521Sdelphij	sco3.2v[4-9]* | sco5v6*)
1326360521Sdelphij		# Don't forget version if it is 3.2v4 or newer.
1327360521Sdelphij		;;
1328360521Sdelphij	scout)
1329360521Sdelphij		# Don't match below
1330360521Sdelphij		;;
1331360521Sdelphij	sco*)
1332360521Sdelphij		os=sco3.2v2
1333360521Sdelphij		;;
1334360521Sdelphij	psos*)
1335360521Sdelphij		os=psos
1336360521Sdelphij		;;
1337360521Sdelphij	# Now accept the basic system types.
1338267843Sdelphij	# The portable systems comes first.
1339360521Sdelphij	# Each alternative MUST end in a * to match a version number.
1340360521Sdelphij	# sysv* is not here because it comes later, after sysvr4.
1341360521Sdelphij	gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1342360521Sdelphij	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
1343360521Sdelphij	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1344360521Sdelphij	     | sym* | kopensolaris* | plan9* \
1345360521Sdelphij	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1346360521Sdelphij	     | aos* | aros* | cloudabi* | sortix* \
1347360521Sdelphij	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1348360521Sdelphij	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1349360521Sdelphij	     | knetbsd* | mirbsd* | netbsd* \
1350360521Sdelphij	     | bitrig* | openbsd* | solidbsd* | libertybsd* \
1351360521Sdelphij	     | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
1352360521Sdelphij	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1353360521Sdelphij	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1354360521Sdelphij	     | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
1355360521Sdelphij	     | chorusrdb* | cegcc* | glidix* \
1356360521Sdelphij	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1357360521Sdelphij	     | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
1358360521Sdelphij	     | linux-newlib* | linux-musl* | linux-uclibc* \
1359360521Sdelphij	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1360360521Sdelphij	     | interix* | uwin* | mks* | rhapsody* | darwin* \
1361360521Sdelphij	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
1362360521Sdelphij	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
1363360521Sdelphij	     | os2* | vos* | palmos* | uclinux* | nucleus* \
1364360521Sdelphij	     | morphos* | superux* | rtmk* | windiss* \
1365360521Sdelphij	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1366360521Sdelphij	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1367360521Sdelphij	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1368360521Sdelphij	     | midnightbsd* | amdhsa* | unleashed* | emscripten*)
1369267843Sdelphij	# Remember, each alternative MUST END IN *, to match a version number.
1370267843Sdelphij		;;
1371360521Sdelphij	qnx*)
1372360521Sdelphij		case $cpu in
1373360521Sdelphij		    x86 | i*86)
1374267843Sdelphij			;;
1375267843Sdelphij		    *)
1376360521Sdelphij			os=nto-$os
1377267843Sdelphij			;;
1378267843Sdelphij		esac
1379267843Sdelphij		;;
1380360521Sdelphij	hiux*)
1381360521Sdelphij		os=hiuxwe2
1382267843Sdelphij		;;
1383360521Sdelphij	nto-qnx*)
1384360521Sdelphij		;;
1385360521Sdelphij	nto*)
1386267843Sdelphij		os=`echo $os | sed -e 's|nto|nto-qnx|'`
1387267843Sdelphij		;;
1388360521Sdelphij	sim | xray | os68k* | v88r* \
1389360521Sdelphij	    | windows* | osx | abug | netware* | os9* \
1390360521Sdelphij	    | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
1391267843Sdelphij		;;
1392360521Sdelphij	linux-dietlibc)
1393360521Sdelphij		os=linux-dietlibc
1394267843Sdelphij		;;
1395360521Sdelphij	linux*)
1396267843Sdelphij		os=`echo $os | sed -e 's|linux|linux-gnu|'`
1397267843Sdelphij		;;
1398360521Sdelphij	lynx*178)
1399360521Sdelphij		os=lynxos178
1400267843Sdelphij		;;
1401360521Sdelphij	lynx*5)
1402360521Sdelphij		os=lynxos5
1403267843Sdelphij		;;
1404360521Sdelphij	lynx*)
1405360521Sdelphij		os=lynxos
1406267843Sdelphij		;;
1407360521Sdelphij	mac*)
1408360521Sdelphij		os=`echo "$os" | sed -e 's|mac|macos|'`
1409267843Sdelphij		;;
1410360521Sdelphij	opened*)
1411360521Sdelphij		os=openedition
1412267843Sdelphij		;;
1413360521Sdelphij	os400*)
1414360521Sdelphij		os=os400
1415267843Sdelphij		;;
1416360521Sdelphij	sunos5*)
1417360521Sdelphij		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1418267843Sdelphij		;;
1419360521Sdelphij	sunos6*)
1420360521Sdelphij		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1421267843Sdelphij		;;
1422360521Sdelphij	wince*)
1423360521Sdelphij		os=wince
1424267843Sdelphij		;;
1425360521Sdelphij	utek*)
1426360521Sdelphij		os=bsd
1427267843Sdelphij		;;
1428360521Sdelphij	dynix*)
1429360521Sdelphij		os=bsd
1430267843Sdelphij		;;
1431360521Sdelphij	acis*)
1432360521Sdelphij		os=aos
1433267843Sdelphij		;;
1434360521Sdelphij	atheos*)
1435360521Sdelphij		os=atheos
1436267843Sdelphij		;;
1437360521Sdelphij	syllable*)
1438360521Sdelphij		os=syllable
1439267843Sdelphij		;;
1440360521Sdelphij	386bsd)
1441360521Sdelphij		os=bsd
1442267843Sdelphij		;;
1443360521Sdelphij	ctix* | uts*)
1444360521Sdelphij		os=sysv
1445267843Sdelphij		;;
1446360521Sdelphij	nova*)
1447360521Sdelphij		os=rtmk-nova
1448267843Sdelphij		;;
1449360521Sdelphij	ns2)
1450360521Sdelphij		os=nextstep2
1451360521Sdelphij		;;
1452360521Sdelphij	nsk*)
1453360521Sdelphij		os=nsk
1454360521Sdelphij		;;
1455267843Sdelphij	# Preserve the version number of sinix5.
1456360521Sdelphij	sinix5.*)
1457267843Sdelphij		os=`echo $os | sed -e 's|sinix|sysv|'`
1458267843Sdelphij		;;
1459360521Sdelphij	sinix*)
1460360521Sdelphij		os=sysv4
1461267843Sdelphij		;;
1462360521Sdelphij	tpf*)
1463360521Sdelphij		os=tpf
1464267843Sdelphij		;;
1465360521Sdelphij	triton*)
1466360521Sdelphij		os=sysv3
1467267843Sdelphij		;;
1468360521Sdelphij	oss*)
1469360521Sdelphij		os=sysv3
1470267843Sdelphij		;;
1471360521Sdelphij	svr4*)
1472360521Sdelphij		os=sysv4
1473267843Sdelphij		;;
1474360521Sdelphij	svr3)
1475360521Sdelphij		os=sysv3
1476267843Sdelphij		;;
1477360521Sdelphij	sysvr4)
1478360521Sdelphij		os=sysv4
1479267843Sdelphij		;;
1480360521Sdelphij	# This must come after sysvr4.
1481360521Sdelphij	sysv*)
1482267843Sdelphij		;;
1483360521Sdelphij	ose*)
1484360521Sdelphij		os=ose
1485267843Sdelphij		;;
1486360521Sdelphij	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1487360521Sdelphij		os=mint
1488267843Sdelphij		;;
1489360521Sdelphij	zvmoe)
1490360521Sdelphij		os=zvmoe
1491267843Sdelphij		;;
1492360521Sdelphij	dicos*)
1493360521Sdelphij		os=dicos
1494267843Sdelphij		;;
1495360521Sdelphij	pikeos*)
1496360521Sdelphij		# Until real need of OS specific support for
1497360521Sdelphij		# particular features comes up, bare metal
1498360521Sdelphij		# configurations are quite functional.
1499360521Sdelphij		case $cpu in
1500360521Sdelphij		    arm*)
1501360521Sdelphij			os=eabi
1502360521Sdelphij			;;
1503360521Sdelphij		    *)
1504360521Sdelphij			os=elf
1505360521Sdelphij			;;
1506360521Sdelphij		esac
1507267843Sdelphij		;;
1508360521Sdelphij	nacl*)
1509267843Sdelphij		;;
1510360521Sdelphij	ios)
1511267843Sdelphij		;;
1512360521Sdelphij	none)
1513267843Sdelphij		;;
1514360521Sdelphij	*-eabi)
1515328874Seadler		;;
1516267843Sdelphij	*)
1517360521Sdelphij		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
1518267843Sdelphij		exit 1
1519267843Sdelphij		;;
1520267843Sdelphijesac
1521267843Sdelphijelse
1522267843Sdelphij
1523267843Sdelphij# Here we handle the default operating systems that come with various machines.
1524267843Sdelphij# The value should be what the vendor currently ships out the door with their
1525267843Sdelphij# machine or put another way, the most popular os provided with the machine.
1526267843Sdelphij
1527267843Sdelphij# Note that if you're going to try to match "-MANUFACTURER" here (say,
1528267843Sdelphij# "-sun"), then you have to tell the case statement up towards the top
1529267843Sdelphij# that MANUFACTURER isn't an operating system.  Otherwise, code above
1530267843Sdelphij# will signal an error saying that MANUFACTURER isn't an operating
1531267843Sdelphij# system, and we'll never get to this point.
1532267843Sdelphij
1533360521Sdelphijcase $cpu-$vendor in
1534267843Sdelphij	score-*)
1535360521Sdelphij		os=elf
1536267843Sdelphij		;;
1537267843Sdelphij	spu-*)
1538360521Sdelphij		os=elf
1539267843Sdelphij		;;
1540267843Sdelphij	*-acorn)
1541360521Sdelphij		os=riscix1.2
1542267843Sdelphij		;;
1543267843Sdelphij	arm*-rebel)
1544360521Sdelphij		os=linux
1545267843Sdelphij		;;
1546267843Sdelphij	arm*-semi)
1547360521Sdelphij		os=aout
1548267843Sdelphij		;;
1549267843Sdelphij	c4x-* | tic4x-*)
1550360521Sdelphij		os=coff
1551267843Sdelphij		;;
1552309847Sdelphij	c8051-*)
1553360521Sdelphij		os=elf
1554309847Sdelphij		;;
1555360521Sdelphij	clipper-intergraph)
1556360521Sdelphij		os=clix
1557360521Sdelphij		;;
1558309847Sdelphij	hexagon-*)
1559360521Sdelphij		os=elf
1560309847Sdelphij		;;
1561267843Sdelphij	tic54x-*)
1562360521Sdelphij		os=coff
1563267843Sdelphij		;;
1564267843Sdelphij	tic55x-*)
1565360521Sdelphij		os=coff
1566267843Sdelphij		;;
1567267843Sdelphij	tic6x-*)
1568360521Sdelphij		os=coff
1569267843Sdelphij		;;
1570267843Sdelphij	# This must come before the *-dec entry.
1571267843Sdelphij	pdp10-*)
1572360521Sdelphij		os=tops20
1573267843Sdelphij		;;
1574267843Sdelphij	pdp11-*)
1575360521Sdelphij		os=none
1576267843Sdelphij		;;
1577267843Sdelphij	*-dec | vax-*)
1578360521Sdelphij		os=ultrix4.2
1579267843Sdelphij		;;
1580267843Sdelphij	m68*-apollo)
1581360521Sdelphij		os=domain
1582267843Sdelphij		;;
1583267843Sdelphij	i386-sun)
1584360521Sdelphij		os=sunos4.0.2
1585267843Sdelphij		;;
1586267843Sdelphij	m68000-sun)
1587360521Sdelphij		os=sunos3
1588267843Sdelphij		;;
1589267843Sdelphij	m68*-cisco)
1590360521Sdelphij		os=aout
1591267843Sdelphij		;;
1592267843Sdelphij	mep-*)
1593360521Sdelphij		os=elf
1594267843Sdelphij		;;
1595267843Sdelphij	mips*-cisco)
1596360521Sdelphij		os=elf
1597267843Sdelphij		;;
1598267843Sdelphij	mips*-*)
1599360521Sdelphij		os=elf
1600267843Sdelphij		;;
1601267843Sdelphij	or32-*)
1602360521Sdelphij		os=coff
1603267843Sdelphij		;;
1604267843Sdelphij	*-tti)	# must be before sparc entry or we get the wrong os.
1605360521Sdelphij		os=sysv3
1606267843Sdelphij		;;
1607267843Sdelphij	sparc-* | *-sun)
1608360521Sdelphij		os=sunos4.1.1
1609267843Sdelphij		;;
1610328874Seadler	pru-*)
1611360521Sdelphij		os=elf
1612328874Seadler		;;
1613267843Sdelphij	*-be)
1614360521Sdelphij		os=beos
1615267843Sdelphij		;;
1616267843Sdelphij	*-ibm)
1617360521Sdelphij		os=aix
1618267843Sdelphij		;;
1619267843Sdelphij	*-knuth)
1620360521Sdelphij		os=mmixware
1621267843Sdelphij		;;
1622267843Sdelphij	*-wec)
1623360521Sdelphij		os=proelf
1624267843Sdelphij		;;
1625267843Sdelphij	*-winbond)
1626360521Sdelphij		os=proelf
1627267843Sdelphij		;;
1628267843Sdelphij	*-oki)
1629360521Sdelphij		os=proelf
1630267843Sdelphij		;;
1631267843Sdelphij	*-hp)
1632360521Sdelphij		os=hpux
1633267843Sdelphij		;;
1634267843Sdelphij	*-hitachi)
1635360521Sdelphij		os=hiux
1636267843Sdelphij		;;
1637267843Sdelphij	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1638360521Sdelphij		os=sysv
1639267843Sdelphij		;;
1640267843Sdelphij	*-cbm)
1641360521Sdelphij		os=amigaos
1642267843Sdelphij		;;
1643267843Sdelphij	*-dg)
1644360521Sdelphij		os=dgux
1645267843Sdelphij		;;
1646267843Sdelphij	*-dolphin)
1647360521Sdelphij		os=sysv3
1648267843Sdelphij		;;
1649267843Sdelphij	m68k-ccur)
1650360521Sdelphij		os=rtu
1651267843Sdelphij		;;
1652267843Sdelphij	m88k-omron*)
1653360521Sdelphij		os=luna
1654267843Sdelphij		;;
1655360521Sdelphij	*-next)
1656360521Sdelphij		os=nextstep
1657267843Sdelphij		;;
1658267843Sdelphij	*-sequent)
1659360521Sdelphij		os=ptx
1660267843Sdelphij		;;
1661267843Sdelphij	*-crds)
1662360521Sdelphij		os=unos
1663267843Sdelphij		;;
1664267843Sdelphij	*-ns)
1665360521Sdelphij		os=genix
1666267843Sdelphij		;;
1667267843Sdelphij	i370-*)
1668360521Sdelphij		os=mvs
1669267843Sdelphij		;;
1670267843Sdelphij	*-gould)
1671360521Sdelphij		os=sysv
1672267843Sdelphij		;;
1673267843Sdelphij	*-highlevel)
1674360521Sdelphij		os=bsd
1675267843Sdelphij		;;
1676267843Sdelphij	*-encore)
1677360521Sdelphij		os=bsd
1678267843Sdelphij		;;
1679267843Sdelphij	*-sgi)
1680360521Sdelphij		os=irix
1681267843Sdelphij		;;
1682267843Sdelphij	*-siemens)
1683360521Sdelphij		os=sysv4
1684267843Sdelphij		;;
1685267843Sdelphij	*-masscomp)
1686360521Sdelphij		os=rtu
1687267843Sdelphij		;;
1688267843Sdelphij	f30[01]-fujitsu | f700-fujitsu)
1689360521Sdelphij		os=uxpv
1690267843Sdelphij		;;
1691267843Sdelphij	*-rom68k)
1692360521Sdelphij		os=coff
1693267843Sdelphij		;;
1694267843Sdelphij	*-*bug)
1695360521Sdelphij		os=coff
1696267843Sdelphij		;;
1697267843Sdelphij	*-apple)
1698360521Sdelphij		os=macos
1699267843Sdelphij		;;
1700267843Sdelphij	*-atari*)
1701360521Sdelphij		os=mint
1702267843Sdelphij		;;
1703360521Sdelphij	*-wrs)
1704360521Sdelphij		os=vxworks
1705360521Sdelphij		;;
1706267843Sdelphij	*)
1707360521Sdelphij		os=none
1708267843Sdelphij		;;
1709267843Sdelphijesac
1710267843Sdelphijfi
1711267843Sdelphij
1712267843Sdelphij# Here we handle the case where we know the os, and the CPU type, but not the
1713267843Sdelphij# manufacturer.  We pick the logical manufacturer.
1714360521Sdelphijcase $vendor in
1715360521Sdelphij	unknown)
1716267843Sdelphij		case $os in
1717360521Sdelphij			riscix*)
1718267843Sdelphij				vendor=acorn
1719267843Sdelphij				;;
1720360521Sdelphij			sunos*)
1721267843Sdelphij				vendor=sun
1722267843Sdelphij				;;
1723360521Sdelphij			cnk*|-aix*)
1724267843Sdelphij				vendor=ibm
1725267843Sdelphij				;;
1726360521Sdelphij			beos*)
1727267843Sdelphij				vendor=be
1728267843Sdelphij				;;
1729360521Sdelphij			hpux*)
1730267843Sdelphij				vendor=hp
1731267843Sdelphij				;;
1732360521Sdelphij			mpeix*)
1733267843Sdelphij				vendor=hp
1734267843Sdelphij				;;
1735360521Sdelphij			hiux*)
1736267843Sdelphij				vendor=hitachi
1737267843Sdelphij				;;
1738360521Sdelphij			unos*)
1739267843Sdelphij				vendor=crds
1740267843Sdelphij				;;
1741360521Sdelphij			dgux*)
1742267843Sdelphij				vendor=dg
1743267843Sdelphij				;;
1744360521Sdelphij			luna*)
1745267843Sdelphij				vendor=omron
1746267843Sdelphij				;;
1747360521Sdelphij			genix*)
1748267843Sdelphij				vendor=ns
1749267843Sdelphij				;;
1750360521Sdelphij			clix*)
1751360521Sdelphij				vendor=intergraph
1752360521Sdelphij				;;
1753360521Sdelphij			mvs* | opened*)
1754267843Sdelphij				vendor=ibm
1755267843Sdelphij				;;
1756360521Sdelphij			os400*)
1757267843Sdelphij				vendor=ibm
1758267843Sdelphij				;;
1759360521Sdelphij			ptx*)
1760267843Sdelphij				vendor=sequent
1761267843Sdelphij				;;
1762360521Sdelphij			tpf*)
1763267843Sdelphij				vendor=ibm
1764267843Sdelphij				;;
1765360521Sdelphij			vxsim* | vxworks* | windiss*)
1766267843Sdelphij				vendor=wrs
1767267843Sdelphij				;;
1768360521Sdelphij			aux*)
1769267843Sdelphij				vendor=apple
1770267843Sdelphij				;;
1771360521Sdelphij			hms*)
1772267843Sdelphij				vendor=hitachi
1773267843Sdelphij				;;
1774360521Sdelphij			mpw* | macos*)
1775267843Sdelphij				vendor=apple
1776267843Sdelphij				;;
1777360521Sdelphij			*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1778267843Sdelphij				vendor=atari
1779267843Sdelphij				;;
1780360521Sdelphij			vos*)
1781267843Sdelphij				vendor=stratus
1782267843Sdelphij				;;
1783267843Sdelphij		esac
1784267843Sdelphij		;;
1785267843Sdelphijesac
1786267843Sdelphij
1787360521Sdelphijecho "$cpu-$vendor-$os"
1788267843Sdelphijexit
1789267843Sdelphij
1790267843Sdelphij# Local variables:
1791360521Sdelphij# eval: (add-hook 'before-save-hook 'time-stamp)
1792267843Sdelphij# time-stamp-start: "timestamp='"
1793267843Sdelphij# time-stamp-format: "%:y-%02m-%02d"
1794267843Sdelphij# time-stamp-end: "'"
1795267843Sdelphij# End:
1796