1
1
#! /bin/sh
2
2
# Attempt to guess a canonical system name.
3
- # Copyright 1992-2021 Free Software Foundation, Inc.
3
+ # Copyright 1992-2024 Free Software Foundation, Inc.
4
4
5
5
# shellcheck disable=SC2006,SC2268 # see below for rationale
6
6
7
- timestamp=' 2021-06-03 '
7
+ timestamp=' 2024-07-27 '
8
8
9
9
# This file is free software; you can redistribute it and/or modify it
10
10
# 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
12
12
# (at your option) any later version.
13
13
#
14
14
# This program is distributed in the hope that it will be useful, but
@@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'`
47
47
usage=" \
48
48
Usage: $0 [OPTION]
49
49
50
- Output the configuration name of the system \` $me ' is run on.
50
+ Output the configuration name of the system ' $me ' is run on.
51
51
52
52
Options:
53
53
-h, --help print this help, then exit
@@ -60,13 +60,13 @@ version="\
60
60
GNU config.guess ($timestamp )
61
61
62
62
Originally written by Per Bothner.
63
- Copyright 1992-2021 Free Software Foundation, Inc.
63
+ Copyright 1992-2024 Free Software Foundation, Inc.
64
64
65
65
This is free software; see the source for copying conditions. There is NO
66
66
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67
67
68
68
help="
69
- Try \` $me --help' for more information."
69
+ Try ' $me --help' for more information."
70
70
71
71
# Parse command line
72
72
while test $# -gt 0 ; do
@@ -102,8 +102,8 @@ GUESS=
102
102
# temporary files to be created and, as you can see below, it is a
103
103
# headache to deal with in a portable fashion.
104
104
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.
107
107
108
108
# Portable tmp directory creation inspired by the Autoconf team.
109
109
@@ -123,7 +123,7 @@ set_cc_for_build() {
123
123
dummy=$tmp /dummy
124
124
case ${CC_FOR_BUILD-} ,${HOST_CC-} ,${CC-} in
125
125
,,) echo " int x;" > " $dummy .c"
126
- for driver in cc gcc c89 c99 ; do
126
+ for driver in cc gcc c17 c99 c89 ; do
127
127
if ($driver -c -o " $dummy .o" " $dummy .c" ) > /dev/null 2>&1 ; then
128
128
CC_FOR_BUILD=$driver
129
129
break
@@ -155,20 +155,26 @@ Linux|GNU|GNU/*)
155
155
156
156
set_cc_for_build
157
157
cat << -EOF > "$dummy .c"
158
+ #if defined(__ANDROID__)
159
+ LIBC=android
160
+ #else
158
161
#include <features.h>
159
162
#if defined(__UCLIBC__)
160
163
LIBC=uclibc
161
164
#elif defined(__dietlibc__)
162
165
LIBC=dietlibc
163
166
#elif defined(__GLIBC__)
164
167
LIBC=gnu
168
+ #elif defined(__LLVM_LIBC__)
169
+ LIBC=llvm
165
170
#else
166
171
#include <stdarg.h>
167
172
/* First heuristic to detect musl libc. */
168
173
#ifdef __DEFINED_va_list
169
174
LIBC=musl
170
175
#endif
171
176
#endif
177
+ #endif
172
178
EOF
173
179
cc_set_libc=` $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^LIBC' | sed ' s, ,,g' `
174
180
eval " $cc_set_libc "
@@ -437,7 +443,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
437
443
# This test works for both compilers.
438
444
if test " $CC_FOR_BUILD " ! = no_compiler_found; then
439
445
if (echo ' #ifdef __amd64' ; echo IS_64BIT_ARCH; echo ' #endif' ) | \
440
- (CCOPTS=" " $CC_FOR_BUILD -E - 2> /dev/null) | \
446
+ (CCOPTS=" " $CC_FOR_BUILD -m64 - E - 2> /dev/null) | \
441
447
grep IS_64BIT_ARCH > /dev/null
442
448
then
443
449
SUN_ARCH=x86_64
@@ -459,7 +465,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
459
465
UNAME_RELEASE=` uname -v`
460
466
;;
461
467
esac
462
- # Japanese Language versions have a version number like ` 4.1.3-JL'.
468
+ # Japanese Language versions have a version number like ' 4.1.3-JL'.
463
469
SUN_REL=` echo " $UNAME_RELEASE " | sed -e ' s/-/_/' `
464
470
GUESS=sparc-sun-sunos$SUN_REL
465
471
;;
628
634
sed ' s/^ //' << EOF > "$dummy .c"
629
635
#include <sys/systemcfg.h>
630
636
631
- main()
637
+ int
638
+ main ()
632
639
{
633
640
if (!__power_pc())
634
641
exit(1);
712
719
#include <stdlib.h>
713
720
#include <unistd.h>
714
721
715
- int main ()
722
+ int
723
+ main ()
716
724
{
717
725
#if defined(_SC_KERNEL_BITS)
718
726
long bits = sysconf(_SC_KERNEL_BITS);
904
912
fi
905
913
;;
906
914
* :FreeBSD:* :* )
907
- UNAME_PROCESSOR=` /usr/bin/ uname -p`
915
+ UNAME_PROCESSOR=` uname -p`
908
916
case $UNAME_PROCESSOR in
909
917
amd64)
910
918
UNAME_PROCESSOR=x86_64 ;;
929
937
i* :PW* :* )
930
938
GUESS=$UNAME_MACHINE -pc-pw32
931
939
;;
940
+ * :SerenityOS:* :* )
941
+ GUESS=$UNAME_MACHINE -pc-serenity
942
+ ;;
932
943
* :Interix* :* )
933
944
case $UNAME_MACHINE in
934
945
x86)
@@ -963,11 +974,37 @@ EOF
963
974
GNU_REL=` echo " $UNAME_RELEASE " | sed -e ' s/[-(].*//' `
964
975
GUESS=$UNAME_MACHINE -unknown-$GNU_SYS$GNU_REL -$LIBC
965
976
;;
977
+ x86_64:[Mm]anagarm:* :* |i? 86:[Mm]anagarm:* :* )
978
+ GUESS=" $UNAME_MACHINE -pc-managarm-mlibc"
979
+ ;;
980
+ * :[Mm]anagarm:* :* )
981
+ GUESS=" $UNAME_MACHINE -unknown-managarm-mlibc"
982
+ ;;
966
983
* :Minix:* :* )
967
984
GUESS=$UNAME_MACHINE -unknown-minix
968
985
;;
969
986
aarch64:Linux:* :* )
970
- GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
987
+ set_cc_for_build
988
+ CPU=$UNAME_MACHINE
989
+ LIBCABI=$LIBC
990
+ if test " $CC_FOR_BUILD " ! = no_compiler_found; then
991
+ ABI=64
992
+ sed ' s/^ //' << EOF > "$dummy .c"
993
+ #ifdef __ARM_EABI__
994
+ #ifdef __ARM_PCS_VFP
995
+ ABI=eabihf
996
+ #else
997
+ ABI=eabi
998
+ #endif
999
+ #endif
1000
+ EOF
1001
+ cc_set_abi=` $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^ABI' | sed ' s, ,,g' `
1002
+ eval " $cc_set_abi "
1003
+ case $ABI in
1004
+ eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
1005
+ esac
1006
+ fi
1007
+ GUESS=$CPU -unknown-linux-$LIBCABI
971
1008
;;
972
1009
aarch64_be:Linux:* :* )
973
1010
UNAME_MACHINE=aarch64_be
@@ -1033,7 +1070,16 @@ EOF
1033
1070
k1om:Linux:* :* )
1034
1071
GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
1035
1072
;;
1036
- loongarch32:Linux:* :* | loongarch64:Linux:* :* | loongarchx32:Linux:* :* )
1073
+ kvx:Linux:* :* )
1074
+ GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
1075
+ ;;
1076
+ kvx:cos:* :* )
1077
+ GUESS=$UNAME_MACHINE -unknown-cos
1078
+ ;;
1079
+ kvx:mbr:* :* )
1080
+ GUESS=$UNAME_MACHINE -unknown-mbr
1081
+ ;;
1082
+ loongarch32:Linux:* :* | loongarch64:Linux:* :* )
1037
1083
GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
1038
1084
;;
1039
1085
m32r* :Linux:* :* )
@@ -1148,16 +1194,27 @@ EOF
1148
1194
;;
1149
1195
x86_64:Linux:* :* )
1150
1196
set_cc_for_build
1197
+ CPU=$UNAME_MACHINE
1151
1198
LIBCABI=$LIBC
1152
1199
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
1200
+ ABI=64
1201
+ sed ' s/^ //' << EOF > "$dummy .c"
1202
+ #ifdef __i386__
1203
+ ABI=x86
1204
+ #else
1205
+ #ifdef __ILP32__
1206
+ ABI=x32
1207
+ #endif
1208
+ #endif
1209
+ EOF
1210
+ cc_set_abi=` $CC_FOR_BUILD -E " $dummy .c" 2> /dev/null | grep ' ^ABI' | sed ' s, ,,g' `
1211
+ eval " $cc_set_abi "
1212
+ case $ABI in
1213
+ x86) CPU=i686 ;;
1214
+ x32) LIBCABI=${LIBC} x32 ;;
1215
+ esac
1159
1216
fi
1160
- GUESS=$UNAME_MACHINE -pc-linux-$LIBCABI
1217
+ GUESS=$CPU -pc-linux-$LIBCABI
1161
1218
;;
1162
1219
xtensa* :Linux:* :* )
1163
1220
GUESS=$UNAME_MACHINE -unknown-linux-$LIBC
@@ -1177,7 +1234,7 @@ EOF
1177
1234
GUESS=$UNAME_MACHINE -pc-sysv4.2uw$UNAME_VERSION
1178
1235
;;
1179
1236
i* 86:OS/2:* :* )
1180
- # If we were able to find ` uname', then EMX Unix compatibility
1237
+ # If we were able to find ' uname', then EMX Unix compatibility
1181
1238
# is probably installed.
1182
1239
GUESS=$UNAME_MACHINE -pc-os2-emx
1183
1240
;;
@@ -1318,7 +1375,7 @@ EOF
1318
1375
GUESS=ns32k-sni-sysv
1319
1376
fi
1320
1377
;;
1321
- PENTIUM:* :4.0* :* ) # Unisys ` ClearPath HMP IX 4000' SVR4/MP effort
1378
+ PENTIUM:* :4.0* :* ) # Unisys ' ClearPath HMP IX 4000' SVR4/MP effort
1322
1379
1323
1380
GUESS=i586-unisys-sysv4
1324
1381
;;
@@ -1364,8 +1421,11 @@ EOF
1364
1421
BePC:Haiku:* :* ) # Haiku running on Intel PC compatible.
1365
1422
GUESS=i586-pc-haiku
1366
1423
;;
1367
- x86_64:Haiku:* :* )
1368
- GUESS=x86_64-unknown-haiku
1424
+ ppc:Haiku:* :* ) # Haiku running on Apple PowerPC
1425
+ GUESS=powerpc-apple-haiku
1426
+ ;;
1427
+ * :Haiku:* :* ) # Haiku modern gcc (not bound by BeOS compat)
1428
+ GUESS=$UNAME_MACHINE -unknown-haiku
1369
1429
;;
1370
1430
SX-4:SUPER-UX:* :* )
1371
1431
GUESS=sx4-nec-superux$UNAME_RELEASE
@@ -1522,6 +1582,9 @@ EOF
1522
1582
i* 86:rdos:* :* )
1523
1583
GUESS=$UNAME_MACHINE -pc-rdos
1524
1584
;;
1585
+ i* 86:Fiwix:* :* )
1586
+ GUESS=$UNAME_MACHINE -pc-fiwix
1587
+ ;;
1525
1588
* :AROS:* :* )
1526
1589
GUESS=$UNAME_MACHINE -unknown-aros
1527
1590
;;
@@ -1534,6 +1597,9 @@ EOF
1534
1597
* :Unleashed:* :* )
1535
1598
GUESS=$UNAME_MACHINE -unknown-unleashed$UNAME_RELEASE
1536
1599
;;
1600
+ * :Ironclad:* :* )
1601
+ GUESS=$UNAME_MACHINE -unknown-ironclad
1602
+ ;;
1537
1603
esac
1538
1604
1539
1605
# Do we have a guess based on uname results?
@@ -1557,6 +1623,7 @@ cat > "$dummy.c" <<EOF
1557
1623
#endif
1558
1624
#endif
1559
1625
#endif
1626
+ int
1560
1627
main ()
1561
1628
{
1562
1629
#if defined (sony)
0 commit comments