Newer
Older
# Configuration validation subroutine script.
# Copyright 1992-2021 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2021-10-27'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
# The "shellcheck disable" line above the timestamp inhibits complaints
# about features and limitations of the classic Bourne shell that were
# superseded or lifted in POSIX. However, this script identifies a wide
# variety of pre-POSIX systems that do not have POSIX shells at all, and
# even some reasonably current systems (Solaris 10 as case-in-point) still
# have a pre-POSIX /bin/sh.
me=`echo "$0" | sed -e 's,.*/,,'`
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
*local*)
# First pass through any local machine types.
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
# Split fields of configuration type
# shellcheck disable=SC2162
IFS="-" read field1 field2 field3 field4 <<EOF
# Separate into logical components for further validation
case $1 in
*-*-*-*-*)
echo Invalid configuration \`"$1"\': more than four components >&2
exit 1
*-*-*-*)
basic_machine=$field1-$field2
basic_os=$field3-$field4
*-*-*)
# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
# parts
maybe_os=$field2-$field3
case $maybe_os in
nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*)
basic_machine=$field1
;;
android-linux)
basic_machine=$field1-unknown
basic_os=linux-android
;;
*)
basic_machine=$field1-$field2
# A lone config we happen to match not fitting any pattern
case $field1-$field2 in
decstation-3100)
basic_machine=mips-dec
*-*)
# Second component is usually, but not always the OS
case $field2 in
# Prevent following clause from handling this valid os
sun*os*)
basic_machine=$field1
zephyr*)
basic_machine=$field1-unknown
basic_os=$field2
;;
# Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
| unicom* | ibm* | next | hp | isi* | apollo | altos* \
| convergent* | ncr* | news | 32* | 3600* | 3100* \
| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
| ultra | tti* | harris | dolphin | highlevel | gould \
| cbm | ns | masscomp | apple | axis | knuth | cray \
| microblaze* | sim | cisco \
| oki | wec | wrs | winbond)
basic_machine=$field1-$field2
;;
*)
basic_machine=$field1
*)
# Convert single-component short-hands not valid as part of
# multi-component configurations.
case $field1 in
386bsd)
basic_machine=i386-pc
;;
a29khif)
basic_machine=a29k-amd
;;
adobe68k)
basic_machine=m68010-adobe
alliant)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
amdahl)
basic_machine=580-amdahl
amiga)
basic_machine=m68k-unknown
amigaos | amigados)
basic_machine=m68k-unknown
;;
amigaunix | amix)
basic_machine=m68k-unknown
;;
apollo68)
basic_machine=m68k-apollo
;;
apollo68bsd)
basic_machine=m68k-apollo
;;
aros)
basic_machine=i386-pc
;;
aux)
basic_machine=m68k-apple
;;
balance)
basic_machine=ns32k-sequent
;;
blackfin)
basic_machine=bfin-unknown
;;
cegcc)
basic_machine=arm-unknown
convex-c1)
basic_machine=c1-convex
;;
convex-c2)
basic_machine=c2-convex
;;
convex-c32)
basic_machine=c32-convex
;;
convex-c34)
basic_machine=c34-convex
;;
convex-c38)
basic_machine=c38-convex
crds | unos)
basic_machine=m68k-crds
;;
da30)
basic_machine=m68k-da30
;;
decstation | pmax | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta88)
basic_machine=m88k-motorola
;;
dicos)
basic_machine=i686-pc
;;
djgpp)
basic_machine=i586-pc
basic_os=msdosdjgpp
;;
ebmon29k)
basic_machine=a29k-amd
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
;;
gmicro)
basic_machine=tron-gmicro
;;
go32)
basic_machine=i386-pc
;;
h8300hms)
basic_machine=h8300-hitachi
;;
h8300xray)
basic_machine=h8300-hitachi
;;
h8500hms)
basic_machine=h8500-hitachi
;;
harris)
basic_machine=m88k-harris
;;
hppaosf)
basic_machine=hppa1.1-hp
;;
hppro)
basic_machine=hppa1.1-hp
;;
i386mach)
basic_machine=i386-mach
;;
isi68 | isi)
basic_machine=m68k-isi
;;
m68knommu)
basic_machine=m68k-unknown
;;
magnum | m3230)
basic_machine=mips-mips
;;
merlin)
basic_machine=ns32k-utek
;;
mingw64)
basic_machine=x86_64-pc
;;
mingw32)
basic_machine=i686-pc
;;
mingw32ce)
basic_machine=arm-unknown
;;
monitor)
basic_machine=m68k-rom68k
;;
morphos)
basic_machine=powerpc-unknown
;;
moxiebox)
basic_machine=moxie-unknown
;;
msdos)
basic_machine=i386-pc
;;
msys)
basic_machine=i686-pc
;;
mvs)
basic_machine=i370-ibm
;;
nacl)
basic_machine=le32-unknown
;;
ncr3000)
basic_machine=i486-ncr
;;
netwinder)
basic_machine=armv4l-rebel
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
;;
news1000)
basic_machine=m68030-sony
;;
necv70)
basic_machine=v70-nec
;;
nh3000)
basic_machine=m68k-harris
;;
nh[45]000)
basic_machine=m88k-harris
;;
nindy960)
basic_machine=i960-intel
;;
mon960)
basic_machine=i960-intel
;;
nonstopux)
basic_machine=mips-compaq
;;
os400)
basic_machine=powerpc-ibm
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
;;
os68k)
basic_machine=m68k-none
;;
paragon)
basic_machine=i860-intel
;;
parisc)
basic_machine=hppa-unknown
basic_os=linux
;;
psp)
basic_machine=mipsallegrexel-sony
basic_os=psp
;;
pw32)
basic_machine=i586-unknown
;;
rdos | rdos64)
basic_machine=x86_64-pc
;;
rdos32)
basic_machine=i386-pc
;;
rom68k)
basic_machine=m68k-rom68k
;;
sa29200)
basic_machine=a29k-amd
;;
sei)
basic_machine=mips-sei
sequent)
basic_machine=i386-sequent
st2000)
basic_machine=m68k-tandem
stratus)
basic_machine=i860-stratus
sun2)
basic_machine=m68000-sun
sun2os3)
basic_machine=m68000-sun
;;
sun2os4)
basic_machine=m68000-sun
sun3)
basic_machine=m68k-sun
;;
sun3os4)
basic_machine=m68k-sun
sun4)
basic_machine=sparc-sun
sun4os3)
basic_machine=sparc-sun
;;
sun4os4)
basic_machine=sparc-sun
;;
sun4sol2)
basic_machine=sparc-sun
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
;;
t3e)
basic_machine=alphaev5-cray
;;
t90)
basic_machine=t90-cray
;;
toad1)
basic_machine=pdp10-xkl
;;
tpf)
basic_machine=s390x-ibm
;;
udi29k)
basic_machine=a29k-amd
;;
ultra3)
basic_machine=a29k-nyu
;;
v810 | necv810)
basic_machine=v810-nec
;;
vaxv)
basic_machine=vax-dec
;;
vms)
basic_machine=vax-dec
vxworks960)
basic_machine=i960-wrs
;;
vxworks68)
basic_machine=m68k-wrs
;;
vxworks29k)
basic_machine=a29k-wrs
;;
xbox)
basic_machine=i686-pc
;;
ymp)
basic_machine=ymp-cray
# Decode 1-component or ad-hoc basic machines
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
cpu=hppa1.1
vendor=winbond
op50n)
cpu=hppa1.1
vendor=oki
op60c)
cpu=hppa1.1
vendor=oki
ibm*)
cpu=i370
vendor=ibm
orion105)
cpu=clipper
vendor=highlevel
mac | mpw | mac-mpw)
cpu=m68k
vendor=apple
pmac | pmac-mpw)
cpu=powerpc
vendor=apple
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
cpu=m68000
vendor=att
cpu=we32k
vendor=att
cpu=powerpc
vendor=ibm
cpu=pdp10
vendor=dec
;;
decsystem20* | dec20*)
cpu=pdp10
vendor=dec
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
cpu=m68k
vendor=motorola
cpu=m68k
vendor=bull
cpu=ns32k
vendor=encore
cpu=elxsi
vendor=elxsi
basic_os=${basic_os:-bsd}
cpu=i860
vendor=alliant
cpu=hppa1.1
vendor=hitachi
cpu=hppa1.0
vendor=hp
cpu=m68000
vendor=hp
cpu=hppa1.0
vendor=hp
cpu=hppa1.1
vendor=hp
# FIXME: really hppa2.0-hp
cpu=hppa1.1
vendor=hp
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
cpu=hppa1.1
vendor=hp
hp9k8[0-9][13679] | hp8[0-9][13679])
cpu=hppa1.1
vendor=hp
cpu=hppa1.0
vendor=hp
basic_os=${basic_os:-unicos}
cpu=m68000
vendor=convergent
*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
cpu=m68k
vendor=atari
cpu=mips
vendor=sony
cpu=m68k
vendor=next
cpu=np1
vendor=gould
op50n-* | op60c-*)
cpu=hppa1.1
vendor=oki
pa-hitachi)
cpu=hppa1.1
vendor=hitachi
pbd)
cpu=sparc
vendor=tti
pbb)
cpu=m68k
vendor=tti
pc532)
cpu=ns32k
vendor=pc532
pn)
cpu=pn
vendor=gould
power)
cpu=power
vendor=ibm
ps2)
cpu=i386
vendor=ibm
rm[46]00)
cpu=mips
vendor=siemens
rtpc | rtpc-*)
cpu=romp
vendor=ibm
sde)
cpu=mipsisa32
vendor=sde
basic_os=${basic_os:-elf}
simso-wrs)
cpu=sparclite
vendor=wrs
tower | tower-32)
cpu=m68k
vendor=ncr
vpp*|vx|vx-*)
cpu=f301
vendor=fujitsu
;;
w65)
cpu=w65
vendor=wdc
;;
w89k-*)
cpu=hppa1.1
vendor=winbond
none)
cpu=none
vendor=none
leon|leon[3-9])
cpu=sparc
vendor=$basic_machine
leon-*|leon[3-9]-*)
cpu=sparc
vendor=`echo "$basic_machine" | sed 's/-.*//'`
IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
cpu=$basic_machine
vendor=pc
# These rules are duplicated from below for sake of the special case above;
# i.e. things that normalized to x86 arches should also default to "pc"
pc98)
cpu=i386
vendor=pc
x64 | amd64)
cpu=x86_64
vendor=pc
# Recognize the basic CPU types without company name.
*)
cpu=$basic_machine
vendor=unknown
esac
unset -v basic_machine
# Decode basic machines in the full and proper CPU-Company form.
case $cpu-$vendor in
# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
# some cases the only manufacturer, in others, it is the most popular.
craynv-unknown)
vendor=cray
basic_os=${basic_os:-unicosmp}
;;
c90-unknown | c90-cray)
vendor=cray
basic_os=${Basic_os:-unicos}
fx80-unknown)
vendor=alliant
romp-unknown)
vendor=ibm
mmix-unknown)
vendor=knuth
microblaze-unknown | microblazeel-unknown)
vendor=xilinx
rs6000-unknown)
vendor=ibm
vax-unknown)
vendor=dec