1
1
#! /bin/sh
2
2
# Configuration validation subroutine script.
3
- # Copyright 1992-2021 Free Software Foundation, Inc.
3
+ # Copyright 1992-2023 Free Software Foundation, Inc.
4
4
5
- timestamp=' 2021-04-30'
5
+ # shellcheck disable=SC2006,SC2268 # see below for rationale
6
+
7
+ timestamp=' 2023-01-21'
6
8
7
9
# This file is free software; you can redistribute it and/or modify it
8
10
# under the terms of the GNU General Public License as published by
9
- # the Free Software Foundation; either version 3 of the License, or
11
+ # the Free Software Foundation, either version 3 of the License, or
10
12
# (at your option) any later version.
11
13
#
12
14
# This program is distributed in the hope that it will be useful, but
@@ -50,7 +52,14 @@ timestamp='2021-04-30'
50
52
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
51
53
# It is wrong to echo any other type of specification.
52
54
53
- me=$( echo " $0 " | sed -e ' s,.*/,,' )
55
+ # The "shellcheck disable" line above the timestamp inhibits complaints
56
+ # about features and limitations of the classic Bourne shell that were
57
+ # superseded or lifted in POSIX. However, this script identifies a wide
58
+ # variety of pre-POSIX systems that do not have POSIX shells at all, and
59
+ # even some reasonably current systems (Solaris 10 as case-in-point) still
60
+ # have a pre-POSIX /bin/sh.
61
+
62
+ me=` echo " $0 " | sed -e ' s,.*/,,' `
54
63
55
64
usage=" \
56
65
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
67
76
version=" \
68
77
GNU config.sub ($timestamp )
69
78
70
- Copyright 1992-2021 Free Software Foundation, Inc.
79
+ Copyright 1992-2023 Free Software Foundation, Inc.
71
80
72
81
This is free software; see the source for copying conditions. There is NO
73
82
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -112,9 +121,11 @@ esac
112
121
113
122
# Split fields of configuration type
114
123
# shellcheck disable=SC2162
124
+ saved_IFS=$IFS
115
125
IFS=" -" read field1 field2 field3 field4 << EOF
116
126
$1
117
127
EOF
128
+ IFS=$saved_IFS
118
129
119
130
# Separate into logical components for further validation
120
131
case $1 in
@@ -134,7 +145,7 @@ case $1 in
134
145
nto-qnx* | linux-* | uclinux-uclibc* \
135
146
| uclinux-gnu* | kfreebsd* -gnu* | knetbsd* -gnu* | netbsd* -gnu* \
136
147
| netbsd* -eabi* | kopensolaris* -gnu* | cloudabi* -eabi* \
137
- | storm-chaos* | os2-emx* | rtmk-nova* )
148
+ | storm-chaos* | os2-emx* | rtmk-nova* | managarm- * )
138
149
basic_machine=$field1
139
150
basic_os=$maybe_os
140
151
;;
@@ -163,6 +174,10 @@ case $1 in
163
174
basic_machine=$field1
164
175
basic_os=$field2
165
176
;;
177
+ zephyr* )
178
+ basic_machine=$field1 -unknown
179
+ basic_os=$field2
180
+ ;;
166
181
# Manufacturers
167
182
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
168
183
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@@ -769,22 +784,22 @@ case $basic_machine in
769
784
vendor=hp
770
785
;;
771
786
i* 86v32)
772
- cpu=$( echo " $1 " | sed -e ' s/86.*/86/' )
787
+ cpu=` echo " $1 " | sed -e ' s/86.*/86/' `
773
788
vendor=pc
774
789
basic_os=sysv32
775
790
;;
776
791
i* 86v4* )
777
- cpu=$( echo " $1 " | sed -e ' s/86.*/86/' )
792
+ cpu=` echo " $1 " | sed -e ' s/86.*/86/' `
778
793
vendor=pc
779
794
basic_os=sysv4
780
795
;;
781
796
i* 86v)
782
- cpu=$( echo " $1 " | sed -e ' s/86.*/86/' )
797
+ cpu=` echo " $1 " | sed -e ' s/86.*/86/' `
783
798
vendor=pc
784
799
basic_os=sysv
785
800
;;
786
801
i* 86sol2)
787
- cpu=$( echo " $1 " | sed -e ' s/86.*/86/' )
802
+ cpu=` echo " $1 " | sed -e ' s/86.*/86/' `
788
803
vendor=pc
789
804
basic_os=solaris2
790
805
;;
@@ -917,14 +932,16 @@ case $basic_machine in
917
932
;;
918
933
leon-* |leon[3-9]-* )
919
934
cpu=sparc
920
- vendor=$( echo " $basic_machine " | sed ' s/-.*//' )
935
+ vendor=` echo " $basic_machine " | sed ' s/-.*//' `
921
936
;;
922
937
923
938
* -* )
924
939
# shellcheck disable=SC2162
940
+ saved_IFS=$IFS
925
941
IFS=" -" read cpu vendor << EOF
926
942
$basic_machine
927
943
EOF
944
+ IFS=$saved_IFS
928
945
;;
929
946
# We use `pc' rather than `unknown'
930
947
# because (1) that's what they normally are, and
@@ -1003,6 +1020,11 @@ case $cpu-$vendor in
1003
1020
;;
1004
1021
1005
1022
# Here we normalize CPU types with a missing or matching vendor
1023
+ armh-unknown | armh-alt)
1024
+ cpu=armv7l
1025
+ vendor=alt
1026
+ basic_os=${basic_os:- linux-gnueabihf}
1027
+ ;;
1006
1028
dpx20-unknown | dpx20-bull)
1007
1029
cpu=rs6000
1008
1030
vendor=bull
@@ -1053,7 +1075,7 @@ case $cpu-$vendor in
1053
1075
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-* )
1054
1076
cpu=i586
1055
1077
;;
1056
- pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_ * -* )
1078
+ pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_ * -* )
1057
1079
cpu=i686
1058
1080
;;
1059
1081
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-* )
@@ -1084,7 +1106,7 @@ case $cpu-$vendor in
1084
1106
cpu=mipsisa64sb1el
1085
1107
;;
1086
1108
sh5e[lb]-* )
1087
- cpu=$( echo " $cpu " | sed ' s/^\(sh.\)e\(.\)$/\1\2e/' )
1109
+ cpu=` echo " $cpu " | sed ' s/^\(sh.\)e\(.\)$/\1\2e/' `
1088
1110
;;
1089
1111
spur-* )
1090
1112
cpu=spur
@@ -1102,9 +1124,9 @@ case $cpu-$vendor in
1102
1124
cpu=x86_64
1103
1125
;;
1104
1126
xscale-* | xscalee[bl]-* )
1105
- cpu=$( echo " $cpu " | sed ' s/^xscale/arm/' )
1127
+ cpu=` echo " $cpu " | sed ' s/^xscale/arm/' `
1106
1128
;;
1107
- arm64-* )
1129
+ arm64-* | aarch64le- * )
1108
1130
cpu=aarch64
1109
1131
;;
1110
1132
@@ -1165,7 +1187,7 @@ case $cpu-$vendor in
1165
1187
| alphapca5[67] | alpha64pca5[67] \
1166
1188
| am33_2.0 \
1167
1189
| amdgcn \
1168
- | arc | arceb | arc64 \
1190
+ | arc | arceb | arc32 | arc64 \
1169
1191
| arm | arm[lb]e | arme[lb] | armv* \
1170
1192
| avr | avr32 \
1171
1193
| asmjs \
@@ -1185,7 +1207,7 @@ case $cpu-$vendor in
1185
1207
| k1om \
1186
1208
| le32 | le64 \
1187
1209
| lm32 \
1188
- | loongarch32 | loongarch64 | loongarchx32 \
1210
+ | loongarch32 | loongarch64 \
1189
1211
| m32c | m32r | m32rle \
1190
1212
| m5200 | m68000 | m680[012346]0 | m68360 | m683? 2 | m68k \
1191
1213
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
@@ -1287,35 +1309,41 @@ esac
1287
1309
if test x$basic_os ! = x
1288
1310
then
1289
1311
1290
- # First recognize some ad-hoc caes , or perhaps split kernel-os, or else just
1312
+ # First recognize some ad-hoc cases , or perhaps split kernel-os, or else just
1291
1313
# set os.
1292
1314
case $basic_os in
1293
1315
gnu/linux* )
1294
1316
kernel=linux
1295
- os=$( echo $basic_os | sed -e ' s|gnu/linux|gnu|' )
1317
+ os=` echo " $basic_os " | sed -e ' s|gnu/linux|gnu|' `
1296
1318
;;
1297
1319
os2-emx)
1298
1320
kernel=os2
1299
- os=$( echo $basic_os | sed -e ' s|os2-emx|emx|' )
1321
+ os=` echo " $basic_os " | sed -e ' s|os2-emx|emx|' `
1300
1322
;;
1301
1323
nto-qnx* )
1302
1324
kernel=nto
1303
- os=$( echo $basic_os | sed -e ' s|nto-qnx|qnx|' )
1325
+ os=` echo " $basic_os " | sed -e ' s|nto-qnx|qnx|' `
1304
1326
;;
1305
1327
* -* )
1306
1328
# shellcheck disable=SC2162
1329
+ saved_IFS=$IFS
1307
1330
IFS=" -" read kernel os << EOF
1308
1331
$basic_os
1309
1332
EOF
1333
+ IFS=$saved_IFS
1310
1334
;;
1311
1335
# Default OS when just kernel was specified
1312
1336
nto* )
1313
1337
kernel=nto
1314
- os=$( echo $basic_os | sed -e ' s|nto|qnx|' )
1338
+ os=` echo " $basic_os " | sed -e ' s|nto|qnx|' `
1315
1339
;;
1316
1340
linux* )
1317
1341
kernel=linux
1318
- os=$( echo $basic_os | sed -e ' s|linux|gnu|' )
1342
+ os=` echo " $basic_os " | sed -e ' s|linux|gnu|' `
1343
+ ;;
1344
+ managarm* )
1345
+ kernel=managarm
1346
+ os=` echo " $basic_os " | sed -e ' s|managarm|mlibc|' `
1319
1347
;;
1320
1348
* )
1321
1349
kernel=
@@ -1336,7 +1364,7 @@ case $os in
1336
1364
os=cnk
1337
1365
;;
1338
1366
solaris1 | solaris1.* )
1339
- os=$( echo $os | sed -e ' s|solaris1|sunos4|' )
1367
+ os=` echo " $os " | sed -e ' s|solaris1|sunos4|' `
1340
1368
;;
1341
1369
solaris)
1342
1370
os=solaris2
@@ -1365,7 +1393,7 @@ case $os in
1365
1393
os=sco3.2v4
1366
1394
;;
1367
1395
sco3.2.[4-9]* )
1368
- os=$( echo $os | sed -e ' s/sco3.2./sco3.2v/' )
1396
+ os=` echo " $os " | sed -e ' s/sco3.2./sco3.2v/' `
1369
1397
;;
1370
1398
sco* v* | scout)
1371
1399
# Don't match below
@@ -1395,7 +1423,7 @@ case $os in
1395
1423
os=lynxos
1396
1424
;;
1397
1425
mac[0-9]* )
1398
- os=$( echo " $os " | sed -e ' s|mac|macos|' )
1426
+ os=` echo " $os " | sed -e ' s|mac|macos|' `
1399
1427
;;
1400
1428
opened* )
1401
1429
os=openedition
@@ -1404,10 +1432,10 @@ case $os in
1404
1432
os=os400
1405
1433
;;
1406
1434
sunos5* )
1407
- os=$( echo " $os " | sed -e ' s|sunos5|solaris2|' )
1435
+ os=` echo " $os " | sed -e ' s|sunos5|solaris2|' `
1408
1436
;;
1409
1437
sunos6* )
1410
- os=$( echo " $os " | sed -e ' s|sunos6|solaris3|' )
1438
+ os=` echo " $os " | sed -e ' s|sunos6|solaris3|' `
1411
1439
;;
1412
1440
wince* )
1413
1441
os=wince
@@ -1441,7 +1469,7 @@ case $os in
1441
1469
;;
1442
1470
# Preserve the version number of sinix5.
1443
1471
sinix5.* )
1444
- os=$( echo $os | sed -e ' s|sinix|sysv|' )
1472
+ os=` echo " $os " | sed -e ' s|sinix|sysv|' `
1445
1473
;;
1446
1474
sinix* )
1447
1475
os=sysv4
1688
1716
# Now, validate our (potentially fixed-up) OS.
1689
1717
case $os in
1690
1718
# Sometimes we do "kernel-libc", so those need to count as OSes.
1691
- musl* | newlib* | uclibc* )
1719
+ musl* | newlib* | relibc * | uclibc* )
1692
1720
;;
1693
1721
# Likewise for "kernel-abi"
1694
1722
eabi* | gnueabi* )
@@ -1729,14 +1757,18 @@ case $os in
1729
1757
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
1730
1758
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1731
1759
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1732
- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* )
1760
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1761
+ | fiwix* | mlibc* )
1733
1762
;;
1734
1763
# This one is extra strict with allowed versions
1735
1764
sco3.2v2 | sco3.2v[4-9]* | sco5v6* )
1736
1765
# Don't forget version if it is 3.2v4 or newer.
1737
1766
;;
1738
1767
none)
1739
1768
;;
1769
+ kernel* )
1770
+ # Restricted further below
1771
+ ;;
1740
1772
* )
1741
1773
echo Invalid configuration \` " $1 " \' : OS \` " $os " \' not recognized 1>&2
1742
1774
exit 1
@@ -1746,16 +1778,27 @@ esac
1746
1778
# As a final step for OS-related things, validate the OS-kernel combination
1747
1779
# (given a valid OS), if there is a kernel.
1748
1780
case $kernel -$os in
1749
- linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
1781
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1782
+ | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
1750
1783
;;
1751
1784
uclinux-uclibc* )
1752
1785
;;
1753
- -dietlibc* | -newlib* | -musl* | -uclibc* )
1786
+ managarm-mlibc* | managarm-kernel* )
1787
+ ;;
1788
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
1754
1789
# These are just libc implementations, not actual OSes, and thus
1755
1790
# require a kernel.
1756
1791
echo " Invalid configuration \` $1 ': libc \` $os ' needs explicit kernel." 1>&2
1757
1792
exit 1
1758
1793
;;
1794
+ -kernel* )
1795
+ echo " Invalid configuration \` $1 ': \` $os ' needs explicit kernel." 1>&2
1796
+ exit 1
1797
+ ;;
1798
+ * -kernel* )
1799
+ echo " Invalid configuration \` $1 ': \` $kernel ' does not support \` $os '." 1>&2
1800
+ exit 1
1801
+ ;;
1759
1802
kfreebsd* -gnu* | kopensolaris* -gnu* )
1760
1803
;;
1761
1804
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
0 commit comments