1
1
#! /bin/sh
2
2
# Attempt to guess a canonical system name.
3
- # Copyright 1992-2020 Free Software Foundation, Inc.
3
+ # Copyright 1992-2021 Free Software Foundation, Inc.
4
4
5
- timestamp=' 2020-11-07 '
5
+ timestamp=' 2021-01-25 '
6
6
7
7
# This file is free software; you can redistribute it and/or modify it
8
8
# under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ timestamp='2020-11-07'
27
27
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
28
28
#
29
29
# You can get the latest version of this script from:
30
- # https://git.savannah.gnu.org/gitweb/?p= config.git;a=blob_plain;f= config.guess
30
+ # https://git.savannah.gnu.org/cgit/ config.git/plain/ config.guess
31
31
#
32
32
# Please send patches to <[email protected] >.
33
33
@@ -50,7 +50,7 @@ version="\
50
50
GNU config.guess ($timestamp )
51
51
52
52
Originally written by Per Bothner.
53
- Copyright 1992-2020 Free Software Foundation, Inc.
53
+ Copyright 1992-2021 Free Software Foundation, Inc.
54
54
55
55
This is free software; see the source for copying conditions. There is NO
56
56
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,9 +138,7 @@ UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
138
138
139
139
case " $UNAME_SYSTEM " in
140
140
Linux|GNU|GNU/* )
141
- # If the system lacks a compiler, then just pick glibc.
142
- # We could probably try harder.
143
- LIBC=gnu
141
+ LIBC=unknown
144
142
145
143
set_cc_for_build
146
144
cat << -EOF > "$dummy .c"
@@ -149,16 +147,30 @@ Linux|GNU|GNU/*)
149
147
LIBC=uclibc
150
148
#elif defined(__dietlibc__)
151
149
LIBC=dietlibc
150
+ #elif defined(__GLIBC__)
151
+ LIBC=gnu
152
152
#else
153
153
#include <stdarg.h>
154
+ /* First heuristic to detect musl libc. */
154
155
#ifdef __DEFINED_va_list
155
156
LIBC=musl
156
- #else
157
- LIBC=gnu
158
157
#endif
159
158
#endif
160
159
EOF
161
160
eval " $( $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^LIBC' | sed ' s, ,,g' ) "
161
+
162
+ # Second heuristic to detect musl libc.
163
+ if [ " $LIBC " = unknown ] &&
164
+ command -v ldd > /dev/null &&
165
+ ldd --version 2>&1 | grep -q ^musl; then
166
+ LIBC=musl
167
+ fi
168
+
169
+ # If the system lacks a compiler, then just pick glibc.
170
+ # We could probably try harder.
171
+ if [ " $LIBC " = unknown ]; then
172
+ LIBC=gnu
173
+ fi
162
174
;;
163
175
esac
164
176
@@ -176,10 +188,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
176
188
#
177
189
# Note: NetBSD doesn't particularly care about the vendor
178
190
# portion of the name. We always set it to "unknown".
179
- sysctl=" sysctl -n hw.machine_arch"
180
191
UNAME_MACHINE_ARCH=$( (uname -p 2> /dev/null || \
181
- " /sbin/$ sysctl" 2> /dev/null || \
182
- " /usr/sbin/$ sysctl" 2> /dev/null || \
192
+ /sbin/sysctl -n hw.machine_arch 2> /dev/null || \
193
+ /usr/sbin/sysctl -n hw.machine_arch 2> /dev/null || \
183
194
echo unknown))
184
195
case " $UNAME_MACHINE_ARCH " in
185
196
aarch64eb) machine=aarch64_be-unknown ;;
984
995
k1om:Linux:* :* )
985
996
echo " $UNAME_MACHINE " -unknown-linux-" $LIBC "
986
997
exit ;;
998
+ loongarch32:Linux:* :* | loongarch64:Linux:* :* | loongarchx32:Linux:* :* )
999
+ echo " $UNAME_MACHINE " -unknown-linux-" $LIBC "
1000
+ exit ;;
987
1001
m32r* :Linux:* :* )
988
1002
echo " $UNAME_MACHINE " -unknown-linux-" $LIBC "
989
1003
exit ;;
@@ -1072,7 +1086,7 @@ EOF
1072
1086
ppcle:Linux:* :* )
1073
1087
echo powerpcle-unknown-linux-" $LIBC "
1074
1088
exit ;;
1075
- riscv32:Linux:* :* | riscv64:Linux:* :* )
1089
+ riscv32:Linux:* :* | riscv32be:Linux: * : * | riscv64:Linux: * : * | riscv64be :Linux:* :* )
1076
1090
echo " $UNAME_MACHINE " -unknown-linux-" $LIBC "
1077
1091
exit ;;
1078
1092
s390:Linux:* :* | s390x:Linux:* :* )
@@ -1468,8 +1482,8 @@ EOF
1468
1482
i* 86:rdos:* :* )
1469
1483
echo " $UNAME_MACHINE " -pc-rdos
1470
1484
exit ;;
1471
- i * 86 :AROS:* :* )
1472
- echo " $UNAME_MACHINE " -pc -aros
1485
+ * :AROS:* :* )
1486
+ echo " $UNAME_MACHINE " -unknown -aros
1473
1487
exit ;;
1474
1488
x86_64:VMkernel:* :* )
1475
1489
echo " $UNAME_MACHINE " -unknown-esx
@@ -1638,9 +1652,9 @@ This script (version $timestamp), has failed to recognize the
1638
1652
operating system you are using. If your script is old, overwrite *all*
1639
1653
copies of config.guess and config.sub with the latest versions from:
1640
1654
1641
- https://git.savannah.gnu.org/gitweb/?p= config.git;a=blob_plain;f= config.guess
1655
+ https://git.savannah.gnu.org/cgit/ config.git/plain/ config.guess
1642
1656
and
1643
- https://git.savannah.gnu.org/gitweb/?p= config.git;a=blob_plain;f= config.sub
1657
+ https://git.savannah.gnu.org/cgit/ config.git/plain/ config.sub
1644
1658
EOF
1645
1659
1646
1660
year=$( echo $timestamp | sed ' s,-.*,,' )
0 commit comments