1907 lines · 35.0 KB · Text
RawDownload
#! /bin/sh# Configuration validation subroutine script.#   Copyright 1992-2023 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2023-01-21' # 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# (at your option) any later version.## 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="\Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options:  -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-2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help="Try \`$me --help' for more information." # Parse command linewhile test $# -gt 0 ; do  case $1 in    --time-stamp | --time* | -t )       echo "$timestamp" ; exit ;;    --version | -v )       echo "$version" ; exit ;;    --help | --h* | -h )       echo "$usage"; exit ;;    -- )     # 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.       echo "$1"       exit ;;     * )       break ;;  esacdone case $# in 0) echo "$me: missing argument$help" >&2    exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2    exit 1;;esac # Split fields of configuration type# shellcheck disable=SC2162saved_IFS=$IFSIFS="-" read field1 field2 field3 field4 <<EOF$1EOFIFS=$saved_IFS # Separate into logical components for further validationcase $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* | managarm-*)				basic_machine=$field1				basic_os=$maybe_os				;;			android-linux)				basic_machine=$field1-unknown				basic_os=linux-android				;;			*)				basic_machine=$field1-$field2				basic_os=$field3				;;		esac		;;	*-*)		# A lone config we happen to match not fitting any pattern		case $field1-$field2 in			decstation-3100)				basic_machine=mips-dec				basic_os=				;;			*-*)				# 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						basic_os=$field2						;;					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_os=						;;					*)						basic_machine=$field1						basic_os=$field2						;;				esac			;;		esac		;;	*)		# Convert single-component short-hands not valid as part of		# multi-component configurations.		case $field1 in			386bsd)				basic_machine=i386-pc				basic_os=bsd				;;			a29khif)				basic_machine=a29k-amd				basic_os=udi				;;			adobe68k)				basic_machine=m68010-adobe				basic_os=scout				;;			alliant)				basic_machine=fx80-alliant				basic_os=				;;			altos | altos3068)				basic_machine=m68k-altos				basic_os=				;;			am29k)				basic_machine=a29k-none				basic_os=bsd				;;			amdahl)				basic_machine=580-amdahl				basic_os=sysv				;;			amiga)				basic_machine=m68k-unknown				basic_os=				;;			amigaos | amigados)				basic_machine=m68k-unknown				basic_os=amigaos				;;			amigaunix | amix)				basic_machine=m68k-unknown				basic_os=sysv4				;;			apollo68)				basic_machine=m68k-apollo				basic_os=sysv				;;			apollo68bsd)				basic_machine=m68k-apollo				basic_os=bsd				;;			aros)				basic_machine=i386-pc				basic_os=aros				;;			aux)				basic_machine=m68k-apple				basic_os=aux				;;			balance)				basic_machine=ns32k-sequent				basic_os=dynix				;;			blackfin)				basic_machine=bfin-unknown				basic_os=linux				;;			cegcc)				basic_machine=arm-unknown				basic_os=cegcc				;;			convex-c1)				basic_machine=c1-convex				basic_os=bsd				;;			convex-c2)				basic_machine=c2-convex				basic_os=bsd				;;			convex-c32)				basic_machine=c32-convex				basic_os=bsd				;;			convex-c34)				basic_machine=c34-convex				basic_os=bsd				;;			convex-c38)				basic_machine=c38-convex				basic_os=bsd				;;			cray)				basic_machine=j90-cray				basic_os=unicos				;;			crds | unos)				basic_machine=m68k-crds				basic_os=				;;			da30)				basic_machine=m68k-da30				basic_os=				;;			decstation | pmax | pmin | dec3100 | decstatn)				basic_machine=mips-dec				basic_os=				;;			delta88)				basic_machine=m88k-motorola				basic_os=sysv3				;;			dicos)				basic_machine=i686-pc				basic_os=dicos				;;			djgpp)				basic_machine=i586-pc				basic_os=msdosdjgpp				;;			ebmon29k)				basic_machine=a29k-amd				basic_os=ebmon				;;			es1800 | OSE68k | ose68k | ose | OSE)				basic_machine=m68k-ericsson				basic_os=ose				;;			gmicro)				basic_machine=tron-gmicro				basic_os=sysv				;;			go32)				basic_machine=i386-pc				basic_os=go32				;;			h8300hms)				basic_machine=h8300-hitachi				basic_os=hms				;;			h8300xray)				basic_machine=h8300-hitachi				basic_os=xray				;;			h8500hms)				basic_machine=h8500-hitachi				basic_os=hms				;;			harris)				basic_machine=m88k-harris				basic_os=sysv3				;;			hp300 | hp300hpux)				basic_machine=m68k-hp				basic_os=hpux				;;			hp300bsd)				basic_machine=m68k-hp				basic_os=bsd				;;			hppaosf)				basic_machine=hppa1.1-hp				basic_os=osf				;;			hppro)				basic_machine=hppa1.1-hp				basic_os=proelf				;;			i386mach)				basic_machine=i386-mach				basic_os=mach				;;			isi68 | isi)				basic_machine=m68k-isi				basic_os=sysv				;;			m68knommu)				basic_machine=m68k-unknown				basic_os=linux				;;			magnum | m3230)				basic_machine=mips-mips				basic_os=sysv				;;			merlin)				basic_machine=ns32k-utek				basic_os=sysv				;;			mingw64)				basic_machine=x86_64-pc				basic_os=mingw64				;;			mingw32)				basic_machine=i686-pc				basic_os=mingw32				;;			mingw32ce)				basic_machine=arm-unknown				basic_os=mingw32ce				;;			monitor)				basic_machine=m68k-rom68k				basic_os=coff				;;			morphos)				basic_machine=powerpc-unknown				basic_os=morphos				;;			moxiebox)				basic_machine=moxie-unknown				basic_os=moxiebox				;;			msdos)				basic_machine=i386-pc				basic_os=msdos				;;			msys)				basic_machine=i686-pc				basic_os=msys				;;			mvs)				basic_machine=i370-ibm				basic_os=mvs				;;			nacl)				basic_machine=le32-unknown				basic_os=nacl				;;			ncr3000)				basic_machine=i486-ncr				basic_os=sysv4				;;			netbsd386)				basic_machine=i386-pc				basic_os=netbsd				;;			netwinder)				basic_machine=armv4l-rebel				basic_os=linux				;;			news | news700 | news800 | news900)				basic_machine=m68k-sony				basic_os=newsos				;;			news1000)				basic_machine=m68030-sony				basic_os=newsos				;;			necv70)				basic_machine=v70-nec				basic_os=sysv				;;			nh3000)				basic_machine=m68k-harris				basic_os=cxux				;;			nh[45]000)				basic_machine=m88k-harris				basic_os=cxux				;;			nindy960)				basic_machine=i960-intel				basic_os=nindy				;;			mon960)				basic_machine=i960-intel				basic_os=mon960				;;			nonstopux)				basic_machine=mips-compaq				basic_os=nonstopux				;;			os400)				basic_machine=powerpc-ibm				basic_os=os400				;;			OSE68000 | ose68000)				basic_machine=m68000-ericsson				basic_os=ose				;;			os68k)				basic_machine=m68k-none				basic_os=os68k				;;			paragon)				basic_machine=i860-intel				basic_os=osf				;;			parisc)				basic_machine=hppa-unknown				basic_os=linux				;;			psp)				basic_machine=mipsallegrexel-sony				basic_os=psp				;;			pw32)				basic_machine=i586-unknown				basic_os=pw32

Lines 1–500 of 1907.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t