135d5702bSmrg#! /bin/sh 235d5702bSmrg# Configuration validation subroutine script. 3541411ceSmrg# Copyright 1992-2023 Free Software Foundation, Inc. 435d5702bSmrg 5541411ceSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale 635d5702bSmrg 7541411ceSmrgtimestamp='2023-01-21' 8541411ceSmrg 9541411ceSmrg# This file is free software; you can redistribute it and/or modify it 10541411ceSmrg# under the terms of the GNU General Public License as published by 11541411ceSmrg# the Free Software Foundation, either version 3 of the License, or 1235d5702bSmrg# (at your option) any later version. 1335d5702bSmrg# 14541411ceSmrg# This program is distributed in the hope that it will be useful, but 15541411ceSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 16541411ceSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17541411ceSmrg# General Public License for more details. 1835d5702bSmrg# 1935d5702bSmrg# You should have received a copy of the GNU General Public License 20541411ceSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 2135d5702bSmrg# 2235d5702bSmrg# As a special exception to the GNU General Public License, if you 2335d5702bSmrg# distribute this file as part of a program that contains a 2435d5702bSmrg# configuration script generated by Autoconf, you may include it under 25541411ceSmrg# the same distribution terms that you use for the rest of that 26541411ceSmrg# program. This Exception is an additional permission under section 7 27541411ceSmrg# of the GNU General Public License, version 3 ("GPLv3"). 2835d5702bSmrg 2935d5702bSmrg 30541411ceSmrg# Please send patches to <config-patches@gnu.org>. 3135d5702bSmrg# 3235d5702bSmrg# Configuration subroutine to validate and canonicalize a configuration type. 3335d5702bSmrg# Supply the specified configuration type as an argument. 3435d5702bSmrg# If it is invalid, we print an error message on stderr and exit with code 1. 3535d5702bSmrg# Otherwise, we print the canonical config type on stdout and succeed. 3635d5702bSmrg 37eeced2e6Smrg# You can get the latest version of this script from: 38541411ceSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39eeced2e6Smrg 4035d5702bSmrg# This file is supposed to be the same for all GNU packages 4135d5702bSmrg# and recognize all the CPU types, system types and aliases 4235d5702bSmrg# that are meaningful with *any* GNU software. 4335d5702bSmrg# Each package is responsible for reporting which valid configurations 4435d5702bSmrg# it does not support. The user should be able to distinguish 4535d5702bSmrg# a failure to support a valid configuration from a meaningless 4635d5702bSmrg# configuration. 4735d5702bSmrg 4835d5702bSmrg# The goal of this file is to map all the various variations of a given 4935d5702bSmrg# machine specification into a single specification in the form: 5035d5702bSmrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 5135d5702bSmrg# or in some cases, the newer four-part form: 5235d5702bSmrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 5335d5702bSmrg# It is wrong to echo any other type of specification. 5435d5702bSmrg 55541411ceSmrg# The "shellcheck disable" line above the timestamp inhibits complaints 56541411ceSmrg# about features and limitations of the classic Bourne shell that were 57541411ceSmrg# superseded or lifted in POSIX. However, this script identifies a wide 58541411ceSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 59541411ceSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still 60541411ceSmrg# have a pre-POSIX /bin/sh. 61541411ceSmrg 6235d5702bSmrgme=`echo "$0" | sed -e 's,.*/,,'` 6335d5702bSmrg 6435d5702bSmrgusage="\ 65541411ceSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 6635d5702bSmrg 6735d5702bSmrgCanonicalize a configuration name. 6835d5702bSmrg 69541411ceSmrgOptions: 7035d5702bSmrg -h, --help print this help, then exit 7135d5702bSmrg -t, --time-stamp print date of last modification, then exit 7235d5702bSmrg -v, --version print version number, then exit 7335d5702bSmrg 7435d5702bSmrgReport bugs and patches to <config-patches@gnu.org>." 7535d5702bSmrg 7635d5702bSmrgversion="\ 7735d5702bSmrgGNU config.sub ($timestamp) 7835d5702bSmrg 79541411ceSmrgCopyright 1992-2023 Free Software Foundation, Inc. 8035d5702bSmrg 8135d5702bSmrgThis is free software; see the source for copying conditions. There is NO 8235d5702bSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 8335d5702bSmrg 8435d5702bSmrghelp=" 8535d5702bSmrgTry \`$me --help' for more information." 8635d5702bSmrg 8735d5702bSmrg# Parse command line 8835d5702bSmrgwhile test $# -gt 0 ; do 8935d5702bSmrg case $1 in 9035d5702bSmrg --time-stamp | --time* | -t ) 9135d5702bSmrg echo "$timestamp" ; exit ;; 9235d5702bSmrg --version | -v ) 9335d5702bSmrg echo "$version" ; exit ;; 9435d5702bSmrg --help | --h* | -h ) 9535d5702bSmrg echo "$usage"; exit ;; 9635d5702bSmrg -- ) # Stop option processing 9735d5702bSmrg shift; break ;; 9835d5702bSmrg - ) # Use stdin as input. 9935d5702bSmrg break ;; 10035d5702bSmrg -* ) 101541411ceSmrg echo "$me: invalid option $1$help" >&2 10235d5702bSmrg exit 1 ;; 10335d5702bSmrg 10435d5702bSmrg *local*) 10535d5702bSmrg # First pass through any local machine types. 106541411ceSmrg echo "$1" 10735d5702bSmrg exit ;; 10835d5702bSmrg 10935d5702bSmrg * ) 11035d5702bSmrg break ;; 11135d5702bSmrg esac 11235d5702bSmrgdone 11335d5702bSmrg 11435d5702bSmrgcase $# in 11535d5702bSmrg 0) echo "$me: missing argument$help" >&2 11635d5702bSmrg exit 1;; 11735d5702bSmrg 1) ;; 11835d5702bSmrg *) echo "$me: too many arguments$help" >&2 11935d5702bSmrg exit 1;; 12035d5702bSmrgesac 12135d5702bSmrg 122541411ceSmrg# Split fields of configuration type 123541411ceSmrg# shellcheck disable=SC2162 124541411ceSmrgsaved_IFS=$IFS 125541411ceSmrgIFS="-" read field1 field2 field3 field4 <<EOF 126541411ceSmrg$1 127541411ceSmrgEOF 128541411ceSmrgIFS=$saved_IFS 12935d5702bSmrg 130541411ceSmrg# Separate into logical components for further validation 131541411ceSmrgcase $1 in 132541411ceSmrg *-*-*-*-*) 133541411ceSmrg echo Invalid configuration \`"$1"\': more than four components >&2 134541411ceSmrg exit 1 13535d5702bSmrg ;; 136541411ceSmrg *-*-*-*) 137541411ceSmrg basic_machine=$field1-$field2 138541411ceSmrg basic_os=$field3-$field4 13935d5702bSmrg ;; 140541411ceSmrg *-*-*) 141541411ceSmrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 142541411ceSmrg # parts 143541411ceSmrg maybe_os=$field2-$field3 144541411ceSmrg case $maybe_os in 145541411ceSmrg nto-qnx* | linux-* | uclinux-uclibc* \ 146541411ceSmrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 147541411ceSmrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148541411ceSmrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) 149541411ceSmrg basic_machine=$field1 150541411ceSmrg basic_os=$maybe_os 151541411ceSmrg ;; 152541411ceSmrg android-linux) 153541411ceSmrg basic_machine=$field1-unknown 154541411ceSmrg basic_os=linux-android 155541411ceSmrg ;; 156541411ceSmrg *) 157541411ceSmrg basic_machine=$field1-$field2 158541411ceSmrg basic_os=$field3 159541411ceSmrg ;; 160541411ceSmrg esac 16135d5702bSmrg ;; 162541411ceSmrg *-*) 163541411ceSmrg # A lone config we happen to match not fitting any pattern 164541411ceSmrg case $field1-$field2 in 165541411ceSmrg decstation-3100) 166541411ceSmrg basic_machine=mips-dec 167541411ceSmrg basic_os= 168541411ceSmrg ;; 169541411ceSmrg *-*) 170541411ceSmrg # Second component is usually, but not always the OS 171541411ceSmrg case $field2 in 172541411ceSmrg # Prevent following clause from handling this valid os 173541411ceSmrg sun*os*) 174541411ceSmrg basic_machine=$field1 175541411ceSmrg basic_os=$field2 176541411ceSmrg ;; 177541411ceSmrg zephyr*) 178541411ceSmrg basic_machine=$field1-unknown 179541411ceSmrg basic_os=$field2 180541411ceSmrg ;; 181541411ceSmrg # Manufacturers 182541411ceSmrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 183541411ceSmrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 184541411ceSmrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 185541411ceSmrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 186541411ceSmrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 187541411ceSmrg | ultra | tti* | harris | dolphin | highlevel | gould \ 188541411ceSmrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 189541411ceSmrg | microblaze* | sim | cisco \ 190541411ceSmrg | oki | wec | wrs | winbond) 191541411ceSmrg basic_machine=$field1-$field2 192541411ceSmrg basic_os= 193541411ceSmrg ;; 194541411ceSmrg *) 195541411ceSmrg basic_machine=$field1 196541411ceSmrg basic_os=$field2 197541411ceSmrg ;; 198541411ceSmrg esac 199541411ceSmrg ;; 200541411ceSmrg esac 20135d5702bSmrg ;; 202541411ceSmrg *) 203541411ceSmrg # Convert single-component short-hands not valid as part of 204541411ceSmrg # multi-component configurations. 205541411ceSmrg case $field1 in 206541411ceSmrg 386bsd) 207541411ceSmrg basic_machine=i386-pc 208541411ceSmrg basic_os=bsd 209541411ceSmrg ;; 210541411ceSmrg a29khif) 211541411ceSmrg basic_machine=a29k-amd 212541411ceSmrg basic_os=udi 213541411ceSmrg ;; 214541411ceSmrg adobe68k) 215541411ceSmrg basic_machine=m68010-adobe 216541411ceSmrg basic_os=scout 217541411ceSmrg ;; 218541411ceSmrg alliant) 219541411ceSmrg basic_machine=fx80-alliant 220541411ceSmrg basic_os= 221541411ceSmrg ;; 222541411ceSmrg altos | altos3068) 223541411ceSmrg basic_machine=m68k-altos 224541411ceSmrg basic_os= 225541411ceSmrg ;; 226541411ceSmrg am29k) 227541411ceSmrg basic_machine=a29k-none 228541411ceSmrg basic_os=bsd 229541411ceSmrg ;; 230541411ceSmrg amdahl) 231541411ceSmrg basic_machine=580-amdahl 232541411ceSmrg basic_os=sysv 233541411ceSmrg ;; 234541411ceSmrg amiga) 235541411ceSmrg basic_machine=m68k-unknown 236541411ceSmrg basic_os= 237541411ceSmrg ;; 238541411ceSmrg amigaos | amigados) 239541411ceSmrg basic_machine=m68k-unknown 240541411ceSmrg basic_os=amigaos 241541411ceSmrg ;; 242541411ceSmrg amigaunix | amix) 243541411ceSmrg basic_machine=m68k-unknown 244541411ceSmrg basic_os=sysv4 245541411ceSmrg ;; 246541411ceSmrg apollo68) 247541411ceSmrg basic_machine=m68k-apollo 248541411ceSmrg basic_os=sysv 249541411ceSmrg ;; 250541411ceSmrg apollo68bsd) 251541411ceSmrg basic_machine=m68k-apollo 252541411ceSmrg basic_os=bsd 253541411ceSmrg ;; 254541411ceSmrg aros) 255541411ceSmrg basic_machine=i386-pc 256541411ceSmrg basic_os=aros 257541411ceSmrg ;; 258541411ceSmrg aux) 259541411ceSmrg basic_machine=m68k-apple 260541411ceSmrg basic_os=aux 261541411ceSmrg ;; 262541411ceSmrg balance) 263541411ceSmrg basic_machine=ns32k-sequent 264541411ceSmrg basic_os=dynix 265541411ceSmrg ;; 266541411ceSmrg blackfin) 267541411ceSmrg basic_machine=bfin-unknown 268541411ceSmrg basic_os=linux 269541411ceSmrg ;; 270541411ceSmrg cegcc) 271541411ceSmrg basic_machine=arm-unknown 272541411ceSmrg basic_os=cegcc 273541411ceSmrg ;; 274541411ceSmrg convex-c1) 275541411ceSmrg basic_machine=c1-convex 276541411ceSmrg basic_os=bsd 277541411ceSmrg ;; 278541411ceSmrg convex-c2) 279541411ceSmrg basic_machine=c2-convex 280541411ceSmrg basic_os=bsd 281541411ceSmrg ;; 282541411ceSmrg convex-c32) 283541411ceSmrg basic_machine=c32-convex 284541411ceSmrg basic_os=bsd 285541411ceSmrg ;; 286541411ceSmrg convex-c34) 287541411ceSmrg basic_machine=c34-convex 288541411ceSmrg basic_os=bsd 289541411ceSmrg ;; 290541411ceSmrg convex-c38) 291541411ceSmrg basic_machine=c38-convex 292541411ceSmrg basic_os=bsd 293541411ceSmrg ;; 294541411ceSmrg cray) 295541411ceSmrg basic_machine=j90-cray 296541411ceSmrg basic_os=unicos 297541411ceSmrg ;; 298541411ceSmrg crds | unos) 299541411ceSmrg basic_machine=m68k-crds 300541411ceSmrg basic_os= 301541411ceSmrg ;; 302541411ceSmrg da30) 303541411ceSmrg basic_machine=m68k-da30 304541411ceSmrg basic_os= 305541411ceSmrg ;; 306541411ceSmrg decstation | pmax | pmin | dec3100 | decstatn) 307541411ceSmrg basic_machine=mips-dec 308541411ceSmrg basic_os= 309541411ceSmrg ;; 310541411ceSmrg delta88) 311541411ceSmrg basic_machine=m88k-motorola 312541411ceSmrg basic_os=sysv3 313541411ceSmrg ;; 314541411ceSmrg dicos) 315541411ceSmrg basic_machine=i686-pc 316541411ceSmrg basic_os=dicos 317541411ceSmrg ;; 318541411ceSmrg djgpp) 319541411ceSmrg basic_machine=i586-pc 320541411ceSmrg basic_os=msdosdjgpp 321541411ceSmrg ;; 322541411ceSmrg ebmon29k) 323541411ceSmrg basic_machine=a29k-amd 324541411ceSmrg basic_os=ebmon 325541411ceSmrg ;; 326541411ceSmrg es1800 | OSE68k | ose68k | ose | OSE) 327541411ceSmrg basic_machine=m68k-ericsson 328541411ceSmrg basic_os=ose 329541411ceSmrg ;; 330541411ceSmrg gmicro) 331541411ceSmrg basic_machine=tron-gmicro 332541411ceSmrg basic_os=sysv 333541411ceSmrg ;; 334541411ceSmrg go32) 335541411ceSmrg basic_machine=i386-pc 336541411ceSmrg basic_os=go32 337541411ceSmrg ;; 338541411ceSmrg h8300hms) 339541411ceSmrg basic_machine=h8300-hitachi 340541411ceSmrg basic_os=hms 341541411ceSmrg ;; 342541411ceSmrg h8300xray) 343541411ceSmrg basic_machine=h8300-hitachi 344541411ceSmrg basic_os=xray 345541411ceSmrg ;; 346541411ceSmrg h8500hms) 347541411ceSmrg basic_machine=h8500-hitachi 348541411ceSmrg basic_os=hms 349541411ceSmrg ;; 350541411ceSmrg harris) 351541411ceSmrg basic_machine=m88k-harris 352541411ceSmrg basic_os=sysv3 353541411ceSmrg ;; 354541411ceSmrg hp300 | hp300hpux) 355541411ceSmrg basic_machine=m68k-hp 356541411ceSmrg basic_os=hpux 357541411ceSmrg ;; 358541411ceSmrg hp300bsd) 359541411ceSmrg basic_machine=m68k-hp 360541411ceSmrg basic_os=bsd 361541411ceSmrg ;; 362541411ceSmrg hppaosf) 363541411ceSmrg basic_machine=hppa1.1-hp 364541411ceSmrg basic_os=osf 365541411ceSmrg ;; 366541411ceSmrg hppro) 367541411ceSmrg basic_machine=hppa1.1-hp 368541411ceSmrg basic_os=proelf 369541411ceSmrg ;; 370541411ceSmrg i386mach) 371541411ceSmrg basic_machine=i386-mach 372541411ceSmrg basic_os=mach 373541411ceSmrg ;; 374541411ceSmrg isi68 | isi) 375541411ceSmrg basic_machine=m68k-isi 376541411ceSmrg basic_os=sysv 377541411ceSmrg ;; 378541411ceSmrg m68knommu) 379541411ceSmrg basic_machine=m68k-unknown 380541411ceSmrg basic_os=linux 381541411ceSmrg ;; 382541411ceSmrg magnum | m3230) 383541411ceSmrg basic_machine=mips-mips 384541411ceSmrg basic_os=sysv 385541411ceSmrg ;; 386541411ceSmrg merlin) 387541411ceSmrg basic_machine=ns32k-utek 388541411ceSmrg basic_os=sysv 389541411ceSmrg ;; 390541411ceSmrg mingw64) 391541411ceSmrg basic_machine=x86_64-pc 392541411ceSmrg basic_os=mingw64 393541411ceSmrg ;; 394541411ceSmrg mingw32) 395541411ceSmrg basic_machine=i686-pc 396541411ceSmrg basic_os=mingw32 397541411ceSmrg ;; 398541411ceSmrg mingw32ce) 399541411ceSmrg basic_machine=arm-unknown 400541411ceSmrg basic_os=mingw32ce 401541411ceSmrg ;; 402541411ceSmrg monitor) 403541411ceSmrg basic_machine=m68k-rom68k 404541411ceSmrg basic_os=coff 405541411ceSmrg ;; 406541411ceSmrg morphos) 407541411ceSmrg basic_machine=powerpc-unknown 408541411ceSmrg basic_os=morphos 409541411ceSmrg ;; 410541411ceSmrg moxiebox) 411541411ceSmrg basic_machine=moxie-unknown 412541411ceSmrg basic_os=moxiebox 413541411ceSmrg ;; 414541411ceSmrg msdos) 415541411ceSmrg basic_machine=i386-pc 416541411ceSmrg basic_os=msdos 417541411ceSmrg ;; 418541411ceSmrg msys) 419541411ceSmrg basic_machine=i686-pc 420541411ceSmrg basic_os=msys 421541411ceSmrg ;; 422541411ceSmrg mvs) 423541411ceSmrg basic_machine=i370-ibm 424541411ceSmrg basic_os=mvs 425541411ceSmrg ;; 426541411ceSmrg nacl) 427541411ceSmrg basic_machine=le32-unknown 428541411ceSmrg basic_os=nacl 429541411ceSmrg ;; 430541411ceSmrg ncr3000) 431541411ceSmrg basic_machine=i486-ncr 432541411ceSmrg basic_os=sysv4 433541411ceSmrg ;; 434541411ceSmrg netbsd386) 435541411ceSmrg basic_machine=i386-pc 436541411ceSmrg basic_os=netbsd 437541411ceSmrg ;; 438541411ceSmrg netwinder) 439541411ceSmrg basic_machine=armv4l-rebel 440541411ceSmrg basic_os=linux 441541411ceSmrg ;; 442541411ceSmrg news | news700 | news800 | news900) 443541411ceSmrg basic_machine=m68k-sony 444541411ceSmrg basic_os=newsos 445541411ceSmrg ;; 446541411ceSmrg news1000) 447541411ceSmrg basic_machine=m68030-sony 448541411ceSmrg basic_os=newsos 449541411ceSmrg ;; 450541411ceSmrg necv70) 451541411ceSmrg basic_machine=v70-nec 452541411ceSmrg basic_os=sysv 453541411ceSmrg ;; 454541411ceSmrg nh3000) 455541411ceSmrg basic_machine=m68k-harris 456541411ceSmrg basic_os=cxux 457541411ceSmrg ;; 458541411ceSmrg nh[45]000) 459541411ceSmrg basic_machine=m88k-harris 460541411ceSmrg basic_os=cxux 461541411ceSmrg ;; 462541411ceSmrg nindy960) 463541411ceSmrg basic_machine=i960-intel 464541411ceSmrg basic_os=nindy 465541411ceSmrg ;; 466541411ceSmrg mon960) 467541411ceSmrg basic_machine=i960-intel 468541411ceSmrg basic_os=mon960 469541411ceSmrg ;; 470541411ceSmrg nonstopux) 471541411ceSmrg basic_machine=mips-compaq 472541411ceSmrg basic_os=nonstopux 473541411ceSmrg ;; 474541411ceSmrg os400) 475541411ceSmrg basic_machine=powerpc-ibm 476541411ceSmrg basic_os=os400 477541411ceSmrg ;; 478541411ceSmrg OSE68000 | ose68000) 479541411ceSmrg basic_machine=m68000-ericsson 480541411ceSmrg basic_os=ose 481541411ceSmrg ;; 482541411ceSmrg os68k) 483541411ceSmrg basic_machine=m68k-none 484541411ceSmrg basic_os=os68k 485541411ceSmrg ;; 486541411ceSmrg paragon) 487541411ceSmrg basic_machine=i860-intel 488541411ceSmrg basic_os=osf 489541411ceSmrg ;; 490541411ceSmrg parisc) 491541411ceSmrg basic_machine=hppa-unknown 492541411ceSmrg basic_os=linux 493541411ceSmrg ;; 494541411ceSmrg psp) 495541411ceSmrg basic_machine=mipsallegrexel-sony 496541411ceSmrg basic_os=psp 497541411ceSmrg ;; 498541411ceSmrg pw32) 499541411ceSmrg basic_machine=i586-unknown 500541411ceSmrg basic_os=pw32 501541411ceSmrg ;; 502541411ceSmrg rdos | rdos64) 503541411ceSmrg basic_machine=x86_64-pc 504541411ceSmrg basic_os=rdos 505541411ceSmrg ;; 506541411ceSmrg rdos32) 507541411ceSmrg basic_machine=i386-pc 508541411ceSmrg basic_os=rdos 509541411ceSmrg ;; 510541411ceSmrg rom68k) 511541411ceSmrg basic_machine=m68k-rom68k 512541411ceSmrg basic_os=coff 513541411ceSmrg ;; 514541411ceSmrg sa29200) 515541411ceSmrg basic_machine=a29k-amd 516541411ceSmrg basic_os=udi 517541411ceSmrg ;; 518541411ceSmrg sei) 519541411ceSmrg basic_machine=mips-sei 520541411ceSmrg basic_os=seiux 521541411ceSmrg ;; 522541411ceSmrg sequent) 523541411ceSmrg basic_machine=i386-sequent 524541411ceSmrg basic_os= 525541411ceSmrg ;; 526541411ceSmrg sps7) 527541411ceSmrg basic_machine=m68k-bull 528541411ceSmrg basic_os=sysv2 529541411ceSmrg ;; 530541411ceSmrg st2000) 531541411ceSmrg basic_machine=m68k-tandem 532541411ceSmrg basic_os= 533541411ceSmrg ;; 534541411ceSmrg stratus) 535541411ceSmrg basic_machine=i860-stratus 536541411ceSmrg basic_os=sysv4 537541411ceSmrg ;; 538541411ceSmrg sun2) 539541411ceSmrg basic_machine=m68000-sun 540541411ceSmrg basic_os= 541541411ceSmrg ;; 542541411ceSmrg sun2os3) 543541411ceSmrg basic_machine=m68000-sun 544541411ceSmrg basic_os=sunos3 545541411ceSmrg ;; 546541411ceSmrg sun2os4) 547541411ceSmrg basic_machine=m68000-sun 548541411ceSmrg basic_os=sunos4 549541411ceSmrg ;; 550541411ceSmrg sun3) 551541411ceSmrg basic_machine=m68k-sun 552541411ceSmrg basic_os= 553541411ceSmrg ;; 554541411ceSmrg sun3os3) 555541411ceSmrg basic_machine=m68k-sun 556541411ceSmrg basic_os=sunos3 557541411ceSmrg ;; 558541411ceSmrg sun3os4) 559541411ceSmrg basic_machine=m68k-sun 560541411ceSmrg basic_os=sunos4 561541411ceSmrg ;; 562541411ceSmrg sun4) 563541411ceSmrg basic_machine=sparc-sun 564541411ceSmrg basic_os= 565541411ceSmrg ;; 566541411ceSmrg sun4os3) 567541411ceSmrg basic_machine=sparc-sun 568541411ceSmrg basic_os=sunos3 569541411ceSmrg ;; 570541411ceSmrg sun4os4) 571541411ceSmrg basic_machine=sparc-sun 572541411ceSmrg basic_os=sunos4 573541411ceSmrg ;; 574541411ceSmrg sun4sol2) 575541411ceSmrg basic_machine=sparc-sun 576541411ceSmrg basic_os=solaris2 577541411ceSmrg ;; 578541411ceSmrg sun386 | sun386i | roadrunner) 579541411ceSmrg basic_machine=i386-sun 580541411ceSmrg basic_os= 581541411ceSmrg ;; 582541411ceSmrg sv1) 583541411ceSmrg basic_machine=sv1-cray 584541411ceSmrg basic_os=unicos 585541411ceSmrg ;; 586541411ceSmrg symmetry) 587541411ceSmrg basic_machine=i386-sequent 588541411ceSmrg basic_os=dynix 589541411ceSmrg ;; 590541411ceSmrg t3e) 591541411ceSmrg basic_machine=alphaev5-cray 592541411ceSmrg basic_os=unicos 593541411ceSmrg ;; 594541411ceSmrg t90) 595541411ceSmrg basic_machine=t90-cray 596541411ceSmrg basic_os=unicos 597541411ceSmrg ;; 598541411ceSmrg toad1) 599541411ceSmrg basic_machine=pdp10-xkl 600541411ceSmrg basic_os=tops20 601541411ceSmrg ;; 602541411ceSmrg tpf) 603541411ceSmrg basic_machine=s390x-ibm 604541411ceSmrg basic_os=tpf 605541411ceSmrg ;; 606541411ceSmrg udi29k) 607541411ceSmrg basic_machine=a29k-amd 608541411ceSmrg basic_os=udi 609541411ceSmrg ;; 610541411ceSmrg ultra3) 611541411ceSmrg basic_machine=a29k-nyu 612541411ceSmrg basic_os=sym1 613541411ceSmrg ;; 614541411ceSmrg v810 | necv810) 615541411ceSmrg basic_machine=v810-nec 616541411ceSmrg basic_os=none 617541411ceSmrg ;; 618541411ceSmrg vaxv) 619541411ceSmrg basic_machine=vax-dec 620541411ceSmrg basic_os=sysv 621541411ceSmrg ;; 622541411ceSmrg vms) 623541411ceSmrg basic_machine=vax-dec 624541411ceSmrg basic_os=vms 625541411ceSmrg ;; 626541411ceSmrg vsta) 627541411ceSmrg basic_machine=i386-pc 628541411ceSmrg basic_os=vsta 629541411ceSmrg ;; 630541411ceSmrg vxworks960) 631541411ceSmrg basic_machine=i960-wrs 632541411ceSmrg basic_os=vxworks 633541411ceSmrg ;; 634541411ceSmrg vxworks68) 635541411ceSmrg basic_machine=m68k-wrs 636541411ceSmrg basic_os=vxworks 637541411ceSmrg ;; 638541411ceSmrg vxworks29k) 639541411ceSmrg basic_machine=a29k-wrs 640541411ceSmrg basic_os=vxworks 641541411ceSmrg ;; 642541411ceSmrg xbox) 643541411ceSmrg basic_machine=i686-pc 644541411ceSmrg basic_os=mingw32 645541411ceSmrg ;; 646541411ceSmrg ymp) 647541411ceSmrg basic_machine=ymp-cray 648541411ceSmrg basic_os=unicos 649541411ceSmrg ;; 650541411ceSmrg *) 651541411ceSmrg basic_machine=$1 652541411ceSmrg basic_os= 653541411ceSmrg ;; 654541411ceSmrg esac 65535d5702bSmrg ;; 656541411ceSmrgesac 657541411ceSmrg 658541411ceSmrg# Decode 1-component or ad-hoc basic machines 659541411ceSmrgcase $basic_machine in 660541411ceSmrg # Here we handle the default manufacturer of certain CPU types. It is in 661541411ceSmrg # some cases the only manufacturer, in others, it is the most popular. 662541411ceSmrg w89k) 663541411ceSmrg cpu=hppa1.1 664541411ceSmrg vendor=winbond 66535d5702bSmrg ;; 666541411ceSmrg op50n) 667541411ceSmrg cpu=hppa1.1 668541411ceSmrg vendor=oki 66935d5702bSmrg ;; 670541411ceSmrg op60c) 671541411ceSmrg cpu=hppa1.1 672541411ceSmrg vendor=oki 67335d5702bSmrg ;; 674541411ceSmrg ibm*) 675541411ceSmrg cpu=i370 676541411ceSmrg vendor=ibm 67735d5702bSmrg ;; 678541411ceSmrg orion105) 679541411ceSmrg cpu=clipper 680541411ceSmrg vendor=highlevel 68135d5702bSmrg ;; 682541411ceSmrg mac | mpw | mac-mpw) 683541411ceSmrg cpu=m68k 684541411ceSmrg vendor=apple 68535d5702bSmrg ;; 686541411ceSmrg pmac | pmac-mpw) 687541411ceSmrg cpu=powerpc 688541411ceSmrg vendor=apple 68935d5702bSmrg ;; 69035d5702bSmrg 69135d5702bSmrg # Recognize the various machine names and aliases which stand 69235d5702bSmrg # for a CPU type and a company and sometimes even an OS. 69335d5702bSmrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 694541411ceSmrg cpu=m68000 695541411ceSmrg vendor=att 69635d5702bSmrg ;; 69735d5702bSmrg 3b*) 698541411ceSmrg cpu=we32k 699541411ceSmrg vendor=att 70035d5702bSmrg ;; 701eeced2e6Smrg bluegene*) 702541411ceSmrg cpu=powerpc 703541411ceSmrg vendor=ibm 704541411ceSmrg basic_os=cnk 70535d5702bSmrg ;; 70635d5702bSmrg decsystem10* | dec10*) 707541411ceSmrg cpu=pdp10 708541411ceSmrg vendor=dec 709541411ceSmrg basic_os=tops10 71035d5702bSmrg ;; 71135d5702bSmrg decsystem20* | dec20*) 712541411ceSmrg cpu=pdp10 713541411ceSmrg vendor=dec 714541411ceSmrg basic_os=tops20 71535d5702bSmrg ;; 71635d5702bSmrg delta | 3300 | motorola-3300 | motorola-delta \ 71735d5702bSmrg | 3300-motorola | delta-motorola) 718541411ceSmrg cpu=m68k 719541411ceSmrg vendor=motorola 72035d5702bSmrg ;; 721541411ceSmrg dpx2*) 722541411ceSmrg cpu=m68k 723541411ceSmrg vendor=bull 724541411ceSmrg basic_os=sysv3 72535d5702bSmrg ;; 72635d5702bSmrg encore | umax | mmax) 727541411ceSmrg cpu=ns32k 728541411ceSmrg vendor=encore 72935d5702bSmrg ;; 730541411ceSmrg elxsi) 731541411ceSmrg cpu=elxsi 732541411ceSmrg vendor=elxsi 733541411ceSmrg basic_os=${basic_os:-bsd} 73435d5702bSmrg ;; 73535d5702bSmrg fx2800) 736541411ceSmrg cpu=i860 737541411ceSmrg vendor=alliant 73835d5702bSmrg ;; 73935d5702bSmrg genix) 740541411ceSmrg cpu=ns32k 741541411ceSmrg vendor=ns 74235d5702bSmrg ;; 74335d5702bSmrg h3050r* | hiux*) 744541411ceSmrg cpu=hppa1.1 745541411ceSmrg vendor=hitachi 746541411ceSmrg basic_os=hiuxwe2 74735d5702bSmrg ;; 74835d5702bSmrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 749541411ceSmrg cpu=hppa1.0 750541411ceSmrg vendor=hp 75135d5702bSmrg ;; 75235d5702bSmrg hp9k2[0-9][0-9] | hp9k31[0-9]) 753541411ceSmrg cpu=m68000 754541411ceSmrg vendor=hp 75535d5702bSmrg ;; 75635d5702bSmrg hp9k3[2-9][0-9]) 757541411ceSmrg cpu=m68k 758541411ceSmrg vendor=hp 75935d5702bSmrg ;; 76035d5702bSmrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 761541411ceSmrg cpu=hppa1.0 762541411ceSmrg vendor=hp 76335d5702bSmrg ;; 76435d5702bSmrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 765541411ceSmrg cpu=hppa1.1 766541411ceSmrg vendor=hp 76735d5702bSmrg ;; 76835d5702bSmrg hp9k78[0-9] | hp78[0-9]) 76935d5702bSmrg # FIXME: really hppa2.0-hp 770541411ceSmrg cpu=hppa1.1 771541411ceSmrg vendor=hp 77235d5702bSmrg ;; 77335d5702bSmrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 77435d5702bSmrg # FIXME: really hppa2.0-hp 775541411ceSmrg cpu=hppa1.1 776541411ceSmrg vendor=hp 77735d5702bSmrg ;; 77835d5702bSmrg hp9k8[0-9][13679] | hp8[0-9][13679]) 779541411ceSmrg cpu=hppa1.1 780541411ceSmrg vendor=hp 78135d5702bSmrg ;; 78235d5702bSmrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 783541411ceSmrg cpu=hppa1.0 784541411ceSmrg vendor=hp 78535d5702bSmrg ;; 78635d5702bSmrg i*86v32) 787541411ceSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 788541411ceSmrg vendor=pc 789541411ceSmrg basic_os=sysv32 79035d5702bSmrg ;; 79135d5702bSmrg i*86v4*) 792541411ceSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 793541411ceSmrg vendor=pc 794541411ceSmrg basic_os=sysv4 79535d5702bSmrg ;; 79635d5702bSmrg i*86v) 797541411ceSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 798541411ceSmrg vendor=pc 799541411ceSmrg basic_os=sysv 80035d5702bSmrg ;; 80135d5702bSmrg i*86sol2) 802541411ceSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 803541411ceSmrg vendor=pc 804541411ceSmrg basic_os=solaris2 80535d5702bSmrg ;; 806541411ceSmrg j90 | j90-cray) 807541411ceSmrg cpu=j90 808541411ceSmrg vendor=cray 809541411ceSmrg basic_os=${basic_os:-unicos} 81035d5702bSmrg ;; 81135d5702bSmrg iris | iris4d) 812541411ceSmrg cpu=mips 813541411ceSmrg vendor=sgi 814541411ceSmrg case $basic_os in 815541411ceSmrg irix*) 81635d5702bSmrg ;; 81735d5702bSmrg *) 818541411ceSmrg basic_os=irix4 81935d5702bSmrg ;; 82035d5702bSmrg esac 82135d5702bSmrg ;; 82235d5702bSmrg miniframe) 823541411ceSmrg cpu=m68000 824541411ceSmrg vendor=convergent 82535d5702bSmrg ;; 826541411ceSmrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 827541411ceSmrg cpu=m68k 828541411ceSmrg vendor=atari 829541411ceSmrg basic_os=mint 83035d5702bSmrg ;; 83135d5702bSmrg news-3600 | risc-news) 832541411ceSmrg cpu=mips 833541411ceSmrg vendor=sony 834541411ceSmrg basic_os=newsos 835541411ceSmrg ;; 836541411ceSmrg next | m*-next) 837541411ceSmrg cpu=m68k 838541411ceSmrg vendor=next 839541411ceSmrg case $basic_os in 840541411ceSmrg openstep*) 841541411ceSmrg ;; 842541411ceSmrg nextstep*) 84335d5702bSmrg ;; 844541411ceSmrg ns2*) 845541411ceSmrg basic_os=nextstep2 84635d5702bSmrg ;; 84735d5702bSmrg *) 848541411ceSmrg basic_os=nextstep3 84935d5702bSmrg ;; 85035d5702bSmrg esac 85135d5702bSmrg ;; 85235d5702bSmrg np1) 853541411ceSmrg cpu=np1 854541411ceSmrg vendor=gould 85535d5702bSmrg ;; 85635d5702bSmrg op50n-* | op60c-*) 857541411ceSmrg cpu=hppa1.1 858541411ceSmrg vendor=oki 859541411ceSmrg basic_os=proelf 86035d5702bSmrg ;; 86135d5702bSmrg pa-hitachi) 862541411ceSmrg cpu=hppa1.1 863541411ceSmrg vendor=hitachi 864541411ceSmrg basic_os=hiuxwe2 86535d5702bSmrg ;; 86635d5702bSmrg pbd) 867541411ceSmrg cpu=sparc 868541411ceSmrg vendor=tti 86935d5702bSmrg ;; 87035d5702bSmrg pbb) 871541411ceSmrg cpu=m68k 872541411ceSmrg vendor=tti 87335d5702bSmrg ;; 874541411ceSmrg pc532) 875541411ceSmrg cpu=ns32k 876541411ceSmrg vendor=pc532 87735d5702bSmrg ;; 87835d5702bSmrg pn) 879541411ceSmrg cpu=pn 880541411ceSmrg vendor=gould 88135d5702bSmrg ;; 882541411ceSmrg power) 883541411ceSmrg cpu=power 884541411ceSmrg vendor=ibm 88535d5702bSmrg ;; 88635d5702bSmrg ps2) 887541411ceSmrg cpu=i386 888541411ceSmrg vendor=ibm 88935d5702bSmrg ;; 89035d5702bSmrg rm[46]00) 891541411ceSmrg cpu=mips 892541411ceSmrg vendor=siemens 89335d5702bSmrg ;; 89435d5702bSmrg rtpc | rtpc-*) 895541411ceSmrg cpu=romp 896541411ceSmrg vendor=ibm 89735d5702bSmrg ;; 898541411ceSmrg sde) 899541411ceSmrg cpu=mipsisa32 900541411ceSmrg vendor=sde 901541411ceSmrg basic_os=${basic_os:-elf} 90235d5702bSmrg ;; 903541411ceSmrg simso-wrs) 904541411ceSmrg cpu=sparclite 905541411ceSmrg vendor=wrs 906541411ceSmrg basic_os=vxworks 90735d5702bSmrg ;; 908541411ceSmrg tower | tower-32) 909541411ceSmrg cpu=m68k 910541411ceSmrg vendor=ncr 91135d5702bSmrg ;; 912541411ceSmrg vpp*|vx|vx-*) 913541411ceSmrg cpu=f301 914541411ceSmrg vendor=fujitsu 91535d5702bSmrg ;; 916541411ceSmrg w65) 917541411ceSmrg cpu=w65 918541411ceSmrg vendor=wdc 91935d5702bSmrg ;; 920541411ceSmrg w89k-*) 921541411ceSmrg cpu=hppa1.1 922541411ceSmrg vendor=winbond 923541411ceSmrg basic_os=proelf 92435d5702bSmrg ;; 925541411ceSmrg none) 926541411ceSmrg cpu=none 927541411ceSmrg vendor=none 92835d5702bSmrg ;; 929541411ceSmrg leon|leon[3-9]) 930541411ceSmrg cpu=sparc 931541411ceSmrg vendor=$basic_machine 93235d5702bSmrg ;; 933541411ceSmrg leon-*|leon[3-9]-*) 934541411ceSmrg cpu=sparc 935541411ceSmrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 93635d5702bSmrg ;; 937541411ceSmrg 938541411ceSmrg *-*) 939541411ceSmrg # shellcheck disable=SC2162 940541411ceSmrg saved_IFS=$IFS 941541411ceSmrg IFS="-" read cpu vendor <<EOF 942541411ceSmrg$basic_machine 943541411ceSmrgEOF 944541411ceSmrg IFS=$saved_IFS 94535d5702bSmrg ;; 946541411ceSmrg # We use `pc' rather than `unknown' 947541411ceSmrg # because (1) that's what they normally are, and 948541411ceSmrg # (2) the word "unknown" tends to confuse beginning users. 949541411ceSmrg i*86 | x86_64) 950541411ceSmrg cpu=$basic_machine 951541411ceSmrg vendor=pc 95235d5702bSmrg ;; 953541411ceSmrg # These rules are duplicated from below for sake of the special case above; 954541411ceSmrg # i.e. things that normalized to x86 arches should also default to "pc" 955541411ceSmrg pc98) 956541411ceSmrg cpu=i386 957541411ceSmrg vendor=pc 95835d5702bSmrg ;; 959541411ceSmrg x64 | amd64) 960541411ceSmrg cpu=x86_64 961541411ceSmrg vendor=pc 96235d5702bSmrg ;; 963541411ceSmrg # Recognize the basic CPU types without company name. 964541411ceSmrg *) 965541411ceSmrg cpu=$basic_machine 966541411ceSmrg vendor=unknown 96735d5702bSmrg ;; 968541411ceSmrgesac 969541411ceSmrg 970541411ceSmrgunset -v basic_machine 971541411ceSmrg 972541411ceSmrg# Decode basic machines in the full and proper CPU-Company form. 973541411ceSmrgcase $cpu-$vendor in 974541411ceSmrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 975541411ceSmrg # some cases the only manufacturer, in others, it is the most popular. 976541411ceSmrg craynv-unknown) 977541411ceSmrg vendor=cray 978541411ceSmrg basic_os=${basic_os:-unicosmp} 97935d5702bSmrg ;; 980541411ceSmrg c90-unknown | c90-cray) 981541411ceSmrg vendor=cray 982541411ceSmrg basic_os=${Basic_os:-unicos} 98335d5702bSmrg ;; 984541411ceSmrg fx80-unknown) 985541411ceSmrg vendor=alliant 98635d5702bSmrg ;; 987541411ceSmrg romp-unknown) 988541411ceSmrg vendor=ibm 98935d5702bSmrg ;; 990541411ceSmrg mmix-unknown) 991541411ceSmrg vendor=knuth 99235d5702bSmrg ;; 993541411ceSmrg microblaze-unknown | microblazeel-unknown) 994541411ceSmrg vendor=xilinx 99535d5702bSmrg ;; 996541411ceSmrg rs6000-unknown) 997541411ceSmrg vendor=ibm 99835d5702bSmrg ;; 999541411ceSmrg vax-unknown) 1000541411ceSmrg vendor=dec 100135d5702bSmrg ;; 1002541411ceSmrg pdp11-unknown) 1003541411ceSmrg vendor=dec 100435d5702bSmrg ;; 1005541411ceSmrg we32k-unknown) 1006541411ceSmrg vendor=att 100735d5702bSmrg ;; 1008541411ceSmrg cydra-unknown) 1009541411ceSmrg vendor=cydrome 101035d5702bSmrg ;; 1011541411ceSmrg i370-ibm*) 1012541411ceSmrg vendor=ibm 101335d5702bSmrg ;; 1014541411ceSmrg orion-unknown) 1015541411ceSmrg vendor=highlevel 101635d5702bSmrg ;; 1017541411ceSmrg xps-unknown | xps100-unknown) 1018541411ceSmrg cpu=xps100 1019541411ceSmrg vendor=honeywell 102035d5702bSmrg ;; 1021541411ceSmrg 1022541411ceSmrg # Here we normalize CPU types with a missing or matching vendor 1023541411ceSmrg armh-unknown | armh-alt) 1024541411ceSmrg cpu=armv7l 1025541411ceSmrg vendor=alt 1026541411ceSmrg basic_os=${basic_os:-linux-gnueabihf} 102735d5702bSmrg ;; 1028541411ceSmrg dpx20-unknown | dpx20-bull) 1029541411ceSmrg cpu=rs6000 1030541411ceSmrg vendor=bull 1031541411ceSmrg basic_os=${basic_os:-bosx} 103235d5702bSmrg ;; 1033541411ceSmrg 1034541411ceSmrg # Here we normalize CPU types irrespective of the vendor 1035541411ceSmrg amd64-*) 1036541411ceSmrg cpu=x86_64 103735d5702bSmrg ;; 1038541411ceSmrg blackfin-*) 1039541411ceSmrg cpu=bfin 1040541411ceSmrg basic_os=linux 104135d5702bSmrg ;; 1042541411ceSmrg c54x-*) 1043541411ceSmrg cpu=tic54x 104435d5702bSmrg ;; 1045541411ceSmrg c55x-*) 1046541411ceSmrg cpu=tic55x 104735d5702bSmrg ;; 1048541411ceSmrg c6x-*) 1049541411ceSmrg cpu=tic6x 105035d5702bSmrg ;; 1051541411ceSmrg e500v[12]-*) 1052541411ceSmrg cpu=powerpc 1053541411ceSmrg basic_os=${basic_os}"spe" 105435d5702bSmrg ;; 1055541411ceSmrg mips3*-*) 1056541411ceSmrg cpu=mips64 105735d5702bSmrg ;; 1058541411ceSmrg ms1-*) 1059541411ceSmrg cpu=mt 106035d5702bSmrg ;; 1061541411ceSmrg m68knommu-*) 1062541411ceSmrg cpu=m68k 1063541411ceSmrg basic_os=linux 106435d5702bSmrg ;; 1065541411ceSmrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 1066541411ceSmrg cpu=s12z 106735d5702bSmrg ;; 1068541411ceSmrg openrisc-*) 1069541411ceSmrg cpu=or32 107035d5702bSmrg ;; 1071541411ceSmrg parisc-*) 1072541411ceSmrg cpu=hppa 1073541411ceSmrg basic_os=linux 107435d5702bSmrg ;; 1075541411ceSmrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1076541411ceSmrg cpu=i586 107735d5702bSmrg ;; 1078541411ceSmrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 1079541411ceSmrg cpu=i686 108035d5702bSmrg ;; 1081541411ceSmrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1082541411ceSmrg cpu=i686 108335d5702bSmrg ;; 1084541411ceSmrg pentium4-*) 1085541411ceSmrg cpu=i786 108635d5702bSmrg ;; 1087541411ceSmrg pc98-*) 1088541411ceSmrg cpu=i386 108935d5702bSmrg ;; 1090541411ceSmrg ppc-* | ppcbe-*) 1091541411ceSmrg cpu=powerpc 109235d5702bSmrg ;; 1093541411ceSmrg ppcle-* | powerpclittle-*) 1094541411ceSmrg cpu=powerpcle 109535d5702bSmrg ;; 1096541411ceSmrg ppc64-*) 1097541411ceSmrg cpu=powerpc64 109835d5702bSmrg ;; 1099541411ceSmrg ppc64le-* | powerpc64little-*) 1100541411ceSmrg cpu=powerpc64le 110135d5702bSmrg ;; 1102541411ceSmrg sb1-*) 1103541411ceSmrg cpu=mipsisa64sb1 110435d5702bSmrg ;; 1105541411ceSmrg sb1el-*) 1106541411ceSmrg cpu=mipsisa64sb1el 110735d5702bSmrg ;; 1108541411ceSmrg sh5e[lb]-*) 1109541411ceSmrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 111035d5702bSmrg ;; 1111541411ceSmrg spur-*) 1112541411ceSmrg cpu=spur 111335d5702bSmrg ;; 1114541411ceSmrg strongarm-* | thumb-*) 1115541411ceSmrg cpu=arm 111635d5702bSmrg ;; 1117541411ceSmrg tx39-*) 1118541411ceSmrg cpu=mipstx39 111935d5702bSmrg ;; 1120541411ceSmrg tx39el-*) 1121541411ceSmrg cpu=mipstx39el 112235d5702bSmrg ;; 1123541411ceSmrg x64-*) 1124541411ceSmrg cpu=x86_64 112535d5702bSmrg ;; 1126541411ceSmrg xscale-* | xscalee[bl]-*) 1127541411ceSmrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 112835d5702bSmrg ;; 1129541411ceSmrg arm64-* | aarch64le-*) 1130541411ceSmrg cpu=aarch64 113135d5702bSmrg ;; 1132541411ceSmrg 1133541411ceSmrg # Recognize the canonical CPU Types that limit and/or modify the 1134541411ceSmrg # company names they are paired with. 1135541411ceSmrg cr16-*) 1136541411ceSmrg basic_os=${basic_os:-elf} 113735d5702bSmrg ;; 1138541411ceSmrg crisv32-* | etraxfs*-*) 1139541411ceSmrg cpu=crisv32 1140541411ceSmrg vendor=axis 114135d5702bSmrg ;; 1142541411ceSmrg cris-* | etrax*-*) 1143541411ceSmrg cpu=cris 1144541411ceSmrg vendor=axis 114535d5702bSmrg ;; 1146541411ceSmrg crx-*) 1147541411ceSmrg basic_os=${basic_os:-elf} 114835d5702bSmrg ;; 1149541411ceSmrg neo-tandem) 1150541411ceSmrg cpu=neo 1151541411ceSmrg vendor=tandem 115235d5702bSmrg ;; 1153541411ceSmrg nse-tandem) 1154541411ceSmrg cpu=nse 1155541411ceSmrg vendor=tandem 115635d5702bSmrg ;; 1157541411ceSmrg nsr-tandem) 1158541411ceSmrg cpu=nsr 1159541411ceSmrg vendor=tandem 116035d5702bSmrg ;; 1161541411ceSmrg nsv-tandem) 1162541411ceSmrg cpu=nsv 1163541411ceSmrg vendor=tandem 116435d5702bSmrg ;; 1165541411ceSmrg nsx-tandem) 1166541411ceSmrg cpu=nsx 1167541411ceSmrg vendor=tandem 116835d5702bSmrg ;; 1169541411ceSmrg mipsallegrexel-sony) 1170541411ceSmrg cpu=mipsallegrexel 1171541411ceSmrg vendor=sony 117235d5702bSmrg ;; 1173541411ceSmrg tile*-*) 1174541411ceSmrg basic_os=${basic_os:-linux-gnu} 117535d5702bSmrg ;; 1176541411ceSmrg 117735d5702bSmrg *) 1178541411ceSmrg # Recognize the canonical CPU types that are allowed with any 1179541411ceSmrg # company name. 1180541411ceSmrg case $cpu in 1181541411ceSmrg 1750a | 580 \ 1182541411ceSmrg | a29k \ 1183541411ceSmrg | aarch64 | aarch64_be \ 1184541411ceSmrg | abacus \ 1185541411ceSmrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 1186541411ceSmrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 1187541411ceSmrg | alphapca5[67] | alpha64pca5[67] \ 1188541411ceSmrg | am33_2.0 \ 1189541411ceSmrg | amdgcn \ 1190541411ceSmrg | arc | arceb | arc32 | arc64 \ 1191541411ceSmrg | arm | arm[lb]e | arme[lb] | armv* \ 1192541411ceSmrg | avr | avr32 \ 1193541411ceSmrg | asmjs \ 1194541411ceSmrg | ba \ 1195541411ceSmrg | be32 | be64 \ 1196541411ceSmrg | bfin | bpf | bs2000 \ 1197541411ceSmrg | c[123]* | c30 | [cjt]90 | c4x \ 1198541411ceSmrg | c8051 | clipper | craynv | csky | cydra \ 1199541411ceSmrg | d10v | d30v | dlx | dsp16xx \ 1200541411ceSmrg | e2k | elxsi | epiphany \ 1201541411ceSmrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1202541411ceSmrg | h8300 | h8500 \ 1203541411ceSmrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 1204541411ceSmrg | hexagon \ 1205541411ceSmrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 1206541411ceSmrg | ip2k | iq2000 \ 1207541411ceSmrg | k1om \ 1208541411ceSmrg | le32 | le64 \ 1209541411ceSmrg | lm32 \ 1210541411ceSmrg | loongarch32 | loongarch64 \ 1211541411ceSmrg | m32c | m32r | m32rle \ 1212541411ceSmrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 1213541411ceSmrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 1214541411ceSmrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 1215541411ceSmrg | microblaze | microblazeel \ 1216541411ceSmrg | mips | mipsbe | mipseb | mipsel | mipsle \ 1217541411ceSmrg | mips16 \ 1218541411ceSmrg | mips64 | mips64eb | mips64el \ 1219541411ceSmrg | mips64octeon | mips64octeonel \ 1220541411ceSmrg | mips64orion | mips64orionel \ 1221541411ceSmrg | mips64r5900 | mips64r5900el \ 1222541411ceSmrg | mips64vr | mips64vrel \ 1223541411ceSmrg | mips64vr4100 | mips64vr4100el \ 1224541411ceSmrg | mips64vr4300 | mips64vr4300el \ 1225541411ceSmrg | mips64vr5000 | mips64vr5000el \ 1226541411ceSmrg | mips64vr5900 | mips64vr5900el \ 1227541411ceSmrg | mipsisa32 | mipsisa32el \ 1228541411ceSmrg | mipsisa32r2 | mipsisa32r2el \ 1229541411ceSmrg | mipsisa32r3 | mipsisa32r3el \ 1230541411ceSmrg | mipsisa32r5 | mipsisa32r5el \ 1231541411ceSmrg | mipsisa32r6 | mipsisa32r6el \ 1232541411ceSmrg | mipsisa64 | mipsisa64el \ 1233541411ceSmrg | mipsisa64r2 | mipsisa64r2el \ 1234541411ceSmrg | mipsisa64r3 | mipsisa64r3el \ 1235541411ceSmrg | mipsisa64r5 | mipsisa64r5el \ 1236541411ceSmrg | mipsisa64r6 | mipsisa64r6el \ 1237541411ceSmrg | mipsisa64sb1 | mipsisa64sb1el \ 1238541411ceSmrg | mipsisa64sr71k | mipsisa64sr71kel \ 1239541411ceSmrg | mipsr5900 | mipsr5900el \ 1240541411ceSmrg | mipstx39 | mipstx39el \ 1241541411ceSmrg | mmix \ 1242541411ceSmrg | mn10200 | mn10300 \ 1243541411ceSmrg | moxie \ 1244541411ceSmrg | mt \ 1245541411ceSmrg | msp430 \ 1246541411ceSmrg | nds32 | nds32le | nds32be \ 1247541411ceSmrg | nfp \ 1248541411ceSmrg | nios | nios2 | nios2eb | nios2el \ 1249541411ceSmrg | none | np1 | ns16k | ns32k | nvptx \ 1250541411ceSmrg | open8 \ 1251541411ceSmrg | or1k* \ 1252541411ceSmrg | or32 \ 1253541411ceSmrg | orion \ 1254541411ceSmrg | picochip \ 1255541411ceSmrg | pdp10 | pdp11 | pj | pjl | pn | power \ 1256541411ceSmrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 1257541411ceSmrg | pru \ 1258541411ceSmrg | pyramid \ 1259541411ceSmrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 1260541411ceSmrg | rl78 | romp | rs6000 | rx \ 1261541411ceSmrg | s390 | s390x \ 1262541411ceSmrg | score \ 1263541411ceSmrg | sh | shl \ 1264541411ceSmrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 1265541411ceSmrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 1266541411ceSmrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 1267541411ceSmrg | sparclite \ 1268541411ceSmrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 1269541411ceSmrg | spu \ 1270541411ceSmrg | tahoe \ 1271541411ceSmrg | thumbv7* \ 1272541411ceSmrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 1273541411ceSmrg | tron \ 1274541411ceSmrg | ubicom32 \ 1275541411ceSmrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 1276541411ceSmrg | vax \ 1277541411ceSmrg | visium \ 1278541411ceSmrg | w65 \ 1279541411ceSmrg | wasm32 | wasm64 \ 1280541411ceSmrg | we32k \ 1281541411ceSmrg | x86 | x86_64 | xc16x | xgate | xps100 \ 1282541411ceSmrg | xstormy16 | xtensa* \ 1283541411ceSmrg | ymp \ 1284541411ceSmrg | z8k | z80) 1285541411ceSmrg ;; 1286541411ceSmrg 1287541411ceSmrg *) 1288541411ceSmrg echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 1289541411ceSmrg exit 1 1290541411ceSmrg ;; 1291541411ceSmrg esac 129235d5702bSmrg ;; 129335d5702bSmrgesac 129435d5702bSmrg 129535d5702bSmrg# Here we canonicalize certain aliases for manufacturers. 1296541411ceSmrgcase $vendor in 1297541411ceSmrg digital*) 1298541411ceSmrg vendor=dec 129935d5702bSmrg ;; 1300541411ceSmrg commodore*) 1301541411ceSmrg vendor=cbm 130235d5702bSmrg ;; 130335d5702bSmrg *) 130435d5702bSmrg ;; 130535d5702bSmrgesac 130635d5702bSmrg 130735d5702bSmrg# Decode manufacturer-specific aliases for certain operating systems. 130835d5702bSmrg 1309541411ceSmrgif test x$basic_os != x 131035d5702bSmrgthen 1311541411ceSmrg 1312541411ceSmrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 1313541411ceSmrg# set os. 1314541411ceSmrgcase $basic_os in 1315541411ceSmrg gnu/linux*) 1316541411ceSmrg kernel=linux 1317541411ceSmrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 1318541411ceSmrg ;; 1319541411ceSmrg os2-emx) 1320541411ceSmrg kernel=os2 1321541411ceSmrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 1322541411ceSmrg ;; 1323541411ceSmrg nto-qnx*) 1324541411ceSmrg kernel=nto 1325541411ceSmrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 1326541411ceSmrg ;; 1327541411ceSmrg *-*) 1328541411ceSmrg # shellcheck disable=SC2162 1329541411ceSmrg saved_IFS=$IFS 1330541411ceSmrg IFS="-" read kernel os <<EOF 1331541411ceSmrg$basic_os 1332541411ceSmrgEOF 1333541411ceSmrg IFS=$saved_IFS 1334541411ceSmrg ;; 1335541411ceSmrg # Default OS when just kernel was specified 1336541411ceSmrg nto*) 1337541411ceSmrg kernel=nto 1338541411ceSmrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 1339541411ceSmrg ;; 1340541411ceSmrg linux*) 1341541411ceSmrg kernel=linux 1342541411ceSmrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 1343541411ceSmrg ;; 1344541411ceSmrg managarm*) 1345541411ceSmrg kernel=managarm 1346541411ceSmrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 1347541411ceSmrg ;; 1348541411ceSmrg *) 1349541411ceSmrg kernel= 1350541411ceSmrg os=$basic_os 1351541411ceSmrg ;; 1352541411ceSmrgesac 1353541411ceSmrg 1354541411ceSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 1355541411ceSmrg# etc.) 135635d5702bSmrgcase $os in 1357541411ceSmrg # First match some system type aliases that might get confused 1358541411ceSmrg # with valid system types. 1359541411ceSmrg # solaris* is a basic system type, with this one exception. 1360541411ceSmrg auroraux) 1361541411ceSmrg os=auroraux 1362eeced2e6Smrg ;; 1363541411ceSmrg bluegene*) 1364541411ceSmrg os=cnk 136535d5702bSmrg ;; 1366541411ceSmrg solaris1 | solaris1.*) 1367541411ceSmrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 136835d5702bSmrg ;; 1369541411ceSmrg solaris) 1370541411ceSmrg os=solaris2 137135d5702bSmrg ;; 1372541411ceSmrg unixware*) 1373541411ceSmrg os=sysv4.2uw 137435d5702bSmrg ;; 1375541411ceSmrg # es1800 is here to avoid being matched by es* (a different OS) 1376541411ceSmrg es1800*) 1377541411ceSmrg os=ose 137835d5702bSmrg ;; 1379541411ceSmrg # Some version numbers need modification 1380541411ceSmrg chorusos*) 1381541411ceSmrg os=chorusos 138235d5702bSmrg ;; 1383541411ceSmrg isc) 1384541411ceSmrg os=isc2.2 138535d5702bSmrg ;; 1386541411ceSmrg sco6) 1387541411ceSmrg os=sco5v6 138835d5702bSmrg ;; 1389541411ceSmrg sco5) 1390541411ceSmrg os=sco3.2v5 139135d5702bSmrg ;; 1392541411ceSmrg sco4) 1393541411ceSmrg os=sco3.2v4 139435d5702bSmrg ;; 1395541411ceSmrg sco3.2.[4-9]*) 1396541411ceSmrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 139735d5702bSmrg ;; 1398541411ceSmrg sco*v* | scout) 1399541411ceSmrg # Don't match below 140035d5702bSmrg ;; 1401541411ceSmrg sco*) 1402541411ceSmrg os=sco3.2v2 140335d5702bSmrg ;; 1404541411ceSmrg psos*) 1405541411ceSmrg os=psos 140635d5702bSmrg ;; 1407541411ceSmrg qnx*) 1408541411ceSmrg os=qnx 140935d5702bSmrg ;; 1410541411ceSmrg hiux*) 1411541411ceSmrg os=hiuxwe2 141235d5702bSmrg ;; 1413541411ceSmrg lynx*178) 1414541411ceSmrg os=lynxos178 141535d5702bSmrg ;; 1416541411ceSmrg lynx*5) 1417541411ceSmrg os=lynxos5 141835d5702bSmrg ;; 1419541411ceSmrg lynxos*) 1420541411ceSmrg # don't get caught up in next wildcard 142135d5702bSmrg ;; 1422541411ceSmrg lynx*) 1423541411ceSmrg os=lynxos 142435d5702bSmrg ;; 1425541411ceSmrg mac[0-9]*) 1426541411ceSmrg os=`echo "$os" | sed -e 's|mac|macos|'` 142735d5702bSmrg ;; 1428541411ceSmrg opened*) 1429541411ceSmrg os=openedition 143035d5702bSmrg ;; 1431541411ceSmrg os400*) 1432541411ceSmrg os=os400 143335d5702bSmrg ;; 1434541411ceSmrg sunos5*) 1435541411ceSmrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 143635d5702bSmrg ;; 1437541411ceSmrg sunos6*) 1438541411ceSmrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 143935d5702bSmrg ;; 1440541411ceSmrg wince*) 1441541411ceSmrg os=wince 144235d5702bSmrg ;; 1443541411ceSmrg utek*) 1444541411ceSmrg os=bsd 144535d5702bSmrg ;; 1446541411ceSmrg dynix*) 1447541411ceSmrg os=bsd 144835d5702bSmrg ;; 1449541411ceSmrg acis*) 1450541411ceSmrg os=aos 145135d5702bSmrg ;; 1452541411ceSmrg atheos*) 1453541411ceSmrg os=atheos 145435d5702bSmrg ;; 1455541411ceSmrg syllable*) 1456541411ceSmrg os=syllable 145735d5702bSmrg ;; 1458541411ceSmrg 386bsd) 1459541411ceSmrg os=bsd 146035d5702bSmrg ;; 1461541411ceSmrg ctix* | uts*) 1462541411ceSmrg os=sysv 146335d5702bSmrg ;; 1464541411ceSmrg nova*) 1465541411ceSmrg os=rtmk-nova 146635d5702bSmrg ;; 1467541411ceSmrg ns2) 1468541411ceSmrg os=nextstep2 146935d5702bSmrg ;; 1470541411ceSmrg # Preserve the version number of sinix5. 1471541411ceSmrg sinix5.*) 1472541411ceSmrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 147335d5702bSmrg ;; 1474541411ceSmrg sinix*) 1475541411ceSmrg os=sysv4 147635d5702bSmrg ;; 1477541411ceSmrg tpf*) 1478541411ceSmrg os=tpf 147935d5702bSmrg ;; 1480541411ceSmrg triton*) 1481541411ceSmrg os=sysv3 148235d5702bSmrg ;; 1483541411ceSmrg oss*) 1484541411ceSmrg os=sysv3 148535d5702bSmrg ;; 1486541411ceSmrg svr4*) 1487541411ceSmrg os=sysv4 148835d5702bSmrg ;; 1489541411ceSmrg svr3) 1490541411ceSmrg os=sysv3 149135d5702bSmrg ;; 1492541411ceSmrg sysvr4) 1493541411ceSmrg os=sysv4 149435d5702bSmrg ;; 1495541411ceSmrg ose*) 1496541411ceSmrg os=ose 149735d5702bSmrg ;; 1498541411ceSmrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1499541411ceSmrg os=mint 150035d5702bSmrg ;; 1501541411ceSmrg dicos*) 1502541411ceSmrg os=dicos 150335d5702bSmrg ;; 1504541411ceSmrg pikeos*) 1505541411ceSmrg # Until real need of OS specific support for 1506541411ceSmrg # particular features comes up, bare metal 1507541411ceSmrg # configurations are quite functional. 1508541411ceSmrg case $cpu in 1509541411ceSmrg arm*) 1510541411ceSmrg os=eabi 1511541411ceSmrg ;; 1512541411ceSmrg *) 1513541411ceSmrg os=elf 1514541411ceSmrg ;; 1515541411ceSmrg esac 151635d5702bSmrg ;; 151735d5702bSmrg *) 1518541411ceSmrg # No normalization, but not necessarily accepted, that comes below. 151935d5702bSmrg ;; 152035d5702bSmrgesac 1521541411ceSmrg 152235d5702bSmrgelse 152335d5702bSmrg 152435d5702bSmrg# Here we handle the default operating systems that come with various machines. 152535d5702bSmrg# The value should be what the vendor currently ships out the door with their 152635d5702bSmrg# machine or put another way, the most popular os provided with the machine. 152735d5702bSmrg 152835d5702bSmrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 152935d5702bSmrg# "-sun"), then you have to tell the case statement up towards the top 153035d5702bSmrg# that MANUFACTURER isn't an operating system. Otherwise, code above 153135d5702bSmrg# will signal an error saying that MANUFACTURER isn't an operating 153235d5702bSmrg# system, and we'll never get to this point. 153335d5702bSmrg 1534541411ceSmrgkernel= 1535541411ceSmrgcase $cpu-$vendor in 1536541411ceSmrg score-*) 1537541411ceSmrg os=elf 153835d5702bSmrg ;; 1539541411ceSmrg spu-*) 1540541411ceSmrg os=elf 154135d5702bSmrg ;; 154235d5702bSmrg *-acorn) 1543541411ceSmrg os=riscix1.2 154435d5702bSmrg ;; 154535d5702bSmrg arm*-rebel) 1546541411ceSmrg kernel=linux 1547541411ceSmrg os=gnu 154835d5702bSmrg ;; 154935d5702bSmrg arm*-semi) 1550541411ceSmrg os=aout 1551541411ceSmrg ;; 1552541411ceSmrg c4x-* | tic4x-*) 1553541411ceSmrg os=coff 1554541411ceSmrg ;; 1555541411ceSmrg c8051-*) 1556541411ceSmrg os=elf 1557541411ceSmrg ;; 1558541411ceSmrg clipper-intergraph) 1559541411ceSmrg os=clix 156035d5702bSmrg ;; 1561541411ceSmrg hexagon-*) 1562541411ceSmrg os=elf 156335d5702bSmrg ;; 1564eeced2e6Smrg tic54x-*) 1565541411ceSmrg os=coff 1566eeced2e6Smrg ;; 1567eeced2e6Smrg tic55x-*) 1568541411ceSmrg os=coff 1569eeced2e6Smrg ;; 1570eeced2e6Smrg tic6x-*) 1571541411ceSmrg os=coff 1572eeced2e6Smrg ;; 157335d5702bSmrg # This must come before the *-dec entry. 157435d5702bSmrg pdp10-*) 1575541411ceSmrg os=tops20 157635d5702bSmrg ;; 157735d5702bSmrg pdp11-*) 1578541411ceSmrg os=none 157935d5702bSmrg ;; 158035d5702bSmrg *-dec | vax-*) 1581541411ceSmrg os=ultrix4.2 158235d5702bSmrg ;; 158335d5702bSmrg m68*-apollo) 1584541411ceSmrg os=domain 158535d5702bSmrg ;; 158635d5702bSmrg i386-sun) 1587541411ceSmrg os=sunos4.0.2 158835d5702bSmrg ;; 158935d5702bSmrg m68000-sun) 1590541411ceSmrg os=sunos3 159135d5702bSmrg ;; 159235d5702bSmrg m68*-cisco) 1593541411ceSmrg os=aout 159435d5702bSmrg ;; 1595541411ceSmrg mep-*) 1596541411ceSmrg os=elf 159735d5702bSmrg ;; 159835d5702bSmrg mips*-cisco) 1599541411ceSmrg os=elf 160035d5702bSmrg ;; 160135d5702bSmrg mips*-*) 1602541411ceSmrg os=elf 160335d5702bSmrg ;; 160435d5702bSmrg or32-*) 1605541411ceSmrg os=coff 160635d5702bSmrg ;; 160735d5702bSmrg *-tti) # must be before sparc entry or we get the wrong os. 1608541411ceSmrg os=sysv3 160935d5702bSmrg ;; 161035d5702bSmrg sparc-* | *-sun) 1611541411ceSmrg os=sunos4.1.1 161235d5702bSmrg ;; 1613541411ceSmrg pru-*) 1614541411ceSmrg os=elf 161535d5702bSmrg ;; 1616541411ceSmrg *-be) 1617541411ceSmrg os=beos 161835d5702bSmrg ;; 161935d5702bSmrg *-ibm) 1620541411ceSmrg os=aix 162135d5702bSmrg ;; 1622541411ceSmrg *-knuth) 1623541411ceSmrg os=mmixware 162435d5702bSmrg ;; 162535d5702bSmrg *-wec) 1626541411ceSmrg os=proelf 162735d5702bSmrg ;; 162835d5702bSmrg *-winbond) 1629541411ceSmrg os=proelf 163035d5702bSmrg ;; 163135d5702bSmrg *-oki) 1632541411ceSmrg os=proelf 163335d5702bSmrg ;; 163435d5702bSmrg *-hp) 1635541411ceSmrg os=hpux 163635d5702bSmrg ;; 163735d5702bSmrg *-hitachi) 1638541411ceSmrg os=hiux 163935d5702bSmrg ;; 164035d5702bSmrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1641541411ceSmrg os=sysv 164235d5702bSmrg ;; 164335d5702bSmrg *-cbm) 1644541411ceSmrg os=amigaos 164535d5702bSmrg ;; 164635d5702bSmrg *-dg) 1647541411ceSmrg os=dgux 164835d5702bSmrg ;; 164935d5702bSmrg *-dolphin) 1650541411ceSmrg os=sysv3 165135d5702bSmrg ;; 165235d5702bSmrg m68k-ccur) 1653541411ceSmrg os=rtu 165435d5702bSmrg ;; 165535d5702bSmrg m88k-omron*) 1656541411ceSmrg os=luna 165735d5702bSmrg ;; 1658541411ceSmrg *-next) 1659541411ceSmrg os=nextstep 166035d5702bSmrg ;; 166135d5702bSmrg *-sequent) 1662541411ceSmrg os=ptx 166335d5702bSmrg ;; 166435d5702bSmrg *-crds) 1665541411ceSmrg os=unos 166635d5702bSmrg ;; 166735d5702bSmrg *-ns) 1668541411ceSmrg os=genix 166935d5702bSmrg ;; 167035d5702bSmrg i370-*) 1671541411ceSmrg os=mvs 167235d5702bSmrg ;; 167335d5702bSmrg *-gould) 1674541411ceSmrg os=sysv 167535d5702bSmrg ;; 167635d5702bSmrg *-highlevel) 1677541411ceSmrg os=bsd 167835d5702bSmrg ;; 167935d5702bSmrg *-encore) 1680541411ceSmrg os=bsd 168135d5702bSmrg ;; 168235d5702bSmrg *-sgi) 1683541411ceSmrg os=irix 168435d5702bSmrg ;; 168535d5702bSmrg *-siemens) 1686541411ceSmrg os=sysv4 168735d5702bSmrg ;; 168835d5702bSmrg *-masscomp) 1689541411ceSmrg os=rtu 169035d5702bSmrg ;; 169135d5702bSmrg f30[01]-fujitsu | f700-fujitsu) 1692541411ceSmrg os=uxpv 169335d5702bSmrg ;; 169435d5702bSmrg *-rom68k) 1695541411ceSmrg os=coff 169635d5702bSmrg ;; 169735d5702bSmrg *-*bug) 1698541411ceSmrg os=coff 169935d5702bSmrg ;; 170035d5702bSmrg *-apple) 1701541411ceSmrg os=macos 170235d5702bSmrg ;; 170335d5702bSmrg *-atari*) 1704541411ceSmrg os=mint 1705541411ceSmrg ;; 1706541411ceSmrg *-wrs) 1707541411ceSmrg os=vxworks 170835d5702bSmrg ;; 170935d5702bSmrg *) 1710541411ceSmrg os=none 171135d5702bSmrg ;; 171235d5702bSmrgesac 1713541411ceSmrg 171435d5702bSmrgfi 171535d5702bSmrg 1716541411ceSmrg# Now, validate our (potentially fixed-up) OS. 1717541411ceSmrgcase $os in 1718541411ceSmrg # Sometimes we do "kernel-libc", so those need to count as OSes. 1719541411ceSmrg musl* | newlib* | relibc* | uclibc*) 1720541411ceSmrg ;; 1721541411ceSmrg # Likewise for "kernel-abi" 1722541411ceSmrg eabi* | gnueabi*) 1723541411ceSmrg ;; 1724541411ceSmrg # VxWorks passes extra cpu info in the 4th filed. 1725541411ceSmrg simlinux | simwindows | spe) 1726541411ceSmrg ;; 1727541411ceSmrg # Now accept the basic system types. 1728541411ceSmrg # The portable systems comes first. 1729541411ceSmrg # Each alternative MUST end in a * to match a version number. 1730541411ceSmrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1731541411ceSmrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 1732541411ceSmrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1733541411ceSmrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 1734541411ceSmrg | hiux* | abug | nacl* | netware* | windows* \ 1735541411ceSmrg | os9* | macos* | osx* | ios* \ 1736541411ceSmrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 1737541411ceSmrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1738541411ceSmrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 1739541411ceSmrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1740541411ceSmrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 1741541411ceSmrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 1742541411ceSmrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 1743541411ceSmrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1744541411ceSmrg | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1745541411ceSmrg | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1746541411ceSmrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 1747541411ceSmrg | chorusrdb* | cegcc* | glidix* | serenity* \ 1748541411ceSmrg | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 1749541411ceSmrg | midipix* | mingw32* | mingw64* | mint* \ 1750541411ceSmrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1751541411ceSmrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 1752541411ceSmrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 1753541411ceSmrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 1754541411ceSmrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 1755541411ceSmrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 1756541411ceSmrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 1757541411ceSmrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 1758541411ceSmrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 1759541411ceSmrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1760541411ceSmrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1761541411ceSmrg | fiwix* | mlibc* ) 1762541411ceSmrg ;; 1763541411ceSmrg # This one is extra strict with allowed versions 1764541411ceSmrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 1765541411ceSmrg # Don't forget version if it is 3.2v4 or newer. 1766541411ceSmrg ;; 1767541411ceSmrg none) 1768541411ceSmrg ;; 1769541411ceSmrg kernel* ) 1770541411ceSmrg # Restricted further below 1771541411ceSmrg ;; 1772541411ceSmrg *) 1773541411ceSmrg echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 1774541411ceSmrg exit 1 1775541411ceSmrg ;; 1776541411ceSmrgesac 1777541411ceSmrg 1778541411ceSmrg# As a final step for OS-related things, validate the OS-kernel combination 1779541411ceSmrg# (given a valid OS), if there is a kernel. 1780541411ceSmrgcase $kernel-$os in 1781541411ceSmrg linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 1782541411ceSmrg | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 1783541411ceSmrg ;; 1784541411ceSmrg uclinux-uclibc* ) 1785541411ceSmrg ;; 1786541411ceSmrg managarm-mlibc* | managarm-kernel* ) 1787541411ceSmrg ;; 1788541411ceSmrg -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 1789541411ceSmrg # These are just libc implementations, not actual OSes, and thus 1790541411ceSmrg # require a kernel. 1791541411ceSmrg echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 1792541411ceSmrg exit 1 1793541411ceSmrg ;; 1794541411ceSmrg -kernel* ) 1795541411ceSmrg echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 1796541411ceSmrg exit 1 1797541411ceSmrg ;; 1798541411ceSmrg *-kernel* ) 1799541411ceSmrg echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 1800541411ceSmrg exit 1 1801541411ceSmrg ;; 1802541411ceSmrg kfreebsd*-gnu* | kopensolaris*-gnu*) 1803541411ceSmrg ;; 1804541411ceSmrg vxworks-simlinux | vxworks-simwindows | vxworks-spe) 1805541411ceSmrg ;; 1806541411ceSmrg nto-qnx*) 1807541411ceSmrg ;; 1808541411ceSmrg os2-emx) 1809541411ceSmrg ;; 1810541411ceSmrg *-eabi* | *-gnueabi*) 1811541411ceSmrg ;; 1812541411ceSmrg -*) 1813541411ceSmrg # Blank kernel with real OS is always fine. 1814541411ceSmrg ;; 1815541411ceSmrg *-*) 1816541411ceSmrg echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 1817541411ceSmrg exit 1 1818541411ceSmrg ;; 1819541411ceSmrgesac 1820541411ceSmrg 182135d5702bSmrg# Here we handle the case where we know the os, and the CPU type, but not the 182235d5702bSmrg# manufacturer. We pick the logical manufacturer. 1823541411ceSmrgcase $vendor in 1824541411ceSmrg unknown) 1825541411ceSmrg case $cpu-$os in 1826541411ceSmrg *-riscix*) 182735d5702bSmrg vendor=acorn 182835d5702bSmrg ;; 1829541411ceSmrg *-sunos*) 183035d5702bSmrg vendor=sun 183135d5702bSmrg ;; 1832541411ceSmrg *-cnk* | *-aix*) 183335d5702bSmrg vendor=ibm 183435d5702bSmrg ;; 1835541411ceSmrg *-beos*) 183635d5702bSmrg vendor=be 183735d5702bSmrg ;; 1838541411ceSmrg *-hpux*) 183935d5702bSmrg vendor=hp 184035d5702bSmrg ;; 1841541411ceSmrg *-mpeix*) 184235d5702bSmrg vendor=hp 184335d5702bSmrg ;; 1844541411ceSmrg *-hiux*) 184535d5702bSmrg vendor=hitachi 184635d5702bSmrg ;; 1847541411ceSmrg *-unos*) 184835d5702bSmrg vendor=crds 184935d5702bSmrg ;; 1850541411ceSmrg *-dgux*) 185135d5702bSmrg vendor=dg 185235d5702bSmrg ;; 1853541411ceSmrg *-luna*) 185435d5702bSmrg vendor=omron 185535d5702bSmrg ;; 1856541411ceSmrg *-genix*) 185735d5702bSmrg vendor=ns 185835d5702bSmrg ;; 1859541411ceSmrg *-clix*) 1860541411ceSmrg vendor=intergraph 1861541411ceSmrg ;; 1862541411ceSmrg *-mvs* | *-opened*) 1863541411ceSmrg vendor=ibm 1864541411ceSmrg ;; 1865541411ceSmrg *-os400*) 186635d5702bSmrg vendor=ibm 186735d5702bSmrg ;; 1868541411ceSmrg s390-* | s390x-*) 186935d5702bSmrg vendor=ibm 187035d5702bSmrg ;; 1871541411ceSmrg *-ptx*) 187235d5702bSmrg vendor=sequent 187335d5702bSmrg ;; 1874541411ceSmrg *-tpf*) 187535d5702bSmrg vendor=ibm 187635d5702bSmrg ;; 1877541411ceSmrg *-vxsim* | *-vxworks* | *-windiss*) 187835d5702bSmrg vendor=wrs 187935d5702bSmrg ;; 1880541411ceSmrg *-aux*) 188135d5702bSmrg vendor=apple 188235d5702bSmrg ;; 1883541411ceSmrg *-hms*) 188435d5702bSmrg vendor=hitachi 188535d5702bSmrg ;; 1886541411ceSmrg *-mpw* | *-macos*) 188735d5702bSmrg vendor=apple 188835d5702bSmrg ;; 1889541411ceSmrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 189035d5702bSmrg vendor=atari 189135d5702bSmrg ;; 1892541411ceSmrg *-vos*) 189335d5702bSmrg vendor=stratus 189435d5702bSmrg ;; 189535d5702bSmrg esac 189635d5702bSmrg ;; 189735d5702bSmrgesac 189835d5702bSmrg 1899541411ceSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os" 190035d5702bSmrgexit 190135d5702bSmrg 190235d5702bSmrg# Local variables: 1903541411ceSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 190435d5702bSmrg# time-stamp-start: "timestamp='" 190535d5702bSmrg# time-stamp-format: "%:y-%02m-%02d" 190635d5702bSmrg# time-stamp-end: "'" 190735d5702bSmrg# End: 1908