1a3167c07Ssthen#! /bin/sh 2933707f3Ssthen# Configuration validation subroutine script. 3*8b7325afSsthen# Copyright 1992-2023 Free Software Foundation, Inc. 4933707f3Ssthen 5191f22c6Ssthen# shellcheck disable=SC2006,SC2268 # see below for rationale 6191f22c6Ssthen 7*8b7325afSsthentimestamp='2023-07-31' 8933707f3Ssthen 998f3ca02Sbrad# This file is free software; you can redistribute it and/or modify it 1098f3ca02Sbrad# under the terms of the GNU General Public License as published by 11e21c60efSsthen# the Free Software Foundation, either version 3 of the License, or 12933707f3Ssthen# (at your option) any later version. 13933707f3Ssthen# 1498f3ca02Sbrad# This program is distributed in the hope that it will be useful, but 1598f3ca02Sbrad# WITHOUT ANY WARRANTY; without even the implied warranty of 1698f3ca02Sbrad# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1798f3ca02Sbrad# General Public License for more details. 18933707f3Ssthen# 19933707f3Ssthen# You should have received a copy of the GNU General Public License 20a3167c07Ssthen# along with this program; if not, see <https://www.gnu.org/licenses/>. 21933707f3Ssthen# 22933707f3Ssthen# As a special exception to the GNU General Public License, if you 23933707f3Ssthen# distribute this file as part of a program that contains a 24933707f3Ssthen# configuration script generated by Autoconf, you may include it under 2598f3ca02Sbrad# the same distribution terms that you use for the rest of that 2698f3ca02Sbrad# program. This Exception is an additional permission under section 7 2798f3ca02Sbrad# of the GNU General Public License, version 3 ("GPLv3"). 28933707f3Ssthen 29933707f3Ssthen 300990ddf5Ssthen# Please send patches to <config-patches@gnu.org>. 31933707f3Ssthen# 32933707f3Ssthen# Configuration subroutine to validate and canonicalize a configuration type. 33933707f3Ssthen# Supply the specified configuration type as an argument. 34933707f3Ssthen# If it is invalid, we print an error message on stderr and exit with code 1. 35933707f3Ssthen# Otherwise, we print the canonical config type on stdout and succeed. 36933707f3Ssthen 37933707f3Ssthen# You can get the latest version of this script from: 38eba819a2Ssthen# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39933707f3Ssthen 40933707f3Ssthen# This file is supposed to be the same for all GNU packages 41933707f3Ssthen# and recognize all the CPU types, system types and aliases 42933707f3Ssthen# that are meaningful with *any* GNU software. 43933707f3Ssthen# Each package is responsible for reporting which valid configurations 44933707f3Ssthen# it does not support. The user should be able to distinguish 45933707f3Ssthen# a failure to support a valid configuration from a meaningless 46933707f3Ssthen# configuration. 47933707f3Ssthen 48933707f3Ssthen# The goal of this file is to map all the various variations of a given 49933707f3Ssthen# machine specification into a single specification in the form: 50933707f3Ssthen# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 51933707f3Ssthen# or in some cases, the newer four-part form: 52933707f3Ssthen# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 53933707f3Ssthen# It is wrong to echo any other type of specification. 54933707f3Ssthen 55191f22c6Ssthen# The "shellcheck disable" line above the timestamp inhibits complaints 56191f22c6Ssthen# about features and limitations of the classic Bourne shell that were 57191f22c6Ssthen# superseded or lifted in POSIX. However, this script identifies a wide 58191f22c6Ssthen# variety of pre-POSIX systems that do not have POSIX shells at all, and 59191f22c6Ssthen# even some reasonably current systems (Solaris 10 as case-in-point) still 60191f22c6Ssthen# have a pre-POSIX /bin/sh. 61191f22c6Ssthen 62191f22c6Ssthenme=`echo "$0" | sed -e 's,.*/,,'` 63933707f3Ssthen 64933707f3Ssthenusage="\ 650990ddf5SsthenUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 66933707f3Ssthen 67933707f3SsthenCanonicalize a configuration name. 68933707f3Ssthen 69a3167c07SsthenOptions: 70933707f3Ssthen -h, --help print this help, then exit 71933707f3Ssthen -t, --time-stamp print date of last modification, then exit 72933707f3Ssthen -v, --version print version number, then exit 73933707f3Ssthen 74933707f3SsthenReport bugs and patches to <config-patches@gnu.org>." 75933707f3Ssthen 76933707f3Ssthenversion="\ 77933707f3SsthenGNU config.sub ($timestamp) 78933707f3Ssthen 79*8b7325afSsthenCopyright 1992-2023 Free Software Foundation, Inc. 80933707f3Ssthen 81933707f3SsthenThis is free software; see the source for copying conditions. There is NO 82933707f3Ssthenwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 83933707f3Ssthen 84933707f3Ssthenhelp=" 85*8b7325afSsthenTry '$me --help' for more information." 86933707f3Ssthen 87933707f3Ssthen# Parse command line 88933707f3Ssthenwhile test $# -gt 0 ; do 89933707f3Ssthen case $1 in 90933707f3Ssthen --time-stamp | --time* | -t ) 91933707f3Ssthen echo "$timestamp" ; exit ;; 92933707f3Ssthen --version | -v ) 93933707f3Ssthen echo "$version" ; exit ;; 94933707f3Ssthen --help | --h* | -h ) 95933707f3Ssthen echo "$usage"; exit ;; 96933707f3Ssthen -- ) # Stop option processing 97933707f3Ssthen shift; break ;; 98933707f3Ssthen - ) # Use stdin as input. 99933707f3Ssthen break ;; 100933707f3Ssthen -* ) 101a3167c07Ssthen echo "$me: invalid option $1$help" >&2 102933707f3Ssthen exit 1 ;; 103933707f3Ssthen 104933707f3Ssthen *local*) 105933707f3Ssthen # First pass through any local machine types. 106a3167c07Ssthen echo "$1" 107933707f3Ssthen exit ;; 108933707f3Ssthen 109933707f3Ssthen * ) 110933707f3Ssthen break ;; 111933707f3Ssthen esac 112933707f3Ssthendone 113933707f3Ssthen 114933707f3Ssthencase $# in 115933707f3Ssthen 0) echo "$me: missing argument$help" >&2 116933707f3Ssthen exit 1;; 117933707f3Ssthen 1) ;; 118933707f3Ssthen *) echo "$me: too many arguments$help" >&2 119933707f3Ssthen exit 1;; 120933707f3Ssthenesac 121933707f3Ssthen 122a3167c07Ssthen# Split fields of configuration type 123a3167c07Ssthen# shellcheck disable=SC2162 124e21c60efSsthensaved_IFS=$IFS 125a3167c07SsthenIFS="-" read field1 field2 field3 field4 <<EOF 126a3167c07Ssthen$1 127a3167c07SsthenEOF 128e21c60efSsthenIFS=$saved_IFS 129a3167c07Ssthen 130a3167c07Ssthen# Separate into logical components for further validation 131a3167c07Ssthencase $1 in 132a3167c07Ssthen *-*-*-*-*) 133*8b7325afSsthen echo "Invalid configuration '$1': more than four components" >&2 134a3167c07Ssthen exit 1 135a3167c07Ssthen ;; 136a3167c07Ssthen *-*-*-*) 137a3167c07Ssthen basic_machine=$field1-$field2 138a3167c07Ssthen basic_os=$field3-$field4 139a3167c07Ssthen ;; 140a3167c07Ssthen *-*-*) 141a3167c07Ssthen # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 142a3167c07Ssthen # parts 143a3167c07Ssthen maybe_os=$field2-$field3 144933707f3Ssthen case $maybe_os in 145a3167c07Ssthen nto-qnx* | linux-* | uclinux-uclibc* \ 146a3167c07Ssthen | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 147a3167c07Ssthen | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148*8b7325afSsthen | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ 149*8b7325afSsthen | windows-* ) 150a3167c07Ssthen basic_machine=$field1 151a3167c07Ssthen basic_os=$maybe_os 152933707f3Ssthen ;; 153229e174cSsthen android-linux) 154a3167c07Ssthen basic_machine=$field1-unknown 155a3167c07Ssthen basic_os=linux-android 156229e174cSsthen ;; 157933707f3Ssthen *) 158a3167c07Ssthen basic_machine=$field1-$field2 159a3167c07Ssthen basic_os=$field3 160a3167c07Ssthen ;; 161a3167c07Ssthen esac 162a3167c07Ssthen ;; 163a3167c07Ssthen *-*) 164a3167c07Ssthen # A lone config we happen to match not fitting any pattern 165a3167c07Ssthen case $field1-$field2 in 166a3167c07Ssthen decstation-3100) 167a3167c07Ssthen basic_machine=mips-dec 168a3167c07Ssthen basic_os= 169a3167c07Ssthen ;; 170a3167c07Ssthen *-*) 171a3167c07Ssthen # Second component is usually, but not always the OS 172a3167c07Ssthen case $field2 in 173a3167c07Ssthen # Prevent following clause from handling this valid os 174a3167c07Ssthen sun*os*) 175a3167c07Ssthen basic_machine=$field1 176a3167c07Ssthen basic_os=$field2 177a3167c07Ssthen ;; 178e21c60efSsthen zephyr*) 179e21c60efSsthen basic_machine=$field1-unknown 180e21c60efSsthen basic_os=$field2 181e21c60efSsthen ;; 182a3167c07Ssthen # Manufacturers 183a3167c07Ssthen dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 184a3167c07Ssthen | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 185a3167c07Ssthen | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 186a3167c07Ssthen | convergent* | ncr* | news | 32* | 3600* | 3100* \ 187a3167c07Ssthen | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 188a3167c07Ssthen | ultra | tti* | harris | dolphin | highlevel | gould \ 189a3167c07Ssthen | cbm | ns | masscomp | apple | axis | knuth | cray \ 190a3167c07Ssthen | microblaze* | sim | cisco \ 191a3167c07Ssthen | oki | wec | wrs | winbond) 192a3167c07Ssthen basic_machine=$field1-$field2 193a3167c07Ssthen basic_os= 194a3167c07Ssthen ;; 195a3167c07Ssthen *) 196a3167c07Ssthen basic_machine=$field1 197a3167c07Ssthen basic_os=$field2 198a3167c07Ssthen ;; 199a3167c07Ssthen esac 200a3167c07Ssthen ;; 201a3167c07Ssthen esac 202a3167c07Ssthen ;; 203a3167c07Ssthen *) 204a3167c07Ssthen # Convert single-component short-hands not valid as part of 205a3167c07Ssthen # multi-component configurations. 206a3167c07Ssthen case $field1 in 207a3167c07Ssthen 386bsd) 208a3167c07Ssthen basic_machine=i386-pc 209a3167c07Ssthen basic_os=bsd 210a3167c07Ssthen ;; 211a3167c07Ssthen a29khif) 212a3167c07Ssthen basic_machine=a29k-amd 213a3167c07Ssthen basic_os=udi 214a3167c07Ssthen ;; 215a3167c07Ssthen adobe68k) 216a3167c07Ssthen basic_machine=m68010-adobe 217a3167c07Ssthen basic_os=scout 218a3167c07Ssthen ;; 219a3167c07Ssthen alliant) 220a3167c07Ssthen basic_machine=fx80-alliant 221a3167c07Ssthen basic_os= 222a3167c07Ssthen ;; 223a3167c07Ssthen altos | altos3068) 224a3167c07Ssthen basic_machine=m68k-altos 225a3167c07Ssthen basic_os= 226a3167c07Ssthen ;; 227a3167c07Ssthen am29k) 228a3167c07Ssthen basic_machine=a29k-none 229a3167c07Ssthen basic_os=bsd 230a3167c07Ssthen ;; 231a3167c07Ssthen amdahl) 232a3167c07Ssthen basic_machine=580-amdahl 233a3167c07Ssthen basic_os=sysv 234a3167c07Ssthen ;; 235a3167c07Ssthen amiga) 236a3167c07Ssthen basic_machine=m68k-unknown 237a3167c07Ssthen basic_os= 238a3167c07Ssthen ;; 239a3167c07Ssthen amigaos | amigados) 240a3167c07Ssthen basic_machine=m68k-unknown 241a3167c07Ssthen basic_os=amigaos 242a3167c07Ssthen ;; 243a3167c07Ssthen amigaunix | amix) 244a3167c07Ssthen basic_machine=m68k-unknown 245a3167c07Ssthen basic_os=sysv4 246a3167c07Ssthen ;; 247a3167c07Ssthen apollo68) 248a3167c07Ssthen basic_machine=m68k-apollo 249a3167c07Ssthen basic_os=sysv 250a3167c07Ssthen ;; 251a3167c07Ssthen apollo68bsd) 252a3167c07Ssthen basic_machine=m68k-apollo 253a3167c07Ssthen basic_os=bsd 254a3167c07Ssthen ;; 255a3167c07Ssthen aros) 256a3167c07Ssthen basic_machine=i386-pc 257a3167c07Ssthen basic_os=aros 258a3167c07Ssthen ;; 259a3167c07Ssthen aux) 260a3167c07Ssthen basic_machine=m68k-apple 261a3167c07Ssthen basic_os=aux 262a3167c07Ssthen ;; 263a3167c07Ssthen balance) 264a3167c07Ssthen basic_machine=ns32k-sequent 265a3167c07Ssthen basic_os=dynix 266a3167c07Ssthen ;; 267a3167c07Ssthen blackfin) 268a3167c07Ssthen basic_machine=bfin-unknown 269a3167c07Ssthen basic_os=linux 270a3167c07Ssthen ;; 271a3167c07Ssthen cegcc) 272a3167c07Ssthen basic_machine=arm-unknown 273a3167c07Ssthen basic_os=cegcc 274a3167c07Ssthen ;; 275a3167c07Ssthen convex-c1) 276a3167c07Ssthen basic_machine=c1-convex 277a3167c07Ssthen basic_os=bsd 278a3167c07Ssthen ;; 279a3167c07Ssthen convex-c2) 280a3167c07Ssthen basic_machine=c2-convex 281a3167c07Ssthen basic_os=bsd 282a3167c07Ssthen ;; 283a3167c07Ssthen convex-c32) 284a3167c07Ssthen basic_machine=c32-convex 285a3167c07Ssthen basic_os=bsd 286a3167c07Ssthen ;; 287a3167c07Ssthen convex-c34) 288a3167c07Ssthen basic_machine=c34-convex 289a3167c07Ssthen basic_os=bsd 290a3167c07Ssthen ;; 291a3167c07Ssthen convex-c38) 292a3167c07Ssthen basic_machine=c38-convex 293a3167c07Ssthen basic_os=bsd 294a3167c07Ssthen ;; 295a3167c07Ssthen cray) 296a3167c07Ssthen basic_machine=j90-cray 297a3167c07Ssthen basic_os=unicos 298a3167c07Ssthen ;; 299a3167c07Ssthen crds | unos) 300a3167c07Ssthen basic_machine=m68k-crds 301a3167c07Ssthen basic_os= 302a3167c07Ssthen ;; 303a3167c07Ssthen da30) 304a3167c07Ssthen basic_machine=m68k-da30 305a3167c07Ssthen basic_os= 306a3167c07Ssthen ;; 307a3167c07Ssthen decstation | pmax | pmin | dec3100 | decstatn) 308a3167c07Ssthen basic_machine=mips-dec 309a3167c07Ssthen basic_os= 310a3167c07Ssthen ;; 311a3167c07Ssthen delta88) 312a3167c07Ssthen basic_machine=m88k-motorola 313a3167c07Ssthen basic_os=sysv3 314a3167c07Ssthen ;; 315a3167c07Ssthen dicos) 316a3167c07Ssthen basic_machine=i686-pc 317a3167c07Ssthen basic_os=dicos 318a3167c07Ssthen ;; 319a3167c07Ssthen djgpp) 320a3167c07Ssthen basic_machine=i586-pc 321a3167c07Ssthen basic_os=msdosdjgpp 322a3167c07Ssthen ;; 323a3167c07Ssthen ebmon29k) 324a3167c07Ssthen basic_machine=a29k-amd 325a3167c07Ssthen basic_os=ebmon 326a3167c07Ssthen ;; 327a3167c07Ssthen es1800 | OSE68k | ose68k | ose | OSE) 328a3167c07Ssthen basic_machine=m68k-ericsson 329a3167c07Ssthen basic_os=ose 330a3167c07Ssthen ;; 331a3167c07Ssthen gmicro) 332a3167c07Ssthen basic_machine=tron-gmicro 333a3167c07Ssthen basic_os=sysv 334a3167c07Ssthen ;; 335a3167c07Ssthen go32) 336a3167c07Ssthen basic_machine=i386-pc 337a3167c07Ssthen basic_os=go32 338a3167c07Ssthen ;; 339a3167c07Ssthen h8300hms) 340a3167c07Ssthen basic_machine=h8300-hitachi 341a3167c07Ssthen basic_os=hms 342a3167c07Ssthen ;; 343a3167c07Ssthen h8300xray) 344a3167c07Ssthen basic_machine=h8300-hitachi 345a3167c07Ssthen basic_os=xray 346a3167c07Ssthen ;; 347a3167c07Ssthen h8500hms) 348a3167c07Ssthen basic_machine=h8500-hitachi 349a3167c07Ssthen basic_os=hms 350a3167c07Ssthen ;; 351a3167c07Ssthen harris) 352a3167c07Ssthen basic_machine=m88k-harris 353a3167c07Ssthen basic_os=sysv3 354a3167c07Ssthen ;; 355a3167c07Ssthen hp300 | hp300hpux) 356a3167c07Ssthen basic_machine=m68k-hp 357a3167c07Ssthen basic_os=hpux 358a3167c07Ssthen ;; 359a3167c07Ssthen hp300bsd) 360a3167c07Ssthen basic_machine=m68k-hp 361a3167c07Ssthen basic_os=bsd 362a3167c07Ssthen ;; 363a3167c07Ssthen hppaosf) 364a3167c07Ssthen basic_machine=hppa1.1-hp 365a3167c07Ssthen basic_os=osf 366a3167c07Ssthen ;; 367a3167c07Ssthen hppro) 368a3167c07Ssthen basic_machine=hppa1.1-hp 369a3167c07Ssthen basic_os=proelf 370a3167c07Ssthen ;; 371a3167c07Ssthen i386mach) 372a3167c07Ssthen basic_machine=i386-mach 373a3167c07Ssthen basic_os=mach 374a3167c07Ssthen ;; 375a3167c07Ssthen isi68 | isi) 376a3167c07Ssthen basic_machine=m68k-isi 377a3167c07Ssthen basic_os=sysv 378a3167c07Ssthen ;; 379a3167c07Ssthen m68knommu) 380a3167c07Ssthen basic_machine=m68k-unknown 381a3167c07Ssthen basic_os=linux 382a3167c07Ssthen ;; 383a3167c07Ssthen magnum | m3230) 384a3167c07Ssthen basic_machine=mips-mips 385a3167c07Ssthen basic_os=sysv 386a3167c07Ssthen ;; 387a3167c07Ssthen merlin) 388a3167c07Ssthen basic_machine=ns32k-utek 389a3167c07Ssthen basic_os=sysv 390a3167c07Ssthen ;; 391a3167c07Ssthen mingw64) 392a3167c07Ssthen basic_machine=x86_64-pc 393a3167c07Ssthen basic_os=mingw64 394a3167c07Ssthen ;; 395a3167c07Ssthen mingw32) 396a3167c07Ssthen basic_machine=i686-pc 397a3167c07Ssthen basic_os=mingw32 398a3167c07Ssthen ;; 399a3167c07Ssthen mingw32ce) 400a3167c07Ssthen basic_machine=arm-unknown 401a3167c07Ssthen basic_os=mingw32ce 402a3167c07Ssthen ;; 403a3167c07Ssthen monitor) 404a3167c07Ssthen basic_machine=m68k-rom68k 405a3167c07Ssthen basic_os=coff 406a3167c07Ssthen ;; 407a3167c07Ssthen morphos) 408a3167c07Ssthen basic_machine=powerpc-unknown 409a3167c07Ssthen basic_os=morphos 410a3167c07Ssthen ;; 411a3167c07Ssthen moxiebox) 412a3167c07Ssthen basic_machine=moxie-unknown 413a3167c07Ssthen basic_os=moxiebox 414a3167c07Ssthen ;; 415a3167c07Ssthen msdos) 416a3167c07Ssthen basic_machine=i386-pc 417a3167c07Ssthen basic_os=msdos 418a3167c07Ssthen ;; 419a3167c07Ssthen msys) 420a3167c07Ssthen basic_machine=i686-pc 421a3167c07Ssthen basic_os=msys 422a3167c07Ssthen ;; 423a3167c07Ssthen mvs) 424a3167c07Ssthen basic_machine=i370-ibm 425a3167c07Ssthen basic_os=mvs 426a3167c07Ssthen ;; 427a3167c07Ssthen nacl) 428a3167c07Ssthen basic_machine=le32-unknown 429a3167c07Ssthen basic_os=nacl 430a3167c07Ssthen ;; 431a3167c07Ssthen ncr3000) 432a3167c07Ssthen basic_machine=i486-ncr 433a3167c07Ssthen basic_os=sysv4 434a3167c07Ssthen ;; 435a3167c07Ssthen netbsd386) 436a3167c07Ssthen basic_machine=i386-pc 437a3167c07Ssthen basic_os=netbsd 438a3167c07Ssthen ;; 439a3167c07Ssthen netwinder) 440a3167c07Ssthen basic_machine=armv4l-rebel 441a3167c07Ssthen basic_os=linux 442a3167c07Ssthen ;; 443a3167c07Ssthen news | news700 | news800 | news900) 444a3167c07Ssthen basic_machine=m68k-sony 445a3167c07Ssthen basic_os=newsos 446a3167c07Ssthen ;; 447a3167c07Ssthen news1000) 448a3167c07Ssthen basic_machine=m68030-sony 449a3167c07Ssthen basic_os=newsos 450a3167c07Ssthen ;; 451a3167c07Ssthen necv70) 452a3167c07Ssthen basic_machine=v70-nec 453a3167c07Ssthen basic_os=sysv 454a3167c07Ssthen ;; 455a3167c07Ssthen nh3000) 456a3167c07Ssthen basic_machine=m68k-harris 457a3167c07Ssthen basic_os=cxux 458a3167c07Ssthen ;; 459a3167c07Ssthen nh[45]000) 460a3167c07Ssthen basic_machine=m88k-harris 461a3167c07Ssthen basic_os=cxux 462a3167c07Ssthen ;; 463a3167c07Ssthen nindy960) 464a3167c07Ssthen basic_machine=i960-intel 465a3167c07Ssthen basic_os=nindy 466a3167c07Ssthen ;; 467a3167c07Ssthen mon960) 468a3167c07Ssthen basic_machine=i960-intel 469a3167c07Ssthen basic_os=mon960 470a3167c07Ssthen ;; 471a3167c07Ssthen nonstopux) 472a3167c07Ssthen basic_machine=mips-compaq 473a3167c07Ssthen basic_os=nonstopux 474a3167c07Ssthen ;; 475a3167c07Ssthen os400) 476a3167c07Ssthen basic_machine=powerpc-ibm 477a3167c07Ssthen basic_os=os400 478a3167c07Ssthen ;; 479a3167c07Ssthen OSE68000 | ose68000) 480a3167c07Ssthen basic_machine=m68000-ericsson 481a3167c07Ssthen basic_os=ose 482a3167c07Ssthen ;; 483a3167c07Ssthen os68k) 484a3167c07Ssthen basic_machine=m68k-none 485a3167c07Ssthen basic_os=os68k 486a3167c07Ssthen ;; 487a3167c07Ssthen paragon) 488a3167c07Ssthen basic_machine=i860-intel 489a3167c07Ssthen basic_os=osf 490a3167c07Ssthen ;; 491a3167c07Ssthen parisc) 492a3167c07Ssthen basic_machine=hppa-unknown 493a3167c07Ssthen basic_os=linux 494a3167c07Ssthen ;; 495a3167c07Ssthen psp) 496a3167c07Ssthen basic_machine=mipsallegrexel-sony 497a3167c07Ssthen basic_os=psp 498a3167c07Ssthen ;; 499a3167c07Ssthen pw32) 500a3167c07Ssthen basic_machine=i586-unknown 501a3167c07Ssthen basic_os=pw32 502a3167c07Ssthen ;; 503a3167c07Ssthen rdos | rdos64) 504a3167c07Ssthen basic_machine=x86_64-pc 505a3167c07Ssthen basic_os=rdos 506a3167c07Ssthen ;; 507a3167c07Ssthen rdos32) 508a3167c07Ssthen basic_machine=i386-pc 509a3167c07Ssthen basic_os=rdos 510a3167c07Ssthen ;; 511a3167c07Ssthen rom68k) 512a3167c07Ssthen basic_machine=m68k-rom68k 513a3167c07Ssthen basic_os=coff 514a3167c07Ssthen ;; 515a3167c07Ssthen sa29200) 516a3167c07Ssthen basic_machine=a29k-amd 517a3167c07Ssthen basic_os=udi 518a3167c07Ssthen ;; 519a3167c07Ssthen sei) 520a3167c07Ssthen basic_machine=mips-sei 521a3167c07Ssthen basic_os=seiux 522a3167c07Ssthen ;; 523a3167c07Ssthen sequent) 524a3167c07Ssthen basic_machine=i386-sequent 525a3167c07Ssthen basic_os= 526a3167c07Ssthen ;; 527a3167c07Ssthen sps7) 528a3167c07Ssthen basic_machine=m68k-bull 529a3167c07Ssthen basic_os=sysv2 530a3167c07Ssthen ;; 531a3167c07Ssthen st2000) 532a3167c07Ssthen basic_machine=m68k-tandem 533a3167c07Ssthen basic_os= 534a3167c07Ssthen ;; 535a3167c07Ssthen stratus) 536a3167c07Ssthen basic_machine=i860-stratus 537a3167c07Ssthen basic_os=sysv4 538a3167c07Ssthen ;; 539a3167c07Ssthen sun2) 540a3167c07Ssthen basic_machine=m68000-sun 541a3167c07Ssthen basic_os= 542a3167c07Ssthen ;; 543a3167c07Ssthen sun2os3) 544a3167c07Ssthen basic_machine=m68000-sun 545a3167c07Ssthen basic_os=sunos3 546a3167c07Ssthen ;; 547a3167c07Ssthen sun2os4) 548a3167c07Ssthen basic_machine=m68000-sun 549a3167c07Ssthen basic_os=sunos4 550a3167c07Ssthen ;; 551a3167c07Ssthen sun3) 552a3167c07Ssthen basic_machine=m68k-sun 553a3167c07Ssthen basic_os= 554a3167c07Ssthen ;; 555a3167c07Ssthen sun3os3) 556a3167c07Ssthen basic_machine=m68k-sun 557a3167c07Ssthen basic_os=sunos3 558a3167c07Ssthen ;; 559a3167c07Ssthen sun3os4) 560a3167c07Ssthen basic_machine=m68k-sun 561a3167c07Ssthen basic_os=sunos4 562a3167c07Ssthen ;; 563a3167c07Ssthen sun4) 564a3167c07Ssthen basic_machine=sparc-sun 565a3167c07Ssthen basic_os= 566a3167c07Ssthen ;; 567a3167c07Ssthen sun4os3) 568a3167c07Ssthen basic_machine=sparc-sun 569a3167c07Ssthen basic_os=sunos3 570a3167c07Ssthen ;; 571a3167c07Ssthen sun4os4) 572a3167c07Ssthen basic_machine=sparc-sun 573a3167c07Ssthen basic_os=sunos4 574a3167c07Ssthen ;; 575a3167c07Ssthen sun4sol2) 576a3167c07Ssthen basic_machine=sparc-sun 577a3167c07Ssthen basic_os=solaris2 578a3167c07Ssthen ;; 579a3167c07Ssthen sun386 | sun386i | roadrunner) 580a3167c07Ssthen basic_machine=i386-sun 581a3167c07Ssthen basic_os= 582a3167c07Ssthen ;; 583a3167c07Ssthen sv1) 584a3167c07Ssthen basic_machine=sv1-cray 585a3167c07Ssthen basic_os=unicos 586a3167c07Ssthen ;; 587a3167c07Ssthen symmetry) 588a3167c07Ssthen basic_machine=i386-sequent 589a3167c07Ssthen basic_os=dynix 590a3167c07Ssthen ;; 591a3167c07Ssthen t3e) 592a3167c07Ssthen basic_machine=alphaev5-cray 593a3167c07Ssthen basic_os=unicos 594a3167c07Ssthen ;; 595a3167c07Ssthen t90) 596a3167c07Ssthen basic_machine=t90-cray 597a3167c07Ssthen basic_os=unicos 598a3167c07Ssthen ;; 599a3167c07Ssthen toad1) 600a3167c07Ssthen basic_machine=pdp10-xkl 601a3167c07Ssthen basic_os=tops20 602a3167c07Ssthen ;; 603a3167c07Ssthen tpf) 604a3167c07Ssthen basic_machine=s390x-ibm 605a3167c07Ssthen basic_os=tpf 606a3167c07Ssthen ;; 607a3167c07Ssthen udi29k) 608a3167c07Ssthen basic_machine=a29k-amd 609a3167c07Ssthen basic_os=udi 610a3167c07Ssthen ;; 611a3167c07Ssthen ultra3) 612a3167c07Ssthen basic_machine=a29k-nyu 613a3167c07Ssthen basic_os=sym1 614a3167c07Ssthen ;; 615a3167c07Ssthen v810 | necv810) 616a3167c07Ssthen basic_machine=v810-nec 617a3167c07Ssthen basic_os=none 618a3167c07Ssthen ;; 619a3167c07Ssthen vaxv) 620a3167c07Ssthen basic_machine=vax-dec 621a3167c07Ssthen basic_os=sysv 622a3167c07Ssthen ;; 623a3167c07Ssthen vms) 624a3167c07Ssthen basic_machine=vax-dec 625a3167c07Ssthen basic_os=vms 626a3167c07Ssthen ;; 627a3167c07Ssthen vsta) 628a3167c07Ssthen basic_machine=i386-pc 629a3167c07Ssthen basic_os=vsta 630a3167c07Ssthen ;; 631a3167c07Ssthen vxworks960) 632a3167c07Ssthen basic_machine=i960-wrs 633a3167c07Ssthen basic_os=vxworks 634a3167c07Ssthen ;; 635a3167c07Ssthen vxworks68) 636a3167c07Ssthen basic_machine=m68k-wrs 637a3167c07Ssthen basic_os=vxworks 638a3167c07Ssthen ;; 639a3167c07Ssthen vxworks29k) 640a3167c07Ssthen basic_machine=a29k-wrs 641a3167c07Ssthen basic_os=vxworks 642a3167c07Ssthen ;; 643a3167c07Ssthen xbox) 644a3167c07Ssthen basic_machine=i686-pc 645a3167c07Ssthen basic_os=mingw32 646a3167c07Ssthen ;; 647a3167c07Ssthen ymp) 648a3167c07Ssthen basic_machine=ymp-cray 649a3167c07Ssthen basic_os=unicos 650a3167c07Ssthen ;; 651a3167c07Ssthen *) 652a3167c07Ssthen basic_machine=$1 653a3167c07Ssthen basic_os= 654a3167c07Ssthen ;; 655a3167c07Ssthen esac 656933707f3Ssthen ;; 657933707f3Ssthenesac 658933707f3Ssthen 659a3167c07Ssthen# Decode 1-component or ad-hoc basic machines 660933707f3Ssthencase $basic_machine in 661a3167c07Ssthen # Here we handle the default manufacturer of certain CPU types. It is in 662a3167c07Ssthen # some cases the only manufacturer, in others, it is the most popular. 663a3167c07Ssthen w89k) 664a3167c07Ssthen cpu=hppa1.1 665a3167c07Ssthen vendor=winbond 666a3167c07Ssthen ;; 667a3167c07Ssthen op50n) 668a3167c07Ssthen cpu=hppa1.1 669a3167c07Ssthen vendor=oki 670a3167c07Ssthen ;; 671a3167c07Ssthen op60c) 672a3167c07Ssthen cpu=hppa1.1 673a3167c07Ssthen vendor=oki 674a3167c07Ssthen ;; 675a3167c07Ssthen ibm*) 676a3167c07Ssthen cpu=i370 677a3167c07Ssthen vendor=ibm 678a3167c07Ssthen ;; 679a3167c07Ssthen orion105) 680a3167c07Ssthen cpu=clipper 681a3167c07Ssthen vendor=highlevel 682a3167c07Ssthen ;; 683a3167c07Ssthen mac | mpw | mac-mpw) 684a3167c07Ssthen cpu=m68k 685a3167c07Ssthen vendor=apple 686a3167c07Ssthen ;; 687a3167c07Ssthen pmac | pmac-mpw) 688a3167c07Ssthen cpu=powerpc 689a3167c07Ssthen vendor=apple 690a3167c07Ssthen ;; 691a3167c07Ssthen 692a3167c07Ssthen # Recognize the various machine names and aliases which stand 693a3167c07Ssthen # for a CPU type and a company and sometimes even an OS. 694a3167c07Ssthen 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 695a3167c07Ssthen cpu=m68000 696a3167c07Ssthen vendor=att 697a3167c07Ssthen ;; 698a3167c07Ssthen 3b*) 699a3167c07Ssthen cpu=we32k 700a3167c07Ssthen vendor=att 701a3167c07Ssthen ;; 702a3167c07Ssthen bluegene*) 703a3167c07Ssthen cpu=powerpc 704a3167c07Ssthen vendor=ibm 705a3167c07Ssthen basic_os=cnk 706a3167c07Ssthen ;; 707a3167c07Ssthen decsystem10* | dec10*) 708a3167c07Ssthen cpu=pdp10 709a3167c07Ssthen vendor=dec 710a3167c07Ssthen basic_os=tops10 711a3167c07Ssthen ;; 712a3167c07Ssthen decsystem20* | dec20*) 713a3167c07Ssthen cpu=pdp10 714a3167c07Ssthen vendor=dec 715a3167c07Ssthen basic_os=tops20 716a3167c07Ssthen ;; 717a3167c07Ssthen delta | 3300 | motorola-3300 | motorola-delta \ 718a3167c07Ssthen | 3300-motorola | delta-motorola) 719a3167c07Ssthen cpu=m68k 720a3167c07Ssthen vendor=motorola 721a3167c07Ssthen ;; 722a3167c07Ssthen dpx2*) 723a3167c07Ssthen cpu=m68k 724a3167c07Ssthen vendor=bull 725a3167c07Ssthen basic_os=sysv3 726a3167c07Ssthen ;; 727a3167c07Ssthen encore | umax | mmax) 728a3167c07Ssthen cpu=ns32k 729a3167c07Ssthen vendor=encore 730a3167c07Ssthen ;; 731a3167c07Ssthen elxsi) 732a3167c07Ssthen cpu=elxsi 733a3167c07Ssthen vendor=elxsi 734a3167c07Ssthen basic_os=${basic_os:-bsd} 735a3167c07Ssthen ;; 736a3167c07Ssthen fx2800) 737a3167c07Ssthen cpu=i860 738a3167c07Ssthen vendor=alliant 739a3167c07Ssthen ;; 740a3167c07Ssthen genix) 741a3167c07Ssthen cpu=ns32k 742a3167c07Ssthen vendor=ns 743a3167c07Ssthen ;; 744a3167c07Ssthen h3050r* | hiux*) 745a3167c07Ssthen cpu=hppa1.1 746a3167c07Ssthen vendor=hitachi 747a3167c07Ssthen basic_os=hiuxwe2 748a3167c07Ssthen ;; 749a3167c07Ssthen hp3k9[0-9][0-9] | hp9[0-9][0-9]) 750a3167c07Ssthen cpu=hppa1.0 751a3167c07Ssthen vendor=hp 752a3167c07Ssthen ;; 753a3167c07Ssthen hp9k2[0-9][0-9] | hp9k31[0-9]) 754a3167c07Ssthen cpu=m68000 755a3167c07Ssthen vendor=hp 756a3167c07Ssthen ;; 757a3167c07Ssthen hp9k3[2-9][0-9]) 758a3167c07Ssthen cpu=m68k 759a3167c07Ssthen vendor=hp 760a3167c07Ssthen ;; 761a3167c07Ssthen hp9k6[0-9][0-9] | hp6[0-9][0-9]) 762a3167c07Ssthen cpu=hppa1.0 763a3167c07Ssthen vendor=hp 764a3167c07Ssthen ;; 765a3167c07Ssthen hp9k7[0-79][0-9] | hp7[0-79][0-9]) 766a3167c07Ssthen cpu=hppa1.1 767a3167c07Ssthen vendor=hp 768a3167c07Ssthen ;; 769a3167c07Ssthen hp9k78[0-9] | hp78[0-9]) 770a3167c07Ssthen # FIXME: really hppa2.0-hp 771a3167c07Ssthen cpu=hppa1.1 772a3167c07Ssthen vendor=hp 773a3167c07Ssthen ;; 774a3167c07Ssthen hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 775a3167c07Ssthen # FIXME: really hppa2.0-hp 776a3167c07Ssthen cpu=hppa1.1 777a3167c07Ssthen vendor=hp 778a3167c07Ssthen ;; 779a3167c07Ssthen hp9k8[0-9][13679] | hp8[0-9][13679]) 780a3167c07Ssthen cpu=hppa1.1 781a3167c07Ssthen vendor=hp 782a3167c07Ssthen ;; 783a3167c07Ssthen hp9k8[0-9][0-9] | hp8[0-9][0-9]) 784a3167c07Ssthen cpu=hppa1.0 785a3167c07Ssthen vendor=hp 786a3167c07Ssthen ;; 787a3167c07Ssthen i*86v32) 788191f22c6Ssthen cpu=`echo "$1" | sed -e 's/86.*/86/'` 789a3167c07Ssthen vendor=pc 790a3167c07Ssthen basic_os=sysv32 791a3167c07Ssthen ;; 792a3167c07Ssthen i*86v4*) 793191f22c6Ssthen cpu=`echo "$1" | sed -e 's/86.*/86/'` 794a3167c07Ssthen vendor=pc 795a3167c07Ssthen basic_os=sysv4 796a3167c07Ssthen ;; 797a3167c07Ssthen i*86v) 798191f22c6Ssthen cpu=`echo "$1" | sed -e 's/86.*/86/'` 799a3167c07Ssthen vendor=pc 800a3167c07Ssthen basic_os=sysv 801a3167c07Ssthen ;; 802a3167c07Ssthen i*86sol2) 803191f22c6Ssthen cpu=`echo "$1" | sed -e 's/86.*/86/'` 804a3167c07Ssthen vendor=pc 805a3167c07Ssthen basic_os=solaris2 806a3167c07Ssthen ;; 807a3167c07Ssthen j90 | j90-cray) 808a3167c07Ssthen cpu=j90 809a3167c07Ssthen vendor=cray 810a3167c07Ssthen basic_os=${basic_os:-unicos} 811a3167c07Ssthen ;; 812a3167c07Ssthen iris | iris4d) 813a3167c07Ssthen cpu=mips 814a3167c07Ssthen vendor=sgi 815a3167c07Ssthen case $basic_os in 816a3167c07Ssthen irix*) 817a3167c07Ssthen ;; 818a3167c07Ssthen *) 819a3167c07Ssthen basic_os=irix4 820a3167c07Ssthen ;; 821a3167c07Ssthen esac 822a3167c07Ssthen ;; 823a3167c07Ssthen miniframe) 824a3167c07Ssthen cpu=m68000 825a3167c07Ssthen vendor=convergent 826a3167c07Ssthen ;; 827a3167c07Ssthen *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 828a3167c07Ssthen cpu=m68k 829a3167c07Ssthen vendor=atari 830a3167c07Ssthen basic_os=mint 831a3167c07Ssthen ;; 832a3167c07Ssthen news-3600 | risc-news) 833a3167c07Ssthen cpu=mips 834a3167c07Ssthen vendor=sony 835a3167c07Ssthen basic_os=newsos 836a3167c07Ssthen ;; 837a3167c07Ssthen next | m*-next) 838a3167c07Ssthen cpu=m68k 839a3167c07Ssthen vendor=next 840a3167c07Ssthen case $basic_os in 841a3167c07Ssthen openstep*) 842a3167c07Ssthen ;; 843a3167c07Ssthen nextstep*) 844a3167c07Ssthen ;; 845a3167c07Ssthen ns2*) 846a3167c07Ssthen basic_os=nextstep2 847a3167c07Ssthen ;; 848a3167c07Ssthen *) 849a3167c07Ssthen basic_os=nextstep3 850a3167c07Ssthen ;; 851a3167c07Ssthen esac 852a3167c07Ssthen ;; 853a3167c07Ssthen np1) 854a3167c07Ssthen cpu=np1 855a3167c07Ssthen vendor=gould 856a3167c07Ssthen ;; 857a3167c07Ssthen op50n-* | op60c-*) 858a3167c07Ssthen cpu=hppa1.1 859a3167c07Ssthen vendor=oki 860a3167c07Ssthen basic_os=proelf 861a3167c07Ssthen ;; 862a3167c07Ssthen pa-hitachi) 863a3167c07Ssthen cpu=hppa1.1 864a3167c07Ssthen vendor=hitachi 865a3167c07Ssthen basic_os=hiuxwe2 866a3167c07Ssthen ;; 867a3167c07Ssthen pbd) 868a3167c07Ssthen cpu=sparc 869a3167c07Ssthen vendor=tti 870a3167c07Ssthen ;; 871a3167c07Ssthen pbb) 872a3167c07Ssthen cpu=m68k 873a3167c07Ssthen vendor=tti 874a3167c07Ssthen ;; 875a3167c07Ssthen pc532) 876a3167c07Ssthen cpu=ns32k 877a3167c07Ssthen vendor=pc532 878a3167c07Ssthen ;; 879a3167c07Ssthen pn) 880a3167c07Ssthen cpu=pn 881a3167c07Ssthen vendor=gould 882a3167c07Ssthen ;; 883a3167c07Ssthen power) 884a3167c07Ssthen cpu=power 885a3167c07Ssthen vendor=ibm 886a3167c07Ssthen ;; 887a3167c07Ssthen ps2) 888a3167c07Ssthen cpu=i386 889a3167c07Ssthen vendor=ibm 890a3167c07Ssthen ;; 891a3167c07Ssthen rm[46]00) 892a3167c07Ssthen cpu=mips 893a3167c07Ssthen vendor=siemens 894a3167c07Ssthen ;; 895a3167c07Ssthen rtpc | rtpc-*) 896a3167c07Ssthen cpu=romp 897a3167c07Ssthen vendor=ibm 898a3167c07Ssthen ;; 899a3167c07Ssthen sde) 900a3167c07Ssthen cpu=mipsisa32 901a3167c07Ssthen vendor=sde 902a3167c07Ssthen basic_os=${basic_os:-elf} 903a3167c07Ssthen ;; 904a3167c07Ssthen simso-wrs) 905a3167c07Ssthen cpu=sparclite 906a3167c07Ssthen vendor=wrs 907a3167c07Ssthen basic_os=vxworks 908a3167c07Ssthen ;; 909a3167c07Ssthen tower | tower-32) 910a3167c07Ssthen cpu=m68k 911a3167c07Ssthen vendor=ncr 912a3167c07Ssthen ;; 913a3167c07Ssthen vpp*|vx|vx-*) 914a3167c07Ssthen cpu=f301 915a3167c07Ssthen vendor=fujitsu 916a3167c07Ssthen ;; 917a3167c07Ssthen w65) 918a3167c07Ssthen cpu=w65 919a3167c07Ssthen vendor=wdc 920a3167c07Ssthen ;; 921a3167c07Ssthen w89k-*) 922a3167c07Ssthen cpu=hppa1.1 923a3167c07Ssthen vendor=winbond 924a3167c07Ssthen basic_os=proelf 925a3167c07Ssthen ;; 926a3167c07Ssthen none) 927a3167c07Ssthen cpu=none 928a3167c07Ssthen vendor=none 929a3167c07Ssthen ;; 930a3167c07Ssthen leon|leon[3-9]) 931a3167c07Ssthen cpu=sparc 932a3167c07Ssthen vendor=$basic_machine 933a3167c07Ssthen ;; 934a3167c07Ssthen leon-*|leon[3-9]-*) 935a3167c07Ssthen cpu=sparc 936191f22c6Ssthen vendor=`echo "$basic_machine" | sed 's/-.*//'` 937a3167c07Ssthen ;; 938a3167c07Ssthen 939a3167c07Ssthen *-*) 940a3167c07Ssthen # shellcheck disable=SC2162 941e21c60efSsthen saved_IFS=$IFS 942a3167c07Ssthen IFS="-" read cpu vendor <<EOF 943a3167c07Ssthen$basic_machine 944a3167c07SsthenEOF 945e21c60efSsthen IFS=$saved_IFS 946a3167c07Ssthen ;; 947*8b7325afSsthen # We use 'pc' rather than 'unknown' 948a3167c07Ssthen # because (1) that's what they normally are, and 949a3167c07Ssthen # (2) the word "unknown" tends to confuse beginning users. 950a3167c07Ssthen i*86 | x86_64) 951a3167c07Ssthen cpu=$basic_machine 952a3167c07Ssthen vendor=pc 953a3167c07Ssthen ;; 954a3167c07Ssthen # These rules are duplicated from below for sake of the special case above; 955a3167c07Ssthen # i.e. things that normalized to x86 arches should also default to "pc" 956a3167c07Ssthen pc98) 957a3167c07Ssthen cpu=i386 958a3167c07Ssthen vendor=pc 959a3167c07Ssthen ;; 960a3167c07Ssthen x64 | amd64) 961a3167c07Ssthen cpu=x86_64 962a3167c07Ssthen vendor=pc 963a3167c07Ssthen ;; 964933707f3Ssthen # Recognize the basic CPU types without company name. 965a3167c07Ssthen *) 966a3167c07Ssthen cpu=$basic_machine 967a3167c07Ssthen vendor=unknown 968a3167c07Ssthen ;; 969a3167c07Ssthenesac 970a3167c07Ssthen 971a3167c07Ssthenunset -v basic_machine 972a3167c07Ssthen 973a3167c07Ssthen# Decode basic machines in the full and proper CPU-Company form. 974a3167c07Ssthencase $cpu-$vendor in 975a3167c07Ssthen # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 976a3167c07Ssthen # some cases the only manufacturer, in others, it is the most popular. 977a3167c07Ssthen craynv-unknown) 978a3167c07Ssthen vendor=cray 979a3167c07Ssthen basic_os=${basic_os:-unicosmp} 980a3167c07Ssthen ;; 981a3167c07Ssthen c90-unknown | c90-cray) 982a3167c07Ssthen vendor=cray 983a3167c07Ssthen basic_os=${Basic_os:-unicos} 984a3167c07Ssthen ;; 985a3167c07Ssthen fx80-unknown) 986a3167c07Ssthen vendor=alliant 987a3167c07Ssthen ;; 988a3167c07Ssthen romp-unknown) 989a3167c07Ssthen vendor=ibm 990a3167c07Ssthen ;; 991a3167c07Ssthen mmix-unknown) 992a3167c07Ssthen vendor=knuth 993a3167c07Ssthen ;; 994a3167c07Ssthen microblaze-unknown | microblazeel-unknown) 995a3167c07Ssthen vendor=xilinx 996a3167c07Ssthen ;; 997a3167c07Ssthen rs6000-unknown) 998a3167c07Ssthen vendor=ibm 999a3167c07Ssthen ;; 1000a3167c07Ssthen vax-unknown) 1001a3167c07Ssthen vendor=dec 1002a3167c07Ssthen ;; 1003a3167c07Ssthen pdp11-unknown) 1004a3167c07Ssthen vendor=dec 1005a3167c07Ssthen ;; 1006a3167c07Ssthen we32k-unknown) 1007a3167c07Ssthen vendor=att 1008a3167c07Ssthen ;; 1009a3167c07Ssthen cydra-unknown) 1010a3167c07Ssthen vendor=cydrome 1011a3167c07Ssthen ;; 1012a3167c07Ssthen i370-ibm*) 1013a3167c07Ssthen vendor=ibm 1014a3167c07Ssthen ;; 1015a3167c07Ssthen orion-unknown) 1016a3167c07Ssthen vendor=highlevel 1017a3167c07Ssthen ;; 1018a3167c07Ssthen xps-unknown | xps100-unknown) 1019a3167c07Ssthen cpu=xps100 1020a3167c07Ssthen vendor=honeywell 1021a3167c07Ssthen ;; 1022a3167c07Ssthen 1023a3167c07Ssthen # Here we normalize CPU types with a missing or matching vendor 1024e21c60efSsthen armh-unknown | armh-alt) 1025e21c60efSsthen cpu=armv7l 1026e21c60efSsthen vendor=alt 1027e21c60efSsthen basic_os=${basic_os:-linux-gnueabihf} 1028e21c60efSsthen ;; 1029a3167c07Ssthen dpx20-unknown | dpx20-bull) 1030a3167c07Ssthen cpu=rs6000 1031a3167c07Ssthen vendor=bull 1032a3167c07Ssthen basic_os=${basic_os:-bosx} 1033a3167c07Ssthen ;; 1034a3167c07Ssthen 1035a3167c07Ssthen # Here we normalize CPU types irrespective of the vendor 1036a3167c07Ssthen amd64-*) 1037a3167c07Ssthen cpu=x86_64 1038a3167c07Ssthen ;; 1039a3167c07Ssthen blackfin-*) 1040a3167c07Ssthen cpu=bfin 1041a3167c07Ssthen basic_os=linux 1042a3167c07Ssthen ;; 1043a3167c07Ssthen c54x-*) 1044a3167c07Ssthen cpu=tic54x 1045a3167c07Ssthen ;; 1046a3167c07Ssthen c55x-*) 1047a3167c07Ssthen cpu=tic55x 1048a3167c07Ssthen ;; 1049a3167c07Ssthen c6x-*) 1050a3167c07Ssthen cpu=tic6x 1051a3167c07Ssthen ;; 1052a3167c07Ssthen e500v[12]-*) 1053a3167c07Ssthen cpu=powerpc 1054a3167c07Ssthen basic_os=${basic_os}"spe" 1055a3167c07Ssthen ;; 1056a3167c07Ssthen mips3*-*) 1057a3167c07Ssthen cpu=mips64 1058a3167c07Ssthen ;; 1059a3167c07Ssthen ms1-*) 1060a3167c07Ssthen cpu=mt 1061a3167c07Ssthen ;; 1062a3167c07Ssthen m68knommu-*) 1063a3167c07Ssthen cpu=m68k 1064a3167c07Ssthen basic_os=linux 1065a3167c07Ssthen ;; 1066a3167c07Ssthen m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 1067a3167c07Ssthen cpu=s12z 1068a3167c07Ssthen ;; 1069a3167c07Ssthen openrisc-*) 1070a3167c07Ssthen cpu=or32 1071a3167c07Ssthen ;; 1072a3167c07Ssthen parisc-*) 1073a3167c07Ssthen cpu=hppa 1074a3167c07Ssthen basic_os=linux 1075a3167c07Ssthen ;; 1076a3167c07Ssthen pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1077a3167c07Ssthen cpu=i586 1078a3167c07Ssthen ;; 1079*8b7325afSsthen pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 1080a3167c07Ssthen cpu=i686 1081a3167c07Ssthen ;; 1082a3167c07Ssthen pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1083a3167c07Ssthen cpu=i686 1084a3167c07Ssthen ;; 1085a3167c07Ssthen pentium4-*) 1086a3167c07Ssthen cpu=i786 1087a3167c07Ssthen ;; 1088a3167c07Ssthen pc98-*) 1089a3167c07Ssthen cpu=i386 1090a3167c07Ssthen ;; 1091a3167c07Ssthen ppc-* | ppcbe-*) 1092a3167c07Ssthen cpu=powerpc 1093a3167c07Ssthen ;; 1094a3167c07Ssthen ppcle-* | powerpclittle-*) 1095a3167c07Ssthen cpu=powerpcle 1096a3167c07Ssthen ;; 1097a3167c07Ssthen ppc64-*) 1098a3167c07Ssthen cpu=powerpc64 1099a3167c07Ssthen ;; 1100a3167c07Ssthen ppc64le-* | powerpc64little-*) 1101a3167c07Ssthen cpu=powerpc64le 1102a3167c07Ssthen ;; 1103a3167c07Ssthen sb1-*) 1104a3167c07Ssthen cpu=mipsisa64sb1 1105a3167c07Ssthen ;; 1106a3167c07Ssthen sb1el-*) 1107a3167c07Ssthen cpu=mipsisa64sb1el 1108a3167c07Ssthen ;; 1109a3167c07Ssthen sh5e[lb]-*) 1110191f22c6Ssthen cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 1111a3167c07Ssthen ;; 1112a3167c07Ssthen spur-*) 1113a3167c07Ssthen cpu=spur 1114a3167c07Ssthen ;; 1115a3167c07Ssthen strongarm-* | thumb-*) 1116a3167c07Ssthen cpu=arm 1117a3167c07Ssthen ;; 1118a3167c07Ssthen tx39-*) 1119a3167c07Ssthen cpu=mipstx39 1120a3167c07Ssthen ;; 1121a3167c07Ssthen tx39el-*) 1122a3167c07Ssthen cpu=mipstx39el 1123a3167c07Ssthen ;; 1124a3167c07Ssthen x64-*) 1125a3167c07Ssthen cpu=x86_64 1126a3167c07Ssthen ;; 1127a3167c07Ssthen xscale-* | xscalee[bl]-*) 1128191f22c6Ssthen cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 1129a3167c07Ssthen ;; 1130e21c60efSsthen arm64-* | aarch64le-*) 1131a3167c07Ssthen cpu=aarch64 1132a3167c07Ssthen ;; 1133a3167c07Ssthen 1134a3167c07Ssthen # Recognize the canonical CPU Types that limit and/or modify the 1135a3167c07Ssthen # company names they are paired with. 1136a3167c07Ssthen cr16-*) 1137a3167c07Ssthen basic_os=${basic_os:-elf} 1138a3167c07Ssthen ;; 1139a3167c07Ssthen crisv32-* | etraxfs*-*) 1140a3167c07Ssthen cpu=crisv32 1141a3167c07Ssthen vendor=axis 1142a3167c07Ssthen ;; 1143a3167c07Ssthen cris-* | etrax*-*) 1144a3167c07Ssthen cpu=cris 1145a3167c07Ssthen vendor=axis 1146a3167c07Ssthen ;; 1147a3167c07Ssthen crx-*) 1148a3167c07Ssthen basic_os=${basic_os:-elf} 1149a3167c07Ssthen ;; 1150a3167c07Ssthen neo-tandem) 1151a3167c07Ssthen cpu=neo 1152a3167c07Ssthen vendor=tandem 1153a3167c07Ssthen ;; 1154a3167c07Ssthen nse-tandem) 1155a3167c07Ssthen cpu=nse 1156a3167c07Ssthen vendor=tandem 1157a3167c07Ssthen ;; 1158a3167c07Ssthen nsr-tandem) 1159a3167c07Ssthen cpu=nsr 1160a3167c07Ssthen vendor=tandem 1161a3167c07Ssthen ;; 1162a3167c07Ssthen nsv-tandem) 1163a3167c07Ssthen cpu=nsv 1164a3167c07Ssthen vendor=tandem 1165a3167c07Ssthen ;; 1166a3167c07Ssthen nsx-tandem) 1167a3167c07Ssthen cpu=nsx 1168a3167c07Ssthen vendor=tandem 1169a3167c07Ssthen ;; 1170a3167c07Ssthen mipsallegrexel-sony) 1171a3167c07Ssthen cpu=mipsallegrexel 1172a3167c07Ssthen vendor=sony 1173a3167c07Ssthen ;; 1174a3167c07Ssthen tile*-*) 1175a3167c07Ssthen basic_os=${basic_os:-linux-gnu} 1176a3167c07Ssthen ;; 1177a3167c07Ssthen 1178a3167c07Ssthen *) 1179a3167c07Ssthen # Recognize the canonical CPU types that are allowed with any 1180a3167c07Ssthen # company name. 1181a3167c07Ssthen case $cpu in 1182933707f3Ssthen 1750a | 580 \ 1183933707f3Ssthen | a29k \ 1184229e174cSsthen | aarch64 | aarch64_be \ 1185a3167c07Ssthen | abacus \ 1186a3167c07Ssthen | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 1187a3167c07Ssthen | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 1188a3167c07Ssthen | alphapca5[67] | alpha64pca5[67] \ 1189933707f3Ssthen | am33_2.0 \ 1190a3167c07Ssthen | amdgcn \ 1191191f22c6Ssthen | arc | arceb | arc32 | arc64 \ 1192a3167c07Ssthen | arm | arm[lb]e | arme[lb] | armv* \ 119398f3ca02Sbrad | avr | avr32 \ 1194a3167c07Ssthen | asmjs \ 11950990ddf5Ssthen | ba \ 1196229e174cSsthen | be32 | be64 \ 1197a3167c07Ssthen | bfin | bpf | bs2000 \ 1198a3167c07Ssthen | c[123]* | c30 | [cjt]90 | c4x \ 1199a3167c07Ssthen | c8051 | clipper | craynv | csky | cydra \ 1200933707f3Ssthen | d10v | d30v | dlx | dsp16xx \ 1201a3167c07Ssthen | e2k | elxsi | epiphany \ 1202a3167c07Ssthen | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1203a3167c07Ssthen | h8300 | h8500 \ 1204a3167c07Ssthen | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 1205229e174cSsthen | hexagon \ 1206a3167c07Ssthen | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 1207933707f3Ssthen | ip2k | iq2000 \ 12080990ddf5Ssthen | k1om \ 1209*8b7325afSsthen | kvx \ 1210229e174cSsthen | le32 | le64 \ 1211933707f3Ssthen | lm32 \ 12127dd170e2Ssthen | loongarch32 | loongarch64 \ 1213a3167c07Ssthen | m32c | m32r | m32rle \ 1214a3167c07Ssthen | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 1215a3167c07Ssthen | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 1216a3167c07Ssthen | m88110 | m88k | maxq | mb | mcore | mep | metag \ 1217a3167c07Ssthen | microblaze | microblazeel \ 1218*8b7325afSsthen | mips* \ 1219a3167c07Ssthen | mmix \ 1220933707f3Ssthen | mn10200 | mn10300 \ 1221933707f3Ssthen | moxie \ 1222933707f3Ssthen | mt \ 1223933707f3Ssthen | msp430 \ 1224229e174cSsthen | nds32 | nds32le | nds32be \ 1225a3167c07Ssthen | nfp \ 122698f3ca02Sbrad | nios | nios2 | nios2eb | nios2el \ 1227a3167c07Ssthen | none | np1 | ns16k | ns32k | nvptx \ 1228a3167c07Ssthen | open8 \ 1229a3167c07Ssthen | or1k* \ 1230a3167c07Ssthen | or32 \ 1231a3167c07Ssthen | orion \ 1232a3167c07Ssthen | picochip \ 1233a3167c07Ssthen | pdp10 | pdp11 | pj | pjl | pn | power \ 1234a3167c07Ssthen | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 1235a3167c07Ssthen | pru \ 1236933707f3Ssthen | pyramid \ 12379982a05dSsthen | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 1238a3167c07Ssthen | rl78 | romp | rs6000 | rx \ 1239a3167c07Ssthen | s390 | s390x \ 1240933707f3Ssthen | score \ 1241a3167c07Ssthen | sh | shl \ 1242a3167c07Ssthen | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 1243a3167c07Ssthen | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 1244a3167c07Ssthen | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 1245a3167c07Ssthen | sparclite \ 1246a3167c07Ssthen | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 1247229e174cSsthen | spu \ 1248a3167c07Ssthen | tahoe \ 1249eba819a2Ssthen | thumbv7* \ 1250a3167c07Ssthen | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 1251a3167c07Ssthen | tron \ 1252933707f3Ssthen | ubicom32 \ 1253a3167c07Ssthen | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 1254a3167c07Ssthen | vax \ 12550990ddf5Ssthen | visium \ 1256a3167c07Ssthen | w65 \ 1257a3167c07Ssthen | wasm32 | wasm64 \ 1258eaf2578eSsthen | we32k \ 1259a3167c07Ssthen | x86 | x86_64 | xc16x | xgate | xps100 \ 1260a3167c07Ssthen | xstormy16 | xtensa* \ 1261a3167c07Ssthen | ymp \ 1262933707f3Ssthen | z8k | z80) 1263933707f3Ssthen ;; 1264933707f3Ssthen 1265a3167c07Ssthen *) 1266*8b7325afSsthen echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 1267933707f3Ssthen exit 1 1268933707f3Ssthen ;; 1269933707f3Ssthen esac 1270933707f3Ssthen ;; 1271933707f3Ssthenesac 1272933707f3Ssthen 1273933707f3Ssthen# Here we canonicalize certain aliases for manufacturers. 1274a3167c07Ssthencase $vendor in 1275a3167c07Ssthen digital*) 1276a3167c07Ssthen vendor=dec 1277933707f3Ssthen ;; 1278a3167c07Ssthen commodore*) 1279a3167c07Ssthen vendor=cbm 1280933707f3Ssthen ;; 1281933707f3Ssthen *) 1282933707f3Ssthen ;; 1283933707f3Ssthenesac 1284933707f3Ssthen 1285933707f3Ssthen# Decode manufacturer-specific aliases for certain operating systems. 1286933707f3Ssthen 12872c144df0Ssthenif test x$basic_os != x 1288933707f3Ssthenthen 1289a3167c07Ssthen 1290e21c60efSsthen# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 1291a3167c07Ssthen# set os. 1292a3167c07Ssthencase $basic_os in 1293a3167c07Ssthen gnu/linux*) 1294a3167c07Ssthen kernel=linux 1295191f22c6Ssthen os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 1296eba819a2Ssthen ;; 1297eba819a2Ssthen os2-emx) 1298eba819a2Ssthen kernel=os2 1299191f22c6Ssthen os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 1300933707f3Ssthen ;; 1301a3167c07Ssthen nto-qnx*) 1302a3167c07Ssthen kernel=nto 1303191f22c6Ssthen os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 1304a3167c07Ssthen ;; 1305a3167c07Ssthen *-*) 1306a3167c07Ssthen # shellcheck disable=SC2162 1307e21c60efSsthen saved_IFS=$IFS 1308a3167c07Ssthen IFS="-" read kernel os <<EOF 1309a3167c07Ssthen$basic_os 1310a3167c07SsthenEOF 1311e21c60efSsthen IFS=$saved_IFS 1312a3167c07Ssthen ;; 1313a3167c07Ssthen # Default OS when just kernel was specified 1314a3167c07Ssthen nto*) 1315a3167c07Ssthen kernel=nto 1316191f22c6Ssthen os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 1317a3167c07Ssthen ;; 1318a3167c07Ssthen linux*) 1319a3167c07Ssthen kernel=linux 1320191f22c6Ssthen os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 1321a3167c07Ssthen ;; 132245872187Ssthen managarm*) 132345872187Ssthen kernel=managarm 132445872187Ssthen os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 132545872187Ssthen ;; 1326a3167c07Ssthen *) 1327a3167c07Ssthen kernel= 1328a3167c07Ssthen os=$basic_os 1329a3167c07Ssthen ;; 1330a3167c07Ssthenesac 1331a3167c07Ssthen 1332a3167c07Ssthen# Now, normalize the OS (knowing we just have one component, it's not a kernel, 1333a3167c07Ssthen# etc.) 1334a3167c07Ssthencase $os in 1335a3167c07Ssthen # First match some system type aliases that might get confused 1336a3167c07Ssthen # with valid system types. 1337a3167c07Ssthen # solaris* is a basic system type, with this one exception. 1338a3167c07Ssthen auroraux) 1339a3167c07Ssthen os=auroraux 1340a3167c07Ssthen ;; 1341a3167c07Ssthen bluegene*) 1342a3167c07Ssthen os=cnk 1343a3167c07Ssthen ;; 1344a3167c07Ssthen solaris1 | solaris1.*) 1345191f22c6Ssthen os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 1346933707f3Ssthen ;; 1347a3167c07Ssthen solaris) 1348a3167c07Ssthen os=solaris2 1349933707f3Ssthen ;; 1350a3167c07Ssthen unixware*) 1351a3167c07Ssthen os=sysv4.2uw 1352eaf2578eSsthen ;; 1353a3167c07Ssthen # es1800 is here to avoid being matched by es* (a different OS) 1354a3167c07Ssthen es1800*) 1355a3167c07Ssthen os=ose 1356933707f3Ssthen ;; 1357a3167c07Ssthen # Some version numbers need modification 1358a3167c07Ssthen chorusos*) 1359a3167c07Ssthen os=chorusos 1360933707f3Ssthen ;; 1361a3167c07Ssthen isc) 1362a3167c07Ssthen os=isc2.2 1363933707f3Ssthen ;; 1364a3167c07Ssthen sco6) 1365a3167c07Ssthen os=sco5v6 1366a3167c07Ssthen ;; 1367a3167c07Ssthen sco5) 1368a3167c07Ssthen os=sco3.2v5 1369a3167c07Ssthen ;; 1370a3167c07Ssthen sco4) 1371a3167c07Ssthen os=sco3.2v4 1372a3167c07Ssthen ;; 1373a3167c07Ssthen sco3.2.[4-9]*) 1374191f22c6Ssthen os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 1375a3167c07Ssthen ;; 1376a3167c07Ssthen sco*v* | scout) 1377a3167c07Ssthen # Don't match below 1378a3167c07Ssthen ;; 1379a3167c07Ssthen sco*) 1380a3167c07Ssthen os=sco3.2v2 1381a3167c07Ssthen ;; 1382a3167c07Ssthen psos*) 1383a3167c07Ssthen os=psos 1384a3167c07Ssthen ;; 1385a3167c07Ssthen qnx*) 13862c144df0Ssthen os=qnx 1387933707f3Ssthen ;; 1388a3167c07Ssthen hiux*) 1389a3167c07Ssthen os=hiuxwe2 1390933707f3Ssthen ;; 1391a3167c07Ssthen lynx*178) 1392a3167c07Ssthen os=lynxos178 1393933707f3Ssthen ;; 1394a3167c07Ssthen lynx*5) 1395a3167c07Ssthen os=lynxos5 1396933707f3Ssthen ;; 1397a3167c07Ssthen lynxos*) 1398a3167c07Ssthen # don't get caught up in next wildcard 1399933707f3Ssthen ;; 1400a3167c07Ssthen lynx*) 1401a3167c07Ssthen os=lynxos 1402933707f3Ssthen ;; 1403a3167c07Ssthen mac[0-9]*) 1404191f22c6Ssthen os=`echo "$os" | sed -e 's|mac|macos|'` 1405933707f3Ssthen ;; 1406a3167c07Ssthen opened*) 1407a3167c07Ssthen os=openedition 1408933707f3Ssthen ;; 1409a3167c07Ssthen os400*) 1410a3167c07Ssthen os=os400 1411933707f3Ssthen ;; 1412a3167c07Ssthen sunos5*) 1413191f22c6Ssthen os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1414933707f3Ssthen ;; 1415a3167c07Ssthen sunos6*) 1416191f22c6Ssthen os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1417933707f3Ssthen ;; 1418a3167c07Ssthen wince*) 1419a3167c07Ssthen os=wince 1420933707f3Ssthen ;; 1421a3167c07Ssthen utek*) 1422a3167c07Ssthen os=bsd 1423eaf2578eSsthen ;; 1424a3167c07Ssthen dynix*) 1425a3167c07Ssthen os=bsd 1426eaf2578eSsthen ;; 1427a3167c07Ssthen acis*) 1428a3167c07Ssthen os=aos 1429933707f3Ssthen ;; 1430a3167c07Ssthen atheos*) 1431a3167c07Ssthen os=atheos 1432933707f3Ssthen ;; 1433a3167c07Ssthen syllable*) 1434a3167c07Ssthen os=syllable 1435933707f3Ssthen ;; 1436a3167c07Ssthen 386bsd) 1437a3167c07Ssthen os=bsd 1438933707f3Ssthen ;; 1439a3167c07Ssthen ctix* | uts*) 1440a3167c07Ssthen os=sysv 1441933707f3Ssthen ;; 1442a3167c07Ssthen nova*) 1443a3167c07Ssthen os=rtmk-nova 1444933707f3Ssthen ;; 1445a3167c07Ssthen ns2) 1446a3167c07Ssthen os=nextstep2 1447933707f3Ssthen ;; 1448933707f3Ssthen # Preserve the version number of sinix5. 1449a3167c07Ssthen sinix5.*) 1450191f22c6Ssthen os=`echo "$os" | sed -e 's|sinix|sysv|'` 1451933707f3Ssthen ;; 1452a3167c07Ssthen sinix*) 1453a3167c07Ssthen os=sysv4 1454933707f3Ssthen ;; 1455a3167c07Ssthen tpf*) 1456a3167c07Ssthen os=tpf 1457933707f3Ssthen ;; 1458a3167c07Ssthen triton*) 1459a3167c07Ssthen os=sysv3 1460933707f3Ssthen ;; 1461a3167c07Ssthen oss*) 1462a3167c07Ssthen os=sysv3 1463933707f3Ssthen ;; 1464a3167c07Ssthen svr4*) 1465a3167c07Ssthen os=sysv4 1466933707f3Ssthen ;; 1467a3167c07Ssthen svr3) 1468a3167c07Ssthen os=sysv3 1469933707f3Ssthen ;; 1470a3167c07Ssthen sysvr4) 1471a3167c07Ssthen os=sysv4 1472933707f3Ssthen ;; 1473a3167c07Ssthen ose*) 1474a3167c07Ssthen os=ose 1475933707f3Ssthen ;; 1476a3167c07Ssthen *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1477a3167c07Ssthen os=mint 1478933707f3Ssthen ;; 1479a3167c07Ssthen dicos*) 1480a3167c07Ssthen os=dicos 1481eaf2578eSsthen ;; 1482a3167c07Ssthen pikeos*) 1483a3167c07Ssthen # Until real need of OS specific support for 1484a3167c07Ssthen # particular features comes up, bare metal 1485a3167c07Ssthen # configurations are quite functional. 1486a3167c07Ssthen case $cpu in 1487a3167c07Ssthen arm*) 1488a3167c07Ssthen os=eabi 1489933707f3Ssthen ;; 1490933707f3Ssthen *) 1491a3167c07Ssthen os=elf 1492933707f3Ssthen ;; 1493933707f3Ssthen esac 1494a3167c07Ssthen ;; 1495a3167c07Ssthen *) 1496a3167c07Ssthen # No normalization, but not necessarily accepted, that comes below. 1497a3167c07Ssthen ;; 1498a3167c07Ssthenesac 1499a3167c07Ssthen 1500933707f3Ssthenelse 1501933707f3Ssthen 1502933707f3Ssthen# Here we handle the default operating systems that come with various machines. 1503933707f3Ssthen# The value should be what the vendor currently ships out the door with their 1504933707f3Ssthen# machine or put another way, the most popular os provided with the machine. 1505933707f3Ssthen 1506933707f3Ssthen# Note that if you're going to try to match "-MANUFACTURER" here (say, 1507933707f3Ssthen# "-sun"), then you have to tell the case statement up towards the top 1508933707f3Ssthen# that MANUFACTURER isn't an operating system. Otherwise, code above 1509933707f3Ssthen# will signal an error saying that MANUFACTURER isn't an operating 1510933707f3Ssthen# system, and we'll never get to this point. 1511933707f3Ssthen 1512a3167c07Ssthenkernel= 1513a3167c07Ssthencase $cpu-$vendor in 1514933707f3Ssthen score-*) 1515a3167c07Ssthen os=elf 1516933707f3Ssthen ;; 1517933707f3Ssthen spu-*) 1518a3167c07Ssthen os=elf 1519933707f3Ssthen ;; 1520933707f3Ssthen *-acorn) 1521a3167c07Ssthen os=riscix1.2 1522933707f3Ssthen ;; 1523933707f3Ssthen arm*-rebel) 1524a3167c07Ssthen kernel=linux 1525a3167c07Ssthen os=gnu 1526933707f3Ssthen ;; 1527933707f3Ssthen arm*-semi) 1528a3167c07Ssthen os=aout 1529933707f3Ssthen ;; 1530933707f3Ssthen c4x-* | tic4x-*) 1531a3167c07Ssthen os=coff 1532933707f3Ssthen ;; 153398f3ca02Sbrad c8051-*) 1534a3167c07Ssthen os=elf 1535a3167c07Ssthen ;; 1536a3167c07Ssthen clipper-intergraph) 1537a3167c07Ssthen os=clix 153898f3ca02Sbrad ;; 1539229e174cSsthen hexagon-*) 1540a3167c07Ssthen os=elf 1541229e174cSsthen ;; 1542229e174cSsthen tic54x-*) 1543a3167c07Ssthen os=coff 1544229e174cSsthen ;; 1545229e174cSsthen tic55x-*) 1546a3167c07Ssthen os=coff 1547229e174cSsthen ;; 1548229e174cSsthen tic6x-*) 1549a3167c07Ssthen os=coff 1550229e174cSsthen ;; 1551933707f3Ssthen # This must come before the *-dec entry. 1552933707f3Ssthen pdp10-*) 1553a3167c07Ssthen os=tops20 1554933707f3Ssthen ;; 1555933707f3Ssthen pdp11-*) 1556a3167c07Ssthen os=none 1557933707f3Ssthen ;; 1558933707f3Ssthen *-dec | vax-*) 1559a3167c07Ssthen os=ultrix4.2 1560933707f3Ssthen ;; 1561933707f3Ssthen m68*-apollo) 1562a3167c07Ssthen os=domain 1563933707f3Ssthen ;; 1564933707f3Ssthen i386-sun) 1565a3167c07Ssthen os=sunos4.0.2 1566933707f3Ssthen ;; 1567933707f3Ssthen m68000-sun) 1568a3167c07Ssthen os=sunos3 1569933707f3Ssthen ;; 1570933707f3Ssthen m68*-cisco) 1571a3167c07Ssthen os=aout 1572933707f3Ssthen ;; 1573933707f3Ssthen mep-*) 1574a3167c07Ssthen os=elf 1575933707f3Ssthen ;; 1576933707f3Ssthen mips*-cisco) 1577a3167c07Ssthen os=elf 1578933707f3Ssthen ;; 1579933707f3Ssthen mips*-*) 1580a3167c07Ssthen os=elf 1581933707f3Ssthen ;; 1582933707f3Ssthen or32-*) 1583a3167c07Ssthen os=coff 1584933707f3Ssthen ;; 1585933707f3Ssthen *-tti) # must be before sparc entry or we get the wrong os. 1586a3167c07Ssthen os=sysv3 1587933707f3Ssthen ;; 1588933707f3Ssthen sparc-* | *-sun) 1589a3167c07Ssthen os=sunos4.1.1 1590a3167c07Ssthen ;; 1591a3167c07Ssthen pru-*) 1592a3167c07Ssthen os=elf 1593933707f3Ssthen ;; 1594933707f3Ssthen *-be) 1595a3167c07Ssthen os=beos 1596eaf2578eSsthen ;; 1597933707f3Ssthen *-ibm) 1598a3167c07Ssthen os=aix 1599933707f3Ssthen ;; 1600933707f3Ssthen *-knuth) 1601a3167c07Ssthen os=mmixware 1602933707f3Ssthen ;; 1603933707f3Ssthen *-wec) 1604a3167c07Ssthen os=proelf 1605933707f3Ssthen ;; 1606933707f3Ssthen *-winbond) 1607a3167c07Ssthen os=proelf 1608933707f3Ssthen ;; 1609933707f3Ssthen *-oki) 1610a3167c07Ssthen os=proelf 1611933707f3Ssthen ;; 1612933707f3Ssthen *-hp) 1613a3167c07Ssthen os=hpux 1614933707f3Ssthen ;; 1615933707f3Ssthen *-hitachi) 1616a3167c07Ssthen os=hiux 1617933707f3Ssthen ;; 1618933707f3Ssthen i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1619a3167c07Ssthen os=sysv 1620933707f3Ssthen ;; 1621933707f3Ssthen *-cbm) 1622a3167c07Ssthen os=amigaos 1623933707f3Ssthen ;; 1624933707f3Ssthen *-dg) 1625a3167c07Ssthen os=dgux 1626933707f3Ssthen ;; 1627933707f3Ssthen *-dolphin) 1628a3167c07Ssthen os=sysv3 1629933707f3Ssthen ;; 1630933707f3Ssthen m68k-ccur) 1631a3167c07Ssthen os=rtu 1632933707f3Ssthen ;; 1633933707f3Ssthen m88k-omron*) 1634a3167c07Ssthen os=luna 1635933707f3Ssthen ;; 1636933707f3Ssthen *-next) 1637a3167c07Ssthen os=nextstep 1638933707f3Ssthen ;; 1639933707f3Ssthen *-sequent) 1640a3167c07Ssthen os=ptx 1641933707f3Ssthen ;; 1642933707f3Ssthen *-crds) 1643a3167c07Ssthen os=unos 1644933707f3Ssthen ;; 1645933707f3Ssthen *-ns) 1646a3167c07Ssthen os=genix 1647933707f3Ssthen ;; 1648933707f3Ssthen i370-*) 1649a3167c07Ssthen os=mvs 1650eaf2578eSsthen ;; 1651933707f3Ssthen *-gould) 1652a3167c07Ssthen os=sysv 1653933707f3Ssthen ;; 1654933707f3Ssthen *-highlevel) 1655a3167c07Ssthen os=bsd 1656933707f3Ssthen ;; 1657933707f3Ssthen *-encore) 1658a3167c07Ssthen os=bsd 1659933707f3Ssthen ;; 1660933707f3Ssthen *-sgi) 1661a3167c07Ssthen os=irix 1662933707f3Ssthen ;; 1663933707f3Ssthen *-siemens) 1664a3167c07Ssthen os=sysv4 1665933707f3Ssthen ;; 1666933707f3Ssthen *-masscomp) 1667a3167c07Ssthen os=rtu 1668933707f3Ssthen ;; 1669933707f3Ssthen f30[01]-fujitsu | f700-fujitsu) 1670a3167c07Ssthen os=uxpv 1671933707f3Ssthen ;; 1672933707f3Ssthen *-rom68k) 1673a3167c07Ssthen os=coff 1674933707f3Ssthen ;; 1675933707f3Ssthen *-*bug) 1676a3167c07Ssthen os=coff 1677933707f3Ssthen ;; 1678933707f3Ssthen *-apple) 1679a3167c07Ssthen os=macos 1680933707f3Ssthen ;; 1681933707f3Ssthen *-atari*) 1682a3167c07Ssthen os=mint 1683a3167c07Ssthen ;; 1684a3167c07Ssthen *-wrs) 1685a3167c07Ssthen os=vxworks 1686933707f3Ssthen ;; 1687933707f3Ssthen *) 1688a3167c07Ssthen os=none 1689933707f3Ssthen ;; 1690933707f3Ssthenesac 1691a3167c07Ssthen 1692933707f3Ssthenfi 1693933707f3Ssthen 1694a3167c07Ssthen# Now, validate our (potentially fixed-up) OS. 1695a3167c07Ssthencase $os in 16969982a05dSsthen # Sometimes we do "kernel-libc", so those need to count as OSes. 1697e21c60efSsthen musl* | newlib* | relibc* | uclibc*) 1698a3167c07Ssthen ;; 16999982a05dSsthen # Likewise for "kernel-abi" 17009982a05dSsthen eabi* | gnueabi*) 17019982a05dSsthen ;; 17029982a05dSsthen # VxWorks passes extra cpu info in the 4th filed. 17039982a05dSsthen simlinux | simwindows | spe) 1704a3167c07Ssthen ;; 1705a3167c07Ssthen # Now accept the basic system types. 1706a3167c07Ssthen # The portable systems comes first. 1707a3167c07Ssthen # Each alternative MUST end in a * to match a version number. 1708a3167c07Ssthen gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1709a3167c07Ssthen | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 1710a3167c07Ssthen | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1711a3167c07Ssthen | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 1712a3167c07Ssthen | hiux* | abug | nacl* | netware* | windows* \ 1713*8b7325afSsthen | os9* | macos* | osx* | ios* | tvos* | watchos* \ 1714a3167c07Ssthen | mpw* | magic* | mmixware* | mon960* | lnews* \ 1715a3167c07Ssthen | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1716a3167c07Ssthen | aos* | aros* | cloudabi* | sortix* | twizzler* \ 1717a3167c07Ssthen | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1718a3167c07Ssthen | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 1719a3167c07Ssthen | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 1720191f22c6Ssthen | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 1721a3167c07Ssthen | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1722a3167c07Ssthen | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1723a3167c07Ssthen | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1724a3167c07Ssthen | udi* | lites* | ieee* | go32* | aux* | hcos* \ 1725191f22c6Ssthen | chorusrdb* | cegcc* | glidix* | serenity* \ 1726a3167c07Ssthen | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 1727a3167c07Ssthen | midipix* | mingw32* | mingw64* | mint* \ 1728a3167c07Ssthen | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1729a3167c07Ssthen | interix* | uwin* | mks* | rhapsody* | darwin* \ 1730a3167c07Ssthen | openstep* | oskit* | conix* | pw32* | nonstopux* \ 1731a3167c07Ssthen | storm-chaos* | tops10* | tenex* | tops20* | its* \ 1732a3167c07Ssthen | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 1733a3167c07Ssthen | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 1734a3167c07Ssthen | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 1735a3167c07Ssthen | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 1736a3167c07Ssthen | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 1737a3167c07Ssthen | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1738e21c60efSsthen | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1739*8b7325afSsthen | fiwix* | mlibc* | cos* | mbr* ) 1740a3167c07Ssthen ;; 1741a3167c07Ssthen # This one is extra strict with allowed versions 1742a3167c07Ssthen sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 1743a3167c07Ssthen # Don't forget version if it is 3.2v4 or newer. 1744a3167c07Ssthen ;; 1745a3167c07Ssthen none) 1746a3167c07Ssthen ;; 1747*8b7325afSsthen kernel* | msvc* ) 174845872187Ssthen # Restricted further below 174945872187Ssthen ;; 1750a3167c07Ssthen *) 1751*8b7325afSsthen echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 1752a3167c07Ssthen exit 1 1753a3167c07Ssthen ;; 1754a3167c07Ssthenesac 1755a3167c07Ssthen 1756a3167c07Ssthen# As a final step for OS-related things, validate the OS-kernel combination 1757a3167c07Ssthen# (given a valid OS), if there is a kernel. 1758a3167c07Ssthencase $kernel-$os in 1759e21c60efSsthen linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 176045872187Ssthen | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 1761a3167c07Ssthen ;; 17622c144df0Ssthen uclinux-uclibc* ) 17632c144df0Ssthen ;; 176445872187Ssthen managarm-mlibc* | managarm-kernel* ) 176545872187Ssthen ;; 1766*8b7325afSsthen windows*-gnu* | windows*-msvc*) 1767*8b7325afSsthen ;; 176845872187Ssthen -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 1769a3167c07Ssthen # These are just libc implementations, not actual OSes, and thus 1770a3167c07Ssthen # require a kernel. 1771*8b7325afSsthen echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 1772a3167c07Ssthen exit 1 1773a3167c07Ssthen ;; 177445872187Ssthen -kernel* ) 1775*8b7325afSsthen echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 177645872187Ssthen exit 1 177745872187Ssthen ;; 177845872187Ssthen *-kernel* ) 1779*8b7325afSsthen echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 1780*8b7325afSsthen exit 1 1781*8b7325afSsthen ;; 1782*8b7325afSsthen *-msvc* ) 1783*8b7325afSsthen echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 178445872187Ssthen exit 1 178545872187Ssthen ;; 1786a3167c07Ssthen kfreebsd*-gnu* | kopensolaris*-gnu*) 1787a3167c07Ssthen ;; 17889982a05dSsthen vxworks-simlinux | vxworks-simwindows | vxworks-spe) 17899982a05dSsthen ;; 1790a3167c07Ssthen nto-qnx*) 1791a3167c07Ssthen ;; 1792eba819a2Ssthen os2-emx) 1793eba819a2Ssthen ;; 1794a3167c07Ssthen *-eabi* | *-gnueabi*) 1795a3167c07Ssthen ;; 1796*8b7325afSsthen none-coff* | none-elf*) 1797*8b7325afSsthen # None (no kernel, i.e. freestanding / bare metal), 1798*8b7325afSsthen # can be paired with an output format "OS" 1799*8b7325afSsthen ;; 1800a3167c07Ssthen -*) 1801a3167c07Ssthen # Blank kernel with real OS is always fine. 1802a3167c07Ssthen ;; 1803a3167c07Ssthen *-*) 1804*8b7325afSsthen echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 1805a3167c07Ssthen exit 1 1806a3167c07Ssthen ;; 1807a3167c07Ssthenesac 1808a3167c07Ssthen 1809933707f3Ssthen# Here we handle the case where we know the os, and the CPU type, but not the 1810933707f3Ssthen# manufacturer. We pick the logical manufacturer. 1811a3167c07Ssthencase $vendor in 1812a3167c07Ssthen unknown) 1813a3167c07Ssthen case $cpu-$os in 1814a3167c07Ssthen *-riscix*) 1815933707f3Ssthen vendor=acorn 1816933707f3Ssthen ;; 1817a3167c07Ssthen *-sunos*) 1818933707f3Ssthen vendor=sun 1819933707f3Ssthen ;; 1820a3167c07Ssthen *-cnk* | *-aix*) 1821933707f3Ssthen vendor=ibm 1822933707f3Ssthen ;; 1823a3167c07Ssthen *-beos*) 1824933707f3Ssthen vendor=be 1825933707f3Ssthen ;; 1826a3167c07Ssthen *-hpux*) 1827933707f3Ssthen vendor=hp 1828933707f3Ssthen ;; 1829a3167c07Ssthen *-mpeix*) 1830933707f3Ssthen vendor=hp 1831933707f3Ssthen ;; 1832a3167c07Ssthen *-hiux*) 1833933707f3Ssthen vendor=hitachi 1834933707f3Ssthen ;; 1835a3167c07Ssthen *-unos*) 1836933707f3Ssthen vendor=crds 1837933707f3Ssthen ;; 1838a3167c07Ssthen *-dgux*) 1839933707f3Ssthen vendor=dg 1840933707f3Ssthen ;; 1841a3167c07Ssthen *-luna*) 1842933707f3Ssthen vendor=omron 1843933707f3Ssthen ;; 1844a3167c07Ssthen *-genix*) 1845933707f3Ssthen vendor=ns 1846933707f3Ssthen ;; 1847a3167c07Ssthen *-clix*) 1848a3167c07Ssthen vendor=intergraph 1849a3167c07Ssthen ;; 1850a3167c07Ssthen *-mvs* | *-opened*) 1851933707f3Ssthen vendor=ibm 1852933707f3Ssthen ;; 1853a3167c07Ssthen *-os400*) 1854933707f3Ssthen vendor=ibm 1855933707f3Ssthen ;; 1856a3167c07Ssthen s390-* | s390x-*) 1857a3167c07Ssthen vendor=ibm 1858a3167c07Ssthen ;; 1859a3167c07Ssthen *-ptx*) 1860933707f3Ssthen vendor=sequent 1861933707f3Ssthen ;; 1862a3167c07Ssthen *-tpf*) 1863933707f3Ssthen vendor=ibm 1864933707f3Ssthen ;; 1865a3167c07Ssthen *-vxsim* | *-vxworks* | *-windiss*) 1866933707f3Ssthen vendor=wrs 1867933707f3Ssthen ;; 1868a3167c07Ssthen *-aux*) 1869933707f3Ssthen vendor=apple 1870933707f3Ssthen ;; 1871a3167c07Ssthen *-hms*) 1872933707f3Ssthen vendor=hitachi 1873933707f3Ssthen ;; 1874a3167c07Ssthen *-mpw* | *-macos*) 1875933707f3Ssthen vendor=apple 1876933707f3Ssthen ;; 1877a3167c07Ssthen *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 1878933707f3Ssthen vendor=atari 1879933707f3Ssthen ;; 1880a3167c07Ssthen *-vos*) 1881933707f3Ssthen vendor=stratus 1882933707f3Ssthen ;; 1883933707f3Ssthen esac 1884933707f3Ssthen ;; 1885933707f3Ssthenesac 1886933707f3Ssthen 1887a3167c07Ssthenecho "$cpu-$vendor-${kernel:+$kernel-}$os" 1888933707f3Ssthenexit 1889933707f3Ssthen 1890933707f3Ssthen# Local variables: 1891a3167c07Ssthen# eval: (add-hook 'before-save-hook 'time-stamp) 1892933707f3Ssthen# time-stamp-start: "timestamp='" 1893933707f3Ssthen# time-stamp-format: "%:y-%02m-%02d" 1894933707f3Ssthen# time-stamp-end: "'" 1895933707f3Ssthen# End: 1896