58eeb75
#! /bin/sh
58eeb75
# Configuration validation subroutine script.
200424a
#   Copyright 1992-2018 Free Software Foundation, Inc.
58eeb75
21b7b3f
timestamp='2018-08-29'
58eeb75
58eeb75
# This file is free software; you can redistribute it and/or modify it
58eeb75
# under the terms of the GNU General Public License as published by
58eeb75
# the Free Software Foundation; either version 3 of the License, or
58eeb75
# (at your option) any later version.
58eeb75
#
58eeb75
# This program is distributed in the hope that it will be useful, but
58eeb75
# WITHOUT ANY WARRANTY; without even the implied warranty of
58eeb75
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
58eeb75
# General Public License for more details.
58eeb75
#
58eeb75
# You should have received a copy of the GNU General Public License
200424a
# along with this program; if not, see <https://www.gnu.org/licenses/>.
58eeb75
#
58eeb75
# As a special exception to the GNU General Public License, if you
58eeb75
# distribute this file as part of a program that contains a
58eeb75
# configuration script generated by Autoconf, you may include it under
58eeb75
# the same distribution terms that you use for the rest of that
58eeb75
# program.  This Exception is an additional permission under section 7
58eeb75
# of the GNU General Public License, version 3 ("GPLv3").
58eeb75
58eeb75
f7306e7
# Please send patches to <config-patches@gnu.org>.
58eeb75
#
58eeb75
# Configuration subroutine to validate and canonicalize a configuration type.
58eeb75
# Supply the specified configuration type as an argument.
58eeb75
# If it is invalid, we print an error message on stderr and exit with code 1.
58eeb75
# Otherwise, we print the canonical config type on stdout and succeed.
58eeb75
58eeb75
# You can get the latest version of this script from:
200424a
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
58eeb75
58eeb75
# This file is supposed to be the same for all GNU packages
58eeb75
# and recognize all the CPU types, system types and aliases
58eeb75
# that are meaningful with *any* GNU software.
58eeb75
# Each package is responsible for reporting which valid configurations
58eeb75
# it does not support.  The user should be able to distinguish
58eeb75
# a failure to support a valid configuration from a meaningless
58eeb75
# configuration.
58eeb75
58eeb75
# The goal of this file is to map all the various variations of a given
58eeb75
# machine specification into a single specification in the form:
58eeb75
#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
58eeb75
# or in some cases, the newer four-part form:
58eeb75
#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
58eeb75
# It is wrong to echo any other type of specification.
58eeb75
58eeb75
me=`echo "$0" | sed -e 's,.*/,,'`
58eeb75
58eeb75
usage="\
fb31339
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
58eeb75
58eeb75
Canonicalize a configuration name.
58eeb75
200424a
Options:
58eeb75
  -h, --help         print this help, then exit
58eeb75
  -t, --time-stamp   print date of last modification, then exit
58eeb75
  -v, --version      print version number, then exit
