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