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