Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#! /bin/sh2# Configuration validation subroutine script.3# Copyright 1992-2026 Free Software Foundation, Inc.5# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale7timestamp='2026-05-17'9# This file is free software; you can redistribute it and/or modify it10# under the terms of the GNU General Public License as published by11# the Free Software Foundation, either version 3 of the License, or12# (at your option) any later version.13#14# This program is distributed in the hope that it will be useful, but15# WITHOUT ANY WARRANTY; without even the implied warranty of16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU17# General Public License for more details.18#19# You should have received a copy of the GNU General Public License20# along with this program; if not, see <https://www.gnu.org/licenses/>.21#22# As a special exception to the GNU General Public License, if you23# distribute this file as part of a program that contains a24# configuration script generated by Autoconf, you may include it under25# the same distribution terms that you use for the rest of that26# program. This Exception is an additional permission under section 727# of the GNU General Public License, version 3 ("GPLv3").30# Please send patches to <[email protected]>.31#32# Configuration subroutine to validate and canonicalize a configuration type.33# Supply the specified configuration type as an argument.34# If it is invalid, we print an error message on stderr and exit with code 1.35# Otherwise, we print the canonical config type on stdout and succeed.37# You can get the latest version of this script from:38# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub40# This file is supposed to be the same for all GNU packages41# and recognize all the CPU types, system types and aliases42# that are meaningful with *any* GNU software.43# Each package is responsible for reporting which valid configurations44# it does not support. The user should be able to distinguish45# a failure to support a valid configuration from a meaningless46# configuration.48# The goal of this file is to map all the various variations of a given49# machine specification into a single specification in the form:50# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM51# or in some cases, the newer four-part form:52# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM53# It is wrong to echo any other type of specification.55# The "shellcheck disable" line above the timestamp inhibits complaints56# about features and limitations of the classic Bourne shell that were57# superseded or lifted in POSIX. However, this script identifies a wide58# variety of pre-POSIX systems that do not have POSIX shells at all, and59# even some reasonably current systems (Solaris 10 as case-in-point) still60# have a pre-POSIX /bin/sh.62me=`echo "$0" | sed -e 's,.*/,,'`64usage="\65Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS67Canonicalize a configuration name.69Options:70-h, --help print this help, then exit71-t, --time-stamp print date of last modification, then exit72-v, --version print version number, then exit74Report bugs and patches to <[email protected]>."76version="\77GNU config.sub ($timestamp)79Copyright 1992-2026 Free Software Foundation, Inc.81This is free software; see the source for copying conditions. There is NO82warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."84help="85Try '$me --help' for more information."87# Parse command line88while test $# -gt 0 ; do89case $1 in90--time-stamp | --time* | -t )91echo "$timestamp" ; exit ;;92--version | -v )93echo "$version" ; exit ;;94--help | --h* | -h )95echo "$usage"; exit ;;96-- ) # Stop option processing97shift; break ;;98- ) # Use stdin as input.99break ;;100-* )101echo "$me: invalid option $1$help" >&2102exit 1 ;;104*local*)105# First pass through any local machine types.106echo "$1"107exit ;;109* )110break ;;111esac112done114case $# in1150) echo "$me: missing argument$help" >&2116exit 1;;1171) ;;118*) echo "$me: too many arguments$help" >&2119exit 1;;120esac122# Split fields of configuration type123saved_IFS=$IFS124IFS="-" read field1 field2 field3 field4 <<EOF125$1126EOF127IFS=$saved_IFS129# Separate into logical components for further validation130case $1 in131*-*-*-*-*)132echo "Invalid configuration '$1': more than four components" >&2133exit 1134;;135*-*-*-*)136basic_machine=$field1-$field2137basic_os=$field3-$field4138;;139*-*-*)140# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two141# parts142maybe_os=$field2-$field3143case $maybe_os in144cloudabi*-eabi* \145| kfreebsd*-gnu* \146| knetbsd*-gnu* \147| kopensolaris*-gnu* \148| ironclad-* \149| linux-* \150| managarm-* \151| netbsd*-eabi* \152| netbsd*-gnu* \153| nto-qnx* \154| os2-emx* \155| rtmk-nova* \156| storm-chaos* \157| uclinux-gnu* \158| uclinux-uclibc* \159| windows-* )160basic_machine=$field1161basic_os=$maybe_os162;;163android-linux)164basic_machine=$field1-unknown165basic_os=linux-android166;;167*)168basic_machine=$field1-$field2169basic_os=$field3170;;171esac172;;173*-*)174case $field1-$field2 in175# Shorthands that happen to contain a single dash176convex-c[12] | convex-c3[248])177basic_machine=$field2-convex178basic_os=179;;180decstation-3100)181basic_machine=mips-dec182basic_os=183;;184*-*)185# Second component is usually, but not always the OS186case $field2 in187# Do not treat sunos as a manufacturer188sun*os*)189basic_machine=$field1190basic_os=$field2191;;192# Manufacturers1933100* \194| 32* \195| 3300* \196| 3600* \197| 7300* \198| acorn \199| altos* \200| apollo \201| apple \202| atari \203| att* \204| axis \205| be \206| bull \207| cbm \208| ccur \209| cisco \210| commodore \211| convergent* \212| convex* \213| cray \214| crds \215| dec* \216| delta* \217| dg \218| digital \219| dolphin \220| encore* \221| gould \222| harris \223| highlevel \224| hitachi* \225| hp \226| ibm* \227| intergraph \228| isi* \229| knuth \230| masscomp \231| microblaze* \232| mips* \233| motorola* \234| ncr* \235| news \236| next \237| ns \238| oki \239| omron* \240| pc533* \241| rebel \242| rom68k \243| rombug \244| semi \245| sequent* \246| sgi* \247| siemens \248| sim \249| sni \250| sony* \
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.