1516e9f99Smrg#! /bin/sh 2516e9f99Smrg# Configuration validation subroutine script. 309924814Smrg# Copyright 1992-2023 Free Software Foundation, Inc. 4516e9f99Smrg 509924814Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale 6516e9f99Smrg 709924814Smrgtimestamp='2023-01-21' 809924814Smrg 909924814Smrg# This file is free software; you can redistribute it and/or modify it 1009924814Smrg# under the terms of the GNU General Public License as published by 1109924814Smrg# the Free Software Foundation, either version 3 of the License, or 12516e9f99Smrg# (at your option) any later version. 13516e9f99Smrg# 1409924814Smrg# This program is distributed in the hope that it will be useful, but 1509924814Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1609924814Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1709924814Smrg# General Public License for more details. 18516e9f99Smrg# 19516e9f99Smrg# You should have received a copy of the GNU General Public License 2009924814Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 21516e9f99Smrg# 22516e9f99Smrg# As a special exception to the GNU General Public License, if you 23516e9f99Smrg# distribute this file as part of a program that contains a 24516e9f99Smrg# configuration script generated by Autoconf, you may include it under 2509924814Smrg# the same distribution terms that you use for the rest of that 2609924814Smrg# program. This Exception is an additional permission under section 7 2709924814Smrg# of the GNU General Public License, version 3 ("GPLv3"). 28516e9f99Smrg 29516e9f99Smrg 3009924814Smrg# Please send patches to <config-patches@gnu.org>. 31516e9f99Smrg# 32516e9f99Smrg# Configuration subroutine to validate and canonicalize a configuration type. 33516e9f99Smrg# Supply the specified configuration type as an argument. 34516e9f99Smrg# If it is invalid, we print an error message on stderr and exit with code 1. 35516e9f99Smrg# Otherwise, we print the canonical config type on stdout and succeed. 36516e9f99Smrg 37883dc8a3Smrg# You can get the latest version of this script from: 3809924814Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 39883dc8a3Smrg 40516e9f99Smrg# This file is supposed to be the same for all GNU packages 41516e9f99Smrg# and recognize all the CPU types, system types and aliases 42516e9f99Smrg# that are meaningful with *any* GNU software. 43516e9f99Smrg# Each package is responsible for reporting which valid configurations 44516e9f99Smrg# it does not support. The user should be able to distinguish 45516e9f99Smrg# a failure to support a valid configuration from a meaningless 46516e9f99Smrg# configuration. 47516e9f99Smrg 48516e9f99Smrg# The goal of this file is to map all the various variations of a given 49516e9f99Smrg# machine specification into a single specification in the form: 50516e9f99Smrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 51516e9f99Smrg# or in some cases, the newer four-part form: 52516e9f99Smrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 53516e9f99Smrg# It is wrong to echo any other type of specification. 54516e9f99Smrg 5509924814Smrg# The "shellcheck disable" line above the timestamp inhibits complaints 5609924814Smrg# about features and limitations of the classic Bourne shell that were 5709924814Smrg# superseded or lifted in POSIX. However, this script identifies a wide 5809924814Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 5909924814Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still 6009924814Smrg# have a pre-POSIX /bin/sh. 6109924814Smrg 62516e9f99Smrgme=`echo "$0" | sed -e 's,.*/,,'` 63516e9f99Smrg 64516e9f99Smrgusage="\ 6509924814SmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 66516e9f99Smrg 67516e9f99SmrgCanonicalize a configuration name. 68516e9f99Smrg 6909924814SmrgOptions: 70516e9f99Smrg -h, --help print this help, then exit 71516e9f99Smrg -t, --time-stamp print date of last modification, then exit 72516e9f99Smrg -v, --version print version number, then exit 73516e9f99Smrg 74516e9f99SmrgReport bugs and patches to <config-patches@gnu.org>." 75516e9f99Smrg 76516e9f99Smrgversion="\ 77516e9f99SmrgGNU config.sub ($timestamp) 78516e9f99Smrg 7909924814SmrgCopyright 1992-2023 Free Software Foundation, Inc. 80516e9f99Smrg 81516e9f99SmrgThis is free software; see the source for copying conditions. There is NO 82516e9f99Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 83516e9f99Smrg 84516e9f99Smrghelp=" 85516e9f99SmrgTry \`$me --help' for more information." 86516e9f99Smrg 87516e9f99Smrg# Parse command line 88516e9f99Smrgwhile test $# -gt 0 ; do 89516e9f99Smrg case $1 in 90516e9f99Smrg --time-stamp | --time* | -t ) 91516e9f99Smrg echo "$timestamp" ; exit ;; 92516e9f99Smrg --version | -v ) 93516e9f99Smrg echo "$version" ; exit ;; 94516e9f99Smrg --help | --h* | -h ) 95516e9f99Smrg echo "$usage"; exit ;; 96516e9f99Smrg -- ) # Stop option processing 97516e9f99Smrg shift; break ;; 98516e9f99Smrg - ) # Use stdin as input. 99516e9f99Smrg break ;; 100516e9f99Smrg -* ) 10109924814Smrg echo "$me: invalid option $1$help" >&2 102516e9f99Smrg exit 1 ;; 103516e9f99Smrg 104516e9f99Smrg *local*) 105516e9f99Smrg # First pass through any local machine types. 10609924814Smrg echo "$1" 107516e9f99Smrg exit ;; 108516e9f99Smrg 109516e9f99Smrg * ) 110516e9f99Smrg break ;; 111516e9f99Smrg esac 112516e9f99Smrgdone 113516e9f99Smrg 114516e9f99Smrgcase $# in 115516e9f99Smrg 0) echo "$me: missing argument$help" >&2 116516e9f99Smrg exit 1;; 117516e9f99Smrg 1) ;; 118516e9f99Smrg *) echo "$me: too many arguments$help" >&2 119516e9f99Smrg exit 1;; 120516e9f99Smrgesac 121516e9f99Smrg 12209924814Smrg# Split fields of configuration type 12309924814Smrg# shellcheck disable=SC2162 12409924814Smrgsaved_IFS=$IFS 12509924814SmrgIFS="-" read field1 field2 field3 field4 <<EOF 12609924814Smrg$1 12709924814SmrgEOF 12809924814SmrgIFS=$saved_IFS 129516e9f99Smrg 13009924814Smrg# Separate into logical components for further validation 13109924814Smrgcase $1 in 13209924814Smrg *-*-*-*-*) 13309924814Smrg echo Invalid configuration \`"$1"\': more than four components >&2 13409924814Smrg exit 1 135516e9f99Smrg ;; 13609924814Smrg *-*-*-*) 13709924814Smrg basic_machine=$field1-$field2 13809924814Smrg basic_os=$field3-$field4 139516e9f99Smrg ;; 14009924814Smrg *-*-*) 14109924814Smrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 14209924814Smrg # parts 14309924814Smrg maybe_os=$field2-$field3 14409924814Smrg case $maybe_os in 14509924814Smrg nto-qnx* | linux-* | uclinux-uclibc* \ 14609924814Smrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 14709924814Smrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 14809924814Smrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) 14909924814Smrg basic_machine=$field1 15009924814Smrg basic_os=$maybe_os 15109924814Smrg ;; 15209924814Smrg android-linux) 15309924814Smrg basic_machine=$field1-unknown 15409924814Smrg basic_os=linux-android 15509924814Smrg ;; 15609924814Smrg *) 15709924814Smrg basic_machine=$field1-$field2 15809924814Smrg basic_os=$field3 15909924814Smrg ;; 16009924814Smrg esac 161516e9f99Smrg ;; 16209924814Smrg *-*) 16309924814Smrg # A lone config we happen to match not fitting any pattern 16409924814Smrg case $field1-$field2 in 16509924814Smrg decstation-3100) 16609924814Smrg basic_machine=mips-dec 16709924814Smrg basic_os= 16809924814Smrg ;; 16909924814Smrg *-*) 17009924814Smrg # Second component is usually, but not always the OS 17109924814Smrg case $field2 in 17209924814Smrg # Prevent following clause from handling this valid os 17309924814Smrg sun*os*) 17409924814Smrg basic_machine=$field1 17509924814Smrg basic_os=$field2 17609924814Smrg ;; 17709924814Smrg zephyr*) 17809924814Smrg basic_machine=$field1-unknown 17909924814Smrg basic_os=$field2 18009924814Smrg ;; 18109924814Smrg # Manufacturers 18209924814Smrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 18309924814Smrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 18409924814Smrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 18509924814Smrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 18609924814Smrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 18709924814Smrg | ultra | tti* | harris | dolphin | highlevel | gould \ 18809924814Smrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 18909924814Smrg | microblaze* | sim | cisco \ 19009924814Smrg | oki | wec | wrs | winbond) 19109924814Smrg basic_machine=$field1-$field2 19209924814Smrg basic_os= 19309924814Smrg ;; 19409924814Smrg *) 19509924814Smrg basic_machine=$field1 19609924814Smrg basic_os=$field2 19709924814Smrg ;; 19809924814Smrg esac 19909924814Smrg ;; 20009924814Smrg esac 201516e9f99Smrg ;; 20209924814Smrg *) 20309924814Smrg # Convert single-component short-hands not valid as part of 20409924814Smrg # multi-component configurations. 20509924814Smrg case $field1 in 20609924814Smrg 386bsd) 20709924814Smrg basic_machine=i386-pc 20809924814Smrg basic_os=bsd 20909924814Smrg ;; 21009924814Smrg a29khif) 21109924814Smrg basic_machine=a29k-amd 21209924814Smrg basic_os=udi 21309924814Smrg ;; 21409924814Smrg adobe68k) 21509924814Smrg basic_machine=m68010-adobe 21609924814Smrg basic_os=scout 21709924814Smrg ;; 21809924814Smrg alliant) 21909924814Smrg basic_machine=fx80-alliant 22009924814Smrg basic_os= 22109924814Smrg ;; 22209924814Smrg altos | altos3068) 22309924814Smrg basic_machine=m68k-altos 22409924814Smrg basic_os= 22509924814Smrg ;; 22609924814Smrg am29k) 22709924814Smrg basic_machine=a29k-none 22809924814Smrg basic_os=bsd 22909924814Smrg ;; 23009924814Smrg amdahl) 23109924814Smrg basic_machine=580-amdahl 23209924814Smrg basic_os=sysv 23309924814Smrg ;; 23409924814Smrg amiga) 23509924814Smrg basic_machine=m68k-unknown 23609924814Smrg basic_os= 23709924814Smrg ;; 23809924814Smrg amigaos | amigados) 23909924814Smrg basic_machine=m68k-unknown 24009924814Smrg basic_os=amigaos 24109924814Smrg ;; 24209924814Smrg amigaunix | amix) 24309924814Smrg basic_machine=m68k-unknown 24409924814Smrg basic_os=sysv4 24509924814Smrg ;; 24609924814Smrg apollo68) 24709924814Smrg basic_machine=m68k-apollo 24809924814Smrg basic_os=sysv 24909924814Smrg ;; 25009924814Smrg apollo68bsd) 25109924814Smrg basic_machine=m68k-apollo 25209924814Smrg basic_os=bsd 25309924814Smrg ;; 25409924814Smrg aros) 25509924814Smrg basic_machine=i386-pc 25609924814Smrg basic_os=aros 25709924814Smrg ;; 25809924814Smrg aux) 25909924814Smrg basic_machine=m68k-apple 26009924814Smrg basic_os=aux 26109924814Smrg ;; 26209924814Smrg balance) 26309924814Smrg basic_machine=ns32k-sequent 26409924814Smrg basic_os=dynix 26509924814Smrg ;; 26609924814Smrg blackfin) 26709924814Smrg basic_machine=bfin-unknown 26809924814Smrg basic_os=linux 26909924814Smrg ;; 27009924814Smrg cegcc) 27109924814Smrg basic_machine=arm-unknown 27209924814Smrg basic_os=cegcc 27309924814Smrg ;; 27409924814Smrg convex-c1) 27509924814Smrg basic_machine=c1-convex 27609924814Smrg basic_os=bsd 27709924814Smrg ;; 27809924814Smrg convex-c2) 27909924814Smrg basic_machine=c2-convex 28009924814Smrg basic_os=bsd 28109924814Smrg ;; 28209924814Smrg convex-c32) 28309924814Smrg basic_machine=c32-convex 28409924814Smrg basic_os=bsd 28509924814Smrg ;; 28609924814Smrg convex-c34) 28709924814Smrg basic_machine=c34-convex 28809924814Smrg basic_os=bsd 28909924814Smrg ;; 29009924814Smrg convex-c38) 29109924814Smrg basic_machine=c38-convex 29209924814Smrg basic_os=bsd 29309924814Smrg ;; 29409924814Smrg cray) 29509924814Smrg basic_machine=j90-cray 29609924814Smrg basic_os=unicos 29709924814Smrg ;; 29809924814Smrg crds | unos) 29909924814Smrg basic_machine=m68k-crds 30009924814Smrg basic_os= 30109924814Smrg ;; 30209924814Smrg da30) 30309924814Smrg basic_machine=m68k-da30 30409924814Smrg basic_os= 30509924814Smrg ;; 30609924814Smrg decstation | pmax | pmin | dec3100 | decstatn) 30709924814Smrg basic_machine=mips-dec 30809924814Smrg basic_os= 30909924814Smrg ;; 31009924814Smrg delta88) 31109924814Smrg basic_machine=m88k-motorola 31209924814Smrg basic_os=sysv3 31309924814Smrg ;; 31409924814Smrg dicos) 31509924814Smrg basic_machine=i686-pc 31609924814Smrg basic_os=dicos 31709924814Smrg ;; 31809924814Smrg djgpp) 31909924814Smrg basic_machine=i586-pc 32009924814Smrg basic_os=msdosdjgpp 32109924814Smrg ;; 32209924814Smrg ebmon29k) 32309924814Smrg basic_machine=a29k-amd 32409924814Smrg basic_os=ebmon 32509924814Smrg ;; 32609924814Smrg es1800 | OSE68k | ose68k | ose | OSE) 32709924814Smrg basic_machine=m68k-ericsson 32809924814Smrg basic_os=ose 32909924814Smrg ;; 33009924814Smrg gmicro) 33109924814Smrg basic_machine=tron-gmicro 33209924814Smrg basic_os=sysv 33309924814Smrg ;; 33409924814Smrg go32) 33509924814Smrg basic_machine=i386-pc 33609924814Smrg basic_os=go32 33709924814Smrg ;; 33809924814Smrg h8300hms) 33909924814Smrg basic_machine=h8300-hitachi 34009924814Smrg basic_os=hms 34109924814Smrg ;; 34209924814Smrg h8300xray) 34309924814Smrg basic_machine=h8300-hitachi 34409924814Smrg basic_os=xray 34509924814Smrg ;; 34609924814Smrg h8500hms) 34709924814Smrg basic_machine=h8500-hitachi 34809924814Smrg basic_os=hms 34909924814Smrg ;; 35009924814Smrg harris) 35109924814Smrg basic_machine=m88k-harris 35209924814Smrg basic_os=sysv3 35309924814Smrg ;; 35409924814Smrg hp300 | hp300hpux) 35509924814Smrg basic_machine=m68k-hp 35609924814Smrg basic_os=hpux 35709924814Smrg ;; 35809924814Smrg hp300bsd) 35909924814Smrg basic_machine=m68k-hp 36009924814Smrg basic_os=bsd 36109924814Smrg ;; 36209924814Smrg hppaosf) 36309924814Smrg basic_machine=hppa1.1-hp 36409924814Smrg basic_os=osf 36509924814Smrg ;; 36609924814Smrg hppro) 36709924814Smrg basic_machine=hppa1.1-hp 36809924814Smrg basic_os=proelf 36909924814Smrg ;; 37009924814Smrg i386mach) 37109924814Smrg basic_machine=i386-mach 37209924814Smrg basic_os=mach 37309924814Smrg ;; 37409924814Smrg isi68 | isi) 37509924814Smrg basic_machine=m68k-isi 37609924814Smrg basic_os=sysv 37709924814Smrg ;; 37809924814Smrg m68knommu) 37909924814Smrg basic_machine=m68k-unknown 38009924814Smrg basic_os=linux 38109924814Smrg ;; 38209924814Smrg magnum | m3230) 38309924814Smrg basic_machine=mips-mips 38409924814Smrg basic_os=sysv 38509924814Smrg ;; 38609924814Smrg merlin) 38709924814Smrg basic_machine=ns32k-utek 38809924814Smrg basic_os=sysv 38909924814Smrg ;; 39009924814Smrg mingw64) 39109924814Smrg basic_machine=x86_64-pc 39209924814Smrg basic_os=mingw64 39309924814Smrg ;; 39409924814Smrg mingw32) 39509924814Smrg basic_machine=i686-pc 39609924814Smrg basic_os=mingw32 39709924814Smrg ;; 39809924814Smrg mingw32ce) 39909924814Smrg basic_machine=arm-unknown 40009924814Smrg basic_os=mingw32ce 40109924814Smrg ;; 40209924814Smrg monitor) 40309924814Smrg basic_machine=m68k-rom68k 40409924814Smrg basic_os=coff 40509924814Smrg ;; 40609924814Smrg morphos) 40709924814Smrg basic_machine=powerpc-unknown 40809924814Smrg basic_os=morphos 40909924814Smrg ;; 41009924814Smrg moxiebox) 41109924814Smrg basic_machine=moxie-unknown 41209924814Smrg basic_os=moxiebox 41309924814Smrg ;; 41409924814Smrg msdos) 41509924814Smrg basic_machine=i386-pc 41609924814Smrg basic_os=msdos 41709924814Smrg ;; 41809924814Smrg msys) 41909924814Smrg basic_machine=i686-pc 42009924814Smrg basic_os=msys 42109924814Smrg ;; 42209924814Smrg mvs) 42309924814Smrg basic_machine=i370-ibm 42409924814Smrg basic_os=mvs 42509924814Smrg ;; 42609924814Smrg nacl) 42709924814Smrg basic_machine=le32-unknown 42809924814Smrg basic_os=nacl 42909924814Smrg ;; 43009924814Smrg ncr3000) 43109924814Smrg basic_machine=i486-ncr 43209924814Smrg basic_os=sysv4 43309924814Smrg ;; 43409924814Smrg netbsd386) 43509924814Smrg basic_machine=i386-pc 43609924814Smrg basic_os=netbsd 43709924814Smrg ;; 43809924814Smrg netwinder) 43909924814Smrg basic_machine=armv4l-rebel 44009924814Smrg basic_os=linux 44109924814Smrg ;; 44209924814Smrg news | news700 | news800 | news900) 44309924814Smrg basic_machine=m68k-sony 44409924814Smrg basic_os=newsos 44509924814Smrg ;; 44609924814Smrg news1000) 44709924814Smrg basic_machine=m68030-sony 44809924814Smrg basic_os=newsos 44909924814Smrg ;; 45009924814Smrg necv70) 45109924814Smrg basic_machine=v70-nec 45209924814Smrg basic_os=sysv 45309924814Smrg ;; 45409924814Smrg nh3000) 45509924814Smrg basic_machine=m68k-harris 45609924814Smrg basic_os=cxux 45709924814Smrg ;; 45809924814Smrg nh[45]000) 45909924814Smrg basic_machine=m88k-harris 46009924814Smrg basic_os=cxux 46109924814Smrg ;; 46209924814Smrg nindy960) 46309924814Smrg basic_machine=i960-intel 46409924814Smrg basic_os=nindy 46509924814Smrg ;; 46609924814Smrg mon960) 46709924814Smrg basic_machine=i960-intel 46809924814Smrg basic_os=mon960 46909924814Smrg ;; 47009924814Smrg nonstopux) 47109924814Smrg basic_machine=mips-compaq 47209924814Smrg basic_os=nonstopux 47309924814Smrg ;; 47409924814Smrg os400) 47509924814Smrg basic_machine=powerpc-ibm 47609924814Smrg basic_os=os400 47709924814Smrg ;; 47809924814Smrg OSE68000 | ose68000) 47909924814Smrg basic_machine=m68000-ericsson 48009924814Smrg basic_os=ose 48109924814Smrg ;; 48209924814Smrg os68k) 48309924814Smrg basic_machine=m68k-none 48409924814Smrg basic_os=os68k 48509924814Smrg ;; 48609924814Smrg paragon) 48709924814Smrg basic_machine=i860-intel 48809924814Smrg basic_os=osf 48909924814Smrg ;; 49009924814Smrg parisc) 49109924814Smrg basic_machine=hppa-unknown 49209924814Smrg basic_os=linux 49309924814Smrg ;; 49409924814Smrg psp) 49509924814Smrg basic_machine=mipsallegrexel-sony 49609924814Smrg basic_os=psp 49709924814Smrg ;; 49809924814Smrg pw32) 49909924814Smrg basic_machine=i586-unknown 50009924814Smrg basic_os=pw32 50109924814Smrg ;; 50209924814Smrg rdos | rdos64) 50309924814Smrg basic_machine=x86_64-pc 50409924814Smrg basic_os=rdos 50509924814Smrg ;; 50609924814Smrg rdos32) 50709924814Smrg basic_machine=i386-pc 50809924814Smrg basic_os=rdos 50909924814Smrg ;; 51009924814Smrg rom68k) 51109924814Smrg basic_machine=m68k-rom68k 51209924814Smrg basic_os=coff 51309924814Smrg ;; 51409924814Smrg sa29200) 51509924814Smrg basic_machine=a29k-amd 51609924814Smrg basic_os=udi 51709924814Smrg ;; 51809924814Smrg sei) 51909924814Smrg basic_machine=mips-sei 52009924814Smrg basic_os=seiux 52109924814Smrg ;; 52209924814Smrg sequent) 52309924814Smrg basic_machine=i386-sequent 52409924814Smrg basic_os= 52509924814Smrg ;; 52609924814Smrg sps7) 52709924814Smrg basic_machine=m68k-bull 52809924814Smrg basic_os=sysv2 52909924814Smrg ;; 53009924814Smrg st2000) 53109924814Smrg basic_machine=m68k-tandem 53209924814Smrg basic_os= 53309924814Smrg ;; 53409924814Smrg stratus) 53509924814Smrg basic_machine=i860-stratus 53609924814Smrg basic_os=sysv4 53709924814Smrg ;; 53809924814Smrg sun2) 53909924814Smrg basic_machine=m68000-sun 54009924814Smrg basic_os= 54109924814Smrg ;; 54209924814Smrg sun2os3) 54309924814Smrg basic_machine=m68000-sun 54409924814Smrg basic_os=sunos3 54509924814Smrg ;; 54609924814Smrg sun2os4) 54709924814Smrg basic_machine=m68000-sun 54809924814Smrg basic_os=sunos4 54909924814Smrg ;; 55009924814Smrg sun3) 55109924814Smrg basic_machine=m68k-sun 55209924814Smrg basic_os= 55309924814Smrg ;; 55409924814Smrg sun3os3) 55509924814Smrg basic_machine=m68k-sun 55609924814Smrg basic_os=sunos3 55709924814Smrg ;; 55809924814Smrg sun3os4) 55909924814Smrg basic_machine=m68k-sun 56009924814Smrg basic_os=sunos4 56109924814Smrg ;; 56209924814Smrg sun4) 56309924814Smrg basic_machine=sparc-sun 56409924814Smrg basic_os= 56509924814Smrg ;; 56609924814Smrg sun4os3) 56709924814Smrg basic_machine=sparc-sun 56809924814Smrg basic_os=sunos3 56909924814Smrg ;; 57009924814Smrg sun4os4) 57109924814Smrg basic_machine=sparc-sun 57209924814Smrg basic_os=sunos4 57309924814Smrg ;; 57409924814Smrg sun4sol2) 57509924814Smrg basic_machine=sparc-sun 57609924814Smrg basic_os=solaris2 57709924814Smrg ;; 57809924814Smrg sun386 | sun386i | roadrunner) 57909924814Smrg basic_machine=i386-sun 58009924814Smrg basic_os= 58109924814Smrg ;; 58209924814Smrg sv1) 58309924814Smrg basic_machine=sv1-cray 58409924814Smrg basic_os=unicos 58509924814Smrg ;; 58609924814Smrg symmetry) 58709924814Smrg basic_machine=i386-sequent 58809924814Smrg basic_os=dynix 58909924814Smrg ;; 59009924814Smrg t3e) 59109924814Smrg basic_machine=alphaev5-cray 59209924814Smrg basic_os=unicos 59309924814Smrg ;; 59409924814Smrg t90) 59509924814Smrg basic_machine=t90-cray 59609924814Smrg basic_os=unicos 59709924814Smrg ;; 59809924814Smrg toad1) 59909924814Smrg basic_machine=pdp10-xkl 60009924814Smrg basic_os=tops20 60109924814Smrg ;; 60209924814Smrg tpf) 60309924814Smrg basic_machine=s390x-ibm 60409924814Smrg basic_os=tpf 60509924814Smrg ;; 60609924814Smrg udi29k) 60709924814Smrg basic_machine=a29k-amd 60809924814Smrg basic_os=udi 60909924814Smrg ;; 61009924814Smrg ultra3) 61109924814Smrg basic_machine=a29k-nyu 61209924814Smrg basic_os=sym1 61309924814Smrg ;; 61409924814Smrg v810 | necv810) 61509924814Smrg basic_machine=v810-nec 61609924814Smrg basic_os=none 61709924814Smrg ;; 61809924814Smrg vaxv) 61909924814Smrg basic_machine=vax-dec 62009924814Smrg basic_os=sysv 62109924814Smrg ;; 62209924814Smrg vms) 62309924814Smrg basic_machine=vax-dec 62409924814Smrg basic_os=vms 62509924814Smrg ;; 62609924814Smrg vsta) 62709924814Smrg basic_machine=i386-pc 62809924814Smrg basic_os=vsta 62909924814Smrg ;; 63009924814Smrg vxworks960) 63109924814Smrg basic_machine=i960-wrs 63209924814Smrg basic_os=vxworks 63309924814Smrg ;; 63409924814Smrg vxworks68) 63509924814Smrg basic_machine=m68k-wrs 63609924814Smrg basic_os=vxworks 63709924814Smrg ;; 63809924814Smrg vxworks29k) 63909924814Smrg basic_machine=a29k-wrs 64009924814Smrg basic_os=vxworks 64109924814Smrg ;; 64209924814Smrg xbox) 64309924814Smrg basic_machine=i686-pc 64409924814Smrg basic_os=mingw32 64509924814Smrg ;; 64609924814Smrg ymp) 64709924814Smrg basic_machine=ymp-cray 64809924814Smrg basic_os=unicos 64909924814Smrg ;; 65009924814Smrg *) 65109924814Smrg basic_machine=$1 65209924814Smrg basic_os= 65309924814Smrg ;; 65409924814Smrg esac 655516e9f99Smrg ;; 65609924814Smrgesac 65709924814Smrg 65809924814Smrg# Decode 1-component or ad-hoc basic machines 65909924814Smrgcase $basic_machine in 66009924814Smrg # Here we handle the default manufacturer of certain CPU types. It is in 66109924814Smrg # some cases the only manufacturer, in others, it is the most popular. 66209924814Smrg w89k) 66309924814Smrg cpu=hppa1.1 66409924814Smrg vendor=winbond 665516e9f99Smrg ;; 66609924814Smrg op50n) 66709924814Smrg cpu=hppa1.1 66809924814Smrg vendor=oki 669516e9f99Smrg ;; 67009924814Smrg op60c) 67109924814Smrg cpu=hppa1.1 67209924814Smrg vendor=oki 673516e9f99Smrg ;; 67409924814Smrg ibm*) 67509924814Smrg cpu=i370 67609924814Smrg vendor=ibm 677516e9f99Smrg ;; 67809924814Smrg orion105) 67909924814Smrg cpu=clipper 68009924814Smrg vendor=highlevel 681516e9f99Smrg ;; 68209924814Smrg mac | mpw | mac-mpw) 68309924814Smrg cpu=m68k 68409924814Smrg vendor=apple 685516e9f99Smrg ;; 68609924814Smrg pmac | pmac-mpw) 68709924814Smrg cpu=powerpc 68809924814Smrg vendor=apple 689516e9f99Smrg ;; 690516e9f99Smrg 691516e9f99Smrg # Recognize the various machine names and aliases which stand 692516e9f99Smrg # for a CPU type and a company and sometimes even an OS. 693516e9f99Smrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 69409924814Smrg cpu=m68000 69509924814Smrg vendor=att 696516e9f99Smrg ;; 697516e9f99Smrg 3b*) 69809924814Smrg cpu=we32k 69909924814Smrg vendor=att 700516e9f99Smrg ;; 701883dc8a3Smrg bluegene*) 70209924814Smrg cpu=powerpc 70309924814Smrg vendor=ibm 70409924814Smrg basic_os=cnk 705516e9f99Smrg ;; 706516e9f99Smrg decsystem10* | dec10*) 70709924814Smrg cpu=pdp10 70809924814Smrg vendor=dec 70909924814Smrg basic_os=tops10 710516e9f99Smrg ;; 711516e9f99Smrg decsystem20* | dec20*) 71209924814Smrg cpu=pdp10 71309924814Smrg vendor=dec 71409924814Smrg basic_os=tops20 715516e9f99Smrg ;; 716516e9f99Smrg delta | 3300 | motorola-3300 | motorola-delta \ 717516e9f99Smrg | 3300-motorola | delta-motorola) 71809924814Smrg cpu=m68k 71909924814Smrg vendor=motorola 720516e9f99Smrg ;; 72109924814Smrg dpx2*) 72209924814Smrg cpu=m68k 72309924814Smrg vendor=bull 72409924814Smrg basic_os=sysv3 725516e9f99Smrg ;; 726516e9f99Smrg encore | umax | mmax) 72709924814Smrg cpu=ns32k 72809924814Smrg vendor=encore 729516e9f99Smrg ;; 73009924814Smrg elxsi) 73109924814Smrg cpu=elxsi 73209924814Smrg vendor=elxsi 73309924814Smrg basic_os=${basic_os:-bsd} 734516e9f99Smrg ;; 735516e9f99Smrg fx2800) 73609924814Smrg cpu=i860 73709924814Smrg vendor=alliant 738516e9f99Smrg ;; 739516e9f99Smrg genix) 74009924814Smrg cpu=ns32k 74109924814Smrg vendor=ns 742516e9f99Smrg ;; 743516e9f99Smrg h3050r* | hiux*) 74409924814Smrg cpu=hppa1.1 74509924814Smrg vendor=hitachi 74609924814Smrg basic_os=hiuxwe2 747516e9f99Smrg ;; 748516e9f99Smrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 74909924814Smrg cpu=hppa1.0 75009924814Smrg vendor=hp 751516e9f99Smrg ;; 752516e9f99Smrg hp9k2[0-9][0-9] | hp9k31[0-9]) 75309924814Smrg cpu=m68000 75409924814Smrg vendor=hp 755516e9f99Smrg ;; 756516e9f99Smrg hp9k3[2-9][0-9]) 75709924814Smrg cpu=m68k 75809924814Smrg vendor=hp 759516e9f99Smrg ;; 760516e9f99Smrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 76109924814Smrg cpu=hppa1.0 76209924814Smrg vendor=hp 763516e9f99Smrg ;; 764516e9f99Smrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 76509924814Smrg cpu=hppa1.1 76609924814Smrg vendor=hp 767516e9f99Smrg ;; 768516e9f99Smrg hp9k78[0-9] | hp78[0-9]) 769516e9f99Smrg # FIXME: really hppa2.0-hp 77009924814Smrg cpu=hppa1.1 77109924814Smrg vendor=hp 772516e9f99Smrg ;; 773516e9f99Smrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 774516e9f99Smrg # FIXME: really hppa2.0-hp 77509924814Smrg cpu=hppa1.1 77609924814Smrg vendor=hp 777516e9f99Smrg ;; 778516e9f99Smrg hp9k8[0-9][13679] | hp8[0-9][13679]) 77909924814Smrg cpu=hppa1.1 78009924814Smrg vendor=hp 781516e9f99Smrg ;; 782516e9f99Smrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 78309924814Smrg cpu=hppa1.0 78409924814Smrg vendor=hp 785516e9f99Smrg ;; 786516e9f99Smrg i*86v32) 78709924814Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 78809924814Smrg vendor=pc 78909924814Smrg basic_os=sysv32 790516e9f99Smrg ;; 791516e9f99Smrg i*86v4*) 79209924814Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79309924814Smrg vendor=pc 79409924814Smrg basic_os=sysv4 795516e9f99Smrg ;; 796516e9f99Smrg i*86v) 79709924814Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 79809924814Smrg vendor=pc 79909924814Smrg basic_os=sysv 800516e9f99Smrg ;; 801516e9f99Smrg i*86sol2) 80209924814Smrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 80309924814Smrg vendor=pc 80409924814Smrg basic_os=solaris2 805516e9f99Smrg ;; 80609924814Smrg j90 | j90-cray) 80709924814Smrg cpu=j90 80809924814Smrg vendor=cray 80909924814Smrg basic_os=${basic_os:-unicos} 810516e9f99Smrg ;; 811516e9f99Smrg iris | iris4d) 81209924814Smrg cpu=mips 81309924814Smrg vendor=sgi 81409924814Smrg case $basic_os in 81509924814Smrg irix*) 816516e9f99Smrg ;; 817516e9f99Smrg *) 81809924814Smrg basic_os=irix4 819516e9f99Smrg ;; 820516e9f99Smrg esac 821516e9f99Smrg ;; 822516e9f99Smrg miniframe) 82309924814Smrg cpu=m68000 82409924814Smrg vendor=convergent 825516e9f99Smrg ;; 82609924814Smrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 82709924814Smrg cpu=m68k 82809924814Smrg vendor=atari 82909924814Smrg basic_os=mint 830516e9f99Smrg ;; 831516e9f99Smrg news-3600 | risc-news) 83209924814Smrg cpu=mips 83309924814Smrg vendor=sony 83409924814Smrg basic_os=newsos 83509924814Smrg ;; 83609924814Smrg next | m*-next) 83709924814Smrg cpu=m68k 83809924814Smrg vendor=next 83909924814Smrg case $basic_os in 84009924814Smrg openstep*) 84109924814Smrg ;; 84209924814Smrg nextstep*) 843516e9f99Smrg ;; 84409924814Smrg ns2*) 84509924814Smrg basic_os=nextstep2 846516e9f99Smrg ;; 847516e9f99Smrg *) 84809924814Smrg basic_os=nextstep3 849516e9f99Smrg ;; 850516e9f99Smrg esac 851516e9f99Smrg ;; 852516e9f99Smrg np1) 85309924814Smrg cpu=np1 85409924814Smrg vendor=gould 855516e9f99Smrg ;; 856516e9f99Smrg op50n-* | op60c-*) 85709924814Smrg cpu=hppa1.1 85809924814Smrg vendor=oki 85909924814Smrg basic_os=proelf 860516e9f99Smrg ;; 861516e9f99Smrg pa-hitachi) 86209924814Smrg cpu=hppa1.1 86309924814Smrg vendor=hitachi 86409924814Smrg basic_os=hiuxwe2 865516e9f99Smrg ;; 866516e9f99Smrg pbd) 86709924814Smrg cpu=sparc 86809924814Smrg vendor=tti 869516e9f99Smrg ;; 870516e9f99Smrg pbb) 87109924814Smrg cpu=m68k 87209924814Smrg vendor=tti 873516e9f99Smrg ;; 87409924814Smrg pc532) 87509924814Smrg cpu=ns32k 87609924814Smrg vendor=pc532 877516e9f99Smrg ;; 878516e9f99Smrg pn) 87909924814Smrg cpu=pn 88009924814Smrg vendor=gould 881516e9f99Smrg ;; 88209924814Smrg power) 88309924814Smrg cpu=power 88409924814Smrg vendor=ibm 885516e9f99Smrg ;; 886516e9f99Smrg ps2) 88709924814Smrg cpu=i386 88809924814Smrg vendor=ibm 889516e9f99Smrg ;; 890516e9f99Smrg rm[46]00) 89109924814Smrg cpu=mips 89209924814Smrg vendor=siemens 893516e9f99Smrg ;; 894516e9f99Smrg rtpc | rtpc-*) 89509924814Smrg cpu=romp 89609924814Smrg vendor=ibm 897516e9f99Smrg ;; 89809924814Smrg sde) 89909924814Smrg cpu=mipsisa32 90009924814Smrg vendor=sde 90109924814Smrg basic_os=${basic_os:-elf} 902516e9f99Smrg ;; 90309924814Smrg simso-wrs) 90409924814Smrg cpu=sparclite 90509924814Smrg vendor=wrs 90609924814Smrg basic_os=vxworks 907516e9f99Smrg ;; 90809924814Smrg tower | tower-32) 90909924814Smrg cpu=m68k 91009924814Smrg vendor=ncr 911516e9f99Smrg ;; 91209924814Smrg vpp*|vx|vx-*) 91309924814Smrg cpu=f301 91409924814Smrg vendor=fujitsu 915516e9f99Smrg ;; 91609924814Smrg w65) 91709924814Smrg cpu=w65 91809924814Smrg vendor=wdc 919516e9f99Smrg ;; 92009924814Smrg w89k-*) 92109924814Smrg cpu=hppa1.1 92209924814Smrg vendor=winbond 92309924814Smrg basic_os=proelf 924516e9f99Smrg ;; 92509924814Smrg none) 92609924814Smrg cpu=none 92709924814Smrg vendor=none 928516e9f99Smrg ;; 92909924814Smrg leon|leon[3-9]) 93009924814Smrg cpu=sparc 93109924814Smrg vendor=$basic_machine 932516e9f99Smrg ;; 93309924814Smrg leon-*|leon[3-9]-*) 93409924814Smrg cpu=sparc 93509924814Smrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 936516e9f99Smrg ;; 93709924814Smrg 93809924814Smrg *-*) 93909924814Smrg # shellcheck disable=SC2162 94009924814Smrg saved_IFS=$IFS 94109924814Smrg IFS="-" read cpu vendor <<EOF 94209924814Smrg$basic_machine 94309924814SmrgEOF 94409924814Smrg IFS=$saved_IFS 945516e9f99Smrg ;; 94609924814Smrg # We use `pc' rather than `unknown' 94709924814Smrg # because (1) that's what they normally are, and 94809924814Smrg # (2) the word "unknown" tends to confuse beginning users. 94909924814Smrg i*86 | x86_64) 95009924814Smrg cpu=$basic_machine 95109924814Smrg vendor=pc 952516e9f99Smrg ;; 95309924814Smrg # These rules are duplicated from below for sake of the special case above; 95409924814Smrg # i.e. things that normalized to x86 arches should also default to "pc" 95509924814Smrg pc98) 95609924814Smrg cpu=i386 95709924814Smrg vendor=pc 958516e9f99Smrg ;; 95909924814Smrg x64 | amd64) 96009924814Smrg cpu=x86_64 96109924814Smrg vendor=pc 962516e9f99Smrg ;; 96309924814Smrg # Recognize the basic CPU types without company name. 96409924814Smrg *) 96509924814Smrg cpu=$basic_machine 96609924814Smrg vendor=unknown 967516e9f99Smrg ;; 96809924814Smrgesac 96909924814Smrg 97009924814Smrgunset -v basic_machine 97109924814Smrg 97209924814Smrg# Decode basic machines in the full and proper CPU-Company form. 97309924814Smrgcase $cpu-$vendor in 97409924814Smrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 97509924814Smrg # some cases the only manufacturer, in others, it is the most popular. 97609924814Smrg craynv-unknown) 97709924814Smrg vendor=cray 97809924814Smrg basic_os=${basic_os:-unicosmp} 979516e9f99Smrg ;; 98009924814Smrg c90-unknown | c90-cray) 98109924814Smrg vendor=cray 98209924814Smrg basic_os=${Basic_os:-unicos} 983516e9f99Smrg ;; 98409924814Smrg fx80-unknown) 98509924814Smrg vendor=alliant 986516e9f99Smrg ;; 98709924814Smrg romp-unknown) 98809924814Smrg vendor=ibm 989516e9f99Smrg ;; 99009924814Smrg mmix-unknown) 99109924814Smrg vendor=knuth 992516e9f99Smrg ;; 99309924814Smrg microblaze-unknown | microblazeel-unknown) 99409924814Smrg vendor=xilinx 995516e9f99Smrg ;; 99609924814Smrg rs6000-unknown) 99709924814Smrg vendor=ibm 998516e9f99Smrg ;; 99909924814Smrg vax-unknown) 100009924814Smrg vendor=dec 1001516e9f99Smrg ;; 100209924814Smrg pdp11-unknown) 100309924814Smrg vendor=dec 1004516e9f99Smrg ;; 100509924814Smrg we32k-unknown) 100609924814Smrg vendor=att 1007516e9f99Smrg ;; 100809924814Smrg cydra-unknown) 100909924814Smrg vendor=cydrome 1010516e9f99Smrg ;; 101109924814Smrg i370-ibm*) 101209924814Smrg vendor=ibm 1013516e9f99Smrg ;; 101409924814Smrg orion-unknown) 101509924814Smrg vendor=highlevel 1016516e9f99Smrg ;; 101709924814Smrg xps-unknown | xps100-unknown) 101809924814Smrg cpu=xps100 101909924814Smrg vendor=honeywell 1020516e9f99Smrg ;; 102109924814Smrg 102209924814Smrg # Here we normalize CPU types with a missing or matching vendor 102309924814Smrg armh-unknown | armh-alt) 102409924814Smrg cpu=armv7l 102509924814Smrg vendor=alt 102609924814Smrg basic_os=${basic_os:-linux-gnueabihf} 1027516e9f99Smrg ;; 102809924814Smrg dpx20-unknown | dpx20-bull) 102909924814Smrg cpu=rs6000 103009924814Smrg vendor=bull 103109924814Smrg basic_os=${basic_os:-bosx} 1032516e9f99Smrg ;; 103309924814Smrg 103409924814Smrg # Here we normalize CPU types irrespective of the vendor 103509924814Smrg amd64-*) 103609924814Smrg cpu=x86_64 1037516e9f99Smrg ;; 103809924814Smrg blackfin-*) 103909924814Smrg cpu=bfin 104009924814Smrg basic_os=linux 1041516e9f99Smrg ;; 104209924814Smrg c54x-*) 104309924814Smrg cpu=tic54x 1044516e9f99Smrg ;; 104509924814Smrg c55x-*) 104609924814Smrg cpu=tic55x 1047516e9f99Smrg ;; 104809924814Smrg c6x-*) 104909924814Smrg cpu=tic6x 1050516e9f99Smrg ;; 105109924814Smrg e500v[12]-*) 105209924814Smrg cpu=powerpc 105309924814Smrg basic_os=${basic_os}"spe" 1054516e9f99Smrg ;; 105509924814Smrg mips3*-*) 105609924814Smrg cpu=mips64 1057516e9f99Smrg ;; 105809924814Smrg ms1-*) 105909924814Smrg cpu=mt 1060516e9f99Smrg ;; 106109924814Smrg m68knommu-*) 106209924814Smrg cpu=m68k 106309924814Smrg basic_os=linux 1064516e9f99Smrg ;; 106509924814Smrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 106609924814Smrg cpu=s12z 1067516e9f99Smrg ;; 106809924814Smrg openrisc-*) 106909924814Smrg cpu=or32 1070516e9f99Smrg ;; 107109924814Smrg parisc-*) 107209924814Smrg cpu=hppa 107309924814Smrg basic_os=linux 1074516e9f99Smrg ;; 107509924814Smrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 107609924814Smrg cpu=i586 1077516e9f99Smrg ;; 107809924814Smrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 107909924814Smrg cpu=i686 1080516e9f99Smrg ;; 108109924814Smrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 108209924814Smrg cpu=i686 1083516e9f99Smrg ;; 108409924814Smrg pentium4-*) 108509924814Smrg cpu=i786 1086516e9f99Smrg ;; 108709924814Smrg pc98-*) 108809924814Smrg cpu=i386 1089516e9f99Smrg ;; 109009924814Smrg ppc-* | ppcbe-*) 109109924814Smrg cpu=powerpc 1092516e9f99Smrg ;; 109309924814Smrg ppcle-* | powerpclittle-*) 109409924814Smrg cpu=powerpcle 1095516e9f99Smrg ;; 109609924814Smrg ppc64-*) 109709924814Smrg cpu=powerpc64 1098516e9f99Smrg ;; 109909924814Smrg ppc64le-* | powerpc64little-*) 110009924814Smrg cpu=powerpc64le 1101516e9f99Smrg ;; 110209924814Smrg sb1-*) 110309924814Smrg cpu=mipsisa64sb1 1104516e9f99Smrg ;; 110509924814Smrg sb1el-*) 110609924814Smrg cpu=mipsisa64sb1el 1107516e9f99Smrg ;; 110809924814Smrg sh5e[lb]-*) 110909924814Smrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 1110516e9f99Smrg ;; 111109924814Smrg spur-*) 111209924814Smrg cpu=spur 1113516e9f99Smrg ;; 111409924814Smrg strongarm-* | thumb-*) 111509924814Smrg cpu=arm 1116516e9f99Smrg ;; 111709924814Smrg tx39-*) 111809924814Smrg cpu=mipstx39 1119516e9f99Smrg ;; 112009924814Smrg tx39el-*) 112109924814Smrg cpu=mipstx39el 1122516e9f99Smrg ;; 112309924814Smrg x64-*) 112409924814Smrg cpu=x86_64 1125516e9f99Smrg ;; 112609924814Smrg xscale-* | xscalee[bl]-*) 112709924814Smrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 1128516e9f99Smrg ;; 112909924814Smrg arm64-* | aarch64le-*) 113009924814Smrg cpu=aarch64 1131516e9f99Smrg ;; 113209924814Smrg 113309924814Smrg # Recognize the canonical CPU Types that limit and/or modify the 113409924814Smrg # company names they are paired with. 113509924814Smrg cr16-*) 113609924814Smrg basic_os=${basic_os:-elf} 1137516e9f99Smrg ;; 113809924814Smrg crisv32-* | etraxfs*-*) 113909924814Smrg cpu=crisv32 114009924814Smrg vendor=axis 1141516e9f99Smrg ;; 114209924814Smrg cris-* | etrax*-*) 114309924814Smrg cpu=cris 114409924814Smrg vendor=axis 1145516e9f99Smrg ;; 114609924814Smrg crx-*) 114709924814Smrg basic_os=${basic_os:-elf} 1148516e9f99Smrg ;; 114909924814Smrg neo-tandem) 115009924814Smrg cpu=neo 115109924814Smrg vendor=tandem 1152516e9f99Smrg ;; 115309924814Smrg nse-tandem) 115409924814Smrg cpu=nse 115509924814Smrg vendor=tandem 1156516e9f99Smrg ;; 115709924814Smrg nsr-tandem) 115809924814Smrg cpu=nsr 115909924814Smrg vendor=tandem 1160516e9f99Smrg ;; 116109924814Smrg nsv-tandem) 116209924814Smrg cpu=nsv 116309924814Smrg vendor=tandem 1164516e9f99Smrg ;; 116509924814Smrg nsx-tandem) 116609924814Smrg cpu=nsx 116709924814Smrg vendor=tandem 1168516e9f99Smrg ;; 116909924814Smrg mipsallegrexel-sony) 117009924814Smrg cpu=mipsallegrexel 117109924814Smrg vendor=sony 1172516e9f99Smrg ;; 117309924814Smrg tile*-*) 117409924814Smrg basic_os=${basic_os:-linux-gnu} 1175516e9f99Smrg ;; 117609924814Smrg 1177516e9f99Smrg *) 117809924814Smrg # Recognize the canonical CPU types that are allowed with any 117909924814Smrg # company name. 118009924814Smrg case $cpu in 118109924814Smrg 1750a | 580 \ 118209924814Smrg | a29k \ 118309924814Smrg | aarch64 | aarch64_be \ 118409924814Smrg | abacus \ 118509924814Smrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 118609924814Smrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 118709924814Smrg | alphapca5[67] | alpha64pca5[67] \ 118809924814Smrg | am33_2.0 \ 118909924814Smrg | amdgcn \ 119009924814Smrg | arc | arceb | arc32 | arc64 \ 119109924814Smrg | arm | arm[lb]e | arme[lb] | armv* \ 119209924814Smrg | avr | avr32 \ 119309924814Smrg | asmjs \ 119409924814Smrg | ba \ 119509924814Smrg | be32 | be64 \ 119609924814Smrg | bfin | bpf | bs2000 \ 119709924814Smrg | c[123]* | c30 | [cjt]90 | c4x \ 119809924814Smrg | c8051 | clipper | craynv | csky | cydra \ 119909924814Smrg | d10v | d30v | dlx | dsp16xx \ 120009924814Smrg | e2k | elxsi | epiphany \ 120109924814Smrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 120209924814Smrg | h8300 | h8500 \ 120309924814Smrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 120409924814Smrg | hexagon \ 120509924814Smrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 120609924814Smrg | ip2k | iq2000 \ 120709924814Smrg | k1om \ 120809924814Smrg | le32 | le64 \ 120909924814Smrg | lm32 \ 121009924814Smrg | loongarch32 | loongarch64 \ 121109924814Smrg | m32c | m32r | m32rle \ 121209924814Smrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 121309924814Smrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 121409924814Smrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 121509924814Smrg | microblaze | microblazeel \ 121609924814Smrg | mips | mipsbe | mipseb | mipsel | mipsle \ 121709924814Smrg | mips16 \ 121809924814Smrg | mips64 | mips64eb | mips64el \ 121909924814Smrg | mips64octeon | mips64octeonel \ 122009924814Smrg | mips64orion | mips64orionel \ 122109924814Smrg | mips64r5900 | mips64r5900el \ 122209924814Smrg | mips64vr | mips64vrel \ 122309924814Smrg | mips64vr4100 | mips64vr4100el \ 122409924814Smrg | mips64vr4300 | mips64vr4300el \ 122509924814Smrg | mips64vr5000 | mips64vr5000el \ 122609924814Smrg | mips64vr5900 | mips64vr5900el \ 122709924814Smrg | mipsisa32 | mipsisa32el \ 122809924814Smrg | mipsisa32r2 | mipsisa32r2el \ 122909924814Smrg | mipsisa32r3 | mipsisa32r3el \ 123009924814Smrg | mipsisa32r5 | mipsisa32r5el \ 123109924814Smrg | mipsisa32r6 | mipsisa32r6el \ 123209924814Smrg | mipsisa64 | mipsisa64el \ 123309924814Smrg | mipsisa64r2 | mipsisa64r2el \ 123409924814Smrg | mipsisa64r3 | mipsisa64r3el \ 123509924814Smrg | mipsisa64r5 | mipsisa64r5el \ 123609924814Smrg | mipsisa64r6 | mipsisa64r6el \ 123709924814Smrg | mipsisa64sb1 | mipsisa64sb1el \ 123809924814Smrg | mipsisa64sr71k | mipsisa64sr71kel \ 123909924814Smrg | mipsr5900 | mipsr5900el \ 124009924814Smrg | mipstx39 | mipstx39el \ 124109924814Smrg | mmix \ 124209924814Smrg | mn10200 | mn10300 \ 124309924814Smrg | moxie \ 124409924814Smrg | mt \ 124509924814Smrg | msp430 \ 124609924814Smrg | nds32 | nds32le | nds32be \ 124709924814Smrg | nfp \ 124809924814Smrg | nios | nios2 | nios2eb | nios2el \ 124909924814Smrg | none | np1 | ns16k | ns32k | nvptx \ 125009924814Smrg | open8 \ 125109924814Smrg | or1k* \ 125209924814Smrg | or32 \ 125309924814Smrg | orion \ 125409924814Smrg | picochip \ 125509924814Smrg | pdp10 | pdp11 | pj | pjl | pn | power \ 125609924814Smrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 125709924814Smrg | pru \ 125809924814Smrg | pyramid \ 125909924814Smrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 126009924814Smrg | rl78 | romp | rs6000 | rx \ 126109924814Smrg | s390 | s390x \ 126209924814Smrg | score \ 126309924814Smrg | sh | shl \ 126409924814Smrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 126509924814Smrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 126609924814Smrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 126709924814Smrg | sparclite \ 126809924814Smrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 126909924814Smrg | spu \ 127009924814Smrg | tahoe \ 127109924814Smrg | thumbv7* \ 127209924814Smrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 127309924814Smrg | tron \ 127409924814Smrg | ubicom32 \ 127509924814Smrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 127609924814Smrg | vax \ 127709924814Smrg | visium \ 127809924814Smrg | w65 \ 127909924814Smrg | wasm32 | wasm64 \ 128009924814Smrg | we32k \ 128109924814Smrg | x86 | x86_64 | xc16x | xgate | xps100 \ 128209924814Smrg | xstormy16 | xtensa* \ 128309924814Smrg | ymp \ 128409924814Smrg | z8k | z80) 128509924814Smrg ;; 128609924814Smrg 128709924814Smrg *) 128809924814Smrg echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 128909924814Smrg exit 1 129009924814Smrg ;; 129109924814Smrg esac 1292516e9f99Smrg ;; 1293516e9f99Smrgesac 1294516e9f99Smrg 1295516e9f99Smrg# Here we canonicalize certain aliases for manufacturers. 129609924814Smrgcase $vendor in 129709924814Smrg digital*) 129809924814Smrg vendor=dec 1299516e9f99Smrg ;; 130009924814Smrg commodore*) 130109924814Smrg vendor=cbm 1302516e9f99Smrg ;; 1303516e9f99Smrg *) 1304516e9f99Smrg ;; 1305516e9f99Smrgesac 1306516e9f99Smrg 1307516e9f99Smrg# Decode manufacturer-specific aliases for certain operating systems. 1308516e9f99Smrg 130909924814Smrgif test x$basic_os != x 1310516e9f99Smrgthen 131109924814Smrg 131209924814Smrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 131309924814Smrg# set os. 131409924814Smrgcase $basic_os in 131509924814Smrg gnu/linux*) 131609924814Smrg kernel=linux 131709924814Smrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 131809924814Smrg ;; 131909924814Smrg os2-emx) 132009924814Smrg kernel=os2 132109924814Smrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 132209924814Smrg ;; 132309924814Smrg nto-qnx*) 132409924814Smrg kernel=nto 132509924814Smrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 132609924814Smrg ;; 132709924814Smrg *-*) 132809924814Smrg # shellcheck disable=SC2162 132909924814Smrg saved_IFS=$IFS 133009924814Smrg IFS="-" read kernel os <<EOF 133109924814Smrg$basic_os 133209924814SmrgEOF 133309924814Smrg IFS=$saved_IFS 133409924814Smrg ;; 133509924814Smrg # Default OS when just kernel was specified 133609924814Smrg nto*) 133709924814Smrg kernel=nto 133809924814Smrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 133909924814Smrg ;; 134009924814Smrg linux*) 134109924814Smrg kernel=linux 134209924814Smrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 134309924814Smrg ;; 134409924814Smrg managarm*) 134509924814Smrg kernel=managarm 134609924814Smrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 134709924814Smrg ;; 134809924814Smrg *) 134909924814Smrg kernel= 135009924814Smrg os=$basic_os 135109924814Smrg ;; 135209924814Smrgesac 135309924814Smrg 135409924814Smrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 135509924814Smrg# etc.) 1356516e9f99Smrgcase $os in 135709924814Smrg # First match some system type aliases that might get confused 135809924814Smrg # with valid system types. 135909924814Smrg # solaris* is a basic system type, with this one exception. 136009924814Smrg auroraux) 136109924814Smrg os=auroraux 1362883dc8a3Smrg ;; 136309924814Smrg bluegene*) 136409924814Smrg os=cnk 1365516e9f99Smrg ;; 136609924814Smrg solaris1 | solaris1.*) 136709924814Smrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 1368516e9f99Smrg ;; 136909924814Smrg solaris) 137009924814Smrg os=solaris2 1371516e9f99Smrg ;; 137209924814Smrg unixware*) 137309924814Smrg os=sysv4.2uw 1374516e9f99Smrg ;; 137509924814Smrg # es1800 is here to avoid being matched by es* (a different OS) 137609924814Smrg es1800*) 137709924814Smrg os=ose 1378516e9f99Smrg ;; 137909924814Smrg # Some version numbers need modification 138009924814Smrg chorusos*) 138109924814Smrg os=chorusos 1382516e9f99Smrg ;; 138309924814Smrg isc) 138409924814Smrg os=isc2.2 1385516e9f99Smrg ;; 138609924814Smrg sco6) 138709924814Smrg os=sco5v6 1388516e9f99Smrg ;; 138909924814Smrg sco5) 139009924814Smrg os=sco3.2v5 1391516e9f99Smrg ;; 139209924814Smrg sco4) 139309924814Smrg os=sco3.2v4 1394516e9f99Smrg ;; 139509924814Smrg sco3.2.[4-9]*) 139609924814Smrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 1397516e9f99Smrg ;; 139809924814Smrg sco*v* | scout) 139909924814Smrg # Don't match below 1400516e9f99Smrg ;; 140109924814Smrg sco*) 140209924814Smrg os=sco3.2v2 1403516e9f99Smrg ;; 140409924814Smrg psos*) 140509924814Smrg os=psos 1406516e9f99Smrg ;; 140709924814Smrg qnx*) 140809924814Smrg os=qnx 1409516e9f99Smrg ;; 141009924814Smrg hiux*) 141109924814Smrg os=hiuxwe2 1412516e9f99Smrg ;; 141309924814Smrg lynx*178) 141409924814Smrg os=lynxos178 1415516e9f99Smrg ;; 141609924814Smrg lynx*5) 141709924814Smrg os=lynxos5 1418516e9f99Smrg ;; 141909924814Smrg lynxos*) 142009924814Smrg # don't get caught up in next wildcard 1421516e9f99Smrg ;; 142209924814Smrg lynx*) 142309924814Smrg os=lynxos 1424516e9f99Smrg ;; 142509924814Smrg mac[0-9]*) 142609924814Smrg os=`echo "$os" | sed -e 's|mac|macos|'` 1427516e9f99Smrg ;; 142809924814Smrg opened*) 142909924814Smrg os=openedition 1430516e9f99Smrg ;; 143109924814Smrg os400*) 143209924814Smrg os=os400 1433516e9f99Smrg ;; 143409924814Smrg sunos5*) 143509924814Smrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1436516e9f99Smrg ;; 143709924814Smrg sunos6*) 143809924814Smrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1439516e9f99Smrg ;; 144009924814Smrg wince*) 144109924814Smrg os=wince 1442516e9f99Smrg ;; 144309924814Smrg utek*) 144409924814Smrg os=bsd 1445516e9f99Smrg ;; 144609924814Smrg dynix*) 144709924814Smrg os=bsd 1448516e9f99Smrg ;; 144909924814Smrg acis*) 145009924814Smrg os=aos 1451516e9f99Smrg ;; 145209924814Smrg atheos*) 145309924814Smrg os=atheos 1454516e9f99Smrg ;; 145509924814Smrg syllable*) 145609924814Smrg os=syllable 1457516e9f99Smrg ;; 145809924814Smrg 386bsd) 145909924814Smrg os=bsd 1460516e9f99Smrg ;; 146109924814Smrg ctix* | uts*) 146209924814Smrg os=sysv 1463516e9f99Smrg ;; 146409924814Smrg nova*) 146509924814Smrg os=rtmk-nova 1466516e9f99Smrg ;; 146709924814Smrg ns2) 146809924814Smrg os=nextstep2 1469516e9f99Smrg ;; 147009924814Smrg # Preserve the version number of sinix5. 147109924814Smrg sinix5.*) 147209924814Smrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 1473516e9f99Smrg ;; 147409924814Smrg sinix*) 147509924814Smrg os=sysv4 1476516e9f99Smrg ;; 147709924814Smrg tpf*) 147809924814Smrg os=tpf 1479516e9f99Smrg ;; 148009924814Smrg triton*) 148109924814Smrg os=sysv3 1482516e9f99Smrg ;; 148309924814Smrg oss*) 148409924814Smrg os=sysv3 1485516e9f99Smrg ;; 148609924814Smrg svr4*) 148709924814Smrg os=sysv4 1488516e9f99Smrg ;; 148909924814Smrg svr3) 149009924814Smrg os=sysv3 1491516e9f99Smrg ;; 149209924814Smrg sysvr4) 149309924814Smrg os=sysv4 1494516e9f99Smrg ;; 149509924814Smrg ose*) 149609924814Smrg os=ose 1497516e9f99Smrg ;; 149809924814Smrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 149909924814Smrg os=mint 1500516e9f99Smrg ;; 150109924814Smrg dicos*) 150209924814Smrg os=dicos 1503516e9f99Smrg ;; 150409924814Smrg pikeos*) 150509924814Smrg # Until real need of OS specific support for 150609924814Smrg # particular features comes up, bare metal 150709924814Smrg # configurations are quite functional. 150809924814Smrg case $cpu in 150909924814Smrg arm*) 151009924814Smrg os=eabi 151109924814Smrg ;; 151209924814Smrg *) 151309924814Smrg os=elf 151409924814Smrg ;; 151509924814Smrg esac 1516516e9f99Smrg ;; 1517516e9f99Smrg *) 151809924814Smrg # No normalization, but not necessarily accepted, that comes below. 1519516e9f99Smrg ;; 1520516e9f99Smrgesac 152109924814Smrg 1522516e9f99Smrgelse 1523516e9f99Smrg 1524516e9f99Smrg# Here we handle the default operating systems that come with various machines. 1525516e9f99Smrg# The value should be what the vendor currently ships out the door with their 1526516e9f99Smrg# machine or put another way, the most popular os provided with the machine. 1527516e9f99Smrg 1528516e9f99Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 1529516e9f99Smrg# "-sun"), then you have to tell the case statement up towards the top 1530516e9f99Smrg# that MANUFACTURER isn't an operating system. Otherwise, code above 1531516e9f99Smrg# will signal an error saying that MANUFACTURER isn't an operating 1532516e9f99Smrg# system, and we'll never get to this point. 1533516e9f99Smrg 153409924814Smrgkernel= 153509924814Smrgcase $cpu-$vendor in 153609924814Smrg score-*) 153709924814Smrg os=elf 1538516e9f99Smrg ;; 153909924814Smrg spu-*) 154009924814Smrg os=elf 1541516e9f99Smrg ;; 1542516e9f99Smrg *-acorn) 154309924814Smrg os=riscix1.2 1544516e9f99Smrg ;; 1545516e9f99Smrg arm*-rebel) 154609924814Smrg kernel=linux 154709924814Smrg os=gnu 1548516e9f99Smrg ;; 1549516e9f99Smrg arm*-semi) 155009924814Smrg os=aout 155109924814Smrg ;; 155209924814Smrg c4x-* | tic4x-*) 155309924814Smrg os=coff 155409924814Smrg ;; 155509924814Smrg c8051-*) 155609924814Smrg os=elf 155709924814Smrg ;; 155809924814Smrg clipper-intergraph) 155909924814Smrg os=clix 1560516e9f99Smrg ;; 156109924814Smrg hexagon-*) 156209924814Smrg os=elf 1563516e9f99Smrg ;; 1564883dc8a3Smrg tic54x-*) 156509924814Smrg os=coff 1566883dc8a3Smrg ;; 1567883dc8a3Smrg tic55x-*) 156809924814Smrg os=coff 1569883dc8a3Smrg ;; 1570883dc8a3Smrg tic6x-*) 157109924814Smrg os=coff 1572883dc8a3Smrg ;; 1573516e9f99Smrg # This must come before the *-dec entry. 1574516e9f99Smrg pdp10-*) 157509924814Smrg os=tops20 1576516e9f99Smrg ;; 1577516e9f99Smrg pdp11-*) 157809924814Smrg os=none 1579516e9f99Smrg ;; 1580516e9f99Smrg *-dec | vax-*) 158109924814Smrg os=ultrix4.2 1582516e9f99Smrg ;; 1583516e9f99Smrg m68*-apollo) 158409924814Smrg os=domain 1585516e9f99Smrg ;; 1586516e9f99Smrg i386-sun) 158709924814Smrg os=sunos4.0.2 1588516e9f99Smrg ;; 1589516e9f99Smrg m68000-sun) 159009924814Smrg os=sunos3 1591516e9f99Smrg ;; 1592516e9f99Smrg m68*-cisco) 159309924814Smrg os=aout 1594516e9f99Smrg ;; 159509924814Smrg mep-*) 159609924814Smrg os=elf 1597516e9f99Smrg ;; 1598516e9f99Smrg mips*-cisco) 159909924814Smrg os=elf 1600516e9f99Smrg ;; 1601516e9f99Smrg mips*-*) 160209924814Smrg os=elf 1603516e9f99Smrg ;; 1604516e9f99Smrg or32-*) 160509924814Smrg os=coff 1606516e9f99Smrg ;; 1607516e9f99Smrg *-tti) # must be before sparc entry or we get the wrong os. 160809924814Smrg os=sysv3 1609516e9f99Smrg ;; 1610516e9f99Smrg sparc-* | *-sun) 161109924814Smrg os=sunos4.1.1 1612516e9f99Smrg ;; 161309924814Smrg pru-*) 161409924814Smrg os=elf 1615516e9f99Smrg ;; 161609924814Smrg *-be) 161709924814Smrg os=beos 1618516e9f99Smrg ;; 1619516e9f99Smrg *-ibm) 162009924814Smrg os=aix 1621516e9f99Smrg ;; 162209924814Smrg *-knuth) 162309924814Smrg os=mmixware 1624516e9f99Smrg ;; 1625516e9f99Smrg *-wec) 162609924814Smrg os=proelf 1627516e9f99Smrg ;; 1628516e9f99Smrg *-winbond) 162909924814Smrg os=proelf 1630516e9f99Smrg ;; 1631516e9f99Smrg *-oki) 163209924814Smrg os=proelf 1633516e9f99Smrg ;; 1634516e9f99Smrg *-hp) 163509924814Smrg os=hpux 1636516e9f99Smrg ;; 1637516e9f99Smrg *-hitachi) 163809924814Smrg os=hiux 1639516e9f99Smrg ;; 1640516e9f99Smrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 164109924814Smrg os=sysv 1642516e9f99Smrg ;; 1643516e9f99Smrg *-cbm) 164409924814Smrg os=amigaos 1645516e9f99Smrg ;; 1646516e9f99Smrg *-dg) 164709924814Smrg os=dgux 1648516e9f99Smrg ;; 1649516e9f99Smrg *-dolphin) 165009924814Smrg os=sysv3 1651516e9f99Smrg ;; 1652516e9f99Smrg m68k-ccur) 165309924814Smrg os=rtu 1654516e9f99Smrg ;; 1655516e9f99Smrg m88k-omron*) 165609924814Smrg os=luna 1657516e9f99Smrg ;; 165809924814Smrg *-next) 165909924814Smrg os=nextstep 1660516e9f99Smrg ;; 1661516e9f99Smrg *-sequent) 166209924814Smrg os=ptx 1663516e9f99Smrg ;; 1664516e9f99Smrg *-crds) 166509924814Smrg os=unos 1666516e9f99Smrg ;; 1667516e9f99Smrg *-ns) 166809924814Smrg os=genix 1669516e9f99Smrg ;; 1670516e9f99Smrg i370-*) 167109924814Smrg os=mvs 1672516e9f99Smrg ;; 1673516e9f99Smrg *-gould) 167409924814Smrg os=sysv 1675516e9f99Smrg ;; 1676516e9f99Smrg *-highlevel) 167709924814Smrg os=bsd 1678516e9f99Smrg ;; 1679516e9f99Smrg *-encore) 168009924814Smrg os=bsd 1681516e9f99Smrg ;; 1682516e9f99Smrg *-sgi) 168309924814Smrg os=irix 1684516e9f99Smrg ;; 1685516e9f99Smrg *-siemens) 168609924814Smrg os=sysv4 1687516e9f99Smrg ;; 1688516e9f99Smrg *-masscomp) 168909924814Smrg os=rtu 1690516e9f99Smrg ;; 1691516e9f99Smrg f30[01]-fujitsu | f700-fujitsu) 169209924814Smrg os=uxpv 1693516e9f99Smrg ;; 1694516e9f99Smrg *-rom68k) 169509924814Smrg os=coff 1696516e9f99Smrg ;; 1697516e9f99Smrg *-*bug) 169809924814Smrg os=coff 1699516e9f99Smrg ;; 1700516e9f99Smrg *-apple) 170109924814Smrg os=macos 1702516e9f99Smrg ;; 1703516e9f99Smrg *-atari*) 170409924814Smrg os=mint 170509924814Smrg ;; 170609924814Smrg *-wrs) 170709924814Smrg os=vxworks 1708516e9f99Smrg ;; 1709516e9f99Smrg *) 171009924814Smrg os=none 1711516e9f99Smrg ;; 1712516e9f99Smrgesac 171309924814Smrg 1714516e9f99Smrgfi 1715516e9f99Smrg 171609924814Smrg# Now, validate our (potentially fixed-up) OS. 171709924814Smrgcase $os in 171809924814Smrg # Sometimes we do "kernel-libc", so those need to count as OSes. 171909924814Smrg musl* | newlib* | relibc* | uclibc*) 172009924814Smrg ;; 172109924814Smrg # Likewise for "kernel-abi" 172209924814Smrg eabi* | gnueabi*) 172309924814Smrg ;; 172409924814Smrg # VxWorks passes extra cpu info in the 4th filed. 172509924814Smrg simlinux | simwindows | spe) 172609924814Smrg ;; 172709924814Smrg # Now accept the basic system types. 172809924814Smrg # The portable systems comes first. 172909924814Smrg # Each alternative MUST end in a * to match a version number. 173009924814Smrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 173109924814Smrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 173209924814Smrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 173309924814Smrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 173409924814Smrg | hiux* | abug | nacl* | netware* | windows* \ 173509924814Smrg | os9* | macos* | osx* | ios* \ 173609924814Smrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 173709924814Smrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 173809924814Smrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 173909924814Smrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 174009924814Smrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 174109924814Smrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 174209924814Smrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 174309924814Smrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 174409924814Smrg | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 174509924814Smrg | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 174609924814Smrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 174709924814Smrg | chorusrdb* | cegcc* | glidix* | serenity* \ 174809924814Smrg | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 174909924814Smrg | midipix* | mingw32* | mingw64* | mint* \ 175009924814Smrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 175109924814Smrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 175209924814Smrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 175309924814Smrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 175409924814Smrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 175509924814Smrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 175609924814Smrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 175709924814Smrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 175809924814Smrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 175909924814Smrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 176009924814Smrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 176109924814Smrg | fiwix* | mlibc* ) 176209924814Smrg ;; 176309924814Smrg # This one is extra strict with allowed versions 176409924814Smrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 176509924814Smrg # Don't forget version if it is 3.2v4 or newer. 176609924814Smrg ;; 176709924814Smrg none) 176809924814Smrg ;; 176909924814Smrg kernel* ) 177009924814Smrg # Restricted further below 177109924814Smrg ;; 177209924814Smrg *) 177309924814Smrg echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 177409924814Smrg exit 1 177509924814Smrg ;; 177609924814Smrgesac 177709924814Smrg 177809924814Smrg# As a final step for OS-related things, validate the OS-kernel combination 177909924814Smrg# (given a valid OS), if there is a kernel. 178009924814Smrgcase $kernel-$os in 178109924814Smrg linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ 178209924814Smrg | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) 178309924814Smrg ;; 178409924814Smrg uclinux-uclibc* ) 178509924814Smrg ;; 178609924814Smrg managarm-mlibc* | managarm-kernel* ) 178709924814Smrg ;; 178809924814Smrg -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) 178909924814Smrg # These are just libc implementations, not actual OSes, and thus 179009924814Smrg # require a kernel. 179109924814Smrg echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 179209924814Smrg exit 1 179309924814Smrg ;; 179409924814Smrg -kernel* ) 179509924814Smrg echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 179609924814Smrg exit 1 179709924814Smrg ;; 179809924814Smrg *-kernel* ) 179909924814Smrg echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 180009924814Smrg exit 1 180109924814Smrg ;; 180209924814Smrg kfreebsd*-gnu* | kopensolaris*-gnu*) 180309924814Smrg ;; 180409924814Smrg vxworks-simlinux | vxworks-simwindows | vxworks-spe) 180509924814Smrg ;; 180609924814Smrg nto-qnx*) 180709924814Smrg ;; 180809924814Smrg os2-emx) 180909924814Smrg ;; 181009924814Smrg *-eabi* | *-gnueabi*) 181109924814Smrg ;; 181209924814Smrg -*) 181309924814Smrg # Blank kernel with real OS is always fine. 181409924814Smrg ;; 181509924814Smrg *-*) 181609924814Smrg echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 181709924814Smrg exit 1 181809924814Smrg ;; 181909924814Smrgesac 182009924814Smrg 1821516e9f99Smrg# Here we handle the case where we know the os, and the CPU type, but not the 1822516e9f99Smrg# manufacturer. We pick the logical manufacturer. 182309924814Smrgcase $vendor in 182409924814Smrg unknown) 182509924814Smrg case $cpu-$os in 182609924814Smrg *-riscix*) 1827516e9f99Smrg vendor=acorn 1828516e9f99Smrg ;; 182909924814Smrg *-sunos*) 1830516e9f99Smrg vendor=sun 1831516e9f99Smrg ;; 183209924814Smrg *-cnk* | *-aix*) 1833516e9f99Smrg vendor=ibm 1834516e9f99Smrg ;; 183509924814Smrg *-beos*) 1836516e9f99Smrg vendor=be 1837516e9f99Smrg ;; 183809924814Smrg *-hpux*) 1839516e9f99Smrg vendor=hp 1840516e9f99Smrg ;; 184109924814Smrg *-mpeix*) 1842516e9f99Smrg vendor=hp 1843516e9f99Smrg ;; 184409924814Smrg *-hiux*) 1845516e9f99Smrg vendor=hitachi 1846516e9f99Smrg ;; 184709924814Smrg *-unos*) 1848516e9f99Smrg vendor=crds 1849516e9f99Smrg ;; 185009924814Smrg *-dgux*) 1851516e9f99Smrg vendor=dg 1852516e9f99Smrg ;; 185309924814Smrg *-luna*) 1854516e9f99Smrg vendor=omron 1855516e9f99Smrg ;; 185609924814Smrg *-genix*) 1857516e9f99Smrg vendor=ns 1858516e9f99Smrg ;; 185909924814Smrg *-clix*) 186009924814Smrg vendor=intergraph 186109924814Smrg ;; 186209924814Smrg *-mvs* | *-opened*) 186309924814Smrg vendor=ibm 186409924814Smrg ;; 186509924814Smrg *-os400*) 1866516e9f99Smrg vendor=ibm 1867516e9f99Smrg ;; 186809924814Smrg s390-* | s390x-*) 1869516e9f99Smrg vendor=ibm 1870516e9f99Smrg ;; 187109924814Smrg *-ptx*) 1872516e9f99Smrg vendor=sequent 1873516e9f99Smrg ;; 187409924814Smrg *-tpf*) 1875516e9f99Smrg vendor=ibm 1876516e9f99Smrg ;; 187709924814Smrg *-vxsim* | *-vxworks* | *-windiss*) 1878516e9f99Smrg vendor=wrs 1879516e9f99Smrg ;; 188009924814Smrg *-aux*) 1881516e9f99Smrg vendor=apple 1882516e9f99Smrg ;; 188309924814Smrg *-hms*) 1884516e9f99Smrg vendor=hitachi 1885516e9f99Smrg ;; 188609924814Smrg *-mpw* | *-macos*) 1887516e9f99Smrg vendor=apple 1888516e9f99Smrg ;; 188909924814Smrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 1890516e9f99Smrg vendor=atari 1891516e9f99Smrg ;; 189209924814Smrg *-vos*) 1893516e9f99Smrg vendor=stratus 1894516e9f99Smrg ;; 1895516e9f99Smrg esac 1896516e9f99Smrg ;; 1897516e9f99Smrgesac 1898516e9f99Smrg 189909924814Smrgecho "$cpu-$vendor-${kernel:+$kernel-}$os" 1900516e9f99Smrgexit 1901516e9f99Smrg 1902516e9f99Smrg# Local variables: 190309924814Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 1904516e9f99Smrg# time-stamp-start: "timestamp='" 1905516e9f99Smrg# time-stamp-format: "%:y-%02m-%02d" 1906516e9f99Smrg# time-stamp-end: "'" 1907516e9f99Smrg# End: 1908