]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - config.sub
ncurses 6.3 - patch 20220312
[ncurses.git] / config.sub
index 3eda71f232c18be5585794bd49efefc2d16dd74d..dba16e84c77c7d25871d80c24deff717faf4c094 100755 (executable)
@@ -1,13 +1,14 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 2021 Thomas E. Dickey
-#   Copyright 1992-2021 Free Software Foundation, Inc.
+#   Copyright 1992-2022 Free Software Foundation, Inc.
 
-timestamp='2021-04-30'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2022-01-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -51,6 +52,13 @@ timestamp='2021-04-30'
 #      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
@@ -68,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2021 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -113,9 +121,11 @@ esac
 
 # Split fields of configuration type
 # shellcheck disable=SC2162
+saved_IFS=$IFS
 IFS="-" read field1 field2 field3 field4 <<EOF
 $1
 EOF
+IFS=$saved_IFS
 
 # Separate into logical components for further validation
 case $1 in
@@ -164,6 +174,10 @@ case $1 in
                                                basic_machine=$field1
                                                basic_os=$field2
                                                ;;
+                                       zephyr*)
+                                               basic_machine=$field1-unknown
+                                               basic_os=$field2
+                                               ;;
                                        # Manufacturers
                                        dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
                                        | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@@ -923,9 +937,11 @@ case $basic_machine in
 
        *-*)
                # shellcheck disable=SC2162
+               saved_IFS=$IFS
                IFS="-" read cpu vendor <<EOF
 $basic_machine
 EOF
+               IFS=$saved_IFS
                ;;
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
@@ -1004,6 +1020,11 @@ case $cpu-$vendor in
                ;;
 
        # Here we normalize CPU types with a missing or matching vendor
+       armh-unknown | armh-alt)
+               cpu=armv7l
+               vendor=alt
+               basic_os=${basic_os:-linux-gnueabihf}
+               ;;
        dpx20-unknown | dpx20-bull)
                cpu=rs6000
                vendor=bull
@@ -1105,7 +1126,7 @@ case $cpu-$vendor in
        xscale-* | xscalee[bl]-*)
                cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
                ;;
-       arm64-*)
+       arm64-* | aarch64le-*)
                cpu=aarch64
                ;;
 
@@ -1166,7 +1187,7 @@ case $cpu-$vendor in
                        | alphapca5[67] | alpha64pca5[67] \
                        | am33_2.0 \
                        | amdgcn \
-                       | arc | arceb | arc64 \
+                       | arc | arceb | arc32 | arc64 \
                        | arm | arm[lb]e | arme[lb] | armv* \
                        | avr | avr32 \
                        | asmjs \
@@ -1288,35 +1309,37 @@ esac
 if test x$basic_os != x
 then
 
-# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
 # set os.
 case $basic_os in
        gnu/linux*)
                kernel=linux
-               os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'`
+               os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
                ;;
        os2-emx)
                kernel=os2
-               os=`echo $basic_os | sed -e 's|os2-emx|emx|'`
+               os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
                ;;
        nto-qnx*)
                kernel=nto
-               os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'`
+               os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
                ;;
        *-*)
                # shellcheck disable=SC2162
+               saved_IFS=$IFS
                IFS="-" read kernel os <<EOF
 $basic_os
 EOF
+               IFS=$saved_IFS
                ;;
        # Default OS when just kernel was specified
        nto*)
                kernel=nto
-               os=`echo $basic_os | sed -e 's|nto|qnx|'`
+               os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
                ;;
        linux*)
                kernel=linux
-               os=`echo $basic_os | sed -e 's|linux|gnu|'`
+               os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
                ;;
        *)
                kernel=
@@ -1337,7 +1360,7 @@ case $os in
                os=cnk
                ;;
        solaris1 | solaris1.*)
-               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
                ;;
        solaris)
                os=solaris2
@@ -1366,7 +1389,7 @@ case $os in
                os=sco3.2v4
                ;;
        sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
                ;;
        sco*v* | scout)
                # Don't match below
@@ -1442,7 +1465,7 @@ case $os in
                ;;
        # Preserve the version number of sinix5.
        sinix5.*)
-               os=`echo $os | sed -e 's|sinix|sysv|'`
+               os=`echo "$os" | sed -e 's|sinix|sysv|'`
                ;;
        sinix*)
                os=sysv4
@@ -1689,7 +1712,7 @@ fi
 # Now, validate our (potentially fixed-up) OS.
 case $os in
        # Sometimes we do "kernel-libc", so those need to count as OSes.
-       musl* | newlib* | uclibc*)
+       musl* | newlib* | relibc* | uclibc*)
                ;;
        # Likewise for "kernel-abi"
        eabi* | gnueabi*)
@@ -1730,7 +1753,8 @@ case $os in
             | skyos* | haiku* | rdos* | toppers* | drops* | es* \
             | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
             | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
-            | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
+            | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+            | fiwix* )
                ;;
        # This one is extra strict with allowed versions
        sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1747,11 +1771,12 @@ esac
 # As a final step for OS-related things, validate the OS-kernel combination
 # (given a valid OS), if there is a kernel.
 case $kernel-$os in
-       linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
+       linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+                  | linux-musl* | linux-relibc* | linux-uclibc* )
                ;;
        uclinux-uclibc* )
                ;;
-       -dietlibc* | -newlib* | -musl* | -uclibc* )
+       -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
                # These are just libc implementations, not actual OSes, and thus
                # require a kernel.
                echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2