1bbe1b32bSmrg#! /bin/sh 2bbe1b32bSmrg# Configuration validation subroutine script. 3e1db7cd1Smrg# Copyright 1992-2024 Free Software Foundation, Inc. 4bbe1b32bSmrg 576028eb6Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale 676028eb6Smrg 7e1db7cd1Smrgtimestamp='2024-01-01' 8bbe1b32bSmrg 98f34cbf9Ssnj# This file is free software; you can redistribute it and/or modify it 108f34cbf9Ssnj# under the terms of the GNU General Public License as published by 11e1db7cd1Smrg# the Free Software Foundation, either version 3 of the License, or 12bbe1b32bSmrg# (at your option) any later version. 13bbe1b32bSmrg# 148f34cbf9Ssnj# This program is distributed in the hope that it will be useful, but 158f34cbf9Ssnj# WITHOUT ANY WARRANTY; without even the implied warranty of 168f34cbf9Ssnj# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178f34cbf9Ssnj# General Public License for more details. 18bbe1b32bSmrg# 19bbe1b32bSmrg# You should have received a copy of the GNU General Public License 2076028eb6Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 21bbe1b32bSmrg# 22bbe1b32bSmrg# As a special exception to the GNU General Public License, if you 23bbe1b32bSmrg# distribute this file as part of a program that contains a 24bbe1b32bSmrg# configuration script generated by Autoconf, you may include it under 258f34cbf9Ssnj# the same distribution terms that you use for the rest of that 268f34cbf9Ssnj# program. This Exception is an additional permission under section 7 278f34cbf9Ssnj# of the GNU General Public License, version 3 ("GPLv3"). 28bbe1b32bSmrg 29bbe1b32bSmrg 3040c5823bSmrg# Please send patches to <config-patches@gnu.org>. 31bbe1b32bSmrg# 32bbe1b32bSmrg# Configuration subroutine to validate and canonicalize a configuration type. 33bbe1b32bSmrg# Supply the specified configuration type as an argument. 34bbe1b32bSmrg# If it is invalid, we print an error message on stderr and exit with code 1. 35bbe1b32bSmrg# Otherwise, we print the canonical config type on stdout and succeed. 36bbe1b32bSmrg 3730f8ce46Smrg# You can get the latest version of this script from: 3876028eb6Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 3930f8ce46Smrg 40bbe1b32bSmrg# This file is supposed to be the same for all GNU packages 41bbe1b32bSmrg# and recognize all the CPU types, system types and aliases 42bbe1b32bSmrg# that are meaningful with *any* GNU software. 43bbe1b32bSmrg# Each package is responsible for reporting which valid configurations 44bbe1b32bSmrg# it does not support. The user should be able to distinguish 45bbe1b32bSmrg# a failure to support a valid configuration from a meaningless 46bbe1b32bSmrg# configuration. 47bbe1b32bSmrg 48bbe1b32bSmrg# The goal of this file is to map all the various variations of a given 49bbe1b32bSmrg# machine specification into a single specification in the form: 50bbe1b32bSmrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 51bbe1b32bSmrg# or in some cases, the newer four-part form: 52bbe1b32bSmrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 53bbe1b32bSmrg# It is wrong to echo any other type of specification. 54bbe1b32bSmrg 5576028eb6Smrg# The "shellcheck disable" line above the timestamp inhibits complaints 5676028eb6Smrg# about features and limitations of the classic Bourne shell that were 5776028eb6Smrg# superseded or lifted in POSIX. However, this script identifies a wide 5876028eb6Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 5976028eb6Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still 6076028eb6Smrg# have a pre-POSIX /bin/sh. 6176028eb6Smrg 62bbe1b32bSmrgme=`echo "$0" | sed -e 's,.*/,,'` 63bbe1b32bSmrg 64bbe1b32bSmrgusage="\ 6540c5823bSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 66bbe1b32bSmrg 67bbe1b32bSmrgCanonicalize a configuration name. 68bbe1b32bSmrg 6976028eb6SmrgOptions: 70bbe1b32bSmrg -h, --help print this help, then exit 71bbe1b32bSmrg -t, --time-stamp print date of last modification, then exit 72bbe1b32bSmrg -v, --version print version number, then exit 73bbe1b32bSmrg 74bbe1b32bSmrgReport bugs and patches to <config-patches@gnu.org>." 75bbe1b32bSmrg 76bbe1b32bSmrgversion="\ 77bbe1b32bSmrgGNU config.sub ($timestamp) 78bbe1b32bSmrg 79e1db7cd1SmrgCopyright 1992-2024 Free Software Foundation, Inc. 80bbe1b32bSmrg 81bbe1b32bSmrgThis is free software; see the source for copying conditions. There is NO 82bbe1b32bSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 83bbe1b32bSmrg 84bbe1b32bSmrghelp=" 85e1db7cd1SmrgTry '$me --help' for more information." 86bbe1b32bSmrg 87bbe1b32bSmrg# Parse command line 88bbe1b32bSmrgwhile test $# -gt 0 ; do 89bbe1b32bSmrg case $1 in 90bbe1b32bSmrg --time-stamp | --time* | -t ) 91bbe1b32bSmrg echo "$timestamp" ; exit ;; 92bbe1b32bSmrg --version | -v ) 93bbe1b32bSmrg echo "$version" ; exit ;; 94bbe1b32bSmrg --help | --h* | -h ) 95bbe1b32bSmrg echo "$usage"; exit ;; 96bbe1b32bSmrg -- ) # Stop option processing 97bbe1b32bSmrg shift; break ;; 98bbe1b32bSmrg - ) # Use stdin as input. 99bbe1b32bSmrg break ;; 100bbe1b32bSmrg -* ) 10176028eb6Smrg echo "$me: invalid option $1$help" >&2 102bbe1b32bSmrg exit 1 ;; 103bbe1b32bSmrg 104bbe1b32bSmrg *local*) 105bbe1b32bSmrg # First pass through any local machine types. 10676028eb6Smrg echo "$1" 107bbe1b32bSmrg exit ;; 108bbe1b32bSmrg 109bbe1b32bSmrg * ) 110bbe1b32bSmrg break ;; 111bbe1b32bSmrg esac 112bbe1b32bSmrgdone 113bbe1b32bSmrg 114bbe1b32bSmrgcase $# in 115bbe1b32bSmrg 0) echo "$me: missing argument$help" >&2 116bbe1b32bSmrg exit 1;; 117bbe1b32bSmrg 1) ;; 118bbe1b32bSmrg *) echo "$me: too many arguments$help" >&2 119bbe1b32bSmrg exit 1;; 120bbe1b32bSmrgesac 121bbe1b32bSmrg 12276028eb6Smrg# Split fields of configuration type 12376028eb6Smrg# shellcheck disable=SC2162 12476028eb6Smrgsaved_IFS=$IFS 12576028eb6SmrgIFS="-" read field1 field2 field3 field4 <<EOF 12676028eb6Smrg$1 12776028eb6SmrgEOF 12876028eb6SmrgIFS=$saved_IFS 129bbe1b32bSmrg 13076028eb6Smrg# Separate into logical components for further validation 13176028eb6Smrgcase $1 in 13276028eb6Smrg *-*-*-*-*) 133e1db7cd1Smrg echo "Invalid configuration '$1': more than four components" >&2 13476028eb6Smrg exit 1 135bbe1b32bSmrg ;; 13676028eb6Smrg *-*-*-*) 13776028eb6Smrg basic_machine=$field1-$field2 13876028eb6Smrg basic_os=$field3-$field4 139bbe1b32bSmrg ;; 14076028eb6Smrg *-*-*) 14176028eb6Smrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 14276028eb6Smrg # parts 14376028eb6Smrg maybe_os=$field2-$field3 14476028eb6Smrg case $maybe_os in 14576028eb6Smrg nto-qnx* | linux-* | uclinux-uclibc* \ 14676028eb6Smrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 14776028eb6Smrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148e1db7cd1Smrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ 149e1db7cd1Smrg | windows-* ) 15076028eb6Smrg basic_machine=$field1 15176028eb6Smrg basic_os=$maybe_os 15276028eb6Smrg ;; 15376028eb6Smrg android-linux) 15476028eb6Smrg basic_machine=$field1-unknown 15576028eb6Smrg basic_os=linux-android 15676028eb6Smrg ;; 15776028eb6Smrg *) 15876028eb6Smrg basic_machine=$field1-$field2 15976028eb6Smrg basic_os=$field3 16076028eb6Smrg ;; 16176028eb6Smrg esac 162bbe1b32bSmrg ;; 16376028eb6Smrg *-*) 16476028eb6Smrg # A lone config we happen to match not fitting any pattern 16576028eb6Smrg case $field1-$field2 in 16676028eb6Smrg decstation-3100) 16776028eb6Smrg basic_machine=mips-dec 16876028eb6Smrg basic_os= 16976028eb6Smrg ;; 17076028eb6Smrg *-*) 17176028eb6Smrg # Second component is usually, but not always the OS 17276028eb6Smrg case $field2 in 17376028eb6Smrg # Prevent following clause from handling this valid os 17476028eb6Smrg sun*os*) 17576028eb6Smrg basic_machine=$field1 17676028eb6Smrg basic_os=$field2 17776028eb6Smrg ;; 17876028eb6Smrg zephyr*) 17976028eb6Smrg basic_machine=$field1-unknown 18076028eb6Smrg basic_os=$field2 18176028eb6Smrg ;; 18276028eb6Smrg # Manufacturers 18376028eb6Smrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 18476028eb6Smrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 18576028eb6Smrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 18676028eb6Smrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 18776028eb6Smrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 18876028eb6Smrg | ultra | tti* | harris | dolphin | highlevel | gould \ 18976028eb6Smrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 19076028eb6Smrg | microblaze* | sim | cisco \ 19176028eb6Smrg | oki | wec | wrs | winbond) 19276028eb6Smrg basic_machine=$field1-$field2 19376028eb6Smrg basic_os= 19476028eb6Smrg ;; 19576028eb6Smrg *) 19676028eb6Smrg basic_machine=$field1 19776028eb6Smrg basic_os=$field2 19876028eb6Smrg ;; 19976028eb6Smrg esac 20076028eb6Smrg ;; 20176028eb6Smrg esac 202bbe1b32bSmrg ;; 20376028eb6Smrg *) 20476028eb6Smrg # Convert single-component short-hands not valid as part of 20576028eb6Smrg # multi-component configurations. 20676028eb6Smrg case $field1 in 20776028eb6Smrg 386bsd) 20876028eb6Smrg basic_machine=i386-pc 20976028eb6Smrg basic_os=bsd 21076028eb6Smrg ;; 21176028eb6Smrg a29khif) 21276028eb6Smrg basic_machine=a29k-amd 21376028eb6Smrg basic_os=udi 21476028eb6Smrg ;; 21576028eb6Smrg adobe68k) 21676028eb6Smrg basic_machine=m68010-adobe 21776028eb6Smrg basic_os=scout 21876028eb6Smrg ;; 21976028eb6Smrg alliant) 22076028eb6Smrg basic_machine=fx80-alliant 22176028eb6Smrg basic_os= 22276028eb6Smrg ;; 22376028eb6Smrg altos | altos3068) 22476028eb6Smrg basic_machine=m68k-altos 22576028eb6Smrg basic_os= 22676028eb6Smrg ;; 22776028eb6Smrg am29k) 22876028eb6Smrg basic_machine=a29k-none 22976028eb6Smrg basic_os=bsd 23076028eb6Smrg ;; 23176028eb6Smrg amdahl) 23276028eb6Smrg basic_machine=580-amdahl 23376028eb6Smrg basic_os=sysv 23476028eb6Smrg ;; 23576028eb6Smrg amiga) 23676028eb6Smrg basic_machine=m68k-unknown 23776028eb6Smrg basic_os= 23876028eb6Smrg ;; 23976028eb6Smrg amigaos | amigados) 24076028eb6Smrg basic_machine=m68k-unknown 24176028eb6Smrg basic_os=amigaos 24276028eb6Smrg ;; 24376028eb6Smrg amigaunix | amix) 24476028eb6Smrg basic_machine=m68k-unknown 24576028eb6Smrg basic_os=sysv4 24676028eb6Smrg ;; 24776028eb6Smrg apollo68) 24876028eb6Smrg basic_machine=m68k-apollo 24976028eb6Smrg basic_os=sysv 25076028eb6Smrg ;; 25176028eb6Smrg apollo68bsd) 25276028eb6Smrg basic_machine=m68k-apollo 25376028eb6Smrg basic_os=bsd 25476028eb6Smrg ;; 25576028eb6Smrg aros) 25676028eb6Smrg basic_machine=i386-pc 25776028eb6Smrg basic_os=aros 25876028eb6Smrg ;; 25976028eb6Smrg aux) 26076028eb6Smrg basic_machine=m68k-apple 26176028eb6Smrg basic_os=aux 26276028eb6Smrg ;; 26376028eb6Smrg balance) 26476028eb6Smrg basic_machine=ns32k-sequent 26576028eb6Smrg basic_os=dynix 26676028eb6Smrg ;; 26776028eb6Smrg blackfin) 26876028eb6Smrg basic_machine=bfin-unknown 26976028eb6Smrg basic_os=linux 27076028eb6Smrg ;; 27176028eb6Smrg cegcc) 27276028eb6Smrg basic_machine=arm-unknown 27376028eb6Smrg basic_os=cegcc 27476028eb6Smrg ;; 27576028eb6Smrg convex-c1) 27676028eb6Smrg basic_machine=c1-convex 27776028eb6Smrg basic_os=bsd 27876028eb6Smrg ;; 27976028eb6Smrg convex-c2) 28076028eb6Smrg basic_machine=c2-convex 28176028eb6Smrg basic_os=bsd 28276028eb6Smrg ;; 28376028eb6Smrg convex-c32) 28476028eb6Smrg basic_machine=c32-convex 28576028eb6Smrg basic_os=bsd 28676028eb6Smrg ;; 28776028eb6Smrg convex-c34) 28876028eb6Smrg basic_machine=c34-convex 28976028eb6Smrg basic_os=bsd 29076028eb6Smrg ;; 29176028eb6Smrg convex-c38) 29276028eb6Smrg basic_machine=c38-convex 29376028eb6Smrg basic_os=bsd 29476028eb6Smrg ;; 29576028eb6Smrg cray) 29676028eb6Smrg basic_machine=j90-cray 29776028eb6Smrg basic_os=unicos 29876028eb6Smrg ;; 29976028eb6Smrg crds | unos) 30076028eb6Smrg basic_machine=m68k-crds 30176028eb6Smrg basic_os= 30276028eb6Smrg ;; 30376028eb6Smrg da30) 30476028eb6Smrg basic_machine=m68k-da30 30576028eb6Smrg basic_os= 30676028eb6Smrg ;; 30776028eb6Smrg decstation | pmax | pmin | dec3100 | decstatn) 30876028eb6Smrg basic_machine=mips-dec 30976028eb6Smrg basic_os= 31076028eb6Smrg ;; 31176028eb6Smrg delta88) 31276028eb6Smrg basic_machine=m88k-motorola 31376028eb6Smrg basic_os=sysv3 31476028eb6Smrg ;; 31576028eb6Smrg dicos) 31676028eb6Smrg basic_machine=i686-pc 31776028eb6Smrg basic_os=dicos 31876028eb6Smrg ;; 31976028eb6Smrg djgpp) 32076028eb6Smrg basic_machine=i586-pc 32176028eb6Smrg basic_os=msdosdjgpp 32276028eb6Smrg ;; 32376028eb6Smrg ebmon29k) 32476028eb6Smrg basic_machine=a29k-amd 32576028eb6Smrg basic_os=ebmon 32676028eb6Smrg ;; 32776028eb6Smrg es1800 | OSE68k | ose68k | ose | OSE) 32876028eb6Smrg basic_machine=m68k-ericsson 32976028eb6Smrg basic_os=ose 33076028eb6Smrg ;; 33176028eb6Smrg gmicro) 33276028eb6Smrg basic_machine=tron-gmicro 33376028eb6Smrg basic_os=sysv 33476028eb6Smrg ;; 33576028eb6Smrg go32) 33676028eb6Smrg basic_machine=i386-pc 33776028eb6Smrg basic_os=go32 33876028eb6Smrg ;; 33976028eb6Smrg h8300hms) 34076028eb6Smrg basic_machine=h8300-hitachi 34176028eb6Smrg basic_os=hms 34276028eb6Smrg ;; 34376028eb6Smrg h8300xray) 34476028eb6Smrg basic_machine=h8300-hitachi 34576028eb6Smrg basic_os=xray 34676028eb6Smrg ;; 34776028eb6Smrg h8500hms) 34876028eb6Smrg basic_machine=h8500-hitachi 34976028eb6Smrg basic_os=hms 35076028eb6Smrg ;; 35176028eb6Smrg harris) 35276028eb6Smrg basic_machine=m88k-harris 35376028eb6Smrg basic_os=sysv3 35476028eb6Smrg ;; 35576028eb6Smrg hp300 | hp300hpux) 35676028eb6Smrg basic_machine=m68k-hp 35776028eb6Smrg basic_os=hpux 35876028eb6Smrg ;; 35976028eb6Smrg hp300bsd) 36076028eb6Smrg basic_machine=m68k-hp 36176028eb6Smrg basic_os=bsd 36276028eb6Smrg ;; 36376028eb6Smrg hppaosf) 36476028eb6Smrg basic_machine=hppa1.1-hp 36576028eb6Smrg basic_os=osf 36676028eb6Smrg ;; 36776028eb6Smrg hppro) 36876028eb6Smrg basic_machine=hppa1.1-hp 36976028eb6Smrg basic_os=proelf 37076028eb6Smrg ;; 37176028eb6Smrg i386mach) 37276028eb6Smrg basic_machine=i386-mach 37376028eb6Smrg basic_os=mach 37476028eb6Smrg ;; 37576028eb6Smrg isi68 | isi) 37676028eb6Smrg basic_machine=m68k-isi 37776028eb6Smrg basic_os=sysv 37876028eb6Smrg ;; 37976028eb6Smrg m68knommu) 38076028eb6Smrg basic_machine=m68k-unknown 38176028eb6Smrg basic_os=linux 38276028eb6Smrg ;; 38376028eb6Smrg magnum | m3230) 38476028eb6Smrg basic_machine=mips-mips 38576028eb6Smrg basic_os=sysv 38676028eb6Smrg ;; 38776028eb6Smrg merlin) 38876028eb6Smrg basic_machine=ns32k-utek 38976028eb6Smrg basic_os=sysv 39076028eb6Smrg ;; 39176028eb6Smrg mingw64) 39276028eb6Smrg basic_machine=x86_64-pc 39376028eb6Smrg basic_os=mingw64 39476028eb6Smrg ;; 39576028eb6Smrg mingw32) 39676028eb6Smrg basic_machine=i686-pc 39776028eb6Smrg basic_os=mingw32 39876028eb6Smrg ;; 39976028eb6Smrg mingw32ce) 40076028eb6Smrg basic_machine=arm-unknown 40176028eb6Smrg basic_os=mingw32ce 40276028eb6Smrg ;; 40376028eb6Smrg monitor) 40476028eb6Smrg basic_machine=m68k-rom68k 40576028eb6Smrg basic_os=coff 40676028eb6Smrg ;; 40776028eb6Smrg morphos) 40876028eb6Smrg basic_machine=powerpc-unknown 40976028eb6Smrg basic_os=morphos 41076028eb6Smrg ;; 41176028eb6Smrg moxiebox) 41276028eb6Smrg basic_machine=moxie-unknown 41376028eb6Smrg basic_os=moxiebox 41476028eb6Smrg ;; 41576028eb6Smrg msdos) 41676028eb6Smrg basic_machine=i386-pc 41776028eb6Smrg basic_os=msdos 41876028eb6Smrg ;; 41976028eb6Smrg msys) 42076028eb6Smrg basic_machine=i686-pc 42176028eb6Smrg basic_os=msys 42276028eb6Smrg ;; 42376028eb6Smrg mvs) 42476028eb6Smrg basic_machine=i370-ibm 42576028eb6Smrg basic_os=mvs 42676028eb6Smrg ;; 42776028eb6Smrg nacl) 42876028eb6Smrg basic_machine=le32-unknown 42976028eb6Smrg basic_os=nacl 43076028eb6Smrg ;; 43176028eb6Smrg ncr3000) 43276028eb6Smrg basic_machine=i486-ncr 43376028eb6Smrg basic_os=sysv4 43476028eb6Smrg ;; 43576028eb6Smrg netbsd386) 43676028eb6Smrg basic_machine=i386-pc 43776028eb6Smrg basic_os=netbsd 43876028eb6Smrg ;; 43976028eb6Smrg netwinder) 44076028eb6Smrg basic_machine=armv4l-rebel 44176028eb6Smrg basic_os=linux 44276028eb6Smrg ;; 44376028eb6Smrg news | news700 | news800 | news900) 44476028eb6Smrg basic_machine=m68k-sony 44576028eb6Smrg basic_os=newsos 44676028eb6Smrg ;; 44776028eb6Smrg news1000) 44876028eb6Smrg basic_machine=m68030-sony 44976028eb6Smrg basic_os=newsos 45076028eb6Smrg ;; 45176028eb6Smrg necv70) 45276028eb6Smrg basic_machine=v70-nec 45376028eb6Smrg basic_os=sysv 45476028eb6Smrg ;; 45576028eb6Smrg nh3000) 45676028eb6Smrg basic_machine=m68k-harris 45776028eb6Smrg basic_os=cxux 45876028eb6Smrg ;; 45976028eb6Smrg nh[45]000) 46076028eb6Smrg basic_machine=m88k-harris 46176028eb6Smrg basic_os=cxux 46276028eb6Smrg ;; 46376028eb6Smrg nindy960) 46476028eb6Smrg basic_machine=i960-intel 46576028eb6Smrg basic_os=nindy 46676028eb6Smrg ;; 46776028eb6Smrg mon960) 46876028eb6Smrg basic_machine=i960-intel 46976028eb6Smrg basic_os=mon960 47076028eb6Smrg ;; 47176028eb6Smrg nonstopux) 47276028eb6Smrg basic_machine=mips-compaq 47376028eb6Smrg basic_os=nonstopux 47476028eb6Smrg ;; 47576028eb6Smrg os400) 47676028eb6Smrg basic_machine=powerpc-ibm 47776028eb6Smrg basic_os=os400 47876028eb6Smrg ;; 47976028eb6Smrg OSE68000 | ose68000) 48076028eb6Smrg basic_machine=m68000-ericsson 48176028eb6Smrg basic_os=ose 48276028eb6Smrg ;; 48376028eb6Smrg os68k) 48476028eb6Smrg basic_machine=m68k-none 48576028eb6Smrg basic_os=os68k 48676028eb6Smrg ;; 48776028eb6Smrg paragon) 48876028eb6Smrg basic_machine=i860-intel 48976028eb6Smrg basic_os=osf 49076028eb6Smrg ;; 49176028eb6Smrg parisc) 49276028eb6Smrg basic_machine=hppa-unknown 49376028eb6Smrg basic_os=linux 49476028eb6Smrg ;; 49576028eb6Smrg psp) 49676028eb6Smrg basic_machine=mipsallegrexel-sony 49776028eb6Smrg basic_os=psp 49876028eb6Smrg ;; 49976028eb6Smrg pw32) 50076028eb6Smrg basic_machine=i586-unknown 50176028eb6Smrg basic_os=pw32 50276028eb6Smrg ;; 50376028eb6Smrg rdos | rdos64) 50476028eb6Smrg basic_machine=x86_64-pc 50576028eb6Smrg basic_os=rdos 50676028eb6Smrg ;; 50776028eb6Smrg rdos32) 50876028eb6Smrg basic_machine=i386-pc 50976028eb6Smrg basic_os=rdos 51076028eb6Smrg ;; 51176028eb6Smrg rom68k) 51276028eb6Smrg basic_machine=m68k-rom68k 51376028eb6Smrg basic_os=coff 51476028eb6Smrg ;; 51576028eb6Smrg sa29200) 51676028eb6Smrg basic_machine=a29k-amd 51776028eb6Smrg basic_os=udi 51876028eb6Smrg ;; 51976028eb6Smrg sei) 52076028eb6Smrg basic_machine=mips-sei 52176028eb6Smrg basic_os=seiux 52276028eb6Smrg ;; 52376028eb6Smrg sequent) 52476028eb6Smrg basic_machine=i386-sequent 52576028eb6Smrg basic_os= 52676028eb6Smrg ;; 52776028eb6Smrg sps7) 52876028eb6Smrg basic_machine=m68k-bull 52976028eb6Smrg basic_os=sysv2 53076028eb6Smrg ;; 53176028eb6Smrg st2000) 53276028eb6Smrg basic_machine=m68k-tandem 53376028eb6Smrg basic_os= 53476028eb6Smrg ;; 53576028eb6Smrg stratus) 53676028eb6Smrg basic_machine=i860-stratus 53776028eb6Smrg basic_os=sysv4 53876028eb6Smrg ;; 53976028eb6Smrg sun2) 54076028eb6Smrg basic_machine=m68000-sun 54176028eb6Smrg basic_os= 54276028eb6Smrg ;; 54376028eb6Smrg sun2os3) 54476028eb6Smrg basic_machine=m68000-sun 54576028eb6Smrg basic_os=sunos3 54676028eb6Smrg ;; 54776028eb6Smrg sun2os4) 54876028eb6Smrg basic_machine=m68000-sun 54976028eb6Smrg basic_os=sunos4 55076028eb6Smrg ;; 55176028eb6Smrg sun3) 55276028eb6Smrg basic_machine=m68k-sun 55376028eb6Smrg basic_os= 55476028eb6Smrg ;; 55576028eb6Smrg sun3os3) 55676028eb6Smrg basic_machine=m68k-sun 55776028eb6Smrg basic_os=sunos3 55876028eb6Smrg ;; 55976028eb6Smrg sun3os4) 56076028eb6Smrg basic_machine=m68k-sun 56176028eb6Smrg basic_os=sunos4 56276028eb6Smrg ;; 56376028eb6Smrg sun4) 56476028eb6Smrg basic_machine=sparc-sun 56576028eb6Smrg basic_os= 56676028eb6Smrg ;; 56776028eb6Smrg sun4os3) 56876028eb6Smrg basic_machine=sparc-sun 56976028eb6Smrg basic_os=sunos3 57076028eb6Smrg ;; 57176028eb6Smrg sun4os4) 57276028eb6Smrg basic_machine=sparc-sun 57376028eb6Smrg basic_os=sunos4 57476028eb6Smrg ;; 57576028eb6Smrg sun4sol2) 57676028eb6Smrg basic_machine=sparc-sun 57776028eb6Smrg basic_os=solaris2 57876028eb6Smrg ;; 57976028eb6Smrg sun386 | sun386i | roadrunner) 58076028eb6Smrg basic_machine=i386-sun 58176028eb6Smrg basic_os= 58276028eb6Smrg ;; 58376028eb6Smrg sv1) 58476028eb6Smrg basic_machine=sv1-cray 58576028eb6Smrg basic_os=unicos 58676028eb6Smrg ;; 58776028eb6Smrg symmetry) 58876028eb6Smrg basic_machine=i386-sequent 58976028eb6Smrg basic_os=dynix 59076028eb6Smrg ;; 59176028eb6Smrg t3e) 59276028eb6Smrg basic_machine=alphaev5-cray 59376028eb6Smrg basic_os=unicos 59476028eb6Smrg ;; 59576028eb6Smrg t90) 59676028eb6Smrg basic_machine=t90-cray 59776028eb6Smrg basic_os=unicos 59876028eb6Smrg ;; 59976028eb6Smrg toad1) 60076028eb6Smrg basic_machine=pdp10-xkl 60176028eb6Smrg basic_os=tops20 60276028eb6Smrg ;; 60376028eb6Smrg tpf) 60476028eb6Smrg basic_machine=s390x-ibm 60576028eb6Smrg basic_os=tpf 60676028eb6Smrg ;; 60776028eb6Smrg udi29k) 60876028eb6Smrg basic_machine=a29k-amd 60976028eb6Smrg basic_os=udi 61076028eb6Smrg ;; 61176028eb6Smrg ultra3) 61276028eb6Smrg basic_machine=a29k-nyu 61376028eb6Smrg basic_os=sym1 61476028eb6Smrg ;; 61576028eb6Smrg v810 | necv810) 61676028eb6Smrg basic_machine=v810-nec 61776028eb6Smrg basic_os=none 61876028eb6Smrg ;; 61976028eb6Smrg vaxv) 62076028eb6Smrg basic_machine=vax-dec 62176028eb6Smrg basic_os=sysv 62276028eb6Smrg ;; 62376028eb6Smrg vms) 62476028eb6Smrg basic_machine=vax-dec 62576028eb6Smrg basic_os=vms 62676028eb6Smrg ;; 62776028eb6Smrg vsta) 62876028eb6Smrg basic_machine=i386-pc 62976028eb6Smrg basic_os=vsta 63076028eb6Smrg ;; 63176028eb6Smrg vxworks960) 63276028eb6Smrg basic_machine=i960-wrs 63376028eb6Smrg basic_os=vxworks 63476028eb6Smrg ;; 63576028eb6Smrg vxworks68) 63676028eb6Smrg basic_machine=m68k-wrs 63776028eb6Smrg basic_os=vxworks 63876028eb6Smrg ;; 63976028eb6Smrg vxworks29k) 64076028eb6Smrg basic_machine=a29k-wrs 64176028eb6Smrg basic_os=vxworks 64276028eb6Smrg ;; 64376028eb6Smrg xbox) 64476028eb6Smrg basic_machine=i686-pc 64576028eb6Smrg basic_os=mingw32 64676028eb6Smrg ;; 64776028eb6Smrg ymp) 64876028eb6Smrg basic_machine=ymp-cray 64976028eb6Smrg basic_os=unicos 65076028eb6Smrg ;; 65176028eb6Smrg *) 65276028eb6Smrg basic_machine=$1 65376028eb6Smrg basic_os= 65476028eb6Smrg ;; 65576028eb6Smrg esac 656bbe1b32bSmrg ;; 657bbe1b32bSmrgesac 658bbe1b32bSmrg 65976028eb6Smrg# Decode 1-component or ad-hoc basic machines 660bbe1b32bSmrgcase $basic_machine in 66176028eb6Smrg # Here we handle the default manufacturer of certain CPU types. It is in 66276028eb6Smrg # some cases the only manufacturer, in others, it is the most popular. 66376028eb6Smrg w89k) 66476028eb6Smrg cpu=hppa1.1 66576028eb6Smrg vendor=winbond 666bbe1b32bSmrg ;; 66776028eb6Smrg op50n) 66876028eb6Smrg cpu=hppa1.1 66976028eb6Smrg vendor=oki 670bbe1b32bSmrg ;; 67176028eb6Smrg op60c) 67276028eb6Smrg cpu=hppa1.1 67376028eb6Smrg vendor=oki 674bbe1b32bSmrg ;; 67576028eb6Smrg ibm*) 67676028eb6Smrg cpu=i370 67776028eb6Smrg vendor=ibm 67834f90d55Smrg ;; 67976028eb6Smrg orion105) 68076028eb6Smrg cpu=clipper 68176028eb6Smrg vendor=highlevel 6828f34cbf9Ssnj ;; 68376028eb6Smrg mac | mpw | mac-mpw) 68476028eb6Smrg cpu=m68k 68576028eb6Smrg vendor=apple 68634f90d55Smrg ;; 68776028eb6Smrg pmac | pmac-mpw) 68876028eb6Smrg cpu=powerpc 68976028eb6Smrg vendor=apple 69034f90d55Smrg ;; 69134f90d55Smrg 692bbe1b32bSmrg # Recognize the various machine names and aliases which stand 693bbe1b32bSmrg # for a CPU type and a company and sometimes even an OS. 694bbe1b32bSmrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 69576028eb6Smrg cpu=m68000 69676028eb6Smrg vendor=att 697bbe1b32bSmrg ;; 698bbe1b32bSmrg 3b*) 69976028eb6Smrg cpu=we32k 70076028eb6Smrg vendor=att 70130f8ce46Smrg ;; 70230f8ce46Smrg bluegene*) 70376028eb6Smrg cpu=powerpc 70476028eb6Smrg vendor=ibm 70576028eb6Smrg basic_os=cnk 706bbe1b32bSmrg ;; 707bbe1b32bSmrg decsystem10* | dec10*) 70876028eb6Smrg cpu=pdp10 70976028eb6Smrg vendor=dec 71076028eb6Smrg basic_os=tops10 711bbe1b32bSmrg ;; 712bbe1b32bSmrg decsystem20* | dec20*) 71376028eb6Smrg cpu=pdp10 71476028eb6Smrg vendor=dec 71576028eb6Smrg basic_os=tops20 716bbe1b32bSmrg ;; 717bbe1b32bSmrg delta | 3300 | motorola-3300 | motorola-delta \ 718bbe1b32bSmrg | 3300-motorola | delta-motorola) 71976028eb6Smrg cpu=m68k 72076028eb6Smrg vendor=motorola 721bbe1b32bSmrg ;; 72276028eb6Smrg dpx2*) 72376028eb6Smrg cpu=m68k 72476028eb6Smrg vendor=bull 72576028eb6Smrg basic_os=sysv3 726bbe1b32bSmrg ;; 727bbe1b32bSmrg encore | umax | mmax) 72876028eb6Smrg cpu=ns32k 72976028eb6Smrg vendor=encore 730bbe1b32bSmrg ;; 73176028eb6Smrg elxsi) 73276028eb6Smrg cpu=elxsi 73376028eb6Smrg vendor=elxsi 73476028eb6Smrg basic_os=${basic_os:-bsd} 735bbe1b32bSmrg ;; 736bbe1b32bSmrg fx2800) 73776028eb6Smrg cpu=i860 73876028eb6Smrg vendor=alliant 739bbe1b32bSmrg ;; 740bbe1b32bSmrg genix) 74176028eb6Smrg cpu=ns32k 74276028eb6Smrg vendor=ns 743bbe1b32bSmrg ;; 744bbe1b32bSmrg h3050r* | hiux*) 74576028eb6Smrg cpu=hppa1.1 74676028eb6Smrg vendor=hitachi 74776028eb6Smrg basic_os=hiuxwe2 748bbe1b32bSmrg ;; 749bbe1b32bSmrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 75076028eb6Smrg cpu=hppa1.0 75176028eb6Smrg vendor=hp 752bbe1b32bSmrg ;; 753bbe1b32bSmrg hp9k2[0-9][0-9] | hp9k31[0-9]) 75476028eb6Smrg cpu=m68000 75576028eb6Smrg vendor=hp 756bbe1b32bSmrg ;; 757bbe1b32bSmrg hp9k3[2-9][0-9]) 75876028eb6Smrg cpu=m68k 75976028eb6Smrg vendor=hp 760bbe1b32bSmrg ;; 761bbe1b32bSmrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 76276028eb6Smrg cpu=hppa1.0 76376028eb6Smrg vendor=hp 764bbe1b32bSmrg ;; 765bbe1b32bSmrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 76676028eb6Smrg cpu=hppa1.1 76776028eb6Smrg vendor=hp 768bbe1b32bSmrg ;; 769bbe1b32bSmrg hp9k78[0-9] | hp78[0-9]) 770bbe1b32bSmrg # FIXME: really hppa2.0-hp 77176028eb6Smrg cpu=hppa1.1 77276028eb6Smrg vendor=hp 773bbe1b32bSmrg ;; 774bbe1b32bSmrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 775bbe1b32bSmrg # FIXME: really hppa2.0-hp 77676028eb6Smrg cpu=hppa1.1 77776028eb6Smrg vendor=hp 778bbe1b32bSmrg ;; 779bbe1b32bSmrg hp9k8[0-9][13679] | hp8[0-9][13679]) 78076028eb6Smrg cpu=hppa1.1 78176028eb6Smrg vendor=hp 782bbe1b32bSmrg ;; 783bbe1b32bSmrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 78476028eb6Smrg cpu=hppa1.0 78576028eb6Smrg vendor=hp 786bbe1b32bSmrg ;; 787bbe1b32bSmrg i*86v32) 78876028eb6Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 78976028eb6Smrg vendor=pc 79076028eb6Smrg basic_os=sysv32 791bbe1b32bSmrg ;; 792bbe1b32bSmrg i*86v4*) 79376028eb6Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79476028eb6Smrg vendor=pc 79576028eb6Smrg basic_os=sysv4 796bbe1b32bSmrg ;; 797bbe1b32bSmrg i*86v) 79876028eb6Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79976028eb6Smrg vendor=pc 80076028eb6Smrg basic_os=sysv 801bbe1b32bSmrg ;; 802bbe1b32bSmrg i*86sol2) 80376028eb6Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 80476028eb6Smrg vendor=pc 80576028eb6Smrg basic_os=solaris2 806bbe1b32bSmrg ;; 80776028eb6Smrg j90 | j90-cray) 80876028eb6Smrg cpu=j90 80976028eb6Smrg vendor=cray 81076028eb6Smrg basic_os=${basic_os:-unicos} 811bbe1b32bSmrg ;; 812bbe1b32bSmrg iris | iris4d) 81376028eb6Smrg cpu=mips 81476028eb6Smrg vendor=sgi 81576028eb6Smrg case $basic_os in 81676028eb6Smrg irix*) 817bbe1b32bSmrg ;; 818bbe1b32bSmrg *) 81976028eb6Smrg basic_os=irix4 820bbe1b32bSmrg ;; 821bbe1b32bSmrg esac 822bbe1b32bSmrg ;; 823bbe1b32bSmrg miniframe) 82476028eb6Smrg cpu=m68000 82576028eb6Smrg vendor=convergent 826bbe1b32bSmrg ;; 82776028eb6Smrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 82876028eb6Smrg cpu=m68k 82976028eb6Smrg vendor=atari 83076028eb6Smrg basic_os=mint 831bbe1b32bSmrg ;; 832bbe1b32bSmrg news-3600 | risc-news) 83376028eb6Smrg cpu=mips 83476028eb6Smrg vendor=sony 83576028eb6Smrg basic_os=newsos 83676028eb6Smrg ;; 83776028eb6Smrg next | m*-next) 83876028eb6Smrg cpu=m68k 83976028eb6Smrg vendor=next 84076028eb6Smrg case $basic_os in 84176028eb6Smrg openstep*) 84276028eb6Smrg ;; 84376028eb6Smrg nextstep*) 844bbe1b32bSmrg ;; 84576028eb6Smrg ns2*) 84676028eb6Smrg basic_os=nextstep2 847bbe1b32bSmrg ;; 848bbe1b32bSmrg *) 84976028eb6Smrg basic_os=nextstep3 850bbe1b32bSmrg ;; 851bbe1b32bSmrg esac 852bbe1b32bSmrg ;; 853bbe1b32bSmrg np1) 85476028eb6Smrg cpu=np1 85576028eb6Smrg vendor=gould 85640c5823bSmrg ;; 857bbe1b32bSmrg op50n-* | op60c-*) 85876028eb6Smrg cpu=hppa1.1 85976028eb6Smrg vendor=oki 86076028eb6Smrg basic_os=proelf 861bbe1b32bSmrg ;; 862bbe1b32bSmrg pa-hitachi) 86376028eb6Smrg cpu=hppa1.1 86476028eb6Smrg vendor=hitachi 86576028eb6Smrg basic_os=hiuxwe2 86630f8ce46Smrg ;; 867bbe1b32bSmrg pbd) 86876028eb6Smrg cpu=sparc 86976028eb6Smrg vendor=tti 870bbe1b32bSmrg ;; 871bbe1b32bSmrg pbb) 87276028eb6Smrg cpu=m68k 87376028eb6Smrg vendor=tti 874bbe1b32bSmrg ;; 87576028eb6Smrg pc532) 87676028eb6Smrg cpu=ns32k 87776028eb6Smrg vendor=pc532 878bbe1b32bSmrg ;; 879bbe1b32bSmrg pn) 88076028eb6Smrg cpu=pn 88176028eb6Smrg vendor=gould 882bbe1b32bSmrg ;; 88376028eb6Smrg power) 88476028eb6Smrg cpu=power 88576028eb6Smrg vendor=ibm 886bbe1b32bSmrg ;; 887bbe1b32bSmrg ps2) 88876028eb6Smrg cpu=i386 88976028eb6Smrg vendor=ibm 890bbe1b32bSmrg ;; 891bbe1b32bSmrg rm[46]00) 89276028eb6Smrg cpu=mips 89376028eb6Smrg vendor=siemens 894bbe1b32bSmrg ;; 895bbe1b32bSmrg rtpc | rtpc-*) 89676028eb6Smrg cpu=romp 89776028eb6Smrg vendor=ibm 898bbe1b32bSmrg ;; 899bbe1b32bSmrg sde) 90076028eb6Smrg cpu=mipsisa32 90176028eb6Smrg vendor=sde 90276028eb6Smrg basic_os=${basic_os:-elf} 903bbe1b32bSmrg ;; 90476028eb6Smrg simso-wrs) 90576028eb6Smrg cpu=sparclite 90676028eb6Smrg vendor=wrs 90776028eb6Smrg basic_os=vxworks 908bbe1b32bSmrg ;; 90976028eb6Smrg tower | tower-32) 91076028eb6Smrg cpu=m68k 91176028eb6Smrg vendor=ncr 912bbe1b32bSmrg ;; 91376028eb6Smrg vpp*|vx|vx-*) 91476028eb6Smrg cpu=f301 91576028eb6Smrg vendor=fujitsu 916bbe1b32bSmrg ;; 91776028eb6Smrg w65) 91876028eb6Smrg cpu=w65 91976028eb6Smrg vendor=wdc 92030f8ce46Smrg ;; 92176028eb6Smrg w89k-*) 92276028eb6Smrg cpu=hppa1.1 92376028eb6Smrg vendor=winbond 92476028eb6Smrg basic_os=proelf 925bbe1b32bSmrg ;; 92676028eb6Smrg none) 92776028eb6Smrg cpu=none 92876028eb6Smrg vendor=none 929bbe1b32bSmrg ;; 93076028eb6Smrg leon|leon[3-9]) 93176028eb6Smrg cpu=sparc 93276028eb6Smrg vendor=$basic_machine 933bbe1b32bSmrg ;; 93476028eb6Smrg leon-*|leon[3-9]-*) 93576028eb6Smrg cpu=sparc 93676028eb6Smrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 937bbe1b32bSmrg ;; 93876028eb6Smrg 93976028eb6Smrg *-*) 94076028eb6Smrg # shellcheck disable=SC2162 94176028eb6Smrg saved_IFS=$IFS 94276028eb6Smrg IFS="-" read cpu vendor <<EOF 94376028eb6Smrg$basic_machine 94476028eb6SmrgEOF 94576028eb6Smrg IFS=$saved_IFS 946bbe1b32bSmrg ;; 947e1db7cd1Smrg # We use 'pc' rather than 'unknown' 94876028eb6Smrg # because (1) that's what they normally are, and 94976028eb6Smrg # (2) the word "unknown" tends to confuse beginning users. 95076028eb6Smrg i*86 | x86_64) 95176028eb6Smrg cpu=$basic_machine 95276028eb6Smrg vendor=pc 953bbe1b32bSmrg ;; 95476028eb6Smrg # These rules are duplicated from below for sake of the special case above; 95576028eb6Smrg # i.e. things that normalized to x86 arches should also default to "pc" 95676028eb6Smrg pc98) 95776028eb6Smrg cpu=i386 95876028eb6Smrg vendor=pc 95934f90d55Smrg ;; 96076028eb6Smrg x64 | amd64) 96176028eb6Smrg cpu=x86_64 96276028eb6Smrg vendor=pc 963bbe1b32bSmrg ;; 96476028eb6Smrg # Recognize the basic CPU types without company name. 96576028eb6Smrg *) 96676028eb6Smrg cpu=$basic_machine 96776028eb6Smrg vendor=unknown 968bbe1b32bSmrg ;; 96976028eb6Smrgesac 97076028eb6Smrg 97176028eb6Smrgunset -v basic_machine 97276028eb6Smrg 97376028eb6Smrg# Decode basic machines in the full and proper CPU-Company form. 97476028eb6Smrgcase $cpu-$vendor in 97576028eb6Smrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 97676028eb6Smrg # some cases the only manufacturer, in others, it is the most popular. 97776028eb6Smrg craynv-unknown) 97876028eb6Smrg vendor=cray 97976028eb6Smrg basic_os=${basic_os:-unicosmp} 980bbe1b32bSmrg ;; 98176028eb6Smrg c90-unknown | c90-cray) 98276028eb6Smrg vendor=cray 98376028eb6Smrg basic_os=${Basic_os:-unicos} 984bbe1b32bSmrg ;; 98576028eb6Smrg fx80-unknown) 98676028eb6Smrg vendor=alliant 987bbe1b32bSmrg ;; 98876028eb6Smrg romp-unknown) 98976028eb6Smrg vendor=ibm 990bbe1b32bSmrg ;; 99176028eb6Smrg mmix-unknown) 99276028eb6Smrg vendor=knuth 993bbe1b32bSmrg ;; 99476028eb6Smrg microblaze-unknown | microblazeel-unknown) 99576028eb6Smrg vendor=xilinx 996bbe1b32bSmrg ;; 99776028eb6Smrg rs6000-unknown) 99876028eb6Smrg vendor=ibm 999bbe1b32bSmrg ;; 100076028eb6Smrg vax-unknown) 100176028eb6Smrg vendor=dec 1002bbe1b32bSmrg ;; 100376028eb6Smrg pdp11-unknown) 100476028eb6Smrg vendor=dec 1005bbe1b32bSmrg ;; 100676028eb6Smrg we32k-unknown) 100776028eb6Smrg vendor=att 1008bbe1b32bSmrg ;; 100976028eb6Smrg cydra-unknown) 101076028eb6Smrg vendor=cydrome 1011bbe1b32bSmrg ;; 101276028eb6Smrg i370-ibm*) 101376028eb6Smrg vendor=ibm 1014bbe1b32bSmrg ;; 101576028eb6Smrg orion-unknown) 101676028eb6Smrg vendor=highlevel 1017bbe1b32bSmrg ;; 101876028eb6Smrg xps-unknown | xps100-unknown) 101976028eb6Smrg cpu=xps100 102076028eb6Smrg vendor=honeywell 1021bbe1b32bSmrg ;; 102276028eb6Smrg 102376028eb6Smrg # Here we normalize CPU types with a missing or matching vendor 1024e1db7cd1Smrg armh-unknown | armh-alt) 1025e1db7cd1Smrg cpu=armv7l 1026e1db7cd1Smrg vendor=alt 1027e1db7cd1Smrg basic_os=${basic_os:-linux-gnueabihf} 1028e1db7cd1Smrg ;; 102976028eb6Smrg dpx20-unknown | dpx20-bull) 103076028eb6Smrg cpu=rs6000 103176028eb6Smrg vendor=bull 103276028eb6Smrg basic_os=${basic_os:-bosx} 1033bbe1b32bSmrg ;; 103476028eb6Smrg 103576028eb6Smrg # Here we normalize CPU types irrespective of the vendor 103676028eb6Smrg amd64-*) 103776028eb6Smrg cpu=x86_64 1038bbe1b32bSmrg ;; 103976028eb6Smrg blackfin-*) 104076028eb6Smrg cpu=bfin 104176028eb6Smrg basic_os=linux 1042bbe1b32bSmrg ;; 104376028eb6Smrg c54x-*) 104476028eb6Smrg cpu=tic54x 1045bbe1b32bSmrg ;; 104676028eb6Smrg c55x-*) 104776028eb6Smrg cpu=tic55x 1048bbe1b32bSmrg ;; 104976028eb6Smrg c6x-*) 105076028eb6Smrg cpu=tic6x 1051bbe1b32bSmrg ;; 105276028eb6Smrg e500v[12]-*) 105376028eb6Smrg cpu=powerpc 105476028eb6Smrg basic_os=${basic_os}"spe" 1055bbe1b32bSmrg ;; 105676028eb6Smrg mips3*-*) 105776028eb6Smrg cpu=mips64 1058bbe1b32bSmrg ;; 105976028eb6Smrg ms1-*) 106076028eb6Smrg cpu=mt 1061bbe1b32bSmrg ;; 106276028eb6Smrg m68knommu-*) 106376028eb6Smrg cpu=m68k 106476028eb6Smrg basic_os=linux 1065bbe1b32bSmrg ;; 106676028eb6Smrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 106776028eb6Smrg cpu=s12z 1068bbe1b32bSmrg ;; 106976028eb6Smrg openrisc-*) 107076028eb6Smrg cpu=or32 1071bbe1b32bSmrg ;; 107276028eb6Smrg parisc-*) 107376028eb6Smrg cpu=hppa 107476028eb6Smrg basic_os=linux 1075bbe1b32bSmrg ;; 107676028eb6Smrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 107776028eb6Smrg cpu=i586 1078bbe1b32bSmrg ;; 1079e1db7cd1Smrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 108076028eb6Smrg cpu=i686 108140c5823bSmrg ;; 108276028eb6Smrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 108376028eb6Smrg cpu=i686 1084bbe1b32bSmrg ;; 108576028eb6Smrg pentium4-*) 108676028eb6Smrg cpu=i786 1087bbe1b32bSmrg ;; 108876028eb6Smrg pc98-*) 108976028eb6Smrg cpu=i386 1090bbe1b32bSmrg ;; 109176028eb6Smrg ppc-* | ppcbe-*) 109276028eb6Smrg cpu=powerpc 1093bbe1b32bSmrg ;; 109476028eb6Smrg ppcle-* | powerpclittle-*) 109576028eb6Smrg cpu=powerpcle 109634f90d55Smrg ;; 109776028eb6Smrg ppc64-*) 109876028eb6Smrg cpu=powerpc64 1099bbe1b32bSmrg ;; 110076028eb6Smrg ppc64le-* | powerpc64little-*) 110176028eb6Smrg cpu=powerpc64le 1102bbe1b32bSmrg ;; 110376028eb6Smrg sb1-*) 110476028eb6Smrg cpu=mipsisa64sb1 110530f8ce46Smrg ;; 110676028eb6Smrg sb1el-*) 110776028eb6Smrg cpu=mipsisa64sb1el 1108bbe1b32bSmrg ;; 110976028eb6Smrg sh5e[lb]-*) 111076028eb6Smrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 1111bbe1b32bSmrg ;; 111276028eb6Smrg spur-*) 111376028eb6Smrg cpu=spur 1114bbe1b32bSmrg ;; 111576028eb6Smrg strongarm-* | thumb-*) 111676028eb6Smrg cpu=arm 1117bbe1b32bSmrg ;; 111876028eb6Smrg tx39-*) 111976028eb6Smrg cpu=mipstx39 1120bbe1b32bSmrg ;; 112176028eb6Smrg tx39el-*) 112276028eb6Smrg cpu=mipstx39el 1123bbe1b32bSmrg ;; 112476028eb6Smrg x64-*) 112576028eb6Smrg cpu=x86_64 1126bbe1b32bSmrg ;; 112776028eb6Smrg xscale-* | xscalee[bl]-*) 112876028eb6Smrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 1129bbe1b32bSmrg ;; 1130e1db7cd1Smrg arm64-* | aarch64le-*) 113176028eb6Smrg cpu=aarch64 1132bbe1b32bSmrg ;; 113376028eb6Smrg 113476028eb6Smrg # Recognize the canonical CPU Types that limit and/or modify the 113576028eb6Smrg # company names they are paired with. 113676028eb6Smrg cr16-*) 113776028eb6Smrg basic_os=${basic_os:-elf} 1138bbe1b32bSmrg ;; 113976028eb6Smrg crisv32-* | etraxfs*-*) 114076028eb6Smrg cpu=crisv32 114176028eb6Smrg vendor=axis 1142bbe1b32bSmrg ;; 114376028eb6Smrg cris-* | etrax*-*) 114476028eb6Smrg cpu=cris 114576028eb6Smrg vendor=axis 1146bbe1b32bSmrg ;; 114776028eb6Smrg crx-*) 114876028eb6Smrg basic_os=${basic_os:-elf} 1149bbe1b32bSmrg ;; 115076028eb6Smrg neo-tandem) 115176028eb6Smrg cpu=neo 115276028eb6Smrg vendor=tandem 1153bbe1b32bSmrg ;; 115476028eb6Smrg nse-tandem) 115576028eb6Smrg cpu=nse 115676028eb6Smrg vendor=tandem 1157bbe1b32bSmrg ;; 115876028eb6Smrg nsr-tandem) 115976028eb6Smrg cpu=nsr 116076028eb6Smrg vendor=tandem 1161bbe1b32bSmrg ;; 116276028eb6Smrg nsv-tandem) 116376028eb6Smrg cpu=nsv 116476028eb6Smrg vendor=tandem 1165bbe1b32bSmrg ;; 116676028eb6Smrg nsx-tandem) 116776028eb6Smrg cpu=nsx 116876028eb6Smrg vendor=tandem 1169bbe1b32bSmrg ;; 117076028eb6Smrg mipsallegrexel-sony) 117176028eb6Smrg cpu=mipsallegrexel 117276028eb6Smrg vendor=sony 1173bbe1b32bSmrg ;; 117476028eb6Smrg tile*-*) 117576028eb6Smrg basic_os=${basic_os:-linux-gnu} 117676028eb6Smrg ;; 117776028eb6Smrg 1178bbe1b32bSmrg *) 117976028eb6Smrg # Recognize the canonical CPU types that are allowed with any 118076028eb6Smrg # company name. 118176028eb6Smrg case $cpu in 118276028eb6Smrg 1750a | 580 \ 118376028eb6Smrg | a29k \ 1184e1db7cd1Smrg | aarch64 | aarch64_be | aarch64c | arm64ec \ 118576028eb6Smrg | abacus \ 118676028eb6Smrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 118776028eb6Smrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 118876028eb6Smrg | alphapca5[67] | alpha64pca5[67] \ 118976028eb6Smrg | am33_2.0 \ 119076028eb6Smrg | amdgcn \ 119176028eb6Smrg | arc | arceb | arc32 | arc64 \ 119276028eb6Smrg | arm | arm[lb]e | arme[lb] | armv* \ 119376028eb6Smrg | avr | avr32 \ 119476028eb6Smrg | asmjs \ 119576028eb6Smrg | ba \ 119676028eb6Smrg | be32 | be64 \ 119776028eb6Smrg | bfin | bpf | bs2000 \ 119876028eb6Smrg | c[123]* | c30 | [cjt]90 | c4x \ 119976028eb6Smrg | c8051 | clipper | craynv | csky | cydra \ 120076028eb6Smrg | d10v | d30v | dlx | dsp16xx \ 120176028eb6Smrg | e2k | elxsi | epiphany \ 120276028eb6Smrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1203e1db7cd1Smrg | javascript \ 120476028eb6Smrg | h8300 | h8500 \ 120576028eb6Smrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 120676028eb6Smrg | hexagon \ 120776028eb6Smrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 120876028eb6Smrg | ip2k | iq2000 \ 120976028eb6Smrg | k1om \ 1210e1db7cd1Smrg | kvx \ 121176028eb6Smrg | le32 | le64 \ 121276028eb6Smrg | lm32 \ 1213e1db7cd1Smrg | loongarch32 | loongarch64 \ 121476028eb6Smrg | m32c | m32r | m32rle \ 121576028eb6Smrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 121676028eb6Smrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 121776028eb6Smrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 121876028eb6Smrg | microblaze | microblazeel \ 1219e1db7cd1Smrg | mips* \ 122076028eb6Smrg | mmix \ 122176028eb6Smrg | mn10200 | mn10300 \ 122276028eb6Smrg | moxie \ 122376028eb6Smrg | mt \ 122476028eb6Smrg | msp430 \ 1225e1db7cd1Smrg | nanomips* \ 122676028eb6Smrg | nds32 | nds32le | nds32be \ 122776028eb6Smrg | nfp \ 122876028eb6Smrg | nios | nios2 | nios2eb | nios2el \ 122976028eb6Smrg | none | np1 | ns16k | ns32k | nvptx \ 123076028eb6Smrg | open8 \ 123176028eb6Smrg | or1k* \ 123276028eb6Smrg | or32 \ 123376028eb6Smrg | orion \ 123476028eb6Smrg | picochip \ 123576028eb6Smrg | pdp10 | pdp11 | pj | pjl | pn | power \ 123676028eb6Smrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 123776028eb6Smrg | pru \ 123876028eb6Smrg | pyramid \ 123976028eb6Smrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 124076028eb6Smrg | rl78 | romp | rs6000 | rx \ 124176028eb6Smrg | s390 | s390x \ 124276028eb6Smrg | score \ 124376028eb6Smrg | sh | shl \ 124476028eb6Smrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 124576028eb6Smrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 124676028eb6Smrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 124776028eb6Smrg | sparclite \ 124876028eb6Smrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 124976028eb6Smrg | spu \ 125076028eb6Smrg | tahoe \ 125176028eb6Smrg | thumbv7* \ 125276028eb6Smrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 125376028eb6Smrg | tron \ 125476028eb6Smrg | ubicom32 \ 125576028eb6Smrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 125676028eb6Smrg | vax \ 1257e1db7cd1Smrg | vc4 \ 125876028eb6Smrg | visium \ 125976028eb6Smrg | w65 \ 126076028eb6Smrg | wasm32 | wasm64 \ 126176028eb6Smrg | we32k \ 126276028eb6Smrg | x86 | x86_64 | xc16x | xgate | xps100 \ 126376028eb6Smrg | xstormy16 | xtensa* \ 126476028eb6Smrg | ymp \ 126576028eb6Smrg | z8k | z80) 126676028eb6Smrg ;; 126776028eb6Smrg 126876028eb6Smrg *) 1269e1db7cd1Smrg echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 127076028eb6Smrg exit 1 127176028eb6Smrg ;; 127276028eb6Smrg esac 1273bbe1b32bSmrg ;; 1274bbe1b32bSmrgesac 1275bbe1b32bSmrg 1276bbe1b32bSmrg# Here we canonicalize certain aliases for manufacturers. 127776028eb6Smrgcase $vendor in 127876028eb6Smrg digital*) 127976028eb6Smrg vendor=dec 1280bbe1b32bSmrg ;; 128176028eb6Smrg commodore*) 128276028eb6Smrg vendor=cbm 1283bbe1b32bSmrg ;; 1284bbe1b32bSmrg *) 1285bbe1b32bSmrg ;; 1286bbe1b32bSmrgesac 1287bbe1b32bSmrg 1288bbe1b32bSmrg# Decode manufacturer-specific aliases for certain operating systems. 1289bbe1b32bSmrg 1290e1db7cd1Smrgif test x"$basic_os" != x 1291bbe1b32bSmrgthen 129276028eb6Smrg 1293e1db7cd1Smrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 129476028eb6Smrg# set os. 1295e1db7cd1Smrgobj= 129676028eb6Smrgcase $basic_os in 129776028eb6Smrg gnu/linux*) 129876028eb6Smrg kernel=linux 129976028eb6Smrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 130076028eb6Smrg ;; 130176028eb6Smrg os2-emx) 130276028eb6Smrg kernel=os2 130376028eb6Smrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 130476028eb6Smrg ;; 130576028eb6Smrg nto-qnx*) 130676028eb6Smrg kernel=nto 130776028eb6Smrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 130876028eb6Smrg ;; 130976028eb6Smrg *-*) 131076028eb6Smrg # shellcheck disable=SC2162 131176028eb6Smrg saved_IFS=$IFS 131276028eb6Smrg IFS="-" read kernel os <<EOF 131376028eb6Smrg$basic_os 131476028eb6SmrgEOF 131576028eb6Smrg IFS=$saved_IFS 131676028eb6Smrg ;; 131776028eb6Smrg # Default OS when just kernel was specified 131876028eb6Smrg nto*) 131976028eb6Smrg kernel=nto 132076028eb6Smrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 132176028eb6Smrg ;; 132276028eb6Smrg linux*) 132376028eb6Smrg kernel=linux 132476028eb6Smrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 132530f8ce46Smrg ;; 1326e1db7cd1Smrg managarm*) 1327e1db7cd1Smrg kernel=managarm 1328e1db7cd1Smrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 1329e1db7cd1Smrg ;; 133076028eb6Smrg *) 133176028eb6Smrg kernel= 133276028eb6Smrg os=$basic_os 1333bbe1b32bSmrg ;; 133476028eb6Smrgesac 133576028eb6Smrg 133676028eb6Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 133776028eb6Smrg# etc.) 133876028eb6Smrgcase $os in 133976028eb6Smrg # First match some system type aliases that might get confused 134076028eb6Smrg # with valid system types. 134176028eb6Smrg # solaris* is a basic system type, with this one exception. 134276028eb6Smrg auroraux) 134376028eb6Smrg os=auroraux 1344bbe1b32bSmrg ;; 134576028eb6Smrg bluegene*) 134676028eb6Smrg os=cnk 1347bbe1b32bSmrg ;; 134876028eb6Smrg solaris1 | solaris1.*) 134976028eb6Smrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 1350bbe1b32bSmrg ;; 135176028eb6Smrg solaris) 135276028eb6Smrg os=solaris2 1353bbe1b32bSmrg ;; 135476028eb6Smrg unixware*) 135576028eb6Smrg os=sysv4.2uw 1356bbe1b32bSmrg ;; 135776028eb6Smrg # es1800 is here to avoid being matched by es* (a different OS) 135876028eb6Smrg es1800*) 135976028eb6Smrg os=ose 1360bbe1b32bSmrg ;; 136176028eb6Smrg # Some version numbers need modification 136276028eb6Smrg chorusos*) 136376028eb6Smrg os=chorusos 1364bbe1b32bSmrg ;; 136576028eb6Smrg isc) 136676028eb6Smrg os=isc2.2 1367bbe1b32bSmrg ;; 136876028eb6Smrg sco6) 136976028eb6Smrg os=sco5v6 1370bbe1b32bSmrg ;; 137176028eb6Smrg sco5) 137276028eb6Smrg os=sco3.2v5 1373bbe1b32bSmrg ;; 137476028eb6Smrg sco4) 137576028eb6Smrg os=sco3.2v4 1376bbe1b32bSmrg ;; 137776028eb6Smrg sco3.2.[4-9]*) 137876028eb6Smrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 1379bbe1b32bSmrg ;; 138076028eb6Smrg sco*v* | scout) 138176028eb6Smrg # Don't match below 1382bbe1b32bSmrg ;; 138376028eb6Smrg sco*) 138476028eb6Smrg os=sco3.2v2 1385bbe1b32bSmrg ;; 138676028eb6Smrg psos*) 138776028eb6Smrg os=psos 1388bbe1b32bSmrg ;; 138976028eb6Smrg qnx*) 139076028eb6Smrg os=qnx 1391bbe1b32bSmrg ;; 139276028eb6Smrg hiux*) 139376028eb6Smrg os=hiuxwe2 1394bbe1b32bSmrg ;; 139576028eb6Smrg lynx*178) 139676028eb6Smrg os=lynxos178 1397bbe1b32bSmrg ;; 139876028eb6Smrg lynx*5) 139976028eb6Smrg os=lynxos5 1400bbe1b32bSmrg ;; 140176028eb6Smrg lynxos*) 140276028eb6Smrg # don't get caught up in next wildcard 1403bbe1b32bSmrg ;; 140476028eb6Smrg lynx*) 140576028eb6Smrg os=lynxos 1406bbe1b32bSmrg ;; 140776028eb6Smrg mac[0-9]*) 140876028eb6Smrg os=`echo "$os" | sed -e 's|mac|macos|'` 1409bbe1b32bSmrg ;; 141076028eb6Smrg opened*) 141176028eb6Smrg os=openedition 1412bbe1b32bSmrg ;; 141376028eb6Smrg os400*) 141476028eb6Smrg os=os400 1415bbe1b32bSmrg ;; 141676028eb6Smrg sunos5*) 141776028eb6Smrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1418bbe1b32bSmrg ;; 141976028eb6Smrg sunos6*) 142076028eb6Smrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1421bbe1b32bSmrg ;; 142276028eb6Smrg wince*) 142376028eb6Smrg os=wince 1424bbe1b32bSmrg ;; 142576028eb6Smrg utek*) 142676028eb6Smrg os=bsd 1427bbe1b32bSmrg ;; 142876028eb6Smrg dynix*) 142976028eb6Smrg os=bsd 1430bbe1b32bSmrg ;; 143176028eb6Smrg acis*) 143276028eb6Smrg os=aos 1433bbe1b32bSmrg ;; 143476028eb6Smrg atheos*) 143576028eb6Smrg os=atheos 1436bbe1b32bSmrg ;; 143776028eb6Smrg syllable*) 143876028eb6Smrg os=syllable 1439bbe1b32bSmrg ;; 144076028eb6Smrg 386bsd) 144176028eb6Smrg os=bsd 1442bbe1b32bSmrg ;; 144376028eb6Smrg ctix* | uts*) 144476028eb6Smrg os=sysv 1445bbe1b32bSmrg ;; 144676028eb6Smrg nova*) 144776028eb6Smrg os=rtmk-nova 1448bbe1b32bSmrg ;; 144976028eb6Smrg ns2) 145076028eb6Smrg os=nextstep2 1451bbe1b32bSmrg ;; 145276028eb6Smrg # Preserve the version number of sinix5. 145376028eb6Smrg sinix5.*) 145476028eb6Smrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 1455bbe1b32bSmrg ;; 145676028eb6Smrg sinix*) 145776028eb6Smrg os=sysv4 1458bbe1b32bSmrg ;; 145976028eb6Smrg tpf*) 146076028eb6Smrg os=tpf 1461bbe1b32bSmrg ;; 146276028eb6Smrg triton*) 146376028eb6Smrg os=sysv3 1464bbe1b32bSmrg ;; 146576028eb6Smrg oss*) 146676028eb6Smrg os=sysv3 1467bbe1b32bSmrg ;; 146876028eb6Smrg svr4*) 146976028eb6Smrg os=sysv4 1470bbe1b32bSmrg ;; 147176028eb6Smrg svr3) 147276028eb6Smrg os=sysv3 1473bbe1b32bSmrg ;; 147476028eb6Smrg sysvr4) 147576028eb6Smrg os=sysv4 147630f8ce46Smrg ;; 147776028eb6Smrg ose*) 147876028eb6Smrg os=ose 147934f90d55Smrg ;; 148076028eb6Smrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 148176028eb6Smrg os=mint 148240c5823bSmrg ;; 148376028eb6Smrg dicos*) 148476028eb6Smrg os=dicos 148576028eb6Smrg ;; 148676028eb6Smrg pikeos*) 148776028eb6Smrg # Until real need of OS specific support for 148876028eb6Smrg # particular features comes up, bare metal 148976028eb6Smrg # configurations are quite functional. 149076028eb6Smrg case $cpu in 149176028eb6Smrg arm*) 149276028eb6Smrg os=eabi 149376028eb6Smrg ;; 149476028eb6Smrg *) 1495e1db7cd1Smrg os= 1496e1db7cd1Smrg obj=elf 149776028eb6Smrg ;; 149876028eb6Smrg esac 1499bbe1b32bSmrg ;; 1500e1db7cd1Smrg aout* | coff* | elf* | pe*) 1501e1db7cd1Smrg # These are machine code file formats, not OSes 1502e1db7cd1Smrg obj=$os 1503e1db7cd1Smrg os= 1504e1db7cd1Smrg ;; 1505bbe1b32bSmrg *) 150676028eb6Smrg # No normalization, but not necessarily accepted, that comes below. 1507bbe1b32bSmrg ;; 1508bbe1b32bSmrgesac 150976028eb6Smrg 1510bbe1b32bSmrgelse 1511bbe1b32bSmrg 1512bbe1b32bSmrg# Here we handle the default operating systems that come with various machines. 1513bbe1b32bSmrg# The value should be what the vendor currently ships out the door with their 1514bbe1b32bSmrg# machine or put another way, the most popular os provided with the machine. 1515bbe1b32bSmrg 1516bbe1b32bSmrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 1517bbe1b32bSmrg# "-sun"), then you have to tell the case statement up towards the top 1518bbe1b32bSmrg# that MANUFACTURER isn't an operating system. Otherwise, code above 1519bbe1b32bSmrg# will signal an error saying that MANUFACTURER isn't an operating 1520bbe1b32bSmrg# system, and we'll never get to this point. 1521bbe1b32bSmrg 152276028eb6Smrgkernel= 1523e1db7cd1Smrgobj= 152476028eb6Smrgcase $cpu-$vendor in 152534f90d55Smrg score-*) 1526e1db7cd1Smrg os= 1527e1db7cd1Smrg obj=elf 1528bbe1b32bSmrg ;; 152934f90d55Smrg spu-*) 1530e1db7cd1Smrg os= 1531e1db7cd1Smrg obj=elf 1532bbe1b32bSmrg ;; 1533bbe1b32bSmrg *-acorn) 153476028eb6Smrg os=riscix1.2 1535bbe1b32bSmrg ;; 1536bbe1b32bSmrg arm*-rebel) 153776028eb6Smrg kernel=linux 153876028eb6Smrg os=gnu 1539bbe1b32bSmrg ;; 1540bbe1b32bSmrg arm*-semi) 1541e1db7cd1Smrg os= 1542e1db7cd1Smrg obj=aout 1543bbe1b32bSmrg ;; 154434f90d55Smrg c4x-* | tic4x-*) 1545e1db7cd1Smrg os= 1546e1db7cd1Smrg obj=coff 1547bbe1b32bSmrg ;; 15488f34cbf9Ssnj c8051-*) 1549e1db7cd1Smrg os= 1550e1db7cd1Smrg obj=elf 155176028eb6Smrg ;; 155276028eb6Smrg clipper-intergraph) 155376028eb6Smrg os=clix 15548f34cbf9Ssnj ;; 15558f34cbf9Ssnj hexagon-*) 1556e1db7cd1Smrg os= 1557e1db7cd1Smrg obj=elf 15588f34cbf9Ssnj ;; 155930f8ce46Smrg tic54x-*) 1560e1db7cd1Smrg os= 1561e1db7cd1Smrg obj=coff 156230f8ce46Smrg ;; 156330f8ce46Smrg tic55x-*) 1564e1db7cd1Smrg os= 1565e1db7cd1Smrg obj=coff 156630f8ce46Smrg ;; 156730f8ce46Smrg tic6x-*) 1568e1db7cd1Smrg os= 1569e1db7cd1Smrg obj=coff 157030f8ce46Smrg ;; 1571bbe1b32bSmrg # This must come before the *-dec entry. 1572bbe1b32bSmrg pdp10-*) 157376028eb6Smrg os=tops20 1574bbe1b32bSmrg ;; 1575bbe1b32bSmrg pdp11-*) 157676028eb6Smrg os=none 1577bbe1b32bSmrg ;; 1578bbe1b32bSmrg *-dec | vax-*) 157976028eb6Smrg os=ultrix4.2 1580bbe1b32bSmrg ;; 1581bbe1b32bSmrg m68*-apollo) 158276028eb6Smrg os=domain 1583bbe1b32bSmrg ;; 1584bbe1b32bSmrg i386-sun) 158576028eb6Smrg os=sunos4.0.2 1586bbe1b32bSmrg ;; 1587bbe1b32bSmrg m68000-sun) 158876028eb6Smrg os=sunos3 1589bbe1b32bSmrg ;; 1590bbe1b32bSmrg m68*-cisco) 1591e1db7cd1Smrg os= 1592e1db7cd1Smrg obj=aout 1593bbe1b32bSmrg ;; 159434f90d55Smrg mep-*) 1595e1db7cd1Smrg os= 1596e1db7cd1Smrg obj=elf 159730f8ce46Smrg ;; 1598bbe1b32bSmrg mips*-cisco) 1599e1db7cd1Smrg os= 1600e1db7cd1Smrg obj=elf 1601bbe1b32bSmrg ;; 1602e1db7cd1Smrg mips*-*|nanomips*-*) 1603e1db7cd1Smrg os= 1604e1db7cd1Smrg obj=elf 1605bbe1b32bSmrg ;; 1606bbe1b32bSmrg or32-*) 1607e1db7cd1Smrg os= 1608e1db7cd1Smrg obj=coff 1609bbe1b32bSmrg ;; 1610bbe1b32bSmrg *-tti) # must be before sparc entry or we get the wrong os. 161176028eb6Smrg os=sysv3 1612bbe1b32bSmrg ;; 1613bbe1b32bSmrg sparc-* | *-sun) 161476028eb6Smrg os=sunos4.1.1 1615bbe1b32bSmrg ;; 161640c5823bSmrg pru-*) 1617e1db7cd1Smrg os= 1618e1db7cd1Smrg obj=elf 161940c5823bSmrg ;; 1620bbe1b32bSmrg *-be) 162176028eb6Smrg os=beos 1622bbe1b32bSmrg ;; 1623bbe1b32bSmrg *-ibm) 162476028eb6Smrg os=aix 1625bbe1b32bSmrg ;; 162634f90d55Smrg *-knuth) 162776028eb6Smrg os=mmixware 1628bbe1b32bSmrg ;; 1629bbe1b32bSmrg *-wec) 163076028eb6Smrg os=proelf 1631bbe1b32bSmrg ;; 1632bbe1b32bSmrg *-winbond) 163376028eb6Smrg os=proelf 1634bbe1b32bSmrg ;; 1635bbe1b32bSmrg *-oki) 163676028eb6Smrg os=proelf 1637bbe1b32bSmrg ;; 1638bbe1b32bSmrg *-hp) 163976028eb6Smrg os=hpux 1640bbe1b32bSmrg ;; 1641bbe1b32bSmrg *-hitachi) 164276028eb6Smrg os=hiux 1643bbe1b32bSmrg ;; 1644bbe1b32bSmrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 164576028eb6Smrg os=sysv 1646bbe1b32bSmrg ;; 1647bbe1b32bSmrg *-cbm) 164876028eb6Smrg os=amigaos 1649bbe1b32bSmrg ;; 1650bbe1b32bSmrg *-dg) 165176028eb6Smrg os=dgux 1652bbe1b32bSmrg ;; 1653bbe1b32bSmrg *-dolphin) 165476028eb6Smrg os=sysv3 1655bbe1b32bSmrg ;; 1656bbe1b32bSmrg m68k-ccur) 165776028eb6Smrg os=rtu 1658bbe1b32bSmrg ;; 1659bbe1b32bSmrg m88k-omron*) 166076028eb6Smrg os=luna 1661bbe1b32bSmrg ;; 166276028eb6Smrg *-next) 166376028eb6Smrg os=nextstep 1664bbe1b32bSmrg ;; 1665bbe1b32bSmrg *-sequent) 166676028eb6Smrg os=ptx 1667bbe1b32bSmrg ;; 1668bbe1b32bSmrg *-crds) 166976028eb6Smrg os=unos 1670bbe1b32bSmrg ;; 1671bbe1b32bSmrg *-ns) 167276028eb6Smrg os=genix 1673bbe1b32bSmrg ;; 1674bbe1b32bSmrg i370-*) 167576028eb6Smrg os=mvs 1676bbe1b32bSmrg ;; 1677bbe1b32bSmrg *-gould) 167876028eb6Smrg os=sysv 1679bbe1b32bSmrg ;; 1680bbe1b32bSmrg *-highlevel) 168176028eb6Smrg os=bsd 1682bbe1b32bSmrg ;; 1683bbe1b32bSmrg *-encore) 168476028eb6Smrg os=bsd 1685bbe1b32bSmrg ;; 1686bbe1b32bSmrg *-sgi) 168776028eb6Smrg os=irix 1688bbe1b32bSmrg ;; 1689bbe1b32bSmrg *-siemens) 169076028eb6Smrg os=sysv4 1691bbe1b32bSmrg ;; 1692bbe1b32bSmrg *-masscomp) 169376028eb6Smrg os=rtu 1694bbe1b32bSmrg ;; 1695bbe1b32bSmrg f30[01]-fujitsu | f700-fujitsu) 169676028eb6Smrg os=uxpv 1697bbe1b32bSmrg ;; 1698bbe1b32bSmrg *-rom68k) 1699e1db7cd1Smrg os= 1700e1db7cd1Smrg obj=coff 1701bbe1b32bSmrg ;; 1702bbe1b32bSmrg *-*bug) 1703e1db7cd1Smrg os= 1704e1db7cd1Smrg obj=coff 1705bbe1b32bSmrg ;; 1706bbe1b32bSmrg *-apple) 170776028eb6Smrg os=macos 1708bbe1b32bSmrg ;; 1709bbe1b32bSmrg *-atari*) 171076028eb6Smrg os=mint 171176028eb6Smrg ;; 171276028eb6Smrg *-wrs) 171376028eb6Smrg os=vxworks 1714bbe1b32bSmrg ;; 1715bbe1b32bSmrg *) 171676028eb6Smrg os=none 1717bbe1b32bSmrg ;; 1718bbe1b32bSmrgesac 171976028eb6Smrg 1720bbe1b32bSmrgfi 1721bbe1b32bSmrg 1722e1db7cd1Smrg# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). 1723e1db7cd1Smrg 172476028eb6Smrgcase $os in 172576028eb6Smrg # Sometimes we do "kernel-libc", so those need to count as OSes. 1726e1db7cd1Smrg llvm* | musl* | newlib* | relibc* | uclibc*) 172776028eb6Smrg ;; 172876028eb6Smrg # Likewise for "kernel-abi" 172976028eb6Smrg eabi* | gnueabi*) 173076028eb6Smrg ;; 173176028eb6Smrg # VxWorks passes extra cpu info in the 4th filed. 173276028eb6Smrg simlinux | simwindows | spe) 173376028eb6Smrg ;; 1734e1db7cd1Smrg # See `case $cpu-$os` validation below 1735e1db7cd1Smrg ghcjs) 1736e1db7cd1Smrg ;; 173776028eb6Smrg # Now accept the basic system types. 173876028eb6Smrg # The portable systems comes first. 173976028eb6Smrg # Each alternative MUST end in a * to match a version number. 174076028eb6Smrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 174176028eb6Smrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 174276028eb6Smrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 174376028eb6Smrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 174476028eb6Smrg | hiux* | abug | nacl* | netware* | windows* \ 1745e1db7cd1Smrg | os9* | macos* | osx* | ios* | tvos* | watchos* \ 174676028eb6Smrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 174776028eb6Smrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 174876028eb6Smrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 174976028eb6Smrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 175076028eb6Smrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 175176028eb6Smrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 175276028eb6Smrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 175376028eb6Smrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1754e1db7cd1Smrg | bosx* | nextstep* | cxux* | oabi* \ 1755e1db7cd1Smrg | ptx* | ecoff* | winnt* | domain* | vsta* \ 175676028eb6Smrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 175776028eb6Smrg | chorusrdb* | cegcc* | glidix* | serenity* \ 1758e1db7cd1Smrg | cygwin* | msys* | moss* | proelf* | rtems* \ 175976028eb6Smrg | midipix* | mingw32* | mingw64* | mint* \ 176076028eb6Smrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 176176028eb6Smrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 176276028eb6Smrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 176376028eb6Smrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 176476028eb6Smrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 176576028eb6Smrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 176676028eb6Smrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 176776028eb6Smrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 176876028eb6Smrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 176976028eb6Smrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1770e1db7cd1Smrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1771e1db7cd1Smrg | fiwix* | mlibc* | cos* | mbr* | ironclad* ) 177276028eb6Smrg ;; 177376028eb6Smrg # This one is extra strict with allowed versions 177476028eb6Smrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 177576028eb6Smrg # Don't forget version if it is 3.2v4 or newer. 177676028eb6Smrg ;; 1777e1db7cd1Smrg # This refers to builds using the UEFI calling convention 1778e1db7cd1Smrg # (which depends on the architecture) and PE file format. 1779e1db7cd1Smrg # Note that this is both a different calling convention and 1780e1db7cd1Smrg # different file format than that of GNU-EFI 1781e1db7cd1Smrg # (x86_64-w64-mingw32). 1782e1db7cd1Smrg uefi) 1783e1db7cd1Smrg ;; 178476028eb6Smrg none) 178576028eb6Smrg ;; 1786e1db7cd1Smrg kernel* | msvc* ) 1787e1db7cd1Smrg # Restricted further below 1788e1db7cd1Smrg ;; 1789e1db7cd1Smrg '') 1790e1db7cd1Smrg if test x"$obj" = x 1791e1db7cd1Smrg then 1792e1db7cd1Smrg echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 1793e1db7cd1Smrg fi 1794e1db7cd1Smrg ;; 179576028eb6Smrg *) 1796e1db7cd1Smrg echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 1797e1db7cd1Smrg exit 1 1798e1db7cd1Smrg ;; 1799e1db7cd1Smrgesac 1800e1db7cd1Smrg 1801e1db7cd1Smrgcase $obj in 1802e1db7cd1Smrg aout* | coff* | elf* | pe*) 1803e1db7cd1Smrg ;; 1804e1db7cd1Smrg '') 1805e1db7cd1Smrg # empty is fine 1806e1db7cd1Smrg ;; 1807e1db7cd1Smrg *) 1808e1db7cd1Smrg echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 1809e1db7cd1Smrg exit 1 1810e1db7cd1Smrg ;; 1811e1db7cd1Smrgesac 1812e1db7cd1Smrg 1813e1db7cd1Smrg# Here we handle the constraint that a (synthetic) cpu and os are 1814e1db7cd1Smrg# valid only in combination with each other and nowhere else. 1815e1db7cd1Smrgcase $cpu-$os in 1816e1db7cd1Smrg # The "javascript-unknown-ghcjs" triple is used by GHC; we 1817e1db7cd1Smrg # accept it here in order to tolerate that, but reject any 1818e1db7cd1Smrg # variations. 1819e1db7cd1Smrg javascript-ghcjs) 1820e1db7cd1Smrg ;; 1821e1db7cd1Smrg javascript-* | *-ghcjs) 1822e1db7cd1Smrg echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 182376028eb6Smrg exit 1 182476028eb6Smrg ;; 182576028eb6Smrgesac 182676028eb6Smrg 182776028eb6Smrg# As a final step for OS-related things, validate the OS-kernel combination 182876028eb6Smrg# (given a valid OS), if there is a kernel. 1829e1db7cd1Smrgcase $kernel-$os-$obj in 1830e1db7cd1Smrg linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ 1831e1db7cd1Smrg | linux-mlibc*- | linux-musl*- | linux-newlib*- \ 1832e1db7cd1Smrg | linux-relibc*- | linux-uclibc*- ) 1833e1db7cd1Smrg ;; 1834e1db7cd1Smrg uclinux-uclibc*- ) 1835e1db7cd1Smrg ;; 1836e1db7cd1Smrg managarm-mlibc*- | managarm-kernel*- ) 183776028eb6Smrg ;; 1838e1db7cd1Smrg windows*-msvc*-) 183976028eb6Smrg ;; 1840e1db7cd1Smrg -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ 1841e1db7cd1Smrg | -uclibc*- ) 184276028eb6Smrg # These are just libc implementations, not actual OSes, and thus 184376028eb6Smrg # require a kernel. 1844e1db7cd1Smrg echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 184576028eb6Smrg exit 1 184676028eb6Smrg ;; 1847e1db7cd1Smrg -kernel*- ) 1848e1db7cd1Smrg echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 1849e1db7cd1Smrg exit 1 185076028eb6Smrg ;; 1851e1db7cd1Smrg *-kernel*- ) 1852e1db7cd1Smrg echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 1853e1db7cd1Smrg exit 1 185476028eb6Smrg ;; 1855e1db7cd1Smrg *-msvc*- ) 1856e1db7cd1Smrg echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 1857e1db7cd1Smrg exit 1 185876028eb6Smrg ;; 1859e1db7cd1Smrg kfreebsd*-gnu*- | kopensolaris*-gnu*-) 1860e1db7cd1Smrg ;; 1861e1db7cd1Smrg vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) 1862e1db7cd1Smrg ;; 1863e1db7cd1Smrg nto-qnx*-) 1864e1db7cd1Smrg ;; 1865e1db7cd1Smrg os2-emx-) 186676028eb6Smrg ;; 1867e1db7cd1Smrg *-eabi*- | *-gnueabi*-) 186876028eb6Smrg ;; 1869e1db7cd1Smrg none--*) 1870e1db7cd1Smrg # None (no kernel, i.e. freestanding / bare metal), 1871e1db7cd1Smrg # can be paired with an machine code file format 1872e1db7cd1Smrg ;; 1873e1db7cd1Smrg -*-) 187476028eb6Smrg # Blank kernel with real OS is always fine. 187576028eb6Smrg ;; 1876e1db7cd1Smrg --*) 1877e1db7cd1Smrg # Blank kernel and OS with real machine code file format is always fine. 1878e1db7cd1Smrg ;; 1879e1db7cd1Smrg *-*-*) 1880e1db7cd1Smrg echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 188176028eb6Smrg exit 1 188276028eb6Smrg ;; 188376028eb6Smrgesac 188476028eb6Smrg 1885bbe1b32bSmrg# Here we handle the case where we know the os, and the CPU type, but not the 1886bbe1b32bSmrg# manufacturer. We pick the logical manufacturer. 188776028eb6Smrgcase $vendor in 188876028eb6Smrg unknown) 188976028eb6Smrg case $cpu-$os in 189076028eb6Smrg *-riscix*) 1891bbe1b32bSmrg vendor=acorn 1892bbe1b32bSmrg ;; 189376028eb6Smrg *-sunos*) 1894bbe1b32bSmrg vendor=sun 1895bbe1b32bSmrg ;; 189676028eb6Smrg *-cnk* | *-aix*) 1897bbe1b32bSmrg vendor=ibm 1898bbe1b32bSmrg ;; 189976028eb6Smrg *-beos*) 1900bbe1b32bSmrg vendor=be 1901bbe1b32bSmrg ;; 190276028eb6Smrg *-hpux*) 1903bbe1b32bSmrg vendor=hp 1904bbe1b32bSmrg ;; 190576028eb6Smrg *-mpeix*) 1906bbe1b32bSmrg vendor=hp 1907bbe1b32bSmrg ;; 190876028eb6Smrg *-hiux*) 1909bbe1b32bSmrg vendor=hitachi 1910bbe1b32bSmrg ;; 191176028eb6Smrg *-unos*) 1912bbe1b32bSmrg vendor=crds 1913bbe1b32bSmrg ;; 191476028eb6Smrg *-dgux*) 1915bbe1b32bSmrg vendor=dg 1916bbe1b32bSmrg ;; 191776028eb6Smrg *-luna*) 1918bbe1b32bSmrg vendor=omron 1919bbe1b32bSmrg ;; 192076028eb6Smrg *-genix*) 1921bbe1b32bSmrg vendor=ns 1922bbe1b32bSmrg ;; 192376028eb6Smrg *-clix*) 192476028eb6Smrg vendor=intergraph 192576028eb6Smrg ;; 192676028eb6Smrg *-mvs* | *-opened*) 192776028eb6Smrg vendor=ibm 192876028eb6Smrg ;; 192976028eb6Smrg *-os400*) 1930bbe1b32bSmrg vendor=ibm 1931bbe1b32bSmrg ;; 193276028eb6Smrg s390-* | s390x-*) 1933bbe1b32bSmrg vendor=ibm 1934bbe1b32bSmrg ;; 193576028eb6Smrg *-ptx*) 1936bbe1b32bSmrg vendor=sequent 1937bbe1b32bSmrg ;; 193876028eb6Smrg *-tpf*) 1939bbe1b32bSmrg vendor=ibm 1940bbe1b32bSmrg ;; 194176028eb6Smrg *-vxsim* | *-vxworks* | *-windiss*) 1942bbe1b32bSmrg vendor=wrs 1943bbe1b32bSmrg ;; 194476028eb6Smrg *-aux*) 1945bbe1b32bSmrg vendor=apple 1946bbe1b32bSmrg ;; 194776028eb6Smrg *-hms*) 1948bbe1b32bSmrg vendor=hitachi 1949bbe1b32bSmrg ;; 195076028eb6Smrg *-mpw* | *-macos*) 1951bbe1b32bSmrg vendor=apple 1952bbe1b32bSmrg ;; 195376028eb6Smrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 1954bbe1b32bSmrg vendor=atari 1955bbe1b32bSmrg ;; 195676028eb6Smrg *-vos*) 1957bbe1b32bSmrg vendor=stratus 1958bbe1b32bSmrg ;; 1959bbe1b32bSmrg esac 1960bbe1b32bSmrg ;; 1961bbe1b32bSmrgesac 1962bbe1b32bSmrg 1963e1db7cd1Smrgecho "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" 1964bbe1b32bSmrgexit 1965bbe1b32bSmrg 1966bbe1b32bSmrg# Local variables: 196776028eb6Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 1968bbe1b32bSmrg# time-stamp-start: "timestamp='" 1969bbe1b32bSmrg# time-stamp-format: "%:y-%02m-%02d" 1970bbe1b32bSmrg# time-stamp-end: "'" 1971bbe1b32bSmrg# End: 1972