58eeb75
58eeb75
Report bugs and patches to <config-patches@gnu.org>."
58eeb75
58eeb75
version="\
58eeb75
GNU config.sub ($timestamp)
58eeb75
200424a
Copyright 1992-2018 Free Software Foundation, Inc.
58eeb75
58eeb75
This is free software; see the source for copying conditions.  There is NO
58eeb75
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
58eeb75
58eeb75
help="
58eeb75
Try \`$me --help' for more information."
58eeb75
58eeb75
# Parse command line
58eeb75
while test $# -gt 0 ; do
58eeb75
  case $1 in
58eeb75
    --time-stamp | --time* | -t )
58eeb75
       echo "$timestamp" ; exit ;;
58eeb75
    --version | -v )
58eeb75
       echo "$version" ; exit ;;
58eeb75
    --help | --h* | -h )
58eeb75
       echo "$usage"; exit ;;
58eeb75
    -- )     # Stop option processing
58eeb75
       shift; break ;;
58eeb75
    - )	# Use stdin as input.
58eeb75
       break ;;
58eeb75
    -* )
58eeb75
       echo "$me: invalid option $1$help"
58eeb75
       exit 1 ;;
58eeb75
58eeb75
    *local*)
58eeb75
       # First pass through any local machine types.
200424a
       echo "$1"
58eeb75
       exit ;;
58eeb75
58eeb75
    * )
58eeb75
       break ;;
58eeb75
  esac
58eeb75
done
58eeb75
58eeb75
case $# in
58eeb75
 0) echo "$me: missing argument$help" >&2
58eeb75
    exit 1;;
58eeb75
 1) ;;
58eeb75
 *) echo "$me: too many arguments$help" >&2
58eeb75
    exit 1;;
58eeb75
esac
58eeb75
21b7b3f
# Split fields of configuration type
200424a
IFS="-" read -r field1 field2 field3 field4 <
200424a
$1
200424a
EOF
200424a
200424a
# Separate into logical components for further validation
200424a
case $1 in
21b7b3f
	*-*-*-*-*)
21b7b3f
		echo Invalid configuration \`"$1"\': more than four components >&2
21b7b3f
		exit 1
21b7b3f
		;;
200424a
	*-*-*-*)
200424a
		basic_machine=$field1-$field2
21b7b3f
		os=$field3-$field4
200424a
		;;
200424a
	*-*-*)
200424a
		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
200424a
		# parts
200424a
		maybe_os=$field2-$field3
200424a
		case $maybe_os in
200424a
			nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
200424a
			| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
200424a
			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
200424a
			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
200424a
			| storm-chaos* | os2-emx* | rtmk-nova*)
200424a
				basic_machine=$field1
21b7b3f
				os=$maybe_os
200424a
				;;
200424a
			android-linux)
200424a
				basic_machine=$field1-unknown
21b7b3f
				os=linux-android
200424a
				;;
200424a
			*)
200424a
				basic_machine=$field1-$field2
21b7b3f
				os=$field3
200424a
				;;
200424a
		esac
200424a
		;;
200424a
	*-*)
21b7b3f
		# A lone config we happen to match not fitting any patern
21b7b3f
		case $field1-$field2 in
21b7b3f
			decstation-3100)
21b7b3f
				basic_machine=mips-dec
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			*-*)
21b7b3f
				# Second component is usually, but not always the OS
21b7b3f
				case $field2 in
21b7b3f
					# Prevent following clause from handling this valid os
21b7b3f
					sun*os*)
21b7b3f
						basic_machine=$field1
21b7b3f
						os=$field2
21b7b3f
						;;
21b7b3f
					# Manufacturers
21b7b3f
					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
21b7b3f
					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
21b7b3f
					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
21b7b3f
					| convergent* | ncr* | news | 32* | 3600* | 3100* \
21b7b3f
					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
21b7b3f
					| ultra | tti* | harris | dolphin | highlevel | gould \
21b7b3f
					| cbm | ns | masscomp | apple | axis | knuth | cray \
21b7b3f
					| microblaze* | sim | cisco \
21b7b3f
					| oki | wec | wrs | winbond)
21b7b3f
						basic_machine=$field1-$field2
21b7b3f
						os=
21b7b3f
						;;
21b7b3f
					*)
21b7b3f
						basic_machine=$field1
21b7b3f
						os=$field2
21b7b3f
						;;
21b7b3f
				esac
21b7b3f
			;;
21b7b3f
		esac
200424a
		;;
200424a
	*)
21b7b3f
		# Convert single-component short-hands not valid as part of
21b7b3f
		# multi-component configurations.
21b7b3f
		case $field1 in
21b7b3f
			386bsd)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			a29khif)
21b7b3f
				basic_machine=a29k-amd
21b7b3f
				os=udi
21b7b3f
				;;
21b7b3f
			adobe68k)
21b7b3f
				basic_machine=m68010-adobe
21b7b3f
				os=scout
21b7b3f
				;;
21b7b3f
			alliant)
21b7b3f
				basic_machine=fx80-alliant
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			altos | altos3068)
21b7b3f
				basic_machine=m68k-altos
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			am29k)
21b7b3f
				basic_machine=a29k-none
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			amdahl)
21b7b3f
				basic_machine=580-amdahl
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			amiga)
21b7b3f
				basic_machine=m68k-unknown
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			amigaos | amigados)
21b7b3f
				basic_machine=m68k-unknown
21b7b3f
				os=amigaos
21b7b3f
				;;
21b7b3f
			amigaunix | amix)
21b7b3f
				basic_machine=m68k-unknown
21b7b3f
				os=sysv4
21b7b3f
				;;
21b7b3f
			apollo68)
21b7b3f
				basic_machine=m68k-apollo
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			apollo68bsd)
21b7b3f
				basic_machine=m68k-apollo
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			aros)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=aros
21b7b3f
				;;
21b7b3f
			aux)
21b7b3f
				basic_machine=m68k-apple
21b7b3f
				os=aux
21b7b3f
				;;
21b7b3f
			balance)
21b7b3f
				basic_machine=ns32k-sequent
21b7b3f
				os=dynix
21b7b3f
				;;
21b7b3f
			blackfin)
21b7b3f
				basic_machine=bfin-unknown
21b7b3f
				os=linux
21b7b3f
				;;
21b7b3f
			cegcc)
21b7b3f
				basic_machine=arm-unknown
21b7b3f
				os=cegcc
21b7b3f
				;;
21b7b3f
			convex-c1)
21b7b3f
				basic_machine=c1-convex
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			convex-c2)
21b7b3f
				basic_machine=c2-convex
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			convex-c32)
21b7b3f
				basic_machine=c32-convex
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			convex-c34)
21b7b3f
				basic_machine=c34-convex
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			convex-c38)
21b7b3f
				basic_machine=c38-convex
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			cray)
21b7b3f
				basic_machine=j90-cray
21b7b3f
				os=unicos
21b7b3f
				;;
21b7b3f
			crds | unos)
21b7b3f
				basic_machine=m68k-crds
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			da30)
21b7b3f
				basic_machine=m68k-da30
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			decstation | pmax | pmin | dec3100 | decstatn)
21b7b3f
				basic_machine=mips-dec
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			delta88)
21b7b3f
				basic_machine=m88k-motorola
21b7b3f
				os=sysv3
21b7b3f
				;;
21b7b3f
			dicos)
21b7b3f
				basic_machine=i686-pc
21b7b3f
				os=dicos
21b7b3f
				;;
21b7b3f
			djgpp)
21b7b3f
				basic_machine=i586-pc
21b7b3f
				os=msdosdjgpp
21b7b3f
				;;
21b7b3f
			ebmon29k)
21b7b3f
				basic_machine=a29k-amd
21b7b3f
				os=ebmon
21b7b3f
				;;
21b7b3f
			es1800 | OSE68k | ose68k | ose | OSE)
21b7b3f
				basic_machine=m68k-ericsson
21b7b3f
				os=ose
21b7b3f
				;;
21b7b3f
			gmicro)
21b7b3f
				basic_machine=tron-gmicro
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			go32)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=go32
21b7b3f
				;;
21b7b3f
			h8300hms)
21b7b3f
				basic_machine=h8300-hitachi
21b7b3f
				os=hms
21b7b3f
				;;
21b7b3f
			h8300xray)
21b7b3f
				basic_machine=h8300-hitachi
21b7b3f
				os=xray
21b7b3f
				;;
21b7b3f
			h8500hms)
21b7b3f
				basic_machine=h8500-hitachi
21b7b3f
				os=hms
21b7b3f
				;;
21b7b3f
			harris)
21b7b3f
				basic_machine=m88k-harris
21b7b3f
				os=sysv3
21b7b3f
				;;
21b7b3f
			hp300)
21b7b3f
				basic_machine=m68k-hp
21b7b3f
				;;
21b7b3f
			hp300bsd)
21b7b3f
				basic_machine=m68k-hp
21b7b3f
				os=bsd
21b7b3f
				;;
21b7b3f
			hp300hpux)
21b7b3f
				basic_machine=m68k-hp
21b7b3f
				os=hpux
21b7b3f
				;;
21b7b3f
			hppaosf)
21b7b3f
				basic_machine=hppa1.1-hp
21b7b3f
				os=osf
21b7b3f
				;;
21b7b3f
			hppro)
21b7b3f
				basic_machine=hppa1.1-hp
21b7b3f
				os=proelf
21b7b3f
				;;
21b7b3f
			i386mach)
21b7b3f
				basic_machine=i386-mach
21b7b3f
				os=mach
21b7b3f
				;;
21b7b3f
			vsta)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=vsta
21b7b3f
				;;
21b7b3f
			isi68 | isi)
21b7b3f
				basic_machine=m68k-isi
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			m68knommu)
21b7b3f
				basic_machine=m68k-unknown
21b7b3f
				os=linux
21b7b3f
				;;
21b7b3f
			magnum | m3230)
21b7b3f
				basic_machine=mips-mips
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			merlin)
21b7b3f
				basic_machine=ns32k-utek
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			mingw64)
21b7b3f
				basic_machine=x86_64-pc
21b7b3f
				os=mingw64
21b7b3f
				;;
21b7b3f
			mingw32)
21b7b3f
				basic_machine=i686-pc
21b7b3f
				os=mingw32
21b7b3f
				;;
21b7b3f
			mingw32ce)
21b7b3f
				basic_machine=arm-unknown
21b7b3f
				os=mingw32ce
21b7b3f
				;;
21b7b3f
			monitor)
21b7b3f
				basic_machine=m68k-rom68k
21b7b3f
				os=coff
21b7b3f
				;;
21b7b3f
			morphos)
21b7b3f
				basic_machine=powerpc-unknown
21b7b3f
				os=morphos
21b7b3f
				;;
21b7b3f
			moxiebox)
21b7b3f
				basic_machine=moxie-unknown
21b7b3f
				os=moxiebox
21b7b3f
				;;
21b7b3f
			msdos)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=msdos
21b7b3f
				;;
21b7b3f
			msys)
21b7b3f
				basic_machine=i686-pc
21b7b3f
				os=msys
21b7b3f
				;;
21b7b3f
			mvs)
21b7b3f
				basic_machine=i370-ibm
21b7b3f
				os=mvs
21b7b3f
				;;
21b7b3f
			nacl)
21b7b3f
				basic_machine=le32-unknown
21b7b3f
				os=nacl
21b7b3f
				;;
21b7b3f
			ncr3000)
21b7b3f
				basic_machine=i486-ncr
21b7b3f
				os=sysv4
21b7b3f
				;;
21b7b3f
			netbsd386)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=netbsd
21b7b3f
				;;
21b7b3f
			netwinder)
21b7b3f
				basic_machine=armv4l-rebel
21b7b3f
				os=linux
21b7b3f
				;;
21b7b3f
			news | news700 | news800 | news900)
21b7b3f
				basic_machine=m68k-sony
21b7b3f
				os=newsos
21b7b3f
				;;
21b7b3f
			news1000)
21b7b3f
				basic_machine=m68030-sony
21b7b3f
				os=newsos
21b7b3f
				;;
21b7b3f
			necv70)
21b7b3f
				basic_machine=v70-nec
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			nh3000)
21b7b3f
				basic_machine=m68k-harris
21b7b3f
				os=cxux
21b7b3f
				;;
21b7b3f
			nh[45]000)
21b7b3f
				basic_machine=m88k-harris
21b7b3f
				os=cxux
21b7b3f
				;;
21b7b3f
			nindy960)
21b7b3f
				basic_machine=i960-intel
21b7b3f
				os=nindy
21b7b3f
				;;
21b7b3f
			mon960)
21b7b3f
				basic_machine=i960-intel
21b7b3f
				os=mon960
21b7b3f
				;;
21b7b3f
			nonstopux)
21b7b3f
				basic_machine=mips-compaq
21b7b3f
				os=nonstopux
21b7b3f
				;;
21b7b3f
			os400)
21b7b3f
				basic_machine=powerpc-ibm
21b7b3f
				os=os400
21b7b3f
				;;
21b7b3f
			OSE68000 | ose68000)
21b7b3f
				basic_machine=m68000-ericsson
21b7b3f
				os=ose
21b7b3f
				;;
21b7b3f
			os68k)
21b7b3f
				basic_machine=m68k-none
21b7b3f
				os=os68k
21b7b3f
				;;
21b7b3f
			paragon)
21b7b3f
				basic_machine=i860-intel
21b7b3f
				os=osf
21b7b3f
				;;
21b7b3f
			parisc)
21b7b3f
				basic_machine=hppa-unknown
21b7b3f
				os=linux
21b7b3f
				;;
21b7b3f
			pw32)
21b7b3f
				basic_machine=i586-unknown
21b7b3f
				os=pw32
21b7b3f
				;;
21b7b3f
			rdos | rdos64)
21b7b3f
				basic_machine=x86_64-pc
21b7b3f
				os=rdos
21b7b3f
				;;
21b7b3f
			rdos32)
21b7b3f
				basic_machine=i386-pc
21b7b3f
				os=rdos
21b7b3f
				;;
21b7b3f
			rom68k)
21b7b3f
				basic_machine=m68k-rom68k
21b7b3f
				os=coff
21b7b3f
				;;
21b7b3f
			sa29200)
21b7b3f
				basic_machine=a29k-amd
21b7b3f
				os=udi
21b7b3f
				;;
21b7b3f
			sei)
21b7b3f
				basic_machine=mips-sei
21b7b3f
				os=seiux
21b7b3f
				;;
21b7b3f
			sequent)
21b7b3f
				basic_machine=i386-sequent
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			sps7)
21b7b3f
				basic_machine=m68k-bull
21b7b3f
				os=sysv2
21b7b3f
				;;
21b7b3f
			st2000)
21b7b3f
				basic_machine=m68k-tandem
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			stratus)
21b7b3f
				basic_machine=i860-stratus
21b7b3f
				os=sysv4
21b7b3f
				;;
21b7b3f
			sun2)
21b7b3f
				basic_machine=m68000-sun
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			sun2os3)
21b7b3f
				basic_machine=m68000-sun
21b7b3f
				os=sunos3
21b7b3f
				;;
21b7b3f
			sun2os4)
21b7b3f
				basic_machine=m68000-sun
21b7b3f
				os=sunos4
21b7b3f
				;;
21b7b3f
			sun3)
21b7b3f
				basic_machine=m68k-sun
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			sun3os3)
21b7b3f
				basic_machine=m68k-sun
21b7b3f
				os=sunos3
21b7b3f
				;;
21b7b3f
			sun3os4)
21b7b3f
				basic_machine=m68k-sun
21b7b3f
				os=sunos4
21b7b3f
				;;
21b7b3f
			sun4)
21b7b3f
				basic_machine=sparc-sun
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			sun4os3)
21b7b3f
				basic_machine=sparc-sun
21b7b3f
				os=sunos3
21b7b3f
				;;
21b7b3f
			sun4os4)
21b7b3f
				basic_machine=sparc-sun
21b7b3f
				os=sunos4
21b7b3f
				;;
21b7b3f
			sun4sol2)
21b7b3f
				basic_machine=sparc-sun
21b7b3f
				os=solaris2
21b7b3f
				;;
21b7b3f
			sun386 | sun386i | roadrunner)
21b7b3f
				basic_machine=i386-sun
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
			sv1)
21b7b3f
				basic_machine=sv1-cray
21b7b3f
				os=unicos
21b7b3f
				;;
21b7b3f
			symmetry)
21b7b3f
				basic_machine=i386-sequent
21b7b3f
				os=dynix
21b7b3f
				;;
21b7b3f
			t3e)
21b7b3f
				basic_machine=alphaev5-cray
21b7b3f
				os=unicos
21b7b3f
				;;
21b7b3f
			t90)
21b7b3f
				basic_machine=t90-cray
21b7b3f
				os=unicos
21b7b3f
				;;
21b7b3f
			toad1)
21b7b3f
				basic_machine=pdp10-xkl
21b7b3f
				os=tops20
21b7b3f
				;;
21b7b3f
			tpf)
21b7b3f
				basic_machine=s390x-ibm
21b7b3f
				os=tpf
21b7b3f
				;;
21b7b3f
			udi29k)
21b7b3f
				basic_machine=a29k-amd
21b7b3f
				os=udi
21b7b3f
				;;
21b7b3f
			ultra3)
21b7b3f
				basic_machine=a29k-nyu
21b7b3f
				os=sym1
21b7b3f
				;;
21b7b3f
			v810 | necv810)
21b7b3f
				basic_machine=v810-nec
21b7b3f
				os=none
21b7b3f
				;;
21b7b3f
			vaxv)
21b7b3f
				basic_machine=vax-dec
21b7b3f
				os=sysv
21b7b3f
				;;
21b7b3f
			vms)
21b7b3f
				basic_machine=vax-dec
21b7b3f
				os=vms
21b7b3f
				;;
21b7b3f
			vxworks960)
21b7b3f
				basic_machine=i960-wrs
21b7b3f
				os=vxworks
21b7b3f
				;;
21b7b3f
			vxworks68)
21b7b3f
				basic_machine=m68k-wrs
21b7b3f
				os=vxworks
21b7b3f
				;;
21b7b3f
			vxworks29k)
21b7b3f
				basic_machine=a29k-wrs
21b7b3f
				os=vxworks
21b7b3f
				;;
21b7b3f
			xbox)
21b7b3f
				basic_machine=i686-pc
21b7b3f
				os=mingw32
21b7b3f
				;;
21b7b3f
			ymp)
21b7b3f
				basic_machine=ymp-cray
21b7b3f
				os=unicos
21b7b3f
				;;
21b7b3f
			*)
21b7b3f
				basic_machine=$1
21b7b3f
				os=
21b7b3f
				;;
21b7b3f
		esac
58eeb75
		;;
58eeb75
esac
58eeb75
21b7b3f
# Decode 1-component or ad-hoc basic machines
58eeb75
case $basic_machine in
21b7b3f
	# Here we handle the default manufacturer of certain CPU types.  It is in
21b7b3f
	# some cases the only manufacturer, in others, it is the most popular.
21b7b3f
	w89k)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=winbond
200424a
		;;
21b7b3f
	op50n)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=oki
58eeb75
		;;
21b7b3f
	op60c)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=oki
58eeb75
		;;
21b7b3f
	ibm*)
21b7b3f
		cpu=i370
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	orion105)
21b7b3f
		cpu=clipper
21b7b3f
		vendor=highlevel
58eeb75
		;;
21b7b3f
	mac | mpw | mac-mpw)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=apple
58eeb75
		;;
21b7b3f
	pmac | pmac-mpw)
21b7b3f
		cpu=powerpc
21b7b3f
		vendor=apple
58eeb75
		;;
58eeb75
58eeb75
	# Recognize the various machine names and aliases which stand
58eeb75
	# for a CPU type and a company and sometimes even an OS.
58eeb75
	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
21b7b3f
		cpu=m68000
21b7b3f
		vendor=att
58eeb75
		;;
58eeb75
	3b*)
21b7b3f
		cpu=we32k
21b7b3f
		vendor=att
58eeb75
		;;
58eeb75
	bluegene*)
21b7b3f
		cpu=powerpc
21b7b3f
		vendor=ibm
21b7b3f
		os=cnk
58eeb75
		;;
58eeb75
	decsystem10* | dec10*)
21b7b3f
		cpu=pdp10
21b7b3f
		vendor=dec
21b7b3f
		os=tops10
58eeb75
		;;
58eeb75
	decsystem20* | dec20*)
21b7b3f
		cpu=pdp10
21b7b3f
		vendor=dec
21b7b3f
		os=tops20
58eeb75
		;;
58eeb75
	delta | 3300 | motorola-3300 | motorola-delta \
58eeb75
	      | 3300-motorola | delta-motorola)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=motorola
58eeb75
		;;
200424a
	dpx2*)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=bull
21b7b3f
		os=sysv3
58eeb75
		;;
58eeb75
	encore | umax | mmax)
21b7b3f
		cpu=ns32k
21b7b3f
		vendor=encore
58eeb75
		;;
21b7b3f
	elxsi)
21b7b3f
		cpu=elxsi
21b7b3f
		vendor=elxsi
21b7b3f
		os=${os:-bsd}
58eeb75
		;;
58eeb75
	fx2800)
21b7b3f
		cpu=i860
21b7b3f
		vendor=alliant
58eeb75
		;;
58eeb75
	genix)
21b7b3f
		cpu=ns32k
21b7b3f
		vendor=ns
58eeb75
		;;
58eeb75
	h3050r* | hiux*)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=hitachi
21b7b3f
		os=hiuxwe2
58eeb75
		;;
58eeb75
	hp3k9[0-9][0-9] | hp9[0-9][0-9])
21b7b3f
		cpu=hppa1.0
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k2[0-9][0-9] | hp9k31[0-9])
21b7b3f
		cpu=m68000
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k3[2-9][0-9])
21b7b3f
		cpu=m68k
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k6[0-9][0-9] | hp6[0-9][0-9])
21b7b3f
		cpu=hppa1.0
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k7[0-79][0-9] | hp7[0-79][0-9])
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k78[0-9] | hp78[0-9])
58eeb75
		# FIXME: really hppa2.0-hp
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
58eeb75
		# FIXME: really hppa2.0-hp
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k8[0-9][13679] | hp8[0-9][13679])
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	hp9k8[0-9][0-9] | hp8[0-9][0-9])
21b7b3f
		cpu=hppa1.0
21b7b3f
		vendor=hp
58eeb75
		;;
58eeb75
	i*86v32)
21b7b3f
		cpu=`echo "$1" | sed -e 's/86.*/86/'`
21b7b3f
		vendor=pc
21b7b3f
		os=sysv32
58eeb75
		;;
58eeb75
	i*86v4*)
21b7b3f
		cpu=`echo "$1" | sed -e 's/86.*/86/'`
21b7b3f
		vendor=pc
21b7b3f
		os=sysv4
58eeb75
		;;
58eeb75
	i*86v)
21b7b3f
		cpu=`echo "$1" | sed -e 's/86.*/86/'`
21b7b3f
		vendor=pc
21b7b3f
		os=sysv
58eeb75
		;;
58eeb75
	i*86sol2)
21b7b3f
		cpu=`echo "$1" | sed -e 's/86.*/86/'`
21b7b3f
		vendor=pc
21b7b3f
		os=solaris2
58eeb75
		;;
21b7b3f
	j90 | j90-cray)
21b7b3f
		cpu=j90
21b7b3f
		vendor=cray
21b7b3f
		os=${os:-unicos}
58eeb75
		;;
58eeb75
	iris | iris4d)
21b7b3f
		cpu=mips
21b7b3f
		vendor=sgi
58eeb75
		case $os in
21b7b3f
		    irix*)
58eeb75
			;;
58eeb75
		    *)
21b7b3f
			os=irix4
58eeb75
			;;
58eeb75
		esac
58eeb75
		;;
58eeb75
	miniframe)
21b7b3f
		cpu=m68000
21b7b3f
		vendor=convergent
58eeb75
		;;
21b7b3f
	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=atari
21b7b3f
		os=mint
58eeb75
		;;
58eeb75
	news-3600 | risc-news)
21b7b3f
		cpu=mips
21b7b3f
		vendor=sony
21b7b3f
		os=newsos
58eeb75
		;;
200424a
	next | m*-next)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=next
58eeb75
		case $os in
21b7b3f
		    nextstep* )
58eeb75
			;;
21b7b3f
		    ns2*)
21b7b3f
		      os=nextstep2
58eeb75
			;;
58eeb75
		    *)
21b7b3f
		      os=nextstep3
58eeb75
			;;
58eeb75
		esac
58eeb75
		;;
58eeb75
	np1)
21b7b3f
		cpu=np1
21b7b3f
		vendor=gould
226b183
		;;
58eeb75
	op50n-* | op60c-*)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=oki
21b7b3f
		os=proelf
58eeb75
		;;
58eeb75
	pa-hitachi)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=hitachi
21b7b3f
		os=hiuxwe2
58eeb75
		;;
58eeb75
	pbd)
21b7b3f
		cpu=sparc
21b7b3f
		vendor=tti
58eeb75
		;;
58eeb75
	pbb)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=tti
58eeb75
		;;
21b7b3f
	pc532)
21b7b3f
		cpu=ns32k
21b7b3f
		vendor=pc532
58eeb75
		;;
58eeb75
	pn)
21b7b3f
		cpu=pn
21b7b3f
		vendor=gould
58eeb75
		;;
21b7b3f
	power)
21b7b3f
		cpu=power
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	ps2)
21b7b3f
		cpu=i386
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	rm[46]00)
21b7b3f
		cpu=mips
21b7b3f
		vendor=siemens
58eeb75
		;;
21b7b3f
	rtpc | rtpc-*)
21b7b3f
		cpu=romp
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	sde)
21b7b3f
		cpu=mipsisa32
21b7b3f
		vendor=sde
21b7b3f
		os=${os:-elf}
58eeb75
		;;
21b7b3f
	simso-wrs)
21b7b3f
		cpu=sparclite
21b7b3f
		vendor=wrs
21b7b3f
		os=vxworks
58eeb75
		;;
21b7b3f
	tower | tower-32)
21b7b3f
		cpu=m68k
21b7b3f
		vendor=ncr
58eeb75
		;;
21b7b3f
	vpp*|vx|vx-*)
21b7b3f
		cpu=f301
21b7b3f
		vendor=fujitsu
58eeb75
		;;
21b7b3f
	w65)
21b7b3f
		cpu=w65
21b7b3f
		vendor=wdc
58eeb75
		;;
21b7b3f
	w89k-*)
21b7b3f
		cpu=hppa1.1
21b7b3f
		vendor=winbond
21b7b3f
		os=proelf
58eeb75
		;;
21b7b3f
	none)
21b7b3f
		cpu=none
21b7b3f
		vendor=none
58eeb75
		;;
21b7b3f
	leon|leon[3-9])
21b7b3f
		cpu=sparc
21b7b3f
		vendor=$basic_machine
58eeb75
		;;
21b7b3f
	leon-*|leon[3-9]-*)
21b7b3f
		cpu=sparc
21b7b3f
		vendor=`echo "$basic_machine" | sed 's/-.*//'`
58eeb75
		;;
21b7b3f
21b7b3f
	*-*)
21b7b3f
		IFS="-" read -r cpu vendor <
21b7b3f
$basic_machine
21b7b3f
EOF
58eeb75
		;;
21b7b3f
	# We use `pc' rather than `unknown'
