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# Attempt to guess a canonical system name.3# Copyright 1992-2026 Free Software Foundation, Inc.5# shellcheck disable=SC2006,SC2268 # 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").28#29# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.30#31# You can get the latest version of this script from:32# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess33#34# Please send patches to <[email protected]>.37# The "shellcheck disable" line above the timestamp inhibits complaints38# about features and limitations of the classic Bourne shell that were39# superseded or lifted in POSIX. However, this script identifies a wide40# variety of pre-POSIX systems that do not have POSIX shells at all, and41# even some reasonably current systems (Solaris 10 as case-in-point) still42# have a pre-POSIX /bin/sh.45me=`echo "$0" | sed -e 's,.*/,,'`47usage="\48Usage: $0 [OPTION]50Output the configuration name of the system '$me' is run on.52Options:53-h, --help print this help, then exit54-t, --time-stamp print date of last modification, then exit55-v, --version print version number, then exit57Report bugs and patches to <[email protected]>."59version="\60GNU config.guess ($timestamp)62Originally written by Per Bothner.63Copyright 1992-2026 Free Software Foundation, Inc.65This is free software; see the source for copying conditions. There is NO66warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."68help="69Try '$me --help' for more information."71# Parse command line72while test $# -gt 0 ; do73case $1 in74--time-stamp | --time* | -t )75echo "$timestamp" ; exit ;;76--version | -v )77echo "$version" ; exit ;;78--help | --h* | -h )79echo "$usage"; exit ;;80-- ) # Stop option processing81shift; break ;;82- ) # Use stdin as input.83break ;;84-* )85echo "$me: invalid option $1$help" >&286exit 1 ;;87* )88break ;;89esac90done92if test $# != 0; then93echo "$me: too many arguments$help" >&294exit 195fi97# Just in case it came from the environment.98GUESS=100# CC_FOR_BUILD -- compiler used by this script. Note that the use of a101# compiler to aid in system detection is discouraged as it requires102# temporary files to be created and, as you can see below, it is a103# headache to deal with in a portable fashion.105# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still106# use 'HOST_CC' if defined, but it is deprecated.108# Portable tmp directory creation inspired by the Autoconf team.110tmp=111# shellcheck disable=SC2172112trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15114set_cc_for_build() {115# prevent multiple calls if $tmp is already set116test "$tmp" && return 0117: "${TMPDIR=/tmp}"118# shellcheck disable=SC2039,SC3028119{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||120{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||121{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||122{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }123dummy=$tmp/dummy124case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in125,,) echo "int x;" > "$dummy.c"126for driver in cc gcc c17 c99 c89 ; do127if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then128CC_FOR_BUILD=$driver129break130fi131done132if test x"$CC_FOR_BUILD" = x ; then133CC_FOR_BUILD=no_compiler_found134fi135;;136,,*) CC_FOR_BUILD=$CC ;;137,*,*) CC_FOR_BUILD=$HOST_CC ;;138esac139}141# This is needed to find uname on a Pyramid OSx when run in the BSD universe.142# ([email protected] 1994-08-24)143if test -f /.attbin/uname ; then144PATH=$PATH:/.attbin ; export PATH145fi147UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown148UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown149UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown150UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown152case $UNAME_SYSTEM in153Ironclad|Linux|GNU|GNU/*)154LIBC=unknown156set_cc_for_build157cat <<-EOF > "$dummy.c"158#if defined(__ANDROID__)159LIBC=android160#else161#include <features.h>162#if defined(__UCLIBC__)163LIBC=uclibc164#elif defined(__dietlibc__)165LIBC=dietlibc166#elif defined(__GLIBC__)167LIBC=gnu168#elif defined(__LLVM_LIBC__)169LIBC=llvm170#elif defined(__mlibc__)171LIBC=mlibc172#else173#include <stdarg.h>174/* First heuristic to detect musl libc. */175#ifdef __DEFINED_va_list176LIBC=musl177#endif178#endif179#endif180EOF181cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`182eval "$cc_set_libc"184# Second heuristic to detect musl libc.185if [ "$LIBC" = unknown ] &&186command -v ldd >/dev/null &&187ldd --version 2>&1 | grep -q ^musl; then188LIBC=musl189fi191# If the system lacks a compiler, then just pick glibc.192# We could probably try harder.193if [ "$LIBC" = unknown ]; then194LIBC=gnu195fi196;;197esac199# Note: order is significant - the case branches are not exclusive.201case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in202*:NetBSD:*:*)203# NetBSD (nbsd) targets should (where applicable) match one or204# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,205# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently206# switched to ELF, *-*-netbsd* would select the old207# object file format. This provides both forward208# compatibility and a consistent mechanism for selecting the209# object file format.210#211# Note: NetBSD doesn't particularly care about the vendor212# portion of the name. We always set it to "unknown".213UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \214/sbin/sysctl -n hw.machine_arch 2>/dev/null || \215/usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \216echo unknown)`217case $UNAME_MACHINE_ARCH in218aarch64eb) machine=aarch64_be-unknown ;;219armeb) machine=armeb-unknown ;;220arm*) machine=arm-unknown ;;221sh3el) machine=shl-unknown ;;222sh3eb) machine=sh-unknown ;;223sh5el) machine=sh5le-unknown ;;224earmv*)225arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`226endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`227machine=${arch}${endian}-unknown228;;229*) machine=$UNAME_MACHINE_ARCH-unknown ;;230esac231# The Operating System including object format, if it has switched232# to ELF recently (or will in the future) and ABI.233case $UNAME_MACHINE_ARCH in234earm*)235os=netbsdelf236;;237arm*|i386|m68k|ns32k|sh3*|sparc|vax)238set_cc_for_build239if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \240| grep -q __ELF__241then242# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).243# Return netbsd for either. FIX?244os=netbsd245else246os=netbsdelf247fi248;;249*)250os=netbsd
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.