19fe995a9Smrg#! /bin/sh 29fe995a9Smrg# Configuration validation subroutine script. 3772b5186Smrg# Copyright 1992-2023 Free Software Foundation, Inc. 49fe995a9Smrg 5c048b52eSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale 6c048b52eSmrg 7772b5186Smrgtimestamp='2023-01-21' 89fe995a9Smrg 99d794632Smrg# This file is free software; you can redistribute it and/or modify it 109d794632Smrg# under the terms of the GNU General Public License as published by 11772b5186Smrg# the Free Software Foundation, either version 3 of the License, or 129fe995a9Smrg# (at your option) any later version. 139fe995a9Smrg# 149d794632Smrg# This program is distributed in the hope that it will be useful, but 159d794632Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 169d794632Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 179d794632Smrg# General Public License for more details. 189fe995a9Smrg# 199fe995a9Smrg# You should have received a copy of the GNU General Public License 206fbef84aSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 219fe995a9Smrg# 229fe995a9Smrg# As a special exception to the GNU General Public License, if you 239fe995a9Smrg# distribute this file as part of a program that contains a 249fe995a9Smrg# configuration script generated by Autoconf, you may include it under 259d794632Smrg# the same distribution terms that you use for the rest of that 269d794632Smrg# program. This Exception is an additional permission under section 7 279d794632Smrg# of the GNU General Public License, version 3 ("GPLv3"). 289fe995a9Smrg 299fe995a9Smrg 30e8ac26b0Smrg# Please send patches to <config-patches@gnu.org>. 319fe995a9Smrg# 329fe995a9Smrg# Configuration subroutine to validate and canonicalize a configuration type. 339fe995a9Smrg# Supply the specified configuration type as an argument. 349fe995a9Smrg# If it is invalid, we print an error message on stderr and exit with code 1. 359fe995a9Smrg# Otherwise, we print the canonical config type on stdout and succeed. 369fe995a9Smrg 37b62cc08cSmrg# You can get the latest version of this script from: 38c048b52eSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39b62cc08cSmrg 409fe995a9Smrg# This file is supposed to be the same for all GNU packages 419fe995a9Smrg# and recognize all the CPU types, system types and aliases 429fe995a9Smrg# that are meaningful with *any* GNU software. 439fe995a9Smrg# Each package is responsible for reporting which valid configurations 449fe995a9Smrg# it does not support. The user should be able to distinguish 459fe995a9Smrg# a failure to support a valid configuration from a meaningless 469fe995a9Smrg# configuration. 479fe995a9Smrg 489fe995a9Smrg# The goal of this file is to map all the various variations of a given 499fe995a9Smrg# machine specification into a single specification in the form: 509fe995a9Smrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 519fe995a9Smrg# or in some cases, the newer four-part form: 529fe995a9Smrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 539fe995a9Smrg# It is wrong to echo any other type of specification. 549fe995a9Smrg 55c048b52eSmrg# The "shellcheck disable" line above the timestamp inhibits complaints 56c048b52eSmrg# about features and limitations of the classic Bourne shell that were 57c048b52eSmrg# superseded or lifted in POSIX. However, this script identifies a wide 58c048b52eSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 59c048b52eSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still 60c048b52eSmrg# have a pre-POSIX /bin/sh. 61c048b52eSmrg 629fe995a9Smrgme=`echo "$0" | sed -e 's,.*/,,'` 639fe995a9Smrg 649fe995a9Smrgusage="\ 656fbef84aSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 669fe995a9Smrg 679fe995a9SmrgCanonicalize a configuration name. 689fe995a9Smrg 696fbef84aSmrgOptions: 709fe995a9Smrg -h, --help print this help, then exit 719fe995a9Smrg -t, --time-stamp print date of last modification, then exit 729fe995a9Smrg -v, --version print version number, then exit 739fe995a9Smrg 749fe995a9SmrgReport bugs and patches to <config-patches@gnu.org>." 759fe995a9Smrg 769fe995a9Smrgversion="\ 779fe995a9SmrgGNU config.sub ($timestamp) 789fe995a9Smrg 79772b5186SmrgCopyright 1992-2023 Free Software Foundation, Inc. 809fe995a9Smrg 819fe995a9SmrgThis is free software; see the source for copying conditions. There is NO 829fe995a9Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 839fe995a9Smrg 849fe995a9Smrghelp=" 859fe995a9SmrgTry \`$me --help' for more information." 869fe995a9Smrg 879fe995a9Smrg# Parse command line 889fe995a9Smrgwhile test $# -gt 0 ; do 899fe995a9Smrg case $1 in 909fe995a9Smrg --time-stamp | --time* | -t ) 919fe995a9Smrg echo "$timestamp" ; exit ;; 929fe995a9Smrg --version | -v ) 939fe995a9Smrg echo "$version" ; exit ;; 949fe995a9Smrg --help | --h* | -h ) 959fe995a9Smrg echo "$usage"; exit ;; 969fe995a9Smrg -- ) # Stop option processing 979fe995a9Smrg shift; break ;; 989fe995a9Smrg - ) # Use stdin as input. 999fe995a9Smrg break ;; 1009fe995a9Smrg -* ) 101c048b52eSmrg echo "$me: invalid option $1$help" >&2 1029fe995a9Smrg exit 1 ;; 1039fe995a9Smrg 1049fe995a9Smrg *local*) 1059fe995a9Smrg # First pass through any local machine types. 1066fbef84aSmrg echo "$1" 1079fe995a9Smrg exit ;; 1089fe995a9Smrg 1099fe995a9Smrg * ) 1109fe995a9Smrg break ;; 1119fe995a9Smrg esac 1129fe995a9Smrgdone 1139fe995a9Smrg 1149fe995a9Smrgcase $# in 1159fe995a9Smrg 0) echo "$me: missing argument$help" >&2 1169fe995a9Smrg exit 1;; 1179fe995a9Smrg 1) ;; 1189fe995a9Smrg *) echo "$me: too many arguments$help" >&2 1199fe995a9Smrg exit 1;; 1209fe995a9Smrgesac 1219fe995a9Smrg 122c048b52eSmrg# Split fields of configuration type 123c048b52eSmrg# shellcheck disable=SC2162 124c048b52eSmrgsaved_IFS=$IFS 125c048b52eSmrgIFS="-" read field1 field2 field3 field4 <<EOF 126c048b52eSmrg$1 127c048b52eSmrgEOF 128c048b52eSmrgIFS=$saved_IFS 1299fe995a9Smrg 130c048b52eSmrg# Separate into logical components for further validation 131c048b52eSmrgcase $1 in 132c048b52eSmrg *-*-*-*-*) 133c048b52eSmrg echo Invalid configuration \`"$1"\': more than four components >&2 134c048b52eSmrg exit 1 1359d794632Smrg ;; 136c048b52eSmrg *-*-*-*) 137c048b52eSmrg basic_machine=$field1-$field2 138c048b52eSmrg basic_os=$field3-$field4 1399fe995a9Smrg ;; 140c048b52eSmrg *-*-*) 141c048b52eSmrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 142c048b52eSmrg # parts 143c048b52eSmrg maybe_os=$field2-$field3 144c048b52eSmrg case $maybe_os in 145c048b52eSmrg nto-qnx* | linux-* | uclinux-uclibc* \ 146c048b52eSmrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 147c048b52eSmrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 148772b5186Smrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) 149c048b52eSmrg basic_machine=$field1 150c048b52eSmrg basic_os=$maybe_os 151c048b52eSmrg ;; 152c048b52eSmrg android-linux) 153c048b52eSmrg basic_machine=$field1-unknown 154c048b52eSmrg basic_os=linux-android 155c048b52eSmrg ;; 156c048b52eSmrg *) 157c048b52eSmrg basic_machine=$field1-$field2 158c048b52eSmrg basic_os=$field3 159c048b52eSmrg ;; 160c048b52eSmrg esac 1619fe995a9Smrg ;; 162c048b52eSmrg *-*) 163c048b52eSmrg # A lone config we happen to match not fitting any pattern 164c048b52eSmrg case $field1-$field2 in 165c048b52eSmrg decstation-3100) 166c048b52eSmrg basic_machine=mips-dec 167c048b52eSmrg basic_os= 168c048b52eSmrg ;; 169c048b52eSmrg *-*) 170c048b52eSmrg # Second component is usually, but not always the OS 171c048b52eSmrg case $field2 in 172c048b52eSmrg # Prevent following clause from handling this valid os 173c048b52eSmrg sun*os*) 174c048b52eSmrg basic_machine=$field1 175c048b52eSmrg basic_os=$field2 176c048b52eSmrg ;; 177c048b52eSmrg zephyr*) 178c048b52eSmrg basic_machine=$field1-unknown 179c048b52eSmrg basic_os=$field2 180c048b52eSmrg ;; 181c048b52eSmrg # Manufacturers 182c048b52eSmrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 183c048b52eSmrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 184c048b52eSmrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 185c048b52eSmrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 186c048b52eSmrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 187c048b52eSmrg | ultra | tti* | harris | dolphin | highlevel | gould \ 188c048b52eSmrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 189c048b52eSmrg | microblaze* | sim | cisco \ 190c048b52eSmrg | oki | wec | wrs | winbond) 191c048b52eSmrg basic_machine=$field1-$field2 192c048b52eSmrg basic_os= 193c048b52eSmrg ;; 194c048b52eSmrg *) 195c048b52eSmrg basic_machine=$field1 196c048b52eSmrg basic_os=$field2 197c048b52eSmrg ;; 198c048b52eSmrg esac 199c048b52eSmrg ;; 200c048b52eSmrg esac 2019fe995a9Smrg ;; 202c048b52eSmrg *) 203c048b52eSmrg # Convert single-component short-hands not valid as part of 204c048b52eSmrg # multi-component configurations. 205c048b52eSmrg case $field1 in 206c048b52eSmrg 386bsd) 207c048b52eSmrg basic_machine=i386-pc 208c048b52eSmrg basic_os=bsd 209c048b52eSmrg ;; 210c048b52eSmrg a29khif) 211c048b52eSmrg basic_machine=a29k-amd 212c048b52eSmrg basic_os=udi 213c048b52eSmrg ;; 214c048b52eSmrg adobe68k) 215c048b52eSmrg basic_machine=m68010-adobe 216c048b52eSmrg basic_os=scout 217c048b52eSmrg ;; 218c048b52eSmrg alliant) 219c048b52eSmrg basic_machine=fx80-alliant 220c048b52eSmrg basic_os= 221c048b52eSmrg ;; 222c048b52eSmrg altos | altos3068) 223c048b52eSmrg basic_machine=m68k-altos 224c048b52eSmrg basic_os= 225c048b52eSmrg ;; 226c048b52eSmrg am29k) 227c048b52eSmrg basic_machine=a29k-none 228c048b52eSmrg basic_os=bsd 229c048b52eSmrg ;; 230c048b52eSmrg amdahl) 231c048b52eSmrg basic_machine=580-amdahl 232c048b52eSmrg basic_os=sysv 233c048b52eSmrg ;; 234c048b52eSmrg amiga) 235c048b52eSmrg basic_machine=m68k-unknown 236c048b52eSmrg basic_os= 237c048b52eSmrg ;; 238c048b52eSmrg amigaos | amigados) 239c048b52eSmrg basic_machine=m68k-unknown 240c048b52eSmrg basic_os=amigaos 241c048b52eSmrg ;; 242c048b52eSmrg amigaunix | amix) 243c048b52eSmrg basic_machine=m68k-unknown 244c048b52eSmrg basic_os=sysv4 245c048b52eSmrg ;; 246c048b52eSmrg apollo68) 247c048b52eSmrg basic_machine=m68k-apollo 248c048b52eSmrg basic_os=sysv 249c048b52eSmrg ;; 250c048b52eSmrg apollo68bsd) 251c048b52eSmrg basic_machine=m68k-apollo 252c048b52eSmrg basic_os=bsd 253c048b52eSmrg ;; 254c048b52eSmrg aros) 255c048b52eSmrg basic_machine=i386-pc 256c048b52eSmrg basic_os=aros 257c048b52eSmrg ;; 258c048b52eSmrg aux) 259c048b52eSmrg basic_machine=m68k-apple 260c048b52eSmrg basic_os=aux 261c048b52eSmrg ;; 262c048b52eSmrg balance) 263c048b52eSmrg basic_machine=ns32k-sequent 264c048b52eSmrg basic_os=dynix 265c048b52eSmrg ;; 266c048b52eSmrg blackfin) 267c048b52eSmrg basic_machine=bfin-unknown 268c048b52eSmrg basic_os=linux 269c048b52eSmrg ;; 270c048b52eSmrg cegcc) 271c048b52eSmrg basic_machine=arm-unknown 272c048b52eSmrg basic_os=cegcc 273c048b52eSmrg ;; 274c048b52eSmrg convex-c1) 275c048b52eSmrg basic_machine=c1-convex 276c048b52eSmrg basic_os=bsd 277c048b52eSmrg ;; 278c048b52eSmrg convex-c2) 279c048b52eSmrg basic_machine=c2-convex 280c048b52eSmrg basic_os=bsd 281c048b52eSmrg ;; 282c048b52eSmrg convex-c32) 283c048b52eSmrg basic_machine=c32-convex 284c048b52eSmrg basic_os=bsd 285c048b52eSmrg ;; 286c048b52eSmrg convex-c34) 287c048b52eSmrg basic_machine=c34-convex 288c048b52eSmrg basic_os=bsd 289c048b52eSmrg ;; 290c048b52eSmrg convex-c38) 291c048b52eSmrg basic_machine=c38-convex 292c048b52eSmrg basic_os=bsd 293c048b52eSmrg ;; 294c048b52eSmrg cray) 295c048b52eSmrg basic_machine=j90-cray 296c048b52eSmrg basic_os=unicos 297c048b52eSmrg ;; 298c048b52eSmrg crds | unos) 299c048b52eSmrg basic_machine=m68k-crds 300c048b52eSmrg basic_os= 301c048b52eSmrg ;; 302c048b52eSmrg da30) 303c048b52eSmrg basic_machine=m68k-da30 304c048b52eSmrg basic_os= 305c048b52eSmrg ;; 306c048b52eSmrg decstation | pmax | pmin | dec3100 | decstatn) 307c048b52eSmrg basic_machine=mips-dec 308c048b52eSmrg basic_os= 309c048b52eSmrg ;; 310c048b52eSmrg delta88) 311c048b52eSmrg basic_machine=m88k-motorola 312c048b52eSmrg basic_os=sysv3 313c048b52eSmrg ;; 314c048b52eSmrg dicos) 315c048b52eSmrg basic_machine=i686-pc 316c048b52eSmrg basic_os=dicos 317c048b52eSmrg ;; 318c048b52eSmrg djgpp) 319c048b52eSmrg basic_machine=i586-pc 320c048b52eSmrg basic_os=msdosdjgpp 321c048b52eSmrg ;; 322c048b52eSmrg ebmon29k) 323c048b52eSmrg basic_machine=a29k-amd 324c048b52eSmrg basic_os=ebmon 325c048b52eSmrg ;; 326c048b52eSmrg es1800 | OSE68k | ose68k | ose | OSE) 327c048b52eSmrg basic_machine=m68k-ericsson 328c048b52eSmrg basic_os=ose 329c048b52eSmrg ;; 330c048b52eSmrg gmicro) 331c048b52eSmrg basic_machine=tron-gmicro 332c048b52eSmrg basic_os=sysv 333c048b52eSmrg ;; 334c048b52eSmrg go32) 335c048b52eSmrg basic_machine=i386-pc 336c048b52eSmrg basic_os=go32 337c048b52eSmrg ;; 338c048b52eSmrg h8300hms) 339c048b52eSmrg basic_machine=h8300-hitachi 340c048b52eSmrg basic_os=hms 341c048b52eSmrg ;; 342c048b52eSmrg h8300xray) 343c048b52eSmrg basic_machine=h8300-hitachi 344c048b52eSmrg basic_os=xray 345c048b52eSmrg ;; 346c048b52eSmrg h8500hms) 347c048b52eSmrg basic_machine=h8500-hitachi 348c048b52eSmrg basic_os=hms 349c048b52eSmrg ;; 350c048b52eSmrg harris) 351c048b52eSmrg basic_machine=m88k-harris 352c048b52eSmrg basic_os=sysv3 353c048b52eSmrg ;; 354c048b52eSmrg hp300 | hp300hpux) 355c048b52eSmrg basic_machine=m68k-hp 356c048b52eSmrg basic_os=hpux 357c048b52eSmrg ;; 358c048b52eSmrg hp300bsd) 359c048b52eSmrg basic_machine=m68k-hp 360c048b52eSmrg basic_os=bsd 361c048b52eSmrg ;; 362c048b52eSmrg hppaosf) 363c048b52eSmrg basic_machine=hppa1.1-hp 364c048b52eSmrg basic_os=osf 365c048b52eSmrg ;; 366c048b52eSmrg hppro) 367c048b52eSmrg basic_machine=hppa1.1-hp 368c048b52eSmrg basic_os=proelf 369c048b52eSmrg ;; 370c048b52eSmrg i386mach) 371c048b52eSmrg basic_machine=i386-mach 372c048b52eSmrg basic_os=mach 373c048b52eSmrg ;; 374c048b52eSmrg isi68 | isi) 375c048b52eSmrg basic_machine=m68k-isi 376c048b52eSmrg basic_os=sysv 377c048b52eSmrg ;; 378c048b52eSmrg m68knommu) 379c048b52eSmrg basic_machine=m68k-unknown 380c048b52eSmrg basic_os=linux 381c048b52eSmrg ;; 382c048b52eSmrg magnum | m3230) 383c048b52eSmrg basic_machine=mips-mips 384c048b52eSmrg basic_os=sysv 385c048b52eSmrg ;; 386c048b52eSmrg merlin) 387c048b52eSmrg basic_machine=ns32k-utek 388c048b52eSmrg basic_os=sysv 389c048b52eSmrg ;; 390c048b52eSmrg mingw64) 391c048b52eSmrg basic_machine=x86_64-pc 392c048b52eSmrg basic_os=mingw64 393c048b52eSmrg ;; 394c048b52eSmrg mingw32) 395c048b52eSmrg basic_machine=i686-pc 396c048b52eSmrg basic_os=mingw32 397c048b52eSmrg ;; 398c048b52eSmrg mingw32ce) 399c048b52eSmrg basic_machine=arm-unknown 400c048b52eSmrg basic_os=mingw32ce 401c048b52eSmrg ;; 402c048b52eSmrg monitor) 403c048b52eSmrg basic_machine=m68k-rom68k 404c048b52eSmrg basic_os=coff 405c048b52eSmrg ;; 406c048b52eSmrg morphos) 407c048b52eSmrg basic_machine=powerpc-unknown 408c048b52eSmrg basic_os=morphos 409c048b52eSmrg ;; 410c048b52eSmrg moxiebox) 411c048b52eSmrg basic_machine=moxie-unknown 412c048b52eSmrg basic_os=moxiebox 413c048b52eSmrg ;; 414c048b52eSmrg msdos) 415c048b52eSmrg basic_machine=i386-pc 416c048b52eSmrg basic_os=msdos 417c048b52eSmrg ;; 418c048b52eSmrg msys) 419c048b52eSmrg basic_machine=i686-pc 420c048b52eSmrg basic_os=msys 421c048b52eSmrg ;; 422c048b52eSmrg mvs) 423c048b52eSmrg basic_machine=i370-ibm 424c048b52eSmrg basic_os=mvs 425c048b52eSmrg ;; 426c048b52eSmrg nacl) 427c048b52eSmrg basic_machine=le32-unknown 428c048b52eSmrg basic_os=nacl 429c048b52eSmrg ;; 430c048b52eSmrg ncr3000) 431c048b52eSmrg basic_machine=i486-ncr 432c048b52eSmrg basic_os=sysv4 433c048b52eSmrg ;; 434c048b52eSmrg netbsd386) 435c048b52eSmrg basic_machine=i386-pc 436c048b52eSmrg basic_os=netbsd 437c048b52eSmrg ;; 438c048b52eSmrg netwinder) 439c048b52eSmrg basic_machine=armv4l-rebel 440c048b52eSmrg basic_os=linux 441c048b52eSmrg ;; 442c048b52eSmrg news | news700 | news800 | news900) 443c048b52eSmrg basic_machine=m68k-sony 444c048b52eSmrg basic_os=newsos 445c048b52eSmrg ;; 446c048b52eSmrg news1000) 447c048b52eSmrg basic_machine=m68030-sony 448c048b52eSmrg basic_os=newsos 449c048b52eSmrg ;; 450c048b52eSmrg necv70) 451c048b52eSmrg basic_machine=v70-nec 452c048b52eSmrg basic_os=sysv 453c048b52eSmrg ;; 454c048b52eSmrg nh3000) 455c048b52eSmrg basic_machine=m68k-harris 456c048b52eSmrg basic_os=cxux 457c048b52eSmrg ;; 458c048b52eSmrg nh[45]000) 459c048b52eSmrg basic_machine=m88k-harris 460c048b52eSmrg basic_os=cxux 461c048b52eSmrg ;; 462c048b52eSmrg nindy960) 463c048b52eSmrg basic_machine=i960-intel 464c048b52eSmrg basic_os=nindy 465c048b52eSmrg ;; 466c048b52eSmrg mon960) 467c048b52eSmrg basic_machine=i960-intel 468c048b52eSmrg basic_os=mon960 469c048b52eSmrg ;; 470c048b52eSmrg nonstopux) 471c048b52eSmrg basic_machine=mips-compaq 472c048b52eSmrg basic_os=nonstopux 473c048b52eSmrg ;; 474c048b52eSmrg os400) 475c048b52eSmrg basic_machine=powerpc-ibm 476c048b52eSmrg basic_os=os400 477c048b52eSmrg ;; 478c048b52eSmrg OSE68000 | ose68000) 479c048b52eSmrg basic_machine=m68000-ericsson 480c048b52eSmrg basic_os=ose 481c048b52eSmrg ;; 482c048b52eSmrg os68k) 483c048b52eSmrg basic_machine=m68k-none 484c048b52eSmrg basic_os=os68k 485c048b52eSmrg ;; 486c048b52eSmrg paragon) 487c048b52eSmrg basic_machine=i860-intel 488c048b52eSmrg basic_os=osf 489c048b52eSmrg ;; 490c048b52eSmrg parisc) 491c048b52eSmrg basic_machine=hppa-unknown 492c048b52eSmrg basic_os=linux 493c048b52eSmrg ;; 494c048b52eSmrg psp) 495c048b52eSmrg basic_machine=mipsallegrexel-sony 496c048b52eSmrg basic_os=psp 497c048b52eSmrg ;; 498c048b52eSmrg pw32) 499c048b52eSmrg basic_machine=i586-unknown 500c048b52eSmrg basic_os=pw32 501c048b52eSmrg ;; 502c048b52eSmrg rdos | rdos64) 503c048b52eSmrg basic_machine=x86_64-pc 504c048b52eSmrg basic_os=rdos 505c048b52eSmrg ;; 506c048b52eSmrg rdos32) 507c048b52eSmrg basic_machine=i386-pc 508c048b52eSmrg basic_os=rdos 509c048b52eSmrg ;; 510c048b52eSmrg rom68k) 511c048b52eSmrg basic_machine=m68k-rom68k 512c048b52eSmrg basic_os=coff 513c048b52eSmrg ;; 514c048b52eSmrg sa29200) 515c048b52eSmrg basic_machine=a29k-amd 516c048b52eSmrg basic_os=udi 517c048b52eSmrg ;; 518c048b52eSmrg sei) 519c048b52eSmrg basic_machine=mips-sei 520c048b52eSmrg basic_os=seiux 521c048b52eSmrg ;; 522c048b52eSmrg sequent) 523c048b52eSmrg basic_machine=i386-sequent 524c048b52eSmrg basic_os= 525c048b52eSmrg ;; 526c048b52eSmrg sps7) 527c048b52eSmrg basic_machine=m68k-bull 528c048b52eSmrg basic_os=sysv2 529c048b52eSmrg ;; 530c048b52eSmrg st2000) 531c048b52eSmrg basic_machine=m68k-tandem 532c048b52eSmrg basic_os= 533c048b52eSmrg ;; 534c048b52eSmrg stratus) 535c048b52eSmrg basic_machine=i860-stratus 536c048b52eSmrg basic_os=sysv4 537c048b52eSmrg ;; 538c048b52eSmrg sun2) 539c048b52eSmrg basic_machine=m68000-sun 540c048b52eSmrg basic_os= 541c048b52eSmrg ;; 542c048b52eSmrg sun2os3) 543c048b52eSmrg basic_machine=m68000-sun 544c048b52eSmrg basic_os=sunos3 545c048b52eSmrg ;; 546c048b52eSmrg sun2os4) 547c048b52eSmrg basic_machine=m68000-sun 548c048b52eSmrg basic_os=sunos4 549c048b52eSmrg ;; 550c048b52eSmrg sun3) 551c048b52eSmrg basic_machine=m68k-sun 552c048b52eSmrg basic_os= 553c048b52eSmrg ;; 554c048b52eSmrg sun3os3) 555c048b52eSmrg basic_machine=m68k-sun 556c048b52eSmrg basic_os=sunos3 557c048b52eSmrg ;; 558c048b52eSmrg sun3os4) 559c048b52eSmrg basic_machine=m68k-sun 560c048b52eSmrg basic_os=sunos4 561c048b52eSmrg ;; 562c048b52eSmrg sun4) 563c048b52eSmrg basic_machine=sparc-sun 564c048b52eSmrg basic_os= 565c048b52eSmrg ;; 566c048b52eSmrg sun4os3) 567c048b52eSmrg basic_machine=sparc-sun 568c048b52eSmrg basic_os=sunos3 569c048b52eSmrg ;; 570c048b52eSmrg sun4os4) 571c048b52eSmrg basic_machine=sparc-sun 572c048b52eSmrg basic_os=sunos4 573c048b52eSmrg ;; 574c048b52eSmrg sun4sol2) 575c048b52eSmrg basic_machine=sparc-sun 576c048b52eSmrg basic_os=solaris2 577c048b52eSmrg ;; 578c048b52eSmrg sun386 | sun386i | roadrunner) 579c048b52eSmrg basic_machine=i386-sun 580c048b52eSmrg basic_os= 581c048b52eSmrg ;; 582c048b52eSmrg sv1) 583c048b52eSmrg basic_machine=sv1-cray 584c048b52eSmrg basic_os=unicos 585c048b52eSmrg ;; 586c048b52eSmrg symmetry) 587c048b52eSmrg basic_machine=i386-sequent 588c048b52eSmrg basic_os=dynix 589c048b52eSmrg ;; 590c048b52eSmrg t3e) 591c048b52eSmrg basic_machine=alphaev5-cray 592c048b52eSmrg basic_os=unicos 593c048b52eSmrg ;; 594c048b52eSmrg t90) 595c048b52eSmrg basic_machine=t90-cray 596c048b52eSmrg basic_os=unicos 597c048b52eSmrg ;; 598c048b52eSmrg toad1) 599c048b52eSmrg basic_machine=pdp10-xkl 600c048b52eSmrg basic_os=tops20 601c048b52eSmrg ;; 602c048b52eSmrg tpf) 603c048b52eSmrg basic_machine=s390x-ibm 604c048b52eSmrg basic_os=tpf 605c048b52eSmrg ;; 606c048b52eSmrg udi29k) 607c048b52eSmrg basic_machine=a29k-amd 608c048b52eSmrg basic_os=udi 609c048b52eSmrg ;; 610c048b52eSmrg ultra3) 611c048b52eSmrg basic_machine=a29k-nyu 612c048b52eSmrg basic_os=sym1 613c048b52eSmrg ;; 614c048b52eSmrg v810 | necv810) 615c048b52eSmrg basic_machine=v810-nec 616c048b52eSmrg basic_os=none 617c048b52eSmrg ;; 618c048b52eSmrg vaxv) 619c048b52eSmrg basic_machine=vax-dec 620c048b52eSmrg basic_os=sysv 621c048b52eSmrg ;; 622c048b52eSmrg vms) 623c048b52eSmrg basic_machine=vax-dec 624c048b52eSmrg basic_os=vms 625c048b52eSmrg ;; 626c048b52eSmrg vsta) 627c048b52eSmrg basic_machine=i386-pc 628c048b52eSmrg basic_os=vsta 629c048b52eSmrg ;; 630c048b52eSmrg vxworks960) 631c048b52eSmrg basic_machine=i960-wrs 632c048b52eSmrg basic_os=vxworks 633c048b52eSmrg ;; 634c048b52eSmrg vxworks68) 635c048b52eSmrg basic_machine=m68k-wrs 636c048b52eSmrg basic_os=vxworks 637c048b52eSmrg ;; 638c048b52eSmrg vxworks29k) 639c048b52eSmrg basic_machine=a29k-wrs 640c048b52eSmrg basic_os=vxworks 641c048b52eSmrg ;; 642c048b52eSmrg xbox) 643c048b52eSmrg basic_machine=i686-pc 644c048b52eSmrg basic_os=mingw32 645c048b52eSmrg ;; 646c048b52eSmrg ymp) 647c048b52eSmrg basic_machine=ymp-cray 648c048b52eSmrg basic_os=unicos 649c048b52eSmrg ;; 650c048b52eSmrg *) 651c048b52eSmrg basic_machine=$1 652c048b52eSmrg basic_os= 653c048b52eSmrg ;; 654c048b52eSmrg esac 6559fe995a9Smrg ;; 6569fe995a9Smrgesac 6579fe995a9Smrg 658c048b52eSmrg# Decode 1-component or ad-hoc basic machines 6599fe995a9Smrgcase $basic_machine in 660c048b52eSmrg # Here we handle the default manufacturer of certain CPU types. It is in 661c048b52eSmrg # some cases the only manufacturer, in others, it is the most popular. 662c048b52eSmrg w89k) 663c048b52eSmrg cpu=hppa1.1 664c048b52eSmrg vendor=winbond 665e8ac26b0Smrg ;; 666c048b52eSmrg op50n) 667c048b52eSmrg cpu=hppa1.1 668c048b52eSmrg vendor=oki 6699fe995a9Smrg ;; 670c048b52eSmrg op60c) 671c048b52eSmrg cpu=hppa1.1 672c048b52eSmrg vendor=oki 6739fe995a9Smrg ;; 674c048b52eSmrg ibm*) 675c048b52eSmrg cpu=i370 676c048b52eSmrg vendor=ibm 6779fe995a9Smrg ;; 678c048b52eSmrg orion105) 679c048b52eSmrg cpu=clipper 680c048b52eSmrg vendor=highlevel 6819d794632Smrg ;; 682c048b52eSmrg mac | mpw | mac-mpw) 683c048b52eSmrg cpu=m68k 684c048b52eSmrg vendor=apple 6859d794632Smrg ;; 686c048b52eSmrg pmac | pmac-mpw) 687c048b52eSmrg cpu=powerpc 688c048b52eSmrg vendor=apple 6899d794632Smrg ;; 6909d794632Smrg 6919fe995a9Smrg # Recognize the various machine names and aliases which stand 6929fe995a9Smrg # for a CPU type and a company and sometimes even an OS. 6939fe995a9Smrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 694c048b52eSmrg cpu=m68000 695c048b52eSmrg vendor=att 6969fe995a9Smrg ;; 6979fe995a9Smrg 3b*) 698c048b52eSmrg cpu=we32k 699c048b52eSmrg vendor=att 700b62cc08cSmrg ;; 701b62cc08cSmrg bluegene*) 702c048b52eSmrg cpu=powerpc 703c048b52eSmrg vendor=ibm 704c048b52eSmrg basic_os=cnk 7059fe995a9Smrg ;; 7069fe995a9Smrg decsystem10* | dec10*) 707c048b52eSmrg cpu=pdp10 708c048b52eSmrg vendor=dec 709c048b52eSmrg basic_os=tops10 7109fe995a9Smrg ;; 7119fe995a9Smrg decsystem20* | dec20*) 712c048b52eSmrg cpu=pdp10 713c048b52eSmrg vendor=dec 714c048b52eSmrg basic_os=tops20 7159fe995a9Smrg ;; 7169fe995a9Smrg delta | 3300 | motorola-3300 | motorola-delta \ 7179fe995a9Smrg | 3300-motorola | delta-motorola) 718c048b52eSmrg cpu=m68k 719c048b52eSmrg vendor=motorola 7209fe995a9Smrg ;; 7216fbef84aSmrg dpx2*) 722c048b52eSmrg cpu=m68k 723c048b52eSmrg vendor=bull 724c048b52eSmrg basic_os=sysv3 7259fe995a9Smrg ;; 7269fe995a9Smrg encore | umax | mmax) 727c048b52eSmrg cpu=ns32k 728c048b52eSmrg vendor=encore 7299fe995a9Smrg ;; 730c048b52eSmrg elxsi) 731c048b52eSmrg cpu=elxsi 732c048b52eSmrg vendor=elxsi 733c048b52eSmrg basic_os=${basic_os:-bsd} 7349fe995a9Smrg ;; 7359fe995a9Smrg fx2800) 736c048b52eSmrg cpu=i860 737c048b52eSmrg vendor=alliant 7389fe995a9Smrg ;; 7399fe995a9Smrg genix) 740c048b52eSmrg cpu=ns32k 741c048b52eSmrg vendor=ns 7429fe995a9Smrg ;; 7439fe995a9Smrg h3050r* | hiux*) 744c048b52eSmrg cpu=hppa1.1 745c048b52eSmrg vendor=hitachi 746c048b52eSmrg basic_os=hiuxwe2 7479fe995a9Smrg ;; 7489fe995a9Smrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 749c048b52eSmrg cpu=hppa1.0 750c048b52eSmrg vendor=hp 7519fe995a9Smrg ;; 7529fe995a9Smrg hp9k2[0-9][0-9] | hp9k31[0-9]) 753c048b52eSmrg cpu=m68000 754c048b52eSmrg vendor=hp 7559fe995a9Smrg ;; 7569fe995a9Smrg hp9k3[2-9][0-9]) 757c048b52eSmrg cpu=m68k 758c048b52eSmrg vendor=hp 7599fe995a9Smrg ;; 7609fe995a9Smrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 761c048b52eSmrg cpu=hppa1.0 762c048b52eSmrg vendor=hp 7639fe995a9Smrg ;; 7649fe995a9Smrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 765c048b52eSmrg cpu=hppa1.1 766c048b52eSmrg vendor=hp 7679fe995a9Smrg ;; 7689fe995a9Smrg hp9k78[0-9] | hp78[0-9]) 7699fe995a9Smrg # FIXME: really hppa2.0-hp 770c048b52eSmrg cpu=hppa1.1 771c048b52eSmrg vendor=hp 7729fe995a9Smrg ;; 7739fe995a9Smrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 7749fe995a9Smrg # FIXME: really hppa2.0-hp 775c048b52eSmrg cpu=hppa1.1 776c048b52eSmrg vendor=hp 7779fe995a9Smrg ;; 7789fe995a9Smrg hp9k8[0-9][13679] | hp8[0-9][13679]) 779c048b52eSmrg cpu=hppa1.1 780c048b52eSmrg vendor=hp 7819fe995a9Smrg ;; 7829fe995a9Smrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 783c048b52eSmrg cpu=hppa1.0 784c048b52eSmrg vendor=hp 7859fe995a9Smrg ;; 7869fe995a9Smrg i*86v32) 787c048b52eSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 788c048b52eSmrg vendor=pc 789c048b52eSmrg basic_os=sysv32 7909fe995a9Smrg ;; 7919fe995a9Smrg i*86v4*) 792c048b52eSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 793c048b52eSmrg vendor=pc 794c048b52eSmrg basic_os=sysv4 7959fe995a9Smrg ;; 7969fe995a9Smrg i*86v) 797c048b52eSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 798c048b52eSmrg vendor=pc 799c048b52eSmrg basic_os=sysv 8009fe995a9Smrg ;; 8019fe995a9Smrg i*86sol2) 802c048b52eSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 803c048b52eSmrg vendor=pc 804c048b52eSmrg basic_os=solaris2 8059fe995a9Smrg ;; 806c048b52eSmrg j90 | j90-cray) 807c048b52eSmrg cpu=j90 808c048b52eSmrg vendor=cray 809c048b52eSmrg basic_os=${basic_os:-unicos} 8109fe995a9Smrg ;; 8119fe995a9Smrg iris | iris4d) 812c048b52eSmrg cpu=mips 813c048b52eSmrg vendor=sgi 814c048b52eSmrg case $basic_os in 815c048b52eSmrg irix*) 8169fe995a9Smrg ;; 8179fe995a9Smrg *) 818c048b52eSmrg basic_os=irix4 8199fe995a9Smrg ;; 8209fe995a9Smrg esac 8219fe995a9Smrg ;; 8229fe995a9Smrg miniframe) 823c048b52eSmrg cpu=m68000 824c048b52eSmrg vendor=convergent 8259fe995a9Smrg ;; 826c048b52eSmrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 827c048b52eSmrg cpu=m68k 828c048b52eSmrg vendor=atari 829c048b52eSmrg basic_os=mint 8309fe995a9Smrg ;; 8319fe995a9Smrg news-3600 | risc-news) 832c048b52eSmrg cpu=mips 833c048b52eSmrg vendor=sony 834c048b52eSmrg basic_os=newsos 8359fe995a9Smrg ;; 8366fbef84aSmrg next | m*-next) 837c048b52eSmrg cpu=m68k 838c048b52eSmrg vendor=next 839c048b52eSmrg case $basic_os in 840c048b52eSmrg openstep*) 841c048b52eSmrg ;; 842c048b52eSmrg nextstep*) 8439fe995a9Smrg ;; 844c048b52eSmrg ns2*) 845c048b52eSmrg basic_os=nextstep2 8469fe995a9Smrg ;; 8479fe995a9Smrg *) 848c048b52eSmrg basic_os=nextstep3 8499fe995a9Smrg ;; 8509fe995a9Smrg esac 8519fe995a9Smrg ;; 8529fe995a9Smrg np1) 853c048b52eSmrg cpu=np1 854c048b52eSmrg vendor=gould 8556fbef84aSmrg ;; 8569fe995a9Smrg op50n-* | op60c-*) 857c048b52eSmrg cpu=hppa1.1 858c048b52eSmrg vendor=oki 859c048b52eSmrg basic_os=proelf 8609fe995a9Smrg ;; 8619fe995a9Smrg pa-hitachi) 862c048b52eSmrg cpu=hppa1.1 863c048b52eSmrg vendor=hitachi 864c048b52eSmrg basic_os=hiuxwe2 865b62cc08cSmrg ;; 8669fe995a9Smrg pbd) 867c048b52eSmrg cpu=sparc 868c048b52eSmrg vendor=tti 8699fe995a9Smrg ;; 8709fe995a9Smrg pbb) 871c048b52eSmrg cpu=m68k 872c048b52eSmrg vendor=tti 8739fe995a9Smrg ;; 874c048b52eSmrg pc532) 875c048b52eSmrg cpu=ns32k 876c048b52eSmrg vendor=pc532 8779fe995a9Smrg ;; 8789fe995a9Smrg pn) 879c048b52eSmrg cpu=pn 880c048b52eSmrg vendor=gould 8819fe995a9Smrg ;; 882c048b52eSmrg power) 883c048b52eSmrg cpu=power 884c048b52eSmrg vendor=ibm 8859fe995a9Smrg ;; 886c048b52eSmrg ps2) 887c048b52eSmrg cpu=i386 888c048b52eSmrg vendor=ibm 8899fe995a9Smrg ;; 890c048b52eSmrg rm[46]00) 891c048b52eSmrg cpu=mips 892c048b52eSmrg vendor=siemens 8939fe995a9Smrg ;; 894c048b52eSmrg rtpc | rtpc-*) 895c048b52eSmrg cpu=romp 896c048b52eSmrg vendor=ibm 8979fe995a9Smrg ;; 898c048b52eSmrg sde) 899c048b52eSmrg cpu=mipsisa32 900c048b52eSmrg vendor=sde 901c048b52eSmrg basic_os=${basic_os:-elf} 9029fe995a9Smrg ;; 903c048b52eSmrg simso-wrs) 904c048b52eSmrg cpu=sparclite 905c048b52eSmrg vendor=wrs 906c048b52eSmrg basic_os=vxworks 9079fe995a9Smrg ;; 908c048b52eSmrg tower | tower-32) 909c048b52eSmrg cpu=m68k 910c048b52eSmrg vendor=ncr 9119fe995a9Smrg ;; 912c048b52eSmrg vpp*|vx|vx-*) 913c048b52eSmrg cpu=f301 914c048b52eSmrg vendor=fujitsu 9159d794632Smrg ;; 916c048b52eSmrg w65) 917c048b52eSmrg cpu=w65 918c048b52eSmrg vendor=wdc 9199fe995a9Smrg ;; 920c048b52eSmrg w89k-*) 921c048b52eSmrg cpu=hppa1.1 922c048b52eSmrg vendor=winbond 923c048b52eSmrg basic_os=proelf 9249fe995a9Smrg ;; 925c048b52eSmrg none) 926c048b52eSmrg cpu=none 927c048b52eSmrg vendor=none 9289fe995a9Smrg ;; 929c048b52eSmrg leon|leon[3-9]) 930c048b52eSmrg cpu=sparc 931c048b52eSmrg vendor=$basic_machine 9329fe995a9Smrg ;; 933c048b52eSmrg leon-*|leon[3-9]-*) 934c048b52eSmrg cpu=sparc 935c048b52eSmrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 9369fe995a9Smrg ;; 937c048b52eSmrg 938c048b52eSmrg *-*) 939c048b52eSmrg # shellcheck disable=SC2162 940c048b52eSmrg saved_IFS=$IFS 941c048b52eSmrg IFS="-" read cpu vendor <<EOF 942c048b52eSmrg$basic_machine 943c048b52eSmrgEOF 944c048b52eSmrg IFS=$saved_IFS 9459fe995a9Smrg ;; 946c048b52eSmrg # We use `pc' rather than `unknown' 947c048b52eSmrg # because (1) that's what they normally are, and 948c048b52eSmrg # (2) the word "unknown" tends to confuse beginning users. 949c048b52eSmrg i*86 | x86_64) 950c048b52eSmrg cpu=$basic_machine 951c048b52eSmrg vendor=pc 9529fe995a9Smrg ;; 953c048b52eSmrg # These rules are duplicated from below for sake of the special case above; 954c048b52eSmrg # i.e. things that normalized to x86 arches should also default to "pc" 955c048b52eSmrg pc98) 956c048b52eSmrg cpu=i386 957c048b52eSmrg vendor=pc 9589fe995a9Smrg ;; 959c048b52eSmrg x64 | amd64) 960c048b52eSmrg cpu=x86_64 961c048b52eSmrg vendor=pc 9629fe995a9Smrg ;; 963c048b52eSmrg # Recognize the basic CPU types without company name. 964c048b52eSmrg *) 965c048b52eSmrg cpu=$basic_machine 966c048b52eSmrg vendor=unknown 9679fe995a9Smrg ;; 968c048b52eSmrgesac 969c048b52eSmrg 970c048b52eSmrgunset -v basic_machine 971c048b52eSmrg 972c048b52eSmrg# Decode basic machines in the full and proper CPU-Company form. 973c048b52eSmrgcase $cpu-$vendor in 974c048b52eSmrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 975c048b52eSmrg # some cases the only manufacturer, in others, it is the most popular. 976c048b52eSmrg craynv-unknown) 977c048b52eSmrg vendor=cray 978c048b52eSmrg basic_os=${basic_os:-unicosmp} 9799fe995a9Smrg ;; 980c048b52eSmrg c90-unknown | c90-cray) 981c048b52eSmrg vendor=cray 982c048b52eSmrg basic_os=${Basic_os:-unicos} 9839fe995a9Smrg ;; 984c048b52eSmrg fx80-unknown) 985c048b52eSmrg vendor=alliant 986b62cc08cSmrg ;; 987c048b52eSmrg romp-unknown) 988c048b52eSmrg vendor=ibm 9899fe995a9Smrg ;; 990c048b52eSmrg mmix-unknown) 991c048b52eSmrg vendor=knuth 9929fe995a9Smrg ;; 993c048b52eSmrg microblaze-unknown | microblazeel-unknown) 994c048b52eSmrg vendor=xilinx 9959fe995a9Smrg ;; 996c048b52eSmrg rs6000-unknown) 997c048b52eSmrg vendor=ibm 9989fe995a9Smrg ;; 999c048b52eSmrg vax-unknown) 1000c048b52eSmrg vendor=dec 10019fe995a9Smrg ;; 1002c048b52eSmrg pdp11-unknown) 1003c048b52eSmrg vendor=dec 10049d794632Smrg ;; 1005c048b52eSmrg we32k-unknown) 1006c048b52eSmrg vendor=att 10079fe995a9Smrg ;; 1008c048b52eSmrg cydra-unknown) 1009c048b52eSmrg vendor=cydrome 10109fe995a9Smrg ;; 1011c048b52eSmrg i370-ibm*) 1012c048b52eSmrg vendor=ibm 10139fe995a9Smrg ;; 1014c048b52eSmrg orion-unknown) 1015c048b52eSmrg vendor=highlevel 10169fe995a9Smrg ;; 1017c048b52eSmrg xps-unknown | xps100-unknown) 1018c048b52eSmrg cpu=xps100 1019c048b52eSmrg vendor=honeywell 10209fe995a9Smrg ;; 1021c048b52eSmrg 1022c048b52eSmrg # Here we normalize CPU types with a missing or matching vendor 1023772b5186Smrg armh-unknown | armh-alt) 1024772b5186Smrg cpu=armv7l 1025772b5186Smrg vendor=alt 1026772b5186Smrg basic_os=${basic_os:-linux-gnueabihf} 1027772b5186Smrg ;; 1028c048b52eSmrg dpx20-unknown | dpx20-bull) 1029c048b52eSmrg cpu=rs6000 1030c048b52eSmrg vendor=bull 1031c048b52eSmrg basic_os=${basic_os:-bosx} 10329fe995a9Smrg ;; 1033c048b52eSmrg 1034c048b52eSmrg # Here we normalize CPU types irrespective of the vendor 1035c048b52eSmrg amd64-*) 1036c048b52eSmrg cpu=x86_64 10379fe995a9Smrg ;; 1038c048b52eSmrg blackfin-*) 1039c048b52eSmrg cpu=bfin 1040c048b52eSmrg basic_os=linux 10419fe995a9Smrg ;; 1042c048b52eSmrg c54x-*) 1043c048b52eSmrg cpu=tic54x 10449fe995a9Smrg ;; 1045c048b52eSmrg c55x-*) 1046c048b52eSmrg cpu=tic55x 10479fe995a9Smrg ;; 1048c048b52eSmrg c6x-*) 1049c048b52eSmrg cpu=tic6x 10509fe995a9Smrg ;; 1051c048b52eSmrg e500v[12]-*) 1052c048b52eSmrg cpu=powerpc 1053c048b52eSmrg basic_os=${basic_os}"spe" 10549fe995a9Smrg ;; 1055c048b52eSmrg mips3*-*) 1056c048b52eSmrg cpu=mips64 10579fe995a9Smrg ;; 1058c048b52eSmrg ms1-*) 1059c048b52eSmrg cpu=mt 10609fe995a9Smrg ;; 1061c048b52eSmrg m68knommu-*) 1062c048b52eSmrg cpu=m68k 1063c048b52eSmrg basic_os=linux 10649fe995a9Smrg ;; 1065c048b52eSmrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 1066c048b52eSmrg cpu=s12z 10679fe995a9Smrg ;; 1068c048b52eSmrg openrisc-*) 1069c048b52eSmrg cpu=or32 10709fe995a9Smrg ;; 1071c048b52eSmrg parisc-*) 1072c048b52eSmrg cpu=hppa 1073c048b52eSmrg basic_os=linux 10749fe995a9Smrg ;; 1075c048b52eSmrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1076c048b52eSmrg cpu=i586 10779fe995a9Smrg ;; 1078772b5186Smrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 1079c048b52eSmrg cpu=i686 10809fe995a9Smrg ;; 1081c048b52eSmrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1082c048b52eSmrg cpu=i686 10839fe995a9Smrg ;; 1084c048b52eSmrg pentium4-*) 1085c048b52eSmrg cpu=i786 10869fe995a9Smrg ;; 1087c048b52eSmrg pc98-*) 1088c048b52eSmrg cpu=i386 10899fe995a9Smrg ;; 1090c048b52eSmrg ppc-* | ppcbe-*) 1091c048b52eSmrg cpu=powerpc 10929fe995a9Smrg ;; 1093c048b52eSmrg ppcle-* | powerpclittle-*) 1094c048b52eSmrg cpu=powerpcle 10959fe995a9Smrg ;; 1096c048b52eSmrg ppc64-*) 1097c048b52eSmrg cpu=powerpc64 10989fe995a9Smrg ;; 1099c048b52eSmrg ppc64le-* | powerpc64little-*) 1100c048b52eSmrg cpu=powerpc64le 11019fe995a9Smrg ;; 1102c048b52eSmrg sb1-*) 1103c048b52eSmrg cpu=mipsisa64sb1 11049fe995a9Smrg ;; 1105c048b52eSmrg sb1el-*) 1106c048b52eSmrg cpu=mipsisa64sb1el 11079fe995a9Smrg ;; 1108c048b52eSmrg sh5e[lb]-*) 1109c048b52eSmrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 11109fe995a9Smrg ;; 1111c048b52eSmrg spur-*) 1112c048b52eSmrg cpu=spur 11139fe995a9Smrg ;; 1114c048b52eSmrg strongarm-* | thumb-*) 1115c048b52eSmrg cpu=arm 11169fe995a9Smrg ;; 1117c048b52eSmrg tx39-*) 1118c048b52eSmrg cpu=mipstx39 11196fbef84aSmrg ;; 1120c048b52eSmrg tx39el-*) 1121c048b52eSmrg cpu=mipstx39el 11229fe995a9Smrg ;; 1123c048b52eSmrg x64-*) 1124c048b52eSmrg cpu=x86_64 11259fe995a9Smrg ;; 11269d794632Smrg xscale-* | xscalee[bl]-*) 1127c048b52eSmrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 11289fe995a9Smrg ;; 1129772b5186Smrg arm64-* | aarch64le-*) 1130c048b52eSmrg cpu=aarch64 11319fe995a9Smrg ;; 11329fe995a9Smrg 1133c048b52eSmrg # Recognize the canonical CPU Types that limit and/or modify the 1134c048b52eSmrg # company names they are paired with. 1135c048b52eSmrg cr16-*) 1136c048b52eSmrg basic_os=${basic_os:-elf} 11379fe995a9Smrg ;; 1138c048b52eSmrg crisv32-* | etraxfs*-*) 1139c048b52eSmrg cpu=crisv32 1140c048b52eSmrg vendor=axis 11419fe995a9Smrg ;; 1142c048b52eSmrg cris-* | etrax*-*) 1143c048b52eSmrg cpu=cris 1144c048b52eSmrg vendor=axis 11459fe995a9Smrg ;; 1146c048b52eSmrg crx-*) 1147c048b52eSmrg basic_os=${basic_os:-elf} 11489fe995a9Smrg ;; 1149c048b52eSmrg neo-tandem) 1150c048b52eSmrg cpu=neo 1151c048b52eSmrg vendor=tandem 11529fe995a9Smrg ;; 1153c048b52eSmrg nse-tandem) 1154c048b52eSmrg cpu=nse 1155c048b52eSmrg vendor=tandem 11569fe995a9Smrg ;; 1157c048b52eSmrg nsr-tandem) 1158c048b52eSmrg cpu=nsr 1159c048b52eSmrg vendor=tandem 11609fe995a9Smrg ;; 1161c048b52eSmrg nsv-tandem) 1162c048b52eSmrg cpu=nsv 1163c048b52eSmrg vendor=tandem 11649fe995a9Smrg ;; 1165c048b52eSmrg nsx-tandem) 1166c048b52eSmrg cpu=nsx 1167c048b52eSmrg vendor=tandem 11689fe995a9Smrg ;; 1169c048b52eSmrg mipsallegrexel-sony) 1170c048b52eSmrg cpu=mipsallegrexel 1171c048b52eSmrg vendor=sony 11729fe995a9Smrg ;; 1173c048b52eSmrg tile*-*) 1174c048b52eSmrg basic_os=${basic_os:-linux-gnu} 11759fe995a9Smrg ;; 1176c048b52eSmrg 11779fe995a9Smrg *) 1178c048b52eSmrg # Recognize the canonical CPU types that are allowed with any 1179c048b52eSmrg # company name. 1180c048b52eSmrg case $cpu in 1181c048b52eSmrg 1750a | 580 \ 1182c048b52eSmrg | a29k \ 1183c048b52eSmrg | aarch64 | aarch64_be \ 1184c048b52eSmrg | abacus \ 1185c048b52eSmrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 1186c048b52eSmrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 1187c048b52eSmrg | alphapca5[67] | alpha64pca5[67] \ 1188c048b52eSmrg | am33_2.0 \ 1189c048b52eSmrg | amdgcn \ 1190c048b52eSmrg | arc | arceb | arc32 | arc64 \ 1191c048b52eSmrg | arm | arm[lb]e | arme[lb] | armv* \ 1192c048b52eSmrg | avr | avr32 \ 1193c048b52eSmrg | asmjs \ 1194c048b52eSmrg | ba \ 1195c048b52eSmrg | be32 | be64 \ 1196c048b52eSmrg | bfin | bpf | bs2000 \ 1197c048b52eSmrg | c[123]* | c30 | [cjt]90 | c4x \ 1198c048b52eSmrg | c8051 | clipper | craynv | csky | cydra \ 1199c048b52eSmrg | d10v | d30v | dlx | dsp16xx \ 1200c048b52eSmrg | e2k | elxsi | epiphany \ 1201c048b52eSmrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1202c048b52eSmrg | h8300 | h8500 \ 1203c048b52eSmrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 1204c048b52eSmrg | hexagon \ 1205c048b52eSmrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 1206c048b52eSmrg | ip2k | iq2000 \ 1207c048b52eSmrg | k1om \ 1208c048b52eSmrg | le32 | le64 \ 1209c048b52eSmrg | lm32 \ 1210772b5186Smrg | loongarch32 | loongarch64 \ 1211c048b52eSmrg | m32c | m32r | m32rle \ 1212c048b52eSmrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 1213c048b52eSmrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 1214c048b52eSmrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 1215c048b52eSmrg | microblaze | microblazeel \ 1216c048b52eSmrg | mips | mipsbe | mipseb | mipsel | mipsle \ 1217c048b52eSmrg | mips16 \ 1218c048b52eSmrg | mips64 | mips64eb | mips64el \ 1219c048b52eSmrg | mips64octeon | mips64octeonel \ 1220c048b52eSmrg | mips64orion | mips64orionel \ 1221c048b52eSmrg | mips64r5900 | mips64r5900el \ 1222c048b52eSmrg | mips64vr | mips64vrel \ 1223c048b52eSmrg | mips64vr4100 | mips64vr4100el \ 1224c048b52eSmrg | mips64vr4300 | mips64vr4300el \ 1225c048b52eSmrg | mips64vr5000 | mips64vr5000el \ 1226c048b52eSmrg | mips64vr5900 | mips64vr5900el \ 1227c048b52eSmrg | mipsisa32 | mipsisa32el \ 1228c048b52eSmrg | mipsisa32r2 | mipsisa32r2el \ 1229c048b52eSmrg | mipsisa32r3 | mipsisa32r3el \ 1230c048b52eSmrg | mipsisa32r5 | mipsisa32r5el \ 1231c048b52eSmrg | mipsisa32r6 | mipsisa32r6el \ 1232c048b52eSmrg | mipsisa64 | mipsisa64el \ 1233c048b52eSmrg | mipsisa64r2 | mipsisa64r2el \ 1234c048b52eSmrg | mipsisa64r3 | mipsisa64r3el \ 1235c048b52eSmrg | mipsisa64r5 | mipsisa64r5el \ 1236c048b52eSmrg | mipsisa64r6 | mipsisa64r6el \ 1237c048b52eSmrg | mipsisa64sb1 | mipsisa64sb1el \ 1238c048b52eSmrg | mipsisa64sr71k | mipsisa64sr71kel \ 1239c048b52eSmrg | mipsr5900 | mipsr5900el \ 1240c048b52eSmrg | mipstx39 | mipstx39el \ 1241c048b52eSmrg | mmix \ 1242c048b52eSmrg | mn10200 | mn10300 \ 1243c048b52eSmrg | moxie \ 1244c048b52eSmrg | mt \ 1245c048b52eSmrg | msp430 \ 1246c048b52eSmrg | nds32 | nds32le | nds32be \ 1247c048b52eSmrg | nfp \ 1248c048b52eSmrg | nios | nios2 | nios2eb | nios2el \ 1249c048b52eSmrg | none | np1 | ns16k | ns32k | nvptx \ 1250c048b52eSmrg | open8 \ 1251c048b52eSmrg | or1k* \ 1252c048b52eSmrg | or32 \ 1253c048b52eSmrg | orion \ 1254c048b52eSmrg | picochip \ 1255c048b52eSmrg | pdp10 | pdp11 | pj | pjl | pn | power \ 1256c048b52eSmrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 1257c048b52eSmrg | pru \ 1258c048b52eSmrg | pyramid \ 1259c048b52eSmrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 1260c048b52eSmrg | rl78 | romp | rs6000 | rx \ 1261c048b52eSmrg | s390 | s390x \ 1262c048b52eSmrg | score \ 1263c048b52eSmrg | sh | shl \ 1264c048b52eSmrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 1265c048b52eSmrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 1266c048b52eSmrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 1267c048b52eSmrg | sparclite \ 1268c048b52eSmrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 1269c048b52eSmrg | spu \ 1270c048b52eSmrg | tahoe \ 1271c048b52eSmrg | thumbv7* \ 1272c048b52eSmrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 1273c048b52eSmrg | tron \ 1274c048b52eSmrg | ubicom32 \ 1275c048b52eSmrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 1276c048b52eSmrg | vax \ 1277c048b52eSmrg | visium \ 1278c048b52eSmrg | w65 \ 1279c048b52eSmrg | wasm32 | wasm64 \ 1280c048b52eSmrg | we32k \ 1281c048b52eSmrg | x86 | x86_64 | xc16x | xgate | xps100 \ 1282c048b52eSmrg | xstormy16 | xtensa* \ 1283c048b52eSmrg | ymp \ 1284c048b52eSmrg | z8k | z80) 1285c048b52eSmrg ;; 1286c048b52eSmrg 1287c048b52eSmrg *) 1288c048b52eSmrg echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 1289c048b52eSmrg exit 1 1290c048b52eSmrg ;; 1291c048b52eSmrg esac 12929fe995a9Smrg ;; 12939fe995a9Smrgesac 12949fe995a9Smrg 12959fe995a9Smrg# Here we canonicalize certain aliases for manufacturers. 1296c048b52eSmrgcase $vendor in 1297c048b52eSmrg digital*) 1298c048b52eSmrg vendor=dec 12999fe995a9Smrg ;; 1300c048b52eSmrg commodore*) 1301c048b52eSmrg vendor=cbm 13029fe995a9Smrg ;; 13039fe995a9Smrg *) 13049fe995a9Smrg ;; 13059fe995a9Smrgesac 13069fe995a9Smrg 13079fe995a9Smrg# Decode manufacturer-specific aliases for certain operating systems. 13089fe995a9Smrg 1309c048b52eSmrgif test x$basic_os != x 13109fe995a9Smrgthen 1311c048b52eSmrg 1312772b5186Smrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 1313c048b52eSmrg# set os. 1314c048b52eSmrgcase $basic_os in 1315c048b52eSmrg gnu/linux*) 1316c048b52eSmrg kernel=linux 1317c048b52eSmrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 1318c048b52eSmrg ;; 1319c048b52eSmrg os2-emx) 1320c048b52eSmrg kernel=os2 1321c048b52eSmrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 1322c048b52eSmrg ;; 1323c048b52eSmrg nto-qnx*) 1324c048b52eSmrg kernel=nto 1325c048b52eSmrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 1326c048b52eSmrg ;; 1327c048b52eSmrg *-*) 1328c048b52eSmrg # shellcheck disable=SC2162 1329c048b52eSmrg saved_IFS=$IFS 1330c048b52eSmrg IFS="-" read kernel os <<EOF 1331c048b52eSmrg$basic_os 1332c048b52eSmrgEOF 1333c048b52eSmrg IFS=$saved_IFS 1334c048b52eSmrg ;; 1335c048b52eSmrg # Default OS when just kernel was specified 1336c048b52eSmrg nto*) 1337c048b52eSmrg kernel=nto 1338c048b52eSmrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 1339c048b52eSmrg ;; 1340c048b52eSmrg linux*) 1341c048b52eSmrg kernel=linux 1342c048b52eSmrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 1343c048b52eSmrg ;; 1344772b5186Smrg managarm*) 1345772b5186Smrg kernel=managarm 1346772b5186Smrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 1347772b5186Smrg ;; 1348c048b52eSmrg *) 1349c048b52eSmrg kernel= 1350c048b52eSmrg os=$basic_os 1351c048b52eSmrg ;; 1352c048b52eSmrgesac 1353c048b52eSmrg 1354c048b52eSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 1355c048b52eSmrg# etc.) 13569fe995a9Smrgcase $os in 13576fbef84aSmrg # First match some system type aliases that might get confused 13586fbef84aSmrg # with valid system types. 1359c048b52eSmrg # solaris* is a basic system type, with this one exception. 1360c048b52eSmrg auroraux) 1361c048b52eSmrg os=auroraux 1362b62cc08cSmrg ;; 1363c048b52eSmrg bluegene*) 1364c048b52eSmrg os=cnk 13659fe995a9Smrg ;; 1366c048b52eSmrg solaris1 | solaris1.*) 1367c048b52eSmrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 13689fe995a9Smrg ;; 1369c048b52eSmrg solaris) 1370c048b52eSmrg os=solaris2 13719fe995a9Smrg ;; 1372c048b52eSmrg unixware*) 1373c048b52eSmrg os=sysv4.2uw 13749fe995a9Smrg ;; 13756fbef84aSmrg # es1800 is here to avoid being matched by es* (a different OS) 1376c048b52eSmrg es1800*) 1377c048b52eSmrg os=ose 13786fbef84aSmrg ;; 1379c048b52eSmrg # Some version numbers need modification 1380c048b52eSmrg chorusos*) 1381c048b52eSmrg os=chorusos 13829fe995a9Smrg ;; 1383c048b52eSmrg isc) 1384c048b52eSmrg os=isc2.2 13859fe995a9Smrg ;; 1386c048b52eSmrg sco6) 1387c048b52eSmrg os=sco5v6 13889fe995a9Smrg ;; 1389c048b52eSmrg sco5) 1390c048b52eSmrg os=sco3.2v5 13919fe995a9Smrg ;; 1392c048b52eSmrg sco4) 1393c048b52eSmrg os=sco3.2v4 13949fe995a9Smrg ;; 1395c048b52eSmrg sco3.2.[4-9]*) 1396c048b52eSmrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 13979fe995a9Smrg ;; 1398c048b52eSmrg sco*v* | scout) 1399c048b52eSmrg # Don't match below 14009fe995a9Smrg ;; 1401c048b52eSmrg sco*) 1402c048b52eSmrg os=sco3.2v2 14039fe995a9Smrg ;; 1404c048b52eSmrg psos*) 1405c048b52eSmrg os=psos 14069fe995a9Smrg ;; 1407c048b52eSmrg qnx*) 1408c048b52eSmrg os=qnx 14099fe995a9Smrg ;; 1410c048b52eSmrg hiux*) 1411c048b52eSmrg os=hiuxwe2 14129fe995a9Smrg ;; 1413c048b52eSmrg lynx*178) 1414c048b52eSmrg os=lynxos178 14159fe995a9Smrg ;; 1416c048b52eSmrg lynx*5) 1417c048b52eSmrg os=lynxos5 14189fe995a9Smrg ;; 1419c048b52eSmrg lynxos*) 1420c048b52eSmrg # don't get caught up in next wildcard 14219fe995a9Smrg ;; 1422c048b52eSmrg lynx*) 1423c048b52eSmrg os=lynxos 14249fe995a9Smrg ;; 1425c048b52eSmrg mac[0-9]*) 1426c048b52eSmrg os=`echo "$os" | sed -e 's|mac|macos|'` 14279fe995a9Smrg ;; 1428c048b52eSmrg opened*) 1429c048b52eSmrg os=openedition 14309fe995a9Smrg ;; 1431c048b52eSmrg os400*) 1432c048b52eSmrg os=os400 14339fe995a9Smrg ;; 1434c048b52eSmrg sunos5*) 1435c048b52eSmrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 14369fe995a9Smrg ;; 1437c048b52eSmrg sunos6*) 1438c048b52eSmrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 14399fe995a9Smrg ;; 1440c048b52eSmrg wince*) 1441c048b52eSmrg os=wince 14429fe995a9Smrg ;; 1443c048b52eSmrg utek*) 1444c048b52eSmrg os=bsd 14459fe995a9Smrg ;; 1446c048b52eSmrg dynix*) 1447c048b52eSmrg os=bsd 14489fe995a9Smrg ;; 1449c048b52eSmrg acis*) 1450c048b52eSmrg os=aos 14519fe995a9Smrg ;; 1452c048b52eSmrg atheos*) 1453c048b52eSmrg os=atheos 14549fe995a9Smrg ;; 1455c048b52eSmrg syllable*) 1456c048b52eSmrg os=syllable 1457c048b52eSmrg ;; 1458c048b52eSmrg 386bsd) 1459c048b52eSmrg os=bsd 1460c048b52eSmrg ;; 1461c048b52eSmrg ctix* | uts*) 1462c048b52eSmrg os=sysv 1463c048b52eSmrg ;; 1464c048b52eSmrg nova*) 1465c048b52eSmrg os=rtmk-nova 1466c048b52eSmrg ;; 1467c048b52eSmrg ns2) 1468c048b52eSmrg os=nextstep2 1469c048b52eSmrg ;; 1470c048b52eSmrg # Preserve the version number of sinix5. 1471c048b52eSmrg sinix5.*) 1472c048b52eSmrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 14739fe995a9Smrg ;; 1474c048b52eSmrg sinix*) 1475c048b52eSmrg os=sysv4 14769fe995a9Smrg ;; 1477c048b52eSmrg tpf*) 1478c048b52eSmrg os=tpf 14799fe995a9Smrg ;; 1480c048b52eSmrg triton*) 1481c048b52eSmrg os=sysv3 14829fe995a9Smrg ;; 1483c048b52eSmrg oss*) 1484c048b52eSmrg os=sysv3 14859fe995a9Smrg ;; 1486c048b52eSmrg svr4*) 1487c048b52eSmrg os=sysv4 14889fe995a9Smrg ;; 1489c048b52eSmrg svr3) 1490c048b52eSmrg os=sysv3 14919fe995a9Smrg ;; 1492c048b52eSmrg sysvr4) 1493c048b52eSmrg os=sysv4 14949fe995a9Smrg ;; 1495c048b52eSmrg ose*) 1496c048b52eSmrg os=ose 14979fe995a9Smrg ;; 1498c048b52eSmrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1499c048b52eSmrg os=mint 1500b62cc08cSmrg ;; 1501c048b52eSmrg dicos*) 1502c048b52eSmrg os=dicos 1503c048b52eSmrg ;; 1504c048b52eSmrg pikeos*) 15056fbef84aSmrg # Until real need of OS specific support for 15066fbef84aSmrg # particular features comes up, bare metal 15076fbef84aSmrg # configurations are quite functional. 1508c048b52eSmrg case $cpu in 15096fbef84aSmrg arm*) 1510c048b52eSmrg os=eabi 15116fbef84aSmrg ;; 15126fbef84aSmrg *) 1513c048b52eSmrg os=elf 15146fbef84aSmrg ;; 15156fbef84aSmrg esac 15166fbef84aSmrg ;; 15179fe995a9Smrg *) 1518c048b52eSmrg # No normalization, but not necessarily accepted, that comes below. 15199fe995a9Smrg ;; 15209fe995a9Smrgesac 1521c048b52eSmrg 15229fe995a9Smrgelse 15239fe995a9Smrg 15249fe995a9Smrg# Here we handle the default operating systems that come with various machines. 15259fe995a9Smrg# The value should be what the vendor currently ships out the door with their 15269fe995a9Smrg# machine or put another way, the most popular os provided with the machine. 15279fe995a9Smrg 15289fe995a9Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 15299fe995a9Smrg# "-sun"), then you have to tell the case statement up towards the top 15309fe995a9Smrg# that MANUFACTURER isn't an operating system. Otherwise, code above 15319fe995a9Smrg# will signal an error saying that MANUFACTURER isn't an operating 15329fe995a9Smrg# system, and we'll never get to this point. 15339fe995a9Smrg 1534c048b52eSmrgkernel= 1535c048b52eSmrgcase $cpu-$vendor in 15369d794632Smrg score-*) 1537c048b52eSmrg os=elf 15389fe995a9Smrg ;; 15399d794632Smrg spu-*) 1540c048b52eSmrg os=elf 15419fe995a9Smrg ;; 15429fe995a9Smrg *-acorn) 1543c048b52eSmrg os=riscix1.2 15449fe995a9Smrg ;; 15459fe995a9Smrg arm*-rebel) 1546c048b52eSmrg kernel=linux 1547c048b52eSmrg os=gnu 15489fe995a9Smrg ;; 15499fe995a9Smrg arm*-semi) 1550c048b52eSmrg os=aout 15519fe995a9Smrg ;; 15529d794632Smrg c4x-* | tic4x-*) 1553c048b52eSmrg os=coff 15549d794632Smrg ;; 1555e8ac26b0Smrg c8051-*) 1556c048b52eSmrg os=elf 1557c048b52eSmrg ;; 1558c048b52eSmrg clipper-intergraph) 1559c048b52eSmrg os=clix 1560e8ac26b0Smrg ;; 15619d794632Smrg hexagon-*) 1562c048b52eSmrg os=elf 15639d794632Smrg ;; 15649d794632Smrg tic54x-*) 1565c048b52eSmrg os=coff 15669d794632Smrg ;; 15679d794632Smrg tic55x-*) 1568c048b52eSmrg os=coff 15699d794632Smrg ;; 15709d794632Smrg tic6x-*) 1571c048b52eSmrg os=coff 15729fe995a9Smrg ;; 15739fe995a9Smrg # This must come before the *-dec entry. 15749fe995a9Smrg pdp10-*) 1575c048b52eSmrg os=tops20 15769fe995a9Smrg ;; 15779fe995a9Smrg pdp11-*) 1578c048b52eSmrg os=none 15799fe995a9Smrg ;; 15809fe995a9Smrg *-dec | vax-*) 1581c048b52eSmrg os=ultrix4.2 15829fe995a9Smrg ;; 15839fe995a9Smrg m68*-apollo) 1584c048b52eSmrg os=domain 15859fe995a9Smrg ;; 15869fe995a9Smrg i386-sun) 1587c048b52eSmrg os=sunos4.0.2 15889fe995a9Smrg ;; 15899fe995a9Smrg m68000-sun) 1590c048b52eSmrg os=sunos3 15919fe995a9Smrg ;; 15929fe995a9Smrg m68*-cisco) 1593c048b52eSmrg os=aout 15949fe995a9Smrg ;; 15959d794632Smrg mep-*) 1596c048b52eSmrg os=elf 1597b62cc08cSmrg ;; 15989fe995a9Smrg mips*-cisco) 1599c048b52eSmrg os=elf 16009fe995a9Smrg ;; 16019fe995a9Smrg mips*-*) 1602c048b52eSmrg os=elf 16039fe995a9Smrg ;; 16049fe995a9Smrg or32-*) 1605c048b52eSmrg os=coff 16069fe995a9Smrg ;; 16079fe995a9Smrg *-tti) # must be before sparc entry or we get the wrong os. 1608c048b52eSmrg os=sysv3 16099fe995a9Smrg ;; 16109fe995a9Smrg sparc-* | *-sun) 1611c048b52eSmrg os=sunos4.1.1 16129fe995a9Smrg ;; 16136fbef84aSmrg pru-*) 1614c048b52eSmrg os=elf 16156fbef84aSmrg ;; 16169fe995a9Smrg *-be) 1617c048b52eSmrg os=beos 16189fe995a9Smrg ;; 16199fe995a9Smrg *-ibm) 1620c048b52eSmrg os=aix 16219fe995a9Smrg ;; 16229d794632Smrg *-knuth) 1623c048b52eSmrg os=mmixware 16249fe995a9Smrg ;; 16259fe995a9Smrg *-wec) 1626c048b52eSmrg os=proelf 16279fe995a9Smrg ;; 16289fe995a9Smrg *-winbond) 1629c048b52eSmrg os=proelf 16309fe995a9Smrg ;; 16319fe995a9Smrg *-oki) 1632c048b52eSmrg os=proelf 16339fe995a9Smrg ;; 16349fe995a9Smrg *-hp) 1635c048b52eSmrg os=hpux 16369fe995a9Smrg ;; 16379fe995a9Smrg *-hitachi) 1638c048b52eSmrg os=hiux 16399fe995a9Smrg ;; 16409fe995a9Smrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1641c048b52eSmrg os=sysv 16429fe995a9Smrg ;; 16439fe995a9Smrg *-cbm) 1644c048b52eSmrg os=amigaos 16459fe995a9Smrg ;; 16469fe995a9Smrg *-dg) 1647c048b52eSmrg os=dgux 16489fe995a9Smrg ;; 16499fe995a9Smrg *-dolphin) 1650c048b52eSmrg os=sysv3 16519fe995a9Smrg ;; 16529fe995a9Smrg m68k-ccur) 1653c048b52eSmrg os=rtu 16549fe995a9Smrg ;; 16559fe995a9Smrg m88k-omron*) 1656c048b52eSmrg os=luna 16579fe995a9Smrg ;; 16586fbef84aSmrg *-next) 1659c048b52eSmrg os=nextstep 16609fe995a9Smrg ;; 16619fe995a9Smrg *-sequent) 1662c048b52eSmrg os=ptx 16639fe995a9Smrg ;; 16649fe995a9Smrg *-crds) 1665c048b52eSmrg os=unos 16669fe995a9Smrg ;; 16679fe995a9Smrg *-ns) 1668c048b52eSmrg os=genix 16699fe995a9Smrg ;; 16709fe995a9Smrg i370-*) 1671c048b52eSmrg os=mvs 16729fe995a9Smrg ;; 16739fe995a9Smrg *-gould) 1674c048b52eSmrg os=sysv 16759fe995a9Smrg ;; 16769fe995a9Smrg *-highlevel) 1677c048b52eSmrg os=bsd 16789fe995a9Smrg ;; 16799fe995a9Smrg *-encore) 1680c048b52eSmrg os=bsd 16819fe995a9Smrg ;; 16829fe995a9Smrg *-sgi) 1683c048b52eSmrg os=irix 16849fe995a9Smrg ;; 16859fe995a9Smrg *-siemens) 1686c048b52eSmrg os=sysv4 16879fe995a9Smrg ;; 16889fe995a9Smrg *-masscomp) 1689c048b52eSmrg os=rtu 16909fe995a9Smrg ;; 16919fe995a9Smrg f30[01]-fujitsu | f700-fujitsu) 1692c048b52eSmrg os=uxpv 16939fe995a9Smrg ;; 16949fe995a9Smrg *-rom68k) 1695c048b52eSmrg os=coff 16969fe995a9Smrg ;; 16979fe995a9Smrg *-*bug) 1698c048b52eSmrg os=coff 16999fe995a9Smrg ;; 17009fe995a9Smrg *-apple) 1701c048b52eSmrg os=macos 17029fe995a9Smrg ;; 17039fe995a9Smrg *-atari*) 1704c048b52eSmrg os=mint 1705c048b52eSmrg ;; 1706c048b52eSmrg *-wrs) 1707c048b52eSmrg os=vxworks 17089fe995a9Smrg ;; 17099fe995a9Smrg *) 1710c048b52eSmrg os=none 17119fe995a9Smrg ;; 17129fe995a9Smrgesac 1713c048b52eSmrg 17149fe995a9Smrgfi 17159fe995a9Smrg 1716c048b52eSmrg# Now, validate our (potentially fixed-up) OS. 1717c048b52eSmrgcase $os in 1718c048b52eSmrg # Sometimes we do "kernel-libc", so those need to count as OSes. 1719c048b52eSmrg musl* | newlib* | relibc* | uclibc*) 1720c048b52eSmrg ;; 1721c048b52eSmrg # Likewise for "kernel-abi" 1722c048b52eSmrg eabi* | gnueabi*) 1723c048b52eSmrg ;; 1724c048b52eSmrg # VxWorks passes extra cpu info in the 4th filed. 1725c048b52eSmrg simlinux | simwindows | spe) 1726c048b52eSmrg ;; 1727c048b52eSmrg # Now accept the basic system types. 1728c048b52eSmrg # The portable systems comes first. 1729c048b52eSmrg # Each alternative MUST end in a * to match a version number. 1730c048b52eSmrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1731c048b52eSmrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 1732c048b52eSmrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1733c048b52eSmrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 1734c048b52eSmrg | hiux* | abug | nacl* | netware* | windows* \ 1735c048b52eSmrg | os9* | macos* | osx* | ios* \ 1736c048b52eSmrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 1737c048b52eSmrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1738c048b52eSmrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 1739c048b52eSmrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1740c048b52eSmrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 1741c048b52eSmrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 1742c048b52eSmrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 1743c048b52eSmrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 1744c048b52eSmrg | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1745c048b52eSmrg | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1746c048b52eSmrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 1747c048b52eSmrg | chorusrdb* | cegcc* | glidix* | serenity* \ 1748c048b52eSmrg | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 1749c048b52eSmrg | midipix* | mingw32* | mingw64* | mint* \ 1750c048b52eSmrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1751c048b52eSmrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 1752c048b52eSmrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 1753c048b52eSmrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 1754c048b52eSmrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 1755c048b52eSmrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 1756c048b52eSmrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 1757c048b52eSmrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 1758c048b52eSmrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 1759c048b52eSmrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 1760772b5186Smrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 1761772b5186Smrg | fiwix* | mlibc* ) 1762c048b52eSmrg ;; 1763c048b52eSmrg # This one is extra strict with allowed versions 1764c048b52eSmrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 1765c048b52eSmrg # Don't forget version if it is 3.2v4 or newer. 1766c048b52eSmrg ;; 1767c048b52eSmrg none) 1768c048b52eSmrg ;; 1769772b5186Smrg kernel* ) 1770772b5186Smrg # Restricted further below 1771772b5186Smrg ;; 1772c048b52eSmrg *) 1773c048b52eSmrg echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 1774c048b52eSmrg exit 1 1775c048b52eSmrg ;; 1776c048b52eSmrgesac 1777c048b52eSmrg 1778c048b52eSmrg# As a final step for OS-related things, validate the OS-kernel combination 1779c048b52eSmrg# (given a valid OS), if there is a kernel. 1780c048b52eSmrgcase $kernel-$os in 1781c048b52eSmrg linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 1782772b5186Smrg | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 1783c048b52eSmrg ;; 1784c048b52eSmrg uclinux-uclibc* ) 1785c048b52eSmrg ;; 1786772b5186Smrg managarm-mlibc* | managarm-kernel* ) 1787772b5186Smrg ;; 1788772b5186Smrg -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 1789c048b52eSmrg # These are just libc implementations, not actual OSes, and thus 1790c048b52eSmrg # require a kernel. 1791c048b52eSmrg echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 1792c048b52eSmrg exit 1 1793c048b52eSmrg ;; 1794772b5186Smrg -kernel* ) 1795772b5186Smrg echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 1796772b5186Smrg exit 1 1797772b5186Smrg ;; 1798772b5186Smrg *-kernel* ) 1799772b5186Smrg echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 1800772b5186Smrg exit 1 1801772b5186Smrg ;; 1802c048b52eSmrg kfreebsd*-gnu* | kopensolaris*-gnu*) 1803c048b52eSmrg ;; 1804c048b52eSmrg vxworks-simlinux | vxworks-simwindows | vxworks-spe) 1805c048b52eSmrg ;; 1806c048b52eSmrg nto-qnx*) 1807c048b52eSmrg ;; 1808c048b52eSmrg os2-emx) 1809c048b52eSmrg ;; 1810c048b52eSmrg *-eabi* | *-gnueabi*) 1811c048b52eSmrg ;; 1812c048b52eSmrg -*) 1813c048b52eSmrg # Blank kernel with real OS is always fine. 1814c048b52eSmrg ;; 1815c048b52eSmrg *-*) 1816c048b52eSmrg echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 1817c048b52eSmrg exit 1 1818c048b52eSmrg ;; 1819c048b52eSmrgesac 1820c048b52eSmrg 18219fe995a9Smrg# Here we handle the case where we know the os, and the CPU type, but not the 18229fe995a9Smrg# manufacturer. We pick the logical manufacturer. 1823c048b52eSmrgcase $vendor in 1824c048b52eSmrg unknown) 1825c048b52eSmrg case $cpu-$os in 1826c048b52eSmrg *-riscix*) 18279fe995a9Smrg vendor=acorn 18289fe995a9Smrg ;; 1829c048b52eSmrg *-sunos*) 18309fe995a9Smrg vendor=sun 18319fe995a9Smrg ;; 1832c048b52eSmrg *-cnk* | *-aix*) 18339fe995a9Smrg vendor=ibm 18349fe995a9Smrg ;; 1835c048b52eSmrg *-beos*) 18369fe995a9Smrg vendor=be 18379fe995a9Smrg ;; 1838c048b52eSmrg *-hpux*) 18399fe995a9Smrg vendor=hp 18409fe995a9Smrg ;; 1841c048b52eSmrg *-mpeix*) 18429fe995a9Smrg vendor=hp 18439fe995a9Smrg ;; 1844c048b52eSmrg *-hiux*) 18459fe995a9Smrg vendor=hitachi 18469fe995a9Smrg ;; 1847c048b52eSmrg *-unos*) 18489fe995a9Smrg vendor=crds 18499fe995a9Smrg ;; 1850c048b52eSmrg *-dgux*) 18519fe995a9Smrg vendor=dg 18529fe995a9Smrg ;; 1853c048b52eSmrg *-luna*) 18549fe995a9Smrg vendor=omron 18559fe995a9Smrg ;; 1856c048b52eSmrg *-genix*) 18579fe995a9Smrg vendor=ns 18589fe995a9Smrg ;; 1859c048b52eSmrg *-clix*) 1860c048b52eSmrg vendor=intergraph 1861c048b52eSmrg ;; 1862c048b52eSmrg *-mvs* | *-opened*) 1863c048b52eSmrg vendor=ibm 1864c048b52eSmrg ;; 1865c048b52eSmrg *-os400*) 18669fe995a9Smrg vendor=ibm 18679fe995a9Smrg ;; 1868c048b52eSmrg s390-* | s390x-*) 18699fe995a9Smrg vendor=ibm 18709fe995a9Smrg ;; 1871c048b52eSmrg *-ptx*) 18729fe995a9Smrg vendor=sequent 18739fe995a9Smrg ;; 1874c048b52eSmrg *-tpf*) 18759fe995a9Smrg vendor=ibm 18769fe995a9Smrg ;; 1877c048b52eSmrg *-vxsim* | *-vxworks* | *-windiss*) 18789fe995a9Smrg vendor=wrs 18799fe995a9Smrg ;; 1880c048b52eSmrg *-aux*) 18819fe995a9Smrg vendor=apple 18829fe995a9Smrg ;; 1883c048b52eSmrg *-hms*) 18849fe995a9Smrg vendor=hitachi 18859fe995a9Smrg ;; 1886c048b52eSmrg *-mpw* | *-macos*) 18879fe995a9Smrg vendor=apple 18889fe995a9Smrg ;; 1889c048b52eSmrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 18909fe995a9Smrg vendor=atari 18919fe995a9Smrg ;; 1892c048b52eSmrg *-vos*) 18939fe995a9Smrg vendor=stratus 18949fe995a9Smrg ;; 18959fe995a9Smrg esac 18969fe995a9Smrg ;; 18979fe995a9Smrgesac 18989fe995a9Smrg 1899c048b52eSmrgecho "$cpu-$vendor-${kernel:+$kernel-}$os" 19009fe995a9Smrgexit 19019fe995a9Smrg 19029fe995a9Smrg# Local variables: 1903c048b52eSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 19049fe995a9Smrg# time-stamp-start: "timestamp='" 19059fe995a9Smrg# time-stamp-format: "%:y-%02m-%02d" 19069fe995a9Smrg# time-stamp-end: "'" 19079fe995a9Smrg# End: 1908