21b7b3f
	# because (1) that's what they normally are, and
21b7b3f
	# (2) the word "unknown" tends to confuse beginning users.
21b7b3f
	i*86 | x86_64)
21b7b3f
		cpu=$basic_machine
21b7b3f
		vendor=pc
58eeb75
		;;
21b7b3f
	# These rules are duplicated from below for sake of the special case above;
21b7b3f
	# i.e. things that normalized to x86 arches should also default to "pc"
21b7b3f
	pc98)
21b7b3f
		cpu=i386
21b7b3f
		vendor=pc
58eeb75
		;;
21b7b3f
	x64 | amd64)
21b7b3f
		cpu=x86_64
21b7b3f
		vendor=pc
58eeb75
		;;
21b7b3f
	# Recognize the basic CPU types without company name.
21b7b3f
	*)
21b7b3f
		cpu=$basic_machine
21b7b3f
		vendor=unknown
58eeb75
		;;
21b7b3f
esac
21b7b3f
21b7b3f
unset -v basic_machine
21b7b3f
21b7b3f
# Decode basic machines in the full and proper CPU-Company form.
21b7b3f
case $cpu-$vendor in
21b7b3f
	# Here we handle the default manufacturer of certain CPU types in cannonical form. It is in
21b7b3f
	# some cases the only manufacturer, in others, it is the most popular.
