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