11ab64890Smrg#! /bin/sh 21ab64890Smrg# Configuration validation subroutine script. 33b4ba46cSmrg# Copyright 1992-2024 Free Software Foundation, Inc. 41ab64890Smrg 57d2c738bSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale 67d2c738bSmrg 73b4ba46cSmrgtimestamp='2024-01-01' 81ab64890Smrg 9eb411b4bSmrg# This file is free software; you can redistribute it and/or modify it 10eb411b4bSmrg# under the terms of the GNU General Public License as published by 117d2c738bSmrg# the Free Software Foundation, either version 3 of the License, or 121ab64890Smrg# (at your option) any later version. 131ab64890Smrg# 14eb411b4bSmrg# This program is distributed in the hope that it will be useful, but 15eb411b4bSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 16eb411b4bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17eb411b4bSmrg# General Public License for more details. 181ab64890Smrg# 191ab64890Smrg# You should have received a copy of the GNU General Public License 205afda2e6Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 211ab64890Smrg# 221ab64890Smrg# As a special exception to the GNU General Public License, if you 231ab64890Smrg# distribute this file as part of a program that contains a 241ab64890Smrg# configuration script generated by Autoconf, you may include it under 25eb411b4bSmrg# the same distribution terms that you use for the rest of that 26eb411b4bSmrg# program. This Exception is an additional permission under section 7 27eb411b4bSmrg# of the GNU General Public License, version 3 ("GPLv3"). 281ab64890Smrg 291ab64890Smrg 30862bcd1aSmrg# Please send patches to <config-patches@gnu.org>. 311ab64890Smrg# 321ab64890Smrg# Configuration subroutine to validate and canonicalize a configuration type. 331ab64890Smrg# Supply the specified configuration type as an argument. 341ab64890Smrg# If it is invalid, we print an error message on stderr and exit with code 1. 351ab64890Smrg# Otherwise, we print the canonical config type on stdout and succeed. 361ab64890Smrg 3788de56ccSmrg# You can get the latest version of this script from: 387d2c738bSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 3988de56ccSmrg 401ab64890Smrg# This file is supposed to be the same for all GNU packages 411ab64890Smrg# and recognize all the CPU types, system types and aliases 421ab64890Smrg# that are meaningful with *any* GNU software. 431ab64890Smrg# Each package is responsible for reporting which valid configurations 441ab64890Smrg# it does not support. The user should be able to distinguish 451ab64890Smrg# a failure to support a valid configuration from a meaningless 461ab64890Smrg# configuration. 471ab64890Smrg 481ab64890Smrg# The goal of this file is to map all the various variations of a given 491ab64890Smrg# machine specification into a single specification in the form: 501ab64890Smrg# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 511ab64890Smrg# or in some cases, the newer four-part form: 521ab64890Smrg# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 531ab64890Smrg# It is wrong to echo any other type of specification. 541ab64890Smrg 557d2c738bSmrg# The "shellcheck disable" line above the timestamp inhibits complaints 567d2c738bSmrg# about features and limitations of the classic Bourne shell that were 577d2c738bSmrg# superseded or lifted in POSIX. However, this script identifies a wide 587d2c738bSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 597d2c738bSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still 607d2c738bSmrg# have a pre-POSIX /bin/sh. 617d2c738bSmrg 62e9628295Smrgme=`echo "$0" | sed -e 's,.*/,,'` 631ab64890Smrg 641ab64890Smrgusage="\ 6538ae11fcSmrgUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 661ab64890Smrg 671ab64890SmrgCanonicalize a configuration name. 681ab64890Smrg 695afda2e6SmrgOptions: 701ab64890Smrg -h, --help print this help, then exit 711ab64890Smrg -t, --time-stamp print date of last modification, then exit 721ab64890Smrg -v, --version print version number, then exit 731ab64890Smrg 741ab64890SmrgReport bugs and patches to <config-patches@gnu.org>." 751ab64890Smrg 761ab64890Smrgversion="\ 771ab64890SmrgGNU config.sub ($timestamp) 781ab64890Smrg 793b4ba46cSmrgCopyright 1992-2024 Free Software Foundation, Inc. 801ab64890Smrg 811ab64890SmrgThis is free software; see the source for copying conditions. There is NO 821ab64890Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 831ab64890Smrg 841ab64890Smrghelp=" 853b4ba46cSmrgTry '$me --help' for more information." 861ab64890Smrg 871ab64890Smrg# Parse command line 881ab64890Smrgwhile test $# -gt 0 ; do 891ab64890Smrg case $1 in 901ab64890Smrg --time-stamp | --time* | -t ) 911ab64890Smrg echo "$timestamp" ; exit ;; 921ab64890Smrg --version | -v ) 931ab64890Smrg echo "$version" ; exit ;; 941ab64890Smrg --help | --h* | -h ) 951ab64890Smrg echo "$usage"; exit ;; 961ab64890Smrg -- ) # Stop option processing 971ab64890Smrg shift; break ;; 981ab64890Smrg - ) # Use stdin as input. 991ab64890Smrg break ;; 1001ab64890Smrg -* ) 1017d2c738bSmrg echo "$me: invalid option $1$help" >&2 1021ab64890Smrg exit 1 ;; 1031ab64890Smrg 1041ab64890Smrg *local*) 1051ab64890Smrg # First pass through any local machine types. 1065afda2e6Smrg echo "$1" 1071ab64890Smrg exit ;; 1081ab64890Smrg 1091ab64890Smrg * ) 1101ab64890Smrg break ;; 1111ab64890Smrg esac 1121ab64890Smrgdone 1131ab64890Smrg 1141ab64890Smrgcase $# in 1151ab64890Smrg 0) echo "$me: missing argument$help" >&2 1161ab64890Smrg exit 1;; 1171ab64890Smrg 1) ;; 1181ab64890Smrg *) echo "$me: too many arguments$help" >&2 1191ab64890Smrg exit 1;; 1201ab64890Smrgesac 1211ab64890Smrg 1227d2c738bSmrg# Split fields of configuration type 1237d2c738bSmrg# shellcheck disable=SC2162 1247d2c738bSmrgsaved_IFS=$IFS 1257d2c738bSmrgIFS="-" read field1 field2 field3 field4 <<EOF 1267d2c738bSmrg$1 1277d2c738bSmrgEOF 1287d2c738bSmrgIFS=$saved_IFS 1291ab64890Smrg 1307d2c738bSmrg# Separate into logical components for further validation 1317d2c738bSmrgcase $1 in 1327d2c738bSmrg *-*-*-*-*) 1333b4ba46cSmrg echo "Invalid configuration '$1': more than four components" >&2 1347d2c738bSmrg exit 1 13514db512dSmrg ;; 1367d2c738bSmrg *-*-*-*) 1377d2c738bSmrg basic_machine=$field1-$field2 1387d2c738bSmrg basic_os=$field3-$field4 13914db512dSmrg ;; 1407d2c738bSmrg *-*-*) 1417d2c738bSmrg # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 1427d2c738bSmrg # parts 1437d2c738bSmrg maybe_os=$field2-$field3 1447d2c738bSmrg case $maybe_os in 1457d2c738bSmrg nto-qnx* | linux-* | uclinux-uclibc* \ 1467d2c738bSmrg | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 1477d2c738bSmrg | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 1483b4ba46cSmrg | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ 1493b4ba46cSmrg | windows-* ) 1507d2c738bSmrg basic_machine=$field1 1517d2c738bSmrg basic_os=$maybe_os 1527d2c738bSmrg ;; 1537d2c738bSmrg android-linux) 1547d2c738bSmrg basic_machine=$field1-unknown 1557d2c738bSmrg basic_os=linux-android 1567d2c738bSmrg ;; 1577d2c738bSmrg *) 1587d2c738bSmrg basic_machine=$field1-$field2 1597d2c738bSmrg basic_os=$field3 1607d2c738bSmrg ;; 1617d2c738bSmrg esac 16214db512dSmrg ;; 1637d2c738bSmrg *-*) 1647d2c738bSmrg # A lone config we happen to match not fitting any pattern 1657d2c738bSmrg case $field1-$field2 in 1667d2c738bSmrg decstation-3100) 1677d2c738bSmrg basic_machine=mips-dec 1687d2c738bSmrg basic_os= 1697d2c738bSmrg ;; 1707d2c738bSmrg *-*) 1717d2c738bSmrg # Second component is usually, but not always the OS 1727d2c738bSmrg case $field2 in 1737d2c738bSmrg # Prevent following clause from handling this valid os 1747d2c738bSmrg sun*os*) 1757d2c738bSmrg basic_machine=$field1 1767d2c738bSmrg basic_os=$field2 1777d2c738bSmrg ;; 1787d2c738bSmrg zephyr*) 1797d2c738bSmrg basic_machine=$field1-unknown 1807d2c738bSmrg basic_os=$field2 1817d2c738bSmrg ;; 1827d2c738bSmrg # Manufacturers 1837d2c738bSmrg dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 1847d2c738bSmrg | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 1857d2c738bSmrg | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 1867d2c738bSmrg | convergent* | ncr* | news | 32* | 3600* | 3100* \ 1877d2c738bSmrg | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 1887d2c738bSmrg | ultra | tti* | harris | dolphin | highlevel | gould \ 1897d2c738bSmrg | cbm | ns | masscomp | apple | axis | knuth | cray \ 1907d2c738bSmrg | microblaze* | sim | cisco \ 1917d2c738bSmrg | oki | wec | wrs | winbond) 1927d2c738bSmrg basic_machine=$field1-$field2 1937d2c738bSmrg basic_os= 1947d2c738bSmrg ;; 1957d2c738bSmrg *) 1967d2c738bSmrg basic_machine=$field1 1977d2c738bSmrg basic_os=$field2 1987d2c738bSmrg ;; 1997d2c738bSmrg esac 2007d2c738bSmrg ;; 2017d2c738bSmrg esac 20214db512dSmrg ;; 2037d2c738bSmrg *) 2047d2c738bSmrg # Convert single-component short-hands not valid as part of 2057d2c738bSmrg # multi-component configurations. 2067d2c738bSmrg case $field1 in 2077d2c738bSmrg 386bsd) 2087d2c738bSmrg basic_machine=i386-pc 2097d2c738bSmrg basic_os=bsd 2107d2c738bSmrg ;; 2117d2c738bSmrg a29khif) 2127d2c738bSmrg basic_machine=a29k-amd 2137d2c738bSmrg basic_os=udi 2147d2c738bSmrg ;; 2157d2c738bSmrg adobe68k) 2167d2c738bSmrg basic_machine=m68010-adobe 2177d2c738bSmrg basic_os=scout 2187d2c738bSmrg ;; 2197d2c738bSmrg alliant) 2207d2c738bSmrg basic_machine=fx80-alliant 2217d2c738bSmrg basic_os= 2227d2c738bSmrg ;; 2237d2c738bSmrg altos | altos3068) 2247d2c738bSmrg basic_machine=m68k-altos 2257d2c738bSmrg basic_os= 2267d2c738bSmrg ;; 2277d2c738bSmrg am29k) 2287d2c738bSmrg basic_machine=a29k-none 2297d2c738bSmrg basic_os=bsd 2307d2c738bSmrg ;; 2317d2c738bSmrg amdahl) 2327d2c738bSmrg basic_machine=580-amdahl 2337d2c738bSmrg basic_os=sysv 2347d2c738bSmrg ;; 2357d2c738bSmrg amiga) 2367d2c738bSmrg basic_machine=m68k-unknown 2377d2c738bSmrg basic_os= 2387d2c738bSmrg ;; 2397d2c738bSmrg amigaos | amigados) 2407d2c738bSmrg basic_machine=m68k-unknown 2417d2c738bSmrg basic_os=amigaos 2427d2c738bSmrg ;; 2437d2c738bSmrg amigaunix | amix) 2447d2c738bSmrg basic_machine=m68k-unknown 2457d2c738bSmrg basic_os=sysv4 2467d2c738bSmrg ;; 2477d2c738bSmrg apollo68) 2487d2c738bSmrg basic_machine=m68k-apollo 2497d2c738bSmrg basic_os=sysv 2507d2c738bSmrg ;; 2517d2c738bSmrg apollo68bsd) 2527d2c738bSmrg basic_machine=m68k-apollo 2537d2c738bSmrg basic_os=bsd 2547d2c738bSmrg ;; 2557d2c738bSmrg aros) 2567d2c738bSmrg basic_machine=i386-pc 2577d2c738bSmrg basic_os=aros 2587d2c738bSmrg ;; 2597d2c738bSmrg aux) 2607d2c738bSmrg basic_machine=m68k-apple 2617d2c738bSmrg basic_os=aux 2627d2c738bSmrg ;; 2637d2c738bSmrg balance) 2647d2c738bSmrg basic_machine=ns32k-sequent 2657d2c738bSmrg basic_os=dynix 2667d2c738bSmrg ;; 2677d2c738bSmrg blackfin) 2687d2c738bSmrg basic_machine=bfin-unknown 2697d2c738bSmrg basic_os=linux 2707d2c738bSmrg ;; 2717d2c738bSmrg cegcc) 2727d2c738bSmrg basic_machine=arm-unknown 2737d2c738bSmrg basic_os=cegcc 2747d2c738bSmrg ;; 2757d2c738bSmrg convex-c1) 2767d2c738bSmrg basic_machine=c1-convex 2777d2c738bSmrg basic_os=bsd 2787d2c738bSmrg ;; 2797d2c738bSmrg convex-c2) 2807d2c738bSmrg basic_machine=c2-convex 2817d2c738bSmrg basic_os=bsd 2827d2c738bSmrg ;; 2837d2c738bSmrg convex-c32) 2847d2c738bSmrg basic_machine=c32-convex 2857d2c738bSmrg basic_os=bsd 2867d2c738bSmrg ;; 2877d2c738bSmrg convex-c34) 2887d2c738bSmrg basic_machine=c34-convex 2897d2c738bSmrg basic_os=bsd 2907d2c738bSmrg ;; 2917d2c738bSmrg convex-c38) 2927d2c738bSmrg basic_machine=c38-convex 2937d2c738bSmrg basic_os=bsd 2947d2c738bSmrg ;; 2957d2c738bSmrg cray) 2967d2c738bSmrg basic_machine=j90-cray 2977d2c738bSmrg basic_os=unicos 2987d2c738bSmrg ;; 2997d2c738bSmrg crds | unos) 3007d2c738bSmrg basic_machine=m68k-crds 3017d2c738bSmrg basic_os= 3027d2c738bSmrg ;; 3037d2c738bSmrg da30) 3047d2c738bSmrg basic_machine=m68k-da30 3057d2c738bSmrg basic_os= 3067d2c738bSmrg ;; 3077d2c738bSmrg decstation | pmax | pmin | dec3100 | decstatn) 3087d2c738bSmrg basic_machine=mips-dec 3097d2c738bSmrg basic_os= 3107d2c738bSmrg ;; 3117d2c738bSmrg delta88) 3127d2c738bSmrg basic_machine=m88k-motorola 3137d2c738bSmrg basic_os=sysv3 3147d2c738bSmrg ;; 3157d2c738bSmrg dicos) 3167d2c738bSmrg basic_machine=i686-pc 3177d2c738bSmrg basic_os=dicos 3187d2c738bSmrg ;; 3197d2c738bSmrg djgpp) 3207d2c738bSmrg basic_machine=i586-pc 3217d2c738bSmrg basic_os=msdosdjgpp 3227d2c738bSmrg ;; 3237d2c738bSmrg ebmon29k) 3247d2c738bSmrg basic_machine=a29k-amd 3257d2c738bSmrg basic_os=ebmon 3267d2c738bSmrg ;; 3277d2c738bSmrg es1800 | OSE68k | ose68k | ose | OSE) 3287d2c738bSmrg basic_machine=m68k-ericsson 3297d2c738bSmrg basic_os=ose 3307d2c738bSmrg ;; 3317d2c738bSmrg gmicro) 3327d2c738bSmrg basic_machine=tron-gmicro 3337d2c738bSmrg basic_os=sysv 3347d2c738bSmrg ;; 3357d2c738bSmrg go32) 3367d2c738bSmrg basic_machine=i386-pc 3377d2c738bSmrg basic_os=go32 3387d2c738bSmrg ;; 3397d2c738bSmrg h8300hms) 3407d2c738bSmrg basic_machine=h8300-hitachi 3417d2c738bSmrg basic_os=hms 3427d2c738bSmrg ;; 3437d2c738bSmrg h8300xray) 3447d2c738bSmrg basic_machine=h8300-hitachi 3457d2c738bSmrg basic_os=xray 3467d2c738bSmrg ;; 3477d2c738bSmrg h8500hms) 3487d2c738bSmrg basic_machine=h8500-hitachi 3497d2c738bSmrg basic_os=hms 3507d2c738bSmrg ;; 3517d2c738bSmrg harris) 3527d2c738bSmrg basic_machine=m88k-harris 3537d2c738bSmrg basic_os=sysv3 3547d2c738bSmrg ;; 3557d2c738bSmrg hp300 | hp300hpux) 3567d2c738bSmrg basic_machine=m68k-hp 3577d2c738bSmrg basic_os=hpux 3587d2c738bSmrg ;; 3597d2c738bSmrg hp300bsd) 3607d2c738bSmrg basic_machine=m68k-hp 3617d2c738bSmrg basic_os=bsd 3627d2c738bSmrg ;; 3637d2c738bSmrg hppaosf) 3647d2c738bSmrg basic_machine=hppa1.1-hp 3657d2c738bSmrg basic_os=osf 3667d2c738bSmrg ;; 3677d2c738bSmrg hppro) 3687d2c738bSmrg basic_machine=hppa1.1-hp 3697d2c738bSmrg basic_os=proelf 3707d2c738bSmrg ;; 3717d2c738bSmrg i386mach) 3727d2c738bSmrg basic_machine=i386-mach 3737d2c738bSmrg basic_os=mach 3747d2c738bSmrg ;; 3757d2c738bSmrg isi68 | isi) 3767d2c738bSmrg basic_machine=m68k-isi 3777d2c738bSmrg basic_os=sysv 3787d2c738bSmrg ;; 3797d2c738bSmrg m68knommu) 3807d2c738bSmrg basic_machine=m68k-unknown 3817d2c738bSmrg basic_os=linux 3827d2c738bSmrg ;; 3837d2c738bSmrg magnum | m3230) 3847d2c738bSmrg basic_machine=mips-mips 3857d2c738bSmrg basic_os=sysv 3867d2c738bSmrg ;; 3877d2c738bSmrg merlin) 3887d2c738bSmrg basic_machine=ns32k-utek 3897d2c738bSmrg basic_os=sysv 3907d2c738bSmrg ;; 3917d2c738bSmrg mingw64) 3927d2c738bSmrg basic_machine=x86_64-pc 3937d2c738bSmrg basic_os=mingw64 3947d2c738bSmrg ;; 3957d2c738bSmrg mingw32) 3967d2c738bSmrg basic_machine=i686-pc 3977d2c738bSmrg basic_os=mingw32 3987d2c738bSmrg ;; 3997d2c738bSmrg mingw32ce) 4007d2c738bSmrg basic_machine=arm-unknown 4017d2c738bSmrg basic_os=mingw32ce 4027d2c738bSmrg ;; 4037d2c738bSmrg monitor) 4047d2c738bSmrg basic_machine=m68k-rom68k 4057d2c738bSmrg basic_os=coff 4067d2c738bSmrg ;; 4077d2c738bSmrg morphos) 4087d2c738bSmrg basic_machine=powerpc-unknown 4097d2c738bSmrg basic_os=morphos 4107d2c738bSmrg ;; 4117d2c738bSmrg moxiebox) 4127d2c738bSmrg basic_machine=moxie-unknown 4137d2c738bSmrg basic_os=moxiebox 4147d2c738bSmrg ;; 4157d2c738bSmrg msdos) 4167d2c738bSmrg basic_machine=i386-pc 4177d2c738bSmrg basic_os=msdos 4187d2c738bSmrg ;; 4197d2c738bSmrg msys) 4207d2c738bSmrg basic_machine=i686-pc 4217d2c738bSmrg basic_os=msys 4227d2c738bSmrg ;; 4237d2c738bSmrg mvs) 4247d2c738bSmrg basic_machine=i370-ibm 4257d2c738bSmrg basic_os=mvs 4267d2c738bSmrg ;; 4277d2c738bSmrg nacl) 4287d2c738bSmrg basic_machine=le32-unknown 4297d2c738bSmrg basic_os=nacl 4307d2c738bSmrg ;; 4317d2c738bSmrg ncr3000) 4327d2c738bSmrg basic_machine=i486-ncr 4337d2c738bSmrg basic_os=sysv4 4347d2c738bSmrg ;; 4357d2c738bSmrg netbsd386) 4367d2c738bSmrg basic_machine=i386-pc 4377d2c738bSmrg basic_os=netbsd 4387d2c738bSmrg ;; 4397d2c738bSmrg netwinder) 4407d2c738bSmrg basic_machine=armv4l-rebel 4417d2c738bSmrg basic_os=linux 4427d2c738bSmrg ;; 4437d2c738bSmrg news | news700 | news800 | news900) 4447d2c738bSmrg basic_machine=m68k-sony 4457d2c738bSmrg basic_os=newsos 4467d2c738bSmrg ;; 4477d2c738bSmrg news1000) 4487d2c738bSmrg basic_machine=m68030-sony 4497d2c738bSmrg basic_os=newsos 4507d2c738bSmrg ;; 4517d2c738bSmrg necv70) 4527d2c738bSmrg basic_machine=v70-nec 4537d2c738bSmrg basic_os=sysv 4547d2c738bSmrg ;; 4557d2c738bSmrg nh3000) 4567d2c738bSmrg basic_machine=m68k-harris 4577d2c738bSmrg basic_os=cxux 4587d2c738bSmrg ;; 4597d2c738bSmrg nh[45]000) 4607d2c738bSmrg basic_machine=m88k-harris 4617d2c738bSmrg basic_os=cxux 4627d2c738bSmrg ;; 4637d2c738bSmrg nindy960) 4647d2c738bSmrg basic_machine=i960-intel 4657d2c738bSmrg basic_os=nindy 4667d2c738bSmrg ;; 4677d2c738bSmrg mon960) 4687d2c738bSmrg basic_machine=i960-intel 4697d2c738bSmrg basic_os=mon960 4707d2c738bSmrg ;; 4717d2c738bSmrg nonstopux) 4727d2c738bSmrg basic_machine=mips-compaq 4737d2c738bSmrg basic_os=nonstopux 4747d2c738bSmrg ;; 4757d2c738bSmrg os400) 4767d2c738bSmrg basic_machine=powerpc-ibm 4777d2c738bSmrg basic_os=os400 4787d2c738bSmrg ;; 4797d2c738bSmrg OSE68000 | ose68000) 4807d2c738bSmrg basic_machine=m68000-ericsson 4817d2c738bSmrg basic_os=ose 4827d2c738bSmrg ;; 4837d2c738bSmrg os68k) 4847d2c738bSmrg basic_machine=m68k-none 4857d2c738bSmrg basic_os=os68k 4867d2c738bSmrg ;; 4877d2c738bSmrg paragon) 4887d2c738bSmrg basic_machine=i860-intel 4897d2c738bSmrg basic_os=osf 4907d2c738bSmrg ;; 4917d2c738bSmrg parisc) 4927d2c738bSmrg basic_machine=hppa-unknown 4937d2c738bSmrg basic_os=linux 4947d2c738bSmrg ;; 4957d2c738bSmrg psp) 4967d2c738bSmrg basic_machine=mipsallegrexel-sony 4977d2c738bSmrg basic_os=psp 4987d2c738bSmrg ;; 4997d2c738bSmrg pw32) 5007d2c738bSmrg basic_machine=i586-unknown 5017d2c738bSmrg basic_os=pw32 5027d2c738bSmrg ;; 5037d2c738bSmrg rdos | rdos64) 5047d2c738bSmrg basic_machine=x86_64-pc 5057d2c738bSmrg basic_os=rdos 5067d2c738bSmrg ;; 5077d2c738bSmrg rdos32) 5087d2c738bSmrg basic_machine=i386-pc 5097d2c738bSmrg basic_os=rdos 5107d2c738bSmrg ;; 5117d2c738bSmrg rom68k) 5127d2c738bSmrg basic_machine=m68k-rom68k 5137d2c738bSmrg basic_os=coff 5147d2c738bSmrg ;; 5157d2c738bSmrg sa29200) 5167d2c738bSmrg basic_machine=a29k-amd 5177d2c738bSmrg basic_os=udi 5187d2c738bSmrg ;; 5197d2c738bSmrg sei) 5207d2c738bSmrg basic_machine=mips-sei 5217d2c738bSmrg basic_os=seiux 5227d2c738bSmrg ;; 5237d2c738bSmrg sequent) 5247d2c738bSmrg basic_machine=i386-sequent 5257d2c738bSmrg basic_os= 5267d2c738bSmrg ;; 5277d2c738bSmrg sps7) 5287d2c738bSmrg basic_machine=m68k-bull 5297d2c738bSmrg basic_os=sysv2 5307d2c738bSmrg ;; 5317d2c738bSmrg st2000) 5327d2c738bSmrg basic_machine=m68k-tandem 5337d2c738bSmrg basic_os= 5347d2c738bSmrg ;; 5357d2c738bSmrg stratus) 5367d2c738bSmrg basic_machine=i860-stratus 5377d2c738bSmrg basic_os=sysv4 5387d2c738bSmrg ;; 5397d2c738bSmrg sun2) 5407d2c738bSmrg basic_machine=m68000-sun 5417d2c738bSmrg basic_os= 5427d2c738bSmrg ;; 5437d2c738bSmrg sun2os3) 5447d2c738bSmrg basic_machine=m68000-sun 5457d2c738bSmrg basic_os=sunos3 5467d2c738bSmrg ;; 5477d2c738bSmrg sun2os4) 5487d2c738bSmrg basic_machine=m68000-sun 5497d2c738bSmrg basic_os=sunos4 5507d2c738bSmrg ;; 5517d2c738bSmrg sun3) 5527d2c738bSmrg basic_machine=m68k-sun 5537d2c738bSmrg basic_os= 5547d2c738bSmrg ;; 5557d2c738bSmrg sun3os3) 5567d2c738bSmrg basic_machine=m68k-sun 5577d2c738bSmrg basic_os=sunos3 5587d2c738bSmrg ;; 5597d2c738bSmrg sun3os4) 5607d2c738bSmrg basic_machine=m68k-sun 5617d2c738bSmrg basic_os=sunos4 5627d2c738bSmrg ;; 5637d2c738bSmrg sun4) 5647d2c738bSmrg basic_machine=sparc-sun 5657d2c738bSmrg basic_os= 5667d2c738bSmrg ;; 5677d2c738bSmrg sun4os3) 5687d2c738bSmrg basic_machine=sparc-sun 5697d2c738bSmrg basic_os=sunos3 5707d2c738bSmrg ;; 5717d2c738bSmrg sun4os4) 5727d2c738bSmrg basic_machine=sparc-sun 5737d2c738bSmrg basic_os=sunos4 5747d2c738bSmrg ;; 5757d2c738bSmrg sun4sol2) 5767d2c738bSmrg basic_machine=sparc-sun 5777d2c738bSmrg basic_os=solaris2 5787d2c738bSmrg ;; 5797d2c738bSmrg sun386 | sun386i | roadrunner) 5807d2c738bSmrg basic_machine=i386-sun 5817d2c738bSmrg basic_os= 5827d2c738bSmrg ;; 5837d2c738bSmrg sv1) 5847d2c738bSmrg basic_machine=sv1-cray 5857d2c738bSmrg basic_os=unicos 5867d2c738bSmrg ;; 5877d2c738bSmrg symmetry) 5887d2c738bSmrg basic_machine=i386-sequent 5897d2c738bSmrg basic_os=dynix 5907d2c738bSmrg ;; 5917d2c738bSmrg t3e) 5927d2c738bSmrg basic_machine=alphaev5-cray 5937d2c738bSmrg basic_os=unicos 5947d2c738bSmrg ;; 5957d2c738bSmrg t90) 5967d2c738bSmrg basic_machine=t90-cray 5977d2c738bSmrg basic_os=unicos 5987d2c738bSmrg ;; 5997d2c738bSmrg toad1) 6007d2c738bSmrg basic_machine=pdp10-xkl 6017d2c738bSmrg basic_os=tops20 6027d2c738bSmrg ;; 6037d2c738bSmrg tpf) 6047d2c738bSmrg basic_machine=s390x-ibm 6057d2c738bSmrg basic_os=tpf 6067d2c738bSmrg ;; 6077d2c738bSmrg udi29k) 6087d2c738bSmrg basic_machine=a29k-amd 6097d2c738bSmrg basic_os=udi 6107d2c738bSmrg ;; 6117d2c738bSmrg ultra3) 6127d2c738bSmrg basic_machine=a29k-nyu 6137d2c738bSmrg basic_os=sym1 6147d2c738bSmrg ;; 6157d2c738bSmrg v810 | necv810) 6167d2c738bSmrg basic_machine=v810-nec 6177d2c738bSmrg basic_os=none 6187d2c738bSmrg ;; 6197d2c738bSmrg vaxv) 6207d2c738bSmrg basic_machine=vax-dec 6217d2c738bSmrg basic_os=sysv 6227d2c738bSmrg ;; 6237d2c738bSmrg vms) 6247d2c738bSmrg basic_machine=vax-dec 6257d2c738bSmrg basic_os=vms 6267d2c738bSmrg ;; 6277d2c738bSmrg vsta) 6287d2c738bSmrg basic_machine=i386-pc 6297d2c738bSmrg basic_os=vsta 6307d2c738bSmrg ;; 6317d2c738bSmrg vxworks960) 6327d2c738bSmrg basic_machine=i960-wrs 6337d2c738bSmrg basic_os=vxworks 6347d2c738bSmrg ;; 6357d2c738bSmrg vxworks68) 6367d2c738bSmrg basic_machine=m68k-wrs 6377d2c738bSmrg basic_os=vxworks 6387d2c738bSmrg ;; 6397d2c738bSmrg vxworks29k) 6407d2c738bSmrg basic_machine=a29k-wrs 6417d2c738bSmrg basic_os=vxworks 6427d2c738bSmrg ;; 6437d2c738bSmrg xbox) 6447d2c738bSmrg basic_machine=i686-pc 6457d2c738bSmrg basic_os=mingw32 6467d2c738bSmrg ;; 6477d2c738bSmrg ymp) 6487d2c738bSmrg basic_machine=ymp-cray 6497d2c738bSmrg basic_os=unicos 6507d2c738bSmrg ;; 6517d2c738bSmrg *) 6527d2c738bSmrg basic_machine=$1 6537d2c738bSmrg basic_os= 6547d2c738bSmrg ;; 6557d2c738bSmrg esac 6561ab64890Smrg ;; 6571ab64890Smrgesac 6581ab64890Smrg 6597d2c738bSmrg# Decode 1-component or ad-hoc basic machines 6601ab64890Smrgcase $basic_machine in 6617d2c738bSmrg # Here we handle the default manufacturer of certain CPU types. It is in 6627d2c738bSmrg # some cases the only manufacturer, in others, it is the most popular. 6637d2c738bSmrg w89k) 6647d2c738bSmrg cpu=hppa1.1 6657d2c738bSmrg vendor=winbond 666eb411b4bSmrg ;; 6677d2c738bSmrg op50n) 6687d2c738bSmrg cpu=hppa1.1 6697d2c738bSmrg vendor=oki 670eb411b4bSmrg ;; 6717d2c738bSmrg op60c) 6727d2c738bSmrg cpu=hppa1.1 6737d2c738bSmrg vendor=oki 6749c019ec5Smaya ;; 6757d2c738bSmrg ibm*) 6767d2c738bSmrg cpu=i370 6777d2c738bSmrg vendor=ibm 6789c019ec5Smaya ;; 6797d2c738bSmrg orion105) 6807d2c738bSmrg cpu=clipper 6817d2c738bSmrg vendor=highlevel 68214db512dSmrg ;; 6837d2c738bSmrg mac | mpw | mac-mpw) 6847d2c738bSmrg cpu=m68k 6857d2c738bSmrg vendor=apple 686eb411b4bSmrg ;; 6877d2c738bSmrg pmac | pmac-mpw) 6887d2c738bSmrg cpu=powerpc 6897d2c738bSmrg vendor=apple 69014db512dSmrg ;; 69114db512dSmrg 6921ab64890Smrg # Recognize the various machine names and aliases which stand 6931ab64890Smrg # for a CPU type and a company and sometimes even an OS. 6941ab64890Smrg 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 6957d2c738bSmrg cpu=m68000 6967d2c738bSmrg vendor=att 6971ab64890Smrg ;; 6981ab64890Smrg 3b*) 6997d2c738bSmrg cpu=we32k 7007d2c738bSmrg vendor=att 70161b2299dSmrg ;; 70288de56ccSmrg bluegene*) 7037d2c738bSmrg cpu=powerpc 7047d2c738bSmrg vendor=ibm 7057d2c738bSmrg basic_os=cnk 7061ab64890Smrg ;; 7071ab64890Smrg decsystem10* | dec10*) 7087d2c738bSmrg cpu=pdp10 7097d2c738bSmrg vendor=dec 7107d2c738bSmrg basic_os=tops10 7111ab64890Smrg ;; 7121ab64890Smrg decsystem20* | dec20*) 7137d2c738bSmrg cpu=pdp10 7147d2c738bSmrg vendor=dec 7157d2c738bSmrg basic_os=tops20 7161ab64890Smrg ;; 7171ab64890Smrg delta | 3300 | motorola-3300 | motorola-delta \ 7181ab64890Smrg | 3300-motorola | delta-motorola) 7197d2c738bSmrg cpu=m68k 7207d2c738bSmrg vendor=motorola 72188de56ccSmrg ;; 7225afda2e6Smrg dpx2*) 7237d2c738bSmrg cpu=m68k 7247d2c738bSmrg vendor=bull 7257d2c738bSmrg basic_os=sysv3 72614db512dSmrg ;; 72714db512dSmrg encore | umax | mmax) 7287d2c738bSmrg cpu=ns32k 7297d2c738bSmrg vendor=encore 73014db512dSmrg ;; 7317d2c738bSmrg elxsi) 7327d2c738bSmrg cpu=elxsi 7337d2c738bSmrg vendor=elxsi 7347d2c738bSmrg basic_os=${basic_os:-bsd} 7351ab64890Smrg ;; 7361ab64890Smrg fx2800) 7377d2c738bSmrg cpu=i860 7387d2c738bSmrg vendor=alliant 7391ab64890Smrg ;; 7401ab64890Smrg genix) 7417d2c738bSmrg cpu=ns32k 7427d2c738bSmrg vendor=ns 7431ab64890Smrg ;; 7441ab64890Smrg h3050r* | hiux*) 7457d2c738bSmrg cpu=hppa1.1 7467d2c738bSmrg vendor=hitachi 7477d2c738bSmrg basic_os=hiuxwe2 7481ab64890Smrg ;; 7491ab64890Smrg hp3k9[0-9][0-9] | hp9[0-9][0-9]) 7507d2c738bSmrg cpu=hppa1.0 7517d2c738bSmrg vendor=hp 7521ab64890Smrg ;; 7531ab64890Smrg hp9k2[0-9][0-9] | hp9k31[0-9]) 7547d2c738bSmrg cpu=m68000 7557d2c738bSmrg vendor=hp 7561ab64890Smrg ;; 7571ab64890Smrg hp9k3[2-9][0-9]) 7587d2c738bSmrg cpu=m68k 7597d2c738bSmrg vendor=hp 7601ab64890Smrg ;; 7611ab64890Smrg hp9k6[0-9][0-9] | hp6[0-9][0-9]) 7627d2c738bSmrg cpu=hppa1.0 7637d2c738bSmrg vendor=hp 7641ab64890Smrg ;; 7651ab64890Smrg hp9k7[0-79][0-9] | hp7[0-79][0-9]) 7667d2c738bSmrg cpu=hppa1.1 7677d2c738bSmrg vendor=hp 7681ab64890Smrg ;; 7691ab64890Smrg hp9k78[0-9] | hp78[0-9]) 7701ab64890Smrg # FIXME: really hppa2.0-hp 7717d2c738bSmrg cpu=hppa1.1 7727d2c738bSmrg vendor=hp 7731ab64890Smrg ;; 7741ab64890Smrg hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 7751ab64890Smrg # FIXME: really hppa2.0-hp 7767d2c738bSmrg cpu=hppa1.1 7777d2c738bSmrg vendor=hp 7781ab64890Smrg ;; 7791ab64890Smrg hp9k8[0-9][13679] | hp8[0-9][13679]) 7807d2c738bSmrg cpu=hppa1.1 7817d2c738bSmrg vendor=hp 7821ab64890Smrg ;; 7831ab64890Smrg hp9k8[0-9][0-9] | hp8[0-9][0-9]) 7847d2c738bSmrg cpu=hppa1.0 7857d2c738bSmrg vendor=hp 7861ab64890Smrg ;; 7871ab64890Smrg i*86v32) 7887d2c738bSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 7897d2c738bSmrg vendor=pc 7907d2c738bSmrg basic_os=sysv32 7911ab64890Smrg ;; 7921ab64890Smrg i*86v4*) 7937d2c738bSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 7947d2c738bSmrg vendor=pc 7957d2c738bSmrg basic_os=sysv4 7961ab64890Smrg ;; 7971ab64890Smrg i*86v) 7987d2c738bSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 7997d2c738bSmrg vendor=pc 8007d2c738bSmrg basic_os=sysv 8011ab64890Smrg ;; 8021ab64890Smrg i*86sol2) 8037d2c738bSmrg cpu=`echo "$1" | sed -e 's/86.*/86/'` 8047d2c738bSmrg vendor=pc 8057d2c738bSmrg basic_os=solaris2 80614db512dSmrg ;; 8077d2c738bSmrg j90 | j90-cray) 8087d2c738bSmrg cpu=j90 8097d2c738bSmrg vendor=cray 8107d2c738bSmrg basic_os=${basic_os:-unicos} 8111ab64890Smrg ;; 8121ab64890Smrg iris | iris4d) 8137d2c738bSmrg cpu=mips 8147d2c738bSmrg vendor=sgi 8157d2c738bSmrg case $basic_os in 8167d2c738bSmrg irix*) 8171ab64890Smrg ;; 8181ab64890Smrg *) 8197d2c738bSmrg basic_os=irix4 8201ab64890Smrg ;; 8211ab64890Smrg esac 8221ab64890Smrg ;; 8231ab64890Smrg miniframe) 8247d2c738bSmrg cpu=m68000 8257d2c738bSmrg vendor=convergent 82614db512dSmrg ;; 8277d2c738bSmrg *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 8287d2c738bSmrg cpu=m68k 8297d2c738bSmrg vendor=atari 8307d2c738bSmrg basic_os=mint 8311ab64890Smrg ;; 8321ab64890Smrg news-3600 | risc-news) 8337d2c738bSmrg cpu=mips 8347d2c738bSmrg vendor=sony 8357d2c738bSmrg basic_os=newsos 8361ab64890Smrg ;; 8375afda2e6Smrg next | m*-next) 8387d2c738bSmrg cpu=m68k 8397d2c738bSmrg vendor=next 8407d2c738bSmrg case $basic_os in 8417d2c738bSmrg openstep*) 8427d2c738bSmrg ;; 8437d2c738bSmrg nextstep*) 8441ab64890Smrg ;; 8457d2c738bSmrg ns2*) 8467d2c738bSmrg basic_os=nextstep2 8471ab64890Smrg ;; 8481ab64890Smrg *) 8497d2c738bSmrg basic_os=nextstep3 8501ab64890Smrg ;; 8511ab64890Smrg esac 8521ab64890Smrg ;; 8531ab64890Smrg np1) 8547d2c738bSmrg cpu=np1 8557d2c738bSmrg vendor=gould 8561ab64890Smrg ;; 8571ab64890Smrg op50n-* | op60c-*) 8587d2c738bSmrg cpu=hppa1.1 8597d2c738bSmrg vendor=oki 8607d2c738bSmrg basic_os=proelf 8611ab64890Smrg ;; 8621ab64890Smrg pa-hitachi) 8637d2c738bSmrg cpu=hppa1.1 8647d2c738bSmrg vendor=hitachi 8657d2c738bSmrg basic_os=hiuxwe2 86661b2299dSmrg ;; 8671ab64890Smrg pbd) 8687d2c738bSmrg cpu=sparc 8697d2c738bSmrg vendor=tti 8701ab64890Smrg ;; 8711ab64890Smrg pbb) 8727d2c738bSmrg cpu=m68k 8737d2c738bSmrg vendor=tti 87414db512dSmrg ;; 8757d2c738bSmrg pc532) 8767d2c738bSmrg cpu=ns32k 8777d2c738bSmrg vendor=pc532 8781ab64890Smrg ;; 8791ab64890Smrg pn) 8807d2c738bSmrg cpu=pn 8817d2c738bSmrg vendor=gould 8821ab64890Smrg ;; 8837d2c738bSmrg power) 8847d2c738bSmrg cpu=power 8857d2c738bSmrg vendor=ibm 8861ab64890Smrg ;; 8877d2c738bSmrg ps2) 8887d2c738bSmrg cpu=i386 8897d2c738bSmrg vendor=ibm 8901ab64890Smrg ;; 8917d2c738bSmrg rm[46]00) 8927d2c738bSmrg cpu=mips 8937d2c738bSmrg vendor=siemens 8941ab64890Smrg ;; 8957d2c738bSmrg rtpc | rtpc-*) 8967d2c738bSmrg cpu=romp 8977d2c738bSmrg vendor=ibm 8981ab64890Smrg ;; 8997d2c738bSmrg sde) 9007d2c738bSmrg cpu=mipsisa32 9017d2c738bSmrg vendor=sde 9027d2c738bSmrg basic_os=${basic_os:-elf} 9031ab64890Smrg ;; 9047d2c738bSmrg simso-wrs) 9057d2c738bSmrg cpu=sparclite 9067d2c738bSmrg vendor=wrs 9077d2c738bSmrg basic_os=vxworks 9081ab64890Smrg ;; 9097d2c738bSmrg tower | tower-32) 9107d2c738bSmrg cpu=m68k 9117d2c738bSmrg vendor=ncr 9121ab64890Smrg ;; 9137d2c738bSmrg vpp*|vx|vx-*) 9147d2c738bSmrg cpu=f301 9157d2c738bSmrg vendor=fujitsu 9161ab64890Smrg ;; 9177d2c738bSmrg w65) 9187d2c738bSmrg cpu=w65 9197d2c738bSmrg vendor=wdc 9201ab64890Smrg ;; 9217d2c738bSmrg w89k-*) 9227d2c738bSmrg cpu=hppa1.1 9237d2c738bSmrg vendor=winbond 9247d2c738bSmrg basic_os=proelf 9251ab64890Smrg ;; 9267d2c738bSmrg none) 9277d2c738bSmrg cpu=none 9287d2c738bSmrg vendor=none 9291ab64890Smrg ;; 9307d2c738bSmrg leon|leon[3-9]) 9317d2c738bSmrg cpu=sparc 9327d2c738bSmrg vendor=$basic_machine 933eb411b4bSmrg ;; 9347d2c738bSmrg leon-*|leon[3-9]-*) 9357d2c738bSmrg cpu=sparc 9367d2c738bSmrg vendor=`echo "$basic_machine" | sed 's/-.*//'` 9371ab64890Smrg ;; 9387d2c738bSmrg 9397d2c738bSmrg *-*) 9407d2c738bSmrg # shellcheck disable=SC2162 9417d2c738bSmrg saved_IFS=$IFS 9427d2c738bSmrg IFS="-" read cpu vendor <<EOF 9437d2c738bSmrg$basic_machine 9447d2c738bSmrgEOF 9457d2c738bSmrg IFS=$saved_IFS 9461ab64890Smrg ;; 9473b4ba46cSmrg # We use 'pc' rather than 'unknown' 9487d2c738bSmrg # because (1) that's what they normally are, and 9497d2c738bSmrg # (2) the word "unknown" tends to confuse beginning users. 9507d2c738bSmrg i*86 | x86_64) 9517d2c738bSmrg cpu=$basic_machine 9527d2c738bSmrg vendor=pc 9531ab64890Smrg ;; 9547d2c738bSmrg # These rules are duplicated from below for sake of the special case above; 9557d2c738bSmrg # i.e. things that normalized to x86 arches should also default to "pc" 9567d2c738bSmrg pc98) 9577d2c738bSmrg cpu=i386 9587d2c738bSmrg vendor=pc 9591ab64890Smrg ;; 9607d2c738bSmrg x64 | amd64) 9617d2c738bSmrg cpu=x86_64 9627d2c738bSmrg vendor=pc 9631ab64890Smrg ;; 9647d2c738bSmrg # Recognize the basic CPU types without company name. 9657d2c738bSmrg *) 9667d2c738bSmrg cpu=$basic_machine 9677d2c738bSmrg vendor=unknown 9681ab64890Smrg ;; 9697d2c738bSmrgesac 9707d2c738bSmrg 9717d2c738bSmrgunset -v basic_machine 9727d2c738bSmrg 9737d2c738bSmrg# Decode basic machines in the full and proper CPU-Company form. 9747d2c738bSmrgcase $cpu-$vendor in 9757d2c738bSmrg # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 9767d2c738bSmrg # some cases the only manufacturer, in others, it is the most popular. 9777d2c738bSmrg craynv-unknown) 9787d2c738bSmrg vendor=cray 9797d2c738bSmrg basic_os=${basic_os:-unicosmp} 9801ab64890Smrg ;; 9817d2c738bSmrg c90-unknown | c90-cray) 9827d2c738bSmrg vendor=cray 9837d2c738bSmrg basic_os=${Basic_os:-unicos} 9841ab64890Smrg ;; 9857d2c738bSmrg fx80-unknown) 9867d2c738bSmrg vendor=alliant 9871ab64890Smrg ;; 9887d2c738bSmrg romp-unknown) 9897d2c738bSmrg vendor=ibm 9901ab64890Smrg ;; 9917d2c738bSmrg mmix-unknown) 9927d2c738bSmrg vendor=knuth 9931ab64890Smrg ;; 9947d2c738bSmrg microblaze-unknown | microblazeel-unknown) 9957d2c738bSmrg vendor=xilinx 9961ab64890Smrg ;; 9977d2c738bSmrg rs6000-unknown) 9987d2c738bSmrg vendor=ibm 9991ab64890Smrg ;; 10007d2c738bSmrg vax-unknown) 10017d2c738bSmrg vendor=dec 10021ab64890Smrg ;; 10037d2c738bSmrg pdp11-unknown) 10047d2c738bSmrg vendor=dec 10051ab64890Smrg ;; 10067d2c738bSmrg we32k-unknown) 10077d2c738bSmrg vendor=att 100861b2299dSmrg ;; 10097d2c738bSmrg cydra-unknown) 10107d2c738bSmrg vendor=cydrome 10111ab64890Smrg ;; 10127d2c738bSmrg i370-ibm*) 10137d2c738bSmrg vendor=ibm 10141ab64890Smrg ;; 10157d2c738bSmrg orion-unknown) 10167d2c738bSmrg vendor=highlevel 10171ab64890Smrg ;; 10187d2c738bSmrg xps-unknown | xps100-unknown) 10197d2c738bSmrg cpu=xps100 10207d2c738bSmrg vendor=honeywell 10211ab64890Smrg ;; 10227d2c738bSmrg 10237d2c738bSmrg # Here we normalize CPU types with a missing or matching vendor 10247d2c738bSmrg armh-unknown | armh-alt) 10257d2c738bSmrg cpu=armv7l 10267d2c738bSmrg vendor=alt 10277d2c738bSmrg basic_os=${basic_os:-linux-gnueabihf} 10281ab64890Smrg ;; 10297d2c738bSmrg dpx20-unknown | dpx20-bull) 10307d2c738bSmrg cpu=rs6000 10317d2c738bSmrg vendor=bull 10327d2c738bSmrg basic_os=${basic_os:-bosx} 10331ab64890Smrg ;; 10347d2c738bSmrg 10357d2c738bSmrg # Here we normalize CPU types irrespective of the vendor 10367d2c738bSmrg amd64-*) 10377d2c738bSmrg cpu=x86_64 10381ab64890Smrg ;; 10397d2c738bSmrg blackfin-*) 10407d2c738bSmrg cpu=bfin 10417d2c738bSmrg basic_os=linux 10421ab64890Smrg ;; 10437d2c738bSmrg c54x-*) 10447d2c738bSmrg cpu=tic54x 10451ab64890Smrg ;; 10467d2c738bSmrg c55x-*) 10477d2c738bSmrg cpu=tic55x 10481ab64890Smrg ;; 10497d2c738bSmrg c6x-*) 10507d2c738bSmrg cpu=tic6x 10511ab64890Smrg ;; 10527d2c738bSmrg e500v[12]-*) 10537d2c738bSmrg cpu=powerpc 10547d2c738bSmrg basic_os=${basic_os}"spe" 10551ab64890Smrg ;; 10567d2c738bSmrg mips3*-*) 10577d2c738bSmrg cpu=mips64 10581ab64890Smrg ;; 10597d2c738bSmrg ms1-*) 10607d2c738bSmrg cpu=mt 10611ab64890Smrg ;; 10627d2c738bSmrg m68knommu-*) 10637d2c738bSmrg cpu=m68k 10647d2c738bSmrg basic_os=linux 10651ab64890Smrg ;; 10667d2c738bSmrg m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 10677d2c738bSmrg cpu=s12z 10681ab64890Smrg ;; 10697d2c738bSmrg openrisc-*) 10707d2c738bSmrg cpu=or32 10711ab64890Smrg ;; 10727d2c738bSmrg parisc-*) 10737d2c738bSmrg cpu=hppa 10747d2c738bSmrg basic_os=linux 10751ab64890Smrg ;; 10767d2c738bSmrg pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 10777d2c738bSmrg cpu=i586 1078eb411b4bSmrg ;; 10797d2c738bSmrg pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) 10807d2c738bSmrg cpu=i686 10811ab64890Smrg ;; 10827d2c738bSmrg pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 10837d2c738bSmrg cpu=i686 10841ab64890Smrg ;; 10857d2c738bSmrg pentium4-*) 10867d2c738bSmrg cpu=i786 108788de56ccSmrg ;; 10887d2c738bSmrg pc98-*) 10897d2c738bSmrg cpu=i386 10901ab64890Smrg ;; 10917d2c738bSmrg ppc-* | ppcbe-*) 10927d2c738bSmrg cpu=powerpc 10931ab64890Smrg ;; 10947d2c738bSmrg ppcle-* | powerpclittle-*) 10957d2c738bSmrg cpu=powerpcle 10969c019ec5Smaya ;; 10977d2c738bSmrg ppc64-*) 10987d2c738bSmrg cpu=powerpc64 10991ab64890Smrg ;; 11007d2c738bSmrg ppc64le-* | powerpc64little-*) 11017d2c738bSmrg cpu=powerpc64le 11021ab64890Smrg ;; 11037d2c738bSmrg sb1-*) 11047d2c738bSmrg cpu=mipsisa64sb1 11051ab64890Smrg ;; 11067d2c738bSmrg sb1el-*) 11077d2c738bSmrg cpu=mipsisa64sb1el 11089c019ec5Smaya ;; 11097d2c738bSmrg sh5e[lb]-*) 11107d2c738bSmrg cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 11119c019ec5Smaya ;; 11127d2c738bSmrg spur-*) 11137d2c738bSmrg cpu=spur 111414db512dSmrg ;; 11157d2c738bSmrg strongarm-* | thumb-*) 11167d2c738bSmrg cpu=arm 111714db512dSmrg ;; 11187d2c738bSmrg tx39-*) 11197d2c738bSmrg cpu=mipstx39 112014db512dSmrg ;; 11217d2c738bSmrg tx39el-*) 11227d2c738bSmrg cpu=mipstx39el 112314db512dSmrg ;; 11247d2c738bSmrg x64-*) 11257d2c738bSmrg cpu=x86_64 11261ab64890Smrg ;; 11275afda2e6Smrg xscale-* | xscalee[bl]-*) 11287d2c738bSmrg cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 11299c019ec5Smaya ;; 11307d2c738bSmrg arm64-* | aarch64le-*) 11317d2c738bSmrg cpu=aarch64 11321ab64890Smrg ;; 11335afda2e6Smrg 11347d2c738bSmrg # Recognize the canonical CPU Types that limit and/or modify the 11357d2c738bSmrg # company names they are paired with. 11367d2c738bSmrg cr16-*) 11377d2c738bSmrg basic_os=${basic_os:-elf} 11381ab64890Smrg ;; 11397d2c738bSmrg crisv32-* | etraxfs*-*) 11407d2c738bSmrg cpu=crisv32 11417d2c738bSmrg vendor=axis 11421ab64890Smrg ;; 11437d2c738bSmrg cris-* | etrax*-*) 11447d2c738bSmrg cpu=cris 11457d2c738bSmrg vendor=axis 11469c019ec5Smaya ;; 11477d2c738bSmrg crx-*) 11487d2c738bSmrg basic_os=${basic_os:-elf} 11499c019ec5Smaya ;; 11507d2c738bSmrg neo-tandem) 11517d2c738bSmrg cpu=neo 11527d2c738bSmrg vendor=tandem 11539c019ec5Smaya ;; 11547d2c738bSmrg nse-tandem) 11557d2c738bSmrg cpu=nse 11567d2c738bSmrg vendor=tandem 115714db512dSmrg ;; 11587d2c738bSmrg nsr-tandem) 11597d2c738bSmrg cpu=nsr 11607d2c738bSmrg vendor=tandem 116114db512dSmrg ;; 11627d2c738bSmrg nsv-tandem) 11637d2c738bSmrg cpu=nsv 11647d2c738bSmrg vendor=tandem 116514db512dSmrg ;; 11667d2c738bSmrg nsx-tandem) 11677d2c738bSmrg cpu=nsx 11687d2c738bSmrg vendor=tandem 116914db512dSmrg ;; 11707d2c738bSmrg mipsallegrexel-sony) 11717d2c738bSmrg cpu=mipsallegrexel 11727d2c738bSmrg vendor=sony 117314db512dSmrg ;; 11747d2c738bSmrg tile*-*) 11757d2c738bSmrg basic_os=${basic_os:-linux-gnu} 11761ab64890Smrg ;; 11777d2c738bSmrg 11781ab64890Smrg *) 11797d2c738bSmrg # Recognize the canonical CPU types that are allowed with any 11807d2c738bSmrg # company name. 11817d2c738bSmrg case $cpu in 11827d2c738bSmrg 1750a | 580 \ 11837d2c738bSmrg | a29k \ 11843b4ba46cSmrg | aarch64 | aarch64_be | aarch64c | arm64ec \ 11857d2c738bSmrg | abacus \ 11867d2c738bSmrg | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 11877d2c738bSmrg | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 11887d2c738bSmrg | alphapca5[67] | alpha64pca5[67] \ 11897d2c738bSmrg | am33_2.0 \ 11907d2c738bSmrg | amdgcn \ 11917d2c738bSmrg | arc | arceb | arc32 | arc64 \ 11927d2c738bSmrg | arm | arm[lb]e | arme[lb] | armv* \ 11937d2c738bSmrg | avr | avr32 \ 11947d2c738bSmrg | asmjs \ 11957d2c738bSmrg | ba \ 11967d2c738bSmrg | be32 | be64 \ 11977d2c738bSmrg | bfin | bpf | bs2000 \ 11987d2c738bSmrg | c[123]* | c30 | [cjt]90 | c4x \ 11997d2c738bSmrg | c8051 | clipper | craynv | csky | cydra \ 12007d2c738bSmrg | d10v | d30v | dlx | dsp16xx \ 12017d2c738bSmrg | e2k | elxsi | epiphany \ 12027d2c738bSmrg | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 12033b4ba46cSmrg | javascript \ 12047d2c738bSmrg | h8300 | h8500 \ 12057d2c738bSmrg | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 12067d2c738bSmrg | hexagon \ 12077d2c738bSmrg | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 12087d2c738bSmrg | ip2k | iq2000 \ 12097d2c738bSmrg | k1om \ 12103b4ba46cSmrg | kvx \ 12117d2c738bSmrg | le32 | le64 \ 12127d2c738bSmrg | lm32 \ 12137d2c738bSmrg | loongarch32 | loongarch64 \ 12147d2c738bSmrg | m32c | m32r | m32rle \ 12157d2c738bSmrg | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 12167d2c738bSmrg | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 12177d2c738bSmrg | m88110 | m88k | maxq | mb | mcore | mep | metag \ 12187d2c738bSmrg | microblaze | microblazeel \ 12193b4ba46cSmrg | mips* \ 12207d2c738bSmrg | mmix \ 12217d2c738bSmrg | mn10200 | mn10300 \ 12227d2c738bSmrg | moxie \ 12237d2c738bSmrg | mt \ 12247d2c738bSmrg | msp430 \ 12253b4ba46cSmrg | nanomips* \ 12267d2c738bSmrg | nds32 | nds32le | nds32be \ 12277d2c738bSmrg | nfp \ 12287d2c738bSmrg | nios | nios2 | nios2eb | nios2el \ 12297d2c738bSmrg | none | np1 | ns16k | ns32k | nvptx \ 12307d2c738bSmrg | open8 \ 12317d2c738bSmrg | or1k* \ 12327d2c738bSmrg | or32 \ 12337d2c738bSmrg | orion \ 12347d2c738bSmrg | picochip \ 12357d2c738bSmrg | pdp10 | pdp11 | pj | pjl | pn | power \ 12367d2c738bSmrg | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 12377d2c738bSmrg | pru \ 12387d2c738bSmrg | pyramid \ 12397d2c738bSmrg | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ 12407d2c738bSmrg | rl78 | romp | rs6000 | rx \ 12417d2c738bSmrg | s390 | s390x \ 12427d2c738bSmrg | score \ 12437d2c738bSmrg | sh | shl \ 12447d2c738bSmrg | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 12457d2c738bSmrg | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 12467d2c738bSmrg | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 12477d2c738bSmrg | sparclite \ 12487d2c738bSmrg | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 12497d2c738bSmrg | spu \ 12507d2c738bSmrg | tahoe \ 12517d2c738bSmrg | thumbv7* \ 12527d2c738bSmrg | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 12537d2c738bSmrg | tron \ 12547d2c738bSmrg | ubicom32 \ 12557d2c738bSmrg | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 12567d2c738bSmrg | vax \ 12573b4ba46cSmrg | vc4 \ 12587d2c738bSmrg | visium \ 12597d2c738bSmrg | w65 \ 12607d2c738bSmrg | wasm32 | wasm64 \ 12617d2c738bSmrg | we32k \ 12627d2c738bSmrg | x86 | x86_64 | xc16x | xgate | xps100 \ 12637d2c738bSmrg | xstormy16 | xtensa* \ 12647d2c738bSmrg | ymp \ 12657d2c738bSmrg | z8k | z80) 12667d2c738bSmrg ;; 12677d2c738bSmrg 12687d2c738bSmrg *) 12693b4ba46cSmrg echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 12707d2c738bSmrg exit 1 12717d2c738bSmrg ;; 12727d2c738bSmrg esac 12731ab64890Smrg ;; 12741ab64890Smrgesac 12751ab64890Smrg 12761ab64890Smrg# Here we canonicalize certain aliases for manufacturers. 12777d2c738bSmrgcase $vendor in 12787d2c738bSmrg digital*) 12797d2c738bSmrg vendor=dec 12801ab64890Smrg ;; 12817d2c738bSmrg commodore*) 12827d2c738bSmrg vendor=cbm 12831ab64890Smrg ;; 12841ab64890Smrg *) 12851ab64890Smrg ;; 12861ab64890Smrgesac 12871ab64890Smrg 12881ab64890Smrg# Decode manufacturer-specific aliases for certain operating systems. 12891ab64890Smrg 12903b4ba46cSmrgif test x"$basic_os" != x 12911ab64890Smrgthen 12927d2c738bSmrg 12937d2c738bSmrg# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just 12947d2c738bSmrg# set os. 12953b4ba46cSmrgobj= 12967d2c738bSmrgcase $basic_os in 12977d2c738bSmrg gnu/linux*) 12987d2c738bSmrg kernel=linux 12997d2c738bSmrg os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` 13007d2c738bSmrg ;; 13017d2c738bSmrg os2-emx) 13027d2c738bSmrg kernel=os2 13037d2c738bSmrg os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` 13047d2c738bSmrg ;; 13057d2c738bSmrg nto-qnx*) 13067d2c738bSmrg kernel=nto 13077d2c738bSmrg os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` 13087d2c738bSmrg ;; 13097d2c738bSmrg *-*) 13107d2c738bSmrg # shellcheck disable=SC2162 13117d2c738bSmrg saved_IFS=$IFS 13127d2c738bSmrg IFS="-" read kernel os <<EOF 13137d2c738bSmrg$basic_os 13147d2c738bSmrgEOF 13157d2c738bSmrg IFS=$saved_IFS 13167d2c738bSmrg ;; 13177d2c738bSmrg # Default OS when just kernel was specified 13187d2c738bSmrg nto*) 13197d2c738bSmrg kernel=nto 13207d2c738bSmrg os=`echo "$basic_os" | sed -e 's|nto|qnx|'` 13217d2c738bSmrg ;; 13227d2c738bSmrg linux*) 13237d2c738bSmrg kernel=linux 13247d2c738bSmrg os=`echo "$basic_os" | sed -e 's|linux|gnu|'` 13257d2c738bSmrg ;; 13267d2c738bSmrg managarm*) 13277d2c738bSmrg kernel=managarm 13287d2c738bSmrg os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` 13297d2c738bSmrg ;; 13307d2c738bSmrg *) 13317d2c738bSmrg kernel= 13327d2c738bSmrg os=$basic_os 13337d2c738bSmrg ;; 13347d2c738bSmrgesac 13357d2c738bSmrg 13367d2c738bSmrg# Now, normalize the OS (knowing we just have one component, it's not a kernel, 13377d2c738bSmrg# etc.) 13381ab64890Smrgcase $os in 13395afda2e6Smrg # First match some system type aliases that might get confused 13405afda2e6Smrg # with valid system types. 13417d2c738bSmrg # solaris* is a basic system type, with this one exception. 13427d2c738bSmrg auroraux) 13437d2c738bSmrg os=auroraux 134488de56ccSmrg ;; 13457d2c738bSmrg bluegene*) 13467d2c738bSmrg os=cnk 13471ab64890Smrg ;; 13487d2c738bSmrg solaris1 | solaris1.*) 13497d2c738bSmrg os=`echo "$os" | sed -e 's|solaris1|sunos4|'` 13501ab64890Smrg ;; 13517d2c738bSmrg solaris) 13527d2c738bSmrg os=solaris2 13531ab64890Smrg ;; 13547d2c738bSmrg unixware*) 13557d2c738bSmrg os=sysv4.2uw 13561ab64890Smrg ;; 13575afda2e6Smrg # es1800 is here to avoid being matched by es* (a different OS) 13587d2c738bSmrg es1800*) 13597d2c738bSmrg os=ose 13601ab64890Smrg ;; 13617d2c738bSmrg # Some version numbers need modification 13627d2c738bSmrg chorusos*) 13637d2c738bSmrg os=chorusos 13641ab64890Smrg ;; 13657d2c738bSmrg isc) 13667d2c738bSmrg os=isc2.2 13671ab64890Smrg ;; 13687d2c738bSmrg sco6) 13697d2c738bSmrg os=sco5v6 13701ab64890Smrg ;; 13717d2c738bSmrg sco5) 13727d2c738bSmrg os=sco3.2v5 13731ab64890Smrg ;; 13747d2c738bSmrg sco4) 13757d2c738bSmrg os=sco3.2v4 13761ab64890Smrg ;; 13777d2c738bSmrg sco3.2.[4-9]*) 13787d2c738bSmrg os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` 13791ab64890Smrg ;; 13807d2c738bSmrg sco*v* | scout) 13817d2c738bSmrg # Don't match below 13821ab64890Smrg ;; 13837d2c738bSmrg sco*) 13847d2c738bSmrg os=sco3.2v2 13851ab64890Smrg ;; 13867d2c738bSmrg psos*) 13877d2c738bSmrg os=psos 13885afda2e6Smrg ;; 13897d2c738bSmrg qnx*) 13907d2c738bSmrg os=qnx 13911ab64890Smrg ;; 13927d2c738bSmrg hiux*) 13937d2c738bSmrg os=hiuxwe2 13941ab64890Smrg ;; 13957d2c738bSmrg lynx*178) 13967d2c738bSmrg os=lynxos178 13971ab64890Smrg ;; 13987d2c738bSmrg lynx*5) 13997d2c738bSmrg os=lynxos5 14005afda2e6Smrg ;; 14017d2c738bSmrg lynxos*) 14027d2c738bSmrg # don't get caught up in next wildcard 14039c019ec5Smaya ;; 14047d2c738bSmrg lynx*) 14057d2c738bSmrg os=lynxos 14069c019ec5Smaya ;; 14077d2c738bSmrg mac[0-9]*) 14087d2c738bSmrg os=`echo "$os" | sed -e 's|mac|macos|'` 14091ab64890Smrg ;; 14107d2c738bSmrg opened*) 14117d2c738bSmrg os=openedition 141203ea5dc6Smrg ;; 14137d2c738bSmrg os400*) 14147d2c738bSmrg os=os400 141503ea5dc6Smrg ;; 14167d2c738bSmrg sunos5*) 14177d2c738bSmrg os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 141803ea5dc6Smrg ;; 14197d2c738bSmrg sunos6*) 14207d2c738bSmrg os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 142103ea5dc6Smrg ;; 14227d2c738bSmrg wince*) 14237d2c738bSmrg os=wince 142403ea5dc6Smrg ;; 14257d2c738bSmrg utek*) 14267d2c738bSmrg os=bsd 142703ea5dc6Smrg ;; 14287d2c738bSmrg dynix*) 14297d2c738bSmrg os=bsd 14307d2c738bSmrg ;; 14317d2c738bSmrg acis*) 14327d2c738bSmrg os=aos 14337d2c738bSmrg ;; 14347d2c738bSmrg atheos*) 14357d2c738bSmrg os=atheos 14367d2c738bSmrg ;; 14377d2c738bSmrg syllable*) 14387d2c738bSmrg os=syllable 14391ab64890Smrg ;; 14407d2c738bSmrg 386bsd) 14417d2c738bSmrg os=bsd 14427d2c738bSmrg ;; 14437d2c738bSmrg ctix* | uts*) 14447d2c738bSmrg os=sysv 14451ab64890Smrg ;; 14467d2c738bSmrg nova*) 14477d2c738bSmrg os=rtmk-nova 14481ab64890Smrg ;; 14497d2c738bSmrg ns2) 14507d2c738bSmrg os=nextstep2 14517d2c738bSmrg ;; 14527d2c738bSmrg # Preserve the version number of sinix5. 14537d2c738bSmrg sinix5.*) 14547d2c738bSmrg os=`echo "$os" | sed -e 's|sinix|sysv|'` 14551ab64890Smrg ;; 14567d2c738bSmrg sinix*) 14577d2c738bSmrg os=sysv4 14581ab64890Smrg ;; 14597d2c738bSmrg tpf*) 14607d2c738bSmrg os=tpf 14611ab64890Smrg ;; 14627d2c738bSmrg triton*) 14637d2c738bSmrg os=sysv3 14641ab64890Smrg ;; 14657d2c738bSmrg oss*) 14667d2c738bSmrg os=sysv3 14671ab64890Smrg ;; 14687d2c738bSmrg svr4*) 14697d2c738bSmrg os=sysv4 14701ab64890Smrg ;; 14717d2c738bSmrg svr3) 14727d2c738bSmrg os=sysv3 14731ab64890Smrg ;; 14747d2c738bSmrg sysvr4) 14757d2c738bSmrg os=sysv4 14761ab64890Smrg ;; 14777d2c738bSmrg ose*) 14787d2c738bSmrg os=ose 14791ab64890Smrg ;; 14807d2c738bSmrg *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 14817d2c738bSmrg os=mint 14821ab64890Smrg ;; 14837d2c738bSmrg dicos*) 14847d2c738bSmrg os=dicos 14857d2c738bSmrg ;; 14867d2c738bSmrg pikeos*) 14875afda2e6Smrg # Until real need of OS specific support for 14885afda2e6Smrg # particular features comes up, bare metal 14895afda2e6Smrg # configurations are quite functional. 14907d2c738bSmrg case $cpu in 14915afda2e6Smrg arm*) 14927d2c738bSmrg os=eabi 14935afda2e6Smrg ;; 14945afda2e6Smrg *) 14953b4ba46cSmrg os= 14963b4ba46cSmrg obj=elf 14975afda2e6Smrg ;; 14985afda2e6Smrg esac 14991ab64890Smrg ;; 15003b4ba46cSmrg aout* | coff* | elf* | pe*) 15013b4ba46cSmrg # These are machine code file formats, not OSes 15023b4ba46cSmrg obj=$os 15033b4ba46cSmrg os= 15043b4ba46cSmrg ;; 15051ab64890Smrg *) 15067d2c738bSmrg # No normalization, but not necessarily accepted, that comes below. 15071ab64890Smrg ;; 15081ab64890Smrgesac 15097d2c738bSmrg 15101ab64890Smrgelse 15111ab64890Smrg 15121ab64890Smrg# Here we handle the default operating systems that come with various machines. 15131ab64890Smrg# The value should be what the vendor currently ships out the door with their 15141ab64890Smrg# machine or put another way, the most popular os provided with the machine. 15151ab64890Smrg 15161ab64890Smrg# Note that if you're going to try to match "-MANUFACTURER" here (say, 15171ab64890Smrg# "-sun"), then you have to tell the case statement up towards the top 15181ab64890Smrg# that MANUFACTURER isn't an operating system. Otherwise, code above 15191ab64890Smrg# will signal an error saying that MANUFACTURER isn't an operating 15201ab64890Smrg# system, and we'll never get to this point. 15211ab64890Smrg 15227d2c738bSmrgkernel= 15233b4ba46cSmrgobj= 15247d2c738bSmrgcase $cpu-$vendor in 1525eb411b4bSmrg score-*) 15263b4ba46cSmrg os= 15273b4ba46cSmrg obj=elf 15281ab64890Smrg ;; 1529eb411b4bSmrg spu-*) 15303b4ba46cSmrg os= 15313b4ba46cSmrg obj=elf 15321ab64890Smrg ;; 15331ab64890Smrg *-acorn) 15347d2c738bSmrg os=riscix1.2 15351ab64890Smrg ;; 15361ab64890Smrg arm*-rebel) 15377d2c738bSmrg kernel=linux 15387d2c738bSmrg os=gnu 15391ab64890Smrg ;; 15401ab64890Smrg arm*-semi) 15413b4ba46cSmrg os= 15423b4ba46cSmrg obj=aout 15431ab64890Smrg ;; 1544eb411b4bSmrg c4x-* | tic4x-*) 15453b4ba46cSmrg os= 15463b4ba46cSmrg obj=coff 1547eb411b4bSmrg ;; 15480f8248bfSmrg c8051-*) 15493b4ba46cSmrg os= 15503b4ba46cSmrg obj=elf 15517d2c738bSmrg ;; 15527d2c738bSmrg clipper-intergraph) 15537d2c738bSmrg os=clix 15540f8248bfSmrg ;; 1555eb411b4bSmrg hexagon-*) 15563b4ba46cSmrg os= 15573b4ba46cSmrg obj=elf 15581ab64890Smrg ;; 1559e9fcaa8aSmrg tic54x-*) 15603b4ba46cSmrg os= 15613b4ba46cSmrg obj=coff 1562e9fcaa8aSmrg ;; 1563e9fcaa8aSmrg tic55x-*) 15643b4ba46cSmrg os= 15653b4ba46cSmrg obj=coff 1566e9fcaa8aSmrg ;; 1567e9fcaa8aSmrg tic6x-*) 15683b4ba46cSmrg os= 15693b4ba46cSmrg obj=coff 1570e9fcaa8aSmrg ;; 15711ab64890Smrg # This must come before the *-dec entry. 15721ab64890Smrg pdp10-*) 15737d2c738bSmrg os=tops20 15741ab64890Smrg ;; 15751ab64890Smrg pdp11-*) 15767d2c738bSmrg os=none 15771ab64890Smrg ;; 15781ab64890Smrg *-dec | vax-*) 15797d2c738bSmrg os=ultrix4.2 15801ab64890Smrg ;; 15811ab64890Smrg m68*-apollo) 15827d2c738bSmrg os=domain 15831ab64890Smrg ;; 15841ab64890Smrg i386-sun) 15857d2c738bSmrg os=sunos4.0.2 15861ab64890Smrg ;; 15871ab64890Smrg m68000-sun) 15887d2c738bSmrg os=sunos3 15891ab64890Smrg ;; 15901ab64890Smrg m68*-cisco) 15913b4ba46cSmrg os= 15923b4ba46cSmrg obj=aout 15931ab64890Smrg ;; 1594eb411b4bSmrg mep-*) 15953b4ba46cSmrg os= 15963b4ba46cSmrg obj=elf 15971ab64890Smrg ;; 15981ab64890Smrg mips*-cisco) 15993b4ba46cSmrg os= 16003b4ba46cSmrg obj=elf 16011ab64890Smrg ;; 16023b4ba46cSmrg mips*-*|nanomips*-*) 16033b4ba46cSmrg os= 16043b4ba46cSmrg obj=elf 16051ab64890Smrg ;; 16061ab64890Smrg or32-*) 16073b4ba46cSmrg os= 16083b4ba46cSmrg obj=coff 16091ab64890Smrg ;; 16101ab64890Smrg *-tti) # must be before sparc entry or we get the wrong os. 16117d2c738bSmrg os=sysv3 16121ab64890Smrg ;; 16131ab64890Smrg sparc-* | *-sun) 16147d2c738bSmrg os=sunos4.1.1 16151ab64890Smrg ;; 161638ae11fcSmrg pru-*) 16173b4ba46cSmrg os= 16183b4ba46cSmrg obj=elf 161938ae11fcSmrg ;; 16201ab64890Smrg *-be) 16217d2c738bSmrg os=beos 16221ab64890Smrg ;; 16231ab64890Smrg *-ibm) 16247d2c738bSmrg os=aix 16251ab64890Smrg ;; 1626eb411b4bSmrg *-knuth) 16277d2c738bSmrg os=mmixware 16281ab64890Smrg ;; 16291ab64890Smrg *-wec) 16307d2c738bSmrg os=proelf 16311ab64890Smrg ;; 16321ab64890Smrg *-winbond) 16337d2c738bSmrg os=proelf 16341ab64890Smrg ;; 16351ab64890Smrg *-oki) 16367d2c738bSmrg os=proelf 16371ab64890Smrg ;; 16381ab64890Smrg *-hp) 16397d2c738bSmrg os=hpux 16401ab64890Smrg ;; 16411ab64890Smrg *-hitachi) 16427d2c738bSmrg os=hiux 16431ab64890Smrg ;; 16441ab64890Smrg i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 16457d2c738bSmrg os=sysv 16461ab64890Smrg ;; 16471ab64890Smrg *-cbm) 16487d2c738bSmrg os=amigaos 16491ab64890Smrg ;; 16501ab64890Smrg *-dg) 16517d2c738bSmrg os=dgux 16521ab64890Smrg ;; 16531ab64890Smrg *-dolphin) 16547d2c738bSmrg os=sysv3 16551ab64890Smrg ;; 16561ab64890Smrg m68k-ccur) 16577d2c738bSmrg os=rtu 16581ab64890Smrg ;; 16591ab64890Smrg m88k-omron*) 16607d2c738bSmrg os=luna 16611ab64890Smrg ;; 16625afda2e6Smrg *-next) 16637d2c738bSmrg os=nextstep 16641ab64890Smrg ;; 16651ab64890Smrg *-sequent) 16667d2c738bSmrg os=ptx 16671ab64890Smrg ;; 16681ab64890Smrg *-crds) 16697d2c738bSmrg os=unos 16701ab64890Smrg ;; 16711ab64890Smrg *-ns) 16727d2c738bSmrg os=genix 16731ab64890Smrg ;; 16741ab64890Smrg i370-*) 16757d2c738bSmrg os=mvs 16761ab64890Smrg ;; 16771ab64890Smrg *-gould) 16787d2c738bSmrg os=sysv 16791ab64890Smrg ;; 16801ab64890Smrg *-highlevel) 16817d2c738bSmrg os=bsd 16821ab64890Smrg ;; 16831ab64890Smrg *-encore) 16847d2c738bSmrg os=bsd 16851ab64890Smrg ;; 16861ab64890Smrg *-sgi) 16877d2c738bSmrg os=irix 16881ab64890Smrg ;; 16891ab64890Smrg *-siemens) 16907d2c738bSmrg os=sysv4 16911ab64890Smrg ;; 16921ab64890Smrg *-masscomp) 16937d2c738bSmrg os=rtu 16941ab64890Smrg ;; 16951ab64890Smrg f30[01]-fujitsu | f700-fujitsu) 16967d2c738bSmrg os=uxpv 16971ab64890Smrg ;; 16981ab64890Smrg *-rom68k) 16993b4ba46cSmrg os= 17003b4ba46cSmrg obj=coff 17011ab64890Smrg ;; 17021ab64890Smrg *-*bug) 17033b4ba46cSmrg os= 17043b4ba46cSmrg obj=coff 17051ab64890Smrg ;; 17061ab64890Smrg *-apple) 17077d2c738bSmrg os=macos 17081ab64890Smrg ;; 17091ab64890Smrg *-atari*) 17107d2c738bSmrg os=mint 17117d2c738bSmrg ;; 17127d2c738bSmrg *-wrs) 17137d2c738bSmrg os=vxworks 17141ab64890Smrg ;; 17151ab64890Smrg *) 17167d2c738bSmrg os=none 17171ab64890Smrg ;; 17181ab64890Smrgesac 17197d2c738bSmrg 17201ab64890Smrgfi 17211ab64890Smrg 17223b4ba46cSmrg# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). 17233b4ba46cSmrg 17247d2c738bSmrgcase $os in 17257d2c738bSmrg # Sometimes we do "kernel-libc", so those need to count as OSes. 17263b4ba46cSmrg llvm* | musl* | newlib* | relibc* | uclibc*) 17277d2c738bSmrg ;; 17287d2c738bSmrg # Likewise for "kernel-abi" 17297d2c738bSmrg eabi* | gnueabi*) 17307d2c738bSmrg ;; 17317d2c738bSmrg # VxWorks passes extra cpu info in the 4th filed. 17327d2c738bSmrg simlinux | simwindows | spe) 17337d2c738bSmrg ;; 17343b4ba46cSmrg # See `case $cpu-$os` validation below 17353b4ba46cSmrg ghcjs) 17363b4ba46cSmrg ;; 17377d2c738bSmrg # Now accept the basic system types. 17387d2c738bSmrg # The portable systems comes first. 17397d2c738bSmrg # Each alternative MUST end in a * to match a version number. 17407d2c738bSmrg gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 17417d2c738bSmrg | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ 17427d2c738bSmrg | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 17437d2c738bSmrg | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ 17447d2c738bSmrg | hiux* | abug | nacl* | netware* | windows* \ 17453b4ba46cSmrg | os9* | macos* | osx* | ios* | tvos* | watchos* \ 17467d2c738bSmrg | mpw* | magic* | mmixware* | mon960* | lnews* \ 17477d2c738bSmrg | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 17487d2c738bSmrg | aos* | aros* | cloudabi* | sortix* | twizzler* \ 17497d2c738bSmrg | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 17507d2c738bSmrg | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 17517d2c738bSmrg | mirbsd* | netbsd* | dicos* | openedition* | ose* \ 17527d2c738bSmrg | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ 17537d2c738bSmrg | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ 17543b4ba46cSmrg | bosx* | nextstep* | cxux* | oabi* \ 17553b4ba46cSmrg | ptx* | ecoff* | winnt* | domain* | vsta* \ 17567d2c738bSmrg | udi* | lites* | ieee* | go32* | aux* | hcos* \ 17577d2c738bSmrg | chorusrdb* | cegcc* | glidix* | serenity* \ 17583b4ba46cSmrg | cygwin* | msys* | moss* | proelf* | rtems* \ 17597d2c738bSmrg | midipix* | mingw32* | mingw64* | mint* \ 17607d2c738bSmrg | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 17617d2c738bSmrg | interix* | uwin* | mks* | rhapsody* | darwin* \ 17627d2c738bSmrg | openstep* | oskit* | conix* | pw32* | nonstopux* \ 17637d2c738bSmrg | storm-chaos* | tops10* | tenex* | tops20* | its* \ 17647d2c738bSmrg | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ 17657d2c738bSmrg | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ 17667d2c738bSmrg | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 17677d2c738bSmrg | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 17687d2c738bSmrg | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 17697d2c738bSmrg | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ 17707d2c738bSmrg | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ 17713b4ba46cSmrg | fiwix* | mlibc* | cos* | mbr* | ironclad* ) 17727d2c738bSmrg ;; 17737d2c738bSmrg # This one is extra strict with allowed versions 17747d2c738bSmrg sco3.2v2 | sco3.2v[4-9]* | sco5v6*) 17757d2c738bSmrg # Don't forget version if it is 3.2v4 or newer. 17767d2c738bSmrg ;; 17773b4ba46cSmrg # This refers to builds using the UEFI calling convention 17783b4ba46cSmrg # (which depends on the architecture) and PE file format. 17793b4ba46cSmrg # Note that this is both a different calling convention and 17803b4ba46cSmrg # different file format than that of GNU-EFI 17813b4ba46cSmrg # (x86_64-w64-mingw32). 17823b4ba46cSmrg uefi) 17833b4ba46cSmrg ;; 17847d2c738bSmrg none) 17857d2c738bSmrg ;; 17863b4ba46cSmrg kernel* | msvc* ) 17877d2c738bSmrg # Restricted further below 17887d2c738bSmrg ;; 17893b4ba46cSmrg '') 17903b4ba46cSmrg if test x"$obj" = x 17913b4ba46cSmrg then 17923b4ba46cSmrg echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 17933b4ba46cSmrg fi 17943b4ba46cSmrg ;; 17957d2c738bSmrg *) 17963b4ba46cSmrg echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 17973b4ba46cSmrg exit 1 17983b4ba46cSmrg ;; 17993b4ba46cSmrgesac 18003b4ba46cSmrg 18013b4ba46cSmrgcase $obj in 18023b4ba46cSmrg aout* | coff* | elf* | pe*) 18033b4ba46cSmrg ;; 18043b4ba46cSmrg '') 18053b4ba46cSmrg # empty is fine 18063b4ba46cSmrg ;; 18073b4ba46cSmrg *) 18083b4ba46cSmrg echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 18093b4ba46cSmrg exit 1 18103b4ba46cSmrg ;; 18113b4ba46cSmrgesac 18123b4ba46cSmrg 18133b4ba46cSmrg# Here we handle the constraint that a (synthetic) cpu and os are 18143b4ba46cSmrg# valid only in combination with each other and nowhere else. 18153b4ba46cSmrgcase $cpu-$os in 18163b4ba46cSmrg # The "javascript-unknown-ghcjs" triple is used by GHC; we 18173b4ba46cSmrg # accept it here in order to tolerate that, but reject any 18183b4ba46cSmrg # variations. 18193b4ba46cSmrg javascript-ghcjs) 18203b4ba46cSmrg ;; 18213b4ba46cSmrg javascript-* | *-ghcjs) 18223b4ba46cSmrg echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 18237d2c738bSmrg exit 1 18247d2c738bSmrg ;; 18257d2c738bSmrgesac 18267d2c738bSmrg 18277d2c738bSmrg# As a final step for OS-related things, validate the OS-kernel combination 18287d2c738bSmrg# (given a valid OS), if there is a kernel. 18293b4ba46cSmrgcase $kernel-$os-$obj in 18303b4ba46cSmrg linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ 18313b4ba46cSmrg | linux-mlibc*- | linux-musl*- | linux-newlib*- \ 18323b4ba46cSmrg | linux-relibc*- | linux-uclibc*- ) 18337d2c738bSmrg ;; 18343b4ba46cSmrg uclinux-uclibc*- ) 18357d2c738bSmrg ;; 18363b4ba46cSmrg managarm-mlibc*- | managarm-kernel*- ) 18377d2c738bSmrg ;; 18383b4ba46cSmrg windows*-msvc*-) 18393b4ba46cSmrg ;; 18403b4ba46cSmrg -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ 18413b4ba46cSmrg | -uclibc*- ) 18427d2c738bSmrg # These are just libc implementations, not actual OSes, and thus 18437d2c738bSmrg # require a kernel. 18443b4ba46cSmrg echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 18457d2c738bSmrg exit 1 18467d2c738bSmrg ;; 18473b4ba46cSmrg -kernel*- ) 18483b4ba46cSmrg echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 18497d2c738bSmrg exit 1 18507d2c738bSmrg ;; 18513b4ba46cSmrg *-kernel*- ) 18523b4ba46cSmrg echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 18537d2c738bSmrg exit 1 18547d2c738bSmrg ;; 18553b4ba46cSmrg *-msvc*- ) 18563b4ba46cSmrg echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 18573b4ba46cSmrg exit 1 18587d2c738bSmrg ;; 18593b4ba46cSmrg kfreebsd*-gnu*- | kopensolaris*-gnu*-) 18607d2c738bSmrg ;; 18613b4ba46cSmrg vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) 18627d2c738bSmrg ;; 18633b4ba46cSmrg nto-qnx*-) 18643b4ba46cSmrg ;; 18653b4ba46cSmrg os2-emx-) 18663b4ba46cSmrg ;; 18673b4ba46cSmrg *-eabi*- | *-gnueabi*-) 18687d2c738bSmrg ;; 18693b4ba46cSmrg none--*) 18703b4ba46cSmrg # None (no kernel, i.e. freestanding / bare metal), 18713b4ba46cSmrg # can be paired with an machine code file format 18727d2c738bSmrg ;; 18733b4ba46cSmrg -*-) 18747d2c738bSmrg # Blank kernel with real OS is always fine. 18757d2c738bSmrg ;; 18763b4ba46cSmrg --*) 18773b4ba46cSmrg # Blank kernel and OS with real machine code file format is always fine. 18783b4ba46cSmrg ;; 18793b4ba46cSmrg *-*-*) 18803b4ba46cSmrg echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 18817d2c738bSmrg exit 1 18827d2c738bSmrg ;; 18837d2c738bSmrgesac 18847d2c738bSmrg 18851ab64890Smrg# Here we handle the case where we know the os, and the CPU type, but not the 18861ab64890Smrg# manufacturer. We pick the logical manufacturer. 18877d2c738bSmrgcase $vendor in 18887d2c738bSmrg unknown) 18897d2c738bSmrg case $cpu-$os in 18907d2c738bSmrg *-riscix*) 18911ab64890Smrg vendor=acorn 18921ab64890Smrg ;; 18937d2c738bSmrg *-sunos*) 18941ab64890Smrg vendor=sun 18951ab64890Smrg ;; 18967d2c738bSmrg *-cnk* | *-aix*) 18971ab64890Smrg vendor=ibm 18981ab64890Smrg ;; 18997d2c738bSmrg *-beos*) 19001ab64890Smrg vendor=be 19011ab64890Smrg ;; 19027d2c738bSmrg *-hpux*) 19031ab64890Smrg vendor=hp 19041ab64890Smrg ;; 19057d2c738bSmrg *-mpeix*) 19061ab64890Smrg vendor=hp 19071ab64890Smrg ;; 19087d2c738bSmrg *-hiux*) 19091ab64890Smrg vendor=hitachi 19101ab64890Smrg ;; 19117d2c738bSmrg *-unos*) 19121ab64890Smrg vendor=crds 19131ab64890Smrg ;; 19147d2c738bSmrg *-dgux*) 19151ab64890Smrg vendor=dg 19161ab64890Smrg ;; 19177d2c738bSmrg *-luna*) 19181ab64890Smrg vendor=omron 19191ab64890Smrg ;; 19207d2c738bSmrg *-genix*) 19211ab64890Smrg vendor=ns 19221ab64890Smrg ;; 19237d2c738bSmrg *-clix*) 19247d2c738bSmrg vendor=intergraph 19257d2c738bSmrg ;; 19267d2c738bSmrg *-mvs* | *-opened*) 19277d2c738bSmrg vendor=ibm 19287d2c738bSmrg ;; 19297d2c738bSmrg *-os400*) 19301ab64890Smrg vendor=ibm 19311ab64890Smrg ;; 19327d2c738bSmrg s390-* | s390x-*) 19331ab64890Smrg vendor=ibm 19341ab64890Smrg ;; 19357d2c738bSmrg *-ptx*) 19361ab64890Smrg vendor=sequent 19371ab64890Smrg ;; 19387d2c738bSmrg *-tpf*) 19391ab64890Smrg vendor=ibm 19401ab64890Smrg ;; 19417d2c738bSmrg *-vxsim* | *-vxworks* | *-windiss*) 19421ab64890Smrg vendor=wrs 19431ab64890Smrg ;; 19447d2c738bSmrg *-aux*) 19451ab64890Smrg vendor=apple 19461ab64890Smrg ;; 19477d2c738bSmrg *-hms*) 19481ab64890Smrg vendor=hitachi 19491ab64890Smrg ;; 19507d2c738bSmrg *-mpw* | *-macos*) 19511ab64890Smrg vendor=apple 19521ab64890Smrg ;; 19537d2c738bSmrg *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) 19541ab64890Smrg vendor=atari 19551ab64890Smrg ;; 19567d2c738bSmrg *-vos*) 19571ab64890Smrg vendor=stratus 19581ab64890Smrg ;; 19591ab64890Smrg esac 19601ab64890Smrg ;; 19611ab64890Smrgesac 19621ab64890Smrg 19633b4ba46cSmrgecho "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" 19641ab64890Smrgexit 19651ab64890Smrg 19661ab64890Smrg# Local variables: 19677d2c738bSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 19681ab64890Smrg# time-stamp-start: "timestamp='" 19691ab64890Smrg# time-stamp-format: "%:y-%02m-%02d" 19701ab64890Smrg# time-stamp-end: "'" 19711ab64890Smrg# End: 1972