21b7b3f
	craynv-unknown)
21b7b3f
		vendor=cray
21b7b3f
		os=${os:-unicosmp}
58eeb75
		;;
21b7b3f
	c90-unknown | c90-cray)
21b7b3f
		vendor=cray
21b7b3f
		os=${os:-unicos}
58eeb75
		;;
21b7b3f
	fx80-unknown)
21b7b3f
		vendor=alliant
58eeb75
		;;
21b7b3f
	romp-unknown)
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	mmix-unknown)
21b7b3f
		vendor=knuth
58eeb75
		;;
21b7b3f
	microblaze-unknown | microblazeel-unknown)
21b7b3f
		vendor=xilinx
58eeb75
		;;
21b7b3f
	rs6000-unknown)
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	vax-unknown)
21b7b3f
		vendor=dec
58eeb75
		;;
21b7b3f
	pdp11-unknown)
21b7b3f
		vendor=dec
58eeb75
		;;
21b7b3f
	we32k-unknown)
21b7b3f
		vendor=att
58eeb75
		;;
21b7b3f
	cydra-unknown)
21b7b3f
		vendor=cydrome
58eeb75
		;;
21b7b3f
	i370-ibm*)
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	orion-unknown)
21b7b3f
		vendor=highlevel
58eeb75
		;;
