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