1659607e0Smrg#! /bin/sh 2659607e0Smrg# Configuration validation subroutine script. 3ebac4eb7Smrg# Copyright 1992-2023 Free Software Foundation, Inc. 4659607e0Smrg 5370b807fSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale 6659607e0Smrg 7ebac4eb7Smrgtimestamp='2023-01-21' 8370b807fSmrg 9370b807fSmrg# This file is free software; you can redistribute it and/or modify it 10370b807fSmrg# under the terms of the GNU General Public License as published by 11ebac4eb7Smrg# the Free Software Foundation, either version 3 of the License, or 12659607e0Smrg# (at your option) any later version. 13659607e0Smrg# 14370b807fSmrg# This program is distributed in the hope that it will be useful, but 15370b807fSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 16370b807fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17370b807fSmrg# General Public License for more details. 18659607e0Smrg# 19659607e0Smrg# You should have received a copy of the GNU General Public License 20370b807fSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 21659607e0Smrg# 22659607e0Smrg# As a special exception to the GNU General Public License, if you 23659607e0Smrg# distribute this file as part of a program that contains a 24659607e0Smrg# configuration script generated by Autoconf, you may include it under 25370b807fSmrg# the same distribution terms that you use for the rest of that 26370b807fSmrg# program. This Exception is an additional permission under section 7 27370b807fSmrg# of the GNU General Public License, version 3 ("GPLv3"). 28659607e0Smrg 29659607e0Smrg 30370b807fSmrg# Please send patches to <config-patches@gnu.org>. 31659607e0Smrg# 32659607e0Smrg# Configuration subroutine to validate and canonicalize a configuration type. 33659607e0Smrg# Supply the specified configuration type as an argument. 34659607e0Smrg# If it is invalid, we print an error message on stderr and exit with code 1. 35659607e0Smrg# Otherwise, we print the canonical config type on stdout and succeed. 36659607e0Smrg 37b73be646Smrg# You can get the latest version of this script from: 38370b807fSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39b73be646Smrg 40659607e0Smrg# This file is supposed to be the same for all GNU packages 41659607e0Smrg# and recognize all the CPU types, system types and aliases 42659607e0Smrg# that are meaningful with *any* GNU software. 43659607e0Smrg# Each package is responsible for reporting which valid configurations 44659607e0Smrg# it does not support. The user should be able to distinguish 45659607e0Smrg# a failure to support a valid configuration from a meaningless 46659607e0Smrg# configuration. 47659607e0Smrg 48659607e0Smrg# The goal of this file is to map all the various variations of a given 49659607e0Smrg# machine specification into a single specification in the form: 50659607e0Smrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 51659607e0Smrg# or in some cases, the newer four-part form: 52659607e0Smrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 53659607e0Smrg# It is wrong to echo any other type of specification. 54659607e0Smrg 55370b807fSmrg# The "shellcheck disable" line above the timestamp inhibits complaints 56370b807fSmrg# about features and limitations of the classic Bourne shell that were 57370b807fSmrg# superseded or lifted in POSIX. However, this script identifies a wide 58370b807fSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 59370b807fSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still 60370b807fSmrg# have a pre-POSIX /bin/sh. 61370b807fSmrg 62659607e0Smrgme=`echo "$0" | sed -e 's,.*/,,'` 63659607e0Smrg 64659607e0Smrgusage="\ 65370b807fSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 66659607e0Smrg 67659607e0SmrgCanonicalize a configuration name. 68659607e0Smrg 69370b807fSmrgOptions: 70659607e0Smrg -h, --help print this help, then exit 71659607e0Smrg -t, --time-stamp print date of last modification, then exit 72659607e0Smrg -v, --version print version number, then exit 73659607e0Smrg 74659607e0SmrgReport bugs and patches to <config-patches@gnu.org>." 75659607e0Smrg 76659607e0Smrgversion="\ 77659607e0SmrgGNU config.sub ($timestamp) 78659607e0Smrg 79ebac4eb7SmrgCopyright 1992-2023 Free Software Foundation, Inc. 80659607e0Smrg 81659607e0SmrgThis is free software; see the source for copying conditions. There is NO 82659607e0Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 83659607e0Smrg 84659607e0Smrghelp=" 85659607e0SmrgTry \`$me --help' for more information." 86659607e0Smrg 87659607e0Smrg# Parse command line 88659607e0Smrgwhile test $# -gt 0 ; do 89659607e0Smrg case $1 in 90659607e0Smrg --time-stamp | --time* | -t ) 91659607e0Smrg echo "$timestamp" ; exit ;; 92659607e0Smrg --version | -v ) 93659607e0Smrg echo "$version" ; exit ;; 94659607e0Smrg --help | --h* | -h ) 95659607e0Smrg echo "$usage"; exit ;; 96659607e0Smrg -- ) # Stop option processing 97659607e0Smrg shift; break ;; 98659607e0Smrg - ) # Use stdin as input. 99659607e0Smrg break ;; 100659607e0Smrg -* ) 101370b807fSmrg echo "$me: invalid option $1$help" >&2 102659607e0Smrg exit 1 ;; 103659607e0Smrg 104659607e0Smrg *local*) 105659607e0Smrg # First pass through any local machine types. 106370b807fSmrg echo "$1" 107659607e0Smrg exit ;; 108659607e0Smrg 109659607e0Smrg * ) 110659607e0Smrg break ;; 111659607e0Smrg esac 112659607e0Smrgdone 113659607e0Smrg 114659607e0Smrgcase $# in 115659607e0Smrg 0) echo "$me: missing argument$help" >&2 116659607e0Smrg exit 1;; 117659607e0Smrg 1) ;; 118659607e0Smrg *) echo "$me: too many arguments$help" >&2 119659607e0Smrg exit 1;; 120659607e0Smrgesac 121659607e0Smrg 122370b807fSmrg# Split fields of configuration type 123370b807fSmrg# shellcheck disable=SC2162 124370b807fSmrgsaved_IFS=$IFS 125370b807fSmrgIFS="-" read field1 field2 field3 field4 <<EOF 126370b807fSmrg$1 127370b807fSmrgEOF 128370b807fSmrgIFS=$saved_IFS 129659607e0Smrg 130370b807fSmrg# Separate into logical components for further validation 131370b807fSmrgcase $1 in 132370b807fSmrg *-*-*-*-*) 133370b807fSmrg echo Invalid configuration \`"$1"\': more than four components >&2 134370b807fSmrg exit 1 135659607e0Smrg ;; 136370b807fSmrg *-*-*-*) 137370b807fSmrg basic_machine=$field1-$field2 138370b807fSmrg basic_os=$field3-$field4 139659607e0Smrg ;; 140370b807fSmrg *-*-*) 141370b807fSmrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 142370b807fSmrg # parts 143370b807fSmrg maybe_os=$field2-$field3 144370b807fSmrg case $maybe_os in 145370b807fSmrg nto-qnx* | linux-* | uclinux-uclibc* \ 146370b807fSmrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 147370b807fSmrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148ebac4eb7Smrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) 149370b807fSmrg basic_machine=$field1 150370b807fSmrg basic_os=$maybe_os 151370b807fSmrg ;; 152370b807fSmrg android-linux) 153370b807fSmrg basic_machine=$field1-unknown 154370b807fSmrg basic_os=linux-android 155370b807fSmrg ;; 156370b807fSmrg *) 157370b807fSmrg basic_machine=$field1-$field2 158370b807fSmrg basic_os=$field3 159370b807fSmrg ;; 160370b807fSmrg esac 161659607e0Smrg ;; 162370b807fSmrg *-*) 163370b807fSmrg # A lone config we happen to match not fitting any pattern 164370b807fSmrg case $field1-$field2 in 165370b807fSmrg decstation-3100) 166370b807fSmrg basic_machine=mips-dec 167370b807fSmrg basic_os= 168370b807fSmrg ;; 169370b807fSmrg *-*) 170370b807fSmrg # Second component is usually, but not always the OS 171370b807fSmrg case $field2 in 172370b807fSmrg # Prevent following clause from handling this valid os 173370b807fSmrg sun*os*) 174370b807fSmrg basic_machine=$field1 175370b807fSmrg basic_os=$field2 176370b807fSmrg ;; 177370b807fSmrg zephyr*) 178370b807fSmrg basic_machine=$field1-unknown 179370b807fSmrg basic_os=$field2 180370b807fSmrg ;; 181370b807fSmrg # Manufacturers 182370b807fSmrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 183370b807fSmrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 184370b807fSmrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 185370b807fSmrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 186370b807fSmrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 187370b807fSmrg | ultra | tti* | harris | dolphin | highlevel | gould \ 188370b807fSmrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 189370b807fSmrg | microblaze* | sim | cisco \ 190370b807fSmrg | oki | wec | wrs | winbond) 191370b807fSmrg basic_machine=$field1-$field2 192370b807fSmrg basic_os= 193370b807fSmrg ;; 194370b807fSmrg *) 195370b807fSmrg basic_machine=$field1 196370b807fSmrg basic_os=$field2 197370b807fSmrg ;; 198370b807fSmrg esac 199370b807fSmrg ;; 200370b807fSmrg esac 201659607e0Smrg ;; 202370b807fSmrg *) 203370b807fSmrg # Convert single-component short-hands not valid as part of 204370b807fSmrg # multi-component configurations. 205370b807fSmrg case $field1 in 206370b807fSmrg 386bsd) 207370b807fSmrg basic_machine=i386-pc 208370b807fSmrg basic_os=bsd 209370b807fSmrg ;; 210370b807fSmrg a29khif) 211370b807fSmrg basic_machine=a29k-amd 212370b807fSmrg basic_os=udi 213370b807fSmrg ;; 214370b807fSmrg adobe68k) 215370b807fSmrg basic_machine=m68010-adobe 216370b807fSmrg basic_os=scout 217370b807fSmrg ;; 218370b807fSmrg alliant) 219370b807fSmrg basic_machine=fx80-alliant 220370b807fSmrg basic_os= 221370b807fSmrg ;; 222370b807fSmrg altos | altos3068) 223370b807fSmrg basic_machine=m68k-altos 224370b807fSmrg basic_os= 225370b807fSmrg ;; 226370b807fSmrg am29k) 227370b807fSmrg basic_machine=a29k-none 228370b807fSmrg basic_os=bsd 229370b807fSmrg ;; 230370b807fSmrg amdahl) 231370b807fSmrg basic_machine=580-amdahl 232370b807fSmrg basic_os=sysv 233370b807fSmrg ;; 234370b807fSmrg amiga) 235370b807fSmrg basic_machine=m68k-unknown 236370b807fSmrg basic_os= 237370b807fSmrg ;; 238370b807fSmrg amigaos | amigados) 239370b807fSmrg basic_machine=m68k-unknown 240370b807fSmrg basic_os=amigaos 241370b807fSmrg ;; 242370b807fSmrg amigaunix | amix) 243370b807fSmrg basic_machine=m68k-unknown 244370b807fSmrg basic_os=sysv4 245370b807fSmrg ;; 246370b807fSmrg apollo68) 247370b807fSmrg basic_machine=m68k-apollo 248370b807fSmrg basic_os=sysv 249370b807fSmrg ;; 250370b807fSmrg apollo68bsd) 251370b807fSmrg basic_machine=m68k-apollo 252370b807fSmrg basic_os=bsd 253370b807fSmrg ;; 254370b807fSmrg aros) 255370b807fSmrg basic_machine=i386-pc 256370b807fSmrg basic_os=aros 257370b807fSmrg ;; 258370b807fSmrg aux) 259370b807fSmrg basic_machine=m68k-apple 260370b807fSmrg basic_os=aux 261370b807fSmrg ;; 262370b807fSmrg balance) 263370b807fSmrg basic_machine=ns32k-sequent 264370b807fSmrg basic_os=dynix 265370b807fSmrg ;; 266370b807fSmrg blackfin) 267370b807fSmrg basic_machine=bfin-unknown 268370b807fSmrg basic_os=linux 269370b807fSmrg ;; 270370b807fSmrg cegcc) 271370b807fSmrg basic_machine=arm-unknown 272370b807fSmrg basic_os=cegcc 273370b807fSmrg ;; 274370b807fSmrg convex-c1) 275370b807fSmrg basic_machine=c1-convex 276370b807fSmrg basic_os=bsd 277370b807fSmrg ;; 278370b807fSmrg convex-c2) 279370b807fSmrg basic_machine=c2-convex 280370b807fSmrg basic_os=bsd 281370b807fSmrg ;; 282370b807fSmrg convex-c32) 283370b807fSmrg basic_machine=c32-convex 284370b807fSmrg basic_os=bsd 285370b807fSmrg ;; 286370b807fSmrg convex-c34) 287370b807fSmrg basic_machine=c34-convex 288370b807fSmrg basic_os=bsd 289370b807fSmrg ;; 290370b807fSmrg convex-c38) 291370b807fSmrg basic_machine=c38-convex 292370b807fSmrg basic_os=bsd 293370b807fSmrg ;; 294370b807fSmrg cray) 295370b807fSmrg basic_machine=j90-cray 296370b807fSmrg basic_os=unicos 297370b807fSmrg ;; 298370b807fSmrg crds | unos) 299370b807fSmrg basic_machine=m68k-crds 300370b807fSmrg basic_os= 301370b807fSmrg ;; 302370b807fSmrg da30) 303370b807fSmrg basic_machine=m68k-da30 304370b807fSmrg basic_os= 305370b807fSmrg ;; 306370b807fSmrg decstation | pmax | pmin | dec3100 | decstatn) 307370b807fSmrg basic_machine=mips-dec 308370b807fSmrg basic_os= 309370b807fSmrg ;; 310370b807fSmrg delta88) 311370b807fSmrg basic_machine=m88k-motorola 312370b807fSmrg basic_os=sysv3 313370b807fSmrg ;; 314370b807fSmrg dicos) 315370b807fSmrg basic_machine=i686-pc 316370b807fSmrg basic_os=dicos 317370b807fSmrg ;; 318370b807fSmrg djgpp) 319370b807fSmrg basic_machine=i586-pc 320370b807fSmrg basic_os=msdosdjgpp 321370b807fSmrg ;; 322370b807fSmrg ebmon29k) 323370b807fSmrg basic_machine=a29k-amd 324370b807fSmrg basic_os=ebmon 325370b807fSmrg ;; 326370b807fSmrg es1800 | OSE68k | ose68k | ose | OSE) 327370b807fSmrg basic_machine=m68k-ericsson 328370b807fSmrg basic_os=ose 329370b807fSmrg ;; 330370b807fSmrg gmicro) 331370b807fSmrg basic_machine=tron-gmicro 332370b807fSmrg basic_os=sysv 333370b807fSmrg ;; 334370b807fSmrg go32) 335370b807fSmrg basic_machine=i386-pc 336370b807fSmrg basic_os=go32 337370b807fSmrg ;; 338370b807fSmrg h8300hms) 339370b807fSmrg basic_machine=h8300-hitachi 340370b807fSmrg basic_os=hms 341370b807fSmrg ;; 342370b807fSmrg h8300xray) 343370b807fSmrg basic_machine=h8300-hitachi 344370b807fSmrg basic_os=xray 345370b807fSmrg ;; 346370b807fSmrg h8500hms) 347370b807fSmrg basic_machine=h8500-hitachi 348370b807fSmrg basic_os=hms 349370b807fSmrg ;; 350370b807fSmrg harris) 351370b807fSmrg basic_machine=m88k-harris 352370b807fSmrg basic_os=sysv3 353370b807fSmrg ;; 354370b807fSmrg hp300 | hp300hpux) 355370b807fSmrg basic_machine=m68k-hp 356370b807fSmrg basic_os=hpux 357370b807fSmrg ;; 358370b807fSmrg hp300bsd) 359370b807fSmrg basic_machine=m68k-hp 360370b807fSmrg basic_os=bsd 361370b807fSmrg ;; 362370b807fSmrg hppaosf) 363370b807fSmrg basic_machine=hppa1.1-hp 364370b807fSmrg basic_os=osf 365370b807fSmrg ;; 366370b807fSmrg hppro) 367370b807fSmrg basic_machine=hppa1.1-hp 368370b807fSmrg basic_os=proelf 369370b807fSmrg ;; 370370b807fSmrg i386mach) 371370b807fSmrg basic_machine=i386-mach 372370b807fSmrg basic_os=mach 373370b807fSmrg ;; 374370b807fSmrg isi68 | isi) 375370b807fSmrg basic_machine=m68k-isi 376370b807fSmrg basic_os=sysv 377370b807fSmrg ;; 378370b807fSmrg m68knommu) 379370b807fSmrg basic_machine=m68k-unknown 380370b807fSmrg basic_os=linux 381370b807fSmrg ;; 382370b807fSmrg magnum | m3230) 383370b807fSmrg basic_machine=mips-mips 384370b807fSmrg basic_os=sysv 385370b807fSmrg ;; 386370b807fSmrg merlin) 387370b807fSmrg basic_machine=ns32k-utek 388370b807fSmrg basic_os=sysv 389370b807fSmrg ;; 390370b807fSmrg mingw64) 391370b807fSmrg basic_machine=x86_64-pc 392370b807fSmrg basic_os=mingw64 393370b807fSmrg ;; 394370b807fSmrg mingw32) 395370b807fSmrg basic_machine=i686-pc 396370b807fSmrg basic_os=mingw32 397370b807fSmrg ;; 398370b807fSmrg mingw32ce) 399370b807fSmrg basic_machine=arm-unknown 400370b807fSmrg basic_os=mingw32ce 401370b807fSmrg ;; 402370b807fSmrg monitor) 403370b807fSmrg basic_machine=m68k-rom68k 404370b807fSmrg basic_os=coff 405370b807fSmrg ;; 406370b807fSmrg morphos) 407370b807fSmrg basic_machine=powerpc-unknown 408370b807fSmrg basic_os=morphos 409370b807fSmrg ;; 410370b807fSmrg moxiebox) 411370b807fSmrg basic_machine=moxie-unknown 412370b807fSmrg basic_os=moxiebox 413370b807fSmrg ;; 414370b807fSmrg msdos) 415370b807fSmrg basic_machine=i386-pc 416370b807fSmrg basic_os=msdos 417370b807fSmrg ;; 418370b807fSmrg msys) 419370b807fSmrg basic_machine=i686-pc 420370b807fSmrg basic_os=msys 421370b807fSmrg ;; 422370b807fSmrg mvs) 423370b807fSmrg basic_machine=i370-ibm 424370b807fSmrg basic_os=mvs 425370b807fSmrg ;; 426370b807fSmrg nacl) 427370b807fSmrg basic_machine=le32-unknown 428370b807fSmrg basic_os=nacl 429370b807fSmrg ;; 430370b807fSmrg ncr3000) 431370b807fSmrg basic_machine=i486-ncr 432370b807fSmrg basic_os=sysv4 433370b807fSmrg ;; 434370b807fSmrg netbsd386) 435370b807fSmrg basic_machine=i386-pc 436370b807fSmrg basic_os=netbsd 437370b807fSmrg ;; 438370b807fSmrg netwinder) 439370b807fSmrg basic_machine=armv4l-rebel 440370b807fSmrg basic_os=linux 441370b807fSmrg ;; 442370b807fSmrg news | news700 | news800 | news900) 443370b807fSmrg basic_machine=m68k-sony 444370b807fSmrg basic_os=newsos 445370b807fSmrg ;; 446370b807fSmrg news1000) 447370b807fSmrg basic_machine=m68030-sony 448370b807fSmrg basic_os=newsos 449370b807fSmrg ;; 450370b807fSmrg necv70) 451370b807fSmrg basic_machine=v70-nec 452370b807fSmrg basic_os=sysv 453370b807fSmrg ;; 454370b807fSmrg nh3000) 455370b807fSmrg basic_machine=m68k-harris 456370b807fSmrg basic_os=cxux 457370b807fSmrg ;; 458370b807fSmrg nh[45]000) 459370b807fSmrg basic_machine=m88k-harris 460370b807fSmrg basic_os=cxux 461370b807fSmrg ;; 462370b807fSmrg nindy960) 463370b807fSmrg basic_machine=i960-intel 464370b807fSmrg basic_os=nindy 465370b807fSmrg ;; 466370b807fSmrg mon960) 467370b807fSmrg basic_machine=i960-intel 468370b807fSmrg basic_os=mon960 469370b807fSmrg ;; 470370b807fSmrg nonstopux) 471370b807fSmrg basic_machine=mips-compaq 472370b807fSmrg basic_os=nonstopux 473370b807fSmrg ;; 474370b807fSmrg os400) 475370b807fSmrg basic_machine=powerpc-ibm 476370b807fSmrg basic_os=os400 477370b807fSmrg ;; 478370b807fSmrg OSE68000 | ose68000) 479370b807fSmrg basic_machine=m68000-ericsson 480370b807fSmrg basic_os=ose 481370b807fSmrg ;; 482370b807fSmrg os68k) 483370b807fSmrg basic_machine=m68k-none 484370b807fSmrg basic_os=os68k 485370b807fSmrg ;; 486370b807fSmrg paragon) 487370b807fSmrg basic_machine=i860-intel 488370b807fSmrg basic_os=osf 489370b807fSmrg ;; 490370b807fSmrg parisc) 491370b807fSmrg basic_machine=hppa-unknown 492370b807fSmrg basic_os=linux 493370b807fSmrg ;; 494370b807fSmrg psp) 495370b807fSmrg basic_machine=mipsallegrexel-sony 496370b807fSmrg basic_os=psp 497370b807fSmrg ;; 498370b807fSmrg pw32) 499370b807fSmrg basic_machine=i586-unknown 500370b807fSmrg basic_os=pw32 501370b807fSmrg ;; 502370b807fSmrg rdos | rdos64) 503370b807fSmrg basic_machine=x86_64-pc 504370b807fSmrg basic_os=rdos 505370b807fSmrg ;; 506370b807fSmrg rdos32) 507370b807fSmrg basic_machine=i386-pc 508370b807fSmrg basic_os=rdos 509370b807fSmrg ;; 510370b807fSmrg rom68k) 511370b807fSmrg basic_machine=m68k-rom68k 512370b807fSmrg basic_os=coff 513370b807fSmrg ;; 514370b807fSmrg sa29200) 515370b807fSmrg basic_machine=a29k-amd 516370b807fSmrg basic_os=udi 517370b807fSmrg ;; 518370b807fSmrg sei) 519370b807fSmrg basic_machine=mips-sei 520370b807fSmrg basic_os=seiux 521370b807fSmrg ;; 522370b807fSmrg sequent) 523370b807fSmrg basic_machine=i386-sequent 524370b807fSmrg basic_os= 525370b807fSmrg ;; 526370b807fSmrg sps7) 527370b807fSmrg basic_machine=m68k-bull 528370b807fSmrg basic_os=sysv2 529370b807fSmrg ;; 530370b807fSmrg st2000) 531370b807fSmrg basic_machine=m68k-tandem 532370b807fSmrg basic_os= 533370b807fSmrg ;; 534370b807fSmrg stratus) 535370b807fSmrg basic_machine=i860-stratus 536370b807fSmrg basic_os=sysv4 537370b807fSmrg ;; 538370b807fSmrg sun2) 539370b807fSmrg basic_machine=m68000-sun 540370b807fSmrg basic_os= 541370b807fSmrg ;; 542370b807fSmrg sun2os3) 543370b807fSmrg basic_machine=m68000-sun 544370b807fSmrg basic_os=sunos3 545370b807fSmrg ;; 546370b807fSmrg sun2os4) 547370b807fSmrg basic_machine=m68000-sun 548370b807fSmrg basic_os=sunos4 549370b807fSmrg ;; 550370b807fSmrg sun3) 551370b807fSmrg basic_machine=m68k-sun 552370b807fSmrg basic_os= 553370b807fSmrg ;; 554370b807fSmrg sun3os3) 555370b807fSmrg basic_machine=m68k-sun 556370b807fSmrg basic_os=sunos3 557370b807fSmrg ;; 558370b807fSmrg sun3os4) 559370b807fSmrg basic_machine=m68k-sun 560370b807fSmrg basic_os=sunos4 561370b807fSmrg ;; 562370b807fSmrg sun4) 563370b807fSmrg basic_machine=sparc-sun 564370b807fSmrg basic_os= 565370b807fSmrg ;; 566370b807fSmrg sun4os3) 567370b807fSmrg basic_machine=sparc-sun 568370b807fSmrg basic_os=sunos3 569370b807fSmrg ;; 570370b807fSmrg sun4os4) 571370b807fSmrg basic_machine=sparc-sun 572370b807fSmrg basic_os=sunos4 573370b807fSmrg ;; 574370b807fSmrg sun4sol2) 575370b807fSmrg basic_machine=sparc-sun 576370b807fSmrg basic_os=solaris2 577370b807fSmrg ;; 578370b807fSmrg sun386 | sun386i | roadrunner) 579370b807fSmrg basic_machine=i386-sun 580370b807fSmrg basic_os= 581370b807fSmrg ;; 582370b807fSmrg sv1) 583370b807fSmrg basic_machine=sv1-cray 584370b807fSmrg basic_os=unicos 585370b807fSmrg ;; 586370b807fSmrg symmetry) 587370b807fSmrg basic_machine=i386-sequent 588370b807fSmrg basic_os=dynix 589370b807fSmrg ;; 590370b807fSmrg t3e) 591370b807fSmrg basic_machine=alphaev5-cray 592370b807fSmrg basic_os=unicos 593370b807fSmrg ;; 594370b807fSmrg t90) 595370b807fSmrg basic_machine=t90-cray 596370b807fSmrg basic_os=unicos 597370b807fSmrg ;; 598370b807fSmrg toad1) 599370b807fSmrg basic_machine=pdp10-xkl 600370b807fSmrg basic_os=tops20 601370b807fSmrg ;; 602370b807fSmrg tpf) 603370b807fSmrg basic_machine=s390x-ibm 604370b807fSmrg basic_os=tpf 605370b807fSmrg ;; 606370b807fSmrg udi29k) 607370b807fSmrg basic_machine=a29k-amd 608370b807fSmrg basic_os=udi 609370b807fSmrg ;; 610370b807fSmrg ultra3) 611370b807fSmrg basic_machine=a29k-nyu 612370b807fSmrg basic_os=sym1 613370b807fSmrg ;; 614370b807fSmrg v810 | necv810) 615370b807fSmrg basic_machine=v810-nec 616370b807fSmrg basic_os=none 617370b807fSmrg ;; 618370b807fSmrg vaxv) 619370b807fSmrg basic_machine=vax-dec 620370b807fSmrg basic_os=sysv 621370b807fSmrg ;; 622370b807fSmrg vms) 623370b807fSmrg basic_machine=vax-dec 624370b807fSmrg basic_os=vms 625370b807fSmrg ;; 626370b807fSmrg vsta) 627370b807fSmrg basic_machine=i386-pc 628370b807fSmrg basic_os=vsta 629370b807fSmrg ;; 630370b807fSmrg vxworks960) 631370b807fSmrg basic_machine=i960-wrs 632370b807fSmrg basic_os=vxworks 633370b807fSmrg ;; 634370b807fSmrg vxworks68) 635370b807fSmrg basic_machine=m68k-wrs 636370b807fSmrg basic_os=vxworks 637370b807fSmrg ;; 638370b807fSmrg vxworks29k) 639370b807fSmrg basic_machine=a29k-wrs 640370b807fSmrg basic_os=vxworks 641370b807fSmrg ;; 642370b807fSmrg xbox) 643370b807fSmrg basic_machine=i686-pc 644370b807fSmrg basic_os=mingw32 645370b807fSmrg ;; 646370b807fSmrg ymp) 647370b807fSmrg basic_machine=ymp-cray 648370b807fSmrg basic_os=unicos 649370b807fSmrg ;; 650370b807fSmrg *) 651370b807fSmrg basic_machine=$1 652370b807fSmrg basic_os= 653370b807fSmrg ;; 654370b807fSmrg esac 655659607e0Smrg ;; 656659607e0Smrgesac 657659607e0Smrg 658370b807fSmrg# Decode 1-component or ad-hoc basic machines 659659607e0Smrgcase $basic_machine in 660370b807fSmrg # Here we handle the default manufacturer of certain CPU types. It is in 661370b807fSmrg # some cases the only manufacturer, in others, it is the most popular. 662370b807fSmrg w89k) 663370b807fSmrg cpu=hppa1.1 664370b807fSmrg vendor=winbond 665659607e0Smrg ;; 666370b807fSmrg op50n) 667370b807fSmrg cpu=hppa1.1 668370b807fSmrg vendor=oki 669a73597f9Smrg ;; 670370b807fSmrg op60c) 671370b807fSmrg cpu=hppa1.1 672370b807fSmrg vendor=oki 673a73597f9Smrg ;; 674370b807fSmrg ibm*) 675370b807fSmrg cpu=i370 676370b807fSmrg vendor=ibm 677a73597f9Smrg ;; 678370b807fSmrg orion105) 679370b807fSmrg cpu=clipper 680370b807fSmrg vendor=highlevel 681a73597f9Smrg ;; 682370b807fSmrg mac | mpw | mac-mpw) 683370b807fSmrg cpu=m68k 684370b807fSmrg vendor=apple 685659607e0Smrg ;; 686370b807fSmrg pmac | pmac-mpw) 687370b807fSmrg cpu=powerpc 688370b807fSmrg vendor=apple 6896aab59a7Smrg ;; 690370b807fSmrg 691659607e0Smrg # Recognize the various machine names and aliases which stand 692659607e0Smrg # for a CPU type and a company and sometimes even an OS. 693659607e0Smrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 694370b807fSmrg cpu=m68000 695370b807fSmrg vendor=att 696659607e0Smrg ;; 697659607e0Smrg 3b*) 698370b807fSmrg cpu=we32k 699370b807fSmrg vendor=att 700fc27e79cSmrg ;; 701b73be646Smrg bluegene*) 702370b807fSmrg cpu=powerpc 703370b807fSmrg vendor=ibm 704370b807fSmrg basic_os=cnk 705659607e0Smrg ;; 706659607e0Smrg decsystem10* | dec10*) 707370b807fSmrg cpu=pdp10 708370b807fSmrg vendor=dec 709370b807fSmrg basic_os=tops10 710659607e0Smrg ;; 711659607e0Smrg decsystem20* | dec20*) 712370b807fSmrg cpu=pdp10 713370b807fSmrg vendor=dec 714370b807fSmrg basic_os=tops20 715659607e0Smrg ;; 716659607e0Smrg delta | 3300 | motorola-3300 | motorola-delta \ 717659607e0Smrg | 3300-motorola | delta-motorola) 718370b807fSmrg cpu=m68k 719370b807fSmrg vendor=motorola 720659607e0Smrg ;; 721370b807fSmrg dpx2*) 722370b807fSmrg cpu=m68k 723370b807fSmrg vendor=bull 724370b807fSmrg basic_os=sysv3 725659607e0Smrg ;; 726659607e0Smrg encore | umax | mmax) 727370b807fSmrg cpu=ns32k 728370b807fSmrg vendor=encore 729659607e0Smrg ;; 730370b807fSmrg elxsi) 731370b807fSmrg cpu=elxsi 732370b807fSmrg vendor=elxsi 733370b807fSmrg basic_os=${basic_os:-bsd} 734659607e0Smrg ;; 735659607e0Smrg fx2800) 736370b807fSmrg cpu=i860 737370b807fSmrg vendor=alliant 738659607e0Smrg ;; 739659607e0Smrg genix) 740370b807fSmrg cpu=ns32k 741370b807fSmrg vendor=ns 742659607e0Smrg ;; 743659607e0Smrg h3050r* | hiux*) 744370b807fSmrg cpu=hppa1.1 745370b807fSmrg vendor=hitachi 746370b807fSmrg basic_os=hiuxwe2 747659607e0Smrg ;; 748659607e0Smrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 749370b807fSmrg cpu=hppa1.0 750370b807fSmrg vendor=hp 751659607e0Smrg ;; 752659607e0Smrg hp9k2[0-9][0-9] | hp9k31[0-9]) 753370b807fSmrg cpu=m68000 754370b807fSmrg vendor=hp 755659607e0Smrg ;; 756659607e0Smrg hp9k3[2-9][0-9]) 757370b807fSmrg cpu=m68k 758370b807fSmrg vendor=hp 759659607e0Smrg ;; 760659607e0Smrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 761370b807fSmrg cpu=hppa1.0 762370b807fSmrg vendor=hp 763659607e0Smrg ;; 764659607e0Smrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 765370b807fSmrg cpu=hppa1.1 766370b807fSmrg vendor=hp 767659607e0Smrg ;; 768659607e0Smrg hp9k78[0-9] | hp78[0-9]) 769659607e0Smrg # FIXME: really hppa2.0-hp 770370b807fSmrg cpu=hppa1.1 771370b807fSmrg vendor=hp 772659607e0Smrg ;; 773659607e0Smrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 774659607e0Smrg # FIXME: really hppa2.0-hp 775370b807fSmrg cpu=hppa1.1 776370b807fSmrg vendor=hp 777659607e0Smrg ;; 778659607e0Smrg hp9k8[0-9][13679] | hp8[0-9][13679]) 779370b807fSmrg cpu=hppa1.1 780370b807fSmrg vendor=hp 781659607e0Smrg ;; 782659607e0Smrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 783370b807fSmrg cpu=hppa1.0 784370b807fSmrg vendor=hp 785659607e0Smrg ;; 786659607e0Smrg i*86v32) 787370b807fSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 788370b807fSmrg vendor=pc 789370b807fSmrg basic_os=sysv32 790659607e0Smrg ;; 791659607e0Smrg i*86v4*) 792370b807fSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 793370b807fSmrg vendor=pc 794370b807fSmrg basic_os=sysv4 795659607e0Smrg ;; 796659607e0Smrg i*86v) 797370b807fSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 798370b807fSmrg vendor=pc 799370b807fSmrg basic_os=sysv 800659607e0Smrg ;; 801659607e0Smrg i*86sol2) 802370b807fSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 803370b807fSmrg vendor=pc 804370b807fSmrg basic_os=solaris2 805659607e0Smrg ;; 806370b807fSmrg j90 | j90-cray) 807370b807fSmrg cpu=j90 808370b807fSmrg vendor=cray 809370b807fSmrg basic_os=${basic_os:-unicos} 810659607e0Smrg ;; 811659607e0Smrg iris | iris4d) 812370b807fSmrg cpu=mips 813370b807fSmrg vendor=sgi 814370b807fSmrg case $basic_os in 815370b807fSmrg irix*) 816659607e0Smrg ;; 817659607e0Smrg *) 818370b807fSmrg basic_os=irix4 819659607e0Smrg ;; 820659607e0Smrg esac 821659607e0Smrg ;; 822659607e0Smrg miniframe) 823370b807fSmrg cpu=m68000 824370b807fSmrg vendor=convergent 825659607e0Smrg ;; 826370b807fSmrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 827370b807fSmrg cpu=m68k 828370b807fSmrg vendor=atari 829370b807fSmrg basic_os=mint 830659607e0Smrg ;; 831659607e0Smrg news-3600 | risc-news) 832370b807fSmrg cpu=mips 833370b807fSmrg vendor=sony 834370b807fSmrg basic_os=newsos 835370b807fSmrg ;; 836370b807fSmrg next | m*-next) 837370b807fSmrg cpu=m68k 838370b807fSmrg vendor=next 839370b807fSmrg case $basic_os in 840370b807fSmrg openstep*) 841370b807fSmrg ;; 842370b807fSmrg nextstep*) 843659607e0Smrg ;; 844370b807fSmrg ns2*) 845370b807fSmrg basic_os=nextstep2 846659607e0Smrg ;; 847659607e0Smrg *) 848370b807fSmrg basic_os=nextstep3 849659607e0Smrg ;; 850659607e0Smrg esac 851659607e0Smrg ;; 852659607e0Smrg np1) 853370b807fSmrg cpu=np1 854370b807fSmrg vendor=gould 855659607e0Smrg ;; 856659607e0Smrg op50n-* | op60c-*) 857370b807fSmrg cpu=hppa1.1 858370b807fSmrg vendor=oki 859370b807fSmrg basic_os=proelf 860659607e0Smrg ;; 861659607e0Smrg pa-hitachi) 862370b807fSmrg cpu=hppa1.1 863370b807fSmrg vendor=hitachi 864370b807fSmrg basic_os=hiuxwe2 865fc27e79cSmrg ;; 866659607e0Smrg pbd) 867370b807fSmrg cpu=sparc 868370b807fSmrg vendor=tti 869659607e0Smrg ;; 870659607e0Smrg pbb) 871370b807fSmrg cpu=m68k 872370b807fSmrg vendor=tti 873fc27e79cSmrg ;; 874370b807fSmrg pc532) 875370b807fSmrg cpu=ns32k 876370b807fSmrg vendor=pc532 877659607e0Smrg ;; 878659607e0Smrg pn) 879370b807fSmrg cpu=pn 880370b807fSmrg vendor=gould 881659607e0Smrg ;; 882370b807fSmrg power) 883370b807fSmrg cpu=power 884370b807fSmrg vendor=ibm 885659607e0Smrg ;; 886659607e0Smrg ps2) 887370b807fSmrg cpu=i386 888370b807fSmrg vendor=ibm 889659607e0Smrg ;; 890659607e0Smrg rm[46]00) 891370b807fSmrg cpu=mips 892370b807fSmrg vendor=siemens 893659607e0Smrg ;; 894659607e0Smrg rtpc | rtpc-*) 895370b807fSmrg cpu=romp 896370b807fSmrg vendor=ibm 897659607e0Smrg ;; 898370b807fSmrg sde) 899370b807fSmrg cpu=mipsisa32 900370b807fSmrg vendor=sde 901370b807fSmrg basic_os=${basic_os:-elf} 902659607e0Smrg ;; 903370b807fSmrg simso-wrs) 904370b807fSmrg cpu=sparclite 905370b807fSmrg vendor=wrs 906370b807fSmrg basic_os=vxworks 907659607e0Smrg ;; 908370b807fSmrg tower | tower-32) 909370b807fSmrg cpu=m68k 910370b807fSmrg vendor=ncr 911fc27e79cSmrg ;; 912370b807fSmrg vpp*|vx|vx-*) 913370b807fSmrg cpu=f301 914370b807fSmrg vendor=fujitsu 915659607e0Smrg ;; 916370b807fSmrg w65) 917370b807fSmrg cpu=w65 918370b807fSmrg vendor=wdc 919659607e0Smrg ;; 920370b807fSmrg w89k-*) 921370b807fSmrg cpu=hppa1.1 922370b807fSmrg vendor=winbond 923370b807fSmrg basic_os=proelf 924659607e0Smrg ;; 925370b807fSmrg none) 926370b807fSmrg cpu=none 927370b807fSmrg vendor=none 928fc27e79cSmrg ;; 929370b807fSmrg leon|leon[3-9]) 930370b807fSmrg cpu=sparc 931370b807fSmrg vendor=$basic_machine 932659607e0Smrg ;; 933370b807fSmrg leon-*|leon[3-9]-*) 934370b807fSmrg cpu=sparc 935370b807fSmrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 936659607e0Smrg ;; 937370b807fSmrg 938370b807fSmrg *-*) 939370b807fSmrg # shellcheck disable=SC2162 940370b807fSmrg saved_IFS=$IFS 941370b807fSmrg IFS="-" read cpu vendor <<EOF 942370b807fSmrg$basic_machine 943370b807fSmrgEOF 944370b807fSmrg IFS=$saved_IFS 945659607e0Smrg ;; 946370b807fSmrg # We use `pc' rather than `unknown' 947370b807fSmrg # because (1) that's what they normally are, and 948370b807fSmrg # (2) the word "unknown" tends to confuse beginning users. 949370b807fSmrg i*86 | x86_64) 950370b807fSmrg cpu=$basic_machine 951370b807fSmrg vendor=pc 952659607e0Smrg ;; 953370b807fSmrg # These rules are duplicated from below for sake of the special case above; 954370b807fSmrg # i.e. things that normalized to x86 arches should also default to "pc" 955370b807fSmrg pc98) 956370b807fSmrg cpu=i386 957370b807fSmrg vendor=pc 958659607e0Smrg ;; 959370b807fSmrg x64 | amd64) 960370b807fSmrg cpu=x86_64 961370b807fSmrg vendor=pc 962659607e0Smrg ;; 963370b807fSmrg # Recognize the basic CPU types without company name. 964370b807fSmrg *) 965370b807fSmrg cpu=$basic_machine 966370b807fSmrg vendor=unknown 967a73597f9Smrg ;; 968370b807fSmrgesac 969370b807fSmrg 970370b807fSmrgunset -v basic_machine 971370b807fSmrg 972370b807fSmrg# Decode basic machines in the full and proper CPU-Company form. 973370b807fSmrgcase $cpu-$vendor in 974370b807fSmrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 975370b807fSmrg # some cases the only manufacturer, in others, it is the most popular. 976370b807fSmrg craynv-unknown) 977370b807fSmrg vendor=cray 978370b807fSmrg basic_os=${basic_os:-unicosmp} 979659607e0Smrg ;; 980370b807fSmrg c90-unknown | c90-cray) 981370b807fSmrg vendor=cray 982370b807fSmrg basic_os=${Basic_os:-unicos} 983659607e0Smrg ;; 984370b807fSmrg fx80-unknown) 985370b807fSmrg vendor=alliant 986659607e0Smrg ;; 987370b807fSmrg romp-unknown) 988370b807fSmrg vendor=ibm 989659607e0Smrg ;; 990370b807fSmrg mmix-unknown) 991370b807fSmrg vendor=knuth 992659607e0Smrg ;; 993370b807fSmrg microblaze-unknown | microblazeel-unknown) 994370b807fSmrg vendor=xilinx 995659607e0Smrg ;; 996370b807fSmrg rs6000-unknown) 997370b807fSmrg vendor=ibm 998659607e0Smrg ;; 999370b807fSmrg vax-unknown) 1000370b807fSmrg vendor=dec 1001659607e0Smrg ;; 1002370b807fSmrg pdp11-unknown) 1003370b807fSmrg vendor=dec 1004659607e0Smrg ;; 1005370b807fSmrg we32k-unknown) 1006370b807fSmrg vendor=att 1007659607e0Smrg ;; 1008370b807fSmrg cydra-unknown) 1009370b807fSmrg vendor=cydrome 1010659607e0Smrg ;; 1011370b807fSmrg i370-ibm*) 1012370b807fSmrg vendor=ibm 1013659607e0Smrg ;; 1014370b807fSmrg orion-unknown) 1015370b807fSmrg vendor=highlevel 1016659607e0Smrg ;; 1017370b807fSmrg xps-unknown | xps100-unknown) 1018370b807fSmrg cpu=xps100 1019370b807fSmrg vendor=honeywell 1020659607e0Smrg ;; 1021370b807fSmrg 1022370b807fSmrg # Here we normalize CPU types with a missing or matching vendor 1023ebac4eb7Smrg armh-unknown | armh-alt) 1024ebac4eb7Smrg cpu=armv7l 1025ebac4eb7Smrg vendor=alt 1026ebac4eb7Smrg basic_os=${basic_os:-linux-gnueabihf} 1027ebac4eb7Smrg ;; 1028370b807fSmrg dpx20-unknown | dpx20-bull) 1029370b807fSmrg cpu=rs6000 1030370b807fSmrg vendor=bull 1031370b807fSmrg basic_os=${basic_os:-bosx} 1032659607e0Smrg ;; 1033370b807fSmrg 1034370b807fSmrg # Here we normalize CPU types irrespective of the vendor 1035370b807fSmrg amd64-*) 1036370b807fSmrg cpu=x86_64 1037fc27e79cSmrg ;; 1038370b807fSmrg blackfin-*) 1039370b807fSmrg cpu=bfin 1040370b807fSmrg basic_os=linux 1041659607e0Smrg ;; 1042370b807fSmrg c54x-*) 1043370b807fSmrg cpu=tic54x 1044659607e0Smrg ;; 1045370b807fSmrg c55x-*) 1046370b807fSmrg cpu=tic55x 1047659607e0Smrg ;; 1048370b807fSmrg c6x-*) 1049370b807fSmrg cpu=tic6x 1050659607e0Smrg ;; 1051370b807fSmrg e500v[12]-*) 1052370b807fSmrg cpu=powerpc 1053370b807fSmrg basic_os=${basic_os}"spe" 1054659607e0Smrg ;; 1055370b807fSmrg mips3*-*) 1056370b807fSmrg cpu=mips64 1057659607e0Smrg ;; 1058370b807fSmrg ms1-*) 1059370b807fSmrg cpu=mt 1060659607e0Smrg ;; 1061370b807fSmrg m68knommu-*) 1062370b807fSmrg cpu=m68k 1063370b807fSmrg basic_os=linux 1064659607e0Smrg ;; 1065370b807fSmrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 1066370b807fSmrg cpu=s12z 1067659607e0Smrg ;; 1068370b807fSmrg openrisc-*) 1069370b807fSmrg cpu=or32 1070659607e0Smrg ;; 1071370b807fSmrg parisc-*) 1072370b807fSmrg cpu=hppa 1073370b807fSmrg basic_os=linux 1074659607e0Smrg ;; 1075370b807fSmrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1076370b807fSmrg cpu=i586 1077659607e0Smrg ;; 1078ebac4eb7Smrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 1079370b807fSmrg cpu=i686 1080659607e0Smrg ;; 1081370b807fSmrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1082370b807fSmrg cpu=i686 1083659607e0Smrg ;; 1084370b807fSmrg pentium4-*) 1085370b807fSmrg cpu=i786 1086659607e0Smrg ;; 1087370b807fSmrg pc98-*) 1088370b807fSmrg cpu=i386 1089659607e0Smrg ;; 1090370b807fSmrg ppc-* | ppcbe-*) 1091370b807fSmrg cpu=powerpc 1092659607e0Smrg ;; 1093370b807fSmrg ppcle-* | powerpclittle-*) 1094370b807fSmrg cpu=powerpcle 1095659607e0Smrg ;; 1096370b807fSmrg ppc64-*) 1097370b807fSmrg cpu=powerpc64 1098a73597f9Smrg ;; 1099370b807fSmrg ppc64le-* | powerpc64little-*) 1100370b807fSmrg cpu=powerpc64le 1101659607e0Smrg ;; 1102370b807fSmrg sb1-*) 1103370b807fSmrg cpu=mipsisa64sb1 1104659607e0Smrg ;; 1105370b807fSmrg sb1el-*) 1106370b807fSmrg cpu=mipsisa64sb1el 1107b73be646Smrg ;; 1108370b807fSmrg sh5e[lb]-*) 1109370b807fSmrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 1110659607e0Smrg ;; 1111370b807fSmrg spur-*) 1112370b807fSmrg cpu=spur 1113659607e0Smrg ;; 1114370b807fSmrg strongarm-* | thumb-*) 1115370b807fSmrg cpu=arm 1116659607e0Smrg ;; 1117370b807fSmrg tx39-*) 1118370b807fSmrg cpu=mipstx39 1119659607e0Smrg ;; 1120370b807fSmrg tx39el-*) 1121370b807fSmrg cpu=mipstx39el 1122659607e0Smrg ;; 1123370b807fSmrg x64-*) 1124370b807fSmrg cpu=x86_64 1125659607e0Smrg ;; 1126370b807fSmrg xscale-* | xscalee[bl]-*) 1127370b807fSmrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 1128659607e0Smrg ;; 1129ebac4eb7Smrg arm64-* | aarch64le-*) 1130370b807fSmrg cpu=aarch64 1131659607e0Smrg ;; 1132370b807fSmrg 1133370b807fSmrg # Recognize the canonical CPU Types that limit and/or modify the 1134370b807fSmrg # company names they are paired with. 1135370b807fSmrg cr16-*) 1136370b807fSmrg basic_os=${basic_os:-elf} 1137659607e0Smrg ;; 1138370b807fSmrg crisv32-* | etraxfs*-*) 1139370b807fSmrg cpu=crisv32 1140370b807fSmrg vendor=axis 1141659607e0Smrg ;; 1142370b807fSmrg cris-* | etrax*-*) 1143370b807fSmrg cpu=cris 1144370b807fSmrg vendor=axis 1145659607e0Smrg ;; 1146370b807fSmrg crx-*) 1147370b807fSmrg basic_os=${basic_os:-elf} 1148659607e0Smrg ;; 1149370b807fSmrg neo-tandem) 1150370b807fSmrg cpu=neo 1151370b807fSmrg vendor=tandem 1152659607e0Smrg ;; 1153370b807fSmrg nse-tandem) 1154370b807fSmrg cpu=nse 1155370b807fSmrg vendor=tandem 1156659607e0Smrg ;; 1157370b807fSmrg nsr-tandem) 1158370b807fSmrg cpu=nsr 1159370b807fSmrg vendor=tandem 1160659607e0Smrg ;; 1161370b807fSmrg nsv-tandem) 1162370b807fSmrg cpu=nsv 1163370b807fSmrg vendor=tandem 1164659607e0Smrg ;; 1165370b807fSmrg nsx-tandem) 1166370b807fSmrg cpu=nsx 1167370b807fSmrg vendor=tandem 1168659607e0Smrg ;; 1169370b807fSmrg mipsallegrexel-sony) 1170370b807fSmrg cpu=mipsallegrexel 1171370b807fSmrg vendor=sony 1172659607e0Smrg ;; 1173370b807fSmrg tile*-*) 1174370b807fSmrg basic_os=${basic_os:-linux-gnu} 1175659607e0Smrg ;; 1176370b807fSmrg 1177659607e0Smrg *) 1178370b807fSmrg # Recognize the canonical CPU types that are allowed with any 1179370b807fSmrg # company name. 1180370b807fSmrg case $cpu in 1181370b807fSmrg 1750a | 580 \ 1182370b807fSmrg | a29k \ 1183370b807fSmrg | aarch64 | aarch64_be \ 1184370b807fSmrg | abacus \ 1185370b807fSmrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 1186370b807fSmrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 1187370b807fSmrg | alphapca5[67] | alpha64pca5[67] \ 1188370b807fSmrg | am33_2.0 \ 1189370b807fSmrg | amdgcn \ 1190370b807fSmrg | arc | arceb | arc32 | arc64 \ 1191370b807fSmrg | arm | arm[lb]e | arme[lb] | armv* \ 1192370b807fSmrg | avr | avr32 \ 1193370b807fSmrg | asmjs \ 1194370b807fSmrg | ba \ 1195370b807fSmrg | be32 | be64 \ 1196370b807fSmrg | bfin | bpf | bs2000 \ 1197370b807fSmrg | c[123]* | c30 | [cjt]90 | c4x \ 1198370b807fSmrg | c8051 | clipper | craynv | csky | cydra \ 1199370b807fSmrg | d10v | d30v | dlx | dsp16xx \ 1200370b807fSmrg | e2k | elxsi | epiphany \ 1201370b807fSmrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1202370b807fSmrg | h8300 | h8500 \ 1203370b807fSmrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 1204370b807fSmrg | hexagon \ 1205370b807fSmrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 1206370b807fSmrg | ip2k | iq2000 \ 1207370b807fSmrg | k1om \ 1208370b807fSmrg | le32 | le64 \ 1209370b807fSmrg | lm32 \ 1210ebac4eb7Smrg | loongarch32 | loongarch64 \ 1211370b807fSmrg | m32c | m32r | m32rle \ 1212370b807fSmrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 1213370b807fSmrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 1214370b807fSmrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 1215370b807fSmrg | microblaze | microblazeel \ 1216370b807fSmrg | mips | mipsbe | mipseb | mipsel | mipsle \ 1217370b807fSmrg | mips16 \ 1218370b807fSmrg | mips64 | mips64eb | mips64el \ 1219370b807fSmrg | mips64octeon | mips64octeonel \ 1220370b807fSmrg | mips64orion | mips64orionel \ 1221370b807fSmrg | mips64r5900 | mips64r5900el \ 1222370b807fSmrg | mips64vr | mips64vrel \ 1223370b807fSmrg | mips64vr4100 | mips64vr4100el \ 1224370b807fSmrg | mips64vr4300 | mips64vr4300el \ 1225370b807fSmrg | mips64vr5000 | mips64vr5000el \ 1226370b807fSmrg | mips64vr5900 | mips64vr5900el \ 1227370b807fSmrg | mipsisa32 | mipsisa32el \ 1228370b807fSmrg | mipsisa32r2 | mipsisa32r2el \ 1229370b807fSmrg | mipsisa32r3 | mipsisa32r3el \ 1230370b807fSmrg | mipsisa32r5 | mipsisa32r5el \ 1231370b807fSmrg | mipsisa32r6 | mipsisa32r6el \ 1232370b807fSmrg | mipsisa64 | mipsisa64el \ 1233370b807fSmrg | mipsisa64r2 | mipsisa64r2el \ 1234370b807fSmrg | mipsisa64r3 | mipsisa64r3el \ 1235370b807fSmrg | mipsisa64r5 | mipsisa64r5el \ 1236370b807fSmrg | mipsisa64r6 | mipsisa64r6el \ 1237370b807fSmrg | mipsisa64sb1 | mipsisa64sb1el \ 1238370b807fSmrg | mipsisa64sr71k | mipsisa64sr71kel \ 1239370b807fSmrg | mipsr5900 | mipsr5900el \ 1240370b807fSmrg | mipstx39 | mipstx39el \ 1241370b807fSmrg | mmix \ 1242370b807fSmrg | mn10200 | mn10300 \ 1243370b807fSmrg | moxie \ 1244370b807fSmrg | mt \ 1245370b807fSmrg | msp430 \ 1246370b807fSmrg | nds32 | nds32le | nds32be \ 1247370b807fSmrg | nfp \ 1248370b807fSmrg | nios | nios2 | nios2eb | nios2el \ 1249370b807fSmrg | none | np1 | ns16k | ns32k | nvptx \ 1250370b807fSmrg | open8 \ 1251370b807fSmrg | or1k* \ 1252370b807fSmrg | or32 \ 1253370b807fSmrg | orion \ 1254370b807fSmrg | picochip \ 1255370b807fSmrg | pdp10 | pdp11 | pj | pjl | pn | power \ 1256370b807fSmrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 1257370b807fSmrg | pru \ 1258370b807fSmrg | pyramid \ 1259370b807fSmrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 1260370b807fSmrg | rl78 | romp | rs6000 | rx \ 1261370b807fSmrg | s390 | s390x \ 1262370b807fSmrg | score \ 1263370b807fSmrg | sh | shl \ 1264370b807fSmrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 1265370b807fSmrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 1266370b807fSmrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 1267370b807fSmrg | sparclite \ 1268370b807fSmrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 1269370b807fSmrg | spu \ 1270370b807fSmrg | tahoe \ 1271370b807fSmrg | thumbv7* \ 1272370b807fSmrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 1273370b807fSmrg | tron \ 1274370b807fSmrg | ubicom32 \ 1275370b807fSmrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 1276370b807fSmrg | vax \ 1277370b807fSmrg | visium \ 1278370b807fSmrg | w65 \ 1279370b807fSmrg | wasm32 | wasm64 \ 1280370b807fSmrg | we32k \ 1281370b807fSmrg | x86 | x86_64 | xc16x | xgate | xps100 \ 1282370b807fSmrg | xstormy16 | xtensa* \ 1283370b807fSmrg | ymp \ 1284370b807fSmrg | z8k | z80) 1285370b807fSmrg ;; 1286370b807fSmrg 1287370b807fSmrg *) 1288370b807fSmrg echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 1289370b807fSmrg exit 1 1290370b807fSmrg ;; 1291370b807fSmrg esac 1292659607e0Smrg ;; 1293659607e0Smrgesac 1294659607e0Smrg 1295659607e0Smrg# Here we canonicalize certain aliases for manufacturers. 1296370b807fSmrgcase $vendor in 1297370b807fSmrg digital*) 1298370b807fSmrg vendor=dec 1299659607e0Smrg ;; 1300370b807fSmrg commodore*) 1301370b807fSmrg vendor=cbm 1302659607e0Smrg ;; 1303659607e0Smrg *) 1304659607e0Smrg ;; 1305659607e0Smrgesac 1306659607e0Smrg 1307659607e0Smrg# Decode manufacturer-specific aliases for certain operating systems. 1308659607e0Smrg 1309370b807fSmrgif test x$basic_os != x 1310659607e0Smrgthen 1311370b807fSmrg 1312ebac4eb7Smrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 1313370b807fSmrg# set os. 1314370b807fSmrgcase $basic_os in 1315370b807fSmrg gnu/linux*) 1316370b807fSmrg kernel=linux 1317370b807fSmrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 1318370b807fSmrg ;; 1319370b807fSmrg os2-emx) 1320370b807fSmrg kernel=os2 1321370b807fSmrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 1322370b807fSmrg ;; 1323370b807fSmrg nto-qnx*) 1324370b807fSmrg kernel=nto 1325370b807fSmrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 1326370b807fSmrg ;; 1327370b807fSmrg *-*) 1328370b807fSmrg # shellcheck disable=SC2162 1329370b807fSmrg saved_IFS=$IFS 1330370b807fSmrg IFS="-" read kernel os <<EOF 1331370b807fSmrg$basic_os 1332370b807fSmrgEOF 1333370b807fSmrg IFS=$saved_IFS 1334370b807fSmrg ;; 1335370b807fSmrg # Default OS when just kernel was specified 1336370b807fSmrg nto*) 1337370b807fSmrg kernel=nto 1338370b807fSmrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 1339370b807fSmrg ;; 1340370b807fSmrg linux*) 1341370b807fSmrg kernel=linux 1342370b807fSmrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 1343b73be646Smrg ;; 1344ebac4eb7Smrg managarm*) 1345ebac4eb7Smrg kernel=managarm 1346ebac4eb7Smrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 1347ebac4eb7Smrg ;; 1348370b807fSmrg *) 1349370b807fSmrg kernel= 1350370b807fSmrg os=$basic_os 1351659607e0Smrg ;; 1352370b807fSmrgesac 1353370b807fSmrg 1354370b807fSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 1355370b807fSmrg# etc.) 1356370b807fSmrgcase $os in 1357370b807fSmrg # First match some system type aliases that might get confused 1358370b807fSmrg # with valid system types. 1359370b807fSmrg # solaris* is a basic system type, with this one exception. 1360370b807fSmrg auroraux) 1361370b807fSmrg os=auroraux 1362659607e0Smrg ;; 1363370b807fSmrg bluegene*) 1364370b807fSmrg os=cnk 1365659607e0Smrg ;; 1366370b807fSmrg solaris1 | solaris1.*) 1367370b807fSmrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 1368659607e0Smrg ;; 1369370b807fSmrg solaris) 1370370b807fSmrg os=solaris2 1371659607e0Smrg ;; 1372370b807fSmrg unixware*) 1373370b807fSmrg os=sysv4.2uw 1374659607e0Smrg ;; 1375370b807fSmrg # es1800 is here to avoid being matched by es* (a different OS) 1376370b807fSmrg es1800*) 1377370b807fSmrg os=ose 1378659607e0Smrg ;; 1379370b807fSmrg # Some version numbers need modification 1380370b807fSmrg chorusos*) 1381370b807fSmrg os=chorusos 1382659607e0Smrg ;; 1383370b807fSmrg isc) 1384370b807fSmrg os=isc2.2 1385659607e0Smrg ;; 1386370b807fSmrg sco6) 1387370b807fSmrg os=sco5v6 1388659607e0Smrg ;; 1389370b807fSmrg sco5) 1390370b807fSmrg os=sco3.2v5 1391659607e0Smrg ;; 1392370b807fSmrg sco4) 1393370b807fSmrg os=sco3.2v4 1394659607e0Smrg ;; 1395370b807fSmrg sco3.2.[4-9]*) 1396370b807fSmrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 1397659607e0Smrg ;; 1398370b807fSmrg sco*v* | scout) 1399370b807fSmrg # Don't match below 1400659607e0Smrg ;; 1401370b807fSmrg sco*) 1402370b807fSmrg os=sco3.2v2 1403659607e0Smrg ;; 1404370b807fSmrg psos*) 1405370b807fSmrg os=psos 1406659607e0Smrg ;; 1407370b807fSmrg qnx*) 1408370b807fSmrg os=qnx 1409659607e0Smrg ;; 1410370b807fSmrg hiux*) 1411370b807fSmrg os=hiuxwe2 1412659607e0Smrg ;; 1413370b807fSmrg lynx*178) 1414370b807fSmrg os=lynxos178 1415659607e0Smrg ;; 1416370b807fSmrg lynx*5) 1417370b807fSmrg os=lynxos5 1418659607e0Smrg ;; 1419370b807fSmrg lynxos*) 1420370b807fSmrg # don't get caught up in next wildcard 1421659607e0Smrg ;; 1422370b807fSmrg lynx*) 1423370b807fSmrg os=lynxos 1424659607e0Smrg ;; 1425370b807fSmrg mac[0-9]*) 1426370b807fSmrg os=`echo "$os" | sed -e 's|mac|macos|'` 1427659607e0Smrg ;; 1428370b807fSmrg opened*) 1429370b807fSmrg os=openedition 1430659607e0Smrg ;; 1431370b807fSmrg os400*) 1432370b807fSmrg os=os400 1433659607e0Smrg ;; 1434370b807fSmrg sunos5*) 1435370b807fSmrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1436659607e0Smrg ;; 1437370b807fSmrg sunos6*) 1438370b807fSmrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1439659607e0Smrg ;; 1440370b807fSmrg wince*) 1441370b807fSmrg os=wince 1442659607e0Smrg ;; 1443370b807fSmrg utek*) 1444370b807fSmrg os=bsd 1445659607e0Smrg ;; 1446370b807fSmrg dynix*) 1447370b807fSmrg os=bsd 1448370b807fSmrg ;; 1449370b807fSmrg acis*) 1450370b807fSmrg os=aos 1451659607e0Smrg ;; 1452370b807fSmrg atheos*) 1453370b807fSmrg os=atheos 1454659607e0Smrg ;; 1455370b807fSmrg syllable*) 1456370b807fSmrg os=syllable 1457659607e0Smrg ;; 1458370b807fSmrg 386bsd) 1459370b807fSmrg os=bsd 1460659607e0Smrg ;; 1461370b807fSmrg ctix* | uts*) 1462370b807fSmrg os=sysv 1463659607e0Smrg ;; 1464370b807fSmrg nova*) 1465370b807fSmrg os=rtmk-nova 1466659607e0Smrg ;; 1467370b807fSmrg ns2) 1468370b807fSmrg os=nextstep2 1469659607e0Smrg ;; 1470370b807fSmrg # Preserve the version number of sinix5. 1471370b807fSmrg sinix5.*) 1472370b807fSmrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 1473659607e0Smrg ;; 1474370b807fSmrg sinix*) 1475370b807fSmrg os=sysv4 1476659607e0Smrg ;; 1477370b807fSmrg tpf*) 1478370b807fSmrg os=tpf 1479659607e0Smrg ;; 1480370b807fSmrg triton*) 1481370b807fSmrg os=sysv3 1482659607e0Smrg ;; 1483370b807fSmrg oss*) 1484370b807fSmrg os=sysv3 1485659607e0Smrg ;; 1486370b807fSmrg svr4*) 1487370b807fSmrg os=sysv4 1488659607e0Smrg ;; 1489370b807fSmrg svr3) 1490370b807fSmrg os=sysv3 1491659607e0Smrg ;; 1492370b807fSmrg sysvr4) 1493370b807fSmrg os=sysv4 1494e4da38afSmrg ;; 1495370b807fSmrg ose*) 1496370b807fSmrg os=ose 1497659607e0Smrg ;; 1498370b807fSmrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1499370b807fSmrg os=mint 1500b73be646Smrg ;; 1501370b807fSmrg dicos*) 1502370b807fSmrg os=dicos 1503a73597f9Smrg ;; 1504370b807fSmrg pikeos*) 1505370b807fSmrg # Until real need of OS specific support for 1506370b807fSmrg # particular features comes up, bare metal 1507370b807fSmrg # configurations are quite functional. 1508370b807fSmrg case $cpu in 1509370b807fSmrg arm*) 1510370b807fSmrg os=eabi 1511370b807fSmrg ;; 1512370b807fSmrg *) 1513370b807fSmrg os=elf 1514370b807fSmrg ;; 1515370b807fSmrg esac 1516659607e0Smrg ;; 1517659607e0Smrg *) 1518370b807fSmrg # No normalization, but not necessarily accepted, that comes below. 1519659607e0Smrg ;; 1520659607e0Smrgesac 1521370b807fSmrg 1522659607e0Smrgelse 1523659607e0Smrg 1524659607e0Smrg# Here we handle the default operating systems that come with various machines. 1525659607e0Smrg# The value should be what the vendor currently ships out the door with their 1526659607e0Smrg# machine or put another way, the most popular os provided with the machine. 1527659607e0Smrg 1528659607e0Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 1529659607e0Smrg# "-sun"), then you have to tell the case statement up towards the top 1530659607e0Smrg# that MANUFACTURER isn't an operating system. Otherwise, code above 1531659607e0Smrg# will signal an error saying that MANUFACTURER isn't an operating 1532659607e0Smrg# system, and we'll never get to this point. 1533659607e0Smrg 1534370b807fSmrgkernel= 1535370b807fSmrgcase $cpu-$vendor in 1536a73597f9Smrg score-*) 1537370b807fSmrg os=elf 1538fc27e79cSmrg ;; 1539a73597f9Smrg spu-*) 1540370b807fSmrg os=elf 1541fc27e79cSmrg ;; 1542659607e0Smrg *-acorn) 1543370b807fSmrg os=riscix1.2 1544659607e0Smrg ;; 1545659607e0Smrg arm*-rebel) 1546370b807fSmrg kernel=linux 1547370b807fSmrg os=gnu 1548659607e0Smrg ;; 1549659607e0Smrg arm*-semi) 1550370b807fSmrg os=aout 1551659607e0Smrg ;; 1552a73597f9Smrg c4x-* | tic4x-*) 1553370b807fSmrg os=coff 1554370b807fSmrg ;; 1555370b807fSmrg c8051-*) 1556370b807fSmrg os=elf 1557370b807fSmrg ;; 1558370b807fSmrg clipper-intergraph) 1559370b807fSmrg os=clix 1560a73597f9Smrg ;; 1561a73597f9Smrg hexagon-*) 1562370b807fSmrg os=elf 1563fc27e79cSmrg ;; 1564bd3a1963Smrg tic54x-*) 1565370b807fSmrg os=coff 1566bd3a1963Smrg ;; 1567bd3a1963Smrg tic55x-*) 1568370b807fSmrg os=coff 1569bd3a1963Smrg ;; 1570bd3a1963Smrg tic6x-*) 1571370b807fSmrg os=coff 1572bd3a1963Smrg ;; 1573659607e0Smrg # This must come before the *-dec entry. 1574659607e0Smrg pdp10-*) 1575370b807fSmrg os=tops20 1576659607e0Smrg ;; 1577659607e0Smrg pdp11-*) 1578370b807fSmrg os=none 1579659607e0Smrg ;; 1580659607e0Smrg *-dec | vax-*) 1581370b807fSmrg os=ultrix4.2 1582659607e0Smrg ;; 1583659607e0Smrg m68*-apollo) 1584370b807fSmrg os=domain 1585659607e0Smrg ;; 1586659607e0Smrg i386-sun) 1587370b807fSmrg os=sunos4.0.2 1588659607e0Smrg ;; 1589659607e0Smrg m68000-sun) 1590370b807fSmrg os=sunos3 1591659607e0Smrg ;; 1592659607e0Smrg m68*-cisco) 1593370b807fSmrg os=aout 1594659607e0Smrg ;; 1595a73597f9Smrg mep-*) 1596370b807fSmrg os=elf 1597fc27e79cSmrg ;; 1598659607e0Smrg mips*-cisco) 1599370b807fSmrg os=elf 1600659607e0Smrg ;; 1601659607e0Smrg mips*-*) 1602370b807fSmrg os=elf 1603659607e0Smrg ;; 1604659607e0Smrg or32-*) 1605370b807fSmrg os=coff 1606659607e0Smrg ;; 1607659607e0Smrg *-tti) # must be before sparc entry or we get the wrong os. 1608370b807fSmrg os=sysv3 1609659607e0Smrg ;; 1610659607e0Smrg sparc-* | *-sun) 1611370b807fSmrg os=sunos4.1.1 1612659607e0Smrg ;; 1613370b807fSmrg pru-*) 1614370b807fSmrg os=elf 1615659607e0Smrg ;; 1616370b807fSmrg *-be) 1617370b807fSmrg os=beos 1618659607e0Smrg ;; 1619659607e0Smrg *-ibm) 1620370b807fSmrg os=aix 1621659607e0Smrg ;; 1622a73597f9Smrg *-knuth) 1623370b807fSmrg os=mmixware 1624659607e0Smrg ;; 1625659607e0Smrg *-wec) 1626370b807fSmrg os=proelf 1627659607e0Smrg ;; 1628659607e0Smrg *-winbond) 1629370b807fSmrg os=proelf 1630659607e0Smrg ;; 1631659607e0Smrg *-oki) 1632370b807fSmrg os=proelf 1633659607e0Smrg ;; 1634659607e0Smrg *-hp) 1635370b807fSmrg os=hpux 1636659607e0Smrg ;; 1637659607e0Smrg *-hitachi) 1638370b807fSmrg os=hiux 1639659607e0Smrg ;; 1640659607e0Smrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1641370b807fSmrg os=sysv 1642659607e0Smrg ;; 1643659607e0Smrg *-cbm) 1644370b807fSmrg os=amigaos 1645659607e0Smrg ;; 1646659607e0Smrg *-dg) 1647370b807fSmrg os=dgux 1648659607e0Smrg ;; 1649659607e0Smrg *-dolphin) 1650370b807fSmrg os=sysv3 1651659607e0Smrg ;; 1652659607e0Smrg m68k-ccur) 1653370b807fSmrg os=rtu 1654659607e0Smrg ;; 1655659607e0Smrg m88k-omron*) 1656370b807fSmrg os=luna 1657659607e0Smrg ;; 1658370b807fSmrg *-next) 1659370b807fSmrg os=nextstep 1660659607e0Smrg ;; 1661659607e0Smrg *-sequent) 1662370b807fSmrg os=ptx 1663659607e0Smrg ;; 1664659607e0Smrg *-crds) 1665370b807fSmrg os=unos 1666659607e0Smrg ;; 1667659607e0Smrg *-ns) 1668370b807fSmrg os=genix 1669659607e0Smrg ;; 1670659607e0Smrg i370-*) 1671370b807fSmrg os=mvs 1672659607e0Smrg ;; 1673659607e0Smrg *-gould) 1674370b807fSmrg os=sysv 1675659607e0Smrg ;; 1676659607e0Smrg *-highlevel) 1677370b807fSmrg os=bsd 1678659607e0Smrg ;; 1679659607e0Smrg *-encore) 1680370b807fSmrg os=bsd 1681659607e0Smrg ;; 1682659607e0Smrg *-sgi) 1683370b807fSmrg os=irix 1684659607e0Smrg ;; 1685659607e0Smrg *-siemens) 1686370b807fSmrg os=sysv4 1687659607e0Smrg ;; 1688659607e0Smrg *-masscomp) 1689370b807fSmrg os=rtu 1690659607e0Smrg ;; 1691659607e0Smrg f30[01]-fujitsu | f700-fujitsu) 1692370b807fSmrg os=uxpv 1693659607e0Smrg ;; 1694659607e0Smrg *-rom68k) 1695370b807fSmrg os=coff 1696659607e0Smrg ;; 1697659607e0Smrg *-*bug) 1698370b807fSmrg os=coff 1699659607e0Smrg ;; 1700659607e0Smrg *-apple) 1701370b807fSmrg os=macos 1702659607e0Smrg ;; 1703659607e0Smrg *-atari*) 1704370b807fSmrg os=mint 1705370b807fSmrg ;; 1706370b807fSmrg *-wrs) 1707370b807fSmrg os=vxworks 1708659607e0Smrg ;; 1709659607e0Smrg *) 1710370b807fSmrg os=none 1711659607e0Smrg ;; 1712659607e0Smrgesac 1713370b807fSmrg 1714659607e0Smrgfi 1715659607e0Smrg 1716370b807fSmrg# Now, validate our (potentially fixed-up) OS. 1717370b807fSmrgcase $os in 1718370b807fSmrg # Sometimes we do "kernel-libc", so those need to count as OSes. 1719370b807fSmrg musl* | newlib* | relibc* | uclibc*) 1720370b807fSmrg ;; 1721370b807fSmrg # Likewise for "kernel-abi" 1722370b807fSmrg eabi* | gnueabi*) 1723370b807fSmrg ;; 1724370b807fSmrg # VxWorks passes extra cpu info in the 4th filed. 1725370b807fSmrg simlinux | simwindows | spe) 1726370b807fSmrg ;; 1727370b807fSmrg # Now accept the basic system types. 1728370b807fSmrg # The portable systems comes first. 1729370b807fSmrg # Each alternative MUST end in a * to match a version number. 1730370b807fSmrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1731370b807fSmrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 1732370b807fSmrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1733370b807fSmrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 1734370b807fSmrg | hiux* | abug | nacl* | netware* | windows* \ 1735370b807fSmrg | os9* | macos* | osx* | ios* \ 1736370b807fSmrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 1737370b807fSmrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1738370b807fSmrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 1739370b807fSmrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1740370b807fSmrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 1741370b807fSmrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 1742370b807fSmrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 1743370b807fSmrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1744370b807fSmrg | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1745370b807fSmrg | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1746370b807fSmrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 1747370b807fSmrg | chorusrdb* | cegcc* | glidix* | serenity* \ 1748370b807fSmrg | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 1749370b807fSmrg | midipix* | mingw32* | mingw64* | mint* \ 1750370b807fSmrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1751370b807fSmrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 1752370b807fSmrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 1753370b807fSmrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 1754370b807fSmrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 1755370b807fSmrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 1756370b807fSmrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 1757370b807fSmrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 1758370b807fSmrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 1759370b807fSmrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1760ebac4eb7Smrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1761ebac4eb7Smrg | fiwix* | mlibc* ) 1762370b807fSmrg ;; 1763370b807fSmrg # This one is extra strict with allowed versions 1764370b807fSmrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 1765370b807fSmrg # Don't forget version if it is 3.2v4 or newer. 1766370b807fSmrg ;; 1767370b807fSmrg none) 1768370b807fSmrg ;; 1769ebac4eb7Smrg kernel* ) 1770ebac4eb7Smrg # Restricted further below 1771ebac4eb7Smrg ;; 1772370b807fSmrg *) 1773370b807fSmrg echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 1774370b807fSmrg exit 1 1775370b807fSmrg ;; 1776370b807fSmrgesac 1777370b807fSmrg 1778370b807fSmrg# As a final step for OS-related things, validate the OS-kernel combination 1779370b807fSmrg# (given a valid OS), if there is a kernel. 1780370b807fSmrgcase $kernel-$os in 1781370b807fSmrg linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 1782ebac4eb7Smrg | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 1783370b807fSmrg ;; 1784370b807fSmrg uclinux-uclibc* ) 1785370b807fSmrg ;; 1786ebac4eb7Smrg managarm-mlibc* | managarm-kernel* ) 1787ebac4eb7Smrg ;; 1788ebac4eb7Smrg -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 1789370b807fSmrg # These are just libc implementations, not actual OSes, and thus 1790370b807fSmrg # require a kernel. 1791370b807fSmrg echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 1792370b807fSmrg exit 1 1793370b807fSmrg ;; 1794ebac4eb7Smrg -kernel* ) 1795ebac4eb7Smrg echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 1796ebac4eb7Smrg exit 1 1797ebac4eb7Smrg ;; 1798ebac4eb7Smrg *-kernel* ) 1799ebac4eb7Smrg echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 1800ebac4eb7Smrg exit 1 1801ebac4eb7Smrg ;; 1802370b807fSmrg kfreebsd*-gnu* | kopensolaris*-gnu*) 1803370b807fSmrg ;; 1804370b807fSmrg vxworks-simlinux | vxworks-simwindows | vxworks-spe) 1805370b807fSmrg ;; 1806370b807fSmrg nto-qnx*) 1807370b807fSmrg ;; 1808370b807fSmrg os2-emx) 1809370b807fSmrg ;; 1810370b807fSmrg *-eabi* | *-gnueabi*) 1811370b807fSmrg ;; 1812370b807fSmrg -*) 1813370b807fSmrg # Blank kernel with real OS is always fine. 1814370b807fSmrg ;; 1815370b807fSmrg *-*) 1816370b807fSmrg echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 1817370b807fSmrg exit 1 1818370b807fSmrg ;; 1819370b807fSmrgesac 1820370b807fSmrg 1821659607e0Smrg# Here we handle the case where we know the os, and the CPU type, but not the 1822659607e0Smrg# manufacturer. We pick the logical manufacturer. 1823370b807fSmrgcase $vendor in 1824370b807fSmrg unknown) 1825370b807fSmrg case $cpu-$os in 1826370b807fSmrg *-riscix*) 1827659607e0Smrg vendor=acorn 1828659607e0Smrg ;; 1829370b807fSmrg *-sunos*) 1830659607e0Smrg vendor=sun 1831659607e0Smrg ;; 1832370b807fSmrg *-cnk* | *-aix*) 1833659607e0Smrg vendor=ibm 1834659607e0Smrg ;; 1835370b807fSmrg *-beos*) 1836659607e0Smrg vendor=be 1837659607e0Smrg ;; 1838370b807fSmrg *-hpux*) 1839659607e0Smrg vendor=hp 1840659607e0Smrg ;; 1841370b807fSmrg *-mpeix*) 1842659607e0Smrg vendor=hp 1843659607e0Smrg ;; 1844370b807fSmrg *-hiux*) 1845659607e0Smrg vendor=hitachi 1846659607e0Smrg ;; 1847370b807fSmrg *-unos*) 1848659607e0Smrg vendor=crds 1849659607e0Smrg ;; 1850370b807fSmrg *-dgux*) 1851659607e0Smrg vendor=dg 1852659607e0Smrg ;; 1853370b807fSmrg *-luna*) 1854659607e0Smrg vendor=omron 1855659607e0Smrg ;; 1856370b807fSmrg *-genix*) 1857659607e0Smrg vendor=ns 1858659607e0Smrg ;; 1859370b807fSmrg *-clix*) 1860370b807fSmrg vendor=intergraph 1861370b807fSmrg ;; 1862370b807fSmrg *-mvs* | *-opened*) 1863370b807fSmrg vendor=ibm 1864370b807fSmrg ;; 1865370b807fSmrg *-os400*) 1866659607e0Smrg vendor=ibm 1867659607e0Smrg ;; 1868370b807fSmrg s390-* | s390x-*) 1869659607e0Smrg vendor=ibm 1870659607e0Smrg ;; 1871370b807fSmrg *-ptx*) 1872659607e0Smrg vendor=sequent 1873659607e0Smrg ;; 1874370b807fSmrg *-tpf*) 1875659607e0Smrg vendor=ibm 1876659607e0Smrg ;; 1877370b807fSmrg *-vxsim* | *-vxworks* | *-windiss*) 1878659607e0Smrg vendor=wrs 1879659607e0Smrg ;; 1880370b807fSmrg *-aux*) 1881659607e0Smrg vendor=apple 1882659607e0Smrg ;; 1883370b807fSmrg *-hms*) 1884659607e0Smrg vendor=hitachi 1885659607e0Smrg ;; 1886370b807fSmrg *-mpw* | *-macos*) 1887659607e0Smrg vendor=apple 1888659607e0Smrg ;; 1889370b807fSmrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 1890659607e0Smrg vendor=atari 1891659607e0Smrg ;; 1892370b807fSmrg *-vos*) 1893659607e0Smrg vendor=stratus 1894659607e0Smrg ;; 1895659607e0Smrg esac 1896659607e0Smrg ;; 1897659607e0Smrgesac 1898659607e0Smrg 1899370b807fSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os" 1900659607e0Smrgexit 1901659607e0Smrg 1902659607e0Smrg# Local variables: 1903370b807fSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 1904659607e0Smrg# time-stamp-start: "timestamp='" 1905659607e0Smrg# time-stamp-format: "%:y-%02m-%02d" 1906659607e0Smrg# time-stamp-end: "'" 1907659607e0Smrg# End: 1908