21b7b3f
	xps-unknown | xps100-unknown)
21b7b3f
		cpu=xps100
21b7b3f
		vendor=honeywell
58eeb75
		;;
21b7b3f
21b7b3f
	# Here we normalize CPU types with a missing or matching vendor
21b7b3f
	dpx20-unknown | dpx20-bull)
21b7b3f
		cpu=rs6000
21b7b3f
		vendor=bull
21b7b3f
		os=${os:-bosx}
58eeb75
		;;
21b7b3f
21b7b3f
	# Here we normalize CPU types irrespective of the vendor
21b7b3f
	amd64-*)
21b7b3f
		cpu=x86_64
58eeb75
		;;
21b7b3f
	blackfin-*)
21b7b3f
		cpu=bfin
21b7b3f
		os=linux
58eeb75
		;;
21b7b3f
	c54x-*)
21b7b3f
		cpu=tic54x
58eeb75
		;;
21b7b3f
	c55x-*)
21b7b3f
		cpu=tic55x
58eeb75
		;;
21b7b3f
	c6x-*)
21b7b3f
		cpu=tic6x
58eeb75
		;;
21b7b3f
	e500v[12]-*)
21b7b3f
		cpu=powerpc
21b7b3f
		os=$os"spe"
58eeb75
		;;
21b7b3f
	mips3*-*)
21b7b3f
		cpu=mips64
58eeb75
		;;
21b7b3f
	ms1-*)
21b7b3f
		cpu=mt
58eeb75
		;;
21b7b3f
	m68knommu-*)
21b7b3f
		cpu=m68k
21b7b3f
		os=linux
58eeb75
		;;
21b7b3f
	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
21b7b3f
		cpu=s12z
58eeb75
		;;
21b7b3f
	openrisc-*)
21b7b3f
		cpu=or32
58eeb75
		;;
21b7b3f
	parisc-*)
21b7b3f
		cpu=hppa
21b7b3f
		os=linux
58eeb75
		;;
21b7b3f
	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
21b7b3f
		cpu=i586
58eeb75
		;;
21b7b3f
	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
21b7b3f
		cpu=i686
58eeb75
		;;
21b7b3f
	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
21b7b3f
		cpu=i686
58eeb75
		;;
21b7b3f
	pentium4-*)
21b7b3f
		cpu=i786
58eeb75
		;;
21b7b3f
	pc98-*)
21b7b3f
		cpu=i386
58eeb75
		;;
21b7b3f
	ppc-* | ppcbe-*)
21b7b3f
		cpu=powerpc
58eeb75
		;;
21b7b3f
	ppcle-* | powerpclittle-*)
21b7b3f
		cpu=powerpcle
58eeb75
		;;
21b7b3f
	ppc64-*)
21b7b3f
		cpu=powerpc64
58eeb75
		;;
21b7b3f
	ppc64le-* | powerpc64little-*)
21b7b3f
		cpu=powerpc64le
58eeb75
		;;
21b7b3f
	sb1-*)
21b7b3f
		cpu=mipsisa64sb1
58eeb75
		;;
21b7b3f
	sb1el-*)
21b7b3f
		cpu=mipsisa64sb1el
58eeb75
		;;
21b7b3f
	sh5e[lb]-*)
21b7b3f
		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
58eeb75
		;;
21b7b3f
	spur-*)
21b7b3f
		cpu=spur
58eeb75
		;;
21b7b3f
	strongarm-* | thumb-*)
21b7b3f
		cpu=arm
58eeb75
		;;
21b7b3f
	tx39-*)
21b7b3f
		cpu=mipstx39
200424a
		;;
21b7b3f
	tx39el-*)
21b7b3f
		cpu=mipstx39el
58eeb75
		;;
21b7b3f
	x64-*)
21b7b3f
		cpu=x86_64
58eeb75
		;;
58eeb75
	xscale-* | xscalee[bl]-*)
21b7b3f
		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
58eeb75
		;;
58eeb75
21b7b3f
	# Recognize the cannonical CPU Types that limit and/or modify the
21b7b3f
	# company names they are paired with.
21b7b3f
	cr16-*)
21b7b3f
		os=${os:-elf}
58eeb75
		;;
21b7b3f
	crisv32-* | etraxfs*-*)
21b7b3f
		cpu=crisv32
21b7b3f
		vendor=axis
58eeb75
		;;
21b7b3f
	cris-* | etrax*-*)
21b7b3f
		cpu=cris
21b7b3f
		vendor=axis
58eeb75
		;;
21b7b3f
	crx-*)
21b7b3f
		os=${os:-elf}
58eeb75
		;;
21b7b3f
	neo-tandem)
21b7b3f
		cpu=neo
21b7b3f
		vendor=tandem
58eeb75
		;;
21b7b3f
	nse-tandem)
21b7b3f
		cpu=nse
21b7b3f
		vendor=tandem
58eeb75
		;;
21b7b3f
	nsr-tandem)
21b7b3f
		cpu=nsr
21b7b3f
		vendor=tandem
58eeb75
		;;
21b7b3f
	nsv-tandem)
21b7b3f
		cpu=nsv
21b7b3f
		vendor=tandem
58eeb75
		;;
21b7b3f
	nsx-tandem)
21b7b3f
		cpu=nsx
21b7b3f
		vendor=tandem
58eeb75
		;;
21b7b3f
	s390-*)
