11#! /bin/sh
22# Attempt to guess a canonical system name.
3- # Copyright 1992-2021 Free Software Foundation, Inc.
3+ # Copyright 1992-2023 Free Software Foundation, Inc.
44
55# shellcheck disable=SC2006,SC2268 # see below for rationale
66
7- timestamp=' 2021-06-03 '
7+ timestamp=' 2023-08-22 '
88
99# This file is free software; you can redistribute it and/or modify it
1010# under the terms of the GNU General Public License as published by
11- # the Free Software Foundation; either version 3 of the License, or
11+ # the Free Software Foundation, either version 3 of the License, or
1212# (at your option) any later version.
1313#
1414# This program is distributed in the hope that it will be useful, but
@@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'`
4747usage=" \
4848Usage: $0 [OPTION]
4949
50- Output the configuration name of the system \` $me ' is run on.
50+ Output the configuration name of the system ' $me ' is run on.
5151
5252Options:
5353 -h, --help print this help, then exit
@@ -60,13 +60,13 @@ version="\
6060GNU config.guess ($timestamp )
6161
6262Originally written by Per Bothner.
63- Copyright 1992-2021 Free Software Foundation, Inc.
63+ Copyright 1992-2023 Free Software Foundation, Inc.
6464
6565This is free software; see the source for copying conditions. There is NO
6666warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6767
6868help="
69- Try \` $me --help' for more information."
69+ Try ' $me --help' for more information."
7070
7171# Parse command line
7272while test $# -gt 0 ; do
@@ -102,8 +102,8 @@ GUESS=
102102# temporary files to be created and, as you can see below, it is a
103103# headache to deal with in a portable fashion.
104104
105- # Historically, ` CC_FOR_BUILD' used to be named ` HOST_CC'. We still
106- # use ` HOST_CC' if defined, but it is deprecated.
105+ # Historically, ' CC_FOR_BUILD' used to be named ' HOST_CC'. We still
106+ # use ' HOST_CC' if defined, but it is deprecated.
107107
108108# Portable tmp directory creation inspired by the Autoconf team.
109109
@@ -155,6 +155,9 @@ Linux|GNU|GNU/*)
155155
156156 set_cc_for_build
157157 cat << -EOF > "$dummy .c"
158+ #if defined(__ANDROID__)
159+ LIBC=android
160+ #else
158161 #include <features.h>
159162 #if defined(__UCLIBC__)
160163 LIBC=uclibc
@@ -169,6 +172,7 @@ Linux|GNU|GNU/*)
169172 LIBC=musl
170173 #endif
171174 #endif
175+ #endif
172176 EOF
173177 cc_set_libc=` $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^LIBC' | sed ' s, ,,g' `
174178 eval " $cc_set_libc "
@@ -437,7 +441,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
437441 # This test works for both compilers.
438442 if test " $CC_FOR_BUILD " ! = no_compiler_found; then
439443 if (echo ' #ifdef __amd64' ; echo IS_64BIT_ARCH; echo ' #endif' ) | \
440- (CCOPTS=" " $CC_FOR_BUILD -E - 2> /dev/null) | \
444+ (CCOPTS=" " $CC_FOR_BUILD -m64 - E - 2> /dev/null) | \
441445 grep IS_64BIT_ARCH > /dev/null
442446 then
443447 SUN_ARCH=x86_64
@@ -459,7 +463,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
459463 UNAME_RELEASE=` uname -v`
460464 ;;
461465 esac
462- # Japanese Language versions have a version number like ` 4.1.3-JL'.
466+ # Japanese Language versions have a version number like ' 4.1.3-JL'.
463467 SUN_REL=` echo " $UNAME_RELEASE " | sed -e ' s/-/_/' `
464468 GUESS=sparc-sun-sunos$SUN_REL
465469 ;;
904908 fi
905909 ;;
906910 * :FreeBSD:* :* )
907- UNAME_PROCESSOR=` /usr/bin/ uname -p`
911+ UNAME_PROCESSOR=` uname -p`
908912 case $UNAME_PROCESSOR in
909913 amd64)
910914 UNAME_PROCESSOR=x86_64 ;;
929933 i* :PW* :* )
930934 GUESS=$UNAME_MACHINE -pc-pw32
931935 ;;
936+ * :SerenityOS:* :* )
937+ GUESS=$UNAME_MACHINE -pc-serenity
938+ ;;
932939 * :Interix* :* )
933940 case $UNAME_MACHINE in
934941 x86)
@@ -963,11 +970,37 @@ EOF
963970 GNU_REL=` echo " $UNAME_RELEASE " | sed -e ' s/[-(].*//' `
964971 GUESS=$UNAME_MACHINE -unknown-$GNU_SYS$GNU_REL -$LIBC
965972 ;;
973+ x86_64:[Mm]anagarm:* :* |i? 86:[Mm]anagarm:* :* )
974+ GUESS=" $UNAME_MACHINE -pc-managarm-mlibc"
975+ ;;
976+ * :[Mm]anagarm:* :* )
977+ GUESS=" $UNAME_MACHINE -unknown-managarm-mlibc"
978+ ;;
966979 * :Minix:* :* )
967980 GUESS=$UNAME_MACHINE -unknown-minix
968981 ;;
969982 aarch64:Linux:* :* )
970- GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
983+ set_cc_for_build
984+ CPU=$UNAME_MACHINE
985+ LIBCABI=$LIBC
986+ if test " $CC_FOR_BUILD " ! = no_compiler_found; then
987+ ABI=64
988+ sed ' s/^ //' << EOF > "$dummy .c"
989+ #ifdef __ARM_EABI__
990+ #ifdef __ARM_PCS_VFP
991+ ABI=eabihf
992+ #else
993+ ABI=eabi
994+ #endif
995+ #endif
996+ EOF
997+ cc_set_abi=` $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^ABI' | sed ' s, ,,g' `
998+ eval " $cc_set_abi "
999+ case $ABI in
1000+ eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
1001+ esac
1002+ fi
1003+ GUESS=$CPU -unknown-linux-$LIBCABI
9711004 ;;
9721005 aarch64_be:Linux:* :* )
9731006 UNAME_MACHINE=aarch64_be
@@ -1033,7 +1066,16 @@ EOF
10331066 k1om:Linux:* :* )
10341067 GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
10351068 ;;
1036- loongarch32:Linux:* :* | loongarch64:Linux:* :* | loongarchx32:Linux:* :* )
1069+ kvx:Linux:* :* )
1070+ GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
1071+ ;;
1072+ kvx:cos:* :* )
1073+ GUESS=$UNAME_MACHINE -unknown-cos
1074+ ;;
1075+ kvx:mbr:* :* )
1076+ GUESS=$UNAME_MACHINE -unknown-mbr
1077+ ;;
1078+ loongarch32:Linux:* :* | loongarch64:Linux:* :* )
10371079 GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
10381080 ;;
10391081 m32r* :Linux:* :* )
@@ -1148,16 +1190,27 @@ EOF
11481190 ;;
11491191 x86_64:Linux:* :* )
11501192 set_cc_for_build
1193+ CPU=$UNAME_MACHINE
11511194 LIBCABI=$LIBC
11521195 if test " $CC_FOR_BUILD " ! = no_compiler_found; then
1153- if (echo ' #ifdef __ILP32__' ; echo IS_X32; echo ' #endif' ) | \
1154- (CCOPTS=" " $CC_FOR_BUILD -E - 2> /dev/null) | \
1155- grep IS_X32 > /dev/null
1156- then
1157- LIBCABI=${LIBC} x32
1158- fi
1196+ ABI=64
1197+ sed ' s/^ //' << EOF > "$dummy .c"
1198+ #ifdef __i386__
1199+ ABI=x86
1200+ #else
1201+ #ifdef __ILP32__
1202+ ABI=x32
1203+ #endif
1204+ #endif
1205+ EOF
1206+ cc_set_abi=` $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^ABI' | sed ' s, ,,g' `
1207+ eval " $cc_set_abi "
1208+ case $ABI in
1209+ x86) CPU=i686 ;;
1210+ x32) LIBCABI=${LIBC} x32 ;;
1211+ esac
11591212 fi
1160- GUESS=$UNAME_MACHINE -pc-linux-$LIBCABI
1213+ GUESS=$CPU -pc-linux-$LIBCABI
11611214 ;;
11621215 xtensa* :Linux:* :* )
11631216 GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
@@ -1177,7 +1230,7 @@ EOF
11771230 GUESS=$UNAME_MACHINE -pc-sysv4.2uw$UNAME_VERSION
11781231 ;;
11791232 i* 86:OS/2:* :* )
1180- # If we were able to find ` uname', then EMX Unix compatibility
1233+ # If we were able to find ' uname', then EMX Unix compatibility
11811234 # is probably installed.
11821235 GUESS=$UNAME_MACHINE -pc-os2-emx
11831236 ;;
@@ -1318,7 +1371,7 @@ EOF
13181371 GUESS=ns32k-sni-sysv
13191372 fi
13201373 ;;
1321- PENTIUM:* :4.0* :* ) # Unisys ` ClearPath HMP IX 4000' SVR4/MP effort
1374+ PENTIUM:* :4.0* :* ) # Unisys ' ClearPath HMP IX 4000' SVR4/MP effort
13221375 # says <Richard.M.Bartel@ccMail.Census.GOV>
13231376 GUESS=i586-unisys-sysv4
13241377 ;;
@@ -1364,8 +1417,11 @@ EOF
13641417 BePC:Haiku:* :* ) # Haiku running on Intel PC compatible.
13651418 GUESS=i586-pc-haiku
13661419 ;;
1367- x86_64:Haiku:* :* )
1368- GUESS=x86_64-unknown-haiku
1420+ ppc:Haiku:* :* ) # Haiku running on Apple PowerPC
1421+ GUESS=powerpc-apple-haiku
1422+ ;;
1423+ * :Haiku:* :* ) # Haiku modern gcc (not bound by BeOS compat)
1424+ GUESS=$UNAME_MACHINE -unknown-haiku
13691425 ;;
13701426 SX-4:SUPER-UX:* :* )
13711427 GUESS=sx4-nec-superux$UNAME_RELEASE
@@ -1522,6 +1578,9 @@ EOF
15221578 i* 86:rdos:* :* )
15231579 GUESS=$UNAME_MACHINE -pc-rdos
15241580 ;;
1581+ i* 86:Fiwix:* :* )
1582+ GUESS=$UNAME_MACHINE -pc-fiwix
1583+ ;;
15251584 * :AROS:* :* )
15261585 GUESS=$UNAME_MACHINE -unknown-aros
15271586 ;;
0 commit comments