15b28e182Smrg#! /bin/sh 25b28e182Smrg# Configuration validation subroutine script. 315adf0bfSmrg# Copyright 1992-2023 Free Software Foundation, Inc. 45b28e182Smrg 515adf0bfSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale 65b28e182Smrg 715adf0bfSmrgtimestamp='2023-01-21' 815adf0bfSmrg 915adf0bfSmrg# This file is free software; you can redistribute it and/or modify it 1015adf0bfSmrg# under the terms of the GNU General Public License as published by 1115adf0bfSmrg# the Free Software Foundation, either version 3 of the License, or 125b28e182Smrg# (at your option) any later version. 135b28e182Smrg# 1415adf0bfSmrg# This program is distributed in the hope that it will be useful, but 1515adf0bfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1615adf0bfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1715adf0bfSmrg# General Public License for more details. 185b28e182Smrg# 195b28e182Smrg# You should have received a copy of the GNU General Public License 2015adf0bfSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 215b28e182Smrg# 225b28e182Smrg# As a special exception to the GNU General Public License, if you 235b28e182Smrg# distribute this file as part of a program that contains a 245b28e182Smrg# configuration script generated by Autoconf, you may include it under 2515adf0bfSmrg# the same distribution terms that you use for the rest of that 2615adf0bfSmrg# program. This Exception is an additional permission under section 7 2715adf0bfSmrg# of the GNU General Public License, version 3 ("GPLv3"). 285b28e182Smrg 295b28e182Smrg 3015adf0bfSmrg# Please send patches to <config-patches@gnu.org>. 315b28e182Smrg# 325b28e182Smrg# Configuration subroutine to validate and canonicalize a configuration type. 335b28e182Smrg# Supply the specified configuration type as an argument. 345b28e182Smrg# If it is invalid, we print an error message on stderr and exit with code 1. 355b28e182Smrg# Otherwise, we print the canonical config type on stdout and succeed. 365b28e182Smrg 37f1e20f77Smrg# You can get the latest version of this script from: 3815adf0bfSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39f1e20f77Smrg 405b28e182Smrg# This file is supposed to be the same for all GNU packages 415b28e182Smrg# and recognize all the CPU types, system types and aliases 425b28e182Smrg# that are meaningful with *any* GNU software. 435b28e182Smrg# Each package is responsible for reporting which valid configurations 445b28e182Smrg# it does not support. The user should be able to distinguish 455b28e182Smrg# a failure to support a valid configuration from a meaningless 465b28e182Smrg# configuration. 475b28e182Smrg 485b28e182Smrg# The goal of this file is to map all the various variations of a given 495b28e182Smrg# machine specification into a single specification in the form: 505b28e182Smrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 515b28e182Smrg# or in some cases, the newer four-part form: 525b28e182Smrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 535b28e182Smrg# It is wrong to echo any other type of specification. 545b28e182Smrg 5515adf0bfSmrg# The "shellcheck disable" line above the timestamp inhibits complaints 5615adf0bfSmrg# about features and limitations of the classic Bourne shell that were 5715adf0bfSmrg# superseded or lifted in POSIX. However, this script identifies a wide 5815adf0bfSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 5915adf0bfSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still 6015adf0bfSmrg# have a pre-POSIX /bin/sh. 6115adf0bfSmrg 625b28e182Smrgme=`echo "$0" | sed -e 's,.*/,,'` 635b28e182Smrg 645b28e182Smrgusage="\ 6515adf0bfSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 665b28e182Smrg 675b28e182SmrgCanonicalize a configuration name. 685b28e182Smrg 6915adf0bfSmrgOptions: 705b28e182Smrg -h, --help print this help, then exit 715b28e182Smrg -t, --time-stamp print date of last modification, then exit 725b28e182Smrg -v, --version print version number, then exit 735b28e182Smrg 745b28e182SmrgReport bugs and patches to <config-patches@gnu.org>." 755b28e182Smrg 765b28e182Smrgversion="\ 775b28e182SmrgGNU config.sub ($timestamp) 785b28e182Smrg 7915adf0bfSmrgCopyright 1992-2023 Free Software Foundation, Inc. 805b28e182Smrg 815b28e182SmrgThis is free software; see the source for copying conditions. There is NO 825b28e182Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 835b28e182Smrg 845b28e182Smrghelp=" 855b28e182SmrgTry \`$me --help' for more information." 865b28e182Smrg 875b28e182Smrg# Parse command line 885b28e182Smrgwhile test $# -gt 0 ; do 895b28e182Smrg case $1 in 905b28e182Smrg --time-stamp | --time* | -t ) 915b28e182Smrg echo "$timestamp" ; exit ;; 925b28e182Smrg --version | -v ) 935b28e182Smrg echo "$version" ; exit ;; 945b28e182Smrg --help | --h* | -h ) 955b28e182Smrg echo "$usage"; exit ;; 965b28e182Smrg -- ) # Stop option processing 975b28e182Smrg shift; break ;; 985b28e182Smrg - ) # Use stdin as input. 995b28e182Smrg break ;; 1005b28e182Smrg -* ) 10115adf0bfSmrg echo "$me: invalid option $1$help" >&2 1025b28e182Smrg exit 1 ;; 1035b28e182Smrg 1045b28e182Smrg *local*) 1055b28e182Smrg # First pass through any local machine types. 10615adf0bfSmrg echo "$1" 1075b28e182Smrg exit ;; 1085b28e182Smrg 1095b28e182Smrg * ) 1105b28e182Smrg break ;; 1115b28e182Smrg esac 1125b28e182Smrgdone 1135b28e182Smrg 1145b28e182Smrgcase $# in 1155b28e182Smrg 0) echo "$me: missing argument$help" >&2 1165b28e182Smrg exit 1;; 1175b28e182Smrg 1) ;; 1185b28e182Smrg *) echo "$me: too many arguments$help" >&2 1195b28e182Smrg exit 1;; 1205b28e182Smrgesac 1215b28e182Smrg 12215adf0bfSmrg# Split fields of configuration type 12315adf0bfSmrg# shellcheck disable=SC2162 12415adf0bfSmrgsaved_IFS=$IFS 12515adf0bfSmrgIFS="-" read field1 field2 field3 field4 <<EOF 12615adf0bfSmrg$1 12715adf0bfSmrgEOF 12815adf0bfSmrgIFS=$saved_IFS 1295b28e182Smrg 13015adf0bfSmrg# Separate into logical components for further validation 13115adf0bfSmrgcase $1 in 13215adf0bfSmrg *-*-*-*-*) 13315adf0bfSmrg echo Invalid configuration \`"$1"\': more than four components >&2 13415adf0bfSmrg exit 1 1355b28e182Smrg ;; 13615adf0bfSmrg *-*-*-*) 13715adf0bfSmrg basic_machine=$field1-$field2 13815adf0bfSmrg basic_os=$field3-$field4 1395b28e182Smrg ;; 14015adf0bfSmrg *-*-*) 14115adf0bfSmrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 14215adf0bfSmrg # parts 14315adf0bfSmrg maybe_os=$field2-$field3 14415adf0bfSmrg case $maybe_os in 14515adf0bfSmrg nto-qnx* | linux-* | uclinux-uclibc* \ 14615adf0bfSmrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 14715adf0bfSmrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 14815adf0bfSmrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) 14915adf0bfSmrg basic_machine=$field1 15015adf0bfSmrg basic_os=$maybe_os 15115adf0bfSmrg ;; 15215adf0bfSmrg android-linux) 15315adf0bfSmrg basic_machine=$field1-unknown 15415adf0bfSmrg basic_os=linux-android 15515adf0bfSmrg ;; 15615adf0bfSmrg *) 15715adf0bfSmrg basic_machine=$field1-$field2 15815adf0bfSmrg basic_os=$field3 15915adf0bfSmrg ;; 16015adf0bfSmrg esac 1615b28e182Smrg ;; 16215adf0bfSmrg *-*) 16315adf0bfSmrg # A lone config we happen to match not fitting any pattern 16415adf0bfSmrg case $field1-$field2 in 16515adf0bfSmrg decstation-3100) 16615adf0bfSmrg basic_machine=mips-dec 16715adf0bfSmrg basic_os= 16815adf0bfSmrg ;; 16915adf0bfSmrg *-*) 17015adf0bfSmrg # Second component is usually, but not always the OS 17115adf0bfSmrg case $field2 in 17215adf0bfSmrg # Prevent following clause from handling this valid os 17315adf0bfSmrg sun*os*) 17415adf0bfSmrg basic_machine=$field1 17515adf0bfSmrg basic_os=$field2 17615adf0bfSmrg ;; 17715adf0bfSmrg zephyr*) 17815adf0bfSmrg basic_machine=$field1-unknown 17915adf0bfSmrg basic_os=$field2 18015adf0bfSmrg ;; 18115adf0bfSmrg # Manufacturers 18215adf0bfSmrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 18315adf0bfSmrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 18415adf0bfSmrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 18515adf0bfSmrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 18615adf0bfSmrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 18715adf0bfSmrg | ultra | tti* | harris | dolphin | highlevel | gould \ 18815adf0bfSmrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 18915adf0bfSmrg | microblaze* | sim | cisco \ 19015adf0bfSmrg | oki | wec | wrs | winbond) 19115adf0bfSmrg basic_machine=$field1-$field2 19215adf0bfSmrg basic_os= 19315adf0bfSmrg ;; 19415adf0bfSmrg *) 19515adf0bfSmrg basic_machine=$field1 19615adf0bfSmrg basic_os=$field2 19715adf0bfSmrg ;; 19815adf0bfSmrg esac 19915adf0bfSmrg ;; 20015adf0bfSmrg esac 2015b28e182Smrg ;; 20215adf0bfSmrg *) 20315adf0bfSmrg # Convert single-component short-hands not valid as part of 20415adf0bfSmrg # multi-component configurations. 20515adf0bfSmrg case $field1 in 20615adf0bfSmrg 386bsd) 20715adf0bfSmrg basic_machine=i386-pc 20815adf0bfSmrg basic_os=bsd 20915adf0bfSmrg ;; 21015adf0bfSmrg a29khif) 21115adf0bfSmrg basic_machine=a29k-amd 21215adf0bfSmrg basic_os=udi 21315adf0bfSmrg ;; 21415adf0bfSmrg adobe68k) 21515adf0bfSmrg basic_machine=m68010-adobe 21615adf0bfSmrg basic_os=scout 21715adf0bfSmrg ;; 21815adf0bfSmrg alliant) 21915adf0bfSmrg basic_machine=fx80-alliant 22015adf0bfSmrg basic_os= 22115adf0bfSmrg ;; 22215adf0bfSmrg altos | altos3068) 22315adf0bfSmrg basic_machine=m68k-altos 22415adf0bfSmrg basic_os= 22515adf0bfSmrg ;; 22615adf0bfSmrg am29k) 22715adf0bfSmrg basic_machine=a29k-none 22815adf0bfSmrg basic_os=bsd 22915adf0bfSmrg ;; 23015adf0bfSmrg amdahl) 23115adf0bfSmrg basic_machine=580-amdahl 23215adf0bfSmrg basic_os=sysv 23315adf0bfSmrg ;; 23415adf0bfSmrg amiga) 23515adf0bfSmrg basic_machine=m68k-unknown 23615adf0bfSmrg basic_os= 23715adf0bfSmrg ;; 23815adf0bfSmrg amigaos | amigados) 23915adf0bfSmrg basic_machine=m68k-unknown 24015adf0bfSmrg basic_os=amigaos 24115adf0bfSmrg ;; 24215adf0bfSmrg amigaunix | amix) 24315adf0bfSmrg basic_machine=m68k-unknown 24415adf0bfSmrg basic_os=sysv4 24515adf0bfSmrg ;; 24615adf0bfSmrg apollo68) 24715adf0bfSmrg basic_machine=m68k-apollo 24815adf0bfSmrg basic_os=sysv 24915adf0bfSmrg ;; 25015adf0bfSmrg apollo68bsd) 25115adf0bfSmrg basic_machine=m68k-apollo 25215adf0bfSmrg basic_os=bsd 25315adf0bfSmrg ;; 25415adf0bfSmrg aros) 25515adf0bfSmrg basic_machine=i386-pc 25615adf0bfSmrg basic_os=aros 25715adf0bfSmrg ;; 25815adf0bfSmrg aux) 25915adf0bfSmrg basic_machine=m68k-apple 26015adf0bfSmrg basic_os=aux 26115adf0bfSmrg ;; 26215adf0bfSmrg balance) 26315adf0bfSmrg basic_machine=ns32k-sequent 26415adf0bfSmrg basic_os=dynix 26515adf0bfSmrg ;; 26615adf0bfSmrg blackfin) 26715adf0bfSmrg basic_machine=bfin-unknown 26815adf0bfSmrg basic_os=linux 26915adf0bfSmrg ;; 27015adf0bfSmrg cegcc) 27115adf0bfSmrg basic_machine=arm-unknown 27215adf0bfSmrg basic_os=cegcc 27315adf0bfSmrg ;; 27415adf0bfSmrg convex-c1) 27515adf0bfSmrg basic_machine=c1-convex 27615adf0bfSmrg basic_os=bsd 27715adf0bfSmrg ;; 27815adf0bfSmrg convex-c2) 27915adf0bfSmrg basic_machine=c2-convex 28015adf0bfSmrg basic_os=bsd 28115adf0bfSmrg ;; 28215adf0bfSmrg convex-c32) 28315adf0bfSmrg basic_machine=c32-convex 28415adf0bfSmrg basic_os=bsd 28515adf0bfSmrg ;; 28615adf0bfSmrg convex-c34) 28715adf0bfSmrg basic_machine=c34-convex 28815adf0bfSmrg basic_os=bsd 28915adf0bfSmrg ;; 29015adf0bfSmrg convex-c38) 29115adf0bfSmrg basic_machine=c38-convex 29215adf0bfSmrg basic_os=bsd 29315adf0bfSmrg ;; 29415adf0bfSmrg cray) 29515adf0bfSmrg basic_machine=j90-cray 29615adf0bfSmrg basic_os=unicos 29715adf0bfSmrg ;; 29815adf0bfSmrg crds | unos) 29915adf0bfSmrg basic_machine=m68k-crds 30015adf0bfSmrg basic_os= 30115adf0bfSmrg ;; 30215adf0bfSmrg da30) 30315adf0bfSmrg basic_machine=m68k-da30 30415adf0bfSmrg basic_os= 30515adf0bfSmrg ;; 30615adf0bfSmrg decstation | pmax | pmin | dec3100 | decstatn) 30715adf0bfSmrg basic_machine=mips-dec 30815adf0bfSmrg basic_os= 30915adf0bfSmrg ;; 31015adf0bfSmrg delta88) 31115adf0bfSmrg basic_machine=m88k-motorola 31215adf0bfSmrg basic_os=sysv3 31315adf0bfSmrg ;; 31415adf0bfSmrg dicos) 31515adf0bfSmrg basic_machine=i686-pc 31615adf0bfSmrg basic_os=dicos 31715adf0bfSmrg ;; 31815adf0bfSmrg djgpp) 31915adf0bfSmrg basic_machine=i586-pc 32015adf0bfSmrg basic_os=msdosdjgpp 32115adf0bfSmrg ;; 32215adf0bfSmrg ebmon29k) 32315adf0bfSmrg basic_machine=a29k-amd 32415adf0bfSmrg basic_os=ebmon 32515adf0bfSmrg ;; 32615adf0bfSmrg es1800 | OSE68k | ose68k | ose | OSE) 32715adf0bfSmrg basic_machine=m68k-ericsson 32815adf0bfSmrg basic_os=ose 32915adf0bfSmrg ;; 33015adf0bfSmrg gmicro) 33115adf0bfSmrg basic_machine=tron-gmicro 33215adf0bfSmrg basic_os=sysv 33315adf0bfSmrg ;; 33415adf0bfSmrg go32) 33515adf0bfSmrg basic_machine=i386-pc 33615adf0bfSmrg basic_os=go32 33715adf0bfSmrg ;; 33815adf0bfSmrg h8300hms) 33915adf0bfSmrg basic_machine=h8300-hitachi 34015adf0bfSmrg basic_os=hms 34115adf0bfSmrg ;; 34215adf0bfSmrg h8300xray) 34315adf0bfSmrg basic_machine=h8300-hitachi 34415adf0bfSmrg basic_os=xray 34515adf0bfSmrg ;; 34615adf0bfSmrg h8500hms) 34715adf0bfSmrg basic_machine=h8500-hitachi 34815adf0bfSmrg basic_os=hms 34915adf0bfSmrg ;; 35015adf0bfSmrg harris) 35115adf0bfSmrg basic_machine=m88k-harris 35215adf0bfSmrg basic_os=sysv3 35315adf0bfSmrg ;; 35415adf0bfSmrg hp300 | hp300hpux) 35515adf0bfSmrg basic_machine=m68k-hp 35615adf0bfSmrg basic_os=hpux 35715adf0bfSmrg ;; 35815adf0bfSmrg hp300bsd) 35915adf0bfSmrg basic_machine=m68k-hp 36015adf0bfSmrg basic_os=bsd 36115adf0bfSmrg ;; 36215adf0bfSmrg hppaosf) 36315adf0bfSmrg basic_machine=hppa1.1-hp 36415adf0bfSmrg basic_os=osf 36515adf0bfSmrg ;; 36615adf0bfSmrg hppro) 36715adf0bfSmrg basic_machine=hppa1.1-hp 36815adf0bfSmrg basic_os=proelf 36915adf0bfSmrg ;; 37015adf0bfSmrg i386mach) 37115adf0bfSmrg basic_machine=i386-mach 37215adf0bfSmrg basic_os=mach 37315adf0bfSmrg ;; 37415adf0bfSmrg isi68 | isi) 37515adf0bfSmrg basic_machine=m68k-isi 37615adf0bfSmrg basic_os=sysv 37715adf0bfSmrg ;; 37815adf0bfSmrg m68knommu) 37915adf0bfSmrg basic_machine=m68k-unknown 38015adf0bfSmrg basic_os=linux 38115adf0bfSmrg ;; 38215adf0bfSmrg magnum | m3230) 38315adf0bfSmrg basic_machine=mips-mips 38415adf0bfSmrg basic_os=sysv 38515adf0bfSmrg ;; 38615adf0bfSmrg merlin) 38715adf0bfSmrg basic_machine=ns32k-utek 38815adf0bfSmrg basic_os=sysv 38915adf0bfSmrg ;; 39015adf0bfSmrg mingw64) 39115adf0bfSmrg basic_machine=x86_64-pc 39215adf0bfSmrg basic_os=mingw64 39315adf0bfSmrg ;; 39415adf0bfSmrg mingw32) 39515adf0bfSmrg basic_machine=i686-pc 39615adf0bfSmrg basic_os=mingw32 39715adf0bfSmrg ;; 39815adf0bfSmrg mingw32ce) 39915adf0bfSmrg basic_machine=arm-unknown 40015adf0bfSmrg basic_os=mingw32ce 40115adf0bfSmrg ;; 40215adf0bfSmrg monitor) 40315adf0bfSmrg basic_machine=m68k-rom68k 40415adf0bfSmrg basic_os=coff 40515adf0bfSmrg ;; 40615adf0bfSmrg morphos) 40715adf0bfSmrg basic_machine=powerpc-unknown 40815adf0bfSmrg basic_os=morphos 40915adf0bfSmrg ;; 41015adf0bfSmrg moxiebox) 41115adf0bfSmrg basic_machine=moxie-unknown 41215adf0bfSmrg basic_os=moxiebox 41315adf0bfSmrg ;; 41415adf0bfSmrg msdos) 41515adf0bfSmrg basic_machine=i386-pc 41615adf0bfSmrg basic_os=msdos 41715adf0bfSmrg ;; 41815adf0bfSmrg msys) 41915adf0bfSmrg basic_machine=i686-pc 42015adf0bfSmrg basic_os=msys 42115adf0bfSmrg ;; 42215adf0bfSmrg mvs) 42315adf0bfSmrg basic_machine=i370-ibm 42415adf0bfSmrg basic_os=mvs 42515adf0bfSmrg ;; 42615adf0bfSmrg nacl) 42715adf0bfSmrg basic_machine=le32-unknown 42815adf0bfSmrg basic_os=nacl 42915adf0bfSmrg ;; 43015adf0bfSmrg ncr3000) 43115adf0bfSmrg basic_machine=i486-ncr 43215adf0bfSmrg basic_os=sysv4 43315adf0bfSmrg ;; 43415adf0bfSmrg netbsd386) 43515adf0bfSmrg basic_machine=i386-pc 43615adf0bfSmrg basic_os=netbsd 43715adf0bfSmrg ;; 43815adf0bfSmrg netwinder) 43915adf0bfSmrg basic_machine=armv4l-rebel 44015adf0bfSmrg basic_os=linux 44115adf0bfSmrg ;; 44215adf0bfSmrg news | news700 | news800 | news900) 44315adf0bfSmrg basic_machine=m68k-sony 44415adf0bfSmrg basic_os=newsos 44515adf0bfSmrg ;; 44615adf0bfSmrg news1000) 44715adf0bfSmrg basic_machine=m68030-sony 44815adf0bfSmrg basic_os=newsos 44915adf0bfSmrg ;; 45015adf0bfSmrg necv70) 45115adf0bfSmrg basic_machine=v70-nec 45215adf0bfSmrg basic_os=sysv 45315adf0bfSmrg ;; 45415adf0bfSmrg nh3000) 45515adf0bfSmrg basic_machine=m68k-harris 45615adf0bfSmrg basic_os=cxux 45715adf0bfSmrg ;; 45815adf0bfSmrg nh[45]000) 45915adf0bfSmrg basic_machine=m88k-harris 46015adf0bfSmrg basic_os=cxux 46115adf0bfSmrg ;; 46215adf0bfSmrg nindy960) 46315adf0bfSmrg basic_machine=i960-intel 46415adf0bfSmrg basic_os=nindy 46515adf0bfSmrg ;; 46615adf0bfSmrg mon960) 46715adf0bfSmrg basic_machine=i960-intel 46815adf0bfSmrg basic_os=mon960 46915adf0bfSmrg ;; 47015adf0bfSmrg nonstopux) 47115adf0bfSmrg basic_machine=mips-compaq 47215adf0bfSmrg basic_os=nonstopux 47315adf0bfSmrg ;; 47415adf0bfSmrg os400) 47515adf0bfSmrg basic_machine=powerpc-ibm 47615adf0bfSmrg basic_os=os400 47715adf0bfSmrg ;; 47815adf0bfSmrg OSE68000 | ose68000) 47915adf0bfSmrg basic_machine=m68000-ericsson 48015adf0bfSmrg basic_os=ose 48115adf0bfSmrg ;; 48215adf0bfSmrg os68k) 48315adf0bfSmrg basic_machine=m68k-none 48415adf0bfSmrg basic_os=os68k 48515adf0bfSmrg ;; 48615adf0bfSmrg paragon) 48715adf0bfSmrg basic_machine=i860-intel 48815adf0bfSmrg basic_os=osf 48915adf0bfSmrg ;; 49015adf0bfSmrg parisc) 49115adf0bfSmrg basic_machine=hppa-unknown 49215adf0bfSmrg basic_os=linux 49315adf0bfSmrg ;; 49415adf0bfSmrg psp) 49515adf0bfSmrg basic_machine=mipsallegrexel-sony 49615adf0bfSmrg basic_os=psp 49715adf0bfSmrg ;; 49815adf0bfSmrg pw32) 49915adf0bfSmrg basic_machine=i586-unknown 50015adf0bfSmrg basic_os=pw32 50115adf0bfSmrg ;; 50215adf0bfSmrg rdos | rdos64) 50315adf0bfSmrg basic_machine=x86_64-pc 50415adf0bfSmrg basic_os=rdos 50515adf0bfSmrg ;; 50615adf0bfSmrg rdos32) 50715adf0bfSmrg basic_machine=i386-pc 50815adf0bfSmrg basic_os=rdos 50915adf0bfSmrg ;; 51015adf0bfSmrg rom68k) 51115adf0bfSmrg basic_machine=m68k-rom68k 51215adf0bfSmrg basic_os=coff 51315adf0bfSmrg ;; 51415adf0bfSmrg sa29200) 51515adf0bfSmrg basic_machine=a29k-amd 51615adf0bfSmrg basic_os=udi 51715adf0bfSmrg ;; 51815adf0bfSmrg sei) 51915adf0bfSmrg basic_machine=mips-sei 52015adf0bfSmrg basic_os=seiux 52115adf0bfSmrg ;; 52215adf0bfSmrg sequent) 52315adf0bfSmrg basic_machine=i386-sequent 52415adf0bfSmrg basic_os= 52515adf0bfSmrg ;; 52615adf0bfSmrg sps7) 52715adf0bfSmrg basic_machine=m68k-bull 52815adf0bfSmrg basic_os=sysv2 52915adf0bfSmrg ;; 53015adf0bfSmrg st2000) 53115adf0bfSmrg basic_machine=m68k-tandem 53215adf0bfSmrg basic_os= 53315adf0bfSmrg ;; 53415adf0bfSmrg stratus) 53515adf0bfSmrg basic_machine=i860-stratus 53615adf0bfSmrg basic_os=sysv4 53715adf0bfSmrg ;; 53815adf0bfSmrg sun2) 53915adf0bfSmrg basic_machine=m68000-sun 54015adf0bfSmrg basic_os= 54115adf0bfSmrg ;; 54215adf0bfSmrg sun2os3) 54315adf0bfSmrg basic_machine=m68000-sun 54415adf0bfSmrg basic_os=sunos3 54515adf0bfSmrg ;; 54615adf0bfSmrg sun2os4) 54715adf0bfSmrg basic_machine=m68000-sun 54815adf0bfSmrg basic_os=sunos4 54915adf0bfSmrg ;; 55015adf0bfSmrg sun3) 55115adf0bfSmrg basic_machine=m68k-sun 55215adf0bfSmrg basic_os= 55315adf0bfSmrg ;; 55415adf0bfSmrg sun3os3) 55515adf0bfSmrg basic_machine=m68k-sun 55615adf0bfSmrg basic_os=sunos3 55715adf0bfSmrg ;; 55815adf0bfSmrg sun3os4) 55915adf0bfSmrg basic_machine=m68k-sun 56015adf0bfSmrg basic_os=sunos4 56115adf0bfSmrg ;; 56215adf0bfSmrg sun4) 56315adf0bfSmrg basic_machine=sparc-sun 56415adf0bfSmrg basic_os= 56515adf0bfSmrg ;; 56615adf0bfSmrg sun4os3) 56715adf0bfSmrg basic_machine=sparc-sun 56815adf0bfSmrg basic_os=sunos3 56915adf0bfSmrg ;; 57015adf0bfSmrg sun4os4) 57115adf0bfSmrg basic_machine=sparc-sun 57215adf0bfSmrg basic_os=sunos4 57315adf0bfSmrg ;; 57415adf0bfSmrg sun4sol2) 57515adf0bfSmrg basic_machine=sparc-sun 57615adf0bfSmrg basic_os=solaris2 57715adf0bfSmrg ;; 57815adf0bfSmrg sun386 | sun386i | roadrunner) 57915adf0bfSmrg basic_machine=i386-sun 58015adf0bfSmrg basic_os= 58115adf0bfSmrg ;; 58215adf0bfSmrg sv1) 58315adf0bfSmrg basic_machine=sv1-cray 58415adf0bfSmrg basic_os=unicos 58515adf0bfSmrg ;; 58615adf0bfSmrg symmetry) 58715adf0bfSmrg basic_machine=i386-sequent 58815adf0bfSmrg basic_os=dynix 58915adf0bfSmrg ;; 59015adf0bfSmrg t3e) 59115adf0bfSmrg basic_machine=alphaev5-cray 59215adf0bfSmrg basic_os=unicos 59315adf0bfSmrg ;; 59415adf0bfSmrg t90) 59515adf0bfSmrg basic_machine=t90-cray 59615adf0bfSmrg basic_os=unicos 59715adf0bfSmrg ;; 59815adf0bfSmrg toad1) 59915adf0bfSmrg basic_machine=pdp10-xkl 60015adf0bfSmrg basic_os=tops20 60115adf0bfSmrg ;; 60215adf0bfSmrg tpf) 60315adf0bfSmrg basic_machine=s390x-ibm 60415adf0bfSmrg basic_os=tpf 60515adf0bfSmrg ;; 60615adf0bfSmrg udi29k) 60715adf0bfSmrg basic_machine=a29k-amd 60815adf0bfSmrg basic_os=udi 60915adf0bfSmrg ;; 61015adf0bfSmrg ultra3) 61115adf0bfSmrg basic_machine=a29k-nyu 61215adf0bfSmrg basic_os=sym1 61315adf0bfSmrg ;; 61415adf0bfSmrg v810 | necv810) 61515adf0bfSmrg basic_machine=v810-nec 61615adf0bfSmrg basic_os=none 61715adf0bfSmrg ;; 61815adf0bfSmrg vaxv) 61915adf0bfSmrg basic_machine=vax-dec 62015adf0bfSmrg basic_os=sysv 62115adf0bfSmrg ;; 62215adf0bfSmrg vms) 62315adf0bfSmrg basic_machine=vax-dec 62415adf0bfSmrg basic_os=vms 62515adf0bfSmrg ;; 62615adf0bfSmrg vsta) 62715adf0bfSmrg basic_machine=i386-pc 62815adf0bfSmrg basic_os=vsta 62915adf0bfSmrg ;; 63015adf0bfSmrg vxworks960) 63115adf0bfSmrg basic_machine=i960-wrs 63215adf0bfSmrg basic_os=vxworks 63315adf0bfSmrg ;; 63415adf0bfSmrg vxworks68) 63515adf0bfSmrg basic_machine=m68k-wrs 63615adf0bfSmrg basic_os=vxworks 63715adf0bfSmrg ;; 63815adf0bfSmrg vxworks29k) 63915adf0bfSmrg basic_machine=a29k-wrs 64015adf0bfSmrg basic_os=vxworks 64115adf0bfSmrg ;; 64215adf0bfSmrg xbox) 64315adf0bfSmrg basic_machine=i686-pc 64415adf0bfSmrg basic_os=mingw32 64515adf0bfSmrg ;; 64615adf0bfSmrg ymp) 64715adf0bfSmrg basic_machine=ymp-cray 64815adf0bfSmrg basic_os=unicos 64915adf0bfSmrg ;; 65015adf0bfSmrg *) 65115adf0bfSmrg basic_machine=$1 65215adf0bfSmrg basic_os= 65315adf0bfSmrg ;; 65415adf0bfSmrg esac 6555b28e182Smrg ;; 65615adf0bfSmrgesac 65715adf0bfSmrg 65815adf0bfSmrg# Decode 1-component or ad-hoc basic machines 65915adf0bfSmrgcase $basic_machine in 66015adf0bfSmrg # Here we handle the default manufacturer of certain CPU types. It is in 66115adf0bfSmrg # some cases the only manufacturer, in others, it is the most popular. 66215adf0bfSmrg w89k) 66315adf0bfSmrg cpu=hppa1.1 66415adf0bfSmrg vendor=winbond 6655b28e182Smrg ;; 66615adf0bfSmrg op50n) 66715adf0bfSmrg cpu=hppa1.1 66815adf0bfSmrg vendor=oki 6695b28e182Smrg ;; 67015adf0bfSmrg op60c) 67115adf0bfSmrg cpu=hppa1.1 67215adf0bfSmrg vendor=oki 6735b28e182Smrg ;; 67415adf0bfSmrg ibm*) 67515adf0bfSmrg cpu=i370 67615adf0bfSmrg vendor=ibm 6775b28e182Smrg ;; 67815adf0bfSmrg orion105) 67915adf0bfSmrg cpu=clipper 68015adf0bfSmrg vendor=highlevel 6815b28e182Smrg ;; 68215adf0bfSmrg mac | mpw | mac-mpw) 68315adf0bfSmrg cpu=m68k 68415adf0bfSmrg vendor=apple 6855b28e182Smrg ;; 68615adf0bfSmrg pmac | pmac-mpw) 68715adf0bfSmrg cpu=powerpc 68815adf0bfSmrg vendor=apple 6895b28e182Smrg ;; 6905b28e182Smrg 6915b28e182Smrg # Recognize the various machine names and aliases which stand 6925b28e182Smrg # for a CPU type and a company and sometimes even an OS. 6935b28e182Smrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 69415adf0bfSmrg cpu=m68000 69515adf0bfSmrg vendor=att 6965b28e182Smrg ;; 6975b28e182Smrg 3b*) 69815adf0bfSmrg cpu=we32k 69915adf0bfSmrg vendor=att 7005b28e182Smrg ;; 701f1e20f77Smrg bluegene*) 70215adf0bfSmrg cpu=powerpc 70315adf0bfSmrg vendor=ibm 70415adf0bfSmrg basic_os=cnk 7055b28e182Smrg ;; 7065b28e182Smrg decsystem10* | dec10*) 70715adf0bfSmrg cpu=pdp10 70815adf0bfSmrg vendor=dec 70915adf0bfSmrg basic_os=tops10 7105b28e182Smrg ;; 7115b28e182Smrg decsystem20* | dec20*) 71215adf0bfSmrg cpu=pdp10 71315adf0bfSmrg vendor=dec 71415adf0bfSmrg basic_os=tops20 7155b28e182Smrg ;; 7165b28e182Smrg delta | 3300 | motorola-3300 | motorola-delta \ 7175b28e182Smrg | 3300-motorola | delta-motorola) 71815adf0bfSmrg cpu=m68k 71915adf0bfSmrg vendor=motorola 7205b28e182Smrg ;; 72115adf0bfSmrg dpx2*) 72215adf0bfSmrg cpu=m68k 72315adf0bfSmrg vendor=bull 72415adf0bfSmrg basic_os=sysv3 7255b28e182Smrg ;; 7265b28e182Smrg encore | umax | mmax) 72715adf0bfSmrg cpu=ns32k 72815adf0bfSmrg vendor=encore 7295b28e182Smrg ;; 73015adf0bfSmrg elxsi) 73115adf0bfSmrg cpu=elxsi 73215adf0bfSmrg vendor=elxsi 73315adf0bfSmrg basic_os=${basic_os:-bsd} 7345b28e182Smrg ;; 7355b28e182Smrg fx2800) 73615adf0bfSmrg cpu=i860 73715adf0bfSmrg vendor=alliant 7385b28e182Smrg ;; 7395b28e182Smrg genix) 74015adf0bfSmrg cpu=ns32k 74115adf0bfSmrg vendor=ns 7425b28e182Smrg ;; 7435b28e182Smrg h3050r* | hiux*) 74415adf0bfSmrg cpu=hppa1.1 74515adf0bfSmrg vendor=hitachi 74615adf0bfSmrg basic_os=hiuxwe2 7475b28e182Smrg ;; 7485b28e182Smrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 74915adf0bfSmrg cpu=hppa1.0 75015adf0bfSmrg vendor=hp 7515b28e182Smrg ;; 7525b28e182Smrg hp9k2[0-9][0-9] | hp9k31[0-9]) 75315adf0bfSmrg cpu=m68000 75415adf0bfSmrg vendor=hp 7555b28e182Smrg ;; 7565b28e182Smrg hp9k3[2-9][0-9]) 75715adf0bfSmrg cpu=m68k 75815adf0bfSmrg vendor=hp 7595b28e182Smrg ;; 7605b28e182Smrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 76115adf0bfSmrg cpu=hppa1.0 76215adf0bfSmrg vendor=hp 7635b28e182Smrg ;; 7645b28e182Smrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 76515adf0bfSmrg cpu=hppa1.1 76615adf0bfSmrg vendor=hp 7675b28e182Smrg ;; 7685b28e182Smrg hp9k78[0-9] | hp78[0-9]) 7695b28e182Smrg # FIXME: really hppa2.0-hp 77015adf0bfSmrg cpu=hppa1.1 77115adf0bfSmrg vendor=hp 7725b28e182Smrg ;; 7735b28e182Smrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 7745b28e182Smrg # FIXME: really hppa2.0-hp 77515adf0bfSmrg cpu=hppa1.1 77615adf0bfSmrg vendor=hp 7775b28e182Smrg ;; 7785b28e182Smrg hp9k8[0-9][13679] | hp8[0-9][13679]) 77915adf0bfSmrg cpu=hppa1.1 78015adf0bfSmrg vendor=hp 7815b28e182Smrg ;; 7825b28e182Smrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 78315adf0bfSmrg cpu=hppa1.0 78415adf0bfSmrg vendor=hp 7855b28e182Smrg ;; 7865b28e182Smrg i*86v32) 78715adf0bfSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 78815adf0bfSmrg vendor=pc 78915adf0bfSmrg basic_os=sysv32 7905b28e182Smrg ;; 7915b28e182Smrg i*86v4*) 79215adf0bfSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79315adf0bfSmrg vendor=pc 79415adf0bfSmrg basic_os=sysv4 7955b28e182Smrg ;; 7965b28e182Smrg i*86v) 79715adf0bfSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79815adf0bfSmrg vendor=pc 79915adf0bfSmrg basic_os=sysv 8005b28e182Smrg ;; 8015b28e182Smrg i*86sol2) 80215adf0bfSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 80315adf0bfSmrg vendor=pc 80415adf0bfSmrg basic_os=solaris2 8055b28e182Smrg ;; 80615adf0bfSmrg j90 | j90-cray) 80715adf0bfSmrg cpu=j90 80815adf0bfSmrg vendor=cray 80915adf0bfSmrg basic_os=${basic_os:-unicos} 8105b28e182Smrg ;; 8115b28e182Smrg iris | iris4d) 81215adf0bfSmrg cpu=mips 81315adf0bfSmrg vendor=sgi 81415adf0bfSmrg case $basic_os in 81515adf0bfSmrg irix*) 8165b28e182Smrg ;; 8175b28e182Smrg *) 81815adf0bfSmrg basic_os=irix4 8195b28e182Smrg ;; 8205b28e182Smrg esac 8215b28e182Smrg ;; 8225b28e182Smrg miniframe) 82315adf0bfSmrg cpu=m68000 82415adf0bfSmrg vendor=convergent 8255b28e182Smrg ;; 82615adf0bfSmrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 82715adf0bfSmrg cpu=m68k 82815adf0bfSmrg vendor=atari 82915adf0bfSmrg basic_os=mint 8305b28e182Smrg ;; 8315b28e182Smrg news-3600 | risc-news) 83215adf0bfSmrg cpu=mips 83315adf0bfSmrg vendor=sony 83415adf0bfSmrg basic_os=newsos 83515adf0bfSmrg ;; 83615adf0bfSmrg next | m*-next) 83715adf0bfSmrg cpu=m68k 83815adf0bfSmrg vendor=next 83915adf0bfSmrg case $basic_os in 84015adf0bfSmrg openstep*) 84115adf0bfSmrg ;; 84215adf0bfSmrg nextstep*) 8435b28e182Smrg ;; 84415adf0bfSmrg ns2*) 84515adf0bfSmrg basic_os=nextstep2 8465b28e182Smrg ;; 8475b28e182Smrg *) 84815adf0bfSmrg basic_os=nextstep3 8495b28e182Smrg ;; 8505b28e182Smrg esac 8515b28e182Smrg ;; 8525b28e182Smrg np1) 85315adf0bfSmrg cpu=np1 85415adf0bfSmrg vendor=gould 8555b28e182Smrg ;; 8565b28e182Smrg op50n-* | op60c-*) 85715adf0bfSmrg cpu=hppa1.1 85815adf0bfSmrg vendor=oki 85915adf0bfSmrg basic_os=proelf 8605b28e182Smrg ;; 8615b28e182Smrg pa-hitachi) 86215adf0bfSmrg cpu=hppa1.1 86315adf0bfSmrg vendor=hitachi 86415adf0bfSmrg basic_os=hiuxwe2 8655b28e182Smrg ;; 8665b28e182Smrg pbd) 86715adf0bfSmrg cpu=sparc 86815adf0bfSmrg vendor=tti 8695b28e182Smrg ;; 8705b28e182Smrg pbb) 87115adf0bfSmrg cpu=m68k 87215adf0bfSmrg vendor=tti 8735b28e182Smrg ;; 87415adf0bfSmrg pc532) 87515adf0bfSmrg cpu=ns32k 87615adf0bfSmrg vendor=pc532 8775b28e182Smrg ;; 8785b28e182Smrg pn) 87915adf0bfSmrg cpu=pn 88015adf0bfSmrg vendor=gould 8815b28e182Smrg ;; 88215adf0bfSmrg power) 88315adf0bfSmrg cpu=power 88415adf0bfSmrg vendor=ibm 8855b28e182Smrg ;; 8865b28e182Smrg ps2) 88715adf0bfSmrg cpu=i386 88815adf0bfSmrg vendor=ibm 8895b28e182Smrg ;; 8905b28e182Smrg rm[46]00) 89115adf0bfSmrg cpu=mips 89215adf0bfSmrg vendor=siemens 8935b28e182Smrg ;; 8945b28e182Smrg rtpc | rtpc-*) 89515adf0bfSmrg cpu=romp 89615adf0bfSmrg vendor=ibm 8975b28e182Smrg ;; 89815adf0bfSmrg sde) 89915adf0bfSmrg cpu=mipsisa32 90015adf0bfSmrg vendor=sde 90115adf0bfSmrg basic_os=${basic_os:-elf} 9025b28e182Smrg ;; 90315adf0bfSmrg simso-wrs) 90415adf0bfSmrg cpu=sparclite 90515adf0bfSmrg vendor=wrs 90615adf0bfSmrg basic_os=vxworks 9075b28e182Smrg ;; 90815adf0bfSmrg tower | tower-32) 90915adf0bfSmrg cpu=m68k 91015adf0bfSmrg vendor=ncr 9115b28e182Smrg ;; 91215adf0bfSmrg vpp*|vx|vx-*) 91315adf0bfSmrg cpu=f301 91415adf0bfSmrg vendor=fujitsu 9155b28e182Smrg ;; 91615adf0bfSmrg w65) 91715adf0bfSmrg cpu=w65 91815adf0bfSmrg vendor=wdc 9195b28e182Smrg ;; 92015adf0bfSmrg w89k-*) 92115adf0bfSmrg cpu=hppa1.1 92215adf0bfSmrg vendor=winbond 92315adf0bfSmrg basic_os=proelf 9245b28e182Smrg ;; 92515adf0bfSmrg none) 92615adf0bfSmrg cpu=none 92715adf0bfSmrg vendor=none 9285b28e182Smrg ;; 92915adf0bfSmrg leon|leon[3-9]) 93015adf0bfSmrg cpu=sparc 93115adf0bfSmrg vendor=$basic_machine 9325b28e182Smrg ;; 93315adf0bfSmrg leon-*|leon[3-9]-*) 93415adf0bfSmrg cpu=sparc 93515adf0bfSmrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 9365b28e182Smrg ;; 93715adf0bfSmrg 93815adf0bfSmrg *-*) 93915adf0bfSmrg # shellcheck disable=SC2162 94015adf0bfSmrg saved_IFS=$IFS 94115adf0bfSmrg IFS="-" read cpu vendor <<EOF 94215adf0bfSmrg$basic_machine 94315adf0bfSmrgEOF 94415adf0bfSmrg IFS=$saved_IFS 9455b28e182Smrg ;; 94615adf0bfSmrg # We use `pc' rather than `unknown' 94715adf0bfSmrg # because (1) that's what they normally are, and 94815adf0bfSmrg # (2) the word "unknown" tends to confuse beginning users. 94915adf0bfSmrg i*86 | x86_64) 95015adf0bfSmrg cpu=$basic_machine 95115adf0bfSmrg vendor=pc 9525b28e182Smrg ;; 95315adf0bfSmrg # These rules are duplicated from below for sake of the special case above; 95415adf0bfSmrg # i.e. things that normalized to x86 arches should also default to "pc" 95515adf0bfSmrg pc98) 95615adf0bfSmrg cpu=i386 95715adf0bfSmrg vendor=pc 9585b28e182Smrg ;; 95915adf0bfSmrg x64 | amd64) 96015adf0bfSmrg cpu=x86_64 96115adf0bfSmrg vendor=pc 9625b28e182Smrg ;; 96315adf0bfSmrg # Recognize the basic CPU types without company name. 96415adf0bfSmrg *) 96515adf0bfSmrg cpu=$basic_machine 96615adf0bfSmrg vendor=unknown 9675b28e182Smrg ;; 96815adf0bfSmrgesac 96915adf0bfSmrg 97015adf0bfSmrgunset -v basic_machine 97115adf0bfSmrg 97215adf0bfSmrg# Decode basic machines in the full and proper CPU-Company form. 97315adf0bfSmrgcase $cpu-$vendor in 97415adf0bfSmrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 97515adf0bfSmrg # some cases the only manufacturer, in others, it is the most popular. 97615adf0bfSmrg craynv-unknown) 97715adf0bfSmrg vendor=cray 97815adf0bfSmrg basic_os=${basic_os:-unicosmp} 9795b28e182Smrg ;; 98015adf0bfSmrg c90-unknown | c90-cray) 98115adf0bfSmrg vendor=cray 98215adf0bfSmrg basic_os=${Basic_os:-unicos} 9835b28e182Smrg ;; 98415adf0bfSmrg fx80-unknown) 98515adf0bfSmrg vendor=alliant 9865b28e182Smrg ;; 98715adf0bfSmrg romp-unknown) 98815adf0bfSmrg vendor=ibm 9895b28e182Smrg ;; 99015adf0bfSmrg mmix-unknown) 99115adf0bfSmrg vendor=knuth 9925b28e182Smrg ;; 99315adf0bfSmrg microblaze-unknown | microblazeel-unknown) 99415adf0bfSmrg vendor=xilinx 9955b28e182Smrg ;; 99615adf0bfSmrg rs6000-unknown) 99715adf0bfSmrg vendor=ibm 9985b28e182Smrg ;; 99915adf0bfSmrg vax-unknown) 100015adf0bfSmrg vendor=dec 10015b28e182Smrg ;; 100215adf0bfSmrg pdp11-unknown) 100315adf0bfSmrg vendor=dec 10045b28e182Smrg ;; 100515adf0bfSmrg we32k-unknown) 100615adf0bfSmrg vendor=att 10075b28e182Smrg ;; 100815adf0bfSmrg cydra-unknown) 100915adf0bfSmrg vendor=cydrome 10105b28e182Smrg ;; 101115adf0bfSmrg i370-ibm*) 101215adf0bfSmrg vendor=ibm 10135b28e182Smrg ;; 101415adf0bfSmrg orion-unknown) 101515adf0bfSmrg vendor=highlevel 10165b28e182Smrg ;; 101715adf0bfSmrg xps-unknown | xps100-unknown) 101815adf0bfSmrg cpu=xps100 101915adf0bfSmrg vendor=honeywell 10205b28e182Smrg ;; 102115adf0bfSmrg 102215adf0bfSmrg # Here we normalize CPU types with a missing or matching vendor 102315adf0bfSmrg armh-unknown | armh-alt) 102415adf0bfSmrg cpu=armv7l 102515adf0bfSmrg vendor=alt 102615adf0bfSmrg basic_os=${basic_os:-linux-gnueabihf} 10275b28e182Smrg ;; 102815adf0bfSmrg dpx20-unknown | dpx20-bull) 102915adf0bfSmrg cpu=rs6000 103015adf0bfSmrg vendor=bull 103115adf0bfSmrg basic_os=${basic_os:-bosx} 10325b28e182Smrg ;; 103315adf0bfSmrg 103415adf0bfSmrg # Here we normalize CPU types irrespective of the vendor 103515adf0bfSmrg amd64-*) 103615adf0bfSmrg cpu=x86_64 10375b28e182Smrg ;; 103815adf0bfSmrg blackfin-*) 103915adf0bfSmrg cpu=bfin 104015adf0bfSmrg basic_os=linux 10415b28e182Smrg ;; 104215adf0bfSmrg c54x-*) 104315adf0bfSmrg cpu=tic54x 10445b28e182Smrg ;; 104515adf0bfSmrg c55x-*) 104615adf0bfSmrg cpu=tic55x 10475b28e182Smrg ;; 104815adf0bfSmrg c6x-*) 104915adf0bfSmrg cpu=tic6x 10505b28e182Smrg ;; 105115adf0bfSmrg e500v[12]-*) 105215adf0bfSmrg cpu=powerpc 105315adf0bfSmrg basic_os=${basic_os}"spe" 10545b28e182Smrg ;; 105515adf0bfSmrg mips3*-*) 105615adf0bfSmrg cpu=mips64 10575b28e182Smrg ;; 105815adf0bfSmrg ms1-*) 105915adf0bfSmrg cpu=mt 10605b28e182Smrg ;; 106115adf0bfSmrg m68knommu-*) 106215adf0bfSmrg cpu=m68k 106315adf0bfSmrg basic_os=linux 10645b28e182Smrg ;; 106515adf0bfSmrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 106615adf0bfSmrg cpu=s12z 10675b28e182Smrg ;; 106815adf0bfSmrg openrisc-*) 106915adf0bfSmrg cpu=or32 10705b28e182Smrg ;; 107115adf0bfSmrg parisc-*) 107215adf0bfSmrg cpu=hppa 107315adf0bfSmrg basic_os=linux 10745b28e182Smrg ;; 107515adf0bfSmrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 107615adf0bfSmrg cpu=i586 10775b28e182Smrg ;; 107815adf0bfSmrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 107915adf0bfSmrg cpu=i686 10805b28e182Smrg ;; 108115adf0bfSmrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 108215adf0bfSmrg cpu=i686 10835b28e182Smrg ;; 108415adf0bfSmrg pentium4-*) 108515adf0bfSmrg cpu=i786 10865b28e182Smrg ;; 108715adf0bfSmrg pc98-*) 108815adf0bfSmrg cpu=i386 10895b28e182Smrg ;; 109015adf0bfSmrg ppc-* | ppcbe-*) 109115adf0bfSmrg cpu=powerpc 10925b28e182Smrg ;; 109315adf0bfSmrg ppcle-* | powerpclittle-*) 109415adf0bfSmrg cpu=powerpcle 10955b28e182Smrg ;; 109615adf0bfSmrg ppc64-*) 109715adf0bfSmrg cpu=powerpc64 10985b28e182Smrg ;; 109915adf0bfSmrg ppc64le-* | powerpc64little-*) 110015adf0bfSmrg cpu=powerpc64le 11015b28e182Smrg ;; 110215adf0bfSmrg sb1-*) 110315adf0bfSmrg cpu=mipsisa64sb1 11045b28e182Smrg ;; 110515adf0bfSmrg sb1el-*) 110615adf0bfSmrg cpu=mipsisa64sb1el 11075b28e182Smrg ;; 110815adf0bfSmrg sh5e[lb]-*) 110915adf0bfSmrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 11105b28e182Smrg ;; 111115adf0bfSmrg spur-*) 111215adf0bfSmrg cpu=spur 11135b28e182Smrg ;; 111415adf0bfSmrg strongarm-* | thumb-*) 111515adf0bfSmrg cpu=arm 11165b28e182Smrg ;; 111715adf0bfSmrg tx39-*) 111815adf0bfSmrg cpu=mipstx39 11195b28e182Smrg ;; 112015adf0bfSmrg tx39el-*) 112115adf0bfSmrg cpu=mipstx39el 11225b28e182Smrg ;; 112315adf0bfSmrg x64-*) 112415adf0bfSmrg cpu=x86_64 11255b28e182Smrg ;; 112615adf0bfSmrg xscale-* | xscalee[bl]-*) 112715adf0bfSmrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 11285b28e182Smrg ;; 112915adf0bfSmrg arm64-* | aarch64le-*) 113015adf0bfSmrg cpu=aarch64 11315b28e182Smrg ;; 113215adf0bfSmrg 113315adf0bfSmrg # Recognize the canonical CPU Types that limit and/or modify the 113415adf0bfSmrg # company names they are paired with. 113515adf0bfSmrg cr16-*) 113615adf0bfSmrg basic_os=${basic_os:-elf} 11375b28e182Smrg ;; 113815adf0bfSmrg crisv32-* | etraxfs*-*) 113915adf0bfSmrg cpu=crisv32 114015adf0bfSmrg vendor=axis 11415b28e182Smrg ;; 114215adf0bfSmrg cris-* | etrax*-*) 114315adf0bfSmrg cpu=cris 114415adf0bfSmrg vendor=axis 11455b28e182Smrg ;; 114615adf0bfSmrg crx-*) 114715adf0bfSmrg basic_os=${basic_os:-elf} 11485b28e182Smrg ;; 114915adf0bfSmrg neo-tandem) 115015adf0bfSmrg cpu=neo 115115adf0bfSmrg vendor=tandem 11525b28e182Smrg ;; 115315adf0bfSmrg nse-tandem) 115415adf0bfSmrg cpu=nse 115515adf0bfSmrg vendor=tandem 11565b28e182Smrg ;; 115715adf0bfSmrg nsr-tandem) 115815adf0bfSmrg cpu=nsr 115915adf0bfSmrg vendor=tandem 11605b28e182Smrg ;; 116115adf0bfSmrg nsv-tandem) 116215adf0bfSmrg cpu=nsv 116315adf0bfSmrg vendor=tandem 11645b28e182Smrg ;; 116515adf0bfSmrg nsx-tandem) 116615adf0bfSmrg cpu=nsx 116715adf0bfSmrg vendor=tandem 11685b28e182Smrg ;; 116915adf0bfSmrg mipsallegrexel-sony) 117015adf0bfSmrg cpu=mipsallegrexel 117115adf0bfSmrg vendor=sony 11725b28e182Smrg ;; 117315adf0bfSmrg tile*-*) 117415adf0bfSmrg basic_os=${basic_os:-linux-gnu} 11755b28e182Smrg ;; 117615adf0bfSmrg 11775b28e182Smrg *) 117815adf0bfSmrg # Recognize the canonical CPU types that are allowed with any 117915adf0bfSmrg # company name. 118015adf0bfSmrg case $cpu in 118115adf0bfSmrg 1750a | 580 \ 118215adf0bfSmrg | a29k \ 118315adf0bfSmrg | aarch64 | aarch64_be \ 118415adf0bfSmrg | abacus \ 118515adf0bfSmrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 118615adf0bfSmrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 118715adf0bfSmrg | alphapca5[67] | alpha64pca5[67] \ 118815adf0bfSmrg | am33_2.0 \ 118915adf0bfSmrg | amdgcn \ 119015adf0bfSmrg | arc | arceb | arc32 | arc64 \ 119115adf0bfSmrg | arm | arm[lb]e | arme[lb] | armv* \ 119215adf0bfSmrg | avr | avr32 \ 119315adf0bfSmrg | asmjs \ 119415adf0bfSmrg | ba \ 119515adf0bfSmrg | be32 | be64 \ 119615adf0bfSmrg | bfin | bpf | bs2000 \ 119715adf0bfSmrg | c[123]* | c30 | [cjt]90 | c4x \ 119815adf0bfSmrg | c8051 | clipper | craynv | csky | cydra \ 119915adf0bfSmrg | d10v | d30v | dlx | dsp16xx \ 120015adf0bfSmrg | e2k | elxsi | epiphany \ 120115adf0bfSmrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 120215adf0bfSmrg | h8300 | h8500 \ 120315adf0bfSmrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 120415adf0bfSmrg | hexagon \ 120515adf0bfSmrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 120615adf0bfSmrg | ip2k | iq2000 \ 120715adf0bfSmrg | k1om \ 120815adf0bfSmrg | le32 | le64 \ 120915adf0bfSmrg | lm32 \ 121015adf0bfSmrg | loongarch32 | loongarch64 \ 121115adf0bfSmrg | m32c | m32r | m32rle \ 121215adf0bfSmrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 121315adf0bfSmrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 121415adf0bfSmrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 121515adf0bfSmrg | microblaze | microblazeel \ 121615adf0bfSmrg | mips | mipsbe | mipseb | mipsel | mipsle \ 121715adf0bfSmrg | mips16 \ 121815adf0bfSmrg | mips64 | mips64eb | mips64el \ 121915adf0bfSmrg | mips64octeon | mips64octeonel \ 122015adf0bfSmrg | mips64orion | mips64orionel \ 122115adf0bfSmrg | mips64r5900 | mips64r5900el \ 122215adf0bfSmrg | mips64vr | mips64vrel \ 122315adf0bfSmrg | mips64vr4100 | mips64vr4100el \ 122415adf0bfSmrg | mips64vr4300 | mips64vr4300el \ 122515adf0bfSmrg | mips64vr5000 | mips64vr5000el \ 122615adf0bfSmrg | mips64vr5900 | mips64vr5900el \ 122715adf0bfSmrg | mipsisa32 | mipsisa32el \ 122815adf0bfSmrg | mipsisa32r2 | mipsisa32r2el \ 122915adf0bfSmrg | mipsisa32r3 | mipsisa32r3el \ 123015adf0bfSmrg | mipsisa32r5 | mipsisa32r5el \ 123115adf0bfSmrg | mipsisa32r6 | mipsisa32r6el \ 123215adf0bfSmrg | mipsisa64 | mipsisa64el \ 123315adf0bfSmrg | mipsisa64r2 | mipsisa64r2el \ 123415adf0bfSmrg | mipsisa64r3 | mipsisa64r3el \ 123515adf0bfSmrg | mipsisa64r5 | mipsisa64r5el \ 123615adf0bfSmrg | mipsisa64r6 | mipsisa64r6el \ 123715adf0bfSmrg | mipsisa64sb1 | mipsisa64sb1el \ 123815adf0bfSmrg | mipsisa64sr71k | mipsisa64sr71kel \ 123915adf0bfSmrg | mipsr5900 | mipsr5900el \ 124015adf0bfSmrg | mipstx39 | mipstx39el \ 124115adf0bfSmrg | mmix \ 124215adf0bfSmrg | mn10200 | mn10300 \ 124315adf0bfSmrg | moxie \ 124415adf0bfSmrg | mt \ 124515adf0bfSmrg | msp430 \ 124615adf0bfSmrg | nds32 | nds32le | nds32be \ 124715adf0bfSmrg | nfp \ 124815adf0bfSmrg | nios | nios2 | nios2eb | nios2el \ 124915adf0bfSmrg | none | np1 | ns16k | ns32k | nvptx \ 125015adf0bfSmrg | open8 \ 125115adf0bfSmrg | or1k* \ 125215adf0bfSmrg | or32 \ 125315adf0bfSmrg | orion \ 125415adf0bfSmrg | picochip \ 125515adf0bfSmrg | pdp10 | pdp11 | pj | pjl | pn | power \ 125615adf0bfSmrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 125715adf0bfSmrg | pru \ 125815adf0bfSmrg | pyramid \ 125915adf0bfSmrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 126015adf0bfSmrg | rl78 | romp | rs6000 | rx \ 126115adf0bfSmrg | s390 | s390x \ 126215adf0bfSmrg | score \ 126315adf0bfSmrg | sh | shl \ 126415adf0bfSmrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 126515adf0bfSmrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 126615adf0bfSmrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 126715adf0bfSmrg | sparclite \ 126815adf0bfSmrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 126915adf0bfSmrg | spu \ 127015adf0bfSmrg | tahoe \ 127115adf0bfSmrg | thumbv7* \ 127215adf0bfSmrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 127315adf0bfSmrg | tron \ 127415adf0bfSmrg | ubicom32 \ 127515adf0bfSmrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 127615adf0bfSmrg | vax \ 127715adf0bfSmrg | visium \ 127815adf0bfSmrg | w65 \ 127915adf0bfSmrg | wasm32 | wasm64 \ 128015adf0bfSmrg | we32k \ 128115adf0bfSmrg | x86 | x86_64 | xc16x | xgate | xps100 \ 128215adf0bfSmrg | xstormy16 | xtensa* \ 128315adf0bfSmrg | ymp \ 128415adf0bfSmrg | z8k | z80) 128515adf0bfSmrg ;; 128615adf0bfSmrg 128715adf0bfSmrg *) 128815adf0bfSmrg echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 128915adf0bfSmrg exit 1 129015adf0bfSmrg ;; 129115adf0bfSmrg esac 12925b28e182Smrg ;; 12935b28e182Smrgesac 12945b28e182Smrg 12955b28e182Smrg# Here we canonicalize certain aliases for manufacturers. 129615adf0bfSmrgcase $vendor in 129715adf0bfSmrg digital*) 129815adf0bfSmrg vendor=dec 12995b28e182Smrg ;; 130015adf0bfSmrg commodore*) 130115adf0bfSmrg vendor=cbm 13025b28e182Smrg ;; 13035b28e182Smrg *) 13045b28e182Smrg ;; 13055b28e182Smrgesac 13065b28e182Smrg 13075b28e182Smrg# Decode manufacturer-specific aliases for certain operating systems. 13085b28e182Smrg 130915adf0bfSmrgif test x$basic_os != x 13105b28e182Smrgthen 131115adf0bfSmrg 131215adf0bfSmrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 131315adf0bfSmrg# set os. 131415adf0bfSmrgcase $basic_os in 131515adf0bfSmrg gnu/linux*) 131615adf0bfSmrg kernel=linux 131715adf0bfSmrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 131815adf0bfSmrg ;; 131915adf0bfSmrg os2-emx) 132015adf0bfSmrg kernel=os2 132115adf0bfSmrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 132215adf0bfSmrg ;; 132315adf0bfSmrg nto-qnx*) 132415adf0bfSmrg kernel=nto 132515adf0bfSmrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 132615adf0bfSmrg ;; 132715adf0bfSmrg *-*) 132815adf0bfSmrg # shellcheck disable=SC2162 132915adf0bfSmrg saved_IFS=$IFS 133015adf0bfSmrg IFS="-" read kernel os <<EOF 133115adf0bfSmrg$basic_os 133215adf0bfSmrgEOF 133315adf0bfSmrg IFS=$saved_IFS 133415adf0bfSmrg ;; 133515adf0bfSmrg # Default OS when just kernel was specified 133615adf0bfSmrg nto*) 133715adf0bfSmrg kernel=nto 133815adf0bfSmrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 133915adf0bfSmrg ;; 134015adf0bfSmrg linux*) 134115adf0bfSmrg kernel=linux 134215adf0bfSmrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 134315adf0bfSmrg ;; 134415adf0bfSmrg managarm*) 134515adf0bfSmrg kernel=managarm 134615adf0bfSmrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 134715adf0bfSmrg ;; 134815adf0bfSmrg *) 134915adf0bfSmrg kernel= 135015adf0bfSmrg os=$basic_os 135115adf0bfSmrg ;; 135215adf0bfSmrgesac 135315adf0bfSmrg 135415adf0bfSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 135515adf0bfSmrg# etc.) 13565b28e182Smrgcase $os in 135715adf0bfSmrg # First match some system type aliases that might get confused 135815adf0bfSmrg # with valid system types. 135915adf0bfSmrg # solaris* is a basic system type, with this one exception. 136015adf0bfSmrg auroraux) 136115adf0bfSmrg os=auroraux 1362f1e20f77Smrg ;; 136315adf0bfSmrg bluegene*) 136415adf0bfSmrg os=cnk 13655b28e182Smrg ;; 136615adf0bfSmrg solaris1 | solaris1.*) 136715adf0bfSmrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 13685b28e182Smrg ;; 136915adf0bfSmrg solaris) 137015adf0bfSmrg os=solaris2 13715b28e182Smrg ;; 137215adf0bfSmrg unixware*) 137315adf0bfSmrg os=sysv4.2uw 13745b28e182Smrg ;; 137515adf0bfSmrg # es1800 is here to avoid being matched by es* (a different OS) 137615adf0bfSmrg es1800*) 137715adf0bfSmrg os=ose 13785b28e182Smrg ;; 137915adf0bfSmrg # Some version numbers need modification 138015adf0bfSmrg chorusos*) 138115adf0bfSmrg os=chorusos 13825b28e182Smrg ;; 138315adf0bfSmrg isc) 138415adf0bfSmrg os=isc2.2 13855b28e182Smrg ;; 138615adf0bfSmrg sco6) 138715adf0bfSmrg os=sco5v6 13885b28e182Smrg ;; 138915adf0bfSmrg sco5) 139015adf0bfSmrg os=sco3.2v5 13915b28e182Smrg ;; 139215adf0bfSmrg sco4) 139315adf0bfSmrg os=sco3.2v4 13945b28e182Smrg ;; 139515adf0bfSmrg sco3.2.[4-9]*) 139615adf0bfSmrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 13975b28e182Smrg ;; 139815adf0bfSmrg sco*v* | scout) 139915adf0bfSmrg # Don't match below 14005b28e182Smrg ;; 140115adf0bfSmrg sco*) 140215adf0bfSmrg os=sco3.2v2 14035b28e182Smrg ;; 140415adf0bfSmrg psos*) 140515adf0bfSmrg os=psos 14065b28e182Smrg ;; 140715adf0bfSmrg qnx*) 140815adf0bfSmrg os=qnx 14095b28e182Smrg ;; 141015adf0bfSmrg hiux*) 141115adf0bfSmrg os=hiuxwe2 14125b28e182Smrg ;; 141315adf0bfSmrg lynx*178) 141415adf0bfSmrg os=lynxos178 14155b28e182Smrg ;; 141615adf0bfSmrg lynx*5) 141715adf0bfSmrg os=lynxos5 14185b28e182Smrg ;; 141915adf0bfSmrg lynxos*) 142015adf0bfSmrg # don't get caught up in next wildcard 14215b28e182Smrg ;; 142215adf0bfSmrg lynx*) 142315adf0bfSmrg os=lynxos 14245b28e182Smrg ;; 142515adf0bfSmrg mac[0-9]*) 142615adf0bfSmrg os=`echo "$os" | sed -e 's|mac|macos|'` 14275b28e182Smrg ;; 142815adf0bfSmrg opened*) 142915adf0bfSmrg os=openedition 14305b28e182Smrg ;; 143115adf0bfSmrg os400*) 143215adf0bfSmrg os=os400 14335b28e182Smrg ;; 143415adf0bfSmrg sunos5*) 143515adf0bfSmrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 14365b28e182Smrg ;; 143715adf0bfSmrg sunos6*) 143815adf0bfSmrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 14395b28e182Smrg ;; 144015adf0bfSmrg wince*) 144115adf0bfSmrg os=wince 14425b28e182Smrg ;; 144315adf0bfSmrg utek*) 144415adf0bfSmrg os=bsd 14455b28e182Smrg ;; 144615adf0bfSmrg dynix*) 144715adf0bfSmrg os=bsd 14485b28e182Smrg ;; 144915adf0bfSmrg acis*) 145015adf0bfSmrg os=aos 14515b28e182Smrg ;; 145215adf0bfSmrg atheos*) 145315adf0bfSmrg os=atheos 14545b28e182Smrg ;; 145515adf0bfSmrg syllable*) 145615adf0bfSmrg os=syllable 14575b28e182Smrg ;; 145815adf0bfSmrg 386bsd) 145915adf0bfSmrg os=bsd 14605b28e182Smrg ;; 146115adf0bfSmrg ctix* | uts*) 146215adf0bfSmrg os=sysv 14635b28e182Smrg ;; 146415adf0bfSmrg nova*) 146515adf0bfSmrg os=rtmk-nova 14665b28e182Smrg ;; 146715adf0bfSmrg ns2) 146815adf0bfSmrg os=nextstep2 14695b28e182Smrg ;; 147015adf0bfSmrg # Preserve the version number of sinix5. 147115adf0bfSmrg sinix5.*) 147215adf0bfSmrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 14735b28e182Smrg ;; 147415adf0bfSmrg sinix*) 147515adf0bfSmrg os=sysv4 14765b28e182Smrg ;; 147715adf0bfSmrg tpf*) 147815adf0bfSmrg os=tpf 14795b28e182Smrg ;; 148015adf0bfSmrg triton*) 148115adf0bfSmrg os=sysv3 14825b28e182Smrg ;; 148315adf0bfSmrg oss*) 148415adf0bfSmrg os=sysv3 14855b28e182Smrg ;; 148615adf0bfSmrg svr4*) 148715adf0bfSmrg os=sysv4 14885b28e182Smrg ;; 148915adf0bfSmrg svr3) 149015adf0bfSmrg os=sysv3 14915b28e182Smrg ;; 149215adf0bfSmrg sysvr4) 149315adf0bfSmrg os=sysv4 14945b28e182Smrg ;; 149515adf0bfSmrg ose*) 149615adf0bfSmrg os=ose 14975b28e182Smrg ;; 149815adf0bfSmrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 149915adf0bfSmrg os=mint 15005b28e182Smrg ;; 150115adf0bfSmrg dicos*) 150215adf0bfSmrg os=dicos 15035b28e182Smrg ;; 150415adf0bfSmrg pikeos*) 150515adf0bfSmrg # Until real need of OS specific support for 150615adf0bfSmrg # particular features comes up, bare metal 150715adf0bfSmrg # configurations are quite functional. 150815adf0bfSmrg case $cpu in 150915adf0bfSmrg arm*) 151015adf0bfSmrg os=eabi 151115adf0bfSmrg ;; 151215adf0bfSmrg *) 151315adf0bfSmrg os=elf 151415adf0bfSmrg ;; 151515adf0bfSmrg esac 15165b28e182Smrg ;; 15175b28e182Smrg *) 151815adf0bfSmrg # No normalization, but not necessarily accepted, that comes below. 15195b28e182Smrg ;; 15205b28e182Smrgesac 152115adf0bfSmrg 15225b28e182Smrgelse 15235b28e182Smrg 15245b28e182Smrg# Here we handle the default operating systems that come with various machines. 15255b28e182Smrg# The value should be what the vendor currently ships out the door with their 15265b28e182Smrg# machine or put another way, the most popular os provided with the machine. 15275b28e182Smrg 15285b28e182Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 15295b28e182Smrg# "-sun"), then you have to tell the case statement up towards the top 15305b28e182Smrg# that MANUFACTURER isn't an operating system. Otherwise, code above 15315b28e182Smrg# will signal an error saying that MANUFACTURER isn't an operating 15325b28e182Smrg# system, and we'll never get to this point. 15335b28e182Smrg 153415adf0bfSmrgkernel= 153515adf0bfSmrgcase $cpu-$vendor in 153615adf0bfSmrg score-*) 153715adf0bfSmrg os=elf 15385b28e182Smrg ;; 153915adf0bfSmrg spu-*) 154015adf0bfSmrg os=elf 15415b28e182Smrg ;; 15425b28e182Smrg *-acorn) 154315adf0bfSmrg os=riscix1.2 15445b28e182Smrg ;; 15455b28e182Smrg arm*-rebel) 154615adf0bfSmrg kernel=linux 154715adf0bfSmrg os=gnu 15485b28e182Smrg ;; 15495b28e182Smrg arm*-semi) 155015adf0bfSmrg os=aout 155115adf0bfSmrg ;; 155215adf0bfSmrg c4x-* | tic4x-*) 155315adf0bfSmrg os=coff 155415adf0bfSmrg ;; 155515adf0bfSmrg c8051-*) 155615adf0bfSmrg os=elf 155715adf0bfSmrg ;; 155815adf0bfSmrg clipper-intergraph) 155915adf0bfSmrg os=clix 15605b28e182Smrg ;; 156115adf0bfSmrg hexagon-*) 156215adf0bfSmrg os=elf 15635b28e182Smrg ;; 1564f1e20f77Smrg tic54x-*) 156515adf0bfSmrg os=coff 1566f1e20f77Smrg ;; 1567f1e20f77Smrg tic55x-*) 156815adf0bfSmrg os=coff 1569f1e20f77Smrg ;; 1570f1e20f77Smrg tic6x-*) 157115adf0bfSmrg os=coff 1572f1e20f77Smrg ;; 15735b28e182Smrg # This must come before the *-dec entry. 15745b28e182Smrg pdp10-*) 157515adf0bfSmrg os=tops20 15765b28e182Smrg ;; 15775b28e182Smrg pdp11-*) 157815adf0bfSmrg os=none 15795b28e182Smrg ;; 15805b28e182Smrg *-dec | vax-*) 158115adf0bfSmrg os=ultrix4.2 15825b28e182Smrg ;; 15835b28e182Smrg m68*-apollo) 158415adf0bfSmrg os=domain 15855b28e182Smrg ;; 15865b28e182Smrg i386-sun) 158715adf0bfSmrg os=sunos4.0.2 15885b28e182Smrg ;; 15895b28e182Smrg m68000-sun) 159015adf0bfSmrg os=sunos3 15915b28e182Smrg ;; 15925b28e182Smrg m68*-cisco) 159315adf0bfSmrg os=aout 15945b28e182Smrg ;; 159515adf0bfSmrg mep-*) 159615adf0bfSmrg os=elf 15975b28e182Smrg ;; 15985b28e182Smrg mips*-cisco) 159915adf0bfSmrg os=elf 16005b28e182Smrg ;; 16015b28e182Smrg mips*-*) 160215adf0bfSmrg os=elf 16035b28e182Smrg ;; 16045b28e182Smrg or32-*) 160515adf0bfSmrg os=coff 16065b28e182Smrg ;; 16075b28e182Smrg *-tti) # must be before sparc entry or we get the wrong os. 160815adf0bfSmrg os=sysv3 16095b28e182Smrg ;; 16105b28e182Smrg sparc-* | *-sun) 161115adf0bfSmrg os=sunos4.1.1 16125b28e182Smrg ;; 161315adf0bfSmrg pru-*) 161415adf0bfSmrg os=elf 16155b28e182Smrg ;; 161615adf0bfSmrg *-be) 161715adf0bfSmrg os=beos 16185b28e182Smrg ;; 16195b28e182Smrg *-ibm) 162015adf0bfSmrg os=aix 16215b28e182Smrg ;; 162215adf0bfSmrg *-knuth) 162315adf0bfSmrg os=mmixware 16245b28e182Smrg ;; 16255b28e182Smrg *-wec) 162615adf0bfSmrg os=proelf 16275b28e182Smrg ;; 16285b28e182Smrg *-winbond) 162915adf0bfSmrg os=proelf 16305b28e182Smrg ;; 16315b28e182Smrg *-oki) 163215adf0bfSmrg os=proelf 16335b28e182Smrg ;; 16345b28e182Smrg *-hp) 163515adf0bfSmrg os=hpux 16365b28e182Smrg ;; 16375b28e182Smrg *-hitachi) 163815adf0bfSmrg os=hiux 16395b28e182Smrg ;; 16405b28e182Smrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 164115adf0bfSmrg os=sysv 16425b28e182Smrg ;; 16435b28e182Smrg *-cbm) 164415adf0bfSmrg os=amigaos 16455b28e182Smrg ;; 16465b28e182Smrg *-dg) 164715adf0bfSmrg os=dgux 16485b28e182Smrg ;; 16495b28e182Smrg *-dolphin) 165015adf0bfSmrg os=sysv3 16515b28e182Smrg ;; 16525b28e182Smrg m68k-ccur) 165315adf0bfSmrg os=rtu 16545b28e182Smrg ;; 16555b28e182Smrg m88k-omron*) 165615adf0bfSmrg os=luna 16575b28e182Smrg ;; 165815adf0bfSmrg *-next) 165915adf0bfSmrg os=nextstep 16605b28e182Smrg ;; 16615b28e182Smrg *-sequent) 166215adf0bfSmrg os=ptx 16635b28e182Smrg ;; 16645b28e182Smrg *-crds) 166515adf0bfSmrg os=unos 16665b28e182Smrg ;; 16675b28e182Smrg *-ns) 166815adf0bfSmrg os=genix 16695b28e182Smrg ;; 16705b28e182Smrg i370-*) 167115adf0bfSmrg os=mvs 16725b28e182Smrg ;; 16735b28e182Smrg *-gould) 167415adf0bfSmrg os=sysv 16755b28e182Smrg ;; 16765b28e182Smrg *-highlevel) 167715adf0bfSmrg os=bsd 16785b28e182Smrg ;; 16795b28e182Smrg *-encore) 168015adf0bfSmrg os=bsd 16815b28e182Smrg ;; 16825b28e182Smrg *-sgi) 168315adf0bfSmrg os=irix 16845b28e182Smrg ;; 16855b28e182Smrg *-siemens) 168615adf0bfSmrg os=sysv4 16875b28e182Smrg ;; 16885b28e182Smrg *-masscomp) 168915adf0bfSmrg os=rtu 16905b28e182Smrg ;; 16915b28e182Smrg f30[01]-fujitsu | f700-fujitsu) 169215adf0bfSmrg os=uxpv 16935b28e182Smrg ;; 16945b28e182Smrg *-rom68k) 169515adf0bfSmrg os=coff 16965b28e182Smrg ;; 16975b28e182Smrg *-*bug) 169815adf0bfSmrg os=coff 16995b28e182Smrg ;; 17005b28e182Smrg *-apple) 170115adf0bfSmrg os=macos 17025b28e182Smrg ;; 17035b28e182Smrg *-atari*) 170415adf0bfSmrg os=mint 170515adf0bfSmrg ;; 170615adf0bfSmrg *-wrs) 170715adf0bfSmrg os=vxworks 17085b28e182Smrg ;; 17095b28e182Smrg *) 171015adf0bfSmrg os=none 17115b28e182Smrg ;; 17125b28e182Smrgesac 171315adf0bfSmrg 17145b28e182Smrgfi 17155b28e182Smrg 171615adf0bfSmrg# Now, validate our (potentially fixed-up) OS. 171715adf0bfSmrgcase $os in 171815adf0bfSmrg # Sometimes we do "kernel-libc", so those need to count as OSes. 171915adf0bfSmrg musl* | newlib* | relibc* | uclibc*) 172015adf0bfSmrg ;; 172115adf0bfSmrg # Likewise for "kernel-abi" 172215adf0bfSmrg eabi* | gnueabi*) 172315adf0bfSmrg ;; 172415adf0bfSmrg # VxWorks passes extra cpu info in the 4th filed. 172515adf0bfSmrg simlinux | simwindows | spe) 172615adf0bfSmrg ;; 172715adf0bfSmrg # Now accept the basic system types. 172815adf0bfSmrg # The portable systems comes first. 172915adf0bfSmrg # Each alternative MUST end in a * to match a version number. 173015adf0bfSmrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 173115adf0bfSmrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 173215adf0bfSmrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 173315adf0bfSmrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 173415adf0bfSmrg | hiux* | abug | nacl* | netware* | windows* \ 173515adf0bfSmrg | os9* | macos* | osx* | ios* \ 173615adf0bfSmrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 173715adf0bfSmrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 173815adf0bfSmrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 173915adf0bfSmrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 174015adf0bfSmrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 174115adf0bfSmrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 174215adf0bfSmrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 174315adf0bfSmrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 174415adf0bfSmrg | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 174515adf0bfSmrg | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 174615adf0bfSmrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 174715adf0bfSmrg | chorusrdb* | cegcc* | glidix* | serenity* \ 174815adf0bfSmrg | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 174915adf0bfSmrg | midipix* | mingw32* | mingw64* | mint* \ 175015adf0bfSmrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 175115adf0bfSmrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 175215adf0bfSmrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 175315adf0bfSmrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 175415adf0bfSmrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 175515adf0bfSmrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 175615adf0bfSmrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 175715adf0bfSmrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 175815adf0bfSmrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 175915adf0bfSmrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 176015adf0bfSmrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 176115adf0bfSmrg | fiwix* | mlibc* ) 176215adf0bfSmrg ;; 176315adf0bfSmrg # This one is extra strict with allowed versions 176415adf0bfSmrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 176515adf0bfSmrg # Don't forget version if it is 3.2v4 or newer. 176615adf0bfSmrg ;; 176715adf0bfSmrg none) 176815adf0bfSmrg ;; 176915adf0bfSmrg kernel* ) 177015adf0bfSmrg # Restricted further below 177115adf0bfSmrg ;; 177215adf0bfSmrg *) 177315adf0bfSmrg echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 177415adf0bfSmrg exit 1 177515adf0bfSmrg ;; 177615adf0bfSmrgesac 177715adf0bfSmrg 177815adf0bfSmrg# As a final step for OS-related things, validate the OS-kernel combination 177915adf0bfSmrg# (given a valid OS), if there is a kernel. 178015adf0bfSmrgcase $kernel-$os in 178115adf0bfSmrg linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 178215adf0bfSmrg | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 178315adf0bfSmrg ;; 178415adf0bfSmrg uclinux-uclibc* ) 178515adf0bfSmrg ;; 178615adf0bfSmrg managarm-mlibc* | managarm-kernel* ) 178715adf0bfSmrg ;; 178815adf0bfSmrg -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 178915adf0bfSmrg # These are just libc implementations, not actual OSes, and thus 179015adf0bfSmrg # require a kernel. 179115adf0bfSmrg echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 179215adf0bfSmrg exit 1 179315adf0bfSmrg ;; 179415adf0bfSmrg -kernel* ) 179515adf0bfSmrg echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 179615adf0bfSmrg exit 1 179715adf0bfSmrg ;; 179815adf0bfSmrg *-kernel* ) 179915adf0bfSmrg echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 180015adf0bfSmrg exit 1 180115adf0bfSmrg ;; 180215adf0bfSmrg kfreebsd*-gnu* | kopensolaris*-gnu*) 180315adf0bfSmrg ;; 180415adf0bfSmrg vxworks-simlinux | vxworks-simwindows | vxworks-spe) 180515adf0bfSmrg ;; 180615adf0bfSmrg nto-qnx*) 180715adf0bfSmrg ;; 180815adf0bfSmrg os2-emx) 180915adf0bfSmrg ;; 181015adf0bfSmrg *-eabi* | *-gnueabi*) 181115adf0bfSmrg ;; 181215adf0bfSmrg -*) 181315adf0bfSmrg # Blank kernel with real OS is always fine. 181415adf0bfSmrg ;; 181515adf0bfSmrg *-*) 181615adf0bfSmrg echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 181715adf0bfSmrg exit 1 181815adf0bfSmrg ;; 181915adf0bfSmrgesac 182015adf0bfSmrg 18215b28e182Smrg# Here we handle the case where we know the os, and the CPU type, but not the 18225b28e182Smrg# manufacturer. We pick the logical manufacturer. 182315adf0bfSmrgcase $vendor in 182415adf0bfSmrg unknown) 182515adf0bfSmrg case $cpu-$os in 182615adf0bfSmrg *-riscix*) 18275b28e182Smrg vendor=acorn 18285b28e182Smrg ;; 182915adf0bfSmrg *-sunos*) 18305b28e182Smrg vendor=sun 18315b28e182Smrg ;; 183215adf0bfSmrg *-cnk* | *-aix*) 18335b28e182Smrg vendor=ibm 18345b28e182Smrg ;; 183515adf0bfSmrg *-beos*) 18365b28e182Smrg vendor=be 18375b28e182Smrg ;; 183815adf0bfSmrg *-hpux*) 18395b28e182Smrg vendor=hp 18405b28e182Smrg ;; 184115adf0bfSmrg *-mpeix*) 18425b28e182Smrg vendor=hp 18435b28e182Smrg ;; 184415adf0bfSmrg *-hiux*) 18455b28e182Smrg vendor=hitachi 18465b28e182Smrg ;; 184715adf0bfSmrg *-unos*) 18485b28e182Smrg vendor=crds 18495b28e182Smrg ;; 185015adf0bfSmrg *-dgux*) 18515b28e182Smrg vendor=dg 18525b28e182Smrg ;; 185315adf0bfSmrg *-luna*) 18545b28e182Smrg vendor=omron 18555b28e182Smrg ;; 185615adf0bfSmrg *-genix*) 18575b28e182Smrg vendor=ns 18585b28e182Smrg ;; 185915adf0bfSmrg *-clix*) 186015adf0bfSmrg vendor=intergraph 186115adf0bfSmrg ;; 186215adf0bfSmrg *-mvs* | *-opened*) 186315adf0bfSmrg vendor=ibm 186415adf0bfSmrg ;; 186515adf0bfSmrg *-os400*) 18665b28e182Smrg vendor=ibm 18675b28e182Smrg ;; 186815adf0bfSmrg s390-* | s390x-*) 18695b28e182Smrg vendor=ibm 18705b28e182Smrg ;; 187115adf0bfSmrg *-ptx*) 18725b28e182Smrg vendor=sequent 18735b28e182Smrg ;; 187415adf0bfSmrg *-tpf*) 18755b28e182Smrg vendor=ibm 18765b28e182Smrg ;; 187715adf0bfSmrg *-vxsim* | *-vxworks* | *-windiss*) 18785b28e182Smrg vendor=wrs 18795b28e182Smrg ;; 188015adf0bfSmrg *-aux*) 18815b28e182Smrg vendor=apple 18825b28e182Smrg ;; 188315adf0bfSmrg *-hms*) 18845b28e182Smrg vendor=hitachi 18855b28e182Smrg ;; 188615adf0bfSmrg *-mpw* | *-macos*) 18875b28e182Smrg vendor=apple 18885b28e182Smrg ;; 188915adf0bfSmrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 18905b28e182Smrg vendor=atari 18915b28e182Smrg ;; 189215adf0bfSmrg *-vos*) 18935b28e182Smrg vendor=stratus 18945b28e182Smrg ;; 18955b28e182Smrg esac 18965b28e182Smrg ;; 18975b28e182Smrgesac 18985b28e182Smrg 189915adf0bfSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os" 19005b28e182Smrgexit 19015b28e182Smrg 19025b28e182Smrg# Local variables: 190315adf0bfSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 19045b28e182Smrg# time-stamp-start: "timestamp='" 19055b28e182Smrg# time-stamp-format: "%:y-%02m-%02d" 19065b28e182Smrg# time-stamp-end: "'" 19075b28e182Smrg# End: 1908