21b7b3f
		cpu=s390
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	s390x-*)
21b7b3f
		cpu=s390x
21b7b3f
		vendor=ibm
58eeb75
		;;
21b7b3f
	tile*-*)
21b7b3f
		os=${os:-linux-gnu}
58eeb75
		;;
21b7b3f
58eeb75
	*)
21b7b3f
		# Recognize the cannonical CPU types that are allowed with any
21b7b3f
		# company name.
21b7b3f
		case $cpu in
21b7b3f
			1750a | 580 \
21b7b3f
			| a29k \
21b7b3f
			| aarch64 | aarch64_be \
21b7b3f
			| abacus \
21b7b3f
			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
21b7b3f
			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
21b7b3f
			| alphapca5[67] | alpha64pca5[67] \
21b7b3f
			| am33_2.0 \
21b7b3f
			| arc | arceb \
21b7b3f
			| arm  | arm[lb]e | arme[lb] | armv* \
21b7b3f
			| avr | avr32 \
21b7b3f
			| asmjs \
21b7b3f
			| ba \
21b7b3f
			| be32 | be64 \
21b7b3f
			| bfin | bs2000 \
21b7b3f
			| c[123]* | c30 | [cjt]90 | c4x \
21b7b3f
			| c8051 | clipper | craynv | csky | cydra \
21b7b3f
			| d10v | d30v | dlx | dsp16xx \
21b7b3f
			| e2k | elxsi | epiphany \
21b7b3f
			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
21b7b3f
			| h8300 | h8500 \
21b7b3f
			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
21b7b3f
			| hexagon \
21b7b3f
			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
21b7b3f
			| ip2k | iq2000 \
21b7b3f
			| k1om \
21b7b3f
			| le32 | le64 \
21b7b3f
			| lm32 \
21b7b3f
			| m32c | m32r | m32rle \
21b7b3f
			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k | v70 | w65 \
21b7b3f
			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \
21b7b3f
			| m88110 | m88k | maxq | mb | mcore | mep | metag \
21b7b3f
			| microblaze | microblazeel \
21b7b3f
			| mips | mipsbe | mipseb | mipsel | mipsle \
21b7b3f
			| mips16 \
21b7b3f
			| mips64 | mips64el \
21b7b3f
			| mips64octeon | mips64octeonel \
21b7b3f
			| mips64orion | mips64orionel \
21b7b3f
			| mips64r5900 | mips64r5900el \
21b7b3f
			| mips64vr | mips64vrel \
21b7b3f
			| mips64vr4100 | mips64vr4100el \
21b7b3f
			| mips64vr4300 | mips64vr4300el \
21b7b3f
			| mips64vr5000 | mips64vr5000el \
21b7b3f
			| mips64vr5900 | mips64vr5900el \
21b7b3f
			| mipsisa32 | mipsisa32el \
21b7b3f
			| mipsisa32r2 | mipsisa32r2el \
21b7b3f
			| mipsisa32r6 | mipsisa32r6el \
21b7b3f
			| mipsisa64 | mipsisa64el \
21b7b3f
			| mipsisa64r2 | mipsisa64r2el \
21b7b3f
			| mipsisa64r6 | mipsisa64r6el \
21b7b3f
			| mipsisa64sb1 | mipsisa64sb1el \
21b7b3f
			| mipsisa64sr71k | mipsisa64sr71kel \
21b7b3f
			| mipsr5900 | mipsr5900el \
21b7b3f
			| mipstx39 | mipstx39el \
21b7b3f
			| mmix \
21b7b3f
			| mn10200 | mn10300 \
21b7b3f
			| moxie \
21b7b3f
			| mt \
21b7b3f
			| msp430 \
21b7b3f
			| nds32 | nds32le | nds32be \
21b7b3f
			| nfp \
21b7b3f
			| nios | nios2 | nios2eb | nios2el \
21b7b3f
			| none | np1 | ns16k | ns32k \
21b7b3f
			| open8 \
21b7b3f
			| or1k* \
21b7b3f
			| or32 \
21b7b3f
			| orion \
21b7b3f
			| pdp10 | pdp11 | pj | pjl | pn | power \
21b7b3f
			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
21b7b3f
			| pru \
21b7b3f
			| pyramid \
21b7b3f
			| riscv | riscv32 | riscv64 \
21b7b3f
			| rl78 | romp | rs6000 | rx \
21b7b3f
			| score \
21b7b3f
			| sh | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
21b7b3f
			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
21b7b3f
			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
21b7b3f
			| sparclite \
21b7b3f
			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
21b7b3f
			| spu \
21b7b3f
			| tahoe \
21b7b3f
			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
21b7b3f
			| tron \
21b7b3f
			| ubicom32 \
21b7b3f
			| v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
21b7b3f
			| vax \
21b7b3f
			| visium \
21b7b3f
			| wasm32 \
21b7b3f
			| we32k \
21b7b3f
			| x86 | x86_64 | xc16x | xgate | xps100 \
21b7b3f
			| xstormy16 | xtensa* \
21b7b3f
			| ymp \
21b7b3f
			| z8k | z80)
21b7b3f
				;;
21b7b3f
21b7b3f
			*)
21b7b3f
				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
21b7b3f
				exit 1
21b7b3f
				;;
21b7b3f
		esac
58eeb75
		;;
58eeb75
esac
58eeb75
58eeb75
# Here we canonicalize certain aliases for manufacturers.
21b7b3f
case $vendor in
21b7b3f
	digital*)
21b7b3f
		vendor=dec
58eeb75
		;;
21b7b3f
	commodore*)
21b7b3f
		vendor=cbm
58eeb75
		;;
58eeb75
	*)
58eeb75
		;;
58eeb75
esac
58eeb75
58eeb75
# Decode manufacturer-specific aliases for certain operating systems.
58eeb75
200424a
if [ x$os != x ]
58eeb75
then
58eeb75
case $os in
200424a
	# First match some system type aliases that might get confused
200424a
	# with valid system types.
21b7b3f
	# solaris* is a basic system type, with this one exception.
21b7b3f
	auroraux)
21b7b3f
		os=auroraux
58eeb75
		;;
21b7b3f
	bluegene*)
21b7b3f
		os=cnk
21b7b3f
		;;
21b7b3f
	solaris1 | solaris1.*)
58eeb75
		os=`echo $os | sed -e 's|solaris1|sunos4|'`
58eeb75
		;;
21b7b3f
	solaris)
21b7b3f
		os=solaris2
58eeb75
		;;
21b7b3f
	unixware*)
21b7b3f
		os=sysv4.2uw
58eeb75
		;;
21b7b3f
	gnu/linux*)
58eeb75
		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
58eeb75
		;;
200424a
	# es1800 is here to avoid being matched by es* (a different OS)
21b7b3f
	es1800*)
21b7b3f
		os=ose
21b7b3f
		;;
21b7b3f
	# Some version numbers need modification
21b7b3f
	chorusos*)
21b7b3f
		os=chorusos
21b7b3f
		;;
21b7b3f
	isc)
21b7b3f
		os=isc2.2
21b7b3f
		;;
21b7b3f
	sco6)
21b7b3f
		os=sco5v6
21b7b3f
		;;
21b7b3f
	sco5)
21b7b3f
		os=sco3.2v5
21b7b3f
		;;
21b7b3f
	sco4)
21b7b3f
		os=sco3.2v4
21b7b3f
		;;
21b7b3f
	sco3.2.[4-9]*)
21b7b3f
		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
21b7b3f
		;;
21b7b3f
	sco3.2v[4-9]* | sco5v6*)
21b7b3f
		# Don't forget version if it is 3.2v4 or newer.
21b7b3f
		;;
21b7b3f
	scout)
21b7b3f
		# Don't match below
21b7b3f
		;;
21b7b3f
	sco*)
