127702724Smrg#! /bin/sh 227702724Smrg# Configuration validation subroutine script. 3ae545d91Smrg# Copyright 1992-2024 Free Software Foundation, Inc. 427702724Smrg 595b7a5c8Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale 695b7a5c8Smrg 7ae545d91Smrgtimestamp='2024-01-01' 827702724Smrg 9313a12fdSmrg# This file is free software; you can redistribute it and/or modify it 10313a12fdSmrg# under the terms of the GNU General Public License as published by 11630e437aSmrg# the Free Software Foundation, either version 3 of the License, or 1227702724Smrg# (at your option) any later version. 1327702724Smrg# 14313a12fdSmrg# This program is distributed in the hope that it will be useful, but 15313a12fdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 16313a12fdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17313a12fdSmrg# General Public License for more details. 1827702724Smrg# 1927702724Smrg# You should have received a copy of the GNU General Public License 207cea3689Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 2127702724Smrg# 2227702724Smrg# As a special exception to the GNU General Public License, if you 2327702724Smrg# distribute this file as part of a program that contains a 2427702724Smrg# configuration script generated by Autoconf, you may include it under 25313a12fdSmrg# the same distribution terms that you use for the rest of that 26313a12fdSmrg# program. This Exception is an additional permission under section 7 27313a12fdSmrg# of the GNU General Public License, version 3 ("GPLv3"). 2827702724Smrg 2927702724Smrg 307cea3689Smrg# Please send patches to <config-patches@gnu.org>. 3127702724Smrg# 3227702724Smrg# Configuration subroutine to validate and canonicalize a configuration type. 3327702724Smrg# Supply the specified configuration type as an argument. 3427702724Smrg# If it is invalid, we print an error message on stderr and exit with code 1. 3527702724Smrg# Otherwise, we print the canonical config type on stdout and succeed. 3627702724Smrg 3700084f2cSmrg# You can get the latest version of this script from: 3895b7a5c8Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 3900084f2cSmrg 4027702724Smrg# This file is supposed to be the same for all GNU packages 4127702724Smrg# and recognize all the CPU types, system types and aliases 4227702724Smrg# that are meaningful with *any* GNU software. 4327702724Smrg# Each package is responsible for reporting which valid configurations 4427702724Smrg# it does not support. The user should be able to distinguish 4527702724Smrg# a failure to support a valid configuration from a meaningless 4627702724Smrg# configuration. 4727702724Smrg 4827702724Smrg# The goal of this file is to map all the various variations of a given 4927702724Smrg# machine specification into a single specification in the form: 5027702724Smrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 5127702724Smrg# or in some cases, the newer four-part form: 5227702724Smrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 5327702724Smrg# It is wrong to echo any other type of specification. 5427702724Smrg 5595b7a5c8Smrg# The "shellcheck disable" line above the timestamp inhibits complaints 5695b7a5c8Smrg# about features and limitations of the classic Bourne shell that were 5795b7a5c8Smrg# superseded or lifted in POSIX. However, this script identifies a wide 5895b7a5c8Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 5995b7a5c8Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still 6095b7a5c8Smrg# have a pre-POSIX /bin/sh. 6195b7a5c8Smrg 6227702724Smrgme=`echo "$0" | sed -e 's,.*/,,'` 6327702724Smrg 6427702724Smrgusage="\ 657cea3689SmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 6627702724Smrg 6727702724SmrgCanonicalize a configuration name. 6827702724Smrg 697cea3689SmrgOptions: 7027702724Smrg -h, --help print this help, then exit 7127702724Smrg -t, --time-stamp print date of last modification, then exit 7227702724Smrg -v, --version print version number, then exit 7327702724Smrg 7427702724SmrgReport bugs and patches to <config-patches@gnu.org>." 7527702724Smrg 7627702724Smrgversion="\ 7727702724SmrgGNU config.sub ($timestamp) 7827702724Smrg 79ae545d91SmrgCopyright 1992-2024 Free Software Foundation, Inc. 8027702724Smrg 8127702724SmrgThis is free software; see the source for copying conditions. There is NO 8227702724Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 8327702724Smrg 8427702724Smrghelp=" 85ae545d91SmrgTry '$me --help' for more information." 8627702724Smrg 8727702724Smrg# Parse command line 8827702724Smrgwhile test $# -gt 0 ; do 8927702724Smrg case $1 in 9027702724Smrg --time-stamp | --time* | -t ) 9127702724Smrg echo "$timestamp" ; exit ;; 9227702724Smrg --version | -v ) 9327702724Smrg echo "$version" ; exit ;; 9427702724Smrg --help | --h* | -h ) 9527702724Smrg echo "$usage"; exit ;; 9627702724Smrg -- ) # Stop option processing 9727702724Smrg shift; break ;; 9827702724Smrg - ) # Use stdin as input. 9927702724Smrg break ;; 10027702724Smrg -* ) 10195b7a5c8Smrg echo "$me: invalid option $1$help" >&2 10227702724Smrg exit 1 ;; 10327702724Smrg 10427702724Smrg *local*) 10527702724Smrg # First pass through any local machine types. 1067cea3689Smrg echo "$1" 10727702724Smrg exit ;; 10827702724Smrg 10927702724Smrg * ) 11027702724Smrg break ;; 11127702724Smrg esac 11227702724Smrgdone 11327702724Smrg 11427702724Smrgcase $# in 11527702724Smrg 0) echo "$me: missing argument$help" >&2 11627702724Smrg exit 1;; 11727702724Smrg 1) ;; 11827702724Smrg *) echo "$me: too many arguments$help" >&2 11927702724Smrg exit 1;; 12027702724Smrgesac 12127702724Smrg 12295b7a5c8Smrg# Split fields of configuration type 12395b7a5c8Smrg# shellcheck disable=SC2162 12495b7a5c8Smrgsaved_IFS=$IFS 12595b7a5c8SmrgIFS="-" read field1 field2 field3 field4 <<EOF 12695b7a5c8Smrg$1 12795b7a5c8SmrgEOF 12895b7a5c8SmrgIFS=$saved_IFS 12927702724Smrg 13095b7a5c8Smrg# Separate into logical components for further validation 13195b7a5c8Smrgcase $1 in 13295b7a5c8Smrg *-*-*-*-*) 133ae545d91Smrg echo "Invalid configuration '$1': more than four components" >&2 13495b7a5c8Smrg exit 1 135313a12fdSmrg ;; 13695b7a5c8Smrg *-*-*-*) 13795b7a5c8Smrg basic_machine=$field1-$field2 13895b7a5c8Smrg basic_os=$field3-$field4 13927702724Smrg ;; 14095b7a5c8Smrg *-*-*) 14195b7a5c8Smrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 14295b7a5c8Smrg # parts 14395b7a5c8Smrg maybe_os=$field2-$field3 14495b7a5c8Smrg case $maybe_os in 14595b7a5c8Smrg nto-qnx* | linux-* | uclinux-uclibc* \ 14695b7a5c8Smrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 14795b7a5c8Smrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148ae545d91Smrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ 149ae545d91Smrg | windows-* ) 15095b7a5c8Smrg basic_machine=$field1 15195b7a5c8Smrg basic_os=$maybe_os 15295b7a5c8Smrg ;; 15395b7a5c8Smrg android-linux) 15495b7a5c8Smrg basic_machine=$field1-unknown 15595b7a5c8Smrg basic_os=linux-android 15695b7a5c8Smrg ;; 15795b7a5c8Smrg *) 15895b7a5c8Smrg basic_machine=$field1-$field2 15995b7a5c8Smrg basic_os=$field3 16095b7a5c8Smrg ;; 16195b7a5c8Smrg esac 16227702724Smrg ;; 16395b7a5c8Smrg *-*) 16495b7a5c8Smrg # A lone config we happen to match not fitting any pattern 16595b7a5c8Smrg case $field1-$field2 in 16695b7a5c8Smrg decstation-3100) 16795b7a5c8Smrg basic_machine=mips-dec 16895b7a5c8Smrg basic_os= 16995b7a5c8Smrg ;; 17095b7a5c8Smrg *-*) 17195b7a5c8Smrg # Second component is usually, but not always the OS 17295b7a5c8Smrg case $field2 in 17395b7a5c8Smrg # Prevent following clause from handling this valid os 17495b7a5c8Smrg sun*os*) 17595b7a5c8Smrg basic_machine=$field1 17695b7a5c8Smrg basic_os=$field2 17795b7a5c8Smrg ;; 17895b7a5c8Smrg zephyr*) 17995b7a5c8Smrg basic_machine=$field1-unknown 18095b7a5c8Smrg basic_os=$field2 18195b7a5c8Smrg ;; 18295b7a5c8Smrg # Manufacturers 18395b7a5c8Smrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 18495b7a5c8Smrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 18595b7a5c8Smrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 18695b7a5c8Smrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 18795b7a5c8Smrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 18895b7a5c8Smrg | ultra | tti* | harris | dolphin | highlevel | gould \ 18995b7a5c8Smrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 19095b7a5c8Smrg | microblaze* | sim | cisco \ 19195b7a5c8Smrg | oki | wec | wrs | winbond) 19295b7a5c8Smrg basic_machine=$field1-$field2 19395b7a5c8Smrg basic_os= 19495b7a5c8Smrg ;; 19595b7a5c8Smrg *) 19695b7a5c8Smrg basic_machine=$field1 19795b7a5c8Smrg basic_os=$field2 19895b7a5c8Smrg ;; 19995b7a5c8Smrg esac 20095b7a5c8Smrg ;; 20195b7a5c8Smrg esac 20227702724Smrg ;; 20395b7a5c8Smrg *) 20495b7a5c8Smrg # Convert single-component short-hands not valid as part of 20595b7a5c8Smrg # multi-component configurations. 20695b7a5c8Smrg case $field1 in 20795b7a5c8Smrg 386bsd) 20895b7a5c8Smrg basic_machine=i386-pc 20995b7a5c8Smrg basic_os=bsd 21095b7a5c8Smrg ;; 21195b7a5c8Smrg a29khif) 21295b7a5c8Smrg basic_machine=a29k-amd 21395b7a5c8Smrg basic_os=udi 21495b7a5c8Smrg ;; 21595b7a5c8Smrg adobe68k) 21695b7a5c8Smrg basic_machine=m68010-adobe 21795b7a5c8Smrg basic_os=scout 21895b7a5c8Smrg ;; 21995b7a5c8Smrg alliant) 22095b7a5c8Smrg basic_machine=fx80-alliant 22195b7a5c8Smrg basic_os= 22295b7a5c8Smrg ;; 22395b7a5c8Smrg altos | altos3068) 22495b7a5c8Smrg basic_machine=m68k-altos 22595b7a5c8Smrg basic_os= 22695b7a5c8Smrg ;; 22795b7a5c8Smrg am29k) 22895b7a5c8Smrg basic_machine=a29k-none 22995b7a5c8Smrg basic_os=bsd 23095b7a5c8Smrg ;; 23195b7a5c8Smrg amdahl) 23295b7a5c8Smrg basic_machine=580-amdahl 23395b7a5c8Smrg basic_os=sysv 23495b7a5c8Smrg ;; 23595b7a5c8Smrg amiga) 23695b7a5c8Smrg basic_machine=m68k-unknown 23795b7a5c8Smrg basic_os= 23895b7a5c8Smrg ;; 23995b7a5c8Smrg amigaos | amigados) 24095b7a5c8Smrg basic_machine=m68k-unknown 24195b7a5c8Smrg basic_os=amigaos 24295b7a5c8Smrg ;; 24395b7a5c8Smrg amigaunix | amix) 24495b7a5c8Smrg basic_machine=m68k-unknown 24595b7a5c8Smrg basic_os=sysv4 24695b7a5c8Smrg ;; 24795b7a5c8Smrg apollo68) 24895b7a5c8Smrg basic_machine=m68k-apollo 24995b7a5c8Smrg basic_os=sysv 25095b7a5c8Smrg ;; 25195b7a5c8Smrg apollo68bsd) 25295b7a5c8Smrg basic_machine=m68k-apollo 25395b7a5c8Smrg basic_os=bsd 25495b7a5c8Smrg ;; 25595b7a5c8Smrg aros) 25695b7a5c8Smrg basic_machine=i386-pc 25795b7a5c8Smrg basic_os=aros 25895b7a5c8Smrg ;; 25995b7a5c8Smrg aux) 26095b7a5c8Smrg basic_machine=m68k-apple 26195b7a5c8Smrg basic_os=aux 26295b7a5c8Smrg ;; 26395b7a5c8Smrg balance) 26495b7a5c8Smrg basic_machine=ns32k-sequent 26595b7a5c8Smrg basic_os=dynix 26695b7a5c8Smrg ;; 26795b7a5c8Smrg blackfin) 26895b7a5c8Smrg basic_machine=bfin-unknown 26995b7a5c8Smrg basic_os=linux 27095b7a5c8Smrg ;; 27195b7a5c8Smrg cegcc) 27295b7a5c8Smrg basic_machine=arm-unknown 27395b7a5c8Smrg basic_os=cegcc 27495b7a5c8Smrg ;; 27595b7a5c8Smrg convex-c1) 27695b7a5c8Smrg basic_machine=c1-convex 27795b7a5c8Smrg basic_os=bsd 27895b7a5c8Smrg ;; 27995b7a5c8Smrg convex-c2) 28095b7a5c8Smrg basic_machine=c2-convex 28195b7a5c8Smrg basic_os=bsd 28295b7a5c8Smrg ;; 28395b7a5c8Smrg convex-c32) 28495b7a5c8Smrg basic_machine=c32-convex 28595b7a5c8Smrg basic_os=bsd 28695b7a5c8Smrg ;; 28795b7a5c8Smrg convex-c34) 28895b7a5c8Smrg basic_machine=c34-convex 28995b7a5c8Smrg basic_os=bsd 29095b7a5c8Smrg ;; 29195b7a5c8Smrg convex-c38) 29295b7a5c8Smrg basic_machine=c38-convex 29395b7a5c8Smrg basic_os=bsd 29495b7a5c8Smrg ;; 29595b7a5c8Smrg cray) 29695b7a5c8Smrg basic_machine=j90-cray 29795b7a5c8Smrg basic_os=unicos 29895b7a5c8Smrg ;; 29995b7a5c8Smrg crds | unos) 30095b7a5c8Smrg basic_machine=m68k-crds 30195b7a5c8Smrg basic_os= 30295b7a5c8Smrg ;; 30395b7a5c8Smrg da30) 30495b7a5c8Smrg basic_machine=m68k-da30 30595b7a5c8Smrg basic_os= 30695b7a5c8Smrg ;; 30795b7a5c8Smrg decstation | pmax | pmin | dec3100 | decstatn) 30895b7a5c8Smrg basic_machine=mips-dec 30995b7a5c8Smrg basic_os= 31095b7a5c8Smrg ;; 31195b7a5c8Smrg delta88) 31295b7a5c8Smrg basic_machine=m88k-motorola 31395b7a5c8Smrg basic_os=sysv3 31495b7a5c8Smrg ;; 31595b7a5c8Smrg dicos) 31695b7a5c8Smrg basic_machine=i686-pc 31795b7a5c8Smrg basic_os=dicos 31895b7a5c8Smrg ;; 31995b7a5c8Smrg djgpp) 32095b7a5c8Smrg basic_machine=i586-pc 32195b7a5c8Smrg basic_os=msdosdjgpp 32295b7a5c8Smrg ;; 32395b7a5c8Smrg ebmon29k) 32495b7a5c8Smrg basic_machine=a29k-amd 32595b7a5c8Smrg basic_os=ebmon 32695b7a5c8Smrg ;; 32795b7a5c8Smrg es1800 | OSE68k | ose68k | ose | OSE) 32895b7a5c8Smrg basic_machine=m68k-ericsson 32995b7a5c8Smrg basic_os=ose 33095b7a5c8Smrg ;; 33195b7a5c8Smrg gmicro) 33295b7a5c8Smrg basic_machine=tron-gmicro 33395b7a5c8Smrg basic_os=sysv 33495b7a5c8Smrg ;; 33595b7a5c8Smrg go32) 33695b7a5c8Smrg basic_machine=i386-pc 33795b7a5c8Smrg basic_os=go32 33895b7a5c8Smrg ;; 33995b7a5c8Smrg h8300hms) 34095b7a5c8Smrg basic_machine=h8300-hitachi 34195b7a5c8Smrg basic_os=hms 34295b7a5c8Smrg ;; 34395b7a5c8Smrg h8300xray) 34495b7a5c8Smrg basic_machine=h8300-hitachi 34595b7a5c8Smrg basic_os=xray 34695b7a5c8Smrg ;; 34795b7a5c8Smrg h8500hms) 34895b7a5c8Smrg basic_machine=h8500-hitachi 34995b7a5c8Smrg basic_os=hms 35095b7a5c8Smrg ;; 35195b7a5c8Smrg harris) 35295b7a5c8Smrg basic_machine=m88k-harris 35395b7a5c8Smrg basic_os=sysv3 35495b7a5c8Smrg ;; 35595b7a5c8Smrg hp300 | hp300hpux) 35695b7a5c8Smrg basic_machine=m68k-hp 35795b7a5c8Smrg basic_os=hpux 35895b7a5c8Smrg ;; 35995b7a5c8Smrg hp300bsd) 36095b7a5c8Smrg basic_machine=m68k-hp 36195b7a5c8Smrg basic_os=bsd 36295b7a5c8Smrg ;; 36395b7a5c8Smrg hppaosf) 36495b7a5c8Smrg basic_machine=hppa1.1-hp 36595b7a5c8Smrg basic_os=osf 36695b7a5c8Smrg ;; 36795b7a5c8Smrg hppro) 36895b7a5c8Smrg basic_machine=hppa1.1-hp 36995b7a5c8Smrg basic_os=proelf 37095b7a5c8Smrg ;; 37195b7a5c8Smrg i386mach) 37295b7a5c8Smrg basic_machine=i386-mach 37395b7a5c8Smrg basic_os=mach 37495b7a5c8Smrg ;; 37595b7a5c8Smrg isi68 | isi) 37695b7a5c8Smrg basic_machine=m68k-isi 37795b7a5c8Smrg basic_os=sysv 37895b7a5c8Smrg ;; 37995b7a5c8Smrg m68knommu) 38095b7a5c8Smrg basic_machine=m68k-unknown 38195b7a5c8Smrg basic_os=linux 38295b7a5c8Smrg ;; 38395b7a5c8Smrg magnum | m3230) 38495b7a5c8Smrg basic_machine=mips-mips 38595b7a5c8Smrg basic_os=sysv 38695b7a5c8Smrg ;; 38795b7a5c8Smrg merlin) 38895b7a5c8Smrg basic_machine=ns32k-utek 38995b7a5c8Smrg basic_os=sysv 39095b7a5c8Smrg ;; 39195b7a5c8Smrg mingw64) 39295b7a5c8Smrg basic_machine=x86_64-pc 39395b7a5c8Smrg basic_os=mingw64 39495b7a5c8Smrg ;; 39595b7a5c8Smrg mingw32) 39695b7a5c8Smrg basic_machine=i686-pc 39795b7a5c8Smrg basic_os=mingw32 39895b7a5c8Smrg ;; 39995b7a5c8Smrg mingw32ce) 40095b7a5c8Smrg basic_machine=arm-unknown 40195b7a5c8Smrg basic_os=mingw32ce 40295b7a5c8Smrg ;; 40395b7a5c8Smrg monitor) 40495b7a5c8Smrg basic_machine=m68k-rom68k 40595b7a5c8Smrg basic_os=coff 40695b7a5c8Smrg ;; 40795b7a5c8Smrg morphos) 40895b7a5c8Smrg basic_machine=powerpc-unknown 40995b7a5c8Smrg basic_os=morphos 41095b7a5c8Smrg ;; 41195b7a5c8Smrg moxiebox) 41295b7a5c8Smrg basic_machine=moxie-unknown 41395b7a5c8Smrg basic_os=moxiebox 41495b7a5c8Smrg ;; 41595b7a5c8Smrg msdos) 41695b7a5c8Smrg basic_machine=i386-pc 41795b7a5c8Smrg basic_os=msdos 41895b7a5c8Smrg ;; 41995b7a5c8Smrg msys) 42095b7a5c8Smrg basic_machine=i686-pc 42195b7a5c8Smrg basic_os=msys 42295b7a5c8Smrg ;; 42395b7a5c8Smrg mvs) 42495b7a5c8Smrg basic_machine=i370-ibm 42595b7a5c8Smrg basic_os=mvs 42695b7a5c8Smrg ;; 42795b7a5c8Smrg nacl) 42895b7a5c8Smrg basic_machine=le32-unknown 42995b7a5c8Smrg basic_os=nacl 43095b7a5c8Smrg ;; 43195b7a5c8Smrg ncr3000) 43295b7a5c8Smrg basic_machine=i486-ncr 43395b7a5c8Smrg basic_os=sysv4 43495b7a5c8Smrg ;; 43595b7a5c8Smrg netbsd386) 43695b7a5c8Smrg basic_machine=i386-pc 43795b7a5c8Smrg basic_os=netbsd 43895b7a5c8Smrg ;; 43995b7a5c8Smrg netwinder) 44095b7a5c8Smrg basic_machine=armv4l-rebel 44195b7a5c8Smrg basic_os=linux 44295b7a5c8Smrg ;; 44395b7a5c8Smrg news | news700 | news800 | news900) 44495b7a5c8Smrg basic_machine=m68k-sony 44595b7a5c8Smrg basic_os=newsos 44695b7a5c8Smrg ;; 44795b7a5c8Smrg news1000) 44895b7a5c8Smrg basic_machine=m68030-sony 44995b7a5c8Smrg basic_os=newsos 45095b7a5c8Smrg ;; 45195b7a5c8Smrg necv70) 45295b7a5c8Smrg basic_machine=v70-nec 45395b7a5c8Smrg basic_os=sysv 45495b7a5c8Smrg ;; 45595b7a5c8Smrg nh3000) 45695b7a5c8Smrg basic_machine=m68k-harris 45795b7a5c8Smrg basic_os=cxux 45895b7a5c8Smrg ;; 45995b7a5c8Smrg nh[45]000) 46095b7a5c8Smrg basic_machine=m88k-harris 46195b7a5c8Smrg basic_os=cxux 46295b7a5c8Smrg ;; 46395b7a5c8Smrg nindy960) 46495b7a5c8Smrg basic_machine=i960-intel 46595b7a5c8Smrg basic_os=nindy 46695b7a5c8Smrg ;; 46795b7a5c8Smrg mon960) 46895b7a5c8Smrg basic_machine=i960-intel 46995b7a5c8Smrg basic_os=mon960 47095b7a5c8Smrg ;; 47195b7a5c8Smrg nonstopux) 47295b7a5c8Smrg basic_machine=mips-compaq 47395b7a5c8Smrg basic_os=nonstopux 47495b7a5c8Smrg ;; 47595b7a5c8Smrg os400) 47695b7a5c8Smrg basic_machine=powerpc-ibm 47795b7a5c8Smrg basic_os=os400 47895b7a5c8Smrg ;; 47995b7a5c8Smrg OSE68000 | ose68000) 48095b7a5c8Smrg basic_machine=m68000-ericsson 48195b7a5c8Smrg basic_os=ose 48295b7a5c8Smrg ;; 48395b7a5c8Smrg os68k) 48495b7a5c8Smrg basic_machine=m68k-none 48595b7a5c8Smrg basic_os=os68k 48695b7a5c8Smrg ;; 48795b7a5c8Smrg paragon) 48895b7a5c8Smrg basic_machine=i860-intel 48995b7a5c8Smrg basic_os=osf 49095b7a5c8Smrg ;; 49195b7a5c8Smrg parisc) 49295b7a5c8Smrg basic_machine=hppa-unknown 49395b7a5c8Smrg basic_os=linux 49495b7a5c8Smrg ;; 49595b7a5c8Smrg psp) 49695b7a5c8Smrg basic_machine=mipsallegrexel-sony 49795b7a5c8Smrg basic_os=psp 49895b7a5c8Smrg ;; 49995b7a5c8Smrg pw32) 50095b7a5c8Smrg basic_machine=i586-unknown 50195b7a5c8Smrg basic_os=pw32 50295b7a5c8Smrg ;; 50395b7a5c8Smrg rdos | rdos64) 50495b7a5c8Smrg basic_machine=x86_64-pc 50595b7a5c8Smrg basic_os=rdos 50695b7a5c8Smrg ;; 50795b7a5c8Smrg rdos32) 50895b7a5c8Smrg basic_machine=i386-pc 50995b7a5c8Smrg basic_os=rdos 51095b7a5c8Smrg ;; 51195b7a5c8Smrg rom68k) 51295b7a5c8Smrg basic_machine=m68k-rom68k 51395b7a5c8Smrg basic_os=coff 51495b7a5c8Smrg ;; 51595b7a5c8Smrg sa29200) 51695b7a5c8Smrg basic_machine=a29k-amd 51795b7a5c8Smrg basic_os=udi 51895b7a5c8Smrg ;; 51995b7a5c8Smrg sei) 52095b7a5c8Smrg basic_machine=mips-sei 52195b7a5c8Smrg basic_os=seiux 52295b7a5c8Smrg ;; 52395b7a5c8Smrg sequent) 52495b7a5c8Smrg basic_machine=i386-sequent 52595b7a5c8Smrg basic_os= 52695b7a5c8Smrg ;; 52795b7a5c8Smrg sps7) 52895b7a5c8Smrg basic_machine=m68k-bull 52995b7a5c8Smrg basic_os=sysv2 53095b7a5c8Smrg ;; 53195b7a5c8Smrg st2000) 53295b7a5c8Smrg basic_machine=m68k-tandem 53395b7a5c8Smrg basic_os= 53495b7a5c8Smrg ;; 53595b7a5c8Smrg stratus) 53695b7a5c8Smrg basic_machine=i860-stratus 53795b7a5c8Smrg basic_os=sysv4 53895b7a5c8Smrg ;; 53995b7a5c8Smrg sun2) 54095b7a5c8Smrg basic_machine=m68000-sun 54195b7a5c8Smrg basic_os= 54295b7a5c8Smrg ;; 54395b7a5c8Smrg sun2os3) 54495b7a5c8Smrg basic_machine=m68000-sun 54595b7a5c8Smrg basic_os=sunos3 54695b7a5c8Smrg ;; 54795b7a5c8Smrg sun2os4) 54895b7a5c8Smrg basic_machine=m68000-sun 54995b7a5c8Smrg basic_os=sunos4 55095b7a5c8Smrg ;; 55195b7a5c8Smrg sun3) 55295b7a5c8Smrg basic_machine=m68k-sun 55395b7a5c8Smrg basic_os= 55495b7a5c8Smrg ;; 55595b7a5c8Smrg sun3os3) 55695b7a5c8Smrg basic_machine=m68k-sun 55795b7a5c8Smrg basic_os=sunos3 55895b7a5c8Smrg ;; 55995b7a5c8Smrg sun3os4) 56095b7a5c8Smrg basic_machine=m68k-sun 56195b7a5c8Smrg basic_os=sunos4 56295b7a5c8Smrg ;; 56395b7a5c8Smrg sun4) 56495b7a5c8Smrg basic_machine=sparc-sun 56595b7a5c8Smrg basic_os= 56695b7a5c8Smrg ;; 56795b7a5c8Smrg sun4os3) 56895b7a5c8Smrg basic_machine=sparc-sun 56995b7a5c8Smrg basic_os=sunos3 57095b7a5c8Smrg ;; 57195b7a5c8Smrg sun4os4) 57295b7a5c8Smrg basic_machine=sparc-sun 57395b7a5c8Smrg basic_os=sunos4 57495b7a5c8Smrg ;; 57595b7a5c8Smrg sun4sol2) 57695b7a5c8Smrg basic_machine=sparc-sun 57795b7a5c8Smrg basic_os=solaris2 57895b7a5c8Smrg ;; 57995b7a5c8Smrg sun386 | sun386i | roadrunner) 58095b7a5c8Smrg basic_machine=i386-sun 58195b7a5c8Smrg basic_os= 58295b7a5c8Smrg ;; 58395b7a5c8Smrg sv1) 58495b7a5c8Smrg basic_machine=sv1-cray 58595b7a5c8Smrg basic_os=unicos 58695b7a5c8Smrg ;; 58795b7a5c8Smrg symmetry) 58895b7a5c8Smrg basic_machine=i386-sequent 58995b7a5c8Smrg basic_os=dynix 59095b7a5c8Smrg ;; 59195b7a5c8Smrg t3e) 59295b7a5c8Smrg basic_machine=alphaev5-cray 59395b7a5c8Smrg basic_os=unicos 59495b7a5c8Smrg ;; 59595b7a5c8Smrg t90) 59695b7a5c8Smrg basic_machine=t90-cray 59795b7a5c8Smrg basic_os=unicos 59895b7a5c8Smrg ;; 59995b7a5c8Smrg toad1) 60095b7a5c8Smrg basic_machine=pdp10-xkl 60195b7a5c8Smrg basic_os=tops20 60295b7a5c8Smrg ;; 60395b7a5c8Smrg tpf) 60495b7a5c8Smrg basic_machine=s390x-ibm 60595b7a5c8Smrg basic_os=tpf 60695b7a5c8Smrg ;; 60795b7a5c8Smrg udi29k) 60895b7a5c8Smrg basic_machine=a29k-amd 60995b7a5c8Smrg basic_os=udi 61095b7a5c8Smrg ;; 61195b7a5c8Smrg ultra3) 61295b7a5c8Smrg basic_machine=a29k-nyu 61395b7a5c8Smrg basic_os=sym1 61495b7a5c8Smrg ;; 61595b7a5c8Smrg v810 | necv810) 61695b7a5c8Smrg basic_machine=v810-nec 61795b7a5c8Smrg basic_os=none 61895b7a5c8Smrg ;; 61995b7a5c8Smrg vaxv) 62095b7a5c8Smrg basic_machine=vax-dec 62195b7a5c8Smrg basic_os=sysv 62295b7a5c8Smrg ;; 62395b7a5c8Smrg vms) 62495b7a5c8Smrg basic_machine=vax-dec 62595b7a5c8Smrg basic_os=vms 62695b7a5c8Smrg ;; 62795b7a5c8Smrg vsta) 62895b7a5c8Smrg basic_machine=i386-pc 62995b7a5c8Smrg basic_os=vsta 63095b7a5c8Smrg ;; 63195b7a5c8Smrg vxworks960) 63295b7a5c8Smrg basic_machine=i960-wrs 63395b7a5c8Smrg basic_os=vxworks 63495b7a5c8Smrg ;; 63595b7a5c8Smrg vxworks68) 63695b7a5c8Smrg basic_machine=m68k-wrs 63795b7a5c8Smrg basic_os=vxworks 63895b7a5c8Smrg ;; 63995b7a5c8Smrg vxworks29k) 64095b7a5c8Smrg basic_machine=a29k-wrs 64195b7a5c8Smrg basic_os=vxworks 64295b7a5c8Smrg ;; 64395b7a5c8Smrg xbox) 64495b7a5c8Smrg basic_machine=i686-pc 64595b7a5c8Smrg basic_os=mingw32 64695b7a5c8Smrg ;; 64795b7a5c8Smrg ymp) 64895b7a5c8Smrg basic_machine=ymp-cray 64995b7a5c8Smrg basic_os=unicos 65095b7a5c8Smrg ;; 65195b7a5c8Smrg *) 65295b7a5c8Smrg basic_machine=$1 65395b7a5c8Smrg basic_os= 65495b7a5c8Smrg ;; 65595b7a5c8Smrg esac 65627702724Smrg ;; 65727702724Smrgesac 65827702724Smrg 65995b7a5c8Smrg# Decode 1-component or ad-hoc basic machines 66027702724Smrgcase $basic_machine in 66195b7a5c8Smrg # Here we handle the default manufacturer of certain CPU types. It is in 66295b7a5c8Smrg # some cases the only manufacturer, in others, it is the most popular. 66395b7a5c8Smrg w89k) 66495b7a5c8Smrg cpu=hppa1.1 66595b7a5c8Smrg vendor=winbond 6667cea3689Smrg ;; 66795b7a5c8Smrg op50n) 66895b7a5c8Smrg cpu=hppa1.1 66995b7a5c8Smrg vendor=oki 67027702724Smrg ;; 67195b7a5c8Smrg op60c) 67295b7a5c8Smrg cpu=hppa1.1 67395b7a5c8Smrg vendor=oki 67427702724Smrg ;; 67595b7a5c8Smrg ibm*) 67695b7a5c8Smrg cpu=i370 67795b7a5c8Smrg vendor=ibm 67827702724Smrg ;; 67995b7a5c8Smrg orion105) 68095b7a5c8Smrg cpu=clipper 68195b7a5c8Smrg vendor=highlevel 682313a12fdSmrg ;; 68395b7a5c8Smrg mac | mpw | mac-mpw) 68495b7a5c8Smrg cpu=m68k 68595b7a5c8Smrg vendor=apple 686313a12fdSmrg ;; 68795b7a5c8Smrg pmac | pmac-mpw) 68895b7a5c8Smrg cpu=powerpc 68995b7a5c8Smrg vendor=apple 690313a12fdSmrg ;; 691313a12fdSmrg 69227702724Smrg # Recognize the various machine names and aliases which stand 69327702724Smrg # for a CPU type and a company and sometimes even an OS. 69427702724Smrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 69595b7a5c8Smrg cpu=m68000 69695b7a5c8Smrg vendor=att 69727702724Smrg ;; 69827702724Smrg 3b*) 69995b7a5c8Smrg cpu=we32k 70095b7a5c8Smrg vendor=att 701e19dfac4Smrg ;; 70200084f2cSmrg bluegene*) 70395b7a5c8Smrg cpu=powerpc 70495b7a5c8Smrg vendor=ibm 70595b7a5c8Smrg basic_os=cnk 70627702724Smrg ;; 70727702724Smrg decsystem10* | dec10*) 70895b7a5c8Smrg cpu=pdp10 70995b7a5c8Smrg vendor=dec 71095b7a5c8Smrg basic_os=tops10 71127702724Smrg ;; 71227702724Smrg decsystem20* | dec20*) 71395b7a5c8Smrg cpu=pdp10 71495b7a5c8Smrg vendor=dec 71595b7a5c8Smrg basic_os=tops20 71627702724Smrg ;; 71727702724Smrg delta | 3300 | motorola-3300 | motorola-delta \ 71827702724Smrg | 3300-motorola | delta-motorola) 71995b7a5c8Smrg cpu=m68k 72095b7a5c8Smrg vendor=motorola 72127702724Smrg ;; 7227cea3689Smrg dpx2*) 72395b7a5c8Smrg cpu=m68k 72495b7a5c8Smrg vendor=bull 72595b7a5c8Smrg basic_os=sysv3 72627702724Smrg ;; 72727702724Smrg encore | umax | mmax) 72895b7a5c8Smrg cpu=ns32k 72995b7a5c8Smrg vendor=encore 73027702724Smrg ;; 73195b7a5c8Smrg elxsi) 73295b7a5c8Smrg cpu=elxsi 73395b7a5c8Smrg vendor=elxsi 73495b7a5c8Smrg basic_os=${basic_os:-bsd} 73527702724Smrg ;; 73627702724Smrg fx2800) 73795b7a5c8Smrg cpu=i860 73895b7a5c8Smrg vendor=alliant 73927702724Smrg ;; 74027702724Smrg genix) 74195b7a5c8Smrg cpu=ns32k 74295b7a5c8Smrg vendor=ns 74327702724Smrg ;; 74427702724Smrg h3050r* | hiux*) 74595b7a5c8Smrg cpu=hppa1.1 74695b7a5c8Smrg vendor=hitachi 74795b7a5c8Smrg basic_os=hiuxwe2 74827702724Smrg ;; 74927702724Smrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 75095b7a5c8Smrg cpu=hppa1.0 75195b7a5c8Smrg vendor=hp 75227702724Smrg ;; 75327702724Smrg hp9k2[0-9][0-9] | hp9k31[0-9]) 75495b7a5c8Smrg cpu=m68000 75595b7a5c8Smrg vendor=hp 75627702724Smrg ;; 75727702724Smrg hp9k3[2-9][0-9]) 75895b7a5c8Smrg cpu=m68k 75995b7a5c8Smrg vendor=hp 76027702724Smrg ;; 76127702724Smrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 76295b7a5c8Smrg cpu=hppa1.0 76395b7a5c8Smrg vendor=hp 76427702724Smrg ;; 76527702724Smrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 76695b7a5c8Smrg cpu=hppa1.1 76795b7a5c8Smrg vendor=hp 76827702724Smrg ;; 76927702724Smrg hp9k78[0-9] | hp78[0-9]) 77027702724Smrg # FIXME: really hppa2.0-hp 77195b7a5c8Smrg cpu=hppa1.1 77295b7a5c8Smrg vendor=hp 77327702724Smrg ;; 77427702724Smrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 77527702724Smrg # FIXME: really hppa2.0-hp 77695b7a5c8Smrg cpu=hppa1.1 77795b7a5c8Smrg vendor=hp 77827702724Smrg ;; 77927702724Smrg hp9k8[0-9][13679] | hp8[0-9][13679]) 78095b7a5c8Smrg cpu=hppa1.1 78195b7a5c8Smrg vendor=hp 78227702724Smrg ;; 78327702724Smrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 78495b7a5c8Smrg cpu=hppa1.0 78595b7a5c8Smrg vendor=hp 78627702724Smrg ;; 78727702724Smrg i*86v32) 78895b7a5c8Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 78995b7a5c8Smrg vendor=pc 79095b7a5c8Smrg basic_os=sysv32 79127702724Smrg ;; 79227702724Smrg i*86v4*) 79395b7a5c8Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79495b7a5c8Smrg vendor=pc 79595b7a5c8Smrg basic_os=sysv4 79627702724Smrg ;; 79727702724Smrg i*86v) 79895b7a5c8Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79995b7a5c8Smrg vendor=pc 80095b7a5c8Smrg basic_os=sysv 80127702724Smrg ;; 80227702724Smrg i*86sol2) 80395b7a5c8Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 80495b7a5c8Smrg vendor=pc 80595b7a5c8Smrg basic_os=solaris2 80627702724Smrg ;; 80795b7a5c8Smrg j90 | j90-cray) 80895b7a5c8Smrg cpu=j90 80995b7a5c8Smrg vendor=cray 81095b7a5c8Smrg basic_os=${basic_os:-unicos} 81127702724Smrg ;; 81227702724Smrg iris | iris4d) 81395b7a5c8Smrg cpu=mips 81495b7a5c8Smrg vendor=sgi 81595b7a5c8Smrg case $basic_os in 81695b7a5c8Smrg irix*) 81727702724Smrg ;; 81827702724Smrg *) 81995b7a5c8Smrg basic_os=irix4 82027702724Smrg ;; 82127702724Smrg esac 82227702724Smrg ;; 82327702724Smrg miniframe) 82495b7a5c8Smrg cpu=m68000 82595b7a5c8Smrg vendor=convergent 82627702724Smrg ;; 82795b7a5c8Smrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 82895b7a5c8Smrg cpu=m68k 82995b7a5c8Smrg vendor=atari 83095b7a5c8Smrg basic_os=mint 83127702724Smrg ;; 83227702724Smrg news-3600 | risc-news) 83395b7a5c8Smrg cpu=mips 83495b7a5c8Smrg vendor=sony 83595b7a5c8Smrg basic_os=newsos 83627702724Smrg ;; 8377cea3689Smrg next | m*-next) 83895b7a5c8Smrg cpu=m68k 83995b7a5c8Smrg vendor=next 84095b7a5c8Smrg case $basic_os in 84195b7a5c8Smrg openstep*) 84295b7a5c8Smrg ;; 84395b7a5c8Smrg nextstep*) 84427702724Smrg ;; 84595b7a5c8Smrg ns2*) 84695b7a5c8Smrg basic_os=nextstep2 84727702724Smrg ;; 84827702724Smrg *) 84995b7a5c8Smrg basic_os=nextstep3 85027702724Smrg ;; 85127702724Smrg esac 85227702724Smrg ;; 85327702724Smrg np1) 85495b7a5c8Smrg cpu=np1 85595b7a5c8Smrg vendor=gould 8567cea3689Smrg ;; 85727702724Smrg op50n-* | op60c-*) 85895b7a5c8Smrg cpu=hppa1.1 85995b7a5c8Smrg vendor=oki 86095b7a5c8Smrg basic_os=proelf 86127702724Smrg ;; 86227702724Smrg pa-hitachi) 86395b7a5c8Smrg cpu=hppa1.1 86495b7a5c8Smrg vendor=hitachi 86595b7a5c8Smrg basic_os=hiuxwe2 866e19dfac4Smrg ;; 86727702724Smrg pbd) 86895b7a5c8Smrg cpu=sparc 86995b7a5c8Smrg vendor=tti 87027702724Smrg ;; 87127702724Smrg pbb) 87295b7a5c8Smrg cpu=m68k 87395b7a5c8Smrg vendor=tti 87427702724Smrg ;; 87595b7a5c8Smrg pc532) 87695b7a5c8Smrg cpu=ns32k 87795b7a5c8Smrg vendor=pc532 87827702724Smrg ;; 87927702724Smrg pn) 88095b7a5c8Smrg cpu=pn 88195b7a5c8Smrg vendor=gould 88227702724Smrg ;; 88395b7a5c8Smrg power) 88495b7a5c8Smrg cpu=power 88595b7a5c8Smrg vendor=ibm 88627702724Smrg ;; 88795b7a5c8Smrg ps2) 88895b7a5c8Smrg cpu=i386 88995b7a5c8Smrg vendor=ibm 89027702724Smrg ;; 89195b7a5c8Smrg rm[46]00) 89295b7a5c8Smrg cpu=mips 89395b7a5c8Smrg vendor=siemens 89427702724Smrg ;; 89595b7a5c8Smrg rtpc | rtpc-*) 89695b7a5c8Smrg cpu=romp 89795b7a5c8Smrg vendor=ibm 89827702724Smrg ;; 89995b7a5c8Smrg sde) 90095b7a5c8Smrg cpu=mipsisa32 90195b7a5c8Smrg vendor=sde 90295b7a5c8Smrg basic_os=${basic_os:-elf} 90327702724Smrg ;; 90495b7a5c8Smrg simso-wrs) 90595b7a5c8Smrg cpu=sparclite 90695b7a5c8Smrg vendor=wrs 90795b7a5c8Smrg basic_os=vxworks 90827702724Smrg ;; 90995b7a5c8Smrg tower | tower-32) 91095b7a5c8Smrg cpu=m68k 91195b7a5c8Smrg vendor=ncr 91227702724Smrg ;; 91395b7a5c8Smrg vpp*|vx|vx-*) 91495b7a5c8Smrg cpu=f301 91595b7a5c8Smrg vendor=fujitsu 916313a12fdSmrg ;; 91795b7a5c8Smrg w65) 91895b7a5c8Smrg cpu=w65 91995b7a5c8Smrg vendor=wdc 92027702724Smrg ;; 92195b7a5c8Smrg w89k-*) 92295b7a5c8Smrg cpu=hppa1.1 92395b7a5c8Smrg vendor=winbond 92495b7a5c8Smrg basic_os=proelf 92527702724Smrg ;; 92695b7a5c8Smrg none) 92795b7a5c8Smrg cpu=none 92895b7a5c8Smrg vendor=none 92927702724Smrg ;; 93095b7a5c8Smrg leon|leon[3-9]) 93195b7a5c8Smrg cpu=sparc 93295b7a5c8Smrg vendor=$basic_machine 93327702724Smrg ;; 93495b7a5c8Smrg leon-*|leon[3-9]-*) 93595b7a5c8Smrg cpu=sparc 93695b7a5c8Smrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 93727702724Smrg ;; 93895b7a5c8Smrg 93995b7a5c8Smrg *-*) 94095b7a5c8Smrg # shellcheck disable=SC2162 94195b7a5c8Smrg saved_IFS=$IFS 94295b7a5c8Smrg IFS="-" read cpu vendor <<EOF 94395b7a5c8Smrg$basic_machine 94495b7a5c8SmrgEOF 94595b7a5c8Smrg IFS=$saved_IFS 94627702724Smrg ;; 947ae545d91Smrg # We use 'pc' rather than 'unknown' 94895b7a5c8Smrg # because (1) that's what they normally are, and 94995b7a5c8Smrg # (2) the word "unknown" tends to confuse beginning users. 95095b7a5c8Smrg i*86 | x86_64) 95195b7a5c8Smrg cpu=$basic_machine 95295b7a5c8Smrg vendor=pc 95327702724Smrg ;; 95495b7a5c8Smrg # These rules are duplicated from below for sake of the special case above; 95595b7a5c8Smrg # i.e. things that normalized to x86 arches should also default to "pc" 95695b7a5c8Smrg pc98) 95795b7a5c8Smrg cpu=i386 95895b7a5c8Smrg vendor=pc 95927702724Smrg ;; 96095b7a5c8Smrg x64 | amd64) 96195b7a5c8Smrg cpu=x86_64 96295b7a5c8Smrg vendor=pc 96327702724Smrg ;; 96495b7a5c8Smrg # Recognize the basic CPU types without company name. 96595b7a5c8Smrg *) 96695b7a5c8Smrg cpu=$basic_machine 96795b7a5c8Smrg vendor=unknown 968e19dfac4Smrg ;; 96995b7a5c8Smrgesac 97095b7a5c8Smrg 97195b7a5c8Smrgunset -v basic_machine 97295b7a5c8Smrg 97395b7a5c8Smrg# Decode basic machines in the full and proper CPU-Company form. 97495b7a5c8Smrgcase $cpu-$vendor in 97595b7a5c8Smrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 97695b7a5c8Smrg # some cases the only manufacturer, in others, it is the most popular. 97795b7a5c8Smrg craynv-unknown) 97895b7a5c8Smrg vendor=cray 97995b7a5c8Smrg basic_os=${basic_os:-unicosmp} 98027702724Smrg ;; 98195b7a5c8Smrg c90-unknown | c90-cray) 98295b7a5c8Smrg vendor=cray 98395b7a5c8Smrg basic_os=${Basic_os:-unicos} 98427702724Smrg ;; 98595b7a5c8Smrg fx80-unknown) 98695b7a5c8Smrg vendor=alliant 987e19dfac4Smrg ;; 98895b7a5c8Smrg romp-unknown) 98995b7a5c8Smrg vendor=ibm 99027702724Smrg ;; 99195b7a5c8Smrg mmix-unknown) 99295b7a5c8Smrg vendor=knuth 99327702724Smrg ;; 99495b7a5c8Smrg microblaze-unknown | microblazeel-unknown) 99595b7a5c8Smrg vendor=xilinx 99627702724Smrg ;; 99795b7a5c8Smrg rs6000-unknown) 99895b7a5c8Smrg vendor=ibm 99927702724Smrg ;; 100095b7a5c8Smrg vax-unknown) 100195b7a5c8Smrg vendor=dec 100227702724Smrg ;; 100395b7a5c8Smrg pdp11-unknown) 100495b7a5c8Smrg vendor=dec 1005313a12fdSmrg ;; 100695b7a5c8Smrg we32k-unknown) 100795b7a5c8Smrg vendor=att 100827702724Smrg ;; 100995b7a5c8Smrg cydra-unknown) 101095b7a5c8Smrg vendor=cydrome 101127702724Smrg ;; 101295b7a5c8Smrg i370-ibm*) 101395b7a5c8Smrg vendor=ibm 101427702724Smrg ;; 101595b7a5c8Smrg orion-unknown) 101695b7a5c8Smrg vendor=highlevel 101727702724Smrg ;; 101895b7a5c8Smrg xps-unknown | xps100-unknown) 101995b7a5c8Smrg cpu=xps100 102095b7a5c8Smrg vendor=honeywell 102127702724Smrg ;; 102295b7a5c8Smrg 102395b7a5c8Smrg # Here we normalize CPU types with a missing or matching vendor 1024630e437aSmrg armh-unknown | armh-alt) 1025630e437aSmrg cpu=armv7l 1026630e437aSmrg vendor=alt 1027630e437aSmrg basic_os=${basic_os:-linux-gnueabihf} 1028630e437aSmrg ;; 102995b7a5c8Smrg dpx20-unknown | dpx20-bull) 103095b7a5c8Smrg cpu=rs6000 103195b7a5c8Smrg vendor=bull 103295b7a5c8Smrg basic_os=${basic_os:-bosx} 103327702724Smrg ;; 103495b7a5c8Smrg 103595b7a5c8Smrg # Here we normalize CPU types irrespective of the vendor 103695b7a5c8Smrg amd64-*) 103795b7a5c8Smrg cpu=x86_64 103827702724Smrg ;; 103995b7a5c8Smrg blackfin-*) 104095b7a5c8Smrg cpu=bfin 104195b7a5c8Smrg basic_os=linux 104227702724Smrg ;; 104395b7a5c8Smrg c54x-*) 104495b7a5c8Smrg cpu=tic54x 104527702724Smrg ;; 104695b7a5c8Smrg c55x-*) 104795b7a5c8Smrg cpu=tic55x 104827702724Smrg ;; 104995b7a5c8Smrg c6x-*) 105095b7a5c8Smrg cpu=tic6x 105127702724Smrg ;; 105295b7a5c8Smrg e500v[12]-*) 105395b7a5c8Smrg cpu=powerpc 105495b7a5c8Smrg basic_os=${basic_os}"spe" 105527702724Smrg ;; 105695b7a5c8Smrg mips3*-*) 105795b7a5c8Smrg cpu=mips64 105827702724Smrg ;; 105995b7a5c8Smrg ms1-*) 106095b7a5c8Smrg cpu=mt 106127702724Smrg ;; 106295b7a5c8Smrg m68knommu-*) 106395b7a5c8Smrg cpu=m68k 106495b7a5c8Smrg basic_os=linux 106527702724Smrg ;; 106695b7a5c8Smrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 106795b7a5c8Smrg cpu=s12z 1068e19dfac4Smrg ;; 106995b7a5c8Smrg openrisc-*) 107095b7a5c8Smrg cpu=or32 107127702724Smrg ;; 107295b7a5c8Smrg parisc-*) 107395b7a5c8Smrg cpu=hppa 107495b7a5c8Smrg basic_os=linux 107527702724Smrg ;; 107695b7a5c8Smrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 107795b7a5c8Smrg cpu=i586 107827702724Smrg ;; 1079ae545d91Smrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 108095b7a5c8Smrg cpu=i686 108127702724Smrg ;; 108295b7a5c8Smrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 108395b7a5c8Smrg cpu=i686 108427702724Smrg ;; 108595b7a5c8Smrg pentium4-*) 108695b7a5c8Smrg cpu=i786 108727702724Smrg ;; 108895b7a5c8Smrg pc98-*) 108995b7a5c8Smrg cpu=i386 109027702724Smrg ;; 109195b7a5c8Smrg ppc-* | ppcbe-*) 109295b7a5c8Smrg cpu=powerpc 109327702724Smrg ;; 109495b7a5c8Smrg ppcle-* | powerpclittle-*) 109595b7a5c8Smrg cpu=powerpcle 109627702724Smrg ;; 109795b7a5c8Smrg ppc64-*) 109895b7a5c8Smrg cpu=powerpc64 109927702724Smrg ;; 110095b7a5c8Smrg ppc64le-* | powerpc64little-*) 110195b7a5c8Smrg cpu=powerpc64le 110227702724Smrg ;; 110395b7a5c8Smrg sb1-*) 110495b7a5c8Smrg cpu=mipsisa64sb1 110527702724Smrg ;; 110695b7a5c8Smrg sb1el-*) 110795b7a5c8Smrg cpu=mipsisa64sb1el 110827702724Smrg ;; 110995b7a5c8Smrg sh5e[lb]-*) 111095b7a5c8Smrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 111127702724Smrg ;; 111295b7a5c8Smrg spur-*) 111395b7a5c8Smrg cpu=spur 111427702724Smrg ;; 111595b7a5c8Smrg strongarm-* | thumb-*) 111695b7a5c8Smrg cpu=arm 111727702724Smrg ;; 111895b7a5c8Smrg tx39-*) 111995b7a5c8Smrg cpu=mipstx39 11207cea3689Smrg ;; 112195b7a5c8Smrg tx39el-*) 112295b7a5c8Smrg cpu=mipstx39el 112327702724Smrg ;; 112495b7a5c8Smrg x64-*) 112595b7a5c8Smrg cpu=x86_64 112627702724Smrg ;; 1127313a12fdSmrg xscale-* | xscalee[bl]-*) 112895b7a5c8Smrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 112927702724Smrg ;; 1130630e437aSmrg arm64-* | aarch64le-*) 113195b7a5c8Smrg cpu=aarch64 113227702724Smrg ;; 113327702724Smrg 113495b7a5c8Smrg # Recognize the canonical CPU Types that limit and/or modify the 113595b7a5c8Smrg # company names they are paired with. 113695b7a5c8Smrg cr16-*) 113795b7a5c8Smrg basic_os=${basic_os:-elf} 113827702724Smrg ;; 113995b7a5c8Smrg crisv32-* | etraxfs*-*) 114095b7a5c8Smrg cpu=crisv32 114195b7a5c8Smrg vendor=axis 114227702724Smrg ;; 114395b7a5c8Smrg cris-* | etrax*-*) 114495b7a5c8Smrg cpu=cris 114595b7a5c8Smrg vendor=axis 114627702724Smrg ;; 114795b7a5c8Smrg crx-*) 114895b7a5c8Smrg basic_os=${basic_os:-elf} 114927702724Smrg ;; 115095b7a5c8Smrg neo-tandem) 115195b7a5c8Smrg cpu=neo 115295b7a5c8Smrg vendor=tandem 115327702724Smrg ;; 115495b7a5c8Smrg nse-tandem) 115595b7a5c8Smrg cpu=nse 115695b7a5c8Smrg vendor=tandem 115727702724Smrg ;; 115895b7a5c8Smrg nsr-tandem) 115995b7a5c8Smrg cpu=nsr 116095b7a5c8Smrg vendor=tandem 116127702724Smrg ;; 116295b7a5c8Smrg nsv-tandem) 116395b7a5c8Smrg cpu=nsv 116495b7a5c8Smrg vendor=tandem 116527702724Smrg ;; 116695b7a5c8Smrg nsx-tandem) 116795b7a5c8Smrg cpu=nsx 116895b7a5c8Smrg vendor=tandem 116927702724Smrg ;; 117095b7a5c8Smrg mipsallegrexel-sony) 117195b7a5c8Smrg cpu=mipsallegrexel 117295b7a5c8Smrg vendor=sony 117327702724Smrg ;; 117495b7a5c8Smrg tile*-*) 117595b7a5c8Smrg basic_os=${basic_os:-linux-gnu} 117627702724Smrg ;; 117795b7a5c8Smrg 117827702724Smrg *) 117995b7a5c8Smrg # Recognize the canonical CPU types that are allowed with any 118095b7a5c8Smrg # company name. 118195b7a5c8Smrg case $cpu in 118295b7a5c8Smrg 1750a | 580 \ 118395b7a5c8Smrg | a29k \ 1184ae545d91Smrg | aarch64 | aarch64_be | aarch64c | arm64ec \ 118595b7a5c8Smrg | abacus \ 118695b7a5c8Smrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 118795b7a5c8Smrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 118895b7a5c8Smrg | alphapca5[67] | alpha64pca5[67] \ 118995b7a5c8Smrg | am33_2.0 \ 119095b7a5c8Smrg | amdgcn \ 119195b7a5c8Smrg | arc | arceb | arc32 | arc64 \ 119295b7a5c8Smrg | arm | arm[lb]e | arme[lb] | armv* \ 119395b7a5c8Smrg | avr | avr32 \ 119495b7a5c8Smrg | asmjs \ 119595b7a5c8Smrg | ba \ 119695b7a5c8Smrg | be32 | be64 \ 119795b7a5c8Smrg | bfin | bpf | bs2000 \ 119895b7a5c8Smrg | c[123]* | c30 | [cjt]90 | c4x \ 119995b7a5c8Smrg | c8051 | clipper | craynv | csky | cydra \ 120095b7a5c8Smrg | d10v | d30v | dlx | dsp16xx \ 120195b7a5c8Smrg | e2k | elxsi | epiphany \ 120295b7a5c8Smrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1203ae545d91Smrg | javascript \ 120495b7a5c8Smrg | h8300 | h8500 \ 120595b7a5c8Smrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 120695b7a5c8Smrg | hexagon \ 120795b7a5c8Smrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 120895b7a5c8Smrg | ip2k | iq2000 \ 120995b7a5c8Smrg | k1om \ 1210ae545d91Smrg | kvx \ 121195b7a5c8Smrg | le32 | le64 \ 121295b7a5c8Smrg | lm32 \ 1213630e437aSmrg | loongarch32 | loongarch64 \ 121495b7a5c8Smrg | m32c | m32r | m32rle \ 121595b7a5c8Smrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 121695b7a5c8Smrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 121795b7a5c8Smrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 121895b7a5c8Smrg | microblaze | microblazeel \ 1219ae545d91Smrg | mips* \ 122095b7a5c8Smrg | mmix \ 122195b7a5c8Smrg | mn10200 | mn10300 \ 122295b7a5c8Smrg | moxie \ 122395b7a5c8Smrg | mt \ 122495b7a5c8Smrg | msp430 \ 1225ae545d91Smrg | nanomips* \ 122695b7a5c8Smrg | nds32 | nds32le | nds32be \ 122795b7a5c8Smrg | nfp \ 122895b7a5c8Smrg | nios | nios2 | nios2eb | nios2el \ 122995b7a5c8Smrg | none | np1 | ns16k | ns32k | nvptx \ 123095b7a5c8Smrg | open8 \ 123195b7a5c8Smrg | or1k* \ 123295b7a5c8Smrg | or32 \ 123395b7a5c8Smrg | orion \ 123495b7a5c8Smrg | picochip \ 123595b7a5c8Smrg | pdp10 | pdp11 | pj | pjl | pn | power \ 123695b7a5c8Smrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 123795b7a5c8Smrg | pru \ 123895b7a5c8Smrg | pyramid \ 123995b7a5c8Smrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 124095b7a5c8Smrg | rl78 | romp | rs6000 | rx \ 124195b7a5c8Smrg | s390 | s390x \ 124295b7a5c8Smrg | score \ 124395b7a5c8Smrg | sh | shl \ 124495b7a5c8Smrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 124595b7a5c8Smrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 124695b7a5c8Smrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 124795b7a5c8Smrg | sparclite \ 124895b7a5c8Smrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 124995b7a5c8Smrg | spu \ 125095b7a5c8Smrg | tahoe \ 125195b7a5c8Smrg | thumbv7* \ 125295b7a5c8Smrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 125395b7a5c8Smrg | tron \ 125495b7a5c8Smrg | ubicom32 \ 125595b7a5c8Smrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 125695b7a5c8Smrg | vax \ 1257ae545d91Smrg | vc4 \ 125895b7a5c8Smrg | visium \ 125995b7a5c8Smrg | w65 \ 126095b7a5c8Smrg | wasm32 | wasm64 \ 126195b7a5c8Smrg | we32k \ 126295b7a5c8Smrg | x86 | x86_64 | xc16x | xgate | xps100 \ 126395b7a5c8Smrg | xstormy16 | xtensa* \ 126495b7a5c8Smrg | ymp \ 126595b7a5c8Smrg | z8k | z80) 126695b7a5c8Smrg ;; 126795b7a5c8Smrg 126895b7a5c8Smrg *) 1269ae545d91Smrg echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 127095b7a5c8Smrg exit 1 127195b7a5c8Smrg ;; 127295b7a5c8Smrg esac 127327702724Smrg ;; 127427702724Smrgesac 127527702724Smrg 127627702724Smrg# Here we canonicalize certain aliases for manufacturers. 127795b7a5c8Smrgcase $vendor in 127895b7a5c8Smrg digital*) 127995b7a5c8Smrg vendor=dec 128027702724Smrg ;; 128195b7a5c8Smrg commodore*) 128295b7a5c8Smrg vendor=cbm 128327702724Smrg ;; 128427702724Smrg *) 128527702724Smrg ;; 128627702724Smrgesac 128727702724Smrg 128827702724Smrg# Decode manufacturer-specific aliases for certain operating systems. 128927702724Smrg 1290ae545d91Smrgif test x"$basic_os" != x 129127702724Smrgthen 129295b7a5c8Smrg 1293630e437aSmrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 129495b7a5c8Smrg# set os. 1295ae545d91Smrgobj= 129695b7a5c8Smrgcase $basic_os in 129795b7a5c8Smrg gnu/linux*) 129895b7a5c8Smrg kernel=linux 129995b7a5c8Smrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 130095b7a5c8Smrg ;; 130195b7a5c8Smrg os2-emx) 130295b7a5c8Smrg kernel=os2 130395b7a5c8Smrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 130495b7a5c8Smrg ;; 130595b7a5c8Smrg nto-qnx*) 130695b7a5c8Smrg kernel=nto 130795b7a5c8Smrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 130895b7a5c8Smrg ;; 130995b7a5c8Smrg *-*) 131095b7a5c8Smrg # shellcheck disable=SC2162 131195b7a5c8Smrg saved_IFS=$IFS 131295b7a5c8Smrg IFS="-" read kernel os <<EOF 131395b7a5c8Smrg$basic_os 131495b7a5c8SmrgEOF 131595b7a5c8Smrg IFS=$saved_IFS 131695b7a5c8Smrg ;; 131795b7a5c8Smrg # Default OS when just kernel was specified 131895b7a5c8Smrg nto*) 131995b7a5c8Smrg kernel=nto 132095b7a5c8Smrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 132195b7a5c8Smrg ;; 132295b7a5c8Smrg linux*) 132395b7a5c8Smrg kernel=linux 132495b7a5c8Smrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 132595b7a5c8Smrg ;; 1326630e437aSmrg managarm*) 1327630e437aSmrg kernel=managarm 1328630e437aSmrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 1329630e437aSmrg ;; 133095b7a5c8Smrg *) 133195b7a5c8Smrg kernel= 133295b7a5c8Smrg os=$basic_os 133395b7a5c8Smrg ;; 133495b7a5c8Smrgesac 133595b7a5c8Smrg 133695b7a5c8Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 133795b7a5c8Smrg# etc.) 133827702724Smrgcase $os in 13397cea3689Smrg # First match some system type aliases that might get confused 13407cea3689Smrg # with valid system types. 134195b7a5c8Smrg # solaris* is a basic system type, with this one exception. 134295b7a5c8Smrg auroraux) 134395b7a5c8Smrg os=auroraux 134400084f2cSmrg ;; 134595b7a5c8Smrg bluegene*) 134695b7a5c8Smrg os=cnk 134727702724Smrg ;; 134895b7a5c8Smrg solaris1 | solaris1.*) 134995b7a5c8Smrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 135027702724Smrg ;; 135195b7a5c8Smrg solaris) 135295b7a5c8Smrg os=solaris2 135327702724Smrg ;; 135495b7a5c8Smrg unixware*) 135595b7a5c8Smrg os=sysv4.2uw 135627702724Smrg ;; 13577cea3689Smrg # es1800 is here to avoid being matched by es* (a different OS) 135895b7a5c8Smrg es1800*) 135995b7a5c8Smrg os=ose 13607cea3689Smrg ;; 136195b7a5c8Smrg # Some version numbers need modification 136295b7a5c8Smrg chorusos*) 136395b7a5c8Smrg os=chorusos 136427702724Smrg ;; 136595b7a5c8Smrg isc) 136695b7a5c8Smrg os=isc2.2 136727702724Smrg ;; 136895b7a5c8Smrg sco6) 136995b7a5c8Smrg os=sco5v6 137027702724Smrg ;; 137195b7a5c8Smrg sco5) 137295b7a5c8Smrg os=sco3.2v5 137327702724Smrg ;; 137495b7a5c8Smrg sco4) 137595b7a5c8Smrg os=sco3.2v4 137627702724Smrg ;; 137795b7a5c8Smrg sco3.2.[4-9]*) 137895b7a5c8Smrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 137927702724Smrg ;; 138095b7a5c8Smrg sco*v* | scout) 138195b7a5c8Smrg # Don't match below 138227702724Smrg ;; 138395b7a5c8Smrg sco*) 138495b7a5c8Smrg os=sco3.2v2 138527702724Smrg ;; 138695b7a5c8Smrg psos*) 138795b7a5c8Smrg os=psos 138827702724Smrg ;; 138995b7a5c8Smrg qnx*) 139095b7a5c8Smrg os=qnx 139127702724Smrg ;; 139295b7a5c8Smrg hiux*) 139395b7a5c8Smrg os=hiuxwe2 139427702724Smrg ;; 139595b7a5c8Smrg lynx*178) 139695b7a5c8Smrg os=lynxos178 139727702724Smrg ;; 139895b7a5c8Smrg lynx*5) 139995b7a5c8Smrg os=lynxos5 140027702724Smrg ;; 140195b7a5c8Smrg lynxos*) 140295b7a5c8Smrg # don't get caught up in next wildcard 140327702724Smrg ;; 140495b7a5c8Smrg lynx*) 140595b7a5c8Smrg os=lynxos 140627702724Smrg ;; 140795b7a5c8Smrg mac[0-9]*) 140895b7a5c8Smrg os=`echo "$os" | sed -e 's|mac|macos|'` 140927702724Smrg ;; 141095b7a5c8Smrg opened*) 141195b7a5c8Smrg os=openedition 141227702724Smrg ;; 141395b7a5c8Smrg os400*) 141495b7a5c8Smrg os=os400 141527702724Smrg ;; 141695b7a5c8Smrg sunos5*) 141795b7a5c8Smrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 141827702724Smrg ;; 141995b7a5c8Smrg sunos6*) 142095b7a5c8Smrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 142127702724Smrg ;; 142295b7a5c8Smrg wince*) 142395b7a5c8Smrg os=wince 142427702724Smrg ;; 142595b7a5c8Smrg utek*) 142695b7a5c8Smrg os=bsd 142727702724Smrg ;; 142895b7a5c8Smrg dynix*) 142995b7a5c8Smrg os=bsd 143027702724Smrg ;; 143195b7a5c8Smrg acis*) 143295b7a5c8Smrg os=aos 143327702724Smrg ;; 143495b7a5c8Smrg atheos*) 143595b7a5c8Smrg os=atheos 143627702724Smrg ;; 143795b7a5c8Smrg syllable*) 143895b7a5c8Smrg os=syllable 143995b7a5c8Smrg ;; 144095b7a5c8Smrg 386bsd) 144195b7a5c8Smrg os=bsd 144295b7a5c8Smrg ;; 144395b7a5c8Smrg ctix* | uts*) 144495b7a5c8Smrg os=sysv 144595b7a5c8Smrg ;; 144695b7a5c8Smrg nova*) 144795b7a5c8Smrg os=rtmk-nova 144895b7a5c8Smrg ;; 144995b7a5c8Smrg ns2) 145095b7a5c8Smrg os=nextstep2 145195b7a5c8Smrg ;; 145295b7a5c8Smrg # Preserve the version number of sinix5. 145395b7a5c8Smrg sinix5.*) 145495b7a5c8Smrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 145527702724Smrg ;; 145695b7a5c8Smrg sinix*) 145795b7a5c8Smrg os=sysv4 145827702724Smrg ;; 145995b7a5c8Smrg tpf*) 146095b7a5c8Smrg os=tpf 146127702724Smrg ;; 146295b7a5c8Smrg triton*) 146395b7a5c8Smrg os=sysv3 146427702724Smrg ;; 146595b7a5c8Smrg oss*) 146695b7a5c8Smrg os=sysv3 146727702724Smrg ;; 146895b7a5c8Smrg svr4*) 146995b7a5c8Smrg os=sysv4 147027702724Smrg ;; 147195b7a5c8Smrg svr3) 147295b7a5c8Smrg os=sysv3 147327702724Smrg ;; 147495b7a5c8Smrg sysvr4) 147595b7a5c8Smrg os=sysv4 147627702724Smrg ;; 147795b7a5c8Smrg ose*) 147895b7a5c8Smrg os=ose 147927702724Smrg ;; 148095b7a5c8Smrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 148195b7a5c8Smrg os=mint 148200084f2cSmrg ;; 148395b7a5c8Smrg dicos*) 148495b7a5c8Smrg os=dicos 148595b7a5c8Smrg ;; 148695b7a5c8Smrg pikeos*) 14877cea3689Smrg # Until real need of OS specific support for 14887cea3689Smrg # particular features comes up, bare metal 14897cea3689Smrg # configurations are quite functional. 149095b7a5c8Smrg case $cpu in 14917cea3689Smrg arm*) 149295b7a5c8Smrg os=eabi 14937cea3689Smrg ;; 14947cea3689Smrg *) 1495ae545d91Smrg os= 1496ae545d91Smrg obj=elf 14977cea3689Smrg ;; 14987cea3689Smrg esac 14997cea3689Smrg ;; 1500ae545d91Smrg aout* | coff* | elf* | pe*) 1501ae545d91Smrg # These are machine code file formats, not OSes 1502ae545d91Smrg obj=$os 1503ae545d91Smrg os= 1504ae545d91Smrg ;; 150527702724Smrg *) 150695b7a5c8Smrg # No normalization, but not necessarily accepted, that comes below. 150727702724Smrg ;; 150827702724Smrgesac 150995b7a5c8Smrg 151027702724Smrgelse 151127702724Smrg 151227702724Smrg# Here we handle the default operating systems that come with various machines. 151327702724Smrg# The value should be what the vendor currently ships out the door with their 151427702724Smrg# machine or put another way, the most popular os provided with the machine. 151527702724Smrg 151627702724Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 151727702724Smrg# "-sun"), then you have to tell the case statement up towards the top 151827702724Smrg# that MANUFACTURER isn't an operating system. Otherwise, code above 151927702724Smrg# will signal an error saying that MANUFACTURER isn't an operating 152027702724Smrg# system, and we'll never get to this point. 152127702724Smrg 152295b7a5c8Smrgkernel= 1523ae545d91Smrgobj= 152495b7a5c8Smrgcase $cpu-$vendor in 1525313a12fdSmrg score-*) 1526ae545d91Smrg os= 1527ae545d91Smrg obj=elf 1528e19dfac4Smrg ;; 1529313a12fdSmrg spu-*) 1530ae545d91Smrg os= 1531ae545d91Smrg obj=elf 1532e19dfac4Smrg ;; 153327702724Smrg *-acorn) 153495b7a5c8Smrg os=riscix1.2 153527702724Smrg ;; 153627702724Smrg arm*-rebel) 153795b7a5c8Smrg kernel=linux 153895b7a5c8Smrg os=gnu 153927702724Smrg ;; 154027702724Smrg arm*-semi) 1541ae545d91Smrg os= 1542ae545d91Smrg obj=aout 154327702724Smrg ;; 1544313a12fdSmrg c4x-* | tic4x-*) 1545ae545d91Smrg os= 1546ae545d91Smrg obj=coff 1547313a12fdSmrg ;; 15487cea3689Smrg c8051-*) 1549ae545d91Smrg os= 1550ae545d91Smrg obj=elf 155195b7a5c8Smrg ;; 155295b7a5c8Smrg clipper-intergraph) 155395b7a5c8Smrg os=clix 15547cea3689Smrg ;; 1555313a12fdSmrg hexagon-*) 1556ae545d91Smrg os= 1557ae545d91Smrg obj=elf 1558313a12fdSmrg ;; 1559313a12fdSmrg tic54x-*) 1560ae545d91Smrg os= 1561ae545d91Smrg obj=coff 1562313a12fdSmrg ;; 1563313a12fdSmrg tic55x-*) 1564ae545d91Smrg os= 1565ae545d91Smrg obj=coff 1566313a12fdSmrg ;; 1567313a12fdSmrg tic6x-*) 1568ae545d91Smrg os= 1569ae545d91Smrg obj=coff 1570e19dfac4Smrg ;; 157127702724Smrg # This must come before the *-dec entry. 157227702724Smrg pdp10-*) 157395b7a5c8Smrg os=tops20 157427702724Smrg ;; 157527702724Smrg pdp11-*) 157695b7a5c8Smrg os=none 157727702724Smrg ;; 157827702724Smrg *-dec | vax-*) 157995b7a5c8Smrg os=ultrix4.2 158027702724Smrg ;; 158127702724Smrg m68*-apollo) 158295b7a5c8Smrg os=domain 158327702724Smrg ;; 158427702724Smrg i386-sun) 158595b7a5c8Smrg os=sunos4.0.2 158627702724Smrg ;; 158727702724Smrg m68000-sun) 158895b7a5c8Smrg os=sunos3 158927702724Smrg ;; 159027702724Smrg m68*-cisco) 1591ae545d91Smrg os= 1592ae545d91Smrg obj=aout 159327702724Smrg ;; 1594313a12fdSmrg mep-*) 1595ae545d91Smrg os= 1596ae545d91Smrg obj=elf 1597e19dfac4Smrg ;; 159827702724Smrg mips*-cisco) 1599ae545d91Smrg os= 1600ae545d91Smrg obj=elf 160127702724Smrg ;; 1602ae545d91Smrg mips*-*|nanomips*-*) 1603ae545d91Smrg os= 1604ae545d91Smrg obj=elf 160527702724Smrg ;; 160627702724Smrg or32-*) 1607ae545d91Smrg os= 1608ae545d91Smrg obj=coff 160927702724Smrg ;; 161027702724Smrg *-tti) # must be before sparc entry or we get the wrong os. 161195b7a5c8Smrg os=sysv3 161227702724Smrg ;; 161327702724Smrg sparc-* | *-sun) 161495b7a5c8Smrg os=sunos4.1.1 161527702724Smrg ;; 16167cea3689Smrg pru-*) 1617ae545d91Smrg os= 1618ae545d91Smrg obj=elf 16197cea3689Smrg ;; 162027702724Smrg *-be) 162195b7a5c8Smrg os=beos 162227702724Smrg ;; 162327702724Smrg *-ibm) 162495b7a5c8Smrg os=aix 162527702724Smrg ;; 1626313a12fdSmrg *-knuth) 162795b7a5c8Smrg os=mmixware 162827702724Smrg ;; 162927702724Smrg *-wec) 163095b7a5c8Smrg os=proelf 163127702724Smrg ;; 163227702724Smrg *-winbond) 163395b7a5c8Smrg os=proelf 163427702724Smrg ;; 163527702724Smrg *-oki) 163695b7a5c8Smrg os=proelf 163727702724Smrg ;; 163827702724Smrg *-hp) 163995b7a5c8Smrg os=hpux 164027702724Smrg ;; 164127702724Smrg *-hitachi) 164295b7a5c8Smrg os=hiux 164327702724Smrg ;; 164427702724Smrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 164595b7a5c8Smrg os=sysv 164627702724Smrg ;; 164727702724Smrg *-cbm) 164895b7a5c8Smrg os=amigaos 164927702724Smrg ;; 165027702724Smrg *-dg) 165195b7a5c8Smrg os=dgux 165227702724Smrg ;; 165327702724Smrg *-dolphin) 165495b7a5c8Smrg os=sysv3 165527702724Smrg ;; 165627702724Smrg m68k-ccur) 165795b7a5c8Smrg os=rtu 165827702724Smrg ;; 165927702724Smrg m88k-omron*) 166095b7a5c8Smrg os=luna 166127702724Smrg ;; 16627cea3689Smrg *-next) 166395b7a5c8Smrg os=nextstep 166427702724Smrg ;; 166527702724Smrg *-sequent) 166695b7a5c8Smrg os=ptx 166727702724Smrg ;; 166827702724Smrg *-crds) 166995b7a5c8Smrg os=unos 167027702724Smrg ;; 167127702724Smrg *-ns) 167295b7a5c8Smrg os=genix 167327702724Smrg ;; 167427702724Smrg i370-*) 167595b7a5c8Smrg os=mvs 167627702724Smrg ;; 167727702724Smrg *-gould) 167895b7a5c8Smrg os=sysv 167927702724Smrg ;; 168027702724Smrg *-highlevel) 168195b7a5c8Smrg os=bsd 168227702724Smrg ;; 168327702724Smrg *-encore) 168495b7a5c8Smrg os=bsd 168527702724Smrg ;; 168627702724Smrg *-sgi) 168795b7a5c8Smrg os=irix 168827702724Smrg ;; 168927702724Smrg *-siemens) 169095b7a5c8Smrg os=sysv4 169127702724Smrg ;; 169227702724Smrg *-masscomp) 169395b7a5c8Smrg os=rtu 169427702724Smrg ;; 169527702724Smrg f30[01]-fujitsu | f700-fujitsu) 169695b7a5c8Smrg os=uxpv 169727702724Smrg ;; 169827702724Smrg *-rom68k) 1699ae545d91Smrg os= 1700ae545d91Smrg obj=coff 170127702724Smrg ;; 170227702724Smrg *-*bug) 1703ae545d91Smrg os= 1704ae545d91Smrg obj=coff 170527702724Smrg ;; 170627702724Smrg *-apple) 170795b7a5c8Smrg os=macos 170827702724Smrg ;; 170927702724Smrg *-atari*) 171095b7a5c8Smrg os=mint 171195b7a5c8Smrg ;; 171295b7a5c8Smrg *-wrs) 171395b7a5c8Smrg os=vxworks 171427702724Smrg ;; 171527702724Smrg *) 171695b7a5c8Smrg os=none 171727702724Smrg ;; 171827702724Smrgesac 171995b7a5c8Smrg 172027702724Smrgfi 172127702724Smrg 1722ae545d91Smrg# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). 1723ae545d91Smrg 172495b7a5c8Smrgcase $os in 172595b7a5c8Smrg # Sometimes we do "kernel-libc", so those need to count as OSes. 1726ae545d91Smrg llvm* | musl* | newlib* | relibc* | uclibc*) 172795b7a5c8Smrg ;; 172895b7a5c8Smrg # Likewise for "kernel-abi" 172995b7a5c8Smrg eabi* | gnueabi*) 173095b7a5c8Smrg ;; 173195b7a5c8Smrg # VxWorks passes extra cpu info in the 4th filed. 173295b7a5c8Smrg simlinux | simwindows | spe) 173395b7a5c8Smrg ;; 1734ae545d91Smrg # See `case $cpu-$os` validation below 1735ae545d91Smrg ghcjs) 1736ae545d91Smrg ;; 173795b7a5c8Smrg # Now accept the basic system types. 173895b7a5c8Smrg # The portable systems comes first. 173995b7a5c8Smrg # Each alternative MUST end in a * to match a version number. 174095b7a5c8Smrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 174195b7a5c8Smrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 174295b7a5c8Smrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 174395b7a5c8Smrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 174495b7a5c8Smrg | hiux* | abug | nacl* | netware* | windows* \ 1745ae545d91Smrg | os9* | macos* | osx* | ios* | tvos* | watchos* \ 174695b7a5c8Smrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 174795b7a5c8Smrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 174895b7a5c8Smrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 174995b7a5c8Smrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 175095b7a5c8Smrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 175195b7a5c8Smrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 175295b7a5c8Smrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 175395b7a5c8Smrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1754ae545d91Smrg | bosx* | nextstep* | cxux* | oabi* \ 1755ae545d91Smrg | ptx* | ecoff* | winnt* | domain* | vsta* \ 175695b7a5c8Smrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 175795b7a5c8Smrg | chorusrdb* | cegcc* | glidix* | serenity* \ 1758ae545d91Smrg | cygwin* | msys* | moss* | proelf* | rtems* \ 175995b7a5c8Smrg | midipix* | mingw32* | mingw64* | mint* \ 176095b7a5c8Smrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 176195b7a5c8Smrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 176295b7a5c8Smrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 176395b7a5c8Smrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 176495b7a5c8Smrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 176595b7a5c8Smrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 176695b7a5c8Smrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 176795b7a5c8Smrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 176895b7a5c8Smrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 176995b7a5c8Smrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1770630e437aSmrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1771ae545d91Smrg | fiwix* | mlibc* | cos* | mbr* | ironclad* ) 177295b7a5c8Smrg ;; 177395b7a5c8Smrg # This one is extra strict with allowed versions 177495b7a5c8Smrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 177595b7a5c8Smrg # Don't forget version if it is 3.2v4 or newer. 177695b7a5c8Smrg ;; 1777ae545d91Smrg # This refers to builds using the UEFI calling convention 1778ae545d91Smrg # (which depends on the architecture) and PE file format. 1779ae545d91Smrg # Note that this is both a different calling convention and 1780ae545d91Smrg # different file format than that of GNU-EFI 1781ae545d91Smrg # (x86_64-w64-mingw32). 1782ae545d91Smrg uefi) 1783ae545d91Smrg ;; 178495b7a5c8Smrg none) 178595b7a5c8Smrg ;; 1786ae545d91Smrg kernel* | msvc* ) 1787630e437aSmrg # Restricted further below 1788630e437aSmrg ;; 1789ae545d91Smrg '') 1790ae545d91Smrg if test x"$obj" = x 1791ae545d91Smrg then 1792ae545d91Smrg echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 1793ae545d91Smrg fi 1794ae545d91Smrg ;; 179595b7a5c8Smrg *) 1796ae545d91Smrg echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 1797ae545d91Smrg exit 1 1798ae545d91Smrg ;; 1799ae545d91Smrgesac 1800ae545d91Smrg 1801ae545d91Smrgcase $obj in 1802ae545d91Smrg aout* | coff* | elf* | pe*) 1803ae545d91Smrg ;; 1804ae545d91Smrg '') 1805ae545d91Smrg # empty is fine 1806ae545d91Smrg ;; 1807ae545d91Smrg *) 1808ae545d91Smrg echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 1809ae545d91Smrg exit 1 1810ae545d91Smrg ;; 1811ae545d91Smrgesac 1812ae545d91Smrg 1813ae545d91Smrg# Here we handle the constraint that a (synthetic) cpu and os are 1814ae545d91Smrg# valid only in combination with each other and nowhere else. 1815ae545d91Smrgcase $cpu-$os in 1816ae545d91Smrg # The "javascript-unknown-ghcjs" triple is used by GHC; we 1817ae545d91Smrg # accept it here in order to tolerate that, but reject any 1818ae545d91Smrg # variations. 1819ae545d91Smrg javascript-ghcjs) 1820ae545d91Smrg ;; 1821ae545d91Smrg javascript-* | *-ghcjs) 1822ae545d91Smrg echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 182395b7a5c8Smrg exit 1 182495b7a5c8Smrg ;; 182595b7a5c8Smrgesac 182695b7a5c8Smrg 182795b7a5c8Smrg# As a final step for OS-related things, validate the OS-kernel combination 182895b7a5c8Smrg# (given a valid OS), if there is a kernel. 1829ae545d91Smrgcase $kernel-$os-$obj in 1830ae545d91Smrg linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ 1831ae545d91Smrg | linux-mlibc*- | linux-musl*- | linux-newlib*- \ 1832ae545d91Smrg | linux-relibc*- | linux-uclibc*- ) 183395b7a5c8Smrg ;; 1834ae545d91Smrg uclinux-uclibc*- ) 183595b7a5c8Smrg ;; 1836ae545d91Smrg managarm-mlibc*- | managarm-kernel*- ) 1837630e437aSmrg ;; 1838ae545d91Smrg windows*-msvc*-) 1839ae545d91Smrg ;; 1840ae545d91Smrg -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ 1841ae545d91Smrg | -uclibc*- ) 184295b7a5c8Smrg # These are just libc implementations, not actual OSes, and thus 184395b7a5c8Smrg # require a kernel. 1844ae545d91Smrg echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 184595b7a5c8Smrg exit 1 184695b7a5c8Smrg ;; 1847ae545d91Smrg -kernel*- ) 1848ae545d91Smrg echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 1849630e437aSmrg exit 1 1850630e437aSmrg ;; 1851ae545d91Smrg *-kernel*- ) 1852ae545d91Smrg echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 1853630e437aSmrg exit 1 1854630e437aSmrg ;; 1855ae545d91Smrg *-msvc*- ) 1856ae545d91Smrg echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 1857ae545d91Smrg exit 1 185895b7a5c8Smrg ;; 1859ae545d91Smrg kfreebsd*-gnu*- | kopensolaris*-gnu*-) 186095b7a5c8Smrg ;; 1861ae545d91Smrg vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) 186295b7a5c8Smrg ;; 1863ae545d91Smrg nto-qnx*-) 1864ae545d91Smrg ;; 1865ae545d91Smrg os2-emx-) 1866ae545d91Smrg ;; 1867ae545d91Smrg *-eabi*- | *-gnueabi*-) 186895b7a5c8Smrg ;; 1869ae545d91Smrg none--*) 1870ae545d91Smrg # None (no kernel, i.e. freestanding / bare metal), 1871ae545d91Smrg # can be paired with an machine code file format 187295b7a5c8Smrg ;; 1873ae545d91Smrg -*-) 187495b7a5c8Smrg # Blank kernel with real OS is always fine. 187595b7a5c8Smrg ;; 1876ae545d91Smrg --*) 1877ae545d91Smrg # Blank kernel and OS with real machine code file format is always fine. 1878ae545d91Smrg ;; 1879ae545d91Smrg *-*-*) 1880ae545d91Smrg echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 188195b7a5c8Smrg exit 1 188295b7a5c8Smrg ;; 188395b7a5c8Smrgesac 188495b7a5c8Smrg 188527702724Smrg# Here we handle the case where we know the os, and the CPU type, but not the 188627702724Smrg# manufacturer. We pick the logical manufacturer. 188795b7a5c8Smrgcase $vendor in 188895b7a5c8Smrg unknown) 188995b7a5c8Smrg case $cpu-$os in 189095b7a5c8Smrg *-riscix*) 189127702724Smrg vendor=acorn 189227702724Smrg ;; 189395b7a5c8Smrg *-sunos*) 189427702724Smrg vendor=sun 189527702724Smrg ;; 189695b7a5c8Smrg *-cnk* | *-aix*) 189727702724Smrg vendor=ibm 189827702724Smrg ;; 189995b7a5c8Smrg *-beos*) 190027702724Smrg vendor=be 190127702724Smrg ;; 190295b7a5c8Smrg *-hpux*) 190327702724Smrg vendor=hp 190427702724Smrg ;; 190595b7a5c8Smrg *-mpeix*) 190627702724Smrg vendor=hp 190727702724Smrg ;; 190895b7a5c8Smrg *-hiux*) 190927702724Smrg vendor=hitachi 191027702724Smrg ;; 191195b7a5c8Smrg *-unos*) 191227702724Smrg vendor=crds 191327702724Smrg ;; 191495b7a5c8Smrg *-dgux*) 191527702724Smrg vendor=dg 191627702724Smrg ;; 191795b7a5c8Smrg *-luna*) 191827702724Smrg vendor=omron 191927702724Smrg ;; 192095b7a5c8Smrg *-genix*) 192127702724Smrg vendor=ns 192227702724Smrg ;; 192395b7a5c8Smrg *-clix*) 192495b7a5c8Smrg vendor=intergraph 192595b7a5c8Smrg ;; 192695b7a5c8Smrg *-mvs* | *-opened*) 192795b7a5c8Smrg vendor=ibm 192895b7a5c8Smrg ;; 192995b7a5c8Smrg *-os400*) 193027702724Smrg vendor=ibm 193127702724Smrg ;; 193295b7a5c8Smrg s390-* | s390x-*) 193327702724Smrg vendor=ibm 193427702724Smrg ;; 193595b7a5c8Smrg *-ptx*) 193627702724Smrg vendor=sequent 193727702724Smrg ;; 193895b7a5c8Smrg *-tpf*) 193927702724Smrg vendor=ibm 194027702724Smrg ;; 194195b7a5c8Smrg *-vxsim* | *-vxworks* | *-windiss*) 194227702724Smrg vendor=wrs 194327702724Smrg ;; 194495b7a5c8Smrg *-aux*) 194527702724Smrg vendor=apple 194627702724Smrg ;; 194795b7a5c8Smrg *-hms*) 194827702724Smrg vendor=hitachi 194927702724Smrg ;; 195095b7a5c8Smrg *-mpw* | *-macos*) 195127702724Smrg vendor=apple 195227702724Smrg ;; 195395b7a5c8Smrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 195427702724Smrg vendor=atari 195527702724Smrg ;; 195695b7a5c8Smrg *-vos*) 195727702724Smrg vendor=stratus 195827702724Smrg ;; 195927702724Smrg esac 196027702724Smrg ;; 196127702724Smrgesac 196227702724Smrg 1963ae545d91Smrgecho "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" 196427702724Smrgexit 196527702724Smrg 196627702724Smrg# Local variables: 196795b7a5c8Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 196827702724Smrg# time-stamp-start: "timestamp='" 196927702724Smrg# time-stamp-format: "%:y-%02m-%02d" 197027702724Smrg# time-stamp-end: "'" 197127702724Smrg# End: 1972