1267843Sdelphij#! /bin/sh
2267843Sdelphij# Configuration validation subroutine script.
3328875Seadler#   Copyright 1992-2017 Free Software Foundation, Inc.
4267843Sdelphij
5328875Seadlertimestamp='2017-01-01'
6267843Sdelphij
7309848Sdelphij# This file is free software; you can redistribute it and/or modify it
8309848Sdelphij# under the terms of the GNU General Public License as published by
9309848Sdelphij# the Free Software Foundation; either version 3 of the License, or
10267843Sdelphij# (at your option) any later version.
11267843Sdelphij#
12309848Sdelphij# This program is distributed in the hope that it will be useful, but
13309848Sdelphij# WITHOUT ANY WARRANTY; without even the implied warranty of
14309848Sdelphij# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15309848Sdelphij# General Public License for more details.
16267843Sdelphij#
17267843Sdelphij# You should have received a copy of the GNU General Public License
18267843Sdelphij# along with this program; if not, see <http://www.gnu.org/licenses/>.
19267843Sdelphij#
20267843Sdelphij# As a special exception to the GNU General Public License, if you
21267843Sdelphij# distribute this file as part of a program that contains a
22267843Sdelphij# configuration script generated by Autoconf, you may include it under
23309848Sdelphij# the same distribution terms that you use for the rest of that
24309848Sdelphij# program.  This Exception is an additional permission under section 7
25309848Sdelphij# of the GNU General Public License, version 3 ("GPLv3").
26267843Sdelphij
27267843Sdelphij
28309848Sdelphij# Please send patches to <config-patches@gnu.org>.
29267843Sdelphij#
30267843Sdelphij# Configuration subroutine to validate and canonicalize a configuration type.
31267843Sdelphij# Supply the specified configuration type as an argument.
32267843Sdelphij# If it is invalid, we print an error message on stderr and exit with code 1.
33267843Sdelphij# Otherwise, we print the canonical config type on stdout and succeed.
34267843Sdelphij
35267843Sdelphij# You can get the latest version of this script from:
36328875Seadler# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
37267843Sdelphij
38267843Sdelphij# This file is supposed to be the same for all GNU packages
39267843Sdelphij# and recognize all the CPU types, system types and aliases
40267843Sdelphij# that are meaningful with *any* GNU software.
41267843Sdelphij# Each package is responsible for reporting which valid configurations
42267843Sdelphij# it does not support.  The user should be able to distinguish
43267843Sdelphij# a failure to support a valid configuration from a meaningless
44267843Sdelphij# configuration.
45267843Sdelphij
46267843Sdelphij# The goal of this file is to map all the various variations of a given
47267843Sdelphij# machine specification into a single specification in the form:
48267843Sdelphij#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
49267843Sdelphij# or in some cases, the newer four-part form:
50267843Sdelphij#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
51267843Sdelphij# It is wrong to echo any other type of specification.
52267843Sdelphij
53267843Sdelphijme=`echo "$0" | sed -e 's,.*/,,'`
54267843Sdelphij
55267843Sdelphijusage="\
56328875SeadlerUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
57267843Sdelphij
58267843SdelphijCanonicalize a configuration name.
59267843Sdelphij
60267843SdelphijOperation modes:
61267843Sdelphij  -h, --help         print this help, then exit
62267843Sdelphij  -t, --time-stamp   print date of last modification, then exit
63267843Sdelphij  -v, --version      print version number, then exit
64267843Sdelphij
65267843SdelphijReport bugs and patches to <config-patches@gnu.org>."
66267843Sdelphij
67267843Sdelphijversion="\
68267843SdelphijGNU config.sub ($timestamp)
69267843Sdelphij
70328875SeadlerCopyright 1992-2017 Free Software Foundation, Inc.
71267843Sdelphij
72267843SdelphijThis is free software; see the source for copying conditions.  There is NO
73267843Sdelphijwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
74267843Sdelphij
75267843Sdelphijhelp="
76267843SdelphijTry \`$me --help' for more information."
77267843Sdelphij
78267843Sdelphij# Parse command line
79267843Sdelphijwhile test $# -gt 0 ; do
80267843Sdelphij  case $1 in
81267843Sdelphij    --time-stamp | --time* | -t )
82267843Sdelphij       echo "$timestamp" ; exit ;;
83267843Sdelphij    --version | -v )
84267843Sdelphij       echo "$version" ; exit ;;
85267843Sdelphij    --help | --h* | -h )
86267843Sdelphij       echo "$usage"; exit ;;
87267843Sdelphij    -- )     # Stop option processing
88267843Sdelphij       shift; break ;;
89267843Sdelphij    - )	# Use stdin as input.
90267843Sdelphij       break ;;
91267843Sdelphij    -* )
92267843Sdelphij       echo "$me: invalid option $1$help"
93267843Sdelphij       exit 1 ;;
94267843Sdelphij
95267843Sdelphij    *local*)
96267843Sdelphij       # First pass through any local machine types.
97267843Sdelphij       echo $1
98267843Sdelphij       exit ;;
99267843Sdelphij
100267843Sdelphij    * )
101267843Sdelphij       break ;;
102267843Sdelphij  esac
103267843Sdelphijdone
104267843Sdelphij
105267843Sdelphijcase $# in
106267843Sdelphij 0) echo "$me: missing argument$help" >&2
107267843Sdelphij    exit 1;;
108267843Sdelphij 1) ;;
109267843Sdelphij *) echo "$me: too many arguments$help" >&2
110267843Sdelphij    exit 1;;
111267843Sdelphijesac
112267843Sdelphij
113267843Sdelphij# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
114267843Sdelphij# Here we must recognize all the valid KERNEL-OS combinations.
115267843Sdelphijmaybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
116267843Sdelphijcase $maybe_os in
117267843Sdelphij  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
118309848Sdelphij  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
119309848Sdelphij  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
120328875Seadler  kopensolaris*-gnu* | cloudabi*-eabi* | \
121267843Sdelphij  storm-chaos* | os2-emx* | rtmk-nova*)
122267843Sdelphij    os=-$maybe_os
123267843Sdelphij    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
124267843Sdelphij    ;;
125267843Sdelphij  android-linux)
126267843Sdelphij    os=-linux-android
127267843Sdelphij    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
128267843Sdelphij    ;;
129267843Sdelphij  *)
130267843Sdelphij    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
131267843Sdelphij    if [ $basic_machine != $1 ]
132267843Sdelphij    then os=`echo $1 | sed 's/.*-/-/'`
133267843Sdelphij    else os=; fi
134267843Sdelphij    ;;
135267843Sdelphijesac
136267843Sdelphij
137267843Sdelphij### Let's recognize common machines as not being operating systems so
138267843Sdelphij### that things like config.sub decstation-3100 work.  We also
139267843Sdelphij### recognize some manufacturers as not being operating systems, so we
140267843Sdelphij### can provide default operating systems below.
141267843Sdelphijcase $os in
142267843Sdelphij	-sun*os*)
143267843Sdelphij		# Prevent following clause from handling this invalid input.
144267843Sdelphij		;;
145267843Sdelphij	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
146267843Sdelphij	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
147267843Sdelphij	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
148267843Sdelphij	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
149267843Sdelphij	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
150267843Sdelphij	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
151309848Sdelphij	-apple | -axis | -knuth | -cray | -microblaze*)
152267843Sdelphij		os=
153267843Sdelphij		basic_machine=$1
154267843Sdelphij		;;
155267843Sdelphij	-bluegene*)
156267843Sdelphij		os=-cnk
157267843Sdelphij		;;
158267843Sdelphij	-sim | -cisco | -oki | -wec | -winbond)
159267843Sdelphij		os=
160267843Sdelphij		basic_machine=$1
161267843Sdelphij		;;
162267843Sdelphij	-scout)
163267843Sdelphij		;;
164267843Sdelphij	-wrs)
165267843Sdelphij		os=-vxworks
166267843Sdelphij		basic_machine=$1
167267843Sdelphij		;;
168267843Sdelphij	-chorusos*)
169267843Sdelphij		os=-chorusos
170267843Sdelphij		basic_machine=$1
171267843Sdelphij		;;
172267843Sdelphij	-chorusrdb)
173267843Sdelphij		os=-chorusrdb
174267843Sdelphij		basic_machine=$1
175267843Sdelphij		;;
176267843Sdelphij	-hiux*)
177267843Sdelphij		os=-hiuxwe2
178267843Sdelphij		;;
179267843Sdelphij	-sco6)
180267843Sdelphij		os=-sco5v6
181267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
182267843Sdelphij		;;
183267843Sdelphij	-sco5)
184267843Sdelphij		os=-sco3.2v5
185267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186267843Sdelphij		;;
187267843Sdelphij	-sco4)
188267843Sdelphij		os=-sco3.2v4
189267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190267843Sdelphij		;;
191267843Sdelphij	-sco3.2.[4-9]*)
192267843Sdelphij		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
193267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194267843Sdelphij		;;
195267843Sdelphij	-sco3.2v[4-9]*)
196267843Sdelphij		# Don't forget version if it is 3.2v4 or newer.
197267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
198267843Sdelphij		;;
199267843Sdelphij	-sco5v6*)
200267843Sdelphij		# Don't forget version if it is 3.2v4 or newer.
201267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
202267843Sdelphij		;;
203267843Sdelphij	-sco*)
204267843Sdelphij		os=-sco3.2v2
205267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206267843Sdelphij		;;
207267843Sdelphij	-udk*)
208267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
209267843Sdelphij		;;
210267843Sdelphij	-isc)
211267843Sdelphij		os=-isc2.2
212267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
213267843Sdelphij		;;
214267843Sdelphij	-clix*)
215267843Sdelphij		basic_machine=clipper-intergraph
216267843Sdelphij		;;
217267843Sdelphij	-isc*)
218267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
219267843Sdelphij		;;
220267843Sdelphij	-lynx*178)
221267843Sdelphij		os=-lynxos178
222267843Sdelphij		;;
223267843Sdelphij	-lynx*5)
224267843Sdelphij		os=-lynxos5
225267843Sdelphij		;;
226267843Sdelphij	-lynx*)
227267843Sdelphij		os=-lynxos
228267843Sdelphij		;;
229267843Sdelphij	-ptx*)
230267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
231267843Sdelphij		;;
232267843Sdelphij	-windowsnt*)
233267843Sdelphij		os=`echo $os | sed -e 's/windowsnt/winnt/'`
234267843Sdelphij		;;
235267843Sdelphij	-psos*)
236267843Sdelphij		os=-psos
237267843Sdelphij		;;
238267843Sdelphij	-mint | -mint[0-9]*)
239267843Sdelphij		basic_machine=m68k-atari
240267843Sdelphij		os=-mint
241267843Sdelphij		;;
242267843Sdelphijesac
243267843Sdelphij
244267843Sdelphij# Decode aliases for certain CPU-COMPANY combinations.
245267843Sdelphijcase $basic_machine in
246267843Sdelphij	# Recognize the basic CPU types without company name.
247267843Sdelphij	# Some are omitted here because they have special meanings below.
248267843Sdelphij	1750a | 580 \
249267843Sdelphij	| a29k \
250267843Sdelphij	| aarch64 | aarch64_be \
251267843Sdelphij	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
252267843Sdelphij	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
253267843Sdelphij	| am33_2.0 \
254309848Sdelphij	| arc | arceb \
255309848Sdelphij	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
256309848Sdelphij	| avr | avr32 \
257328875Seadler	| ba \
258309848Sdelphij	| be32 | be64 \
259267843Sdelphij	| bfin \
260309848Sdelphij	| c4x | c8051 | clipper \
261267843Sdelphij	| d10v | d30v | dlx | dsp16xx \
262309848Sdelphij	| e2k | epiphany \
263309848Sdelphij	| fido | fr30 | frv | ft32 \
264267843Sdelphij	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
265267843Sdelphij	| hexagon \
266267843Sdelphij	| i370 | i860 | i960 | ia64 \
267267843Sdelphij	| ip2k | iq2000 \
268309848Sdelphij	| k1om \
269267843Sdelphij	| le32 | le64 \
270267843Sdelphij	| lm32 \
271267843Sdelphij	| m32c | m32r | m32rle | m68000 | m68k | m88k \
272309848Sdelphij	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
273267843Sdelphij	| mips | mipsbe | mipseb | mipsel | mipsle \
274267843Sdelphij	| mips16 \
275267843Sdelphij	| mips64 | mips64el \
276267843Sdelphij	| mips64octeon | mips64octeonel \
277267843Sdelphij	| mips64orion | mips64orionel \
278267843Sdelphij	| mips64r5900 | mips64r5900el \
279267843Sdelphij	| mips64vr | mips64vrel \
280267843Sdelphij	| mips64vr4100 | mips64vr4100el \
281267843Sdelphij	| mips64vr4300 | mips64vr4300el \
282267843Sdelphij	| mips64vr5000 | mips64vr5000el \
283267843Sdelphij	| mips64vr5900 | mips64vr5900el \
284267843Sdelphij	| mipsisa32 | mipsisa32el \
285267843Sdelphij	| mipsisa32r2 | mipsisa32r2el \
286309848Sdelphij	| mipsisa32r6 | mipsisa32r6el \
287267843Sdelphij	| mipsisa64 | mipsisa64el \
288267843Sdelphij	| mipsisa64r2 | mipsisa64r2el \
289309848Sdelphij	| mipsisa64r6 | mipsisa64r6el \
290267843Sdelphij	| mipsisa64sb1 | mipsisa64sb1el \
291267843Sdelphij	| mipsisa64sr71k | mipsisa64sr71kel \
292309848Sdelphij	| mipsr5900 | mipsr5900el \
293267843Sdelphij	| mipstx39 | mipstx39el \
294267843Sdelphij	| mn10200 | mn10300 \
295267843Sdelphij	| moxie \
296267843Sdelphij	| mt \
297267843Sdelphij	| msp430 \
298267843Sdelphij	| nds32 | nds32le | nds32be \
299309848Sdelphij	| nios | nios2 | nios2eb | nios2el \
300267843Sdelphij	| ns16k | ns32k \
301309848Sdelphij	| open8 | or1k | or1knd | or32 \
302267843Sdelphij	| pdp10 | pdp11 | pj | pjl \
303267843Sdelphij	| powerpc | powerpc64 | powerpc64le | powerpcle \
304328875Seadler	| pru \
305267843Sdelphij	| pyramid \
306309848Sdelphij	| riscv32 | riscv64 \
307267843Sdelphij	| rl78 | rx \
308267843Sdelphij	| score \
309328875Seadler	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
310267843Sdelphij	| sh64 | sh64le \
311267843Sdelphij	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
312267843Sdelphij	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
313267843Sdelphij	| spu \
314267843Sdelphij	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
315267843Sdelphij	| ubicom32 \
316267843Sdelphij	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
317309848Sdelphij	| visium \
318267843Sdelphij	| we32k \
319267843Sdelphij	| x86 | xc16x | xstormy16 | xtensa \
320267843Sdelphij	| z8k | z80)
321267843Sdelphij		basic_machine=$basic_machine-unknown
322267843Sdelphij		;;
323267843Sdelphij	c54x)
324267843Sdelphij		basic_machine=tic54x-unknown
325267843Sdelphij		;;
326267843Sdelphij	c55x)
327267843Sdelphij		basic_machine=tic55x-unknown
328267843Sdelphij		;;
329267843Sdelphij	c6x)
330267843Sdelphij		basic_machine=tic6x-unknown
331267843Sdelphij		;;
332309848Sdelphij	leon|leon[3-9])
333309848Sdelphij		basic_machine=sparc-$basic_machine
334309848Sdelphij		;;
335309848Sdelphij	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
336267843Sdelphij		basic_machine=$basic_machine-unknown
337267843Sdelphij		os=-none
338267843Sdelphij		;;
339267843Sdelphij	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
340267843Sdelphij		;;
341267843Sdelphij	ms1)
342267843Sdelphij		basic_machine=mt-unknown
343267843Sdelphij		;;
344267843Sdelphij
345267843Sdelphij	strongarm | thumb | xscale)
346267843Sdelphij		basic_machine=arm-unknown
347267843Sdelphij		;;
348267843Sdelphij	xgate)
349267843Sdelphij		basic_machine=$basic_machine-unknown
350267843Sdelphij		os=-none
351267843Sdelphij		;;
352267843Sdelphij	xscaleeb)
353267843Sdelphij		basic_machine=armeb-unknown
354267843Sdelphij		;;
355267843Sdelphij
356267843Sdelphij	xscaleel)
357267843Sdelphij		basic_machine=armel-unknown
358267843Sdelphij		;;
359267843Sdelphij
360267843Sdelphij	# We use `pc' rather than `unknown'
361267843Sdelphij	# because (1) that's what they normally are, and
362267843Sdelphij	# (2) the word "unknown" tends to confuse beginning users.
363267843Sdelphij	i*86 | x86_64)
364267843Sdelphij	  basic_machine=$basic_machine-pc
365267843Sdelphij	  ;;
366267843Sdelphij	# Object if more than one company name word.
367267843Sdelphij	*-*-*)
368267843Sdelphij		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
369267843Sdelphij		exit 1
370267843Sdelphij		;;
371267843Sdelphij	# Recognize the basic CPU types with company name.
372267843Sdelphij	580-* \
373267843Sdelphij	| a29k-* \
374267843Sdelphij	| aarch64-* | aarch64_be-* \
375267843Sdelphij	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
376267843Sdelphij	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
377309848Sdelphij	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
378267843Sdelphij	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
379267843Sdelphij	| avr-* | avr32-* \
380328875Seadler	| ba-* \
381267843Sdelphij	| be32-* | be64-* \
382267843Sdelphij	| bfin-* | bs2000-* \
383267843Sdelphij	| c[123]* | c30-* | [cjt]90-* | c4x-* \
384309848Sdelphij	| c8051-* | clipper-* | craynv-* | cydra-* \
385267843Sdelphij	| d10v-* | d30v-* | dlx-* \
386309848Sdelphij	| e2k-* | elxsi-* \
387267843Sdelphij	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
388267843Sdelphij	| h8300-* | h8500-* \
389267843Sdelphij	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
390267843Sdelphij	| hexagon-* \
391267843Sdelphij	| i*86-* | i860-* | i960-* | ia64-* \
392267843Sdelphij	| ip2k-* | iq2000-* \
393309848Sdelphij	| k1om-* \
394267843Sdelphij	| le32-* | le64-* \
395267843Sdelphij	| lm32-* \
396267843Sdelphij	| m32c-* | m32r-* | m32rle-* \
397267843Sdelphij	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
398309848Sdelphij	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
399309848Sdelphij	| microblaze-* | microblazeel-* \
400267843Sdelphij	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
401267843Sdelphij	| mips16-* \
402267843Sdelphij	| mips64-* | mips64el-* \
403267843Sdelphij	| mips64octeon-* | mips64octeonel-* \
404267843Sdelphij	| mips64orion-* | mips64orionel-* \
405267843Sdelphij	| mips64r5900-* | mips64r5900el-* \
406267843Sdelphij	| mips64vr-* | mips64vrel-* \
407267843Sdelphij	| mips64vr4100-* | mips64vr4100el-* \
408267843Sdelphij	| mips64vr4300-* | mips64vr4300el-* \
409267843Sdelphij	| mips64vr5000-* | mips64vr5000el-* \
410267843Sdelphij	| mips64vr5900-* | mips64vr5900el-* \
411267843Sdelphij	| mipsisa32-* | mipsisa32el-* \
412267843Sdelphij	| mipsisa32r2-* | mipsisa32r2el-* \
413309848Sdelphij	| mipsisa32r6-* | mipsisa32r6el-* \
414267843Sdelphij	| mipsisa64-* | mipsisa64el-* \
415267843Sdelphij	| mipsisa64r2-* | mipsisa64r2el-* \
416309848Sdelphij	| mipsisa64r6-* | mipsisa64r6el-* \
417267843Sdelphij	| mipsisa64sb1-* | mipsisa64sb1el-* \
418267843Sdelphij	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
419309848Sdelphij	| mipsr5900-* | mipsr5900el-* \
420267843Sdelphij	| mipstx39-* | mipstx39el-* \
421267843Sdelphij	| mmix-* \
422267843Sdelphij	| mt-* \
423267843Sdelphij	| msp430-* \
424267843Sdelphij	| nds32-* | nds32le-* | nds32be-* \
425309848Sdelphij	| nios-* | nios2-* | nios2eb-* | nios2el-* \
426267843Sdelphij	| none-* | np1-* | ns16k-* | ns32k-* \
427267843Sdelphij	| open8-* \
428309848Sdelphij	| or1k*-* \
429267843Sdelphij	| orion-* \
430267843Sdelphij	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
431267843Sdelphij	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
432328875Seadler	| pru-* \
433267843Sdelphij	| pyramid-* \
434328875Seadler	| riscv32-* | riscv64-* \
435267843Sdelphij	| rl78-* | romp-* | rs6000-* | rx-* \
436267843Sdelphij	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
437267843Sdelphij	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
438267843Sdelphij	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
439267843Sdelphij	| sparclite-* \
440328875Seadler	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
441267843Sdelphij	| tahoe-* \
442267843Sdelphij	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
443267843Sdelphij	| tile*-* \
444267843Sdelphij	| tron-* \
445267843Sdelphij	| ubicom32-* \
446267843Sdelphij	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
447267843Sdelphij	| vax-* \
448309848Sdelphij	| visium-* \
449267843Sdelphij	| we32k-* \
450267843Sdelphij	| x86-* | x86_64-* | xc16x-* | xps100-* \
451267843Sdelphij	| xstormy16-* | xtensa*-* \
452267843Sdelphij	| ymp-* \
453267843Sdelphij	| z8k-* | z80-*)
454267843Sdelphij		;;
455267843Sdelphij	# Recognize the basic CPU types without company name, with glob match.
456267843Sdelphij	xtensa*)
457267843Sdelphij		basic_machine=$basic_machine-unknown
458267843Sdelphij		;;
459267843Sdelphij	# Recognize the various machine names and aliases which stand
460267843Sdelphij	# for a CPU type and a company and sometimes even an OS.
461267843Sdelphij	386bsd)
462267843Sdelphij		basic_machine=i386-unknown
463267843Sdelphij		os=-bsd
464267843Sdelphij		;;
465267843Sdelphij	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
466267843Sdelphij		basic_machine=m68000-att
467267843Sdelphij		;;
468267843Sdelphij	3b*)
469267843Sdelphij		basic_machine=we32k-att
470267843Sdelphij		;;
471267843Sdelphij	a29khif)
472267843Sdelphij		basic_machine=a29k-amd
473267843Sdelphij		os=-udi
474267843Sdelphij		;;
475267843Sdelphij	abacus)
476267843Sdelphij		basic_machine=abacus-unknown
477267843Sdelphij		;;
478267843Sdelphij	adobe68k)
479267843Sdelphij		basic_machine=m68010-adobe
480267843Sdelphij		os=-scout
481267843Sdelphij		;;
482267843Sdelphij	alliant | fx80)
483267843Sdelphij		basic_machine=fx80-alliant
484267843Sdelphij		;;
485267843Sdelphij	altos | altos3068)
486267843Sdelphij		basic_machine=m68k-altos
487267843Sdelphij		;;
488267843Sdelphij	am29k)
489267843Sdelphij		basic_machine=a29k-none
490267843Sdelphij		os=-bsd
491267843Sdelphij		;;
492267843Sdelphij	amd64)
493267843Sdelphij		basic_machine=x86_64-pc
494267843Sdelphij		;;
495267843Sdelphij	amd64-*)
496267843Sdelphij		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
497267843Sdelphij		;;
498267843Sdelphij	amdahl)
499267843Sdelphij		basic_machine=580-amdahl
500267843Sdelphij		os=-sysv
501267843Sdelphij		;;
502267843Sdelphij	amiga | amiga-*)
503267843Sdelphij		basic_machine=m68k-unknown
504267843Sdelphij		;;
505267843Sdelphij	amigaos | amigados)
506267843Sdelphij		basic_machine=m68k-unknown
507267843Sdelphij		os=-amigaos
508267843Sdelphij		;;
509267843Sdelphij	amigaunix | amix)
510267843Sdelphij		basic_machine=m68k-unknown
511267843Sdelphij		os=-sysv4
512267843Sdelphij		;;
513267843Sdelphij	apollo68)
514267843Sdelphij		basic_machine=m68k-apollo
515267843Sdelphij		os=-sysv
516267843Sdelphij		;;
517267843Sdelphij	apollo68bsd)
518267843Sdelphij		basic_machine=m68k-apollo
519267843Sdelphij		os=-bsd
520267843Sdelphij		;;
521267843Sdelphij	aros)
522267843Sdelphij		basic_machine=i386-pc
523267843Sdelphij		os=-aros
524267843Sdelphij		;;
525328875Seadler	asmjs)
526309848Sdelphij		basic_machine=asmjs-unknown
527309848Sdelphij		;;
528267843Sdelphij	aux)
529267843Sdelphij		basic_machine=m68k-apple
530267843Sdelphij		os=-aux
531267843Sdelphij		;;
532267843Sdelphij	balance)
533267843Sdelphij		basic_machine=ns32k-sequent
534267843Sdelphij		os=-dynix
535267843Sdelphij		;;
536267843Sdelphij	blackfin)
537267843Sdelphij		basic_machine=bfin-unknown
538267843Sdelphij		os=-linux
539267843Sdelphij		;;
540267843Sdelphij	blackfin-*)
541267843Sdelphij		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
542267843Sdelphij		os=-linux
543267843Sdelphij		;;
544267843Sdelphij	bluegene*)
545267843Sdelphij		basic_machine=powerpc-ibm
546267843Sdelphij		os=-cnk
547267843Sdelphij		;;
548267843Sdelphij	c54x-*)
549267843Sdelphij		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
550267843Sdelphij		;;
551267843Sdelphij	c55x-*)
552267843Sdelphij		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
553267843Sdelphij		;;
554267843Sdelphij	c6x-*)
555267843Sdelphij		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
556267843Sdelphij		;;
557267843Sdelphij	c90)
558267843Sdelphij		basic_machine=c90-cray
559267843Sdelphij		os=-unicos
560267843Sdelphij		;;
561267843Sdelphij	cegcc)
562267843Sdelphij		basic_machine=arm-unknown
563267843Sdelphij		os=-cegcc
564267843Sdelphij		;;
565267843Sdelphij	convex-c1)
566267843Sdelphij		basic_machine=c1-convex
567267843Sdelphij		os=-bsd
568267843Sdelphij		;;
569267843Sdelphij	convex-c2)
570267843Sdelphij		basic_machine=c2-convex
571267843Sdelphij		os=-bsd
572267843Sdelphij		;;
573267843Sdelphij	convex-c32)
574267843Sdelphij		basic_machine=c32-convex
575267843Sdelphij		os=-bsd
576267843Sdelphij		;;
577267843Sdelphij	convex-c34)
578267843Sdelphij		basic_machine=c34-convex
579267843Sdelphij		os=-bsd
580267843Sdelphij		;;
581267843Sdelphij	convex-c38)
582267843Sdelphij		basic_machine=c38-convex
583267843Sdelphij		os=-bsd
584267843Sdelphij		;;
585267843Sdelphij	cray | j90)
586267843Sdelphij		basic_machine=j90-cray
587267843Sdelphij		os=-unicos
588267843Sdelphij		;;
589267843Sdelphij	craynv)
590267843Sdelphij		basic_machine=craynv-cray
591267843Sdelphij		os=-unicosmp
592267843Sdelphij		;;
593267843Sdelphij	cr16 | cr16-*)
594267843Sdelphij		basic_machine=cr16-unknown
595267843Sdelphij		os=-elf
596267843Sdelphij		;;
597267843Sdelphij	crds | unos)
598267843Sdelphij		basic_machine=m68k-crds
599267843Sdelphij		;;
600267843Sdelphij	crisv32 | crisv32-* | etraxfs*)
601267843Sdelphij		basic_machine=crisv32-axis
602267843Sdelphij		;;
603267843Sdelphij	cris | cris-* | etrax*)
604267843Sdelphij		basic_machine=cris-axis
605267843Sdelphij		;;
606267843Sdelphij	crx)
607267843Sdelphij		basic_machine=crx-unknown
608267843Sdelphij		os=-elf
609267843Sdelphij		;;
610267843Sdelphij	da30 | da30-*)
611267843Sdelphij		basic_machine=m68k-da30
612267843Sdelphij		;;
613267843Sdelphij	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
614267843Sdelphij		basic_machine=mips-dec
615267843Sdelphij		;;
616267843Sdelphij	decsystem10* | dec10*)
617267843Sdelphij		basic_machine=pdp10-dec
618267843Sdelphij		os=-tops10
619267843Sdelphij		;;
620267843Sdelphij	decsystem20* | dec20*)
621267843Sdelphij		basic_machine=pdp10-dec
622267843Sdelphij		os=-tops20
623267843Sdelphij		;;
624267843Sdelphij	delta | 3300 | motorola-3300 | motorola-delta \
625267843Sdelphij	      | 3300-motorola | delta-motorola)
626267843Sdelphij		basic_machine=m68k-motorola
627267843Sdelphij		;;
628267843Sdelphij	delta88)
629267843Sdelphij		basic_machine=m88k-motorola
630267843Sdelphij		os=-sysv3
631267843Sdelphij		;;
632267843Sdelphij	dicos)
633267843Sdelphij		basic_machine=i686-pc
634267843Sdelphij		os=-dicos
635267843Sdelphij		;;
636267843Sdelphij	djgpp)
637267843Sdelphij		basic_machine=i586-pc
638267843Sdelphij		os=-msdosdjgpp
639267843Sdelphij		;;
640267843Sdelphij	dpx20 | dpx20-*)
641267843Sdelphij		basic_machine=rs6000-bull
642267843Sdelphij		os=-bosx
643267843Sdelphij		;;
644267843Sdelphij	dpx2* | dpx2*-bull)
645267843Sdelphij		basic_machine=m68k-bull
646267843Sdelphij		os=-sysv3
647267843Sdelphij		;;
648328875Seadler	e500v[12])
649328875Seadler		basic_machine=powerpc-unknown
650328875Seadler		os=$os"spe"
651328875Seadler		;;
652328875Seadler	e500v[12]-*)
653328875Seadler		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
654328875Seadler		os=$os"spe"
655328875Seadler		;;
656267843Sdelphij	ebmon29k)
657267843Sdelphij		basic_machine=a29k-amd
658267843Sdelphij		os=-ebmon
659267843Sdelphij		;;
660267843Sdelphij	elxsi)
661267843Sdelphij		basic_machine=elxsi-elxsi
662267843Sdelphij		os=-bsd
663267843Sdelphij		;;
664267843Sdelphij	encore | umax | mmax)
665267843Sdelphij		basic_machine=ns32k-encore
666267843Sdelphij		;;
667267843Sdelphij	es1800 | OSE68k | ose68k | ose | OSE)
668267843Sdelphij		basic_machine=m68k-ericsson
669267843Sdelphij		os=-ose
670267843Sdelphij		;;
671267843Sdelphij	fx2800)
672267843Sdelphij		basic_machine=i860-alliant
673267843Sdelphij		;;
674267843Sdelphij	genix)
675267843Sdelphij		basic_machine=ns32k-ns
676267843Sdelphij		;;
677267843Sdelphij	gmicro)
678267843Sdelphij		basic_machine=tron-gmicro
679267843Sdelphij		os=-sysv
680267843Sdelphij		;;
681267843Sdelphij	go32)
682267843Sdelphij		basic_machine=i386-pc
683267843Sdelphij		os=-go32
684267843Sdelphij		;;
685267843Sdelphij	h3050r* | hiux*)
686267843Sdelphij		basic_machine=hppa1.1-hitachi
687267843Sdelphij		os=-hiuxwe2
688267843Sdelphij		;;
689267843Sdelphij	h8300hms)
690267843Sdelphij		basic_machine=h8300-hitachi
691267843Sdelphij		os=-hms
692267843Sdelphij		;;
693267843Sdelphij	h8300xray)
694267843Sdelphij		basic_machine=h8300-hitachi
695267843Sdelphij		os=-xray
696267843Sdelphij		;;
697267843Sdelphij	h8500hms)
698267843Sdelphij		basic_machine=h8500-hitachi
699267843Sdelphij		os=-hms
700267843Sdelphij		;;
701267843Sdelphij	harris)
702267843Sdelphij		basic_machine=m88k-harris
703267843Sdelphij		os=-sysv3
704267843Sdelphij		;;
705267843Sdelphij	hp300-*)
706267843Sdelphij		basic_machine=m68k-hp
707267843Sdelphij		;;
708267843Sdelphij	hp300bsd)
709267843Sdelphij		basic_machine=m68k-hp
710267843Sdelphij		os=-bsd
711267843Sdelphij		;;
712267843Sdelphij	hp300hpux)
713267843Sdelphij		basic_machine=m68k-hp
714267843Sdelphij		os=-hpux
715267843Sdelphij		;;
716267843Sdelphij	hp3k9[0-9][0-9] | hp9[0-9][0-9])
717267843Sdelphij		basic_machine=hppa1.0-hp
718267843Sdelphij		;;
719267843Sdelphij	hp9k2[0-9][0-9] | hp9k31[0-9])
720267843Sdelphij		basic_machine=m68000-hp
721267843Sdelphij		;;
722267843Sdelphij	hp9k3[2-9][0-9])
723267843Sdelphij		basic_machine=m68k-hp
724267843Sdelphij		;;
725267843Sdelphij	hp9k6[0-9][0-9] | hp6[0-9][0-9])
726267843Sdelphij		basic_machine=hppa1.0-hp
727267843Sdelphij		;;
728267843Sdelphij	hp9k7[0-79][0-9] | hp7[0-79][0-9])
729267843Sdelphij		basic_machine=hppa1.1-hp
730267843Sdelphij		;;
731267843Sdelphij	hp9k78[0-9] | hp78[0-9])
732267843Sdelphij		# FIXME: really hppa2.0-hp
733267843Sdelphij		basic_machine=hppa1.1-hp
734267843Sdelphij		;;
735267843Sdelphij	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
736267843Sdelphij		# FIXME: really hppa2.0-hp
737267843Sdelphij		basic_machine=hppa1.1-hp
738267843Sdelphij		;;
739267843Sdelphij	hp9k8[0-9][13679] | hp8[0-9][13679])
740267843Sdelphij		basic_machine=hppa1.1-hp
741267843Sdelphij		;;
742267843Sdelphij	hp9k8[0-9][0-9] | hp8[0-9][0-9])
743267843Sdelphij		basic_machine=hppa1.0-hp
744267843Sdelphij		;;
745267843Sdelphij	hppa-next)
746267843Sdelphij		os=-nextstep3
747267843Sdelphij		;;
748267843Sdelphij	hppaosf)
749267843Sdelphij		basic_machine=hppa1.1-hp
750267843Sdelphij		os=-osf
751267843Sdelphij		;;
752267843Sdelphij	hppro)
753267843Sdelphij		basic_machine=hppa1.1-hp
754267843Sdelphij		os=-proelf
755267843Sdelphij		;;
756267843Sdelphij	i370-ibm* | ibm*)
757267843Sdelphij		basic_machine=i370-ibm
758267843Sdelphij		;;
759267843Sdelphij	i*86v32)
760267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
761267843Sdelphij		os=-sysv32
762267843Sdelphij		;;
763267843Sdelphij	i*86v4*)
764267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
765267843Sdelphij		os=-sysv4
766267843Sdelphij		;;
767267843Sdelphij	i*86v)
768267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
769267843Sdelphij		os=-sysv
770267843Sdelphij		;;
771267843Sdelphij	i*86sol2)
772267843Sdelphij		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
773267843Sdelphij		os=-solaris2
774267843Sdelphij		;;
775267843Sdelphij	i386mach)
776267843Sdelphij		basic_machine=i386-mach
777267843Sdelphij		os=-mach
778267843Sdelphij		;;
779267843Sdelphij	i386-vsta | vsta)
780267843Sdelphij		basic_machine=i386-unknown
781267843Sdelphij		os=-vsta
782267843Sdelphij		;;
783267843Sdelphij	iris | iris4d)
784267843Sdelphij		basic_machine=mips-sgi
785267843Sdelphij		case $os in
786267843Sdelphij		    -irix*)
787267843Sdelphij			;;
788267843Sdelphij		    *)
789267843Sdelphij			os=-irix4
790267843Sdelphij			;;
791267843Sdelphij		esac
792267843Sdelphij		;;
793267843Sdelphij	isi68 | isi)
794267843Sdelphij		basic_machine=m68k-isi
795267843Sdelphij		os=-sysv
796267843Sdelphij		;;
797309848Sdelphij	leon-*|leon[3-9]-*)
798309848Sdelphij		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
799309848Sdelphij		;;
800267843Sdelphij	m68knommu)
801267843Sdelphij		basic_machine=m68k-unknown
802267843Sdelphij		os=-linux
803267843Sdelphij		;;
804267843Sdelphij	m68knommu-*)
805267843Sdelphij		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
806267843Sdelphij		os=-linux
807267843Sdelphij		;;
808267843Sdelphij	m88k-omron*)
809267843Sdelphij		basic_machine=m88k-omron
810267843Sdelphij		;;
811267843Sdelphij	magnum | m3230)
812267843Sdelphij		basic_machine=mips-mips
813267843Sdelphij		os=-sysv
814267843Sdelphij		;;
815267843Sdelphij	merlin)
816267843Sdelphij		basic_machine=ns32k-utek
817267843Sdelphij		os=-sysv
818267843Sdelphij		;;
819309848Sdelphij	microblaze*)
820267843Sdelphij		basic_machine=microblaze-xilinx
821267843Sdelphij		;;
822309848Sdelphij	mingw64)
823309848Sdelphij		basic_machine=x86_64-pc
824309848Sdelphij		os=-mingw64
825309848Sdelphij		;;
826267843Sdelphij	mingw32)
827309848Sdelphij		basic_machine=i686-pc
828267843Sdelphij		os=-mingw32
829267843Sdelphij		;;
830267843Sdelphij	mingw32ce)
831267843Sdelphij		basic_machine=arm-unknown
832267843Sdelphij		os=-mingw32ce
833267843Sdelphij		;;
834267843Sdelphij	miniframe)
835267843Sdelphij		basic_machine=m68000-convergent
836267843Sdelphij		;;
837267843Sdelphij	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
838267843Sdelphij		basic_machine=m68k-atari
839267843Sdelphij		os=-mint
840267843Sdelphij		;;
841267843Sdelphij	mips3*-*)
842267843Sdelphij		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
843267843Sdelphij		;;
844267843Sdelphij	mips3*)
845267843Sdelphij		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
846267843Sdelphij		;;
847267843Sdelphij	monitor)
848267843Sdelphij		basic_machine=m68k-rom68k
849267843Sdelphij		os=-coff
850267843Sdelphij		;;
851267843Sdelphij	morphos)
852267843Sdelphij		basic_machine=powerpc-unknown
853267843Sdelphij		os=-morphos
854267843Sdelphij		;;
855309848Sdelphij	moxiebox)
856309848Sdelphij		basic_machine=moxie-unknown
857309848Sdelphij		os=-moxiebox
858309848Sdelphij		;;
859267843Sdelphij	msdos)
860267843Sdelphij		basic_machine=i386-pc
861267843Sdelphij		os=-msdos
862267843Sdelphij		;;
863267843Sdelphij	ms1-*)
864267843Sdelphij		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
865267843Sdelphij		;;
866267843Sdelphij	msys)
867309848Sdelphij		basic_machine=i686-pc
868267843Sdelphij		os=-msys
869267843Sdelphij		;;
870267843Sdelphij	mvs)
871267843Sdelphij		basic_machine=i370-ibm
872267843Sdelphij		os=-mvs
873267843Sdelphij		;;
874267843Sdelphij	nacl)
875267843Sdelphij		basic_machine=le32-unknown
876267843Sdelphij		os=-nacl
877267843Sdelphij		;;
878267843Sdelphij	ncr3000)
879267843Sdelphij		basic_machine=i486-ncr
880267843Sdelphij		os=-sysv4
881267843Sdelphij		;;
882267843Sdelphij	netbsd386)
883267843Sdelphij		basic_machine=i386-unknown
884267843Sdelphij		os=-netbsd
885267843Sdelphij		;;
886267843Sdelphij	netwinder)
887267843Sdelphij		basic_machine=armv4l-rebel
888267843Sdelphij		os=-linux
889267843Sdelphij		;;
890267843Sdelphij	news | news700 | news800 | news900)
891267843Sdelphij		basic_machine=m68k-sony
892267843Sdelphij		os=-newsos
893267843Sdelphij		;;
894267843Sdelphij	news1000)
895267843Sdelphij		basic_machine=m68030-sony
896267843Sdelphij		os=-newsos
897267843Sdelphij		;;
898267843Sdelphij	news-3600 | risc-news)
899267843Sdelphij		basic_machine=mips-sony
900267843Sdelphij		os=-newsos
901267843Sdelphij		;;
902267843Sdelphij	necv70)
903267843Sdelphij		basic_machine=v70-nec
904267843Sdelphij		os=-sysv
905267843Sdelphij		;;
906267843Sdelphij	next | m*-next )
907267843Sdelphij		basic_machine=m68k-next
908267843Sdelphij		case $os in
909267843Sdelphij		    -nextstep* )
910267843Sdelphij			;;
911267843Sdelphij		    -ns2*)
912267843Sdelphij		      os=-nextstep2
913267843Sdelphij			;;
914267843Sdelphij		    *)
915267843Sdelphij		      os=-nextstep3
916267843Sdelphij			;;
917267843Sdelphij		esac
918267843Sdelphij		;;
919267843Sdelphij	nh3000)
920267843Sdelphij		basic_machine=m68k-harris
921267843Sdelphij		os=-cxux
922267843Sdelphij		;;
923267843Sdelphij	nh[45]000)
924267843Sdelphij		basic_machine=m88k-harris
925267843Sdelphij		os=-cxux
926267843Sdelphij		;;
927267843Sdelphij	nindy960)
928267843Sdelphij		basic_machine=i960-intel
929267843Sdelphij		os=-nindy
930267843Sdelphij		;;
931267843Sdelphij	mon960)
932267843Sdelphij		basic_machine=i960-intel
933267843Sdelphij		os=-mon960
934267843Sdelphij		;;
935267843Sdelphij	nonstopux)
936267843Sdelphij		basic_machine=mips-compaq
937267843Sdelphij		os=-nonstopux
938267843Sdelphij		;;
939267843Sdelphij	np1)
940267843Sdelphij		basic_machine=np1-gould
941267843Sdelphij		;;
942267843Sdelphij	neo-tandem)
943267843Sdelphij		basic_machine=neo-tandem
944267843Sdelphij		;;
945267843Sdelphij	nse-tandem)
946267843Sdelphij		basic_machine=nse-tandem
947267843Sdelphij		;;
948267843Sdelphij	nsr-tandem)
949267843Sdelphij		basic_machine=nsr-tandem
950267843Sdelphij		;;
951267843Sdelphij	op50n-* | op60c-*)
952267843Sdelphij		basic_machine=hppa1.1-oki
953267843Sdelphij		os=-proelf
954267843Sdelphij		;;
955267843Sdelphij	openrisc | openrisc-*)
956267843Sdelphij		basic_machine=or32-unknown
957267843Sdelphij		;;
958267843Sdelphij	os400)
959267843Sdelphij		basic_machine=powerpc-ibm
960267843Sdelphij		os=-os400
961267843Sdelphij		;;
962267843Sdelphij	OSE68000 | ose68000)
963267843Sdelphij		basic_machine=m68000-ericsson
964267843Sdelphij		os=-ose
965267843Sdelphij		;;
966267843Sdelphij	os68k)
967267843Sdelphij		basic_machine=m68k-none
968267843Sdelphij		os=-os68k
969267843Sdelphij		;;
970267843Sdelphij	pa-hitachi)
971267843Sdelphij		basic_machine=hppa1.1-hitachi
972267843Sdelphij		os=-hiuxwe2
973267843Sdelphij		;;
974267843Sdelphij	paragon)
975267843Sdelphij		basic_machine=i860-intel
976267843Sdelphij		os=-osf
977267843Sdelphij		;;
978267843Sdelphij	parisc)
979267843Sdelphij		basic_machine=hppa-unknown
980267843Sdelphij		os=-linux
981267843Sdelphij		;;
982267843Sdelphij	parisc-*)
983267843Sdelphij		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
984267843Sdelphij		os=-linux
985267843Sdelphij		;;
986267843Sdelphij	pbd)
987267843Sdelphij		basic_machine=sparc-tti
988267843Sdelphij		;;
989267843Sdelphij	pbb)
990267843Sdelphij		basic_machine=m68k-tti
991267843Sdelphij		;;
992267843Sdelphij	pc532 | pc532-*)
993267843Sdelphij		basic_machine=ns32k-pc532
994267843Sdelphij		;;
995267843Sdelphij	pc98)
996267843Sdelphij		basic_machine=i386-pc
997267843Sdelphij		;;
998267843Sdelphij	pc98-*)
999267843Sdelphij		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
1000267843Sdelphij		;;
1001267843Sdelphij	pentium | p5 | k5 | k6 | nexgen | viac3)
1002267843Sdelphij		basic_machine=i586-pc
1003267843Sdelphij		;;
1004267843Sdelphij	pentiumpro | p6 | 6x86 | athlon | athlon_*)
1005267843Sdelphij		basic_machine=i686-pc
1006267843Sdelphij		;;
1007267843Sdelphij	pentiumii | pentium2 | pentiumiii | pentium3)
1008267843Sdelphij		basic_machine=i686-pc
1009267843Sdelphij		;;
1010267843Sdelphij	pentium4)
1011267843Sdelphij		basic_machine=i786-pc
1012267843Sdelphij		;;
1013267843Sdelphij	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1014267843Sdelphij		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
1015267843Sdelphij		;;
1016267843Sdelphij	pentiumpro-* | p6-* | 6x86-* | athlon-*)
1017267843Sdelphij		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
1018267843Sdelphij		;;
1019267843Sdelphij	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1020267843Sdelphij		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
1021267843Sdelphij		;;
1022267843Sdelphij	pentium4-*)
1023267843Sdelphij		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
1024267843Sdelphij		;;
1025267843Sdelphij	pn)
1026267843Sdelphij		basic_machine=pn-gould
1027267843Sdelphij		;;
1028267843Sdelphij	power)	basic_machine=power-ibm
1029267843Sdelphij		;;
1030267843Sdelphij	ppc | ppcbe)	basic_machine=powerpc-unknown
1031267843Sdelphij		;;
1032267843Sdelphij	ppc-* | ppcbe-*)
1033267843Sdelphij		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
1034267843Sdelphij		;;
1035328875Seadler	ppcle | powerpclittle)
1036267843Sdelphij		basic_machine=powerpcle-unknown
1037267843Sdelphij		;;
1038267843Sdelphij	ppcle-* | powerpclittle-*)
1039267843Sdelphij		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
1040267843Sdelphij		;;
1041267843Sdelphij	ppc64)	basic_machine=powerpc64-unknown
1042267843Sdelphij		;;
1043267843Sdelphij	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
1044267843Sdelphij		;;
1045328875Seadler	ppc64le | powerpc64little)
1046267843Sdelphij		basic_machine=powerpc64le-unknown
1047267843Sdelphij		;;
1048267843Sdelphij	ppc64le-* | powerpc64little-*)
1049267843Sdelphij		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
1050267843Sdelphij		;;
1051267843Sdelphij	ps2)
1052267843Sdelphij		basic_machine=i386-ibm
1053267843Sdelphij		;;
1054267843Sdelphij	pw32)
1055267843Sdelphij		basic_machine=i586-unknown
1056267843Sdelphij		os=-pw32
1057267843Sdelphij		;;
1058309848Sdelphij	rdos | rdos64)
1059309848Sdelphij		basic_machine=x86_64-pc
1060309848Sdelphij		os=-rdos
1061309848Sdelphij		;;
1062309848Sdelphij	rdos32)
1063267843Sdelphij		basic_machine=i386-pc
1064267843Sdelphij		os=-rdos
1065267843Sdelphij		;;
1066267843Sdelphij	rom68k)
1067267843Sdelphij		basic_machine=m68k-rom68k
1068267843Sdelphij		os=-coff
1069267843Sdelphij		;;
1070267843Sdelphij	rm[46]00)
1071267843Sdelphij		basic_machine=mips-siemens
1072267843Sdelphij		;;
1073267843Sdelphij	rtpc | rtpc-*)
1074267843Sdelphij		basic_machine=romp-ibm
1075267843Sdelphij		;;
1076267843Sdelphij	s390 | s390-*)
1077267843Sdelphij		basic_machine=s390-ibm
1078267843Sdelphij		;;
1079267843Sdelphij	s390x | s390x-*)
1080267843Sdelphij		basic_machine=s390x-ibm
1081267843Sdelphij		;;
1082267843Sdelphij	sa29200)
1083267843Sdelphij		basic_machine=a29k-amd
1084267843Sdelphij		os=-udi
1085267843Sdelphij		;;
1086267843Sdelphij	sb1)
1087267843Sdelphij		basic_machine=mipsisa64sb1-unknown
1088267843Sdelphij		;;
1089267843Sdelphij	sb1el)
1090267843Sdelphij		basic_machine=mipsisa64sb1el-unknown
1091267843Sdelphij		;;
1092267843Sdelphij	sde)
1093267843Sdelphij		basic_machine=mipsisa32-sde
1094267843Sdelphij		os=-elf
1095267843Sdelphij		;;
1096267843Sdelphij	sei)
1097267843Sdelphij		basic_machine=mips-sei
1098267843Sdelphij		os=-seiux
1099267843Sdelphij		;;
1100267843Sdelphij	sequent)
1101267843Sdelphij		basic_machine=i386-sequent
1102267843Sdelphij		;;
1103267843Sdelphij	sh)
1104267843Sdelphij		basic_machine=sh-hitachi
1105267843Sdelphij		os=-hms
1106267843Sdelphij		;;
1107267843Sdelphij	sh5el)
1108267843Sdelphij		basic_machine=sh5le-unknown
1109267843Sdelphij		;;
1110267843Sdelphij	sh64)
1111267843Sdelphij		basic_machine=sh64-unknown
1112267843Sdelphij		;;
1113267843Sdelphij	sparclite-wrs | simso-wrs)
1114267843Sdelphij		basic_machine=sparclite-wrs
1115267843Sdelphij		os=-vxworks
1116267843Sdelphij		;;
1117267843Sdelphij	sps7)
1118267843Sdelphij		basic_machine=m68k-bull
1119267843Sdelphij		os=-sysv2
1120267843Sdelphij		;;
1121267843Sdelphij	spur)
1122267843Sdelphij		basic_machine=spur-unknown
1123267843Sdelphij		;;
1124267843Sdelphij	st2000)
1125267843Sdelphij		basic_machine=m68k-tandem
1126267843Sdelphij		;;
1127267843Sdelphij	stratus)
1128267843Sdelphij		basic_machine=i860-stratus
1129267843Sdelphij		os=-sysv4
1130267843Sdelphij		;;
1131267843Sdelphij	strongarm-* | thumb-*)
1132267843Sdelphij		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
1133267843Sdelphij		;;
1134267843Sdelphij	sun2)
1135267843Sdelphij		basic_machine=m68000-sun
1136267843Sdelphij		;;
1137267843Sdelphij	sun2os3)
1138267843Sdelphij		basic_machine=m68000-sun
1139267843Sdelphij		os=-sunos3
1140267843Sdelphij		;;
1141267843Sdelphij	sun2os4)
1142267843Sdelphij		basic_machine=m68000-sun
1143267843Sdelphij		os=-sunos4
1144267843Sdelphij		;;
1145267843Sdelphij	sun3os3)
1146267843Sdelphij		basic_machine=m68k-sun
1147267843Sdelphij		os=-sunos3
1148267843Sdelphij		;;
1149267843Sdelphij	sun3os4)
1150267843Sdelphij		basic_machine=m68k-sun
1151267843Sdelphij		os=-sunos4
1152267843Sdelphij		;;
1153267843Sdelphij	sun4os3)
1154267843Sdelphij		basic_machine=sparc-sun
1155267843Sdelphij		os=-sunos3
1156267843Sdelphij		;;
1157267843Sdelphij	sun4os4)
1158267843Sdelphij		basic_machine=sparc-sun
1159267843Sdelphij		os=-sunos4
1160267843Sdelphij		;;
1161267843Sdelphij	sun4sol2)
1162267843Sdelphij		basic_machine=sparc-sun
1163267843Sdelphij		os=-solaris2
1164267843Sdelphij		;;
1165267843Sdelphij	sun3 | sun3-*)
1166267843Sdelphij		basic_machine=m68k-sun
1167267843Sdelphij		;;
1168267843Sdelphij	sun4)
1169267843Sdelphij		basic_machine=sparc-sun
1170267843Sdelphij		;;
1171267843Sdelphij	sun386 | sun386i | roadrunner)
1172267843Sdelphij		basic_machine=i386-sun
1173267843Sdelphij		;;
1174267843Sdelphij	sv1)
1175267843Sdelphij		basic_machine=sv1-cray
1176267843Sdelphij		os=-unicos
1177267843Sdelphij		;;
1178267843Sdelphij	symmetry)
1179267843Sdelphij		basic_machine=i386-sequent
1180267843Sdelphij		os=-dynix
1181267843Sdelphij		;;
1182267843Sdelphij	t3e)
1183267843Sdelphij		basic_machine=alphaev5-cray
1184267843Sdelphij		os=-unicos
1185267843Sdelphij		;;
1186267843Sdelphij	t90)
1187267843Sdelphij		basic_machine=t90-cray
1188267843Sdelphij		os=-unicos
1189267843Sdelphij		;;
1190267843Sdelphij	tile*)
1191267843Sdelphij		basic_machine=$basic_machine-unknown
1192267843Sdelphij		os=-linux-gnu
1193267843Sdelphij		;;
1194267843Sdelphij	tx39)
1195267843Sdelphij		basic_machine=mipstx39-unknown
1196267843Sdelphij		;;
1197267843Sdelphij	tx39el)
1198267843Sdelphij		basic_machine=mipstx39el-unknown
1199267843Sdelphij		;;
1200267843Sdelphij	toad1)
1201267843Sdelphij		basic_machine=pdp10-xkl
1202267843Sdelphij		os=-tops20
1203267843Sdelphij		;;
1204267843Sdelphij	tower | tower-32)
1205267843Sdelphij		basic_machine=m68k-ncr
1206267843Sdelphij		;;
1207267843Sdelphij	tpf)
1208267843Sdelphij		basic_machine=s390x-ibm
1209267843Sdelphij		os=-tpf
1210267843Sdelphij		;;
1211267843Sdelphij	udi29k)
1212267843Sdelphij		basic_machine=a29k-amd
1213267843Sdelphij		os=-udi
1214267843Sdelphij		;;
1215267843Sdelphij	ultra3)
1216267843Sdelphij		basic_machine=a29k-nyu
1217267843Sdelphij		os=-sym1
1218267843Sdelphij		;;
1219267843Sdelphij	v810 | necv810)
1220267843Sdelphij		basic_machine=v810-nec
1221267843Sdelphij		os=-none
1222267843Sdelphij		;;
1223267843Sdelphij	vaxv)
1224267843Sdelphij		basic_machine=vax-dec
1225267843Sdelphij		os=-sysv
1226267843Sdelphij		;;
1227267843Sdelphij	vms)
1228267843Sdelphij		basic_machine=vax-dec
1229267843Sdelphij		os=-vms
1230267843Sdelphij		;;
1231267843Sdelphij	vpp*|vx|vx-*)
1232267843Sdelphij		basic_machine=f301-fujitsu
1233267843Sdelphij		;;
1234267843Sdelphij	vxworks960)
1235267843Sdelphij		basic_machine=i960-wrs
1236267843Sdelphij		os=-vxworks
1237267843Sdelphij		;;
1238267843Sdelphij	vxworks68)
1239267843Sdelphij		basic_machine=m68k-wrs
1240267843Sdelphij		os=-vxworks
1241267843Sdelphij		;;
1242267843Sdelphij	vxworks29k)
1243267843Sdelphij		basic_machine=a29k-wrs
1244267843Sdelphij		os=-vxworks
1245267843Sdelphij		;;
1246267843Sdelphij	w65*)
1247267843Sdelphij		basic_machine=w65-wdc
1248267843Sdelphij		os=-none
1249267843Sdelphij		;;
1250267843Sdelphij	w89k-*)
1251267843Sdelphij		basic_machine=hppa1.1-winbond
1252267843Sdelphij		os=-proelf
1253267843Sdelphij		;;
1254267843Sdelphij	xbox)
1255267843Sdelphij		basic_machine=i686-pc
1256267843Sdelphij		os=-mingw32
1257267843Sdelphij		;;
1258267843Sdelphij	xps | xps100)
1259267843Sdelphij		basic_machine=xps100-honeywell
1260267843Sdelphij		;;
1261267843Sdelphij	xscale-* | xscalee[bl]-*)
1262267843Sdelphij		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
1263267843Sdelphij		;;
1264267843Sdelphij	ymp)
1265267843Sdelphij		basic_machine=ymp-cray
1266267843Sdelphij		os=-unicos
1267267843Sdelphij		;;
1268267843Sdelphij	z8k-*-coff)
1269267843Sdelphij		basic_machine=z8k-unknown
1270267843Sdelphij		os=-sim
1271267843Sdelphij		;;
1272267843Sdelphij	z80-*-coff)
1273267843Sdelphij		basic_machine=z80-unknown
1274267843Sdelphij		os=-sim
1275267843Sdelphij		;;
1276267843Sdelphij	none)
1277267843Sdelphij		basic_machine=none-none
1278267843Sdelphij		os=-none
1279267843Sdelphij		;;
1280267843Sdelphij
1281267843Sdelphij# Here we handle the default manufacturer of certain CPU types.  It is in
1282267843Sdelphij# some cases the only manufacturer, in others, it is the most popular.
1283267843Sdelphij	w89k)
1284267843Sdelphij		basic_machine=hppa1.1-winbond
1285267843Sdelphij		;;
1286267843Sdelphij	op50n)
1287267843Sdelphij		basic_machine=hppa1.1-oki
1288267843Sdelphij		;;
1289267843Sdelphij	op60c)
1290267843Sdelphij		basic_machine=hppa1.1-oki
1291267843Sdelphij		;;
1292267843Sdelphij	romp)
1293267843Sdelphij		basic_machine=romp-ibm
1294267843Sdelphij		;;
1295267843Sdelphij	mmix)
1296267843Sdelphij		basic_machine=mmix-knuth
1297267843Sdelphij		;;
1298267843Sdelphij	rs6000)
1299267843Sdelphij		basic_machine=rs6000-ibm
1300267843Sdelphij		;;
1301267843Sdelphij	vax)
1302267843Sdelphij		basic_machine=vax-dec
1303267843Sdelphij		;;
1304267843Sdelphij	pdp10)
1305267843Sdelphij		# there are many clones, so DEC is not a safe bet
1306267843Sdelphij		basic_machine=pdp10-unknown
1307267843Sdelphij		;;
1308267843Sdelphij	pdp11)
1309267843Sdelphij		basic_machine=pdp11-dec
1310267843Sdelphij		;;
1311267843Sdelphij	we32k)
1312267843Sdelphij		basic_machine=we32k-att
1313267843Sdelphij		;;
1314267843Sdelphij	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
1315267843Sdelphij		basic_machine=sh-unknown
1316267843Sdelphij		;;
1317267843Sdelphij	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1318267843Sdelphij		basic_machine=sparc-sun
1319267843Sdelphij		;;
1320267843Sdelphij	cydra)
1321267843Sdelphij		basic_machine=cydra-cydrome
1322267843Sdelphij		;;
1323267843Sdelphij	orion)
1324267843Sdelphij		basic_machine=orion-highlevel
1325267843Sdelphij		;;
1326267843Sdelphij	orion105)
1327267843Sdelphij		basic_machine=clipper-highlevel
1328267843Sdelphij		;;
1329267843Sdelphij	mac | mpw | mac-mpw)
1330267843Sdelphij		basic_machine=m68k-apple
1331267843Sdelphij		;;
1332267843Sdelphij	pmac | pmac-mpw)
1333267843Sdelphij		basic_machine=powerpc-apple
1334267843Sdelphij		;;
1335267843Sdelphij	*-unknown)
1336267843Sdelphij		# Make sure to match an already-canonicalized machine name.
1337267843Sdelphij		;;
1338267843Sdelphij	*)
1339267843Sdelphij		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1340267843Sdelphij		exit 1
1341267843Sdelphij		;;
1342267843Sdelphijesac
1343267843Sdelphij
1344267843Sdelphij# Here we canonicalize certain aliases for manufacturers.
1345267843Sdelphijcase $basic_machine in
1346267843Sdelphij	*-digital*)
1347267843Sdelphij		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1348267843Sdelphij		;;
1349267843Sdelphij	*-commodore*)
1350267843Sdelphij		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1351267843Sdelphij		;;
1352267843Sdelphij	*)
1353267843Sdelphij		;;
1354267843Sdelphijesac
1355267843Sdelphij
1356267843Sdelphij# Decode manufacturer-specific aliases for certain operating systems.
1357267843Sdelphij
1358267843Sdelphijif [ x"$os" != x"" ]
1359267843Sdelphijthen
1360267843Sdelphijcase $os in
1361267843Sdelphij	# First match some system type aliases
1362267843Sdelphij	# that might get confused with valid system types.
1363267843Sdelphij	# -solaris* is a basic system type, with this one exception.
1364267843Sdelphij	-auroraux)
1365267843Sdelphij		os=-auroraux
1366267843Sdelphij		;;
1367267843Sdelphij	-solaris1 | -solaris1.*)
1368267843Sdelphij		os=`echo $os | sed -e 's|solaris1|sunos4|'`
1369267843Sdelphij		;;
1370267843Sdelphij	-solaris)
1371267843Sdelphij		os=-solaris2
1372267843Sdelphij		;;
1373267843Sdelphij	-svr4*)
1374267843Sdelphij		os=-sysv4
1375267843Sdelphij		;;
1376267843Sdelphij	-unixware*)
1377267843Sdelphij		os=-sysv4.2uw
1378267843Sdelphij		;;
1379267843Sdelphij	-gnu/linux*)
1380267843Sdelphij		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1381267843Sdelphij		;;
1382267843Sdelphij	# First accept the basic system types.
1383267843Sdelphij	# The portable systems comes first.
1384267843Sdelphij	# Each alternative MUST END IN A *, to match a version number.
1385267843Sdelphij	# -sysv* is not here because it comes later, after sysvr4.
1386267843Sdelphij	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1387267843Sdelphij	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1388267843Sdelphij	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1389309848Sdelphij	      | -sym* | -kopensolaris* | -plan9* \
1390267843Sdelphij	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1391328875Seadler	      | -aos* | -aros* | -cloudabi* | -sortix* \
1392267843Sdelphij	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1393267843Sdelphij	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1394267843Sdelphij	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1395328875Seadler	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
1396267843Sdelphij	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1397267843Sdelphij	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1398267843Sdelphij	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1399267843Sdelphij	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1400328875Seadler	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
1401267843Sdelphij	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1402328875Seadler	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1403309848Sdelphij	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
1404309848Sdelphij	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
1405267843Sdelphij	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1406267843Sdelphij	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1407267843Sdelphij	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1408267843Sdelphij	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1409267843Sdelphij	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1410267843Sdelphij	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1411328875Seadler	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
1412328875Seadler	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
1413267843Sdelphij	# Remember, each alternative MUST END IN *, to match a version number.
1414267843Sdelphij		;;
1415267843Sdelphij	-qnx*)
1416267843Sdelphij		case $basic_machine in
1417267843Sdelphij		    x86-* | i*86-*)
1418267843Sdelphij			;;
1419267843Sdelphij		    *)
1420267843Sdelphij			os=-nto$os
1421267843Sdelphij			;;
1422267843Sdelphij		esac
1423267843Sdelphij		;;
1424267843Sdelphij	-nto-qnx*)
1425267843Sdelphij		;;
1426267843Sdelphij	-nto*)
1427267843Sdelphij		os=`echo $os | sed -e 's|nto|nto-qnx|'`
1428267843Sdelphij		;;
1429267843Sdelphij	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1430267843Sdelphij	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1431267843Sdelphij	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1432267843Sdelphij		;;
1433267843Sdelphij	-mac*)
1434267843Sdelphij		os=`echo $os | sed -e 's|mac|macos|'`
1435267843Sdelphij		;;
1436267843Sdelphij	-linux-dietlibc)
1437267843Sdelphij		os=-linux-dietlibc
1438267843Sdelphij		;;
1439267843Sdelphij	-linux*)
1440267843Sdelphij		os=`echo $os | sed -e 's|linux|linux-gnu|'`
1441267843Sdelphij		;;
1442267843Sdelphij	-sunos5*)
1443267843Sdelphij		os=`echo $os | sed -e 's|sunos5|solaris2|'`
1444267843Sdelphij		;;
1445267843Sdelphij	-sunos6*)
1446267843Sdelphij		os=`echo $os | sed -e 's|sunos6|solaris3|'`
1447267843Sdelphij		;;
1448267843Sdelphij	-opened*)
1449267843Sdelphij		os=-openedition
1450267843Sdelphij		;;
1451267843Sdelphij	-os400*)
1452267843Sdelphij		os=-os400
1453267843Sdelphij		;;
1454267843Sdelphij	-wince*)
1455267843Sdelphij		os=-wince
1456267843Sdelphij		;;
1457267843Sdelphij	-osfrose*)
1458267843Sdelphij		os=-osfrose
1459267843Sdelphij		;;
1460267843Sdelphij	-osf*)
1461267843Sdelphij		os=-osf
1462267843Sdelphij		;;
1463267843Sdelphij	-utek*)
1464267843Sdelphij		os=-bsd
1465267843Sdelphij		;;
1466267843Sdelphij	-dynix*)
1467267843Sdelphij		os=-bsd
1468267843Sdelphij		;;
1469267843Sdelphij	-acis*)
1470267843Sdelphij		os=-aos
1471267843Sdelphij		;;
1472267843Sdelphij	-atheos*)
1473267843Sdelphij		os=-atheos
1474267843Sdelphij		;;
1475267843Sdelphij	-syllable*)
1476267843Sdelphij		os=-syllable
1477267843Sdelphij		;;
1478267843Sdelphij	-386bsd)
1479267843Sdelphij		os=-bsd
1480267843Sdelphij		;;
1481267843Sdelphij	-ctix* | -uts*)
1482267843Sdelphij		os=-sysv
1483267843Sdelphij		;;
1484267843Sdelphij	-nova*)
1485267843Sdelphij		os=-rtmk-nova
1486267843Sdelphij		;;
1487267843Sdelphij	-ns2 )
1488267843Sdelphij		os=-nextstep2
1489267843Sdelphij		;;
1490267843Sdelphij	-nsk*)
1491267843Sdelphij		os=-nsk
1492267843Sdelphij		;;
1493267843Sdelphij	# Preserve the version number of sinix5.
1494267843Sdelphij	-sinix5.*)
1495267843Sdelphij		os=`echo $os | sed -e 's|sinix|sysv|'`
1496267843Sdelphij		;;
1497267843Sdelphij	-sinix*)
1498267843Sdelphij		os=-sysv4
1499267843Sdelphij		;;
1500267843Sdelphij	-tpf*)
1501267843Sdelphij		os=-tpf
1502267843Sdelphij		;;
1503267843Sdelphij	-triton*)
1504267843Sdelphij		os=-sysv3
1505267843Sdelphij		;;
1506267843Sdelphij	-oss*)
1507267843Sdelphij		os=-sysv3
1508267843Sdelphij		;;
1509267843Sdelphij	-svr4)
1510267843Sdelphij		os=-sysv4
1511267843Sdelphij		;;
1512267843Sdelphij	-svr3)
1513267843Sdelphij		os=-sysv3
1514267843Sdelphij		;;
1515267843Sdelphij	-sysvr4)
1516267843Sdelphij		os=-sysv4
1517267843Sdelphij		;;
1518267843Sdelphij	# This must come after -sysvr4.
1519267843Sdelphij	-sysv*)
1520267843Sdelphij		;;
1521267843Sdelphij	-ose*)
1522267843Sdelphij		os=-ose
1523267843Sdelphij		;;
1524267843Sdelphij	-es1800*)
1525267843Sdelphij		os=-ose
1526267843Sdelphij		;;
1527267843Sdelphij	-xenix)
1528267843Sdelphij		os=-xenix
1529267843Sdelphij		;;
1530267843Sdelphij	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1531267843Sdelphij		os=-mint
1532267843Sdelphij		;;
1533267843Sdelphij	-aros*)
1534267843Sdelphij		os=-aros
1535267843Sdelphij		;;
1536267843Sdelphij	-zvmoe)
1537267843Sdelphij		os=-zvmoe
1538267843Sdelphij		;;
1539267843Sdelphij	-dicos*)
1540267843Sdelphij		os=-dicos
1541267843Sdelphij		;;
1542267843Sdelphij	-nacl*)
1543267843Sdelphij		;;
1544328875Seadler	-ios)
1545328875Seadler		;;
1546267843Sdelphij	-none)
1547267843Sdelphij		;;
1548267843Sdelphij	*)
1549267843Sdelphij		# Get rid of the `-' at the beginning of $os.
1550267843Sdelphij		os=`echo $os | sed 's/[^-]*-//'`
1551267843Sdelphij		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1552267843Sdelphij		exit 1
1553267843Sdelphij		;;
1554267843Sdelphijesac
1555267843Sdelphijelse
1556267843Sdelphij
1557267843Sdelphij# Here we handle the default operating systems that come with various machines.
1558267843Sdelphij# The value should be what the vendor currently ships out the door with their
1559267843Sdelphij# machine or put another way, the most popular os provided with the machine.
1560267843Sdelphij
1561267843Sdelphij# Note that if you're going to try to match "-MANUFACTURER" here (say,
1562267843Sdelphij# "-sun"), then you have to tell the case statement up towards the top
1563267843Sdelphij# that MANUFACTURER isn't an operating system.  Otherwise, code above
1564267843Sdelphij# will signal an error saying that MANUFACTURER isn't an operating
1565267843Sdelphij# system, and we'll never get to this point.
1566267843Sdelphij
1567267843Sdelphijcase $basic_machine in
1568267843Sdelphij	score-*)
1569267843Sdelphij		os=-elf
1570267843Sdelphij		;;
1571267843Sdelphij	spu-*)
1572267843Sdelphij		os=-elf
1573267843Sdelphij		;;
1574267843Sdelphij	*-acorn)
1575267843Sdelphij		os=-riscix1.2
1576267843Sdelphij		;;
1577267843Sdelphij	arm*-rebel)
1578267843Sdelphij		os=-linux
1579267843Sdelphij		;;
1580267843Sdelphij	arm*-semi)
1581267843Sdelphij		os=-aout
1582267843Sdelphij		;;
1583267843Sdelphij	c4x-* | tic4x-*)
1584267843Sdelphij		os=-coff
1585267843Sdelphij		;;
1586309848Sdelphij	c8051-*)
1587309848Sdelphij		os=-elf
1588309848Sdelphij		;;
1589309848Sdelphij	hexagon-*)
1590309848Sdelphij		os=-elf
1591309848Sdelphij		;;
1592267843Sdelphij	tic54x-*)
1593267843Sdelphij		os=-coff
1594267843Sdelphij		;;
1595267843Sdelphij	tic55x-*)
1596267843Sdelphij		os=-coff
1597267843Sdelphij		;;
1598267843Sdelphij	tic6x-*)
1599267843Sdelphij		os=-coff
1600267843Sdelphij		;;
1601267843Sdelphij	# This must come before the *-dec entry.
1602267843Sdelphij	pdp10-*)
1603267843Sdelphij		os=-tops20
1604267843Sdelphij		;;
1605267843Sdelphij	pdp11-*)
1606267843Sdelphij		os=-none
1607267843Sdelphij		;;
1608267843Sdelphij	*-dec | vax-*)
1609267843Sdelphij		os=-ultrix4.2
1610267843Sdelphij		;;
1611267843Sdelphij	m68*-apollo)
1612267843Sdelphij		os=-domain
1613267843Sdelphij		;;
1614267843Sdelphij	i386-sun)
1615267843Sdelphij		os=-sunos4.0.2
1616267843Sdelphij		;;
1617267843Sdelphij	m68000-sun)
1618267843Sdelphij		os=-sunos3
1619267843Sdelphij		;;
1620267843Sdelphij	m68*-cisco)
1621267843Sdelphij		os=-aout
1622267843Sdelphij		;;
1623267843Sdelphij	mep-*)
1624267843Sdelphij		os=-elf
1625267843Sdelphij		;;
1626267843Sdelphij	mips*-cisco)
1627267843Sdelphij		os=-elf
1628267843Sdelphij		;;
1629267843Sdelphij	mips*-*)
1630267843Sdelphij		os=-elf
1631267843Sdelphij		;;
1632267843Sdelphij	or32-*)
1633267843Sdelphij		os=-coff
1634267843Sdelphij		;;
1635267843Sdelphij	*-tti)	# must be before sparc entry or we get the wrong os.
1636267843Sdelphij		os=-sysv3
1637267843Sdelphij		;;
1638267843Sdelphij	sparc-* | *-sun)
1639267843Sdelphij		os=-sunos4.1.1
1640267843Sdelphij		;;
1641328875Seadler	pru-*)
1642328875Seadler		os=-elf
1643328875Seadler		;;
1644267843Sdelphij	*-be)
1645267843Sdelphij		os=-beos
1646267843Sdelphij		;;
1647267843Sdelphij	*-haiku)
1648267843Sdelphij		os=-haiku
1649267843Sdelphij		;;
1650267843Sdelphij	*-ibm)
1651267843Sdelphij		os=-aix
1652267843Sdelphij		;;
1653267843Sdelphij	*-knuth)
1654267843Sdelphij		os=-mmixware
1655267843Sdelphij		;;
1656267843Sdelphij	*-wec)
1657267843Sdelphij		os=-proelf
1658267843Sdelphij		;;
1659267843Sdelphij	*-winbond)
1660267843Sdelphij		os=-proelf
1661267843Sdelphij		;;
1662267843Sdelphij	*-oki)
1663267843Sdelphij		os=-proelf
1664267843Sdelphij		;;
1665267843Sdelphij	*-hp)
1666267843Sdelphij		os=-hpux
1667267843Sdelphij		;;
1668267843Sdelphij	*-hitachi)
1669267843Sdelphij		os=-hiux
1670267843Sdelphij		;;
1671267843Sdelphij	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1672267843Sdelphij		os=-sysv
1673267843Sdelphij		;;
1674267843Sdelphij	*-cbm)
1675267843Sdelphij		os=-amigaos
1676267843Sdelphij		;;
1677267843Sdelphij	*-dg)
1678267843Sdelphij		os=-dgux
1679267843Sdelphij		;;
1680267843Sdelphij	*-dolphin)
1681267843Sdelphij		os=-sysv3
1682267843Sdelphij		;;
1683267843Sdelphij	m68k-ccur)
1684267843Sdelphij		os=-rtu
1685267843Sdelphij		;;
1686267843Sdelphij	m88k-omron*)
1687267843Sdelphij		os=-luna
1688267843Sdelphij		;;
1689267843Sdelphij	*-next )
1690267843Sdelphij		os=-nextstep
1691267843Sdelphij		;;
1692267843Sdelphij	*-sequent)
1693267843Sdelphij		os=-ptx
1694267843Sdelphij		;;
1695267843Sdelphij	*-crds)
1696267843Sdelphij		os=-unos
1697267843Sdelphij		;;
1698267843Sdelphij	*-ns)
1699267843Sdelphij		os=-genix
1700267843Sdelphij		;;
1701267843Sdelphij	i370-*)
1702267843Sdelphij		os=-mvs
1703267843Sdelphij		;;
1704267843Sdelphij	*-next)
1705267843Sdelphij		os=-nextstep3
1706267843Sdelphij		;;
1707267843Sdelphij	*-gould)
1708267843Sdelphij		os=-sysv
1709267843Sdelphij		;;
1710267843Sdelphij	*-highlevel)
1711267843Sdelphij		os=-bsd
1712267843Sdelphij		;;
1713267843Sdelphij	*-encore)
1714267843Sdelphij		os=-bsd
1715267843Sdelphij		;;
1716267843Sdelphij	*-sgi)
1717267843Sdelphij		os=-irix
1718267843Sdelphij		;;
1719267843Sdelphij	*-siemens)
1720267843Sdelphij		os=-sysv4
1721267843Sdelphij		;;
1722267843Sdelphij	*-masscomp)
1723267843Sdelphij		os=-rtu
1724267843Sdelphij		;;
1725267843Sdelphij	f30[01]-fujitsu | f700-fujitsu)
1726267843Sdelphij		os=-uxpv
1727267843Sdelphij		;;
1728267843Sdelphij	*-rom68k)
1729267843Sdelphij		os=-coff
1730267843Sdelphij		;;
1731267843Sdelphij	*-*bug)
1732267843Sdelphij		os=-coff
1733267843Sdelphij		;;
1734267843Sdelphij	*-apple)
1735267843Sdelphij		os=-macos
1736267843Sdelphij		;;
1737267843Sdelphij	*-atari*)
1738267843Sdelphij		os=-mint
1739267843Sdelphij		;;
1740267843Sdelphij	*)
1741267843Sdelphij		os=-none
1742267843Sdelphij		;;
1743267843Sdelphijesac
1744267843Sdelphijfi
1745267843Sdelphij
1746267843Sdelphij# Here we handle the case where we know the os, and the CPU type, but not the
1747267843Sdelphij# manufacturer.  We pick the logical manufacturer.
1748267843Sdelphijvendor=unknown
1749267843Sdelphijcase $basic_machine in
1750267843Sdelphij	*-unknown)
1751267843Sdelphij		case $os in
1752267843Sdelphij			-riscix*)
1753267843Sdelphij				vendor=acorn
1754267843Sdelphij				;;
1755267843Sdelphij			-sunos*)
1756267843Sdelphij				vendor=sun
1757267843Sdelphij				;;
1758267843Sdelphij			-cnk*|-aix*)
1759267843Sdelphij				vendor=ibm
1760267843Sdelphij				;;
1761267843Sdelphij			-beos*)
1762267843Sdelphij				vendor=be
1763267843Sdelphij				;;
1764267843Sdelphij			-hpux*)
1765267843Sdelphij				vendor=hp
1766267843Sdelphij				;;
1767267843Sdelphij			-mpeix*)
1768267843Sdelphij				vendor=hp
1769267843Sdelphij				;;
1770267843Sdelphij			-hiux*)
1771267843Sdelphij				vendor=hitachi
1772267843Sdelphij				;;
1773267843Sdelphij			-unos*)
1774267843Sdelphij				vendor=crds
1775267843Sdelphij				;;
1776267843Sdelphij			-dgux*)
1777267843Sdelphij				vendor=dg
1778267843Sdelphij				;;
1779267843Sdelphij			-luna*)
1780267843Sdelphij				vendor=omron
1781267843Sdelphij				;;
1782267843Sdelphij			-genix*)
1783267843Sdelphij				vendor=ns
1784267843Sdelphij				;;
1785267843Sdelphij			-mvs* | -opened*)
1786267843Sdelphij				vendor=ibm
1787267843Sdelphij				;;
1788267843Sdelphij			-os400*)
1789267843Sdelphij				vendor=ibm
1790267843Sdelphij				;;
1791267843Sdelphij			-ptx*)
1792267843Sdelphij				vendor=sequent
1793267843Sdelphij				;;
1794267843Sdelphij			-tpf*)
1795267843Sdelphij				vendor=ibm
1796267843Sdelphij				;;
1797267843Sdelphij			-vxsim* | -vxworks* | -windiss*)
1798267843Sdelphij				vendor=wrs
1799267843Sdelphij				;;
1800267843Sdelphij			-aux*)
1801267843Sdelphij				vendor=apple
1802267843Sdelphij				;;
1803267843Sdelphij			-hms*)
1804267843Sdelphij				vendor=hitachi
1805267843Sdelphij				;;
1806267843Sdelphij			-mpw* | -macos*)
1807267843Sdelphij				vendor=apple
1808267843Sdelphij				;;
1809267843Sdelphij			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1810267843Sdelphij				vendor=atari
1811267843Sdelphij				;;
1812267843Sdelphij			-vos*)
1813267843Sdelphij				vendor=stratus
1814267843Sdelphij				;;
1815267843Sdelphij		esac
1816267843Sdelphij		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1817267843Sdelphij		;;
1818267843Sdelphijesac
1819267843Sdelphij
1820267843Sdelphijecho $basic_machine$os
1821267843Sdelphijexit
1822267843Sdelphij
1823267843Sdelphij# Local variables:
1824267843Sdelphij# eval: (add-hook 'write-file-hooks 'time-stamp)
1825267843Sdelphij# time-stamp-start: "timestamp='"
1826267843Sdelphij# time-stamp-format: "%:y-%02m-%02d"
1827267843Sdelphij# time-stamp-end: "'"
1828267843Sdelphij# End:
1829