21b7b3f
		os=sco3.2v2
21b7b3f
		;;
21b7b3f
	psos*)
21b7b3f
		os=psos
200424a
		;;
200424a
	# Now accept the basic system types.
58eeb75
	# The portable systems comes first.
200424a
	# Each alternative MUST end in a * to match a version number.
21b7b3f
	# sysv* is not here because it comes later, after sysvr4.
21b7b3f
	gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
21b7b3f
	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
21b7b3f
	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
21b7b3f
	     | sym* | kopensolaris* | plan9* \
21b7b3f
	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
21b7b3f
	     | aos* | aros* | cloudabi* | sortix* \
21b7b3f
	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
21b7b3f
	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
21b7b3f
	     | knetbsd* | mirbsd* | netbsd* \
21b7b3f
	     | bitrig* | openbsd* | solidbsd* | libertybsd* \
21b7b3f
	     | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
21b7b3f
	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
21b7b3f
	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
21b7b3f
	     | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
21b7b3f
	     | chorusrdb* | cegcc* | glidix* \
21b7b3f
	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
21b7b3f
	     | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
21b7b3f
	     | linux-newlib* | linux-musl* | linux-uclibc* \
21b7b3f
	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
21b7b3f
	     | interix* | uwin* | mks* | rhapsody* | darwin* \
21b7b3f
	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
21b7b3f
	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
21b7b3f
	     | os2* | vos* | palmos* | uclinux* | nucleus* \
21b7b3f
	     | morphos* | superux* | rtmk* | windiss* \
21b7b3f
	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
21b7b3f
	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
21b7b3f
	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
21b7b3f
	     | midnightbsd*)
58eeb75
	# Remember, each alternative MUST END IN *, to match a version number.
58eeb75
		;;
21b7b3f
	qnx*)
21b7b3f
		case $cpu in
21b7b3f
		    x86 | i*86)
58eeb75
			;;
58eeb75
		    *)
21b7b3f
			os=nto-$os
58eeb75
			;;
58eeb75
		esac
58eeb75
		;;
21b7b3f
	hiux*)
21b7b3f
		os=hiuxwe2
58eeb75
		;;
21b7b3f
	nto-qnx*)
21b7b3f
		;;
21b7b3f
	nto*)
58eeb75
		os=`echo $os | sed -e 's|nto|nto-qnx|'`
58eeb75
		;;
21b7b3f
	sim | xray | os68k* | v88r* \
21b7b3f
	    | windows* | osx | abug | netware* | os9* \
21b7b3f
	    | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
21b7b3f
		;;
21b7b3f
	linux-dietlibc)
21b7b3f
		os=linux-dietlibc
21b7b3f
		;;
21b7b3f
	linux*)
21b7b3f
		os=`echo $os | sed -e 's|linux|linux-gnu|'`
21b7b3f
		;;
21b7b3f
	lynx*178)
21b7b3f
		os=lynxos178
21b7b3f
		;;
21b7b3f
	lynx*5)
21b7b3f
		os=lynxos5
21b7b3f
		;;
21b7b3f
	lynx*)
21b7b3f
		os=lynxos
58eeb75
		;;
21b7b3f
	mac*)
200424a
		os=`echo "$os" | sed -e 's|mac|macos|'`
58eeb75
		;;
21b7b3f
	opened*)
21b7b3f
		os=openedition
58eeb75
		;;
21b7b3f
	os400*)
21b7b3f
		os=os400
58eeb75
		;;
21b7b3f
	sunos5*)
200424a
		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
58eeb75
		;;
21b7b3f
	sunos6*)
200424a
		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
58eeb75
		;;
21b7b3f
	wince*)
21b7b3f
		os=wince
58eeb75
		;;
21b7b3f
	utek*)
21b7b3f
		os=bsd
58eeb75
		;;
21b7b3f
	dynix*)
21b7b3f
		os=bsd
58eeb75
		;;
21b7b3f
	acis*)
21b7b3f
		os=aos
58eeb75
		;;
21b7b3f
	atheos*)
21b7b3f
		os=atheos
58eeb75
		;;
21b7b3f
	syllable*)
21b7b3f
		os=syllable
58eeb75
		;;
21b7b3f
	386bsd)
21b7b3f
		os=bsd
58eeb75
		;;
21b7b3f
	ctix* | uts*)
21b7b3f
		os=sysv
58eeb75
		;;
21b7b3f
	nova*)
21b7b3f
		os=rtmk-nova
58eeb75
		;;
21b7b3f
	ns2)
21b7b3f
		os=nextstep2
58eeb75
		;;
21b7b3f
	nsk*)
21b7b3f
		os=nsk
58eeb75
		;;
58eeb75
	# Preserve the version number of sinix5.
21b7b3f
	sinix5.*)
58eeb75
		os=`echo $os | sed -e 's|sinix|sysv|'`
58eeb75
		;;
21b7b3f
	sinix*)
21b7b3f
		os=sysv4
58eeb75
		;;
21b7b3f
	tpf*)
21b7b3f
		os=tpf
58eeb75
		;;
21b7b3f
	triton*)
21b7b3f
		os=sysv3
58eeb75
		;;
21b7b3f
	oss*)
21b7b3f
		os=sysv3
58eeb75
		;;
21b7b3f
	svr4*)
21b7b3f
		os=sysv4
58eeb75
		;;
21b7b3f
	svr3)
21b7b3f
		os=sysv3
58eeb75
		;;
21b7b3f
	sysvr4)
21b7b3f
		os=sysv4
58eeb75
		;;
21b7b3f
	# This must come after sysvr4.
21b7b3f
	sysv*)
58eeb75
		;;
21b7b3f
	ose*)
21b7b3f
		os=ose
58eeb75
		;;
21b7b3f
	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
21b7b3f
		os=mint
58eeb75
		;;
21b7b3f
	zvmoe)
21b7b3f
		os=zvmoe
58eeb75
		;;
21b7b3f
	dicos*)
21b7b3f
		os=dicos
58eeb75
		;;
21b7b3f
	pikeos*)
200424a
		# Until real need of OS specific support for
200424a
		# particular features comes up, bare metal
200424a
		# configurations are quite functional.
21b7b3f
		case $cpu in
200424a
		    arm*)
21b7b3f
			os=eabi
200424a
			;;
200424a
		    *)
21b7b3f
			os=elf
200424a
			;;
200424a
		esac
200424a
		;;
21b7b3f
	nacl*)
58eeb75
		;;
21b7b3f
	ios)
fb31339
		;;
21b7b3f
	none)
58eeb75
		;;
21b7b3f
	*-eabi)
200424a
		;;
58eeb75
	*)
200424a
		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
58eeb75
		exit 1
58eeb75
		;;
58eeb75
esac
58eeb75
else
58eeb75
58eeb75
# Here we handle the default operating systems that come with various machines.
58eeb75
# The value should be what the vendor currently ships out the door with their
58eeb75
# machine or put another way, the most popular os provided with the machine.
58eeb75
58eeb75
# Note that if you're going to try to match "-MANUFACTURER" here (say,
58eeb75
# "-sun"), then you have to tell the case statement up towards the top
58eeb75
# that MANUFACTURER isn't an operating system.  Otherwise, code above
58eeb75
# will signal an error saying that MANUFACTURER isn't an operating
58eeb75
# system, and we'll never get to this point.
58eeb75
21b7b3f
case $cpu-$vendor in
58eeb75
	score-*)
21b7b3f
		os=elf
58eeb75
		;;
58eeb75
	spu-*)
21b7b3f
		os=elf
58eeb75
		;;
58eeb75
	*-acorn)
21b7b3f
		os=riscix1.2
58eeb75
		;;
58eeb75
	arm*-rebel)
21b7b3f
		os=linux
58eeb75
		;;
