1#! /bin/sh
2# Configuration validation subroutine script.
3#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
4#   Free Software Foundation, Inc.
5
6timestamp='2001-09-07'
7
8# This file is (in principle) common to ALL GNU software.
9# The presence of a machine in this file suggests that SOME GNU software
10# can handle that machine.  It does not imply ALL GNU software can.
11#
12# This file is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 59 Temple Place - Suite 330,
25# Boston, MA 02111-1307, USA.
26
27# As a special exception to the GNU General Public License, if you
28# distribute this file as part of a program that contains a
29# configuration script generated by Autoconf, you may include it under
30# the same distribution terms that you use for the rest of that program.
31
32# Please send patches to <config-patches@gnu.org>.
33#
34# Configuration subroutine to validate and canonicalize a configuration type.
35# Supply the specified configuration type as an argument.
36# If it is invalid, we print an error message on stderr and exit with code 1.
37# Otherwise, we print the canonical config type on stdout and succeed.
38
39# This file is supposed to be the same for all GNU packages
40# and recognize all the CPU types, system types and aliases
41# that are meaningful with *any* GNU software.
42# Each package is responsible for reporting which valid configurations
43# it does not support.  The user should be able to distinguish
44# a failure to support a valid configuration from a meaningless
45# configuration.
46
47# The goal of this file is to map all the various variations of a given
48# machine specification into a single specification in the form:
49#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
50# or in some cases, the newer four-part form:
51#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
52# It is wrong to echo any other type of specification.
53
54me=`echo "$0" | sed -e 's,.*/,,'`
55
56usage="\
57Usage: $0 [OPTION] CPU-MFR-OPSYS
58       $0 [OPTION] ALIAS
59
60Canonicalize a configuration name.
61
62Operation modes:
63  -h, --help         print this help, then exit
64  -t, --time-stamp   print date of last modification, then exit
65  -v, --version      print version number, then exit
66
67Report bugs and patches to <config-patches@gnu.org>."
68
69version="\
70GNU config.sub ($timestamp)
71
72Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
73Free Software Foundation, Inc.
74
75This is free software; see the source for copying conditions.  There is NO
76warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
77
78help="
79Try \`$me --help' for more information."
80
81# Parse command line
82while test $# -gt 0 ; do
83  case $1 in
84    --time-stamp | --time* | -t )
85       echo "$timestamp" ; exit 0 ;;
86    --version | -v )
87       echo "$version" ; exit 0 ;;
88    --help | --h* | -h )
89       echo "$usage"; exit 0 ;;
90    -- )     # Stop option processing
91       shift; break ;;
92    - )	# Use stdin as input.
93       break ;;
94    -* )
95       echo "$me: invalid option $1$help"
96       exit 1 ;;
97
98    *local*)
99       # First pass through any local machine types.
100       echo $1
101       exit 0;;
102
103    * )
104       break ;;
105  esac
106done
107
108case $# in
109 0) echo "$me: missing argument$help" >&2
110    exit 1;;
111 1) ;;
112 *) echo "$me: too many arguments$help" >&2
113    exit 1;;
114esac
115
116# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
117# Here we must recognize all the valid KERNEL-OS combinations.
118maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
119case $maybe_os in
120  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
121    os=-$maybe_os
122    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
123    ;;
124  *)
125    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
126    if [ $basic_machine != $1 ]
127    then os=`echo $1 | sed 's/.*-/-/'`
128    else os=; fi
129    ;;
130esac
131
132### Let's recognize common machines as not being operating systems so
133### that things like config.sub decstation-3100 work.  We also
134### recognize some manufacturers as not being operating systems, so we
135### can provide default operating systems below.
136case $os in
137	-sun*os*)
138		# Prevent following clause from handling this invalid input.
139		;;
140	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
141	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
142	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
143	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
144	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
145	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
146	-apple | -axis)
147		os=
148		basic_machine=$1
149		;;
150	-sim | -cisco | -oki | -wec | -winbond)
151		os=
152		basic_machine=$1
153		;;
154	-scout)
155		;;
156	-wrs)
157		os=-vxworks
158		basic_machine=$1
159		;;
160	-chorusos*)
161		os=-chorusos
162		basic_machine=$1
163		;;
164 	-chorusrdb)
165 		os=-chorusrdb
166		basic_machine=$1
167 		;;
168	-hiux*)
169		os=-hiuxwe2
170		;;
171	-sco5)
172		os=-sco3.2v5
173		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
174		;;
175	-sco4)
176		os=-sco3.2v4
177		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
178		;;
179	-sco3.2.[4-9]*)
180		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
181		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
182		;;
183	-sco3.2v[4-9]*)
184		# Don't forget version if it is 3.2v4 or newer.
185		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186		;;
187	-sco*)
188		os=-sco3.2v2
189		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190		;;
191	-udk*)
192		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
193		;;
194	-isc)
195		os=-isc2.2
196		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
197		;;
198	-clix*)
199		basic_machine=clipper-intergraph
200		;;
201	-isc*)
202		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
203		;;
204	-lynx*)
205		os=-lynxos
206		;;
207	-ptx*)
208		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
209		;;
210	-windowsnt*)
211		os=`echo $os | sed -e 's/windowsnt/winnt/'`
212		;;
213	-psos*)
214		os=-psos
215		;;
216	-mint | -mint[0-9]*)
217		basic_machine=m68k-atari
218		os=-mint
219		;;
220esac
221
222# Decode aliases for certain CPU-COMPANY combinations.
223case $basic_machine in
224	# Recognize the basic CPU types without company name.
225	# Some are omitted here because they have special meanings below.
226	1750a | 580 \
227	| a29k \
228	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
229	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
230	| c4x | clipper \
231	| d10v | d30v | dsp16xx \
232	| fr30 \
233	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
234	| i370 | i860 | i960 | ia64 \
235	| m32r | m68000 | m68k | m88k | mcore \
236	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
237	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
238	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
239	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
240	| mipsisa32 \
241	| mn10200 | mn10300 \
242	| ns16k | ns32k \
243	| openrisc \
244	| pdp10 | pdp11 | pj | pjl \
245	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
246	| pyramid \
247	| s390 | s390x \
248	| sh | sh[34] | sh[34]eb | shbe | shle \
249	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
250	| stormy16 | strongarm \
251	| tahoe | thumb | tic80 | tron \
252	| v850 \
253	| we32k \
254	| x86 | xscale \
255	| z8k)
256		basic_machine=$basic_machine-unknown
257		;;
258	m6811 | m68hc11 | m6812 | m68hc12)
259		# Motorola 68HC11/12.
260		basic_machine=$basic_machine-unknown
261		os=-none
262		;;
263	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
264		;;
265
266	# We use `pc' rather than `unknown'
267	# because (1) that's what they normally are, and
268	# (2) the word "unknown" tends to confuse beginning users.
269	i*86 | x86_64)
270	  basic_machine=$basic_machine-pc
271	  ;;
272	# Object if more than one company name word.
273	*-*-*)
274		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
275		exit 1
276		;;
277	# Recognize the basic CPU types with company name.
278	580-* \
279	| a29k-* \
280	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
281	| alphapca5[67]-* | arc-* \
282	| arm-*  | armbe-* | armle-* | armv*-* \
283	| bs2000-* \
284	| c[123]* | c30-* | [cjt]90-* | c54x-* \
285	| clipper-* | cray2-* | cydra-* \
286	| d10v-* | d30v-* \
287	| elxsi-* \
288	| f30[01]-* | f700-* | fr30-* | fx80-* \
289	| h8300-* | h8500-* \
290	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
291	| i*86-* | i860-* | i960-* | ia64-* \
292	| m32r-* \
293	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
294	| m88110-* | m88k-* | mcore-* \
295	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
296	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
297	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
298	| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
299	| none-* | np1-* | ns16k-* | ns32k-* \
300	| orion-* \
301	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
302	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
303	| pyramid-* \
304	| romp-* | rs6000-* \
305	| s390-* | s390x-* \
306	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
307	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
308	| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
309	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
310	| v850-* | vax-* \
311	| we32k-* \
312	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
313	| ymp-* \
314	| z8k-*)
315		;;
316	# Recognize the various machine names and aliases which stand
317	# for a CPU type and a company and sometimes even an OS.
318	386bsd)
319		basic_machine=i386-unknown
320		os=-bsd
321		;;
322	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
323		basic_machine=m68000-att
324		;;
325	3b*)
326		basic_machine=we32k-att
327		;;
328	a29khif)
329		basic_machine=a29k-amd
330		os=-udi
331		;;
332	adobe68k)
333		basic_machine=m68010-adobe
334		os=-scout
335		;;
336	alliant | fx80)
337		basic_machine=fx80-alliant
338		;;
339	altos | altos3068)
340		basic_machine=m68k-altos
341		;;
342	am29k)
343		basic_machine=a29k-none
344		os=-bsd
345		;;
346	amdahl)
347		basic_machine=580-amdahl
348		os=-sysv
349		;;
350	amiga | amiga-*)
351		basic_machine=m68k-unknown
352		;;
353	amigaos | amigados)
354		basic_machine=m68k-unknown
355		os=-amigaos
356		;;
357	amigaunix | amix)
358		basic_machine=m68k-unknown
359		os=-sysv4
360		;;
361	apollo68)
362		basic_machine=m68k-apollo
363		os=-sysv
364		;;
365	apollo68bsd)
366		basic_machine=m68k-apollo
367		os=-bsd
368		;;
369	aux)
370		basic_machine=m68k-apple
371		os=-aux
372		;;
373	balance)
374		basic_machine=ns32k-sequent
375		os=-dynix
376		;;
377	convex-c1)
378		basic_machine=c1-convex
379		os=-bsd
380		;;
381	convex-c2)
382		basic_machine=c2-convex
383		os=-bsd
384		;;
385	convex-c32)
386		basic_machine=c32-convex
387		os=-bsd
388		;;
389	convex-c34)
390		basic_machine=c34-convex
391		os=-bsd
392		;;
393	convex-c38)
394		basic_machine=c38-convex
395		os=-bsd
396		;;
397	cray | ymp)
398		basic_machine=ymp-cray
399		os=-unicos
400		;;
401	cray2)
402		basic_machine=cray2-cray
403		os=-unicos
404		;;
405	[cjt]90)
406		basic_machine=${basic_machine}-cray
407		os=-unicos
408		;;
409	crds | unos)
410		basic_machine=m68k-crds
411		;;
412	cris | cris-* | etrax*)
413		basic_machine=cris-axis
414		;;
415	da30 | da30-*)
416		basic_machine=m68k-da30
417		;;
418	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
419		basic_machine=mips-dec
420		;;
421	delta | 3300 | motorola-3300 | motorola-delta \
422	      | 3300-motorola | delta-motorola)
423		basic_machine=m68k-motorola
424		;;
425	delta88)
426		basic_machine=m88k-motorola
427		os=-sysv3
428		;;
429	dpx20 | dpx20-*)
430		basic_machine=rs6000-bull
431		os=-bosx
432		;;
433	dpx2* | dpx2*-bull)
434		basic_machine=m68k-bull
435		os=-sysv3
436		;;
437	ebmon29k)
438		basic_machine=a29k-amd
439		os=-ebmon
440		;;
441	elxsi)
442		basic_machine=elxsi-elxsi
443		os=-bsd
444		;;
445	encore | umax | mmax)
446		basic_machine=ns32k-encore
447		;;
448	es1800 | OSE68k | ose68k | ose | OSE)
449		basic_machine=m68k-ericsson
450		os=-ose
451		;;
452	fx2800)
453		basic_machine=i860-alliant
454		;;
455	genix)
456		basic_machine=ns32k-ns
457		;;
458	gmicro)
459		basic_machine=tron-gmicro
460		os=-sysv
461		;;
462	go32)
463		basic_machine=i386-pc
464		os=-go32
465		;;
466	h3050r* | hiux*)
467		basic_machine=hppa1.1-hitachi
468		os=-hiuxwe2
469		;;
470	h8300hms)
471		basic_machine=h8300-hitachi
472		os=-hms
473		;;
474	h8300xray)
475		basic_machine=h8300-hitachi
476		os=-xray
477		;;
478	h8500hms)
479		basic_machine=h8500-hitachi
480		os=-hms
481		;;
482	harris)
483		basic_machine=m88k-harris
484		os=-sysv3
485		;;
486	hp300-*)
487		basic_machine=m68k-hp
488		;;
489	hp300bsd)
490		basic_machine=m68k-hp
491		os=-bsd
492		;;
493	hp300hpux)
494		basic_machine=m68k-hp
495		os=-hpux
496		;;
497	hp3k9[0-9][0-9] | hp9[0-9][0-9])
498		basic_machine=hppa1.0-hp
499		;;
500	hp9k2[0-9][0-9] | hp9k31[0-9])
501		basic_machine=m68000-hp
502		;;
503	hp9k3[2-9][0-9])
504		basic_machine=m68k-hp
505		;;
506	hp9k6[0-9][0-9] | hp6[0-9][0-9])
507		basic_machine=hppa1.0-hp
508		;;
509	hp9k7[0-79][0-9] | hp7[0-79][0-9])
510		basic_machine=hppa1.1-hp
511		;;
512	hp9k78[0-9] | hp78[0-9])
513		# FIXME: really hppa2.0-hp
514		basic_machine=hppa1.1-hp
515		;;
516	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
517		# FIXME: really hppa2.0-hp
518		basic_machine=hppa1.1-hp
519		;;
520	hp9k8[0-9][13679] | hp8[0-9][13679])
521		basic_machine=hppa1.1-hp
522		;;
523	hp9k8[0-9][0-9] | hp8[0-9][0-9])
524		basic_machine=hppa1.0-hp
525		;;
526	hppa-next)
527		os=-nextstep3
528		;;
529	hppaosf)
530		basic_machine=hppa1.1-hp
531		os=-osf
532		;;
533	hppro)
534		basic_machine=hppa1.1-hp
535		os=-proelf
536		;;
537	i370-ibm* | ibm*)
538		basic_machine=i370-ibm
539		;;
540# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
541	i*86v32)
542		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
543		os=-sysv32
544		;;
545	i*86v4*)
546		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
547		os=-sysv4
548		;;
549	i*86v)
550		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
551		os=-sysv
552		;;
553	i*86sol2)
554		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
555		os=-solaris2
556		;;
557	i386mach)
558		basic_machine=i386-mach
559		os=-mach
560		;;
561	i386-vsta | vsta)
562		basic_machine=i386-unknown
563		os=-vsta
564		;;
565	iris | iris4d)
566		basic_machine=mips-sgi
567		case $os in
568		    -irix*)
569			;;
570		    *)
571			os=-irix4
572			;;
573		esac
574		;;
575	isi68 | isi)
576		basic_machine=m68k-isi
577		os=-sysv
578		;;
579	m88k-omron*)
580		basic_machine=m88k-omron
581		;;
582	magnum | m3230)
583		basic_machine=mips-mips
584		os=-sysv
585		;;
586	merlin)
587		basic_machine=ns32k-utek
588		os=-sysv
589		;;
590	mingw32)
591		basic_machine=i386-pc
592		os=-mingw32
593		;;
594	miniframe)
595		basic_machine=m68000-convergent
596		;;
597	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
598		basic_machine=m68k-atari
599		os=-mint
600		;;
601	mipsel*-linux*)
602		basic_machine=mipsel-unknown
603		os=-linux-gnu
604		;;
605	mips*-linux*)
606		basic_machine=mips-unknown
607		os=-linux-gnu
608		;;
609	mips3*-*)
610		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
611		;;
612	mips3*)
613		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
614		;;
615	mmix*)
616		basic_machine=mmix-knuth
617		os=-mmixware
618		;;
619	monitor)
620		basic_machine=m68k-rom68k
621		os=-coff
622		;;
623	msdos)
624		basic_machine=i386-pc
625		os=-msdos
626		;;
627	mvs)
628		basic_machine=i370-ibm
629		os=-mvs
630		;;
631	ncr3000)
632		basic_machine=i486-ncr
633		os=-sysv4
634		;;
635	netbsd386)
636		basic_machine=i386-unknown
637		os=-netbsd
638		;;
639	netwinder)
640		basic_machine=armv4l-rebel
641		os=-linux
642		;;
643	news | news700 | news800 | news900)
644		basic_machine=m68k-sony
645		os=-newsos
646		;;
647	news1000)
648		basic_machine=m68030-sony
649		os=-newsos
650		;;
651	news-3600 | risc-news)
652		basic_machine=mips-sony
653		os=-newsos
654		;;
655	necv70)
656		basic_machine=v70-nec
657		os=-sysv
658		;;
659	next | m*-next )
660		basic_machine=m68k-next
661		case $os in
662		    -nextstep* )
663			;;
664		    -ns2*)
665		      os=-nextstep2
666			;;
667		    *)
668		      os=-nextstep3
669			;;
670		esac
671		;;
672	nh3000)
673		basic_machine=m68k-harris
674		os=-cxux
675		;;
676	nh[45]000)
677		basic_machine=m88k-harris
678		os=-cxux
679		;;
680	nindy960)
681		basic_machine=i960-intel
682		os=-nindy
683		;;
684	mon960)
685		basic_machine=i960-intel
686		os=-mon960
687		;;
688	nonstopux)
689		basic_machine=mips-compaq
690		os=-nonstopux
691		;;
692	np1)
693		basic_machine=np1-gould
694		;;
695	nsr-tandem)
696		basic_machine=nsr-tandem
697		;;
698	op50n-* | op60c-*)
699		basic_machine=hppa1.1-oki
700		os=-proelf
701		;;
702	OSE68000 | ose68000)
703		basic_machine=m68000-ericsson
704		os=-ose
705		;;
706	os68k)
707		basic_machine=m68k-none
708		os=-os68k
709		;;
710	pa-hitachi)
711		basic_machine=hppa1.1-hitachi
712		os=-hiuxwe2
713		;;
714	paragon)
715		basic_machine=i860-intel
716		os=-osf
717		;;
718	pbd)
719		basic_machine=sparc-tti
720		;;
721	pbb)
722		basic_machine=m68k-tti
723		;;
724        pc532 | pc532-*)
725		basic_machine=ns32k-pc532
726		;;
727	pentium | p5 | k5 | k6 | nexgen)
728		basic_machine=i586-pc
729		;;
730	pentiumpro | p6 | 6x86 | athlon)
731		basic_machine=i686-pc
732		;;
733	pentiumii | pentium2)
734		basic_machine=i686-pc
735		;;
736	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
737		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
738		;;
739	pentiumpro-* | p6-* | 6x86-* | athlon-*)
740		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
741		;;
742	pentiumii-* | pentium2-*)
743		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
744		;;
745	pn)
746		basic_machine=pn-gould
747		;;
748	power)	basic_machine=power-ibm
749		;;
750	ppc)	basic_machine=powerpc-unknown
751	        ;;
752	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
753		;;
754	ppcle | powerpclittle | ppc-le | powerpc-little)
755		basic_machine=powerpcle-unknown
756	        ;;
757	ppcle-* | powerpclittle-*)
758		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
759		;;
760	ppc64)	basic_machine=powerpc64-unknown
761	        ;;
762	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
763		;;
764	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
765		basic_machine=powerpc64le-unknown
766	        ;;
767	ppc64le-* | powerpc64little-*)
768		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
769		;;
770	ps2)
771		basic_machine=i386-ibm
772		;;
773	pw32)
774		basic_machine=i586-unknown
775		os=-pw32
776		;;
777	rom68k)
778		basic_machine=m68k-rom68k
779		os=-coff
780		;;
781	rm[46]00)
782		basic_machine=mips-siemens
783		;;
784	rtpc | rtpc-*)
785		basic_machine=romp-ibm
786		;;
787	sa29200)
788		basic_machine=a29k-amd
789		os=-udi
790		;;
791	sequent)
792		basic_machine=i386-sequent
793		;;
794	sh)
795		basic_machine=sh-hitachi
796		os=-hms
797		;;
798	sparclite-wrs)
799		basic_machine=sparclite-wrs
800		os=-vxworks
801		;;
802	sps7)
803		basic_machine=m68k-bull
804		os=-sysv2
805		;;
806	spur)
807		basic_machine=spur-unknown
808		;;
809	st2000)
810		basic_machine=m68k-tandem
811		;;
812	stratus)
813		basic_machine=i860-stratus
814		os=-sysv4
815		;;
816	sun2)
817		basic_machine=m68000-sun
818		;;
819	sun2os3)
820		basic_machine=m68000-sun
821		os=-sunos3
822		;;
823	sun2os4)
824		basic_machine=m68000-sun
825		os=-sunos4
826		;;
827	sun3os3)
828		basic_machine=m68k-sun
829		os=-sunos3
830		;;
831	sun3os4)
832		basic_machine=m68k-sun
833		os=-sunos4
834		;;
835	sun4os3)
836		basic_machine=sparc-sun
837		os=-sunos3
838		;;
839	sun4os4)
840		basic_machine=sparc-sun
841		os=-sunos4
842		;;
843	sun4sol2)
844		basic_machine=sparc-sun
845		os=-solaris2
846		;;
847	sun3 | sun3-*)
848		basic_machine=m68k-sun
849		;;
850	sun4)
851		basic_machine=sparc-sun
852		;;
853	sun386 | sun386i | roadrunner)
854		basic_machine=i386-sun
855		;;
856	sv1)
857		basic_machine=sv1-cray
858		os=-unicos
859		;;
860	symmetry)
861		basic_machine=i386-sequent
862		os=-dynix
863		;;
864	t3e)
865		basic_machine=t3e-cray
866		os=-unicos
867		;;
868	tic54x | c54x*)
869		basic_machine=tic54x-unknown
870		os=-coff
871		;;
872	tx39)
873		basic_machine=mipstx39-unknown
874		;;
875	tx39el)
876		basic_machine=mipstx39el-unknown
877		;;
878	tower | tower-32)
879		basic_machine=m68k-ncr
880		;;
881	udi29k)
882		basic_machine=a29k-amd
883		os=-udi
884		;;
885	ultra3)
886		basic_machine=a29k-nyu
887		os=-sym1
888		;;
889	v810 | necv810)
890		basic_machine=v810-nec
891		os=-none
892		;;
893	vaxv)
894		basic_machine=vax-dec
895		os=-sysv
896		;;
897	vms)
898		basic_machine=vax-dec
899		os=-vms
900		;;
901	vpp*|vx|vx-*)
902               basic_machine=f301-fujitsu
903               ;;
904	vxworks960)
905		basic_machine=i960-wrs
906		os=-vxworks
907		;;
908	vxworks68)
909		basic_machine=m68k-wrs
910		os=-vxworks
911		;;
912	vxworks29k)
913		basic_machine=a29k-wrs
914		os=-vxworks
915		;;
916	w65*)
917		basic_machine=w65-wdc
918		os=-none
919		;;
920	w89k-*)
921		basic_machine=hppa1.1-winbond
922		os=-proelf
923		;;
924	windows32)
925		basic_machine=i386-pc
926		os=-windows32-msvcrt
927		;;
928	xmp)
929		basic_machine=xmp-cray
930		os=-unicos
931		;;
932        xps | xps100)
933		basic_machine=xps100-honeywell
934		;;
935	z8k-*-coff)
936		basic_machine=z8k-unknown
937		os=-sim
938		;;
939	none)
940		basic_machine=none-none
941		os=-none
942		;;
943
944# Here we handle the default manufacturer of certain CPU types.  It is in
945# some cases the only manufacturer, in others, it is the most popular.
946	w89k)
947		basic_machine=hppa1.1-winbond
948		;;
949	op50n)
950		basic_machine=hppa1.1-oki
951		;;
952	op60c)
953		basic_machine=hppa1.1-oki
954		;;
955	mips)
956		if [ x$os = x-linux-gnu ]; then
957			basic_machine=mips-unknown
958		else
959			basic_machine=mips-mips
960		fi
961		;;
962	romp)
963		basic_machine=romp-ibm
964		;;
965	rs6000)
966		basic_machine=rs6000-ibm
967		;;
968	vax)
969		basic_machine=vax-dec
970		;;
971	pdp10)
972		# there are many clones, so DEC is not a safe bet
973		basic_machine=pdp10-unknown
974		;;
975	pdp11)
976		basic_machine=pdp11-dec
977		;;
978	we32k)
979		basic_machine=we32k-att
980		;;
981	sh3 | sh4 | sh3eb | sh4eb)
982		basic_machine=sh-unknown
983		;;
984	sparc | sparcv9 | sparcv9b)
985		basic_machine=sparc-sun
986		;;
987        cydra)
988		basic_machine=cydra-cydrome
989		;;
990	orion)
991		basic_machine=orion-highlevel
992		;;
993	orion105)
994		basic_machine=clipper-highlevel
995		;;
996	mac | mpw | mac-mpw)
997		basic_machine=m68k-apple
998		;;
999	pmac | pmac-mpw)
1000		basic_machine=powerpc-apple
1001		;;
1002	c4x*)
1003		basic_machine=c4x-none
1004		os=-coff
1005		;;
1006	*-unknown)
1007		# Make sure to match an already-canonicalized machine name.
1008		;;
1009	*)
1010		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1011		exit 1
1012		;;
1013esac
1014
1015# Here we canonicalize certain aliases for manufacturers.
1016case $basic_machine in
1017	*-digital*)
1018		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1019		;;
1020	*-commodore*)
1021		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1022		;;
1023	*)
1024		;;
1025esac
1026
1027# Decode manufacturer-specific aliases for certain operating systems.
1028
1029if [ x"$os" != x"" ]
1030then
1031case $os in
1032        # First match some system type aliases
1033        # that might get confused with valid system types.
1034	# -solaris* is a basic system type, with this one exception.
1035	-solaris1 | -solaris1.*)
1036		os=`echo $os | sed -e 's|solaris1|sunos4|'`
1037		;;
1038	-solaris)
1039		os=-solaris2
1040		;;
1041	-svr4*)
1042		os=-sysv4
1043		;;
1044	-unixware*)
1045		os=-sysv4.2uw
1046		;;
1047	-gnu/linux*)
1048		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1049		;;
1050	# First accept the basic system types.
1051	# The portable systems comes first.
1052	# Each alternative MUST END IN A *, to match a version number.
1053	# -sysv* is not here because it comes later, after sysvr4.
1054	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1055	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1056	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1057	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1058	      | -aos* \
1059	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1060	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1061	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
1062	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1063	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1064	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1065	      | -chorusos* | -chorusrdb* \
1066	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1067	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
1068	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
1069	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1070	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1071	      | -os2* | -vos*)
1072	# Remember, each alternative MUST END IN *, to match a version number.
1073		;;
1074	-qnx*)
1075		case $basic_machine in
1076		    x86-* | i*86-*)
1077			;;
1078		    *)
1079			os=-nto$os
1080			;;
1081		esac
1082		;;
1083	-nto*)
1084		os=-nto-qnx
1085		;;
1086	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1087	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
1088	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1089		;;
1090	-mac*)
1091		os=`echo $os | sed -e 's|mac|macos|'`
1092		;;
1093	-linux*)
1094		os=`echo $os | sed -e 's|linux|linux-gnu|'`
1095		;;
1096	-sunos5*)
1097		os=`echo $os | sed -e 's|sunos5|solaris2|'`
1098		;;
1099	-sunos6*)
1100		os=`echo $os | sed -e 's|sunos6|solaris3|'`
1101		;;
1102	-opened*)
1103		os=-openedition
1104		;;
1105	-wince*)
1106		os=-wince
1107		;;
1108	-osfrose*)
1109		os=-osfrose
1110		;;
1111	-osf*)
1112		os=-osf
1113		;;
1114	-utek*)
1115		os=-bsd
1116		;;
1117	-dynix*)
1118		os=-bsd
1119		;;
1120	-acis*)
1121		os=-aos
1122		;;
1123	-386bsd)
1124		os=-bsd
1125		;;
1126	-ctix* | -uts*)
1127		os=-sysv
1128		;;
1129	-ns2 )
1130	        os=-nextstep2
1131		;;
1132	-nsk*)
1133		os=-nsk
1134		;;
1135	# Preserve the version number of sinix5.
1136	-sinix5.*)
1137		os=`echo $os | sed -e 's|sinix|sysv|'`
1138		;;
1139	-sinix*)
1140		os=-sysv4
1141		;;
1142	-triton*)
1143		os=-sysv3
1144		;;
1145	-oss*)
1146		os=-sysv3
1147		;;
1148	-svr4)
1149		os=-sysv4
1150		;;
1151	-svr3)
1152		os=-sysv3
1153		;;
1154	-sysvr4)
1155		os=-sysv4
1156		;;
1157	# This must come after -sysvr4.
1158	-sysv*)
1159		;;
1160	-ose*)
1161		os=-ose
1162		;;
1163	-es1800*)
1164		os=-ose
1165		;;
1166	-xenix)
1167		os=-xenix
1168		;;
1169        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1170	        os=-mint
1171		;;
1172	-none)
1173		;;
1174	*)
1175		# Get rid of the `-' at the beginning of $os.
1176		os=`echo $os | sed 's/[^-]*-//'`
1177		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1178		exit 1
1179		;;
1180esac
1181else
1182
1183# Here we handle the default operating systems that come with various machines.
1184# The value should be what the vendor currently ships out the door with their
1185# machine or put another way, the most popular os provided with the machine.
1186
1187# Note that if you're going to try to match "-MANUFACTURER" here (say,
1188# "-sun"), then you have to tell the case statement up towards the top
1189# that MANUFACTURER isn't an operating system.  Otherwise, code above
1190# will signal an error saying that MANUFACTURER isn't an operating
1191# system, and we'll never get to this point.
1192
1193case $basic_machine in
1194	*-acorn)
1195		os=-riscix1.2
1196		;;
1197	arm*-rebel)
1198		os=-linux
1199		;;
1200	arm*-semi)
1201		os=-aout
1202		;;
1203	pdp10-*)
1204		os=-tops20
1205		;;
1206        pdp11-*)
1207		os=-none
1208		;;
1209	*-dec | vax-*)
1210		os=-ultrix4.2
1211		;;
1212	m68*-apollo)
1213		os=-domain
1214		;;
1215	i386-sun)
1216		os=-sunos4.0.2
1217		;;
1218	m68000-sun)
1219		os=-sunos3
1220		# This also exists in the configure program, but was not the
1221		# default.
1222		# os=-sunos4
1223		;;
1224	m68*-cisco)
1225		os=-aout
1226		;;
1227	mips*-cisco)
1228		os=-elf
1229		;;
1230	mips*-*)
1231		os=-elf
1232		;;
1233	*-tti)	# must be before sparc entry or we get the wrong os.
1234		os=-sysv3
1235		;;
1236	sparc-* | *-sun)
1237		os=-sunos4.1.1
1238		;;
1239	*-be)
1240		os=-beos
1241		;;
1242	*-ibm)
1243		os=-aix
1244		;;
1245	*-wec)
1246		os=-proelf
1247		;;
1248	*-winbond)
1249		os=-proelf
1250		;;
1251	*-oki)
1252		os=-proelf
1253		;;
1254	*-hp)
1255		os=-hpux
1256		;;
1257	*-hitachi)
1258		os=-hiux
1259		;;
1260	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1261		os=-sysv
1262		;;
1263	*-cbm)
1264		os=-amigaos
1265		;;
1266	*-dg)
1267		os=-dgux
1268		;;
1269	*-dolphin)
1270		os=-sysv3
1271		;;
1272	m68k-ccur)
1273		os=-rtu
1274		;;
1275	m88k-omron*)
1276		os=-luna
1277		;;
1278	*-next )
1279		os=-nextstep
1280		;;
1281	*-sequent)
1282		os=-ptx
1283		;;
1284	*-crds)
1285		os=-unos
1286		;;
1287	*-ns)
1288		os=-genix
1289		;;
1290	i370-*)
1291		os=-mvs
1292		;;
1293	*-next)
1294		os=-nextstep3
1295		;;
1296        *-gould)
1297		os=-sysv
1298		;;
1299        *-highlevel)
1300		os=-bsd
1301		;;
1302	*-encore)
1303		os=-bsd
1304		;;
1305        *-sgi)
1306		os=-irix
1307		;;
1308        *-siemens)
1309		os=-sysv4
1310		;;
1311	*-masscomp)
1312		os=-rtu
1313		;;
1314	f30[01]-fujitsu | f700-fujitsu)
1315		os=-uxpv
1316		;;
1317	*-rom68k)
1318		os=-coff
1319		;;
1320	*-*bug)
1321		os=-coff
1322		;;
1323	*-apple)
1324		os=-macos
1325		;;
1326	*-atari*)
1327		os=-mint
1328		;;
1329	*)
1330		os=-none
1331		;;
1332esac
1333fi
1334
1335# Here we handle the case where we know the os, and the CPU type, but not the
1336# manufacturer.  We pick the logical manufacturer.
1337vendor=unknown
1338case $basic_machine in
1339	*-unknown)
1340		case $os in
1341			-riscix*)
1342				vendor=acorn
1343				;;
1344			-sunos*)
1345				vendor=sun
1346				;;
1347			-aix*)
1348				vendor=ibm
1349				;;
1350			-beos*)
1351				vendor=be
1352				;;
1353			-hpux*)
1354				vendor=hp
1355				;;
1356			-mpeix*)
1357				vendor=hp
1358				;;
1359			-hiux*)
1360				vendor=hitachi
1361				;;
1362			-unos*)
1363				vendor=crds
1364				;;
1365			-dgux*)
1366				vendor=dg
1367				;;
1368			-luna*)
1369				vendor=omron
1370				;;
1371			-genix*)
1372				vendor=ns
1373				;;
1374			-mvs* | -opened*)
1375				vendor=ibm
1376				;;
1377			-ptx*)
1378				vendor=sequent
1379				;;
1380			-vxsim* | -vxworks*)
1381				vendor=wrs
1382				;;
1383			-aux*)
1384				vendor=apple
1385				;;
1386			-hms*)
1387				vendor=hitachi
1388				;;
1389			-mpw* | -macos*)
1390				vendor=apple
1391				;;
1392			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1393				vendor=atari
1394				;;
1395			-vos*)
1396				vendor=stratus
1397				;;
1398		esac
1399		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1400		;;
1401esac
1402
1403echo $basic_machine$os
1404exit 0
1405
1406# Local variables:
1407# eval: (add-hook 'write-file-hooks 'time-stamp)
1408# time-stamp-start: "timestamp='"
1409# time-stamp-format: "%:y-%02m-%02d"
1410# time-stamp-end: "'"
1411# End:
1412