1284194Sdelphij#! /bin/sh
2284194Sdelphij# Configuration validation subroutine script.
3284194Sdelphij#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4284194Sdelphij#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5284194Sdelphij#   2011, 2012 Free Software Foundation, Inc.
6284194Sdelphij
7284194Sdelphijtimestamp='2012-04-18'
8284194Sdelphij
9284194Sdelphij# This file is (in principle) common to ALL GNU software.
10284194Sdelphij# The presence of a machine in this file suggests that SOME GNU software
11284194Sdelphij# can handle that machine.  It does not imply ALL GNU software can.
12284194Sdelphij#
13284194Sdelphij# This file is free software; you can redistribute it and/or modify
14284194Sdelphij# it under the terms of the GNU General Public License as published by
15284194Sdelphij# the Free Software Foundation; either version 2 of the License, or
16284194Sdelphij# (at your option) any later version.
17284194Sdelphij#
18284194Sdelphij# This program is distributed in the hope that it will be useful,
19284194Sdelphij# but WITHOUT ANY WARRANTY; without even the implied warranty of
20284194Sdelphij# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21284194Sdelphij# GNU General Public License for more details.
22284194Sdelphij#
23284194Sdelphij# You should have received a copy of the GNU General Public License
24284194Sdelphij# along with this program; if not, see <http://www.gnu.org/licenses/>.
25284194Sdelphij#
26284194Sdelphij# As a special exception to the GNU General Public License, if you
27284194Sdelphij# distribute this file as part of a program that contains a
28284194Sdelphij# configuration script generated by Autoconf, you may include it under
29284194Sdelphij# the same distribution terms that you use for the rest of that program.
30284194Sdelphij
31284194Sdelphij
32284194Sdelphij# Please send patches to <config-patches@gnu.org>.  Submit a context
33284194Sdelphij# diff and a properly formatted GNU ChangeLog entry.
34284194Sdelphij#
35284194Sdelphij# Configuration subroutine to validate and canonicalize a configuration type.
36284194Sdelphij# Supply the specified configuration type as an argument.
37284194Sdelphij# If it is invalid, we print an error message on stderr and exit with code 1.
38284194Sdelphij# Otherwise, we print the canonical config type on stdout and succeed.
39284194Sdelphij
40284194Sdelphij# You can get the latest version of this script from:
41284194Sdelphij# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
42284194Sdelphij
43284194Sdelphij# This file is supposed to be the same for all GNU packages
44284194Sdelphij# and recognize all the CPU types, system types and aliases
45284194Sdelphij# that are meaningful with *any* GNU software.
46284194Sdelphij# Each package is responsible for reporting which valid configurations
47284194Sdelphij# it does not support.  The user should be able to distinguish
48284194Sdelphij# a failure to support a valid configuration from a meaningless
49284194Sdelphij# configuration.
50284194Sdelphij
51284194Sdelphij# The goal of this file is to map all the various variations of a given
52284194Sdelphij# machine specification into a single specification in the form:
53284194Sdelphij#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
54284194Sdelphij# or in some cases, the newer four-part form:
55284194Sdelphij#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
56284194Sdelphij# It is wrong to echo any other type of specification.
57284194Sdelphij
58284194Sdelphijme=`echo "$0" | sed -e 's,.*/,,'`
59284194Sdelphij
60284194Sdelphijusage="\
61284194SdelphijUsage: $0 [OPTION] CPU-MFR-OPSYS
62284194Sdelphij       $0 [OPTION] ALIAS
63284194Sdelphij
64284194SdelphijCanonicalize a configuration name.
65284194Sdelphij
66284194SdelphijOperation modes:
67284194Sdelphij  -h, --help         print this help, then exit
68284194Sdelphij  -t, --time-stamp   print date of last modification, then exit
69284194Sdelphij  -v, --version      print version number, then exit
70284194Sdelphij
71284194SdelphijReport bugs and patches to <config-patches@gnu.org>."
72284194Sdelphij
73284194Sdelphijversion="\
74284194SdelphijGNU config.sub ($timestamp)
75284194Sdelphij
76284194SdelphijCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
77284194Sdelphij2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
78284194SdelphijFree Software Foundation, Inc.
79284194Sdelphij
80284194SdelphijThis is free software; see the source for copying conditions.  There is NO
81284194Sdelphijwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
82284194Sdelphij
83284194Sdelphijhelp="
84284194SdelphijTry \`$me --help' for more information."
85284194Sdelphij
86284194Sdelphij# Parse command line
87284194Sdelphijwhile test $# -gt 0 ; do
88284194Sdelphij  case $1 in
89284194Sdelphij    --time-stamp | --time* | -t )
90284194Sdelphij       echo "$timestamp" ; exit ;;
91284194Sdelphij    --version | -v )
92284194Sdelphij       echo "$version" ; exit ;;
93284194Sdelphij    --help | --h* | -h )
94284194Sdelphij       echo "$usage"; exit ;;
95284194Sdelphij    -- )     # Stop option processing
96284194Sdelphij       shift; break ;;
97284194Sdelphij    - )	# Use stdin as input.
98284194Sdelphij       break ;;
99284194Sdelphij    -* )
100284194Sdelphij       echo "$me: invalid option $1$help"
101284194Sdelphij       exit 1 ;;
102284194Sdelphij
103284194Sdelphij    *local*)
104284194Sdelphij       # First pass through any local machine types.
105284194Sdelphij       echo $1
106284194Sdelphij       exit ;;
107284194Sdelphij
108284194Sdelphij    * )
109284194Sdelphij       break ;;
110284194Sdelphij  esac
111284194Sdelphijdone
112284194Sdelphij
113284194Sdelphijcase $# in
114284194Sdelphij 0) echo "$me: missing argument$help" >&2
115284194Sdelphij    exit 1;;
116284194Sdelphij 1) ;;
117284194Sdelphij *) echo "$me: too many arguments$help" >&2
118284194Sdelphij    exit 1;;
119284194Sdelphijesac
120284194Sdelphij
121284194Sdelphij# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
122284194Sdelphij# Here we must recognize all the valid KERNEL-OS combinations.
123284194Sdelphijmaybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
124284194Sdelphijcase $maybe_os in
125284194Sdelphij  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
126284194Sdelphij  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
127284194Sdelphij  knetbsd*-gnu* | netbsd*-gnu* | \
128284194Sdelphij  kopensolaris*-gnu* | \
129284194Sdelphij  storm-chaos* | os2-emx* | rtmk-nova*)
130284194Sdelphij    os=-$maybe_os
131284194Sdelphij    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
132284194Sdelphij    ;;
133284194Sdelphij  android-linux)
134284194Sdelphij    os=-linux-android
135284194Sdelphij    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
136284194Sdelphij    ;;
137284194Sdelphij  *)
138284194Sdelphij    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
139284194Sdelphij    if [ $basic_machine != $1 ]
140284194Sdelphij    then os=`echo $1 | sed 's/.*-/-/'`
141284194Sdelphij    else os=; fi
142284194Sdelphij    ;;
143284194Sdelphijesac
144284194Sdelphij
145284194Sdelphij### Let's recognize common machines as not being operating systems so
146284194Sdelphij### that things like config.sub decstation-3100 work.  We also
147284194Sdelphij### recognize some manufacturers as not being operating systems, so we
148284194Sdelphij### can provide default operating systems below.
149284194Sdelphijcase $os in
150284194Sdelphij	-sun*os*)
151284194Sdelphij		# Prevent following clause from handling this invalid input.
152284194Sdelphij		;;
153284194Sdelphij	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
154284194Sdelphij	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
155284194Sdelphij	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
156284194Sdelphij	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
157284194Sdelphij	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
158284194Sdelphij	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
159284194Sdelphij	-apple | -axis | -knuth | -cray | -microblaze)
160284194Sdelphij		os=
161284194Sdelphij		basic_machine=$1
162284194Sdelphij		;;
163284194Sdelphij	-bluegene*)
164284194Sdelphij		os=-cnk
165284194Sdelphij		;;
166284194Sdelphij	-sim | -cisco | -oki | -wec | -winbond)
167284194Sdelphij		os=
168284194Sdelphij		basic_machine=$1
169284194Sdelphij		;;
170284194Sdelphij	-scout)
171284194Sdelphij		;;
172284194Sdelphij	-wrs)
173284194Sdelphij		os=-vxworks
174284194Sdelphij		basic_machine=$1
175284194Sdelphij		;;
176284194Sdelphij	-chorusos*)
177284194Sdelphij		os=-chorusos
178284194Sdelphij		basic_machine=$1
179284194Sdelphij		;;
180284194Sdelphij	-chorusrdb)
181284194Sdelphij		os=-chorusrdb
182284194Sdelphij		basic_machine=$1
183284194Sdelphij		;;
184284194Sdelphij	-hiux*)
185284194Sdelphij		os=-hiuxwe2
186284194Sdelphij		;;
187284194Sdelphij	-sco6)
188284194Sdelphij		os=-sco5v6
189284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190284194Sdelphij		;;
191284194Sdelphij	-sco5)
192284194Sdelphij		os=-sco3.2v5
193284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194284194Sdelphij		;;
195284194Sdelphij	-sco4)
196284194Sdelphij		os=-sco3.2v4
197284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
198284194Sdelphij		;;
199284194Sdelphij	-sco3.2.[4-9]*)
200284194Sdelphij		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
201284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
202284194Sdelphij		;;
203284194Sdelphij	-sco3.2v[4-9]*)
204284194Sdelphij		# Don't forget version if it is 3.2v4 or newer.
205284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206284194Sdelphij		;;
207284194Sdelphij	-sco5v6*)
208284194Sdelphij		# Don't forget version if it is 3.2v4 or newer.
209284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
210284194Sdelphij		;;
211284194Sdelphij	-sco*)
212284194Sdelphij		os=-sco3.2v2
213284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
214284194Sdelphij		;;
215284194Sdelphij	-udk*)
216284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
217284194Sdelphij		;;
218284194Sdelphij	-isc)
219284194Sdelphij		os=-isc2.2
220284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
221284194Sdelphij		;;
222284194Sdelphij	-clix*)
223284194Sdelphij		basic_machine=clipper-intergraph
224284194Sdelphij		;;
225284194Sdelphij	-isc*)
226284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
227284194Sdelphij		;;
228284194Sdelphij	-lynx*178)
229284194Sdelphij		os=-lynxos178
230284194Sdelphij		;;
231284194Sdelphij	-lynx*5)
232284194Sdelphij		os=-lynxos5
233284194Sdelphij		;;
234284194Sdelphij	-lynx*)
235284194Sdelphij		os=-lynxos
236284194Sdelphij		;;
237284194Sdelphij	-ptx*)
238284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
239284194Sdelphij		;;
240284194Sdelphij	-windowsnt*)
241284194Sdelphij		os=`echo $os | sed -e 's/windowsnt/winnt/'`
242284194Sdelphij		;;
243284194Sdelphij	-psos*)
244284194Sdelphij		os=-psos
245284194Sdelphij		;;
246284194Sdelphij	-mint | -mint[0-9]*)
247284194Sdelphij		basic_machine=m68k-atari
248284194Sdelphij		os=-mint
249284194Sdelphij		;;
250284194Sdelphijesac
251284194Sdelphij
252284194Sdelphij# Decode aliases for certain CPU-COMPANY combinations.
253284194Sdelphijcase $basic_machine in
254284194Sdelphij	# Recognize the basic CPU types without company name.
255284194Sdelphij	# Some are omitted here because they have special meanings below.
256284194Sdelphij	1750a | 580 \
257284194Sdelphij	| a29k \
258284194Sdelphij	| aarch64 | aarch64_be \
259284194Sdelphij	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
260284194Sdelphij	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
261284194Sdelphij	| am33_2.0 \
262284194Sdelphij	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
263284194Sdelphij        | be32 | be64 \
264284194Sdelphij	| bfin \
265284194Sdelphij	| c4x | clipper \
266284194Sdelphij	| d10v | d30v | dlx | dsp16xx \
267284194Sdelphij	| epiphany \
268284194Sdelphij	| fido | fr30 | frv \
269284194Sdelphij	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
270284194Sdelphij	| hexagon \
271284194Sdelphij	| i370 | i860 | i960 | ia64 \
272284194Sdelphij	| ip2k | iq2000 \
273284194Sdelphij	| le32 | le64 \
274284194Sdelphij	| lm32 \
275284194Sdelphij	| m32c | m32r | m32rle | m68000 | m68k | m88k \
276284194Sdelphij	| maxq | mb | microblaze | mcore | mep | metag \
277284194Sdelphij	| mips | mipsbe | mipseb | mipsel | mipsle \
278284194Sdelphij	| mips16 \
279284194Sdelphij	| mips64 | mips64el \
280284194Sdelphij	| mips64octeon | mips64octeonel \
281284194Sdelphij	| mips64orion | mips64orionel \
282284194Sdelphij	| mips64r5900 | mips64r5900el \
283284194Sdelphij	| mips64vr | mips64vrel \
284284194Sdelphij	| mips64vr4100 | mips64vr4100el \
285284194Sdelphij	| mips64vr4300 | mips64vr4300el \
286284194Sdelphij	| mips64vr5000 | mips64vr5000el \
287284194Sdelphij	| mips64vr5900 | mips64vr5900el \
288284194Sdelphij	| mipsisa32 | mipsisa32el \
289284194Sdelphij	| mipsisa32r2 | mipsisa32r2el \
290284194Sdelphij	| mipsisa64 | mipsisa64el \
291284194Sdelphij	| mipsisa64r2 | mipsisa64r2el \
292284194Sdelphij	| mipsisa64sb1 | mipsisa64sb1el \
293284194Sdelphij	| mipsisa64sr71k | mipsisa64sr71kel \
294284194Sdelphij	| mipstx39 | mipstx39el \
295284194Sdelphij	| mn10200 | mn10300 \
296284194Sdelphij	| moxie \
297284194Sdelphij	| mt \
298284194Sdelphij	| msp430 \
299284194Sdelphij	| nds32 | nds32le | nds32be \
300284194Sdelphij	| nios | nios2 \
301284194Sdelphij	| ns16k | ns32k \
302284194Sdelphij	| open8 \
303284194Sdelphij	| or32 \
304284194Sdelphij	| pdp10 | pdp11 | pj | pjl \
305284194Sdelphij	| powerpc | powerpc64 | powerpc64le | powerpcle \
306284194Sdelphij	| pyramid \
307284194Sdelphij	| rl78 | rx \
308284194Sdelphij	| score \
309284194Sdelphij	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
310284194Sdelphij	| sh64 | sh64le \
311284194Sdelphij	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
312284194Sdelphij	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
313284194Sdelphij	| spu \
314284194Sdelphij	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
315284194Sdelphij	| ubicom32 \
316284194Sdelphij	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
317284194Sdelphij	| we32k \
318284194Sdelphij	| x86 | xc16x | xstormy16 | xtensa \
319284194Sdelphij	| z8k | z80)
320284194Sdelphij		basic_machine=$basic_machine-unknown
321284194Sdelphij		;;
322284194Sdelphij	c54x)
323284194Sdelphij		basic_machine=tic54x-unknown
324284194Sdelphij		;;
325284194Sdelphij	c55x)
326284194Sdelphij		basic_machine=tic55x-unknown
327284194Sdelphij		;;
328284194Sdelphij	c6x)
329284194Sdelphij		basic_machine=tic6x-unknown
330284194Sdelphij		;;
331284194Sdelphij	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
332284194Sdelphij		basic_machine=$basic_machine-unknown
333284194Sdelphij		os=-none
334284194Sdelphij		;;
335284194Sdelphij	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
336284194Sdelphij		;;
337284194Sdelphij	ms1)
338284194Sdelphij		basic_machine=mt-unknown
339284194Sdelphij		;;
340284194Sdelphij
341284194Sdelphij	strongarm | thumb | xscale)
342284194Sdelphij		basic_machine=arm-unknown
343284194Sdelphij		;;
344284194Sdelphij	xgate)
345284194Sdelphij		basic_machine=$basic_machine-unknown
346284194Sdelphij		os=-none
347284194Sdelphij		;;
348284194Sdelphij	xscaleeb)
349284194Sdelphij		basic_machine=armeb-unknown
350284194Sdelphij		;;
351284194Sdelphij
352284194Sdelphij	xscaleel)
353284194Sdelphij		basic_machine=armel-unknown
354284194Sdelphij		;;
355284194Sdelphij
356284194Sdelphij	# We use `pc' rather than `unknown'
357284194Sdelphij	# because (1) that's what they normally are, and
358284194Sdelphij	# (2) the word "unknown" tends to confuse beginning users.
359284194Sdelphij	i*86 | x86_64)
360284194Sdelphij	  basic_machine=$basic_machine-pc
361284194Sdelphij	  ;;
362284194Sdelphij	# Object if more than one company name word.
363284194Sdelphij	*-*-*)
364284194Sdelphij		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
365284194Sdelphij		exit 1
366284194Sdelphij		;;
367284194Sdelphij	# Recognize the basic CPU types with company name.
368284194Sdelphij	580-* \
369284194Sdelphij	| a29k-* \
370284194Sdelphij	| aarch64-* | aarch64_be-* \
371284194Sdelphij	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
372284194Sdelphij	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
373284194Sdelphij	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
374284194Sdelphij	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
375284194Sdelphij	| avr-* | avr32-* \
376284194Sdelphij	| be32-* | be64-* \
377284194Sdelphij	| bfin-* | bs2000-* \
378284194Sdelphij	| c[123]* | c30-* | [cjt]90-* | c4x-* \
379284194Sdelphij	| clipper-* | craynv-* | cydra-* \
380284194Sdelphij	| d10v-* | d30v-* | dlx-* \
381284194Sdelphij	| elxsi-* \
382284194Sdelphij	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
383284194Sdelphij	| h8300-* | h8500-* \
384284194Sdelphij	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
385284194Sdelphij	| hexagon-* \
386284194Sdelphij	| i*86-* | i860-* | i960-* | ia64-* \
387284194Sdelphij	| ip2k-* | iq2000-* \
388284194Sdelphij	| le32-* | le64-* \
389284194Sdelphij	| lm32-* \
390284194Sdelphij	| m32c-* | m32r-* | m32rle-* \
391284194Sdelphij	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
392284194Sdelphij	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
393284194Sdelphij	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
394284194Sdelphij	| mips16-* \
395284194Sdelphij	| mips64-* | mips64el-* \
396284194Sdelphij	| mips64octeon-* | mips64octeonel-* \
397284194Sdelphij	| mips64orion-* | mips64orionel-* \
398284194Sdelphij	| mips64r5900-* | mips64r5900el-* \
399284194Sdelphij	| mips64vr-* | mips64vrel-* \
400284194Sdelphij	| mips64vr4100-* | mips64vr4100el-* \
401284194Sdelphij	| mips64vr4300-* | mips64vr4300el-* \
402284194Sdelphij	| mips64vr5000-* | mips64vr5000el-* \
403284194Sdelphij	| mips64vr5900-* | mips64vr5900el-* \
404284194Sdelphij	| mipsisa32-* | mipsisa32el-* \
405284194Sdelphij	| mipsisa32r2-* | mipsisa32r2el-* \
406284194Sdelphij	| mipsisa64-* | mipsisa64el-* \
407284194Sdelphij	| mipsisa64r2-* | mipsisa64r2el-* \
408284194Sdelphij	| mipsisa64sb1-* | mipsisa64sb1el-* \
409284194Sdelphij	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
410284194Sdelphij	| mipstx39-* | mipstx39el-* \
411284194Sdelphij	| mmix-* \
412284194Sdelphij	| mt-* \
413284194Sdelphij	| msp430-* \
414284194Sdelphij	| nds32-* | nds32le-* | nds32be-* \
415284194Sdelphij	| nios-* | nios2-* \
416284194Sdelphij	| none-* | np1-* | ns16k-* | ns32k-* \
417284194Sdelphij	| open8-* \
418284194Sdelphij	| orion-* \
419284194Sdelphij	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
420284194Sdelphij	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
421284194Sdelphij	| pyramid-* \
422284194Sdelphij	| rl78-* | romp-* | rs6000-* | rx-* \
423284194Sdelphij	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
424284194Sdelphij	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
425284194Sdelphij	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
426284194Sdelphij	| sparclite-* \
427284194Sdelphij	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
428284194Sdelphij	| tahoe-* \
429284194Sdelphij	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
430284194Sdelphij	| tile*-* \
431284194Sdelphij	| tron-* \
432284194Sdelphij	| ubicom32-* \
433284194Sdelphij	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
434284194Sdelphij	| vax-* \
435284194Sdelphij	| we32k-* \
436284194Sdelphij	| x86-* | x86_64-* | xc16x-* | xps100-* \
437284194Sdelphij	| xstormy16-* | xtensa*-* \
438284194Sdelphij	| ymp-* \
439284194Sdelphij	| z8k-* | z80-*)
440284194Sdelphij		;;
441284194Sdelphij	# Recognize the basic CPU types without company name, with glob match.
442284194Sdelphij	xtensa*)
443284194Sdelphij		basic_machine=$basic_machine-unknown
444284194Sdelphij		;;
445284194Sdelphij	# Recognize the various machine names and aliases which stand
446284194Sdelphij	# for a CPU type and a company and sometimes even an OS.
447284194Sdelphij	386bsd)
448284194Sdelphij		basic_machine=i386-unknown
449284194Sdelphij		os=-bsd
450284194Sdelphij		;;
451284194Sdelphij	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
452284194Sdelphij		basic_machine=m68000-att
453284194Sdelphij		;;
454284194Sdelphij	3b*)
455284194Sdelphij		basic_machine=we32k-att
456284194Sdelphij		;;
457284194Sdelphij	a29khif)
458284194Sdelphij		basic_machine=a29k-amd
459284194Sdelphij		os=-udi
460284194Sdelphij		;;
461284194Sdelphij	abacus)
462284194Sdelphij		basic_machine=abacus-unknown
463284194Sdelphij		;;
464284194Sdelphij	adobe68k)
465284194Sdelphij		basic_machine=m68010-adobe
466284194Sdelphij		os=-scout
467284194Sdelphij		;;
468284194Sdelphij	alliant | fx80)
469284194Sdelphij		basic_machine=fx80-alliant
470284194Sdelphij		;;
471284194Sdelphij	altos | altos3068)
472284194Sdelphij		basic_machine=m68k-altos
473284194Sdelphij		;;
474284194Sdelphij	am29k)
475284194Sdelphij		basic_machine=a29k-none
476284194Sdelphij		os=-bsd
477284194Sdelphij		;;
478284194Sdelphij	amd64)
479284194Sdelphij		basic_machine=x86_64-pc
480284194Sdelphij		;;
481284194Sdelphij	amd64-*)
482284194Sdelphij		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
483284194Sdelphij		;;
484284194Sdelphij	amdahl)
485284194Sdelphij		basic_machine=580-amdahl
486284194Sdelphij		os=-sysv
487284194Sdelphij		;;
488284194Sdelphij	amiga | amiga-*)
489284194Sdelphij		basic_machine=m68k-unknown
490284194Sdelphij		;;
491284194Sdelphij	amigaos | amigados)
492284194Sdelphij		basic_machine=m68k-unknown
493284194Sdelphij		os=-amigaos
494284194Sdelphij		;;
495284194Sdelphij	amigaunix | amix)
496284194Sdelphij		basic_machine=m68k-unknown
497284194Sdelphij		os=-sysv4
498284194Sdelphij		;;
499284194Sdelphij	apollo68)
500284194Sdelphij		basic_machine=m68k-apollo
501284194Sdelphij		os=-sysv
502284194Sdelphij		;;
503284194Sdelphij	apollo68bsd)
504284194Sdelphij		basic_machine=m68k-apollo
505284194Sdelphij		os=-bsd
506284194Sdelphij		;;
507284194Sdelphij	aros)
508284194Sdelphij		basic_machine=i386-pc
509284194Sdelphij		os=-aros
510284194Sdelphij		;;
511284194Sdelphij	aux)
512284194Sdelphij		basic_machine=m68k-apple
513284194Sdelphij		os=-aux
514284194Sdelphij		;;
515284194Sdelphij	balance)
516284194Sdelphij		basic_machine=ns32k-sequent
517284194Sdelphij		os=-dynix
518284194Sdelphij		;;
519284194Sdelphij	blackfin)
520284194Sdelphij		basic_machine=bfin-unknown
521284194Sdelphij		os=-linux
522284194Sdelphij		;;
523284194Sdelphij	blackfin-*)
524284194Sdelphij		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
525284194Sdelphij		os=-linux
526284194Sdelphij		;;
527284194Sdelphij	bluegene*)
528284194Sdelphij		basic_machine=powerpc-ibm
529284194Sdelphij		os=-cnk
530284194Sdelphij		;;
531284194Sdelphij	c54x-*)
532284194Sdelphij		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
533284194Sdelphij		;;
534284194Sdelphij	c55x-*)
535284194Sdelphij		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
536284194Sdelphij		;;
537284194Sdelphij	c6x-*)
538284194Sdelphij		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
539284194Sdelphij		;;
540284194Sdelphij	c90)
541284194Sdelphij		basic_machine=c90-cray
542284194Sdelphij		os=-unicos
543284194Sdelphij		;;
544284194Sdelphij	cegcc)
545284194Sdelphij		basic_machine=arm-unknown
546284194Sdelphij		os=-cegcc
547284194Sdelphij		;;
548284194Sdelphij	convex-c1)
549284194Sdelphij		basic_machine=c1-convex
550284194Sdelphij		os=-bsd
551284194Sdelphij		;;
552284194Sdelphij	convex-c2)
553284194Sdelphij		basic_machine=c2-convex
554284194Sdelphij		os=-bsd
555284194Sdelphij		;;
556284194Sdelphij	convex-c32)
557284194Sdelphij		basic_machine=c32-convex
558284194Sdelphij		os=-bsd
559284194Sdelphij		;;
560284194Sdelphij	convex-c34)
561284194Sdelphij		basic_machine=c34-convex
562284194Sdelphij		os=-bsd
563284194Sdelphij		;;
564284194Sdelphij	convex-c38)
565284194Sdelphij		basic_machine=c38-convex
566284194Sdelphij		os=-bsd
567284194Sdelphij		;;
568284194Sdelphij	cray | j90)
569284194Sdelphij		basic_machine=j90-cray
570284194Sdelphij		os=-unicos
571284194Sdelphij		;;
572284194Sdelphij	craynv)
573284194Sdelphij		basic_machine=craynv-cray
574284194Sdelphij		os=-unicosmp
575284194Sdelphij		;;
576284194Sdelphij	cr16 | cr16-*)
577284194Sdelphij		basic_machine=cr16-unknown
578284194Sdelphij		os=-elf
579284194Sdelphij		;;
580284194Sdelphij	crds | unos)
581284194Sdelphij		basic_machine=m68k-crds
582284194Sdelphij		;;
583284194Sdelphij	crisv32 | crisv32-* | etraxfs*)
584284194Sdelphij		basic_machine=crisv32-axis
585284194Sdelphij		;;
586284194Sdelphij	cris | cris-* | etrax*)
587284194Sdelphij		basic_machine=cris-axis
588284194Sdelphij		;;
589284194Sdelphij	crx)
590284194Sdelphij		basic_machine=crx-unknown
591284194Sdelphij		os=-elf
592284194Sdelphij		;;
593284194Sdelphij	da30 | da30-*)
594284194Sdelphij		basic_machine=m68k-da30
595284194Sdelphij		;;
596284194Sdelphij	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
597284194Sdelphij		basic_machine=mips-dec
598284194Sdelphij		;;
599284194Sdelphij	decsystem10* | dec10*)
600284194Sdelphij		basic_machine=pdp10-dec
601284194Sdelphij		os=-tops10
602284194Sdelphij		;;
603284194Sdelphij	decsystem20* | dec20*)
604284194Sdelphij		basic_machine=pdp10-dec
605284194Sdelphij		os=-tops20
606284194Sdelphij		;;
607284194Sdelphij	delta | 3300 | motorola-3300 | motorola-delta \
608284194Sdelphij	      | 3300-motorola | delta-motorola)
609284194Sdelphij		basic_machine=m68k-motorola
610284194Sdelphij		;;
611284194Sdelphij	delta88)
612284194Sdelphij		basic_machine=m88k-motorola
613284194Sdelphij		os=-sysv3
614284194Sdelphij		;;
615284194Sdelphij	dicos)
616284194Sdelphij		basic_machine=i686-pc
617284194Sdelphij		os=-dicos
618284194Sdelphij		;;
619284194Sdelphij	djgpp)
620284194Sdelphij		basic_machine=i586-pc
621284194Sdelphij		os=-msdosdjgpp
622284194Sdelphij		;;
623284194Sdelphij	dpx20 | dpx20-*)
624284194Sdelphij		basic_machine=rs6000-bull
625284194Sdelphij		os=-bosx
626284194Sdelphij		;;
627284194Sdelphij	dpx2* | dpx2*-bull)
628284194Sdelphij		basic_machine=m68k-bull
629284194Sdelphij		os=-sysv3
630284194Sdelphij		;;
631284194Sdelphij	ebmon29k)
632284194Sdelphij		basic_machine=a29k-amd
633284194Sdelphij		os=-ebmon
634284194Sdelphij		;;
635284194Sdelphij	elxsi)
636284194Sdelphij		basic_machine=elxsi-elxsi
637284194Sdelphij		os=-bsd
638284194Sdelphij		;;
639284194Sdelphij	encore | umax | mmax)
640284194Sdelphij		basic_machine=ns32k-encore
641284194Sdelphij		;;
642284194Sdelphij	es1800 | OSE68k | ose68k | ose | OSE)
643284194Sdelphij		basic_machine=m68k-ericsson
644284194Sdelphij		os=-ose
645284194Sdelphij		;;
646284194Sdelphij	fx2800)
647284194Sdelphij		basic_machine=i860-alliant
648284194Sdelphij		;;
649284194Sdelphij	genix)
650284194Sdelphij		basic_machine=ns32k-ns
651284194Sdelphij		;;
652284194Sdelphij	gmicro)
653284194Sdelphij		basic_machine=tron-gmicro
654284194Sdelphij		os=-sysv
655284194Sdelphij		;;
656284194Sdelphij	go32)
657284194Sdelphij		basic_machine=i386-pc
658284194Sdelphij		os=-go32
659284194Sdelphij		;;
660284194Sdelphij	h3050r* | hiux*)
661284194Sdelphij		basic_machine=hppa1.1-hitachi
662284194Sdelphij		os=-hiuxwe2
663284194Sdelphij		;;
664284194Sdelphij	h8300hms)
665284194Sdelphij		basic_machine=h8300-hitachi
666284194Sdelphij		os=-hms
667284194Sdelphij		;;
668284194Sdelphij	h8300xray)
669284194Sdelphij		basic_machine=h8300-hitachi
670284194Sdelphij		os=-xray
671284194Sdelphij		;;
672284194Sdelphij	h8500hms)
673284194Sdelphij		basic_machine=h8500-hitachi
674284194Sdelphij		os=-hms
675284194Sdelphij		;;
676284194Sdelphij	harris)
677284194Sdelphij		basic_machine=m88k-harris
678284194Sdelphij		os=-sysv3
679284194Sdelphij		;;
680284194Sdelphij	hp300-*)
681284194Sdelphij		basic_machine=m68k-hp
682284194Sdelphij		;;
683284194Sdelphij	hp300bsd)
684284194Sdelphij		basic_machine=m68k-hp
685284194Sdelphij		os=-bsd
686284194Sdelphij		;;
687284194Sdelphij	hp300hpux)
688284194Sdelphij		basic_machine=m68k-hp
689284194Sdelphij		os=-hpux
690284194Sdelphij		;;
691284194Sdelphij	hp3k9[0-9][0-9] | hp9[0-9][0-9])
692284194Sdelphij		basic_machine=hppa1.0-hp
693284194Sdelphij		;;
694284194Sdelphij	hp9k2[0-9][0-9] | hp9k31[0-9])
695284194Sdelphij		basic_machine=m68000-hp
696284194Sdelphij		;;
697284194Sdelphij	hp9k3[2-9][0-9])
698284194Sdelphij		basic_machine=m68k-hp
699284194Sdelphij		;;
700284194Sdelphij	hp9k6[0-9][0-9] | hp6[0-9][0-9])
701284194Sdelphij		basic_machine=hppa1.0-hp
702284194Sdelphij		;;
703284194Sdelphij	hp9k7[0-79][0-9] | hp7[0-79][0-9])
704284194Sdelphij		basic_machine=hppa1.1-hp
705284194Sdelphij		;;
706284194Sdelphij	hp9k78[0-9] | hp78[0-9])
707284194Sdelphij		# FIXME: really hppa2.0-hp
708284194Sdelphij		basic_machine=hppa1.1-hp
709284194Sdelphij		;;
710284194Sdelphij	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
711284194Sdelphij		# FIXME: really hppa2.0-hp
712284194Sdelphij		basic_machine=hppa1.1-hp
713284194Sdelphij		;;
714284194Sdelphij	hp9k8[0-9][13679] | hp8[0-9][13679])
715284194Sdelphij		basic_machine=hppa1.1-hp
716284194Sdelphij		;;
717284194Sdelphij	hp9k8[0-9][0-9] | hp8[0-9][0-9])
718284194Sdelphij		basic_machine=hppa1.0-hp
719284194Sdelphij		;;
720284194Sdelphij	hppa-next)
721284194Sdelphij		os=-nextstep3
722284194Sdelphij		;;
723284194Sdelphij	hppaosf)
724284194Sdelphij		basic_machine=hppa1.1-hp
725284194Sdelphij		os=-osf
726284194Sdelphij		;;
727284194Sdelphij	hppro)
728284194Sdelphij		basic_machine=hppa1.1-hp
729284194Sdelphij		os=-proelf
730284194Sdelphij		;;
731284194Sdelphij	i370-ibm* | ibm*)
732284194Sdelphij		basic_machine=i370-ibm
733284194Sdelphij		;;
734284194Sdelphij	i*86v32)
735284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
736284194Sdelphij		os=-sysv32
737284194Sdelphij		;;
738284194Sdelphij	i*86v4*)
739284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
740284194Sdelphij		os=-sysv4
741284194Sdelphij		;;
742284194Sdelphij	i*86v)
743284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
744284194Sdelphij		os=-sysv
745284194Sdelphij		;;
746284194Sdelphij	i*86sol2)
747284194Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
748284194Sdelphij		os=-solaris2
749284194Sdelphij		;;
750284194Sdelphij	i386mach)
751284194Sdelphij		basic_machine=i386-mach
752284194Sdelphij		os=-mach
753284194Sdelphij		;;
754284194Sdelphij	i386-vsta | vsta)
755284194Sdelphij		basic_machine=i386-unknown
756284194Sdelphij		os=-vsta
757284194Sdelphij		;;
758284194Sdelphij	iris | iris4d)
759284194Sdelphij		basic_machine=mips-sgi
760284194Sdelphij		case $os in
761284194Sdelphij		    -irix*)
762284194Sdelphij			;;
763284194Sdelphij		    *)
764284194Sdelphij			os=-irix4
765284194Sdelphij			;;
766284194Sdelphij		esac
767284194Sdelphij		;;
768284194Sdelphij	isi68 | isi)
769284194Sdelphij		basic_machine=m68k-isi
770284194Sdelphij		os=-sysv
771284194Sdelphij		;;
772284194Sdelphij	m68knommu)
773284194Sdelphij		basic_machine=m68k-unknown
774284194Sdelphij		os=-linux
775284194Sdelphij		;;
776284194Sdelphij	m68knommu-*)
777284194Sdelphij		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
778284194Sdelphij		os=-linux
779284194Sdelphij		;;
780284194Sdelphij	m88k-omron*)
781284194Sdelphij		basic_machine=m88k-omron
782284194Sdelphij		;;
783284194Sdelphij	magnum | m3230)
784284194Sdelphij		basic_machine=mips-mips
785284194Sdelphij		os=-sysv
786284194Sdelphij		;;
787284194Sdelphij	merlin)
788284194Sdelphij		basic_machine=ns32k-utek
789284194Sdelphij		os=-sysv
790284194Sdelphij		;;
791284194Sdelphij	microblaze)
792284194Sdelphij		basic_machine=microblaze-xilinx
793284194Sdelphij		;;
794284194Sdelphij	mingw32)
795284194Sdelphij		basic_machine=i386-pc
796284194Sdelphij		os=-mingw32
797284194Sdelphij		;;
798284194Sdelphij	mingw32ce)
799284194Sdelphij		basic_machine=arm-unknown
800284194Sdelphij		os=-mingw32ce
801284194Sdelphij		;;
802284194Sdelphij	miniframe)
803284194Sdelphij		basic_machine=m68000-convergent
804284194Sdelphij		;;
805284194Sdelphij	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
806284194Sdelphij		basic_machine=m68k-atari
807284194Sdelphij		os=-mint
808284194Sdelphij		;;
809284194Sdelphij	mips3*-*)
810284194Sdelphij		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
811284194Sdelphij		;;
812284194Sdelphij	mips3*)
813284194Sdelphij		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
814284194Sdelphij		;;
815284194Sdelphij	monitor)
816284194Sdelphij		basic_machine=m68k-rom68k
817284194Sdelphij		os=-coff
818284194Sdelphij		;;
819284194Sdelphij	morphos)
820284194Sdelphij		basic_machine=powerpc-unknown
821284194Sdelphij		os=-morphos
822284194Sdelphij		;;
823284194Sdelphij	msdos)
824284194Sdelphij		basic_machine=i386-pc
825284194Sdelphij		os=-msdos
826284194Sdelphij		;;
827284194Sdelphij	ms1-*)
828284194Sdelphij		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
829284194Sdelphij		;;
830284194Sdelphij	msys)
831284194Sdelphij		basic_machine=i386-pc
832284194Sdelphij		os=-msys
833284194Sdelphij		;;
834284194Sdelphij	mvs)
835284194Sdelphij		basic_machine=i370-ibm
836284194Sdelphij		os=-mvs
837284194Sdelphij		;;
838284194Sdelphij	nacl)
839284194Sdelphij		basic_machine=le32-unknown
840284194Sdelphij		os=-nacl
841284194Sdelphij		;;
842284194Sdelphij	ncr3000)
843284194Sdelphij		basic_machine=i486-ncr
844284194Sdelphij		os=-sysv4
845284194Sdelphij		;;
846284194Sdelphij	netbsd386)
847284194Sdelphij		basic_machine=i386-unknown
848284194Sdelphij		os=-netbsd
849284194Sdelphij		;;
850284194Sdelphij	netwinder)
851284194Sdelphij		basic_machine=armv4l-rebel
852284194Sdelphij		os=-linux
853284194Sdelphij		;;
854284194Sdelphij	news | news700 | news800 | news900)
855284194Sdelphij		basic_machine=m68k-sony
856284194Sdelphij		os=-newsos
857284194Sdelphij		;;
858284194Sdelphij	news1000)
859284194Sdelphij		basic_machine=m68030-sony
860284194Sdelphij		os=-newsos
861284194Sdelphij		;;
862284194Sdelphij	news-3600 | risc-news)
863284194Sdelphij		basic_machine=mips-sony
864284194Sdelphij		os=-newsos
865284194Sdelphij		;;
866284194Sdelphij	necv70)
867284194Sdelphij		basic_machine=v70-nec
868284194Sdelphij		os=-sysv
869284194Sdelphij		;;
870284194Sdelphij	next | m*-next )
871284194Sdelphij		basic_machine=m68k-next
872284194Sdelphij		case $os in
873284194Sdelphij		    -nextstep* )
874284194Sdelphij			;;
875284194Sdelphij		    -ns2*)
876284194Sdelphij		      os=-nextstep2
877284194Sdelphij			;;
878284194Sdelphij		    *)
879284194Sdelphij		      os=-nextstep3
880284194Sdelphij			;;
881284194Sdelphij		esac
882284194Sdelphij		;;
883284194Sdelphij	nh3000)
884284194Sdelphij		basic_machine=m68k-harris
885284194Sdelphij		os=-cxux
886284194Sdelphij		;;
887284194Sdelphij	nh[45]000)
888284194Sdelphij		basic_machine=m88k-harris
889284194Sdelphij		os=-cxux
890284194Sdelphij		;;
891284194Sdelphij	nindy960)
892284194Sdelphij		basic_machine=i960-intel
893284194Sdelphij		os=-nindy
894284194Sdelphij		;;
895284194Sdelphij	mon960)
896284194Sdelphij		basic_machine=i960-intel
897284194Sdelphij		os=-mon960
898284194Sdelphij		;;
899284194Sdelphij	nonstopux)
900284194Sdelphij		basic_machine=mips-compaq
901284194Sdelphij		os=-nonstopux
902284194Sdelphij		;;
903284194Sdelphij	np1)
904284194Sdelphij		basic_machine=np1-gould
905284194Sdelphij		;;
906284194Sdelphij	neo-tandem)
907284194Sdelphij		basic_machine=neo-tandem
908284194Sdelphij		;;
909284194Sdelphij	nse-tandem)
910284194Sdelphij		basic_machine=nse-tandem
911284194Sdelphij		;;
912284194Sdelphij	nsr-tandem)
913284194Sdelphij		basic_machine=nsr-tandem
914284194Sdelphij		;;
915284194Sdelphij	op50n-* | op60c-*)
916284194Sdelphij		basic_machine=hppa1.1-oki
917284194Sdelphij		os=-proelf
918284194Sdelphij		;;
919284194Sdelphij	openrisc | openrisc-*)
920284194Sdelphij		basic_machine=or32-unknown
921284194Sdelphij		;;
922284194Sdelphij	os400)
923284194Sdelphij		basic_machine=powerpc-ibm
924284194Sdelphij		os=-os400
925284194Sdelphij		;;
926284194Sdelphij	OSE68000 | ose68000)
927284194Sdelphij		basic_machine=m68000-ericsson
928284194Sdelphij		os=-ose
929284194Sdelphij		;;
930284194Sdelphij	os68k)
931284194Sdelphij		basic_machine=m68k-none
932284194Sdelphij		os=-os68k
933284194Sdelphij		;;
934284194Sdelphij	pa-hitachi)
935284194Sdelphij		basic_machine=hppa1.1-hitachi
936284194Sdelphij		os=-hiuxwe2
937284194Sdelphij		;;
938284194Sdelphij	paragon)
939284194Sdelphij		basic_machine=i860-intel
940284194Sdelphij		os=-osf
941284194Sdelphij		;;
942284194Sdelphij	parisc)
943284194Sdelphij		basic_machine=hppa-unknown
944284194Sdelphij		os=-linux
945284194Sdelphij		;;
946284194Sdelphij	parisc-*)
947284194Sdelphij		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
948284194Sdelphij		os=-linux
949284194Sdelphij		;;
950284194Sdelphij	pbd)
951284194Sdelphij		basic_machine=sparc-tti
952284194Sdelphij		;;
953284194Sdelphij	pbb)
954284194Sdelphij		basic_machine=m68k-tti
955284194Sdelphij		;;
956284194Sdelphij	pc532 | pc532-*)
957284194Sdelphij		basic_machine=ns32k-pc532
958284194Sdelphij		;;
959284194Sdelphij	pc98)
960284194Sdelphij		basic_machine=i386-pc
961284194Sdelphij		;;
962284194Sdelphij	pc98-*)
963284194Sdelphij		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
964284194Sdelphij		;;
965284194Sdelphij	pentium | p5 | k5 | k6 | nexgen | viac3)
966284194Sdelphij		basic_machine=i586-pc
967284194Sdelphij		;;
968284194Sdelphij	pentiumpro | p6 | 6x86 | athlon | athlon_*)
969284194Sdelphij		basic_machine=i686-pc
970284194Sdelphij		;;
971284194Sdelphij	pentiumii | pentium2 | pentiumiii | pentium3)
972284194Sdelphij		basic_machine=i686-pc
973284194Sdelphij		;;
974284194Sdelphij	pentium4)
975284194Sdelphij		basic_machine=i786-pc
976284194Sdelphij		;;
977284194Sdelphij	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
978284194Sdelphij		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
979284194Sdelphij		;;
980284194Sdelphij	pentiumpro-* | p6-* | 6x86-* | athlon-*)
981284194Sdelphij		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
982284194Sdelphij		;;
983284194Sdelphij	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
984284194Sdelphij		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
985284194Sdelphij		;;
986284194Sdelphij	pentium4-*)
987284194Sdelphij		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
988284194Sdelphij		;;
989284194Sdelphij	pn)
990284194Sdelphij		basic_machine=pn-gould
991284194Sdelphij		;;
992284194Sdelphij	power)	basic_machine=power-ibm
993284194Sdelphij		;;
994284194Sdelphij	ppc | ppcbe)	basic_machine=powerpc-unknown
995284194Sdelphij		;;
996284194Sdelphij	ppc-* | ppcbe-*)
997284194Sdelphij		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
998284194Sdelphij		;;
999284194Sdelphij	ppcle | powerpclittle | ppc-le | powerpc-little)
1000284194Sdelphij		basic_machine=powerpcle-unknown
1001284194Sdelphij		;;
1002284194Sdelphij	ppcle-* | powerpclittle-*)
1003284194Sdelphij		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
1004284194Sdelphij		;;
1005284194Sdelphij	ppc64)	basic_machine=powerpc64-unknown
1006284194Sdelphij		;;
1007284194Sdelphij	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
1008284194Sdelphij		;;
1009284194Sdelphij	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
1010284194Sdelphij		basic_machine=powerpc64le-unknown
1011284194Sdelphij		;;
1012284194Sdelphij	ppc64le-* | powerpc64little-*)
1013284194Sdelphij		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
1014284194Sdelphij		;;
1015284194Sdelphij	ps2)
1016284194Sdelphij		basic_machine=i386-ibm
1017284194Sdelphij		;;
1018284194Sdelphij	pw32)
1019284194Sdelphij		basic_machine=i586-unknown
1020284194Sdelphij		os=-pw32
1021284194Sdelphij		;;
1022284194Sdelphij	rdos)
1023284194Sdelphij		basic_machine=i386-pc
1024284194Sdelphij		os=-rdos
1025284194Sdelphij		;;
1026284194Sdelphij	rom68k)
1027284194Sdelphij		basic_machine=m68k-rom68k
1028284194Sdelphij		os=-coff
1029284194Sdelphij		;;
1030284194Sdelphij	rm[46]00)
1031284194Sdelphij		basic_machine=mips-siemens
1032284194Sdelphij		;;
1033284194Sdelphij	rtpc | rtpc-*)
1034284194Sdelphij		basic_machine=romp-ibm
1035284194Sdelphij		;;
1036284194Sdelphij	s390 | s390-*)
1037284194Sdelphij		basic_machine=s390-ibm
1038284194Sdelphij		;;
1039284194Sdelphij	s390x | s390x-*)
1040284194Sdelphij		basic_machine=s390x-ibm
1041284194Sdelphij		;;
1042284194Sdelphij	sa29200)
1043284194Sdelphij		basic_machine=a29k-amd
1044284194Sdelphij		os=-udi
1045284194Sdelphij		;;
1046284194Sdelphij	sb1)
1047284194Sdelphij		basic_machine=mipsisa64sb1-unknown
1048284194Sdelphij		;;
1049284194Sdelphij	sb1el)
1050284194Sdelphij		basic_machine=mipsisa64sb1el-unknown
1051284194Sdelphij		;;
1052284194Sdelphij	sde)
1053284194Sdelphij		basic_machine=mipsisa32-sde
1054284194Sdelphij		os=-elf
1055284194Sdelphij		;;
1056284194Sdelphij	sei)
1057284194Sdelphij		basic_machine=mips-sei
1058284194Sdelphij		os=-seiux
1059284194Sdelphij		;;
1060284194Sdelphij	sequent)
1061284194Sdelphij		basic_machine=i386-sequent
1062284194Sdelphij		;;
1063284194Sdelphij	sh)
1064284194Sdelphij		basic_machine=sh-hitachi
1065284194Sdelphij		os=-hms
1066284194Sdelphij		;;
1067284194Sdelphij	sh5el)
1068284194Sdelphij		basic_machine=sh5le-unknown
1069284194Sdelphij		;;
1070284194Sdelphij	sh64)
1071284194Sdelphij		basic_machine=sh64-unknown
1072284194Sdelphij		;;
1073284194Sdelphij	sparclite-wrs | simso-wrs)
1074284194Sdelphij		basic_machine=sparclite-wrs
1075284194Sdelphij		os=-vxworks
1076284194Sdelphij		;;
1077284194Sdelphij	sps7)
1078284194Sdelphij		basic_machine=m68k-bull
1079284194Sdelphij		os=-sysv2
1080284194Sdelphij		;;
1081284194Sdelphij	spur)
1082284194Sdelphij		basic_machine=spur-unknown
1083284194Sdelphij		;;
1084284194Sdelphij	st2000)
1085284194Sdelphij		basic_machine=m68k-tandem
1086284194Sdelphij		;;
1087284194Sdelphij	stratus)
1088284194Sdelphij		basic_machine=i860-stratus
1089284194Sdelphij		os=-sysv4
1090284194Sdelphij		;;
1091284194Sdelphij	strongarm-* | thumb-*)
1092284194Sdelphij		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
1093284194Sdelphij		;;
1094284194Sdelphij	sun2)
1095284194Sdelphij		basic_machine=m68000-sun
1096284194Sdelphij		;;
1097284194Sdelphij	sun2os3)
1098284194Sdelphij		basic_machine=m68000-sun
1099284194Sdelphij		os=-sunos3
1100284194Sdelphij		;;
1101284194Sdelphij	sun2os4)
1102284194Sdelphij		basic_machine=m68000-sun
1103284194Sdelphij		os=-sunos4
1104284194Sdelphij		;;
1105284194Sdelphij	sun3os3)
1106284194Sdelphij		basic_machine=m68k-sun
1107284194Sdelphij		os=-sunos3
1108284194Sdelphij		;;
1109284194Sdelphij	sun3os4)
1110284194Sdelphij		basic_machine=m68k-sun
1111284194Sdelphij		os=-sunos4
1112284194Sdelphij		;;
1113284194Sdelphij	sun4os3)
1114284194Sdelphij		basic_machine=sparc-sun
1115284194Sdelphij		os=-sunos3
1116284194Sdelphij		;;
1117284194Sdelphij	sun4os4)
1118284194Sdelphij		basic_machine=sparc-sun
1119284194Sdelphij		os=-sunos4
1120284194Sdelphij		;;
1121284194Sdelphij	sun4sol2)
1122284194Sdelphij		basic_machine=sparc-sun
1123284194Sdelphij		os=-solaris2
1124284194Sdelphij		;;
1125284194Sdelphij	sun3 | sun3-*)
1126284194Sdelphij		basic_machine=m68k-sun
1127284194Sdelphij		;;
1128284194Sdelphij	sun4)
1129284194Sdelphij		basic_machine=sparc-sun
1130284194Sdelphij		;;
1131284194Sdelphij	sun386 | sun386i | roadrunner)
1132284194Sdelphij		basic_machine=i386-sun
1133284194Sdelphij		;;
1134284194Sdelphij	sv1)
1135284194Sdelphij		basic_machine=sv1-cray
1136284194Sdelphij		os=-unicos
1137284194Sdelphij		;;
1138284194Sdelphij	symmetry)
1139284194Sdelphij		basic_machine=i386-sequent
1140284194Sdelphij		os=-dynix
1141284194Sdelphij		;;
1142284194Sdelphij	t3e)
1143284194Sdelphij		basic_machine=alphaev5-cray
1144284194Sdelphij		os=-unicos
1145284194Sdelphij		;;
1146284194Sdelphij	t90)
1147284194Sdelphij		basic_machine=t90-cray
1148284194Sdelphij		os=-unicos
1149284194Sdelphij		;;
1150284194Sdelphij	tile*)
1151284194Sdelphij		basic_machine=$basic_machine-unknown
1152284194Sdelphij		os=-linux-gnu
1153284194Sdelphij		;;
1154284194Sdelphij	tx39)
1155284194Sdelphij		basic_machine=mipstx39-unknown
1156284194Sdelphij		;;
1157284194Sdelphij	tx39el)
1158284194Sdelphij		basic_machine=mipstx39el-unknown
1159284194Sdelphij		;;
1160284194Sdelphij	toad1)
1161284194Sdelphij		basic_machine=pdp10-xkl
1162284194Sdelphij		os=-tops20
1163284194Sdelphij		;;
1164284194Sdelphij	tower | tower-32)
1165284194Sdelphij		basic_machine=m68k-ncr
1166284194Sdelphij		;;
1167284194Sdelphij	tpf)
1168284194Sdelphij		basic_machine=s390x-ibm
1169284194Sdelphij		os=-tpf
1170284194Sdelphij		;;
1171284194Sdelphij	udi29k)
1172284194Sdelphij		basic_machine=a29k-amd
1173284194Sdelphij		os=-udi
1174284194Sdelphij		;;
1175284194Sdelphij	ultra3)
1176284194Sdelphij		basic_machine=a29k-nyu
1177284194Sdelphij		os=-sym1
1178284194Sdelphij		;;
1179284194Sdelphij	v810 | necv810)
1180284194Sdelphij		basic_machine=v810-nec
1181284194Sdelphij		os=-none
1182284194Sdelphij		;;
1183284194Sdelphij	vaxv)
1184284194Sdelphij		basic_machine=vax-dec
1185284194Sdelphij		os=-sysv
1186284194Sdelphij		;;
1187284194Sdelphij	vms)
1188284194Sdelphij		basic_machine=vax-dec
1189284194Sdelphij		os=-vms
1190284194Sdelphij		;;
1191284194Sdelphij	vpp*|vx|vx-*)
1192284194Sdelphij		basic_machine=f301-fujitsu
1193284194Sdelphij		;;
1194284194Sdelphij	vxworks960)
1195284194Sdelphij		basic_machine=i960-wrs
1196284194Sdelphij		os=-vxworks
1197284194Sdelphij		;;
1198284194Sdelphij	vxworks68)
1199284194Sdelphij		basic_machine=m68k-wrs
1200284194Sdelphij		os=-vxworks
1201284194Sdelphij		;;
1202284194Sdelphij	vxworks29k)
1203284194Sdelphij		basic_machine=a29k-wrs
1204284194Sdelphij		os=-vxworks
1205284194Sdelphij		;;
1206284194Sdelphij	w65*)
1207284194Sdelphij		basic_machine=w65-wdc
1208284194Sdelphij		os=-none
1209284194Sdelphij		;;
1210284194Sdelphij	w89k-*)
1211284194Sdelphij		basic_machine=hppa1.1-winbond
1212284194Sdelphij		os=-proelf
1213284194Sdelphij		;;
1214284194Sdelphij	xbox)
1215284194Sdelphij		basic_machine=i686-pc
1216284194Sdelphij		os=-mingw32
1217284194Sdelphij		;;
1218284194Sdelphij	xps | xps100)
1219284194Sdelphij		basic_machine=xps100-honeywell
1220284194Sdelphij		;;
1221284194Sdelphij	xscale-* | xscalee[bl]-*)
1222284194Sdelphij		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
1223284194Sdelphij		;;
1224284194Sdelphij	ymp)
1225284194Sdelphij		basic_machine=ymp-cray
1226284194Sdelphij		os=-unicos
1227284194Sdelphij		;;
1228284194Sdelphij	z8k-*-coff)
1229284194Sdelphij		basic_machine=z8k-unknown
1230284194Sdelphij		os=-sim
1231284194Sdelphij		;;
1232284194Sdelphij	z80-*-coff)
1233284194Sdelphij		basic_machine=z80-unknown
1234284194Sdelphij		os=-sim
1235284194Sdelphij		;;
1236284194Sdelphij	none)
1237284194Sdelphij		basic_machine=none-none
1238284194Sdelphij		os=-none
1239284194Sdelphij		;;
1240284194Sdelphij
1241284194Sdelphij# Here we handle the default manufacturer of certain CPU types.  It is in
1242284194Sdelphij# some cases the only manufacturer, in others, it is the most popular.
1243284194Sdelphij	w89k)
1244284194Sdelphij		basic_machine=hppa1.1-winbond
1245284194Sdelphij		;;
1246284194Sdelphij	op50n)
1247284194Sdelphij		basic_machine=hppa1.1-oki
1248284194Sdelphij		;;
1249284194Sdelphij	op60c)
1250284194Sdelphij		basic_machine=hppa1.1-oki
1251284194Sdelphij		;;
1252284194Sdelphij	romp)
1253284194Sdelphij		basic_machine=romp-ibm
1254284194Sdelphij		;;
1255284194Sdelphij	mmix)
1256284194Sdelphij		basic_machine=mmix-knuth
1257284194Sdelphij		;;
1258284194Sdelphij	rs6000)
1259284194Sdelphij		basic_machine=rs6000-ibm
1260284194Sdelphij		;;
1261284194Sdelphij	vax)
1262284194Sdelphij		basic_machine=vax-dec
1263284194Sdelphij		;;
1264284194Sdelphij	pdp10)
1265284194Sdelphij		# there are many clones, so DEC is not a safe bet
1266284194Sdelphij		basic_machine=pdp10-unknown
1267284194Sdelphij		;;
1268284194Sdelphij	pdp11)
1269284194Sdelphij		basic_machine=pdp11-dec
1270284194Sdelphij		;;
1271284194Sdelphij	we32k)
1272284194Sdelphij		basic_machine=we32k-att
1273284194Sdelphij		;;
1274284194Sdelphij	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
1275284194Sdelphij		basic_machine=sh-unknown
1276284194Sdelphij		;;
1277284194Sdelphij	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1278284194Sdelphij		basic_machine=sparc-sun
1279284194Sdelphij		;;
1280284194Sdelphij	cydra)
1281284194Sdelphij		basic_machine=cydra-cydrome
1282284194Sdelphij		;;
1283284194Sdelphij	orion)
1284284194Sdelphij		basic_machine=orion-highlevel
1285284194Sdelphij		;;
1286284194Sdelphij	orion105)
1287284194Sdelphij		basic_machine=clipper-highlevel
1288284194Sdelphij		;;
1289284194Sdelphij	mac | mpw | mac-mpw)
1290284194Sdelphij		basic_machine=m68k-apple
1291284194Sdelphij		;;
1292284194Sdelphij	pmac | pmac-mpw)
1293284194Sdelphij		basic_machine=powerpc-apple
1294284194Sdelphij		;;
1295284194Sdelphij	*-unknown)
1296284194Sdelphij		# Make sure to match an already-canonicalized machine name.
1297284194Sdelphij		;;
1298284194Sdelphij	*)
1299284194Sdelphij		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1300284194Sdelphij		exit 1
1301284194Sdelphij		;;
1302284194Sdelphijesac
1303284194Sdelphij
1304284194Sdelphij# Here we canonicalize certain aliases for manufacturers.
1305284194Sdelphijcase $basic_machine in
1306284194Sdelphij	*-digital*)
1307284194Sdelphij		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1308284194Sdelphij		;;
1309284194Sdelphij	*-commodore*)
1310284194Sdelphij		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1311284194Sdelphij		;;
1312284194Sdelphij	*)
1313284194Sdelphij		;;
1314284194Sdelphijesac
1315284194Sdelphij
1316284194Sdelphij# Decode manufacturer-specific aliases for certain operating systems.
1317284194Sdelphij
1318284194Sdelphijif [ x"$os" != x"" ]
1319284194Sdelphijthen
1320284194Sdelphijcase $os in
1321284194Sdelphij	# First match some system type aliases
1322284194Sdelphij	# that might get confused with valid system types.
1323284194Sdelphij	# -solaris* is a basic system type, with this one exception.
1324284194Sdelphij	-auroraux)
1325284194Sdelphij		os=-auroraux
1326284194Sdelphij		;;
1327284194Sdelphij	-solaris1 | -solaris1.*)
1328284194Sdelphij		os=`echo $os | sed -e 's|solaris1|sunos4|'`
1329284194Sdelphij		;;
1330284194Sdelphij	-solaris)
1331284194Sdelphij		os=-solaris2
1332284194Sdelphij		;;
1333284194Sdelphij	-svr4*)
1334284194Sdelphij		os=-sysv4
1335284194Sdelphij		;;
1336284194Sdelphij	-unixware*)
1337284194Sdelphij		os=-sysv4.2uw
1338284194Sdelphij		;;
1339284194Sdelphij	-gnu/linux*)
1340284194Sdelphij		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1341284194Sdelphij		;;
1342284194Sdelphij	# First accept the basic system types.
1343284194Sdelphij	# The portable systems comes first.
1344284194Sdelphij	# Each alternative MUST END IN A *, to match a version number.
1345284194Sdelphij	# -sysv* is not here because it comes later, after sysvr4.
1346284194Sdelphij	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1347284194Sdelphij	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1348284194Sdelphij	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1349284194Sdelphij	      | -sym* | -kopensolaris* \
1350284194Sdelphij	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1351284194Sdelphij	      | -aos* | -aros* \
1352284194Sdelphij	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1353284194Sdelphij	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1354284194Sdelphij	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1355284194Sdelphij	      | -openbsd* | -solidbsd* \
1356284194Sdelphij	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1357284194Sdelphij	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1358284194Sdelphij	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1359284194Sdelphij	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1360284194Sdelphij	      | -chorusos* | -chorusrdb* | -cegcc* \
1361284194Sdelphij	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1362284194Sdelphij	      | -mingw32* | -linux-gnu* | -linux-android* \
1363284194Sdelphij	      | -linux-newlib* | -linux-uclibc* \
1364284194Sdelphij	      | -uxpv* | -beos* | -mpeix* | -udk* \
1365284194Sdelphij	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1366284194Sdelphij	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1367284194Sdelphij	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1368284194Sdelphij	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1369284194Sdelphij	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1370284194Sdelphij	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1371284194Sdelphij	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
1372284194Sdelphij	# Remember, each alternative MUST END IN *, to match a version number.
1373284194Sdelphij		;;
1374284194Sdelphij	-qnx*)
1375284194Sdelphij		case $basic_machine in
1376284194Sdelphij		    x86-* | i*86-*)
1377284194Sdelphij			;;
1378284194Sdelphij		    *)
1379284194Sdelphij			os=-nto$os
1380284194Sdelphij			;;
1381284194Sdelphij		esac
1382284194Sdelphij		;;
1383284194Sdelphij	-nto-qnx*)
1384284194Sdelphij		;;
1385284194Sdelphij	-nto*)
1386284194Sdelphij		os=`echo $os | sed -e 's|nto|nto-qnx|'`
1387284194Sdelphij		;;
1388284194Sdelphij	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1389284194Sdelphij	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1390284194Sdelphij	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1391284194Sdelphij		;;
1392284194Sdelphij	-mac*)
1393284194Sdelphij		os=`echo $os | sed -e 's|mac|macos|'`
1394284194Sdelphij		;;
1395284194Sdelphij	-linux-dietlibc)
1396284194Sdelphij		os=-linux-dietlibc
1397284194Sdelphij		;;
1398284194Sdelphij	-linux*)
1399284194Sdelphij		os=`echo $os | sed -e 's|linux|linux-gnu|'`
1400284194Sdelphij		;;
1401284194Sdelphij	-sunos5*)
1402284194Sdelphij		os=`echo $os | sed -e 's|sunos5|solaris2|'`
1403284194Sdelphij		;;
1404284194Sdelphij	-sunos6*)
1405284194Sdelphij		os=`echo $os | sed -e 's|sunos6|solaris3|'`
1406284194Sdelphij		;;
1407284194Sdelphij	-opened*)
1408284194Sdelphij		os=-openedition
1409284194Sdelphij		;;
1410284194Sdelphij	-os400*)
1411284194Sdelphij		os=-os400
1412284194Sdelphij		;;
1413284194Sdelphij	-wince*)
1414284194Sdelphij		os=-wince
1415284194Sdelphij		;;
1416284194Sdelphij	-osfrose*)
1417284194Sdelphij		os=-osfrose
1418284194Sdelphij		;;
1419284194Sdelphij	-osf*)
1420284194Sdelphij		os=-osf
1421284194Sdelphij		;;
1422284194Sdelphij	-utek*)
1423284194Sdelphij		os=-bsd
1424284194Sdelphij		;;
1425284194Sdelphij	-dynix*)
1426284194Sdelphij		os=-bsd
1427284194Sdelphij		;;
1428284194Sdelphij	-acis*)
1429284194Sdelphij		os=-aos
1430284194Sdelphij		;;
1431284194Sdelphij	-atheos*)
1432284194Sdelphij		os=-atheos
1433284194Sdelphij		;;
1434284194Sdelphij	-syllable*)
1435284194Sdelphij		os=-syllable
1436284194Sdelphij		;;
1437284194Sdelphij	-386bsd)
1438284194Sdelphij		os=-bsd
1439284194Sdelphij		;;
1440284194Sdelphij	-ctix* | -uts*)
1441284194Sdelphij		os=-sysv
1442284194Sdelphij		;;
1443284194Sdelphij	-nova*)
1444284194Sdelphij		os=-rtmk-nova
1445284194Sdelphij		;;
1446284194Sdelphij	-ns2 )
1447284194Sdelphij		os=-nextstep2
1448284194Sdelphij		;;
1449284194Sdelphij	-nsk*)
1450284194Sdelphij		os=-nsk
1451284194Sdelphij		;;
1452284194Sdelphij	# Preserve the version number of sinix5.
1453284194Sdelphij	-sinix5.*)
1454284194Sdelphij		os=`echo $os | sed -e 's|sinix|sysv|'`
1455284194Sdelphij		;;
1456284194Sdelphij	-sinix*)
1457284194Sdelphij		os=-sysv4
1458284194Sdelphij		;;
1459284194Sdelphij	-tpf*)
1460284194Sdelphij		os=-tpf
1461284194Sdelphij		;;
1462284194Sdelphij	-triton*)
1463284194Sdelphij		os=-sysv3
1464284194Sdelphij		;;
1465284194Sdelphij	-oss*)
1466284194Sdelphij		os=-sysv3
1467284194Sdelphij		;;
1468284194Sdelphij	-svr4)
1469284194Sdelphij		os=-sysv4
1470284194Sdelphij		;;
1471284194Sdelphij	-svr3)
1472284194Sdelphij		os=-sysv3
1473284194Sdelphij		;;
1474284194Sdelphij	-sysvr4)
1475284194Sdelphij		os=-sysv4
1476284194Sdelphij		;;
1477284194Sdelphij	# This must come after -sysvr4.
1478284194Sdelphij	-sysv*)
1479284194Sdelphij		;;
1480284194Sdelphij	-ose*)
1481284194Sdelphij		os=-ose
1482284194Sdelphij		;;
1483284194Sdelphij	-es1800*)
1484284194Sdelphij		os=-ose
1485284194Sdelphij		;;
1486284194Sdelphij	-xenix)
1487284194Sdelphij		os=-xenix
1488284194Sdelphij		;;
1489284194Sdelphij	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1490284194Sdelphij		os=-mint
1491284194Sdelphij		;;
1492284194Sdelphij	-aros*)
1493284194Sdelphij		os=-aros
1494284194Sdelphij		;;
1495284194Sdelphij	-kaos*)
1496284194Sdelphij		os=-kaos
1497284194Sdelphij		;;
1498284194Sdelphij	-zvmoe)
1499284194Sdelphij		os=-zvmoe
1500284194Sdelphij		;;
1501284194Sdelphij	-dicos*)
1502284194Sdelphij		os=-dicos
1503284194Sdelphij		;;
1504284194Sdelphij	-nacl*)
1505284194Sdelphij		;;
1506284194Sdelphij	-none)
1507284194Sdelphij		;;
1508284194Sdelphij	*)
1509284194Sdelphij		# Get rid of the `-' at the beginning of $os.
1510284194Sdelphij		os=`echo $os | sed 's/[^-]*-//'`
1511284194Sdelphij		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1512284194Sdelphij		exit 1
1513284194Sdelphij		;;
1514284194Sdelphijesac
1515284194Sdelphijelse
1516284194Sdelphij
1517284194Sdelphij# Here we handle the default operating systems that come with various machines.
1518284194Sdelphij# The value should be what the vendor currently ships out the door with their
1519284194Sdelphij# machine or put another way, the most popular os provided with the machine.
1520284194Sdelphij
1521284194Sdelphij# Note that if you're going to try to match "-MANUFACTURER" here (say,
1522284194Sdelphij# "-sun"), then you have to tell the case statement up towards the top
1523284194Sdelphij# that MANUFACTURER isn't an operating system.  Otherwise, code above
1524284194Sdelphij# will signal an error saying that MANUFACTURER isn't an operating
1525284194Sdelphij# system, and we'll never get to this point.
1526284194Sdelphij
1527284194Sdelphijcase $basic_machine in
1528284194Sdelphij	score-*)
1529284194Sdelphij		os=-elf
1530284194Sdelphij		;;
1531284194Sdelphij	spu-*)
1532284194Sdelphij		os=-elf
1533284194Sdelphij		;;
1534284194Sdelphij	*-acorn)
1535284194Sdelphij		os=-riscix1.2
1536284194Sdelphij		;;
1537284194Sdelphij	arm*-rebel)
1538284194Sdelphij		os=-linux
1539284194Sdelphij		;;
1540284194Sdelphij	arm*-semi)
1541284194Sdelphij		os=-aout
1542284194Sdelphij		;;
1543284194Sdelphij	c4x-* | tic4x-*)
1544284194Sdelphij		os=-coff
1545284194Sdelphij		;;
1546284194Sdelphij	tic54x-*)
1547284194Sdelphij		os=-coff
1548284194Sdelphij		;;
1549284194Sdelphij	tic55x-*)
1550284194Sdelphij		os=-coff
1551284194Sdelphij		;;
1552284194Sdelphij	tic6x-*)
1553284194Sdelphij		os=-coff
1554284194Sdelphij		;;
1555284194Sdelphij	# This must come before the *-dec entry.
1556284194Sdelphij	pdp10-*)
1557284194Sdelphij		os=-tops20
1558284194Sdelphij		;;
1559284194Sdelphij	pdp11-*)
1560284194Sdelphij		os=-none
1561284194Sdelphij		;;
1562284194Sdelphij	*-dec | vax-*)
1563284194Sdelphij		os=-ultrix4.2
1564284194Sdelphij		;;
1565284194Sdelphij	m68*-apollo)
1566284194Sdelphij		os=-domain
1567284194Sdelphij		;;
1568284194Sdelphij	i386-sun)
1569284194Sdelphij		os=-sunos4.0.2
1570284194Sdelphij		;;
1571284194Sdelphij	m68000-sun)
1572284194Sdelphij		os=-sunos3
1573284194Sdelphij		;;
1574284194Sdelphij	m68*-cisco)
1575284194Sdelphij		os=-aout
1576284194Sdelphij		;;
1577284194Sdelphij	mep-*)
1578284194Sdelphij		os=-elf
1579284194Sdelphij		;;
1580284194Sdelphij	mips*-cisco)
1581284194Sdelphij		os=-elf
1582284194Sdelphij		;;
1583284194Sdelphij	mips*-*)
1584284194Sdelphij		os=-elf
1585284194Sdelphij		;;
1586284194Sdelphij	or32-*)
1587284194Sdelphij		os=-coff
1588284194Sdelphij		;;
1589284194Sdelphij	*-tti)	# must be before sparc entry or we get the wrong os.
1590284194Sdelphij		os=-sysv3
1591284194Sdelphij		;;
1592284194Sdelphij	sparc-* | *-sun)
1593284194Sdelphij		os=-sunos4.1.1
1594284194Sdelphij		;;
1595284194Sdelphij	*-be)
1596284194Sdelphij		os=-beos
1597284194Sdelphij		;;
1598284194Sdelphij	*-haiku)
1599284194Sdelphij		os=-haiku
1600284194Sdelphij		;;
1601284194Sdelphij	*-ibm)
1602284194Sdelphij		os=-aix
1603284194Sdelphij		;;
1604284194Sdelphij	*-knuth)
1605284194Sdelphij		os=-mmixware
1606284194Sdelphij		;;
1607284194Sdelphij	*-wec)
1608284194Sdelphij		os=-proelf
1609284194Sdelphij		;;
1610284194Sdelphij	*-winbond)
1611284194Sdelphij		os=-proelf
1612284194Sdelphij		;;
1613284194Sdelphij	*-oki)
1614284194Sdelphij		os=-proelf
1615284194Sdelphij		;;
1616284194Sdelphij	*-hp)
1617284194Sdelphij		os=-hpux
1618284194Sdelphij		;;
1619284194Sdelphij	*-hitachi)
1620284194Sdelphij		os=-hiux
1621284194Sdelphij		;;
1622284194Sdelphij	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1623284194Sdelphij		os=-sysv
1624284194Sdelphij		;;
1625284194Sdelphij	*-cbm)
1626284194Sdelphij		os=-amigaos
1627284194Sdelphij		;;
1628284194Sdelphij	*-dg)
1629284194Sdelphij		os=-dgux
1630284194Sdelphij		;;
1631284194Sdelphij	*-dolphin)
1632284194Sdelphij		os=-sysv3
1633284194Sdelphij		;;
1634284194Sdelphij	m68k-ccur)
1635284194Sdelphij		os=-rtu
1636284194Sdelphij		;;
1637284194Sdelphij	m88k-omron*)
1638284194Sdelphij		os=-luna
1639284194Sdelphij		;;
1640284194Sdelphij	*-next )
1641284194Sdelphij		os=-nextstep
1642284194Sdelphij		;;
1643284194Sdelphij	*-sequent)
1644284194Sdelphij		os=-ptx
1645284194Sdelphij		;;
1646284194Sdelphij	*-crds)
1647284194Sdelphij		os=-unos
1648284194Sdelphij		;;
1649284194Sdelphij	*-ns)
1650284194Sdelphij		os=-genix
1651284194Sdelphij		;;
1652284194Sdelphij	i370-*)
1653284194Sdelphij		os=-mvs
1654284194Sdelphij		;;
1655284194Sdelphij	*-next)
1656284194Sdelphij		os=-nextstep3
1657284194Sdelphij		;;
1658284194Sdelphij	*-gould)
1659284194Sdelphij		os=-sysv
1660284194Sdelphij		;;
1661284194Sdelphij	*-highlevel)
1662284194Sdelphij		os=-bsd
1663284194Sdelphij		;;
1664284194Sdelphij	*-encore)
1665284194Sdelphij		os=-bsd
1666284194Sdelphij		;;
1667284194Sdelphij	*-sgi)
1668284194Sdelphij		os=-irix
1669284194Sdelphij		;;
1670284194Sdelphij	*-siemens)
1671284194Sdelphij		os=-sysv4
1672284194Sdelphij		;;
1673284194Sdelphij	*-masscomp)
1674284194Sdelphij		os=-rtu
1675284194Sdelphij		;;
1676284194Sdelphij	f30[01]-fujitsu | f700-fujitsu)
1677284194Sdelphij		os=-uxpv
1678284194Sdelphij		;;
1679284194Sdelphij	*-rom68k)
1680284194Sdelphij		os=-coff
1681284194Sdelphij		;;
1682284194Sdelphij	*-*bug)
1683284194Sdelphij		os=-coff
1684284194Sdelphij		;;
1685284194Sdelphij	*-apple)
1686284194Sdelphij		os=-macos
1687284194Sdelphij		;;
1688284194Sdelphij	*-atari*)
1689284194Sdelphij		os=-mint
1690284194Sdelphij		;;
1691284194Sdelphij	*)
1692284194Sdelphij		os=-none
1693284194Sdelphij		;;
1694284194Sdelphijesac
1695284194Sdelphijfi
1696284194Sdelphij
1697284194Sdelphij# Here we handle the case where we know the os, and the CPU type, but not the
1698284194Sdelphij# manufacturer.  We pick the logical manufacturer.
1699284194Sdelphijvendor=unknown
1700284194Sdelphijcase $basic_machine in
1701284194Sdelphij	*-unknown)
1702284194Sdelphij		case $os in
1703284194Sdelphij			-riscix*)
1704284194Sdelphij				vendor=acorn
1705284194Sdelphij				;;
1706284194Sdelphij			-sunos*)
1707284194Sdelphij				vendor=sun
1708284194Sdelphij				;;
1709284194Sdelphij			-cnk*|-aix*)
1710284194Sdelphij				vendor=ibm
1711284194Sdelphij				;;
1712284194Sdelphij			-beos*)
1713284194Sdelphij				vendor=be
1714284194Sdelphij				;;
1715284194Sdelphij			-hpux*)
1716284194Sdelphij				vendor=hp
1717284194Sdelphij				;;
1718284194Sdelphij			-mpeix*)
1719284194Sdelphij				vendor=hp
1720284194Sdelphij				;;
1721284194Sdelphij			-hiux*)
1722284194Sdelphij				vendor=hitachi
1723284194Sdelphij				;;
1724284194Sdelphij			-unos*)
1725284194Sdelphij				vendor=crds
1726284194Sdelphij				;;
1727284194Sdelphij			-dgux*)
1728284194Sdelphij				vendor=dg
1729284194Sdelphij				;;
1730284194Sdelphij			-luna*)
1731284194Sdelphij				vendor=omron
1732284194Sdelphij				;;
1733284194Sdelphij			-genix*)
1734284194Sdelphij				vendor=ns
1735284194Sdelphij				;;
1736284194Sdelphij			-mvs* | -opened*)
1737284194Sdelphij				vendor=ibm
1738284194Sdelphij				;;
1739284194Sdelphij			-os400*)
1740284194Sdelphij				vendor=ibm
1741284194Sdelphij				;;
1742284194Sdelphij			-ptx*)
1743284194Sdelphij				vendor=sequent
1744284194Sdelphij				;;
1745284194Sdelphij			-tpf*)
1746284194Sdelphij				vendor=ibm
1747284194Sdelphij				;;
1748284194Sdelphij			-vxsim* | -vxworks* | -windiss*)
1749284194Sdelphij				vendor=wrs
1750284194Sdelphij				;;
1751284194Sdelphij			-aux*)
1752284194Sdelphij				vendor=apple
1753284194Sdelphij				;;
1754284194Sdelphij			-hms*)
1755284194Sdelphij				vendor=hitachi
1756284194Sdelphij				;;
1757284194Sdelphij			-mpw* | -macos*)
1758284194Sdelphij				vendor=apple
1759284194Sdelphij				;;
1760284194Sdelphij			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1761284194Sdelphij				vendor=atari
1762284194Sdelphij				;;
1763284194Sdelphij			-vos*)
1764284194Sdelphij				vendor=stratus
1765284194Sdelphij				;;
1766284194Sdelphij		esac
1767284194Sdelphij		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1768284194Sdelphij		;;
1769284194Sdelphijesac
1770284194Sdelphij
1771284194Sdelphijecho $basic_machine$os
1772284194Sdelphijexit
1773284194Sdelphij
1774284194Sdelphij# Local variables:
1775284194Sdelphij# eval: (add-hook 'write-file-hooks 'time-stamp)
1776284194Sdelphij# time-stamp-start: "timestamp='"
1777284194Sdelphij# time-stamp-format: "%:y-%02m-%02d"
1778284194Sdelphij# time-stamp-end: "'"
1779284194Sdelphij# End:
1780