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