58eeb75
	arm*-semi)
21b7b3f
		os=aout
58eeb75
		;;
58eeb75
	c4x-* | tic4x-*)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	c8051-*)
21b7b3f
		os=elf
21b7b3f
		;;
21b7b3f
	clipper-intergraph)
21b7b3f
		os=clix
58eeb75
		;;
58eeb75
	hexagon-*)
21b7b3f
		os=elf
58eeb75
		;;
58eeb75
	tic54x-*)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	tic55x-*)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	tic6x-*)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	# This must come before the *-dec entry.
58eeb75
	pdp10-*)
21b7b3f
		os=tops20
58eeb75
		;;
58eeb75
	pdp11-*)
21b7b3f
		os=none
58eeb75
		;;
58eeb75
	*-dec | vax-*)
21b7b3f
		os=ultrix4.2
58eeb75
		;;
58eeb75
	m68*-apollo)
21b7b3f
		os=domain
58eeb75
		;;
58eeb75
	i386-sun)
21b7b3f
		os=sunos4.0.2
58eeb75
		;;
58eeb75
	m68000-sun)
21b7b3f
		os=sunos3
58eeb75
		;;
58eeb75
	m68*-cisco)
21b7b3f
		os=aout
58eeb75
		;;
58eeb75
	mep-*)
21b7b3f
		os=elf
58eeb75
		;;
58eeb75
	mips*-cisco)
21b7b3f
		os=elf
58eeb75
		;;
58eeb75
	mips*-*)
21b7b3f
		os=elf
58eeb75
		;;
58eeb75
	or32-*)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	*-tti)	# must be before sparc entry or we get the wrong os.
21b7b3f
		os=sysv3
58eeb75
		;;
58eeb75
	sparc-* | *-sun)
21b7b3f
		os=sunos4.1.1
58eeb75
		;;
226b183
	pru-*)
21b7b3f
		os=elf
226b183
		;;
58eeb75
	*-be)
21b7b3f
		os=beos
58eeb75
		;;
58eeb75
	*-ibm)
21b7b3f
		os=aix
58eeb75
		;;
58eeb75
	*-knuth)
21b7b3f
		os=mmixware
58eeb75
		;;
58eeb75
	*-wec)
21b7b3f
		os=proelf
58eeb75
		;;
58eeb75
	*-winbond)
21b7b3f
		os=proelf
58eeb75
		;;
58eeb75
	*-oki)
21b7b3f
		os=proelf
58eeb75
		;;
58eeb75
	*-hp)
21b7b3f
		os=hpux
58eeb75
		;;
58eeb75
	*-hitachi)
21b7b3f
		os=hiux
58eeb75
		;;
58eeb75
	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
21b7b3f
		os=sysv
58eeb75
		;;
58eeb75
	*-cbm)
21b7b3f
		os=amigaos
58eeb75
		;;
58eeb75
	*-dg)
21b7b3f
		os=dgux
58eeb75
		;;
58eeb75
	*-dolphin)
21b7b3f
		os=sysv3
58eeb75
		;;
58eeb75
	m68k-ccur)
21b7b3f
		os=rtu
58eeb75
		;;
58eeb75
	m88k-omron*)
21b7b3f
		os=luna
58eeb75
		;;
200424a
	*-next)
21b7b3f
		os=nextstep
58eeb75
		;;
58eeb75
	*-sequent)
21b7b3f
		os=ptx
58eeb75
		;;
58eeb75
	*-crds)
21b7b3f
		os=unos
58eeb75
		;;
58eeb75
	*-ns)
21b7b3f
		os=genix
58eeb75
		;;
58eeb75
	i370-*)
21b7b3f
		os=mvs
58eeb75
		;;
58eeb75
	*-gould)
21b7b3f
		os=sysv
58eeb75
		;;
58eeb75
	*-highlevel)
21b7b3f
		os=bsd
58eeb75
		;;
58eeb75
	*-encore)
21b7b3f
		os=bsd
58eeb75
		;;
58eeb75
	*-sgi)
21b7b3f
		os=irix
58eeb75
		;;
58eeb75
	*-siemens)
21b7b3f
		os=sysv4
58eeb75
		;;
58eeb75
	*-masscomp)
21b7b3f
		os=rtu
58eeb75
		;;
58eeb75
	f30[01]-fujitsu | f700-fujitsu)
21b7b3f
		os=uxpv
58eeb75
		;;
58eeb75
	*-rom68k)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	*-*bug)
21b7b3f
		os=coff
58eeb75
		;;
58eeb75
	*-apple)
21b7b3f
		os=macos
58eeb75
		;;
58eeb75
	*-atari*)
21b7b3f
		os=mint
21b7b3f
		;;
21b7b3f
	*-wrs)
21b7b3f
		os=vxworks
58eeb75
		;;
58eeb75
	*)
21b7b3f
		os=none
58eeb75
		;;
58eeb75
esac
58eeb75
fi
58eeb75
58eeb75
# Here we handle the case where we know the os, and the CPU type, but not the
58eeb75
# manufacturer.  We pick the logical manufacturer.
21b7b3f
case $vendor in
21b7b3f
	unknown)
58eeb75
		case $os in
21b7b3f
			riscix*)
58eeb75
				vendor=acorn
58eeb75
				;;
21b7b3f
			sunos*)
58eeb75
				vendor=sun
58eeb75
				;;
21b7b3f
			cnk*|-aix*)
58eeb75
				vendor=ibm
58eeb75
				;;
21b7b3f
			beos*)
58eeb75
				vendor=be
58eeb75
				;;
21b7b3f
			hpux*)
58eeb75
				vendor=hp
58eeb75
				;;
21b7b3f
			mpeix*)
58eeb75
				vendor=hp
58eeb75
				;;
21b7b3f
			hiux*)
58eeb75
				vendor=hitachi
58eeb75
				;;
21b7b3f
			unos*)
58eeb75
				vendor=crds
58eeb75
				;;
21b7b3f
			dgux*)
58eeb75
				vendor=dg
58eeb75
				;;
21b7b3f
			luna*)
58eeb75
				vendor=omron
58eeb75
				;;
21b7b3f
			genix*)
58eeb75
				vendor=ns
58eeb75
				;;
21b7b3f
			clix*)
21b7b3f
				vendor=intergraph
21b7b3f
				;;
21b7b3f
			mvs* | opened*)
58eeb75
				vendor=ibm
58eeb75
				;;
21b7b3f
			os400*)
58eeb75
				vendor=ibm
58eeb75
				;;
21b7b3f
			ptx*)
58eeb75
				vendor=sequent
58eeb75
				;;
21b7b3f
			tpf*)
58eeb75
				vendor=ibm
58eeb75
				;;
21b7b3f
			vxsim* | vxworks* | windiss*)
58eeb75
				vendor=wrs
58eeb75
				;;
21b7b3f
			aux*)
58eeb75
				vendor=apple
58eeb75
				;;
21b7b3f
			hms*)
58eeb75
				vendor=hitachi
58eeb75
				;;
21b7b3f
			mpw* | macos*)
58eeb75
				vendor=apple
58eeb75
				;;
21b7b3f
			*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
58eeb75
				vendor=atari
58eeb75
				;;
21b7b3f
			vos*)
58eeb75
				vendor=stratus
58eeb75
				;;
58eeb75
		esac
58eeb75
		;;
58eeb75
esac
58eeb75
21b7b3f
echo "$cpu-$vendor-$os"
58eeb75
exit
58eeb75
58eeb75
# Local variables:
200424a
# eval: (add-hook 'before-save-hook 'time-stamp)
58eeb75
# time-stamp-start: "timestamp='"
58eeb75
# time-stamp-format: "%:y-%02m-%02d"
58eeb75
# time-stamp-end: "'"
58eeb75
# End: