14456fccdSmrg#! /bin/sh 24456fccdSmrg# Configuration validation subroutine script. 3a7e741d5Smrg# Copyright 1992-2023 Free Software Foundation, Inc. 44456fccdSmrg 5a7e741d5Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale 6a7e741d5Smrg 7a7e741d5Smrgtimestamp='2023-01-21' 84456fccdSmrg 93e6c936aSmrg# This file is free software; you can redistribute it and/or modify it 103e6c936aSmrg# under the terms of the GNU General Public License as published by 11a7e741d5Smrg# the Free Software Foundation, either version 3 of the License, or 124456fccdSmrg# (at your option) any later version. 134456fccdSmrg# 143e6c936aSmrg# This program is distributed in the hope that it will be useful, but 153e6c936aSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 163e6c936aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 173e6c936aSmrg# General Public License for more details. 184456fccdSmrg# 194456fccdSmrg# You should have received a copy of the GNU General Public License 20b0a0317aSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 214456fccdSmrg# 224456fccdSmrg# As a special exception to the GNU General Public License, if you 234456fccdSmrg# distribute this file as part of a program that contains a 244456fccdSmrg# configuration script generated by Autoconf, you may include it under 253e6c936aSmrg# the same distribution terms that you use for the rest of that 263e6c936aSmrg# program. This Exception is an additional permission under section 7 273e6c936aSmrg# of the GNU General Public License, version 3 ("GPLv3"). 284456fccdSmrg 294456fccdSmrg 30b0a0317aSmrg# Please send patches to <config-patches@gnu.org>. 314456fccdSmrg# 324456fccdSmrg# Configuration subroutine to validate and canonicalize a configuration type. 334456fccdSmrg# Supply the specified configuration type as an argument. 344456fccdSmrg# If it is invalid, we print an error message on stderr and exit with code 1. 354456fccdSmrg# Otherwise, we print the canonical config type on stdout and succeed. 364456fccdSmrg 37521070a0Smrg# You can get the latest version of this script from: 38a7e741d5Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39521070a0Smrg 404456fccdSmrg# This file is supposed to be the same for all GNU packages 414456fccdSmrg# and recognize all the CPU types, system types and aliases 424456fccdSmrg# that are meaningful with *any* GNU software. 434456fccdSmrg# Each package is responsible for reporting which valid configurations 444456fccdSmrg# it does not support. The user should be able to distinguish 454456fccdSmrg# a failure to support a valid configuration from a meaningless 464456fccdSmrg# configuration. 474456fccdSmrg 484456fccdSmrg# The goal of this file is to map all the various variations of a given 494456fccdSmrg# machine specification into a single specification in the form: 504456fccdSmrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 514456fccdSmrg# or in some cases, the newer four-part form: 524456fccdSmrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 534456fccdSmrg# It is wrong to echo any other type of specification. 544456fccdSmrg 55a7e741d5Smrg# The "shellcheck disable" line above the timestamp inhibits complaints 56a7e741d5Smrg# about features and limitations of the classic Bourne shell that were 57a7e741d5Smrg# superseded or lifted in POSIX. However, this script identifies a wide 58a7e741d5Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 59a7e741d5Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still 60a7e741d5Smrg# have a pre-POSIX /bin/sh. 61a7e741d5Smrg 624456fccdSmrgme=`echo "$0" | sed -e 's,.*/,,'` 634456fccdSmrg 644456fccdSmrgusage="\ 65b0a0317aSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 664456fccdSmrg 674456fccdSmrgCanonicalize a configuration name. 684456fccdSmrg 69b0a0317aSmrgOptions: 704456fccdSmrg -h, --help print this help, then exit 714456fccdSmrg -t, --time-stamp print date of last modification, then exit 724456fccdSmrg -v, --version print version number, then exit 734456fccdSmrg 744456fccdSmrgReport bugs and patches to <config-patches@gnu.org>." 754456fccdSmrg 764456fccdSmrgversion="\ 774456fccdSmrgGNU config.sub ($timestamp) 784456fccdSmrg 79a7e741d5SmrgCopyright 1992-2023 Free Software Foundation, Inc. 804456fccdSmrg 814456fccdSmrgThis is free software; see the source for copying conditions. There is NO 824456fccdSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 834456fccdSmrg 844456fccdSmrghelp=" 854456fccdSmrgTry \`$me --help' for more information." 864456fccdSmrg 874456fccdSmrg# Parse command line 884456fccdSmrgwhile test $# -gt 0 ; do 894456fccdSmrg case $1 in 904456fccdSmrg --time-stamp | --time* | -t ) 914456fccdSmrg echo "$timestamp" ; exit ;; 924456fccdSmrg --version | -v ) 934456fccdSmrg echo "$version" ; exit ;; 944456fccdSmrg --help | --h* | -h ) 954456fccdSmrg echo "$usage"; exit ;; 964456fccdSmrg -- ) # Stop option processing 974456fccdSmrg shift; break ;; 984456fccdSmrg - ) # Use stdin as input. 994456fccdSmrg break ;; 1004456fccdSmrg -* ) 101a7e741d5Smrg echo "$me: invalid option $1$help" >&2 1024456fccdSmrg exit 1 ;; 1034456fccdSmrg 1044456fccdSmrg *local*) 1054456fccdSmrg # First pass through any local machine types. 106b0a0317aSmrg echo "$1" 1074456fccdSmrg exit ;; 1084456fccdSmrg 1094456fccdSmrg * ) 1104456fccdSmrg break ;; 1114456fccdSmrg esac 1124456fccdSmrgdone 1134456fccdSmrg 1144456fccdSmrgcase $# in 1154456fccdSmrg 0) echo "$me: missing argument$help" >&2 1164456fccdSmrg exit 1;; 1174456fccdSmrg 1) ;; 1184456fccdSmrg *) echo "$me: too many arguments$help" >&2 1194456fccdSmrg exit 1;; 1204456fccdSmrgesac 1214456fccdSmrg 122b0a0317aSmrg# Split fields of configuration type 123a7e741d5Smrg# shellcheck disable=SC2162 124a7e741d5Smrgsaved_IFS=$IFS 125a7e741d5SmrgIFS="-" read field1 field2 field3 field4 <<EOF 126b0a0317aSmrg$1 127b0a0317aSmrgEOF 128a7e741d5SmrgIFS=$saved_IFS 1294456fccdSmrg 130b0a0317aSmrg# Separate into logical components for further validation 131b0a0317aSmrgcase $1 in 132b0a0317aSmrg *-*-*-*-*) 133b0a0317aSmrg echo Invalid configuration \`"$1"\': more than four components >&2 134b0a0317aSmrg exit 1 1354456fccdSmrg ;; 136b0a0317aSmrg *-*-*-*) 137b0a0317aSmrg basic_machine=$field1-$field2 138a7e741d5Smrg basic_os=$field3-$field4 1394456fccdSmrg ;; 140b0a0317aSmrg *-*-*) 141b0a0317aSmrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 142b0a0317aSmrg # parts 143b0a0317aSmrg maybe_os=$field2-$field3 144b0a0317aSmrg case $maybe_os in 145a7e741d5Smrg nto-qnx* | linux-* | uclinux-uclibc* \ 146b0a0317aSmrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 147b0a0317aSmrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148a7e741d5Smrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) 149b0a0317aSmrg basic_machine=$field1 150a7e741d5Smrg basic_os=$maybe_os 151b0a0317aSmrg ;; 152b0a0317aSmrg android-linux) 153b0a0317aSmrg basic_machine=$field1-unknown 154a7e741d5Smrg basic_os=linux-android 155b0a0317aSmrg ;; 156b0a0317aSmrg *) 157b0a0317aSmrg basic_machine=$field1-$field2 158a7e741d5Smrg basic_os=$field3 159b0a0317aSmrg ;; 160b0a0317aSmrg esac 1614456fccdSmrg ;; 162b0a0317aSmrg *-*) 163a7e741d5Smrg # A lone config we happen to match not fitting any pattern 164b0a0317aSmrg case $field1-$field2 in 165b0a0317aSmrg decstation-3100) 166b0a0317aSmrg basic_machine=mips-dec 167a7e741d5Smrg basic_os= 168b0a0317aSmrg ;; 169b0a0317aSmrg *-*) 170b0a0317aSmrg # Second component is usually, but not always the OS 171b0a0317aSmrg case $field2 in 172b0a0317aSmrg # Prevent following clause from handling this valid os 173b0a0317aSmrg sun*os*) 174b0a0317aSmrg basic_machine=$field1 175a7e741d5Smrg basic_os=$field2 176a7e741d5Smrg ;; 177a7e741d5Smrg zephyr*) 178a7e741d5Smrg basic_machine=$field1-unknown 179a7e741d5Smrg basic_os=$field2 180b0a0317aSmrg ;; 181b0a0317aSmrg # Manufacturers 182b0a0317aSmrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 183b0a0317aSmrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 184b0a0317aSmrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 185b0a0317aSmrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 186b0a0317aSmrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 187b0a0317aSmrg | ultra | tti* | harris | dolphin | highlevel | gould \ 188b0a0317aSmrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 189b0a0317aSmrg | microblaze* | sim | cisco \ 190b0a0317aSmrg | oki | wec | wrs | winbond) 191b0a0317aSmrg basic_machine=$field1-$field2 192a7e741d5Smrg basic_os= 193b0a0317aSmrg ;; 194b0a0317aSmrg *) 195b0a0317aSmrg basic_machine=$field1 196a7e741d5Smrg basic_os=$field2 197b0a0317aSmrg ;; 198b0a0317aSmrg esac 199b0a0317aSmrg ;; 200b0a0317aSmrg esac 2014456fccdSmrg ;; 202b0a0317aSmrg *) 203b0a0317aSmrg # Convert single-component short-hands not valid as part of 204b0a0317aSmrg # multi-component configurations. 205b0a0317aSmrg case $field1 in 206b0a0317aSmrg 386bsd) 207b0a0317aSmrg basic_machine=i386-pc 208a7e741d5Smrg basic_os=bsd 209b0a0317aSmrg ;; 210b0a0317aSmrg a29khif) 211b0a0317aSmrg basic_machine=a29k-amd 212a7e741d5Smrg basic_os=udi 213b0a0317aSmrg ;; 214b0a0317aSmrg adobe68k) 215b0a0317aSmrg basic_machine=m68010-adobe 216a7e741d5Smrg basic_os=scout 217b0a0317aSmrg ;; 218b0a0317aSmrg alliant) 219b0a0317aSmrg basic_machine=fx80-alliant 220a7e741d5Smrg basic_os= 221b0a0317aSmrg ;; 222b0a0317aSmrg altos | altos3068) 223b0a0317aSmrg basic_machine=m68k-altos 224a7e741d5Smrg basic_os= 225b0a0317aSmrg ;; 226b0a0317aSmrg am29k) 227b0a0317aSmrg basic_machine=a29k-none 228a7e741d5Smrg basic_os=bsd 229b0a0317aSmrg ;; 230b0a0317aSmrg amdahl) 231b0a0317aSmrg basic_machine=580-amdahl 232a7e741d5Smrg basic_os=sysv 233b0a0317aSmrg ;; 234b0a0317aSmrg amiga) 235b0a0317aSmrg basic_machine=m68k-unknown 236a7e741d5Smrg basic_os= 237b0a0317aSmrg ;; 238b0a0317aSmrg amigaos | amigados) 239b0a0317aSmrg basic_machine=m68k-unknown 240a7e741d5Smrg basic_os=amigaos 241b0a0317aSmrg ;; 242b0a0317aSmrg amigaunix | amix) 243b0a0317aSmrg basic_machine=m68k-unknown 244a7e741d5Smrg basic_os=sysv4 245b0a0317aSmrg ;; 246b0a0317aSmrg apollo68) 247b0a0317aSmrg basic_machine=m68k-apollo 248a7e741d5Smrg basic_os=sysv 249b0a0317aSmrg ;; 250b0a0317aSmrg apollo68bsd) 251b0a0317aSmrg basic_machine=m68k-apollo 252a7e741d5Smrg basic_os=bsd 253b0a0317aSmrg ;; 254b0a0317aSmrg aros) 255b0a0317aSmrg basic_machine=i386-pc 256a7e741d5Smrg basic_os=aros 257b0a0317aSmrg ;; 258b0a0317aSmrg aux) 259b0a0317aSmrg basic_machine=m68k-apple 260a7e741d5Smrg basic_os=aux 261b0a0317aSmrg ;; 262b0a0317aSmrg balance) 263b0a0317aSmrg basic_machine=ns32k-sequent 264a7e741d5Smrg basic_os=dynix 265b0a0317aSmrg ;; 266b0a0317aSmrg blackfin) 267b0a0317aSmrg basic_machine=bfin-unknown 268a7e741d5Smrg basic_os=linux 269b0a0317aSmrg ;; 270b0a0317aSmrg cegcc) 271b0a0317aSmrg basic_machine=arm-unknown 272a7e741d5Smrg basic_os=cegcc 273b0a0317aSmrg ;; 274b0a0317aSmrg convex-c1) 275b0a0317aSmrg basic_machine=c1-convex 276a7e741d5Smrg basic_os=bsd 277b0a0317aSmrg ;; 278b0a0317aSmrg convex-c2) 279b0a0317aSmrg basic_machine=c2-convex 280a7e741d5Smrg basic_os=bsd 281b0a0317aSmrg ;; 282b0a0317aSmrg convex-c32) 283b0a0317aSmrg basic_machine=c32-convex 284a7e741d5Smrg basic_os=bsd 285b0a0317aSmrg ;; 286b0a0317aSmrg convex-c34) 287b0a0317aSmrg basic_machine=c34-convex 288a7e741d5Smrg basic_os=bsd 289b0a0317aSmrg ;; 290b0a0317aSmrg convex-c38) 291b0a0317aSmrg basic_machine=c38-convex 292a7e741d5Smrg basic_os=bsd 293b0a0317aSmrg ;; 294b0a0317aSmrg cray) 295b0a0317aSmrg basic_machine=j90-cray 296a7e741d5Smrg basic_os=unicos 297b0a0317aSmrg ;; 298b0a0317aSmrg crds | unos) 299b0a0317aSmrg basic_machine=m68k-crds 300a7e741d5Smrg basic_os= 301b0a0317aSmrg ;; 302b0a0317aSmrg da30) 303b0a0317aSmrg basic_machine=m68k-da30 304a7e741d5Smrg basic_os= 305b0a0317aSmrg ;; 306b0a0317aSmrg decstation | pmax | pmin | dec3100 | decstatn) 307b0a0317aSmrg basic_machine=mips-dec 308a7e741d5Smrg basic_os= 309b0a0317aSmrg ;; 310b0a0317aSmrg delta88) 311b0a0317aSmrg basic_machine=m88k-motorola 312a7e741d5Smrg basic_os=sysv3 313b0a0317aSmrg ;; 314b0a0317aSmrg dicos) 315b0a0317aSmrg basic_machine=i686-pc 316a7e741d5Smrg basic_os=dicos 317b0a0317aSmrg ;; 318b0a0317aSmrg djgpp) 319b0a0317aSmrg basic_machine=i586-pc 320a7e741d5Smrg basic_os=msdosdjgpp 321b0a0317aSmrg ;; 322b0a0317aSmrg ebmon29k) 323b0a0317aSmrg basic_machine=a29k-amd 324a7e741d5Smrg basic_os=ebmon 325b0a0317aSmrg ;; 326b0a0317aSmrg es1800 | OSE68k | ose68k | ose | OSE) 327b0a0317aSmrg basic_machine=m68k-ericsson 328a7e741d5Smrg basic_os=ose 329b0a0317aSmrg ;; 330b0a0317aSmrg gmicro) 331b0a0317aSmrg basic_machine=tron-gmicro 332a7e741d5Smrg basic_os=sysv 333b0a0317aSmrg ;; 334b0a0317aSmrg go32) 335b0a0317aSmrg basic_machine=i386-pc 336a7e741d5Smrg basic_os=go32 337b0a0317aSmrg ;; 338b0a0317aSmrg h8300hms) 339b0a0317aSmrg basic_machine=h8300-hitachi 340a7e741d5Smrg basic_os=hms 341b0a0317aSmrg ;; 342b0a0317aSmrg h8300xray) 343b0a0317aSmrg basic_machine=h8300-hitachi 344a7e741d5Smrg basic_os=xray 345b0a0317aSmrg ;; 346b0a0317aSmrg h8500hms) 347b0a0317aSmrg basic_machine=h8500-hitachi 348a7e741d5Smrg basic_os=hms 349b0a0317aSmrg ;; 350b0a0317aSmrg harris) 351b0a0317aSmrg basic_machine=m88k-harris 352a7e741d5Smrg basic_os=sysv3 353b0a0317aSmrg ;; 354a7e741d5Smrg hp300 | hp300hpux) 355b0a0317aSmrg basic_machine=m68k-hp 356a7e741d5Smrg basic_os=hpux 357b0a0317aSmrg ;; 358b0a0317aSmrg hp300bsd) 359b0a0317aSmrg basic_machine=m68k-hp 360a7e741d5Smrg basic_os=bsd 361b0a0317aSmrg ;; 362b0a0317aSmrg hppaosf) 363b0a0317aSmrg basic_machine=hppa1.1-hp 364a7e741d5Smrg basic_os=osf 365b0a0317aSmrg ;; 366b0a0317aSmrg hppro) 367b0a0317aSmrg basic_machine=hppa1.1-hp 368a7e741d5Smrg basic_os=proelf 369b0a0317aSmrg ;; 370b0a0317aSmrg i386mach) 371b0a0317aSmrg basic_machine=i386-mach 372a7e741d5Smrg basic_os=mach 373b0a0317aSmrg ;; 374b0a0317aSmrg isi68 | isi) 375b0a0317aSmrg basic_machine=m68k-isi 376a7e741d5Smrg basic_os=sysv 377b0a0317aSmrg ;; 378b0a0317aSmrg m68knommu) 379b0a0317aSmrg basic_machine=m68k-unknown 380a7e741d5Smrg basic_os=linux 381b0a0317aSmrg ;; 382b0a0317aSmrg magnum | m3230) 383b0a0317aSmrg basic_machine=mips-mips 384a7e741d5Smrg basic_os=sysv 385b0a0317aSmrg ;; 386b0a0317aSmrg merlin) 387b0a0317aSmrg basic_machine=ns32k-utek 388a7e741d5Smrg basic_os=sysv 389b0a0317aSmrg ;; 390b0a0317aSmrg mingw64) 391b0a0317aSmrg basic_machine=x86_64-pc 392a7e741d5Smrg basic_os=mingw64 393b0a0317aSmrg ;; 394b0a0317aSmrg mingw32) 395b0a0317aSmrg basic_machine=i686-pc 396a7e741d5Smrg basic_os=mingw32 397b0a0317aSmrg ;; 398b0a0317aSmrg mingw32ce) 399b0a0317aSmrg basic_machine=arm-unknown 400a7e741d5Smrg basic_os=mingw32ce 401b0a0317aSmrg ;; 402b0a0317aSmrg monitor) 403b0a0317aSmrg basic_machine=m68k-rom68k 404a7e741d5Smrg basic_os=coff 405b0a0317aSmrg ;; 406b0a0317aSmrg morphos) 407b0a0317aSmrg basic_machine=powerpc-unknown 408a7e741d5Smrg basic_os=morphos 409b0a0317aSmrg ;; 410b0a0317aSmrg moxiebox) 411b0a0317aSmrg basic_machine=moxie-unknown 412a7e741d5Smrg basic_os=moxiebox 413b0a0317aSmrg ;; 414b0a0317aSmrg msdos) 415b0a0317aSmrg basic_machine=i386-pc 416a7e741d5Smrg basic_os=msdos 417b0a0317aSmrg ;; 418b0a0317aSmrg msys) 419b0a0317aSmrg basic_machine=i686-pc 420a7e741d5Smrg basic_os=msys 421b0a0317aSmrg ;; 422b0a0317aSmrg mvs) 423b0a0317aSmrg basic_machine=i370-ibm 424a7e741d5Smrg basic_os=mvs 425b0a0317aSmrg ;; 426b0a0317aSmrg nacl) 427b0a0317aSmrg basic_machine=le32-unknown 428a7e741d5Smrg basic_os=nacl 429b0a0317aSmrg ;; 430b0a0317aSmrg ncr3000) 431b0a0317aSmrg basic_machine=i486-ncr 432a7e741d5Smrg basic_os=sysv4 433b0a0317aSmrg ;; 434b0a0317aSmrg netbsd386) 435b0a0317aSmrg basic_machine=i386-pc 436a7e741d5Smrg basic_os=netbsd 437b0a0317aSmrg ;; 438b0a0317aSmrg netwinder) 439b0a0317aSmrg basic_machine=armv4l-rebel 440a7e741d5Smrg basic_os=linux 441b0a0317aSmrg ;; 442b0a0317aSmrg news | news700 | news800 | news900) 443b0a0317aSmrg basic_machine=m68k-sony 444a7e741d5Smrg basic_os=newsos 445b0a0317aSmrg ;; 446b0a0317aSmrg news1000) 447b0a0317aSmrg basic_machine=m68030-sony 448a7e741d5Smrg basic_os=newsos 449b0a0317aSmrg ;; 450b0a0317aSmrg necv70) 451b0a0317aSmrg basic_machine=v70-nec 452a7e741d5Smrg basic_os=sysv 453b0a0317aSmrg ;; 454b0a0317aSmrg nh3000) 455b0a0317aSmrg basic_machine=m68k-harris 456a7e741d5Smrg basic_os=cxux 457b0a0317aSmrg ;; 458b0a0317aSmrg nh[45]000) 459b0a0317aSmrg basic_machine=m88k-harris 460a7e741d5Smrg basic_os=cxux 461b0a0317aSmrg ;; 462b0a0317aSmrg nindy960) 463b0a0317aSmrg basic_machine=i960-intel 464a7e741d5Smrg basic_os=nindy 465b0a0317aSmrg ;; 466b0a0317aSmrg mon960) 467b0a0317aSmrg basic_machine=i960-intel 468a7e741d5Smrg basic_os=mon960 469b0a0317aSmrg ;; 470b0a0317aSmrg nonstopux) 471b0a0317aSmrg basic_machine=mips-compaq 472a7e741d5Smrg basic_os=nonstopux 473b0a0317aSmrg ;; 474b0a0317aSmrg os400) 475b0a0317aSmrg basic_machine=powerpc-ibm 476a7e741d5Smrg basic_os=os400 477b0a0317aSmrg ;; 478b0a0317aSmrg OSE68000 | ose68000) 479b0a0317aSmrg basic_machine=m68000-ericsson 480a7e741d5Smrg basic_os=ose 481b0a0317aSmrg ;; 482b0a0317aSmrg os68k) 483b0a0317aSmrg basic_machine=m68k-none 484a7e741d5Smrg basic_os=os68k 485b0a0317aSmrg ;; 486b0a0317aSmrg paragon) 487b0a0317aSmrg basic_machine=i860-intel 488a7e741d5Smrg basic_os=osf 489b0a0317aSmrg ;; 490b0a0317aSmrg parisc) 491b0a0317aSmrg basic_machine=hppa-unknown 492a7e741d5Smrg basic_os=linux 493a7e741d5Smrg ;; 494a7e741d5Smrg psp) 495a7e741d5Smrg basic_machine=mipsallegrexel-sony 496a7e741d5Smrg basic_os=psp 497b0a0317aSmrg ;; 498b0a0317aSmrg pw32) 499b0a0317aSmrg basic_machine=i586-unknown 500a7e741d5Smrg basic_os=pw32 501b0a0317aSmrg ;; 502b0a0317aSmrg rdos | rdos64) 503b0a0317aSmrg basic_machine=x86_64-pc 504a7e741d5Smrg basic_os=rdos 505b0a0317aSmrg ;; 506b0a0317aSmrg rdos32) 507b0a0317aSmrg basic_machine=i386-pc 508a7e741d5Smrg basic_os=rdos 509b0a0317aSmrg ;; 510b0a0317aSmrg rom68k) 511b0a0317aSmrg basic_machine=m68k-rom68k 512a7e741d5Smrg basic_os=coff 513b0a0317aSmrg ;; 514b0a0317aSmrg sa29200) 515b0a0317aSmrg basic_machine=a29k-amd 516a7e741d5Smrg basic_os=udi 517b0a0317aSmrg ;; 518b0a0317aSmrg sei) 519b0a0317aSmrg basic_machine=mips-sei 520a7e741d5Smrg basic_os=seiux 521b0a0317aSmrg ;; 522b0a0317aSmrg sequent) 523b0a0317aSmrg basic_machine=i386-sequent 524a7e741d5Smrg basic_os= 525b0a0317aSmrg ;; 526b0a0317aSmrg sps7) 527b0a0317aSmrg basic_machine=m68k-bull 528a7e741d5Smrg basic_os=sysv2 529b0a0317aSmrg ;; 530b0a0317aSmrg st2000) 531b0a0317aSmrg basic_machine=m68k-tandem 532a7e741d5Smrg basic_os= 533b0a0317aSmrg ;; 534b0a0317aSmrg stratus) 535b0a0317aSmrg basic_machine=i860-stratus 536a7e741d5Smrg basic_os=sysv4 537b0a0317aSmrg ;; 538b0a0317aSmrg sun2) 539b0a0317aSmrg basic_machine=m68000-sun 540a7e741d5Smrg basic_os= 541b0a0317aSmrg ;; 542b0a0317aSmrg sun2os3) 543b0a0317aSmrg basic_machine=m68000-sun 544a7e741d5Smrg basic_os=sunos3 545b0a0317aSmrg ;; 546b0a0317aSmrg sun2os4) 547b0a0317aSmrg basic_machine=m68000-sun 548a7e741d5Smrg basic_os=sunos4 549b0a0317aSmrg ;; 550b0a0317aSmrg sun3) 551b0a0317aSmrg basic_machine=m68k-sun 552a7e741d5Smrg basic_os= 553b0a0317aSmrg ;; 554b0a0317aSmrg sun3os3) 555b0a0317aSmrg basic_machine=m68k-sun 556a7e741d5Smrg basic_os=sunos3 557b0a0317aSmrg ;; 558b0a0317aSmrg sun3os4) 559b0a0317aSmrg basic_machine=m68k-sun 560a7e741d5Smrg basic_os=sunos4 561b0a0317aSmrg ;; 562b0a0317aSmrg sun4) 563b0a0317aSmrg basic_machine=sparc-sun 564a7e741d5Smrg basic_os= 565b0a0317aSmrg ;; 566b0a0317aSmrg sun4os3) 567b0a0317aSmrg basic_machine=sparc-sun 568a7e741d5Smrg basic_os=sunos3 569b0a0317aSmrg ;; 570b0a0317aSmrg sun4os4) 571b0a0317aSmrg basic_machine=sparc-sun 572a7e741d5Smrg basic_os=sunos4 573b0a0317aSmrg ;; 574b0a0317aSmrg sun4sol2) 575b0a0317aSmrg basic_machine=sparc-sun 576a7e741d5Smrg basic_os=solaris2 577b0a0317aSmrg ;; 578b0a0317aSmrg sun386 | sun386i | roadrunner) 579b0a0317aSmrg basic_machine=i386-sun 580a7e741d5Smrg basic_os= 581b0a0317aSmrg ;; 582b0a0317aSmrg sv1) 583b0a0317aSmrg basic_machine=sv1-cray 584a7e741d5Smrg basic_os=unicos 585b0a0317aSmrg ;; 586b0a0317aSmrg symmetry) 587b0a0317aSmrg basic_machine=i386-sequent 588a7e741d5Smrg basic_os=dynix 589b0a0317aSmrg ;; 590b0a0317aSmrg t3e) 591b0a0317aSmrg basic_machine=alphaev5-cray 592a7e741d5Smrg basic_os=unicos 593b0a0317aSmrg ;; 594b0a0317aSmrg t90) 595b0a0317aSmrg basic_machine=t90-cray 596a7e741d5Smrg basic_os=unicos 597b0a0317aSmrg ;; 598b0a0317aSmrg toad1) 599b0a0317aSmrg basic_machine=pdp10-xkl 600a7e741d5Smrg basic_os=tops20 601b0a0317aSmrg ;; 602b0a0317aSmrg tpf) 603b0a0317aSmrg basic_machine=s390x-ibm 604a7e741d5Smrg basic_os=tpf 605b0a0317aSmrg ;; 606b0a0317aSmrg udi29k) 607b0a0317aSmrg basic_machine=a29k-amd 608a7e741d5Smrg basic_os=udi 609b0a0317aSmrg ;; 610b0a0317aSmrg ultra3) 611b0a0317aSmrg basic_machine=a29k-nyu 612a7e741d5Smrg basic_os=sym1 613b0a0317aSmrg ;; 614b0a0317aSmrg v810 | necv810) 615b0a0317aSmrg basic_machine=v810-nec 616a7e741d5Smrg basic_os=none 617b0a0317aSmrg ;; 618b0a0317aSmrg vaxv) 619b0a0317aSmrg basic_machine=vax-dec 620a7e741d5Smrg basic_os=sysv 621b0a0317aSmrg ;; 622b0a0317aSmrg vms) 623b0a0317aSmrg basic_machine=vax-dec 624a7e741d5Smrg basic_os=vms 625a7e741d5Smrg ;; 626a7e741d5Smrg vsta) 627a7e741d5Smrg basic_machine=i386-pc 628a7e741d5Smrg basic_os=vsta 629b0a0317aSmrg ;; 630b0a0317aSmrg vxworks960) 631b0a0317aSmrg basic_machine=i960-wrs 632a7e741d5Smrg basic_os=vxworks 633b0a0317aSmrg ;; 634b0a0317aSmrg vxworks68) 635b0a0317aSmrg basic_machine=m68k-wrs 636a7e741d5Smrg basic_os=vxworks 637b0a0317aSmrg ;; 638b0a0317aSmrg vxworks29k) 639b0a0317aSmrg basic_machine=a29k-wrs 640a7e741d5Smrg basic_os=vxworks 641b0a0317aSmrg ;; 642b0a0317aSmrg xbox) 643b0a0317aSmrg basic_machine=i686-pc 644a7e741d5Smrg basic_os=mingw32 645b0a0317aSmrg ;; 646b0a0317aSmrg ymp) 647b0a0317aSmrg basic_machine=ymp-cray 648a7e741d5Smrg basic_os=unicos 649b0a0317aSmrg ;; 650b0a0317aSmrg *) 651b0a0317aSmrg basic_machine=$1 652a7e741d5Smrg basic_os= 653b0a0317aSmrg ;; 654b0a0317aSmrg esac 6554456fccdSmrg ;; 6564456fccdSmrgesac 6574456fccdSmrg 658b0a0317aSmrg# Decode 1-component or ad-hoc basic machines 6594456fccdSmrgcase $basic_machine in 660b0a0317aSmrg # Here we handle the default manufacturer of certain CPU types. It is in 661b0a0317aSmrg # some cases the only manufacturer, in others, it is the most popular. 662b0a0317aSmrg w89k) 663b0a0317aSmrg cpu=hppa1.1 664b0a0317aSmrg vendor=winbond 6654456fccdSmrg ;; 666b0a0317aSmrg op50n) 667b0a0317aSmrg cpu=hppa1.1 668b0a0317aSmrg vendor=oki 6693e6c936aSmrg ;; 670b0a0317aSmrg op60c) 671b0a0317aSmrg cpu=hppa1.1 672b0a0317aSmrg vendor=oki 6733e6c936aSmrg ;; 674b0a0317aSmrg ibm*) 675b0a0317aSmrg cpu=i370 676b0a0317aSmrg vendor=ibm 6773e6c936aSmrg ;; 678b0a0317aSmrg orion105) 679b0a0317aSmrg cpu=clipper 680b0a0317aSmrg vendor=highlevel 6813e6c936aSmrg ;; 682b0a0317aSmrg mac | mpw | mac-mpw) 683b0a0317aSmrg cpu=m68k 684b0a0317aSmrg vendor=apple 6854456fccdSmrg ;; 686b0a0317aSmrg pmac | pmac-mpw) 687b0a0317aSmrg cpu=powerpc 688b0a0317aSmrg vendor=apple 6894456fccdSmrg ;; 690b0a0317aSmrg 6914456fccdSmrg # Recognize the various machine names and aliases which stand 6924456fccdSmrg # for a CPU type and a company and sometimes even an OS. 6934456fccdSmrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 694b0a0317aSmrg cpu=m68000 695b0a0317aSmrg vendor=att 6964456fccdSmrg ;; 6974456fccdSmrg 3b*) 698b0a0317aSmrg cpu=we32k 699b0a0317aSmrg vendor=att 70042d69509Smrg ;; 701521070a0Smrg bluegene*) 702b0a0317aSmrg cpu=powerpc 703b0a0317aSmrg vendor=ibm 704a7e741d5Smrg basic_os=cnk 7054456fccdSmrg ;; 7064456fccdSmrg decsystem10* | dec10*) 707b0a0317aSmrg cpu=pdp10 708b0a0317aSmrg vendor=dec 709a7e741d5Smrg basic_os=tops10 7104456fccdSmrg ;; 7114456fccdSmrg decsystem20* | dec20*) 712b0a0317aSmrg cpu=pdp10 713b0a0317aSmrg vendor=dec 714a7e741d5Smrg basic_os=tops20 7154456fccdSmrg ;; 7164456fccdSmrg delta | 3300 | motorola-3300 | motorola-delta \ 7174456fccdSmrg | 3300-motorola | delta-motorola) 718b0a0317aSmrg cpu=m68k 719b0a0317aSmrg vendor=motorola 720521070a0Smrg ;; 721b0a0317aSmrg dpx2*) 722b0a0317aSmrg cpu=m68k 723b0a0317aSmrg vendor=bull 724a7e741d5Smrg basic_os=sysv3 7254456fccdSmrg ;; 7264456fccdSmrg encore | umax | mmax) 727b0a0317aSmrg cpu=ns32k 728b0a0317aSmrg vendor=encore 7294456fccdSmrg ;; 730b0a0317aSmrg elxsi) 731b0a0317aSmrg cpu=elxsi 732b0a0317aSmrg vendor=elxsi 733a7e741d5Smrg basic_os=${basic_os:-bsd} 7344456fccdSmrg ;; 7354456fccdSmrg fx2800) 736b0a0317aSmrg cpu=i860 737b0a0317aSmrg vendor=alliant 7384456fccdSmrg ;; 7394456fccdSmrg genix) 740b0a0317aSmrg cpu=ns32k 741b0a0317aSmrg vendor=ns 7424456fccdSmrg ;; 7434456fccdSmrg h3050r* | hiux*) 744b0a0317aSmrg cpu=hppa1.1 745b0a0317aSmrg vendor=hitachi 746a7e741d5Smrg basic_os=hiuxwe2 7474456fccdSmrg ;; 7484456fccdSmrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 749b0a0317aSmrg cpu=hppa1.0 750b0a0317aSmrg vendor=hp 7514456fccdSmrg ;; 7524456fccdSmrg hp9k2[0-9][0-9] | hp9k31[0-9]) 753b0a0317aSmrg cpu=m68000 754b0a0317aSmrg vendor=hp 7554456fccdSmrg ;; 7564456fccdSmrg hp9k3[2-9][0-9]) 757b0a0317aSmrg cpu=m68k 758b0a0317aSmrg vendor=hp 7594456fccdSmrg ;; 7604456fccdSmrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 761b0a0317aSmrg cpu=hppa1.0 762b0a0317aSmrg vendor=hp 7634456fccdSmrg ;; 7644456fccdSmrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 765b0a0317aSmrg cpu=hppa1.1 766b0a0317aSmrg vendor=hp 7674456fccdSmrg ;; 7684456fccdSmrg hp9k78[0-9] | hp78[0-9]) 7694456fccdSmrg # FIXME: really hppa2.0-hp 770b0a0317aSmrg cpu=hppa1.1 771b0a0317aSmrg vendor=hp 7724456fccdSmrg ;; 7734456fccdSmrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 7744456fccdSmrg # FIXME: really hppa2.0-hp 775b0a0317aSmrg cpu=hppa1.1 776b0a0317aSmrg vendor=hp 7774456fccdSmrg ;; 7784456fccdSmrg hp9k8[0-9][13679] | hp8[0-9][13679]) 779b0a0317aSmrg cpu=hppa1.1 780b0a0317aSmrg vendor=hp 7814456fccdSmrg ;; 7824456fccdSmrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 783b0a0317aSmrg cpu=hppa1.0 784b0a0317aSmrg vendor=hp 7854456fccdSmrg ;; 7864456fccdSmrg i*86v32) 787b0a0317aSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 788b0a0317aSmrg vendor=pc 789a7e741d5Smrg basic_os=sysv32 7904456fccdSmrg ;; 7914456fccdSmrg i*86v4*) 792b0a0317aSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 793b0a0317aSmrg vendor=pc 794a7e741d5Smrg basic_os=sysv4 7954456fccdSmrg ;; 7964456fccdSmrg i*86v) 797b0a0317aSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 798b0a0317aSmrg vendor=pc 799a7e741d5Smrg basic_os=sysv 8004456fccdSmrg ;; 8014456fccdSmrg i*86sol2) 802b0a0317aSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 803b0a0317aSmrg vendor=pc 804a7e741d5Smrg basic_os=solaris2 8054456fccdSmrg ;; 806b0a0317aSmrg j90 | j90-cray) 807b0a0317aSmrg cpu=j90 808b0a0317aSmrg vendor=cray 809a7e741d5Smrg basic_os=${basic_os:-unicos} 8104456fccdSmrg ;; 8114456fccdSmrg iris | iris4d) 812b0a0317aSmrg cpu=mips 813b0a0317aSmrg vendor=sgi 814a7e741d5Smrg case $basic_os in 815b0a0317aSmrg irix*) 8164456fccdSmrg ;; 8174456fccdSmrg *) 818a7e741d5Smrg basic_os=irix4 8194456fccdSmrg ;; 8204456fccdSmrg esac 8214456fccdSmrg ;; 8224456fccdSmrg miniframe) 823b0a0317aSmrg cpu=m68000 824b0a0317aSmrg vendor=convergent 8254456fccdSmrg ;; 826b0a0317aSmrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 827b0a0317aSmrg cpu=m68k 828b0a0317aSmrg vendor=atari 829a7e741d5Smrg basic_os=mint 8304456fccdSmrg ;; 8314456fccdSmrg news-3600 | risc-news) 832b0a0317aSmrg cpu=mips 833b0a0317aSmrg vendor=sony 834a7e741d5Smrg basic_os=newsos 8354456fccdSmrg ;; 836b0a0317aSmrg next | m*-next) 837b0a0317aSmrg cpu=m68k 838b0a0317aSmrg vendor=next 839a7e741d5Smrg case $basic_os in 840a7e741d5Smrg openstep*) 841a7e741d5Smrg ;; 842a7e741d5Smrg nextstep*) 8434456fccdSmrg ;; 844b0a0317aSmrg ns2*) 845a7e741d5Smrg basic_os=nextstep2 8464456fccdSmrg ;; 8474456fccdSmrg *) 848a7e741d5Smrg basic_os=nextstep3 8494456fccdSmrg ;; 8504456fccdSmrg esac 8514456fccdSmrg ;; 8524456fccdSmrg np1) 853b0a0317aSmrg cpu=np1 854b0a0317aSmrg vendor=gould 8554456fccdSmrg ;; 8564456fccdSmrg op50n-* | op60c-*) 857b0a0317aSmrg cpu=hppa1.1 858b0a0317aSmrg vendor=oki 859a7e741d5Smrg basic_os=proelf 8604456fccdSmrg ;; 8614456fccdSmrg pa-hitachi) 862b0a0317aSmrg cpu=hppa1.1 863b0a0317aSmrg vendor=hitachi 864a7e741d5Smrg basic_os=hiuxwe2 86542d69509Smrg ;; 8664456fccdSmrg pbd) 867b0a0317aSmrg cpu=sparc 868b0a0317aSmrg vendor=tti 8694456fccdSmrg ;; 8704456fccdSmrg pbb) 871b0a0317aSmrg cpu=m68k 872b0a0317aSmrg vendor=tti 8734456fccdSmrg ;; 874b0a0317aSmrg pc532) 875b0a0317aSmrg cpu=ns32k 876b0a0317aSmrg vendor=pc532 8774456fccdSmrg ;; 8784456fccdSmrg pn) 879b0a0317aSmrg cpu=pn 880b0a0317aSmrg vendor=gould 8814456fccdSmrg ;; 882b0a0317aSmrg power) 883b0a0317aSmrg cpu=power 884b0a0317aSmrg vendor=ibm 8854456fccdSmrg ;; 8864456fccdSmrg ps2) 887b0a0317aSmrg cpu=i386 888b0a0317aSmrg vendor=ibm 8894456fccdSmrg ;; 8904456fccdSmrg rm[46]00) 891b0a0317aSmrg cpu=mips 892b0a0317aSmrg vendor=siemens 8934456fccdSmrg ;; 8944456fccdSmrg rtpc | rtpc-*) 895b0a0317aSmrg cpu=romp 896b0a0317aSmrg vendor=ibm 8974456fccdSmrg ;; 898b0a0317aSmrg sde) 899b0a0317aSmrg cpu=mipsisa32 900b0a0317aSmrg vendor=sde 901a7e741d5Smrg basic_os=${basic_os:-elf} 9024456fccdSmrg ;; 903b0a0317aSmrg simso-wrs) 904b0a0317aSmrg cpu=sparclite 905b0a0317aSmrg vendor=wrs 906a7e741d5Smrg basic_os=vxworks 9074456fccdSmrg ;; 908b0a0317aSmrg tower | tower-32) 909b0a0317aSmrg cpu=m68k 910b0a0317aSmrg vendor=ncr 91142d69509Smrg ;; 912b0a0317aSmrg vpp*|vx|vx-*) 913b0a0317aSmrg cpu=f301 914b0a0317aSmrg vendor=fujitsu 9154456fccdSmrg ;; 916b0a0317aSmrg w65) 917b0a0317aSmrg cpu=w65 918b0a0317aSmrg vendor=wdc 9194456fccdSmrg ;; 920b0a0317aSmrg w89k-*) 921b0a0317aSmrg cpu=hppa1.1 922b0a0317aSmrg vendor=winbond 923a7e741d5Smrg basic_os=proelf 9244456fccdSmrg ;; 925b0a0317aSmrg none) 926b0a0317aSmrg cpu=none 927b0a0317aSmrg vendor=none 92842d69509Smrg ;; 929b0a0317aSmrg leon|leon[3-9]) 930b0a0317aSmrg cpu=sparc 931b0a0317aSmrg vendor=$basic_machine 9324456fccdSmrg ;; 933b0a0317aSmrg leon-*|leon[3-9]-*) 934b0a0317aSmrg cpu=sparc 935b0a0317aSmrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 9364456fccdSmrg ;; 937b0a0317aSmrg 938b0a0317aSmrg *-*) 939a7e741d5Smrg # shellcheck disable=SC2162 940a7e741d5Smrg saved_IFS=$IFS 941a7e741d5Smrg IFS="-" read cpu vendor <<EOF 942b0a0317aSmrg$basic_machine 943b0a0317aSmrgEOF 944a7e741d5Smrg IFS=$saved_IFS 9454456fccdSmrg ;; 946b0a0317aSmrg # We use `pc' rather than `unknown' 947b0a0317aSmrg # because (1) that's what they normally are, and 948b0a0317aSmrg # (2) the word "unknown" tends to confuse beginning users. 949b0a0317aSmrg i*86 | x86_64) 950b0a0317aSmrg cpu=$basic_machine 951b0a0317aSmrg vendor=pc 9524456fccdSmrg ;; 953b0a0317aSmrg # These rules are duplicated from below for sake of the special case above; 954b0a0317aSmrg # i.e. things that normalized to x86 arches should also default to "pc" 955b0a0317aSmrg pc98) 956b0a0317aSmrg cpu=i386 957b0a0317aSmrg vendor=pc 9584456fccdSmrg ;; 959b0a0317aSmrg x64 | amd64) 960b0a0317aSmrg cpu=x86_64 961b0a0317aSmrg vendor=pc 9624456fccdSmrg ;; 963b0a0317aSmrg # Recognize the basic CPU types without company name. 964b0a0317aSmrg *) 965b0a0317aSmrg cpu=$basic_machine 966b0a0317aSmrg vendor=unknown 9673e6c936aSmrg ;; 968b0a0317aSmrgesac 969b0a0317aSmrg 970b0a0317aSmrgunset -v basic_machine 971b0a0317aSmrg 972b0a0317aSmrg# Decode basic machines in the full and proper CPU-Company form. 973b0a0317aSmrgcase $cpu-$vendor in 974a7e741d5Smrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 975b0a0317aSmrg # some cases the only manufacturer, in others, it is the most popular. 976b0a0317aSmrg craynv-unknown) 977b0a0317aSmrg vendor=cray 978a7e741d5Smrg basic_os=${basic_os:-unicosmp} 9794456fccdSmrg ;; 980b0a0317aSmrg c90-unknown | c90-cray) 981b0a0317aSmrg vendor=cray 982a7e741d5Smrg basic_os=${Basic_os:-unicos} 9834456fccdSmrg ;; 984b0a0317aSmrg fx80-unknown) 985b0a0317aSmrg vendor=alliant 9864456fccdSmrg ;; 987b0a0317aSmrg romp-unknown) 988b0a0317aSmrg vendor=ibm 9894456fccdSmrg ;; 990b0a0317aSmrg mmix-unknown) 991b0a0317aSmrg vendor=knuth 9924456fccdSmrg ;; 993b0a0317aSmrg microblaze-unknown | microblazeel-unknown) 994b0a0317aSmrg vendor=xilinx 9954456fccdSmrg ;; 996b0a0317aSmrg rs6000-unknown) 997b0a0317aSmrg vendor=ibm 9984456fccdSmrg ;; 999b0a0317aSmrg vax-unknown) 1000b0a0317aSmrg vendor=dec 10014456fccdSmrg ;; 1002b0a0317aSmrg pdp11-unknown) 1003b0a0317aSmrg vendor=dec 10044456fccdSmrg ;; 1005b0a0317aSmrg we32k-unknown) 1006b0a0317aSmrg vendor=att 10074456fccdSmrg ;; 1008b0a0317aSmrg cydra-unknown) 1009b0a0317aSmrg vendor=cydrome 10104456fccdSmrg ;; 1011b0a0317aSmrg i370-ibm*) 1012b0a0317aSmrg vendor=ibm 10134456fccdSmrg ;; 1014b0a0317aSmrg orion-unknown) 1015b0a0317aSmrg vendor=highlevel 10164456fccdSmrg ;; 1017b0a0317aSmrg xps-unknown | xps100-unknown) 1018b0a0317aSmrg cpu=xps100 1019b0a0317aSmrg vendor=honeywell 10204456fccdSmrg ;; 1021b0a0317aSmrg 1022b0a0317aSmrg # Here we normalize CPU types with a missing or matching vendor 1023a7e741d5Smrg armh-unknown | armh-alt) 1024a7e741d5Smrg cpu=armv7l 1025a7e741d5Smrg vendor=alt 1026a7e741d5Smrg basic_os=${basic_os:-linux-gnueabihf} 1027a7e741d5Smrg ;; 1028b0a0317aSmrg dpx20-unknown | dpx20-bull) 1029b0a0317aSmrg cpu=rs6000 1030b0a0317aSmrg vendor=bull 1031a7e741d5Smrg basic_os=${basic_os:-bosx} 10324456fccdSmrg ;; 1033b0a0317aSmrg 1034b0a0317aSmrg # Here we normalize CPU types irrespective of the vendor 1035b0a0317aSmrg amd64-*) 1036b0a0317aSmrg cpu=x86_64 103742d69509Smrg ;; 1038b0a0317aSmrg blackfin-*) 1039b0a0317aSmrg cpu=bfin 1040a7e741d5Smrg basic_os=linux 10414456fccdSmrg ;; 1042b0a0317aSmrg c54x-*) 1043b0a0317aSmrg cpu=tic54x 10444456fccdSmrg ;; 1045b0a0317aSmrg c55x-*) 1046b0a0317aSmrg cpu=tic55x 10474456fccdSmrg ;; 1048b0a0317aSmrg c6x-*) 1049b0a0317aSmrg cpu=tic6x 10504456fccdSmrg ;; 1051b0a0317aSmrg e500v[12]-*) 1052b0a0317aSmrg cpu=powerpc 1053a7e741d5Smrg basic_os=${basic_os}"spe" 10544456fccdSmrg ;; 1055b0a0317aSmrg mips3*-*) 1056b0a0317aSmrg cpu=mips64 10574456fccdSmrg ;; 1058b0a0317aSmrg ms1-*) 1059b0a0317aSmrg cpu=mt 10604456fccdSmrg ;; 1061b0a0317aSmrg m68knommu-*) 1062b0a0317aSmrg cpu=m68k 1063a7e741d5Smrg basic_os=linux 10644456fccdSmrg ;; 1065b0a0317aSmrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 1066b0a0317aSmrg cpu=s12z 10674456fccdSmrg ;; 1068b0a0317aSmrg openrisc-*) 1069b0a0317aSmrg cpu=or32 10704456fccdSmrg ;; 1071b0a0317aSmrg parisc-*) 1072b0a0317aSmrg cpu=hppa 1073a7e741d5Smrg basic_os=linux 10744456fccdSmrg ;; 1075b0a0317aSmrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1076b0a0317aSmrg cpu=i586 10774456fccdSmrg ;; 1078a7e741d5Smrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 1079b0a0317aSmrg cpu=i686 10804456fccdSmrg ;; 1081b0a0317aSmrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1082b0a0317aSmrg cpu=i686 10834456fccdSmrg ;; 1084b0a0317aSmrg pentium4-*) 1085b0a0317aSmrg cpu=i786 10864456fccdSmrg ;; 1087b0a0317aSmrg pc98-*) 1088b0a0317aSmrg cpu=i386 10894456fccdSmrg ;; 1090b0a0317aSmrg ppc-* | ppcbe-*) 1091b0a0317aSmrg cpu=powerpc 10924456fccdSmrg ;; 1093b0a0317aSmrg ppcle-* | powerpclittle-*) 1094b0a0317aSmrg cpu=powerpcle 10954456fccdSmrg ;; 1096b0a0317aSmrg ppc64-*) 1097b0a0317aSmrg cpu=powerpc64 10983e6c936aSmrg ;; 1099b0a0317aSmrg ppc64le-* | powerpc64little-*) 1100b0a0317aSmrg cpu=powerpc64le 11014456fccdSmrg ;; 1102b0a0317aSmrg sb1-*) 1103b0a0317aSmrg cpu=mipsisa64sb1 11044456fccdSmrg ;; 1105b0a0317aSmrg sb1el-*) 1106b0a0317aSmrg cpu=mipsisa64sb1el 1107521070a0Smrg ;; 1108b0a0317aSmrg sh5e[lb]-*) 1109b0a0317aSmrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 11104456fccdSmrg ;; 1111b0a0317aSmrg spur-*) 1112b0a0317aSmrg cpu=spur 11134456fccdSmrg ;; 1114b0a0317aSmrg strongarm-* | thumb-*) 1115b0a0317aSmrg cpu=arm 11164456fccdSmrg ;; 1117b0a0317aSmrg tx39-*) 1118b0a0317aSmrg cpu=mipstx39 11194456fccdSmrg ;; 1120b0a0317aSmrg tx39el-*) 1121b0a0317aSmrg cpu=mipstx39el 11224456fccdSmrg ;; 1123b0a0317aSmrg x64-*) 1124b0a0317aSmrg cpu=x86_64 11254456fccdSmrg ;; 1126b0a0317aSmrg xscale-* | xscalee[bl]-*) 1127b0a0317aSmrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 11284456fccdSmrg ;; 1129a7e741d5Smrg arm64-* | aarch64le-*) 1130a7e741d5Smrg cpu=aarch64 1131a7e741d5Smrg ;; 1132b0a0317aSmrg 1133a7e741d5Smrg # Recognize the canonical CPU Types that limit and/or modify the 1134b0a0317aSmrg # company names they are paired with. 1135b0a0317aSmrg cr16-*) 1136a7e741d5Smrg basic_os=${basic_os:-elf} 11374456fccdSmrg ;; 1138b0a0317aSmrg crisv32-* | etraxfs*-*) 1139b0a0317aSmrg cpu=crisv32 1140b0a0317aSmrg vendor=axis 11414456fccdSmrg ;; 1142b0a0317aSmrg cris-* | etrax*-*) 1143b0a0317aSmrg cpu=cris 1144b0a0317aSmrg vendor=axis 11454456fccdSmrg ;; 1146b0a0317aSmrg crx-*) 1147a7e741d5Smrg basic_os=${basic_os:-elf} 11484456fccdSmrg ;; 1149b0a0317aSmrg neo-tandem) 1150b0a0317aSmrg cpu=neo 1151b0a0317aSmrg vendor=tandem 11524456fccdSmrg ;; 1153b0a0317aSmrg nse-tandem) 1154b0a0317aSmrg cpu=nse 1155b0a0317aSmrg vendor=tandem 11564456fccdSmrg ;; 1157b0a0317aSmrg nsr-tandem) 1158b0a0317aSmrg cpu=nsr 1159b0a0317aSmrg vendor=tandem 11604456fccdSmrg ;; 1161b0a0317aSmrg nsv-tandem) 1162b0a0317aSmrg cpu=nsv 1163b0a0317aSmrg vendor=tandem 11644456fccdSmrg ;; 1165b0a0317aSmrg nsx-tandem) 1166b0a0317aSmrg cpu=nsx 1167b0a0317aSmrg vendor=tandem 11684456fccdSmrg ;; 1169a7e741d5Smrg mipsallegrexel-sony) 1170a7e741d5Smrg cpu=mipsallegrexel 1171a7e741d5Smrg vendor=sony 11724456fccdSmrg ;; 1173b0a0317aSmrg tile*-*) 1174a7e741d5Smrg basic_os=${basic_os:-linux-gnu} 11754456fccdSmrg ;; 1176b0a0317aSmrg 11774456fccdSmrg *) 1178a7e741d5Smrg # Recognize the canonical CPU types that are allowed with any 1179b0a0317aSmrg # company name. 1180b0a0317aSmrg case $cpu in 1181b0a0317aSmrg 1750a | 580 \ 1182b0a0317aSmrg | a29k \ 1183b0a0317aSmrg | aarch64 | aarch64_be \ 1184b0a0317aSmrg | abacus \ 1185b0a0317aSmrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 1186b0a0317aSmrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 1187b0a0317aSmrg | alphapca5[67] | alpha64pca5[67] \ 1188b0a0317aSmrg | am33_2.0 \ 1189a7e741d5Smrg | amdgcn \ 1190a7e741d5Smrg | arc | arceb | arc32 | arc64 \ 1191a7e741d5Smrg | arm | arm[lb]e | arme[lb] | armv* \ 1192b0a0317aSmrg | avr | avr32 \ 1193b0a0317aSmrg | asmjs \ 1194b0a0317aSmrg | ba \ 1195b0a0317aSmrg | be32 | be64 \ 1196a7e741d5Smrg | bfin | bpf | bs2000 \ 1197b0a0317aSmrg | c[123]* | c30 | [cjt]90 | c4x \ 1198b0a0317aSmrg | c8051 | clipper | craynv | csky | cydra \ 1199b0a0317aSmrg | d10v | d30v | dlx | dsp16xx \ 1200b0a0317aSmrg | e2k | elxsi | epiphany \ 1201b0a0317aSmrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1202b0a0317aSmrg | h8300 | h8500 \ 1203b0a0317aSmrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 1204b0a0317aSmrg | hexagon \ 1205b0a0317aSmrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 1206b0a0317aSmrg | ip2k | iq2000 \ 1207b0a0317aSmrg | k1om \ 1208b0a0317aSmrg | le32 | le64 \ 1209b0a0317aSmrg | lm32 \ 1210a7e741d5Smrg | loongarch32 | loongarch64 \ 1211b0a0317aSmrg | m32c | m32r | m32rle \ 1212a7e741d5Smrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 1213a7e741d5Smrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 1214b0a0317aSmrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 1215b0a0317aSmrg | microblaze | microblazeel \ 1216b0a0317aSmrg | mips | mipsbe | mipseb | mipsel | mipsle \ 1217b0a0317aSmrg | mips16 \ 1218a7e741d5Smrg | mips64 | mips64eb | mips64el \ 1219b0a0317aSmrg | mips64octeon | mips64octeonel \ 1220b0a0317aSmrg | mips64orion | mips64orionel \ 1221b0a0317aSmrg | mips64r5900 | mips64r5900el \ 1222b0a0317aSmrg | mips64vr | mips64vrel \ 1223b0a0317aSmrg | mips64vr4100 | mips64vr4100el \ 1224b0a0317aSmrg | mips64vr4300 | mips64vr4300el \ 1225b0a0317aSmrg | mips64vr5000 | mips64vr5000el \ 1226b0a0317aSmrg | mips64vr5900 | mips64vr5900el \ 1227b0a0317aSmrg | mipsisa32 | mipsisa32el \ 1228b0a0317aSmrg | mipsisa32r2 | mipsisa32r2el \ 1229a7e741d5Smrg | mipsisa32r3 | mipsisa32r3el \ 1230a7e741d5Smrg | mipsisa32r5 | mipsisa32r5el \ 1231b0a0317aSmrg | mipsisa32r6 | mipsisa32r6el \ 1232b0a0317aSmrg | mipsisa64 | mipsisa64el \ 1233b0a0317aSmrg | mipsisa64r2 | mipsisa64r2el \ 1234a7e741d5Smrg | mipsisa64r3 | mipsisa64r3el \ 1235a7e741d5Smrg | mipsisa64r5 | mipsisa64r5el \ 1236b0a0317aSmrg | mipsisa64r6 | mipsisa64r6el \ 1237b0a0317aSmrg | mipsisa64sb1 | mipsisa64sb1el \ 1238b0a0317aSmrg | mipsisa64sr71k | mipsisa64sr71kel \ 1239b0a0317aSmrg | mipsr5900 | mipsr5900el \ 1240b0a0317aSmrg | mipstx39 | mipstx39el \ 1241b0a0317aSmrg | mmix \ 1242b0a0317aSmrg | mn10200 | mn10300 \ 1243b0a0317aSmrg | moxie \ 1244b0a0317aSmrg | mt \ 1245b0a0317aSmrg | msp430 \ 1246b0a0317aSmrg | nds32 | nds32le | nds32be \ 1247b0a0317aSmrg | nfp \ 1248b0a0317aSmrg | nios | nios2 | nios2eb | nios2el \ 1249a7e741d5Smrg | none | np1 | ns16k | ns32k | nvptx \ 1250b0a0317aSmrg | open8 \ 1251b0a0317aSmrg | or1k* \ 1252b0a0317aSmrg | or32 \ 1253b0a0317aSmrg | orion \ 1254a7e741d5Smrg | picochip \ 1255b0a0317aSmrg | pdp10 | pdp11 | pj | pjl | pn | power \ 1256b0a0317aSmrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 1257b0a0317aSmrg | pru \ 1258b0a0317aSmrg | pyramid \ 1259a7e741d5Smrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 1260b0a0317aSmrg | rl78 | romp | rs6000 | rx \ 1261a7e741d5Smrg | s390 | s390x \ 1262b0a0317aSmrg | score \ 1263a7e741d5Smrg | sh | shl \ 1264a7e741d5Smrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 1265b0a0317aSmrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 1266b0a0317aSmrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 1267b0a0317aSmrg | sparclite \ 1268b0a0317aSmrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 1269b0a0317aSmrg | spu \ 1270b0a0317aSmrg | tahoe \ 1271a7e741d5Smrg | thumbv7* \ 1272b0a0317aSmrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 1273b0a0317aSmrg | tron \ 1274b0a0317aSmrg | ubicom32 \ 1275a7e741d5Smrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 1276b0a0317aSmrg | vax \ 1277b0a0317aSmrg | visium \ 1278a7e741d5Smrg | w65 \ 1279a7e741d5Smrg | wasm32 | wasm64 \ 1280b0a0317aSmrg | we32k \ 1281b0a0317aSmrg | x86 | x86_64 | xc16x | xgate | xps100 \ 1282b0a0317aSmrg | xstormy16 | xtensa* \ 1283b0a0317aSmrg | ymp \ 1284b0a0317aSmrg | z8k | z80) 1285b0a0317aSmrg ;; 1286b0a0317aSmrg 1287b0a0317aSmrg *) 1288b0a0317aSmrg echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 1289b0a0317aSmrg exit 1 1290b0a0317aSmrg ;; 1291b0a0317aSmrg esac 12924456fccdSmrg ;; 12934456fccdSmrgesac 12944456fccdSmrg 12954456fccdSmrg# Here we canonicalize certain aliases for manufacturers. 1296b0a0317aSmrgcase $vendor in 1297b0a0317aSmrg digital*) 1298b0a0317aSmrg vendor=dec 12994456fccdSmrg ;; 1300b0a0317aSmrg commodore*) 1301b0a0317aSmrg vendor=cbm 13024456fccdSmrg ;; 13034456fccdSmrg *) 13044456fccdSmrg ;; 13054456fccdSmrgesac 13064456fccdSmrg 13074456fccdSmrg# Decode manufacturer-specific aliases for certain operating systems. 13084456fccdSmrg 1309a7e741d5Smrgif test x$basic_os != x 13104456fccdSmrgthen 1311a7e741d5Smrg 1312a7e741d5Smrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 1313a7e741d5Smrg# set os. 1314a7e741d5Smrgcase $basic_os in 1315a7e741d5Smrg gnu/linux*) 1316a7e741d5Smrg kernel=linux 1317a7e741d5Smrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 1318a7e741d5Smrg ;; 1319a7e741d5Smrg os2-emx) 1320a7e741d5Smrg kernel=os2 1321a7e741d5Smrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 1322a7e741d5Smrg ;; 1323a7e741d5Smrg nto-qnx*) 1324a7e741d5Smrg kernel=nto 1325a7e741d5Smrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 1326a7e741d5Smrg ;; 1327a7e741d5Smrg *-*) 1328a7e741d5Smrg # shellcheck disable=SC2162 1329a7e741d5Smrg saved_IFS=$IFS 1330a7e741d5Smrg IFS="-" read kernel os <<EOF 1331a7e741d5Smrg$basic_os 1332a7e741d5SmrgEOF 1333a7e741d5Smrg IFS=$saved_IFS 1334a7e741d5Smrg ;; 1335a7e741d5Smrg # Default OS when just kernel was specified 1336a7e741d5Smrg nto*) 1337a7e741d5Smrg kernel=nto 1338a7e741d5Smrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 1339a7e741d5Smrg ;; 1340a7e741d5Smrg linux*) 1341a7e741d5Smrg kernel=linux 1342a7e741d5Smrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 1343a7e741d5Smrg ;; 1344a7e741d5Smrg managarm*) 1345a7e741d5Smrg kernel=managarm 1346a7e741d5Smrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 1347a7e741d5Smrg ;; 1348a7e741d5Smrg *) 1349a7e741d5Smrg kernel= 1350a7e741d5Smrg os=$basic_os 1351a7e741d5Smrg ;; 1352a7e741d5Smrgesac 1353a7e741d5Smrg 1354a7e741d5Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 1355a7e741d5Smrg# etc.) 13564456fccdSmrgcase $os in 1357b0a0317aSmrg # First match some system type aliases that might get confused 1358b0a0317aSmrg # with valid system types. 1359b0a0317aSmrg # solaris* is a basic system type, with this one exception. 1360b0a0317aSmrg auroraux) 1361b0a0317aSmrg os=auroraux 1362521070a0Smrg ;; 1363b0a0317aSmrg bluegene*) 1364b0a0317aSmrg os=cnk 13654456fccdSmrg ;; 1366b0a0317aSmrg solaris1 | solaris1.*) 1367a7e741d5Smrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 13684456fccdSmrg ;; 1369b0a0317aSmrg solaris) 1370b0a0317aSmrg os=solaris2 13714456fccdSmrg ;; 1372b0a0317aSmrg unixware*) 1373b0a0317aSmrg os=sysv4.2uw 13744456fccdSmrg ;; 1375b0a0317aSmrg # es1800 is here to avoid being matched by es* (a different OS) 1376b0a0317aSmrg es1800*) 1377b0a0317aSmrg os=ose 1378b0a0317aSmrg ;; 1379b0a0317aSmrg # Some version numbers need modification 1380b0a0317aSmrg chorusos*) 1381b0a0317aSmrg os=chorusos 1382b0a0317aSmrg ;; 1383b0a0317aSmrg isc) 1384b0a0317aSmrg os=isc2.2 1385b0a0317aSmrg ;; 1386b0a0317aSmrg sco6) 1387b0a0317aSmrg os=sco5v6 1388b0a0317aSmrg ;; 1389b0a0317aSmrg sco5) 1390b0a0317aSmrg os=sco3.2v5 1391b0a0317aSmrg ;; 1392b0a0317aSmrg sco4) 1393b0a0317aSmrg os=sco3.2v4 1394b0a0317aSmrg ;; 1395b0a0317aSmrg sco3.2.[4-9]*) 1396a7e741d5Smrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 1397b0a0317aSmrg ;; 1398a7e741d5Smrg sco*v* | scout) 1399b0a0317aSmrg # Don't match below 1400b0a0317aSmrg ;; 1401b0a0317aSmrg sco*) 1402b0a0317aSmrg os=sco3.2v2 1403b0a0317aSmrg ;; 1404b0a0317aSmrg psos*) 1405b0a0317aSmrg os=psos 1406b0a0317aSmrg ;; 1407b0a0317aSmrg qnx*) 1408a7e741d5Smrg os=qnx 14094456fccdSmrg ;; 1410b0a0317aSmrg hiux*) 1411b0a0317aSmrg os=hiuxwe2 14124456fccdSmrg ;; 1413b0a0317aSmrg lynx*178) 1414b0a0317aSmrg os=lynxos178 14154456fccdSmrg ;; 1416b0a0317aSmrg lynx*5) 1417b0a0317aSmrg os=lynxos5 14184456fccdSmrg ;; 1419a7e741d5Smrg lynxos*) 1420a7e741d5Smrg # don't get caught up in next wildcard 1421a7e741d5Smrg ;; 1422b0a0317aSmrg lynx*) 1423b0a0317aSmrg os=lynxos 14244456fccdSmrg ;; 1425a7e741d5Smrg mac[0-9]*) 1426b0a0317aSmrg os=`echo "$os" | sed -e 's|mac|macos|'` 14274456fccdSmrg ;; 1428b0a0317aSmrg opened*) 1429b0a0317aSmrg os=openedition 14304456fccdSmrg ;; 1431b0a0317aSmrg os400*) 1432b0a0317aSmrg os=os400 14334456fccdSmrg ;; 1434b0a0317aSmrg sunos5*) 1435b0a0317aSmrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 14364456fccdSmrg ;; 1437b0a0317aSmrg sunos6*) 1438b0a0317aSmrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 14394456fccdSmrg ;; 1440b0a0317aSmrg wince*) 1441b0a0317aSmrg os=wince 14424456fccdSmrg ;; 1443b0a0317aSmrg utek*) 1444b0a0317aSmrg os=bsd 14454456fccdSmrg ;; 1446b0a0317aSmrg dynix*) 1447b0a0317aSmrg os=bsd 14484456fccdSmrg ;; 1449b0a0317aSmrg acis*) 1450b0a0317aSmrg os=aos 14514456fccdSmrg ;; 1452b0a0317aSmrg atheos*) 1453b0a0317aSmrg os=atheos 14544456fccdSmrg ;; 1455b0a0317aSmrg syllable*) 1456b0a0317aSmrg os=syllable 14574456fccdSmrg ;; 1458b0a0317aSmrg 386bsd) 1459b0a0317aSmrg os=bsd 14604456fccdSmrg ;; 1461b0a0317aSmrg ctix* | uts*) 1462b0a0317aSmrg os=sysv 14634456fccdSmrg ;; 1464b0a0317aSmrg nova*) 1465b0a0317aSmrg os=rtmk-nova 1466b0a0317aSmrg ;; 1467b0a0317aSmrg ns2) 1468b0a0317aSmrg os=nextstep2 1469b0a0317aSmrg ;; 14704456fccdSmrg # Preserve the version number of sinix5. 1471b0a0317aSmrg sinix5.*) 1472a7e741d5Smrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 14734456fccdSmrg ;; 1474b0a0317aSmrg sinix*) 1475b0a0317aSmrg os=sysv4 14764456fccdSmrg ;; 1477b0a0317aSmrg tpf*) 1478b0a0317aSmrg os=tpf 14794456fccdSmrg ;; 1480b0a0317aSmrg triton*) 1481b0a0317aSmrg os=sysv3 14824456fccdSmrg ;; 1483b0a0317aSmrg oss*) 1484b0a0317aSmrg os=sysv3 14854456fccdSmrg ;; 1486b0a0317aSmrg svr4*) 1487b0a0317aSmrg os=sysv4 14884456fccdSmrg ;; 1489b0a0317aSmrg svr3) 1490b0a0317aSmrg os=sysv3 14914456fccdSmrg ;; 1492b0a0317aSmrg sysvr4) 1493b0a0317aSmrg os=sysv4 14944456fccdSmrg ;; 1495b0a0317aSmrg ose*) 1496b0a0317aSmrg os=ose 14974456fccdSmrg ;; 1498b0a0317aSmrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1499b0a0317aSmrg os=mint 15004456fccdSmrg ;; 1501b0a0317aSmrg dicos*) 1502b0a0317aSmrg os=dicos 15034456fccdSmrg ;; 1504b0a0317aSmrg pikeos*) 1505b0a0317aSmrg # Until real need of OS specific support for 1506b0a0317aSmrg # particular features comes up, bare metal 1507b0a0317aSmrg # configurations are quite functional. 1508b0a0317aSmrg case $cpu in 1509b0a0317aSmrg arm*) 1510b0a0317aSmrg os=eabi 1511b0a0317aSmrg ;; 1512b0a0317aSmrg *) 1513b0a0317aSmrg os=elf 1514b0a0317aSmrg ;; 1515b0a0317aSmrg esac 15164456fccdSmrg ;; 15174456fccdSmrg *) 1518a7e741d5Smrg # No normalization, but not necessarily accepted, that comes below. 15194456fccdSmrg ;; 15204456fccdSmrgesac 1521a7e741d5Smrg 15224456fccdSmrgelse 15234456fccdSmrg 15244456fccdSmrg# Here we handle the default operating systems that come with various machines. 15254456fccdSmrg# The value should be what the vendor currently ships out the door with their 15264456fccdSmrg# machine or put another way, the most popular os provided with the machine. 15274456fccdSmrg 15284456fccdSmrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 15294456fccdSmrg# "-sun"), then you have to tell the case statement up towards the top 15304456fccdSmrg# that MANUFACTURER isn't an operating system. Otherwise, code above 15314456fccdSmrg# will signal an error saying that MANUFACTURER isn't an operating 15324456fccdSmrg# system, and we'll never get to this point. 15334456fccdSmrg 1534a7e741d5Smrgkernel= 1535b0a0317aSmrgcase $cpu-$vendor in 15363e6c936aSmrg score-*) 1537b0a0317aSmrg os=elf 153842d69509Smrg ;; 15393e6c936aSmrg spu-*) 1540b0a0317aSmrg os=elf 154142d69509Smrg ;; 15424456fccdSmrg *-acorn) 1543b0a0317aSmrg os=riscix1.2 15444456fccdSmrg ;; 15454456fccdSmrg arm*-rebel) 1546a7e741d5Smrg kernel=linux 1547a7e741d5Smrg os=gnu 15484456fccdSmrg ;; 15494456fccdSmrg arm*-semi) 1550b0a0317aSmrg os=aout 15514456fccdSmrg ;; 15523e6c936aSmrg c4x-* | tic4x-*) 1553b0a0317aSmrg os=coff 15543e6c936aSmrg ;; 15550f1ac3bcSmrg c8051-*) 1556b0a0317aSmrg os=elf 1557b0a0317aSmrg ;; 1558b0a0317aSmrg clipper-intergraph) 1559b0a0317aSmrg os=clix 15600f1ac3bcSmrg ;; 15613e6c936aSmrg hexagon-*) 1562b0a0317aSmrg os=elf 15633e6c936aSmrg ;; 15643e6c936aSmrg tic54x-*) 1565b0a0317aSmrg os=coff 15663e6c936aSmrg ;; 15673e6c936aSmrg tic55x-*) 1568b0a0317aSmrg os=coff 15693e6c936aSmrg ;; 15703e6c936aSmrg tic6x-*) 1571b0a0317aSmrg os=coff 157242d69509Smrg ;; 15734456fccdSmrg # This must come before the *-dec entry. 15744456fccdSmrg pdp10-*) 1575b0a0317aSmrg os=tops20 15764456fccdSmrg ;; 15774456fccdSmrg pdp11-*) 1578b0a0317aSmrg os=none 15794456fccdSmrg ;; 15804456fccdSmrg *-dec | vax-*) 1581b0a0317aSmrg os=ultrix4.2 15824456fccdSmrg ;; 15834456fccdSmrg m68*-apollo) 1584b0a0317aSmrg os=domain 15854456fccdSmrg ;; 15864456fccdSmrg i386-sun) 1587b0a0317aSmrg os=sunos4.0.2 15884456fccdSmrg ;; 15894456fccdSmrg m68000-sun) 1590b0a0317aSmrg os=sunos3 15914456fccdSmrg ;; 15924456fccdSmrg m68*-cisco) 1593b0a0317aSmrg os=aout 15944456fccdSmrg ;; 15953e6c936aSmrg mep-*) 1596b0a0317aSmrg os=elf 159742d69509Smrg ;; 15984456fccdSmrg mips*-cisco) 1599b0a0317aSmrg os=elf 16004456fccdSmrg ;; 16014456fccdSmrg mips*-*) 1602b0a0317aSmrg os=elf 16033e6c936aSmrg ;; 16044456fccdSmrg or32-*) 1605b0a0317aSmrg os=coff 16064456fccdSmrg ;; 16074456fccdSmrg *-tti) # must be before sparc entry or we get the wrong os. 1608b0a0317aSmrg os=sysv3 16094456fccdSmrg ;; 16104456fccdSmrg sparc-* | *-sun) 1611b0a0317aSmrg os=sunos4.1.1 16124456fccdSmrg ;; 1613b0a0317aSmrg pru-*) 1614b0a0317aSmrg os=elf 16154456fccdSmrg ;; 1616b0a0317aSmrg *-be) 1617b0a0317aSmrg os=beos 16184456fccdSmrg ;; 16194456fccdSmrg *-ibm) 1620b0a0317aSmrg os=aix 16214456fccdSmrg ;; 16223e6c936aSmrg *-knuth) 1623b0a0317aSmrg os=mmixware 16244456fccdSmrg ;; 16254456fccdSmrg *-wec) 1626b0a0317aSmrg os=proelf 16274456fccdSmrg ;; 16284456fccdSmrg *-winbond) 1629b0a0317aSmrg os=proelf 16304456fccdSmrg ;; 16314456fccdSmrg *-oki) 1632b0a0317aSmrg os=proelf 16334456fccdSmrg ;; 16344456fccdSmrg *-hp) 1635b0a0317aSmrg os=hpux 16364456fccdSmrg ;; 16374456fccdSmrg *-hitachi) 1638b0a0317aSmrg os=hiux 16394456fccdSmrg ;; 16404456fccdSmrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1641b0a0317aSmrg os=sysv 16424456fccdSmrg ;; 16434456fccdSmrg *-cbm) 1644b0a0317aSmrg os=amigaos 16454456fccdSmrg ;; 16464456fccdSmrg *-dg) 1647b0a0317aSmrg os=dgux 16484456fccdSmrg ;; 16494456fccdSmrg *-dolphin) 1650b0a0317aSmrg os=sysv3 16514456fccdSmrg ;; 16524456fccdSmrg m68k-ccur) 1653b0a0317aSmrg os=rtu 16544456fccdSmrg ;; 16554456fccdSmrg m88k-omron*) 1656b0a0317aSmrg os=luna 16574456fccdSmrg ;; 1658b0a0317aSmrg *-next) 1659b0a0317aSmrg os=nextstep 16604456fccdSmrg ;; 16614456fccdSmrg *-sequent) 1662b0a0317aSmrg os=ptx 16634456fccdSmrg ;; 16644456fccdSmrg *-crds) 1665b0a0317aSmrg os=unos 16664456fccdSmrg ;; 16674456fccdSmrg *-ns) 1668b0a0317aSmrg os=genix 16694456fccdSmrg ;; 16704456fccdSmrg i370-*) 1671b0a0317aSmrg os=mvs 16724456fccdSmrg ;; 16734456fccdSmrg *-gould) 1674b0a0317aSmrg os=sysv 16754456fccdSmrg ;; 16764456fccdSmrg *-highlevel) 1677b0a0317aSmrg os=bsd 16784456fccdSmrg ;; 16794456fccdSmrg *-encore) 1680b0a0317aSmrg os=bsd 16814456fccdSmrg ;; 16824456fccdSmrg *-sgi) 1683b0a0317aSmrg os=irix 16844456fccdSmrg ;; 16854456fccdSmrg *-siemens) 1686b0a0317aSmrg os=sysv4 16874456fccdSmrg ;; 16884456fccdSmrg *-masscomp) 1689b0a0317aSmrg os=rtu 16904456fccdSmrg ;; 16914456fccdSmrg f30[01]-fujitsu | f700-fujitsu) 1692b0a0317aSmrg os=uxpv 16934456fccdSmrg ;; 16944456fccdSmrg *-rom68k) 1695b0a0317aSmrg os=coff 16964456fccdSmrg ;; 16974456fccdSmrg *-*bug) 1698b0a0317aSmrg os=coff 16994456fccdSmrg ;; 17004456fccdSmrg *-apple) 1701b0a0317aSmrg os=macos 17024456fccdSmrg ;; 17034456fccdSmrg *-atari*) 1704b0a0317aSmrg os=mint 1705b0a0317aSmrg ;; 1706b0a0317aSmrg *-wrs) 1707b0a0317aSmrg os=vxworks 17084456fccdSmrg ;; 17094456fccdSmrg *) 1710b0a0317aSmrg os=none 17114456fccdSmrg ;; 17124456fccdSmrgesac 1713a7e741d5Smrg 17144456fccdSmrgfi 17154456fccdSmrg 1716a7e741d5Smrg# Now, validate our (potentially fixed-up) OS. 1717a7e741d5Smrgcase $os in 1718a7e741d5Smrg # Sometimes we do "kernel-libc", so those need to count as OSes. 1719a7e741d5Smrg musl* | newlib* | relibc* | uclibc*) 1720a7e741d5Smrg ;; 1721a7e741d5Smrg # Likewise for "kernel-abi" 1722a7e741d5Smrg eabi* | gnueabi*) 1723a7e741d5Smrg ;; 1724a7e741d5Smrg # VxWorks passes extra cpu info in the 4th filed. 1725a7e741d5Smrg simlinux | simwindows | spe) 1726a7e741d5Smrg ;; 1727a7e741d5Smrg # Now accept the basic system types. 1728a7e741d5Smrg # The portable systems comes first. 1729a7e741d5Smrg # Each alternative MUST end in a * to match a version number. 1730a7e741d5Smrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1731a7e741d5Smrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 1732a7e741d5Smrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1733a7e741d5Smrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 1734a7e741d5Smrg | hiux* | abug | nacl* | netware* | windows* \ 1735a7e741d5Smrg | os9* | macos* | osx* | ios* \ 1736a7e741d5Smrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 1737a7e741d5Smrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1738a7e741d5Smrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 1739a7e741d5Smrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1740a7e741d5Smrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 1741a7e741d5Smrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 1742a7e741d5Smrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 1743a7e741d5Smrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1744a7e741d5Smrg | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1745a7e741d5Smrg | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1746a7e741d5Smrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 1747a7e741d5Smrg | chorusrdb* | cegcc* | glidix* | serenity* \ 1748a7e741d5Smrg | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 1749a7e741d5Smrg | midipix* | mingw32* | mingw64* | mint* \ 1750a7e741d5Smrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1751a7e741d5Smrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 1752a7e741d5Smrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 1753a7e741d5Smrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 1754a7e741d5Smrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 1755a7e741d5Smrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 1756a7e741d5Smrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 1757a7e741d5Smrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 1758a7e741d5Smrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 1759a7e741d5Smrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1760a7e741d5Smrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1761a7e741d5Smrg | fiwix* | mlibc* ) 1762a7e741d5Smrg ;; 1763a7e741d5Smrg # This one is extra strict with allowed versions 1764a7e741d5Smrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 1765a7e741d5Smrg # Don't forget version if it is 3.2v4 or newer. 1766a7e741d5Smrg ;; 1767a7e741d5Smrg none) 1768a7e741d5Smrg ;; 1769a7e741d5Smrg kernel* ) 1770a7e741d5Smrg # Restricted further below 1771a7e741d5Smrg ;; 1772a7e741d5Smrg *) 1773a7e741d5Smrg echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 1774a7e741d5Smrg exit 1 1775a7e741d5Smrg ;; 1776a7e741d5Smrgesac 1777a7e741d5Smrg 1778a7e741d5Smrg# As a final step for OS-related things, validate the OS-kernel combination 1779a7e741d5Smrg# (given a valid OS), if there is a kernel. 1780a7e741d5Smrgcase $kernel-$os in 1781a7e741d5Smrg linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 1782a7e741d5Smrg | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 1783a7e741d5Smrg ;; 1784a7e741d5Smrg uclinux-uclibc* ) 1785a7e741d5Smrg ;; 1786a7e741d5Smrg managarm-mlibc* | managarm-kernel* ) 1787a7e741d5Smrg ;; 1788a7e741d5Smrg -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 1789a7e741d5Smrg # These are just libc implementations, not actual OSes, and thus 1790a7e741d5Smrg # require a kernel. 1791a7e741d5Smrg echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 1792a7e741d5Smrg exit 1 1793a7e741d5Smrg ;; 1794a7e741d5Smrg -kernel* ) 1795a7e741d5Smrg echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 1796a7e741d5Smrg exit 1 1797a7e741d5Smrg ;; 1798a7e741d5Smrg *-kernel* ) 1799a7e741d5Smrg echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 1800a7e741d5Smrg exit 1 1801a7e741d5Smrg ;; 1802a7e741d5Smrg kfreebsd*-gnu* | kopensolaris*-gnu*) 1803a7e741d5Smrg ;; 1804a7e741d5Smrg vxworks-simlinux | vxworks-simwindows | vxworks-spe) 1805a7e741d5Smrg ;; 1806a7e741d5Smrg nto-qnx*) 1807a7e741d5Smrg ;; 1808a7e741d5Smrg os2-emx) 1809a7e741d5Smrg ;; 1810a7e741d5Smrg *-eabi* | *-gnueabi*) 1811a7e741d5Smrg ;; 1812a7e741d5Smrg -*) 1813a7e741d5Smrg # Blank kernel with real OS is always fine. 1814a7e741d5Smrg ;; 1815a7e741d5Smrg *-*) 1816a7e741d5Smrg echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 1817a7e741d5Smrg exit 1 1818a7e741d5Smrg ;; 1819a7e741d5Smrgesac 1820a7e741d5Smrg 18214456fccdSmrg# Here we handle the case where we know the os, and the CPU type, but not the 18224456fccdSmrg# manufacturer. We pick the logical manufacturer. 1823b0a0317aSmrgcase $vendor in 1824b0a0317aSmrg unknown) 1825a7e741d5Smrg case $cpu-$os in 1826a7e741d5Smrg *-riscix*) 18274456fccdSmrg vendor=acorn 18284456fccdSmrg ;; 1829a7e741d5Smrg *-sunos*) 18304456fccdSmrg vendor=sun 18314456fccdSmrg ;; 1832a7e741d5Smrg *-cnk* | *-aix*) 18334456fccdSmrg vendor=ibm 18344456fccdSmrg ;; 1835a7e741d5Smrg *-beos*) 18364456fccdSmrg vendor=be 18374456fccdSmrg ;; 1838a7e741d5Smrg *-hpux*) 18394456fccdSmrg vendor=hp 18404456fccdSmrg ;; 1841a7e741d5Smrg *-mpeix*) 18424456fccdSmrg vendor=hp 18434456fccdSmrg ;; 1844a7e741d5Smrg *-hiux*) 18454456fccdSmrg vendor=hitachi 18464456fccdSmrg ;; 1847a7e741d5Smrg *-unos*) 18484456fccdSmrg vendor=crds 18494456fccdSmrg ;; 1850a7e741d5Smrg *-dgux*) 18514456fccdSmrg vendor=dg 18524456fccdSmrg ;; 1853a7e741d5Smrg *-luna*) 18544456fccdSmrg vendor=omron 18554456fccdSmrg ;; 1856a7e741d5Smrg *-genix*) 18574456fccdSmrg vendor=ns 18584456fccdSmrg ;; 1859a7e741d5Smrg *-clix*) 1860b0a0317aSmrg vendor=intergraph 1861b0a0317aSmrg ;; 1862a7e741d5Smrg *-mvs* | *-opened*) 1863a7e741d5Smrg vendor=ibm 1864a7e741d5Smrg ;; 1865a7e741d5Smrg *-os400*) 18664456fccdSmrg vendor=ibm 18674456fccdSmrg ;; 1868a7e741d5Smrg s390-* | s390x-*) 18694456fccdSmrg vendor=ibm 18704456fccdSmrg ;; 1871a7e741d5Smrg *-ptx*) 18724456fccdSmrg vendor=sequent 18734456fccdSmrg ;; 1874a7e741d5Smrg *-tpf*) 18754456fccdSmrg vendor=ibm 18764456fccdSmrg ;; 1877a7e741d5Smrg *-vxsim* | *-vxworks* | *-windiss*) 18784456fccdSmrg vendor=wrs 18794456fccdSmrg ;; 1880a7e741d5Smrg *-aux*) 18814456fccdSmrg vendor=apple 18824456fccdSmrg ;; 1883a7e741d5Smrg *-hms*) 18844456fccdSmrg vendor=hitachi 18854456fccdSmrg ;; 1886a7e741d5Smrg *-mpw* | *-macos*) 18874456fccdSmrg vendor=apple 18884456fccdSmrg ;; 1889a7e741d5Smrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 18904456fccdSmrg vendor=atari 18914456fccdSmrg ;; 1892a7e741d5Smrg *-vos*) 18934456fccdSmrg vendor=stratus 18944456fccdSmrg ;; 18954456fccdSmrg esac 18964456fccdSmrg ;; 18974456fccdSmrgesac 18984456fccdSmrg 1899a7e741d5Smrgecho "$cpu-$vendor-${kernel:+$kernel-}$os" 19004456fccdSmrgexit 19014456fccdSmrg 19024456fccdSmrg# Local variables: 1903b0a0317aSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 19044456fccdSmrg# time-stamp-start: "timestamp='" 19054456fccdSmrg# time-stamp-format: "%:y-%02m-%02d" 19064456fccdSmrg# time-stamp-end: "'" 19074456fccdSmrg# End: 1908