Show
Ignore:
Timestamp:
08/16/22 16:20:56 (2 years ago)
Author:
jwoithe
Message:

admin/config.guess: update to latest version.

As pointed out by Letu Ren on the ffado-devel mailing list, the version of
config.guess included with FFADO was dated 2013-06-10. Due to its age it
failed to identify newer architectures such as RISCV64. Thanks to Letu Ren
for bringing this to our attention.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/admin/config.guess

    r2456 r2833  
    11#! /bin/sh 
    22# Attempt to guess a canonical system name. 
    3 #   Copyright 1992-2013 Free Software Foundation, Inc. 
    4  
    5 timestamp='2013-06-10' 
     3#   Copyright 1992-2022 Free Software Foundation, Inc. 
     4 
     5# shellcheck disable=SC2006,SC2268 # see below for rationale 
     6 
     7timestamp='2022-05-25' 
    68 
    79# This file is free software; you can redistribute it and/or modify it 
    810# 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 
    1012# (at your option) any later version. 
    1113# 
     
    1618# 
    1719# You should have received a copy of the GNU General Public License 
    18 # along with this program; if not, see <http://www.gnu.org/licenses/>. 
     20# along with this program; if not, see <https://www.gnu.org/licenses/>. 
    1921# 
    2022# As a special exception to the GNU General Public License, if you 
     
    2527# of the GNU General Public License, version 3 ("GPLv3"). 
    2628# 
    27 # Originally written by Per Bothner
     29# Originally written by Per Bothner; maintained since 2000 by Ben Elliston
    2830# 
    2931# You can get the latest version of this script from: 
    30 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD 
     32# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess 
    3133# 
    32 # Please send patches with a ChangeLog entry to config-patches@gnu.org. 
     34# Please send patches to <config-patches@gnu.org>. 
     35 
     36 
     37# The "shellcheck disable" line above the timestamp inhibits complaints 
     38# about features and limitations of the classic Bourne shell that were 
     39# superseded or lifted in POSIX.  However, this script identifies a wide 
     40# variety of pre-POSIX systems that do not have POSIX shells at all, and 
     41# even some reasonably current systems (Solaris 10 as case-in-point) still 
     42# have a pre-POSIX /bin/sh. 
    3343 
    3444 
     
    4050Output the configuration name of the system \`$me' is run on. 
    4151 
    42 Operation modes: 
     52Options: 
    4353  -h, --help         print this help, then exit 
    4454  -t, --time-stamp   print date of last modification, then exit 
     
    5161 
    5262Originally written by Per Bothner. 
    53 Copyright 1992-2013 Free Software Foundation, Inc. 
     63Copyright 1992-2022 Free Software Foundation, Inc. 
    5464 
    5565This is free software; see the source for copying conditions.  There is NO 
     
    8595fi 
    8696 
    87 trap 'exit 1' 1 2 15 
     97# Just in case it came from the environment. 
     98GUESS= 
    8899 
    89100# CC_FOR_BUILD -- compiler used by this script. Note that the use of a 
     
    97108# Portable tmp directory creation inspired by the Autoconf team. 
    98109 
    99 set_cc_for_build=' 
    100 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; 
    101 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; 
    102 : ${TMPDIR=/tmp} ; 
    103  { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || 
    104  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || 
    105  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || 
    106  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; 
    107 dummy=$tmp/dummy ; 
    108 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; 
    109 case $CC_FOR_BUILD,$HOST_CC,$CC in 
    110  ,,)    echo "int x;" > $dummy.c ; 
    111         for c in cc gcc c89 c99 ; do 
    112           if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then 
    113              CC_FOR_BUILD="$c"; break ; 
    114           fi ; 
    115         done ; 
    116         if test x"$CC_FOR_BUILD" = x ; then 
    117           CC_FOR_BUILD=no_compiler_found ; 
    118         fi 
    119         ;; 
    120  ,,*)   CC_FOR_BUILD=$CC ;; 
    121  ,*,*)  CC_FOR_BUILD=$HOST_CC ;; 
    122 esac ; set_cc_for_build= ;' 
     110tmp= 
     111# shellcheck disable=SC2172 
     112trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 
     113 
     114set_cc_for_build() { 
     115    # prevent multiple calls if $tmp is already set 
     116    test "$tmp" && return 0 
     117    : "${TMPDIR=/tmp}" 
     118    # shellcheck disable=SC2039,SC3028 
     119    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || 
     120        { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || 
     121        { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || 
     122        { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } 
     123    dummy=$tmp/dummy 
     124    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in 
     125        ,,)    echo "int x;" > "$dummy.c" 
     126               for driver in cc gcc c89 c99 ; do 
     127                   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then 
     128                       CC_FOR_BUILD=$driver 
     129                       break 
     130                   fi 
     131               done 
     132               if test x"$CC_FOR_BUILD" = x ; then 
     133                   CC_FOR_BUILD=no_compiler_found 
     134               fi 
     135               ;; 
     136        ,,*)   CC_FOR_BUILD=$CC ;; 
     137        ,*,*)  CC_FOR_BUILD=$HOST_CC ;; 
     138    esac 
     139
    123140 
    124141# This is needed to find uname on a Pyramid OSx when run in the BSD universe. 
    125142# (ghazi@noc.rutgers.edu 1994-08-24) 
    126 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then 
     143if test -f /.attbin/uname ; then 
    127144        PATH=$PATH:/.attbin ; export PATH 
    128145fi 
     
    130147UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown 
    131148UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 
    132 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 
     149UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 
    133150UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown 
    134151 
    135 case "${UNAME_SYSTEM}" in 
     152case $UNAME_SYSTEM in 
    136153Linux|GNU|GNU/*) 
    137         # If the system lacks a compiler, then just pick glibc. 
    138         # We could probably try harder. 
    139         LIBC=gnu 
    140  
    141         eval $set_cc_for_build 
    142         cat <<-EOF > $dummy.c 
     154        LIBC=unknown 
     155 
     156        set_cc_for_build 
     157        cat <<-EOF > "$dummy.c" 
    143158        #include <features.h> 
    144159        #if defined(__UCLIBC__) 
     
    146161        #elif defined(__dietlibc__) 
    147162        LIBC=dietlibc 
     163        #elif defined(__GLIBC__) 
     164        LIBC=gnu 
    148165        #else 
    149         LIBC=gnu 
     166        #include <stdarg.h> 
     167        /* First heuristic to detect musl libc.  */ 
     168        #ifdef __DEFINED_va_list 
     169        LIBC=musl 
     170        #endif 
    150171        #endif 
    151172        EOF 
    152         eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` 
     173        cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` 
     174        eval "$cc_set_libc" 
     175 
     176        # Second heuristic to detect musl libc. 
     177        if [ "$LIBC" = unknown ] && 
     178           command -v ldd >/dev/null && 
     179           ldd --version 2>&1 | grep -q ^musl; then 
     180                LIBC=musl 
     181        fi 
     182 
     183        # If the system lacks a compiler, then just pick glibc. 
     184        # We could probably try harder. 
     185        if [ "$LIBC" = unknown ]; then 
     186                LIBC=gnu 
     187        fi 
    153188        ;; 
    154189esac 
     
    156191# Note: order is significant - the case branches are not exclusive. 
    157192 
    158 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 
     193case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in 
    159194    *:NetBSD:*:*) 
    160195        # NetBSD (nbsd) targets should (where applicable) match one or 
     
    168203        # Note: NetBSD doesn't particularly care about the vendor 
    169204        # portion of the name.  We always set it to "unknown". 
    170         sysctl="sysctl -n hw.machine_arch" 
    171         UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ 
    172             /usr/sbin/$sysctl 2>/dev/null || echo unknown)` 
    173         case "${UNAME_MACHINE_ARCH}" in 
     205        UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ 
     206            /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ 
     207            /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ 
     208            echo unknown)` 
     209        case $UNAME_MACHINE_ARCH in 
     210            aarch64eb) machine=aarch64_be-unknown ;; 
    174211            armeb) machine=armeb-unknown ;; 
    175212            arm*) machine=arm-unknown ;; 
     
    177214            sh3eb) machine=sh-unknown ;; 
    178215            sh5el) machine=sh5le-unknown ;; 
    179             *) machine=${UNAME_MACHINE_ARCH}-unknown ;; 
     216            earmv*) 
     217                arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` 
     218                endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` 
     219                machine=${arch}${endian}-unknown 
     220                ;; 
     221            *) machine=$UNAME_MACHINE_ARCH-unknown ;; 
    180222        esac 
    181223        # The Operating System including object format, if it has switched 
    182         # to ELF recently, or will in the future. 
    183         case "${UNAME_MACHINE_ARCH}" in 
     224        # to ELF recently (or will in the future) and ABI. 
     225        case $UNAME_MACHINE_ARCH in 
     226            earm*) 
     227                os=netbsdelf 
     228                ;; 
    184229            arm*|i386|m68k|ns32k|sh3*|sparc|vax) 
    185                 eval $set_cc_for_build 
     230                set_cc_for_build 
    186231                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 
    187232                        | grep -q __ELF__ 
     
    198243                ;; 
    199244        esac 
     245        # Determine ABI tags. 
     246        case $UNAME_MACHINE_ARCH in 
     247            earm*) 
     248                expr='s/^earmv[0-9]/-eabi/;s/eb$//' 
     249                abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` 
     250                ;; 
     251        esac 
    200252        # The OS release 
    201253        # Debian GNU/NetBSD machines have a different userland, and 
     
    203255        # kernel version information, so it can be replaced with a 
    204256        # suitable tag, in the style of linux-gnu. 
    205         case "${UNAME_VERSION}" in 
     257        case $UNAME_VERSION in 
    206258            Debian*) 
    207259                release='-gnu' 
    208260                ;; 
    209261            *) 
    210                 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'
     262                release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2
    211263                ;; 
    212264        esac 
     
    214266        # contains redundant information, the shorter form: 
    215267        # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. 
    216         echo "${machine}-${os}${release}" 
    217         exit ;; 
     268        GUESS=$machine-${os}${release}${abi-} 
     269        ;; 
    218270    *:Bitrig:*:*) 
    219271        UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` 
    220         echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} 
    221         exit ;; 
     272        GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE 
     273        ;; 
    222274    *:OpenBSD:*:*) 
    223275        UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` 
    224         echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} 
    225         exit ;; 
     276        GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE 
     277        ;; 
     278    *:SecBSD:*:*) 
     279        UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` 
     280        GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE 
     281        ;; 
     282    *:LibertyBSD:*:*) 
     283        UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` 
     284        GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE 
     285        ;; 
     286    *:MidnightBSD:*:*) 
     287        GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE 
     288        ;; 
    226289    *:ekkoBSD:*:*) 
    227         echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} 
    228         exit ;; 
     290        GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE 
     291        ;; 
    229292    *:SolidBSD:*:*) 
    230         echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} 
    231         exit ;; 
     293        GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE 
     294        ;; 
     295    *:OS108:*:*) 
     296        GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE 
     297        ;; 
    232298    macppc:MirBSD:*:*) 
    233         echo powerpc-unknown-mirbsd${UNAME_RELEASE} 
    234         exit ;; 
     299        GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE 
     300        ;; 
    235301    *:MirBSD:*:*) 
    236         echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} 
    237         exit ;; 
     302        GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE 
     303        ;; 
     304    *:Sortix:*:*) 
     305        GUESS=$UNAME_MACHINE-unknown-sortix 
     306        ;; 
     307    *:Twizzler:*:*) 
     308        GUESS=$UNAME_MACHINE-unknown-twizzler 
     309        ;; 
     310    *:Redox:*:*) 
     311        GUESS=$UNAME_MACHINE-unknown-redox 
     312        ;; 
     313    mips:OSF1:*.*) 
     314        GUESS=mips-dec-osf1 
     315        ;; 
    238316    alpha:OSF1:*:*) 
     317        # Reset EXIT trap before exiting to avoid spurious non-zero exit code. 
     318        trap '' 0 
    239319        case $UNAME_RELEASE in 
    240320        *4.0) 
     
    250330        # types through head -n 1, so we only detect the type of CPU 0. 
    251331        ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1` 
    252         case "$ALPHA_CPU_TYPE" in 
     332        case $ALPHA_CPU_TYPE in 
    253333            "EV4 (21064)") 
    254                 UNAME_MACHINE="alpha" ;; 
     334                UNAME_MACHINE=alpha ;; 
    255335            "EV4.5 (21064)") 
    256                 UNAME_MACHINE="alpha" ;; 
     336                UNAME_MACHINE=alpha ;; 
    257337            "LCA4 (21066/21068)") 
    258                 UNAME_MACHINE="alpha" ;; 
     338                UNAME_MACHINE=alpha ;; 
    259339            "EV5 (21164)") 
    260                 UNAME_MACHINE="alphaev5" ;; 
     340                UNAME_MACHINE=alphaev5 ;; 
    261341            "EV5.6 (21164A)") 
    262                 UNAME_MACHINE="alphaev56" ;; 
     342                UNAME_MACHINE=alphaev56 ;; 
    263343            "EV5.6 (21164PC)") 
    264                 UNAME_MACHINE="alphapca56" ;; 
     344                UNAME_MACHINE=alphapca56 ;; 
    265345            "EV5.7 (21164PC)") 
    266                 UNAME_MACHINE="alphapca57" ;; 
     346                UNAME_MACHINE=alphapca57 ;; 
    267347            "EV6 (21264)") 
    268                 UNAME_MACHINE="alphaev6" ;; 
     348                UNAME_MACHINE=alphaev6 ;; 
    269349            "EV6.7 (21264A)") 
    270                 UNAME_MACHINE="alphaev67" ;; 
     350                UNAME_MACHINE=alphaev67 ;; 
    271351            "EV6.8CB (21264C)") 
    272                 UNAME_MACHINE="alphaev68" ;; 
     352                UNAME_MACHINE=alphaev68 ;; 
    273353            "EV6.8AL (21264B)") 
    274                 UNAME_MACHINE="alphaev68" ;; 
     354                UNAME_MACHINE=alphaev68 ;; 
    275355            "EV6.8CX (21264D)") 
    276                 UNAME_MACHINE="alphaev68" ;; 
     356                UNAME_MACHINE=alphaev68 ;; 
    277357            "EV6.9A (21264/EV69A)") 
    278                 UNAME_MACHINE="alphaev69" ;; 
     358                UNAME_MACHINE=alphaev69 ;; 
    279359            "EV7 (21364)") 
    280                 UNAME_MACHINE="alphaev7" ;; 
     360                UNAME_MACHINE=alphaev7 ;; 
    281361            "EV7.9 (21364A)") 
    282                 UNAME_MACHINE="alphaev79" ;; 
     362                UNAME_MACHINE=alphaev79 ;; 
    283363        esac 
    284364        # A Pn.n version is a patched version. 
     
    287367        # A Xn.n version is an unreleased experimental baselevel. 
    288368        # 1.2 uses "1.2" for uname -r. 
    289         echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 
    290         # Reset EXIT trap before exiting to avoid spurious non-zero exit code. 
    291         exitcode=$? 
    292         trap '' 0 
    293         exit $exitcode ;; 
    294     Alpha\ *:Windows_NT*:*) 
    295         # How do we know it's Interix rather than the generic POSIX subsystem? 
    296         # Should we change UNAME_MACHINE based on the output of uname instead 
    297         # of the specific Alpha model? 
    298         echo alpha-pc-interix 
    299         exit ;; 
    300     21064:Windows_NT:50:3) 
    301         echo alpha-dec-winnt3.5 
    302         exit ;; 
     369        OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` 
     370        GUESS=$UNAME_MACHINE-dec-osf$OSF_REL 
     371        ;; 
    303372    Amiga*:UNIX_System_V:4.0:*) 
    304         echo m68k-unknown-sysv4 
    305         exit ;; 
     373        GUESS=m68k-unknown-sysv4 
     374        ;; 
    306375    *:[Aa]miga[Oo][Ss]:*:*) 
    307         echo ${UNAME_MACHINE}-unknown-amigaos 
    308         exit ;; 
     376        GUESS=$UNAME_MACHINE-unknown-amigaos 
     377        ;; 
    309378    *:[Mm]orph[Oo][Ss]:*:*) 
    310         echo ${UNAME_MACHINE}-unknown-morphos 
    311         exit ;; 
     379        GUESS=$UNAME_MACHINE-unknown-morphos 
     380        ;; 
    312381    *:OS/390:*:*) 
    313         echo i370-ibm-openedition 
    314         exit ;; 
     382        GUESS=i370-ibm-openedition 
     383        ;; 
    315384    *:z/VM:*:*) 
    316         echo s390-ibm-zvmoe 
    317         exit ;; 
     385        GUESS=s390-ibm-zvmoe 
     386        ;; 
    318387    *:OS400:*:*) 
    319         echo powerpc-ibm-os400 
    320         exit ;; 
     388        GUESS=powerpc-ibm-os400 
     389        ;; 
    321390    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) 
    322         echo arm-acorn-riscix${UNAME_RELEASE} 
    323         exit ;; 
     391        GUESS=arm-acorn-riscix$UNAME_RELEASE 
     392        ;; 
    324393    arm*:riscos:*:*|arm*:RISCOS:*:*) 
    325         echo arm-unknown-riscos 
    326         exit ;; 
     394        GUESS=arm-unknown-riscos 
     395        ;; 
    327396    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) 
    328         echo hppa1.1-hitachi-hiuxmpp 
    329         exit ;; 
     397        GUESS=hppa1.1-hitachi-hiuxmpp 
     398        ;; 
    330399    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) 
    331400        # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. 
    332         if test "`(/bin/universe) 2>/dev/null`" = att ; then 
    333                 echo pyramid-pyramid-sysv3 
    334         else 
    335                 echo pyramid-pyramid-bsd 
    336         fi 
    337         exit ;; 
     401        case `(/bin/universe) 2>/dev/null` in 
     402            att) GUESS=pyramid-pyramid-sysv3 ;; 
     403            *)   GUESS=pyramid-pyramid-bsd   ;; 
     404        esac 
     405        ;; 
    338406    NILE*:*:*:dcosx) 
    339         echo pyramid-pyramid-svr4 
    340         exit ;; 
     407        GUESS=pyramid-pyramid-svr4 
     408        ;; 
    341409    DRS?6000:unix:4.0:6*) 
    342         echo sparc-icl-nx6 
    343         exit ;; 
     410        GUESS=sparc-icl-nx6 
     411        ;; 
    344412    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) 
    345413        case `/usr/bin/uname -p` in 
    346             sparc) echo sparc-icl-nx7; exit ;; 
    347         esac ;; 
     414            sparc) GUESS=sparc-icl-nx7 ;; 
     415        esac 
     416        ;; 
    348417    s390x:SunOS:*:*) 
    349         echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
    350         exit ;; 
     418        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 
     419        GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL 
     420        ;; 
    351421    sun4H:SunOS:5.*:*) 
    352         echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
    353         exit ;; 
     422        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 
     423        GUESS=sparc-hal-solaris2$SUN_REL 
     424        ;; 
    354425    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) 
    355         echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
    356         exit ;; 
     426        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 
     427        GUESS=sparc-sun-solaris2$SUN_REL 
     428        ;; 
    357429    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) 
    358         echo i386-pc-auroraux${UNAME_RELEASE} 
    359         exit ;; 
     430        GUESS=i386-pc-auroraux$UNAME_RELEASE 
     431        ;; 
    360432    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) 
    361         eval $set_cc_for_build 
    362         SUN_ARCH="i386" 
     433        set_cc_for_build 
     434        SUN_ARCH=i386 
    363435        # If there is a compiler, see if it is configured for 64-bit objects. 
    364436        # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. 
    365437        # This test works for both compilers. 
    366         if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then 
     438        if test "$CC_FOR_BUILD" != no_compiler_found; then 
    367439            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ 
    368                 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ 
     440                (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ 
    369441                grep IS_64BIT_ARCH >/dev/null 
    370442            then 
    371                 SUN_ARCH="x86_64" 
     443                SUN_ARCH=x86_64 
    372444            fi 
    373445        fi 
    374         echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
    375         exit ;; 
     446        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 
     447        GUESS=$SUN_ARCH-pc-solaris2$SUN_REL 
     448        ;; 
    376449    sun4*:SunOS:6*:*) 
    377450        # According to config.sub, this is the proper way to canonicalize 
    378451        # SunOS6.  Hard to guess exactly what SunOS6 will be like, but 
    379452        # it's likely to be more like Solaris than SunOS4. 
    380         echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
    381         exit ;; 
     453        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 
     454        GUESS=sparc-sun-solaris3$SUN_REL 
     455        ;; 
    382456    sun4*:SunOS:*:*) 
    383         case "`/usr/bin/arch -k`" in 
     457        case `/usr/bin/arch -k` in 
    384458            Series*|S4*) 
    385459                UNAME_RELEASE=`uname -v` 
     
    387461        esac 
    388462        # Japanese Language versions have a version number like `4.1.3-JL'. 
    389         echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` 
    390         exit ;; 
     463        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` 
     464        GUESS=sparc-sun-sunos$SUN_REL 
     465        ;; 
    391466    sun3*:SunOS:*:*) 
    392         echo m68k-sun-sunos${UNAME_RELEASE} 
    393         exit ;; 
     467        GUESS=m68k-sun-sunos$UNAME_RELEASE 
     468        ;; 
    394469    sun*:*:4.2BSD:*) 
    395470        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 
    396         test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 
    397         case "`/bin/arch`" in 
     471        test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 
     472        case `/bin/arch` in 
    398473            sun3) 
    399                 echo m68k-sun-sunos${UNAME_RELEASE} 
     474                GUESS=m68k-sun-sunos$UNAME_RELEASE 
    400475                ;; 
    401476            sun4) 
    402                 echo sparc-sun-sunos${UNAME_RELEASE} 
     477                GUESS=sparc-sun-sunos$UNAME_RELEASE 
    403478                ;; 
    404479        esac 
    405         exit ;; 
     480        ;; 
    406481    aushp:SunOS:*:*) 
    407         echo sparc-auspex-sunos${UNAME_RELEASE} 
    408         exit ;; 
     482        GUESS=sparc-auspex-sunos$UNAME_RELEASE 
     483        ;; 
    409484    # The situation for MiNT is a little confusing.  The machine name 
    410485    # can be virtually everything (everything which is not 
     
    416491    # be no problem. 
    417492    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) 
    418         echo m68k-atari-mint${UNAME_RELEASE} 
    419         exit ;; 
     493        GUESS=m68k-atari-mint$UNAME_RELEASE 
     494        ;; 
    420495    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) 
    421         echo m68k-atari-mint${UNAME_RELEASE} 
    422         exit ;; 
     496        GUESS=m68k-atari-mint$UNAME_RELEASE 
     497        ;; 
    423498    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) 
    424         echo m68k-atari-mint${UNAME_RELEASE} 
    425         exit ;; 
     499        GUESS=m68k-atari-mint$UNAME_RELEASE 
     500        ;; 
    426501    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) 
    427         echo m68k-milan-mint${UNAME_RELEASE} 
    428         exit ;; 
     502        GUESS=m68k-milan-mint$UNAME_RELEASE 
     503        ;; 
    429504    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) 
    430         echo m68k-hades-mint${UNAME_RELEASE} 
    431         exit ;; 
     505        GUESS=m68k-hades-mint$UNAME_RELEASE 
     506        ;; 
    432507    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) 
    433         echo m68k-unknown-mint${UNAME_RELEASE} 
    434         exit ;; 
     508        GUESS=m68k-unknown-mint$UNAME_RELEASE 
     509        ;; 
    435510    m68k:machten:*:*) 
    436         echo m68k-apple-machten${UNAME_RELEASE} 
    437         exit ;; 
     511        GUESS=m68k-apple-machten$UNAME_RELEASE 
     512        ;; 
    438513    powerpc:machten:*:*) 
    439         echo powerpc-apple-machten${UNAME_RELEASE} 
    440         exit ;; 
     514        GUESS=powerpc-apple-machten$UNAME_RELEASE 
     515        ;; 
    441516    RISC*:Mach:*:*) 
    442         echo mips-dec-mach_bsd4.3 
    443         exit ;; 
     517        GUESS=mips-dec-mach_bsd4.3 
     518        ;; 
    444519    RISC*:ULTRIX:*:*) 
    445         echo mips-dec-ultrix${UNAME_RELEASE} 
    446         exit ;; 
     520        GUESS=mips-dec-ultrix$UNAME_RELEASE 
     521        ;; 
    447522    VAX*:ULTRIX*:*:*) 
    448         echo vax-dec-ultrix${UNAME_RELEASE} 
    449         exit ;; 
     523        GUESS=vax-dec-ultrix$UNAME_RELEASE 
     524        ;; 
    450525    2020:CLIX:*:* | 2430:CLIX:*:*) 
    451         echo clipper-intergraph-clix${UNAME_RELEASE} 
    452         exit ;; 
     526        GUESS=clipper-intergraph-clix$UNAME_RELEASE 
     527        ;; 
    453528    mips:*:*:UMIPS | mips:*:*:RISCos) 
    454         eval $set_cc_for_build 
    455         sed 's/^        //' << EOF >$dummy.c 
     529        set_cc_for_build 
     530        sed 's/^        //' << EOF > "$dummy.c" 
    456531#ifdef __cplusplus 
    457532#include <stdio.h>  /* for printf() prototype */ 
     
    462537        #if defined (host_mips) && defined (MIPSEB) 
    463538        #if defined (SYSTYPE_SYSV) 
    464           printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); 
     539          printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); 
    465540        #endif 
    466541        #if defined (SYSTYPE_SVR4) 
    467           printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); 
     542          printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); 
    468543        #endif 
    469544        #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) 
    470           printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); 
     545          printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); 
    471546        #endif 
    472547        #endif 
     
    474549        } 
    475550EOF 
    476         $CC_FOR_BUILD -o $dummy $dummy.c && 
    477           dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && 
    478           SYSTEM_NAME=`$dummy $dummyarg` && 
     551        $CC_FOR_BUILD -o "$dummy" "$dummy.c" && 
     552          dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && 
     553          SYSTEM_NAME=`"$dummy" "$dummyarg"` && 
    479554            { echo "$SYSTEM_NAME"; exit; } 
    480         echo mips-mips-riscos${UNAME_RELEASE} 
    481         exit ;; 
     555        GUESS=mips-mips-riscos$UNAME_RELEASE 
     556        ;; 
    482557    Motorola:PowerMAX_OS:*:*) 
    483         echo powerpc-motorola-powermax 
    484         exit ;; 
     558        GUESS=powerpc-motorola-powermax 
     559        ;; 
    485560    Motorola:*:4.3:PL8-*) 
    486         echo powerpc-harris-powermax 
    487         exit ;; 
     561        GUESS=powerpc-harris-powermax 
     562        ;; 
    488563    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) 
    489         echo powerpc-harris-powermax 
    490         exit ;; 
     564        GUESS=powerpc-harris-powermax 
     565        ;; 
    491566    Night_Hawk:Power_UNIX:*:*) 
    492         echo powerpc-harris-powerunix 
    493         exit ;; 
     567        GUESS=powerpc-harris-powerunix 
     568        ;; 
    494569    m88k:CX/UX:7*:*) 
    495         echo m88k-harris-cxux7 
    496         exit ;; 
     570        GUESS=m88k-harris-cxux7 
     571        ;; 
    497572    m88k:*:4*:R4*) 
    498         echo m88k-motorola-sysv4 
    499         exit ;; 
     573        GUESS=m88k-motorola-sysv4 
     574        ;; 
    500575    m88k:*:3*:R3*) 
    501         echo m88k-motorola-sysv3 
    502         exit ;; 
     576        GUESS=m88k-motorola-sysv3 
     577        ;; 
    503578    AViiON:dgux:*:*) 
    504579        # DG/UX returns AViiON for all architectures 
    505580        UNAME_PROCESSOR=`/usr/bin/uname -p` 
    506         if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] 
     581        if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 
    507582        then 
    508             if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ 
    509                [ ${TARGET_BINARY_INTERFACE}x = x ] 
     583            if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ 
     584               test "$TARGET_BINARY_INTERFACE"x = x 
    510585            then 
    511                 echo m88k-dg-dgux${UNAME_RELEASE} 
     586                GUESS=m88k-dg-dgux$UNAME_RELEASE 
    512587            else 
    513                 echo m88k-dg-dguxbcs${UNAME_RELEASE} 
     588                GUESS=m88k-dg-dguxbcs$UNAME_RELEASE 
    514589            fi 
    515590        else 
    516             echo i586-dg-dgux${UNAME_RELEASE} 
    517         fi 
    518         exit ;; 
     591            GUESS=i586-dg-dgux$UNAME_RELEASE 
     592        fi 
     593        ;; 
    519594    M88*:DolphinOS:*:*) # DolphinOS (SVR3) 
    520         echo m88k-dolphin-sysv3 
    521         exit ;; 
     595        GUESS=m88k-dolphin-sysv3 
     596        ;; 
    522597    M88*:*:R3*:*) 
    523598        # Delta 88k system running SVR3 
    524         echo m88k-motorola-sysv3 
    525         exit ;; 
     599        GUESS=m88k-motorola-sysv3 
     600        ;; 
    526601    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) 
    527         echo m88k-tektronix-sysv3 
    528         exit ;; 
     602        GUESS=m88k-tektronix-sysv3 
     603        ;; 
    529604    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) 
    530         echo m68k-tektronix-bsd 
    531         exit ;; 
     605        GUESS=m68k-tektronix-bsd 
     606        ;; 
    532607    *:IRIX*:*:*) 
    533         echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` 
    534         exit ;; 
     608        IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` 
     609        GUESS=mips-sgi-irix$IRIX_REL 
     610        ;; 
    535611    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. 
    536         echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id 
    537         exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX ' 
     612        GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id 
     613        ;;                    # Note that: echo "'`uname -s`'" gives 'AIX ' 
    538614    i*86:AIX:*:*) 
    539         echo i386-ibm-aix 
    540         exit ;; 
     615        GUESS=i386-ibm-aix 
     616        ;; 
    541617    ia64:AIX:*:*) 
    542         if [ -x /usr/bin/oslevel ] ; then 
     618        if test -x /usr/bin/oslevel ; then 
    543619                IBM_REV=`/usr/bin/oslevel` 
    544620        else 
    545                 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 
    546         fi 
    547         echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} 
    548         exit ;; 
     621                IBM_REV=$UNAME_VERSION.$UNAME_RELEASE 
     622        fi 
     623        GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV 
     624        ;; 
    549625    *:AIX:2:3) 
    550626        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 
    551                 eval $set_cc_for_build 
    552                 sed 's/^                //' << EOF >$dummy.c 
     627                set_cc_for_build 
     628                sed 's/^                //' << EOF > "$dummy.c" 
    553629                #include <sys/systemcfg.h> 
    554630 
     
    561637                        } 
    562638EOF 
    563                 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy
     639                if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"
    564640                then 
    565                         echo "$SYSTEM_NAME" 
     641                        GUESS=$SYSTEM_NAME 
    566642                else 
    567                         echo rs6000-ibm-aix3.2.5 
     643                        GUESS=rs6000-ibm-aix3.2.5 
    568644                fi 
    569645        elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then 
    570                 echo rs6000-ibm-aix3.2.4 
     646                GUESS=rs6000-ibm-aix3.2.4 
    571647        else 
    572                 echo rs6000-ibm-aix3.2 
    573         fi 
    574         exit ;; 
     648                GUESS=rs6000-ibm-aix3.2 
     649        fi 
     650        ;; 
    575651    *:AIX:*:[4567]) 
    576652        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 
    577         if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then 
     653        if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then 
    578654                IBM_ARCH=rs6000 
    579655        else 
    580656                IBM_ARCH=powerpc 
    581657        fi 
    582         if [ -x /usr/bin/oslevel ] ; then 
    583                 IBM_REV=`/usr/bin/oslevel` 
     658        if test -x /usr/bin/lslpp ; then 
     659                IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ 
     660                           awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` 
    584661        else 
    585                 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 
    586         fi 
    587         echo ${IBM_ARCH}-ibm-aix${IBM_REV} 
    588         exit ;; 
     662                IBM_REV=$UNAME_VERSION.$UNAME_RELEASE 
     663        fi 
     664        GUESS=$IBM_ARCH-ibm-aix$IBM_REV 
     665        ;; 
    589666    *:AIX:*:*) 
    590         echo rs6000-ibm-aix 
    591         exit ;; 
    592     ibmrt:4.4BSD:*|romp-ibm:BSD:*) 
    593         echo romp-ibm-bsd4.4 
    594         exit ;; 
     667        GUESS=rs6000-ibm-aix 
     668        ;; 
     669    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) 
     670        GUESS=romp-ibm-bsd4.4 
     671        ;; 
    595672    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and 
    596         echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to 
    597         exit ;;                             # report: romp-ibm BSD 4.3 
     673        GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to 
     674        ;;                                  # report: romp-ibm BSD 4.3 
    598675    *:BOSX:*:*) 
    599         echo rs6000-bull-bosx 
    600         exit ;; 
     676        GUESS=rs6000-bull-bosx 
     677        ;; 
    601678    DPX/2?00:B.O.S.:*:*) 
    602         echo m68k-bull-sysv3 
    603         exit ;; 
     679        GUESS=m68k-bull-sysv3 
     680        ;; 
    604681    9000/[34]??:4.3bsd:1.*:*) 
    605         echo m68k-hp-bsd 
    606         exit ;; 
     682        GUESS=m68k-hp-bsd 
     683        ;; 
    607684    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) 
    608         echo m68k-hp-bsd4.4 
    609         exit ;; 
     685        GUESS=m68k-hp-bsd4.4 
     686        ;; 
    610687    9000/[34678]??:HP-UX:*:*) 
    611         HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 
    612         case "${UNAME_MACHINE}" in 
    613             9000/31? )            HP_ARCH=m68000 ;; 
    614             9000/[34]?? )         HP_ARCH=m68k ;; 
     688        HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` 
     689        case $UNAME_MACHINE in 
     690            9000/31?)            HP_ARCH=m68000 ;; 
     691            9000/[34]??)         HP_ARCH=m68k ;; 
    615692            9000/[678][0-9][0-9]) 
    616                 if [ -x /usr/bin/getconf ]; then 
     693                if test -x /usr/bin/getconf; then 
    617694                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` 
    618695                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` 
    619                     case "${sc_cpu_version}" in 
    620                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 
    621                       528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 
     696                    case $sc_cpu_version in 
     697                      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 
     698                      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 
    622699                      532)                      # CPU_PA_RISC2_0 
    623                         case "${sc_kernel_bits}" in 
    624                           32) HP_ARCH="hppa2.0n" ;; 
    625                           64) HP_ARCH="hppa2.0w" ;; 
    626                           '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20 
     700                        case $sc_kernel_bits in 
     701                          32) HP_ARCH=hppa2.0n ;; 
     702                          64) HP_ARCH=hppa2.0w ;; 
     703                          '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20 
    627704                        esac ;; 
    628705                    esac 
    629706                fi 
    630                 if [ "${HP_ARCH}" = "" ]; then 
    631                     eval $set_cc_for_build 
    632                     sed 's/^            //' << EOF >$dummy.c 
     707                if test "$HP_ARCH" = ""; then 
     708                    set_cc_for_build 
     709                    sed 's/^            //' << EOF > "$dummy.c" 
    633710 
    634711                #define _HPUX_SOURCE 
     
    663740                } 
    664741EOF 
    665                     (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy
     742                    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"
    666743                    test -z "$HP_ARCH" && HP_ARCH=hppa 
    667744                fi ;; 
    668745        esac 
    669         if [ ${HP_ARCH} = "hppa2.0w" ] 
     746        if test "$HP_ARCH" = hppa2.0w 
    670747        then 
    671             eval $set_cc_for_build 
     748            set_cc_for_build 
    672749 
    673750            # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating 
     
    680757            # => hppa64-hp-hpux11.23 
    681758 
    682             if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | 
     759            if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | 
    683760                grep -q __LP64__ 
    684761            then 
    685                 HP_ARCH="hppa2.0w" 
     762                HP_ARCH=hppa2.0w 
    686763            else 
    687                 HP_ARCH="hppa64" 
     764                HP_ARCH=hppa64 
    688765            fi 
    689766        fi 
    690         echo ${HP_ARCH}-hp-hpux${HPUX_REV} 
    691         exit ;; 
     767        GUESS=$HP_ARCH-hp-hpux$HPUX_REV 
     768        ;; 
    692769    ia64:HP-UX:*:*) 
    693         HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 
    694         echo ia64-hp-hpux${HPUX_REV} 
    695         exit ;; 
     770        HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` 
     771        GUESS=ia64-hp-hpux$HPUX_REV 
     772        ;; 
    696773    3050*:HI-UX:*:*) 
    697         eval $set_cc_for_build 
    698         sed 's/^        //' << EOF >$dummy.c 
     774        set_cc_for_build 
     775        sed 's/^        //' << EOF > "$dummy.c" 
    699776        #include <unistd.h> 
    700777        int 
     
    721798        } 
    722799EOF 
    723         $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && 
     800        $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && 
    724801                { echo "$SYSTEM_NAME"; exit; } 
    725         echo unknown-hitachi-hiuxwe2 
    726         exit ;; 
    727     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*
    728         echo hppa1.1-hp-bsd 
    729         exit ;; 
     802        GUESS=unknown-hitachi-hiuxwe2 
     803        ;; 
     804    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*
     805        GUESS=hppa1.1-hp-bsd 
     806        ;; 
    730807    9000/8??:4.3bsd:*:*) 
    731         echo hppa1.0-hp-bsd 
    732         exit ;; 
     808        GUESS=hppa1.0-hp-bsd 
     809        ;; 
    733810    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) 
    734         echo hppa1.0-hp-mpeix 
    735         exit ;; 
    736     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*
    737         echo hppa1.1-hp-osf 
    738         exit ;; 
     811        GUESS=hppa1.0-hp-mpeix 
     812        ;; 
     813    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*
     814        GUESS=hppa1.1-hp-osf 
     815        ;; 
    739816    hp8??:OSF1:*:*) 
    740         echo hppa1.0-hp-osf 
    741         exit ;; 
     817        GUESS=hppa1.0-hp-osf 
     818        ;; 
    742819    i*86:OSF1:*:*) 
    743         if [ -x /usr/sbin/sysversion ] ; then 
    744             echo ${UNAME_MACHINE}-unknown-osf1mk 
     820        if test -x /usr/sbin/sysversion ; then 
     821            GUESS=$UNAME_MACHINE-unknown-osf1mk 
    745822        else 
    746             echo ${UNAME_MACHINE}-unknown-osf1 
    747         fi 
    748         exit ;; 
     823            GUESS=$UNAME_MACHINE-unknown-osf1 
     824        fi 
     825        ;; 
    749826    parisc*:Lites*:*:*) 
    750         echo hppa1.1-hp-lites 
    751         exit ;; 
     827        GUESS=hppa1.1-hp-lites 
     828        ;; 
    752829    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) 
    753         echo c1-convex-bsd 
    754         exit ;; 
     830        GUESS=c1-convex-bsd 
     831        ;; 
    755832    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) 
    756833        if getsysinfo -f scalar_acc 
     
    760837        exit ;; 
    761838    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) 
    762         echo c34-convex-bsd 
    763         exit ;; 
     839        GUESS=c34-convex-bsd 
     840        ;; 
    764841    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) 
    765         echo c38-convex-bsd 
    766         exit ;; 
     842        GUESS=c38-convex-bsd 
     843        ;; 
    767844    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) 
    768         echo c4-convex-bsd 
    769         exit ;; 
     845        GUESS=c4-convex-bsd 
     846        ;; 
    770847    CRAY*Y-MP:*:*:*) 
    771         echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    772         exit ;; 
     848        CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 
     849        GUESS=ymp-cray-unicos$CRAY_REL 
     850        ;; 
    773851    CRAY*[A-Z]90:*:*:*) 
    774         echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE}
     852        echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE"
    775853        | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ 
    776854              -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ 
     
    778856        exit ;; 
    779857    CRAY*TS:*:*:*) 
    780         echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    781         exit ;; 
     858        CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 
     859        GUESS=t90-cray-unicos$CRAY_REL 
     860        ;; 
    782861    CRAY*T3E:*:*:*) 
    783         echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    784         exit ;; 
     862        CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 
     863        GUESS=alphaev5-cray-unicosmk$CRAY_REL 
     864        ;; 
    785865    CRAY*SV1:*:*:*) 
    786         echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    787         exit ;; 
     866        CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 
     867        GUESS=sv1-cray-unicos$CRAY_REL 
     868        ;; 
    788869    *:UNICOS/mp:*:*) 
    789         echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    790         exit ;; 
     870        CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 
     871        GUESS=craynv-cray-unicosmp$CRAY_REL 
     872        ;; 
    791873    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) 
    792         FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
    793         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 
    794         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` 
    795         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 
    796         exit ;; 
     874        FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
     875        FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` 
     876        FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` 
     877        GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} 
     878        ;; 
    797879    5000:UNIX_System_V:4.*:*) 
    798         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 
    799         FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` 
    800         echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 
    801         exit ;; 
     880        FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` 
     881        FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` 
     882        GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} 
     883        ;; 
    802884    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 
    803         echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} 
    804         exit ;; 
     885        GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE 
     886        ;; 
    805887    sparc*:BSD/OS:*:*) 
    806         echo sparc-unknown-bsdi${UNAME_RELEASE} 
    807         exit ;; 
     888        GUESS=sparc-unknown-bsdi$UNAME_RELEASE 
     889        ;; 
    808890    *:BSD/OS:*:*) 
    809         echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} 
    810         exit ;; 
     891        GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE 
     892        ;; 
     893    arm:FreeBSD:*:*) 
     894        UNAME_PROCESSOR=`uname -p` 
     895        set_cc_for_build 
     896        if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ 
     897            | grep -q __ARM_PCS_VFP 
     898        then 
     899            FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 
     900            GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi 
     901        else 
     902            FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 
     903            GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf 
     904        fi 
     905        ;; 
    811906    *:FreeBSD:*:*) 
    812907        UNAME_PROCESSOR=`/usr/bin/uname -p` 
    813         case ${UNAME_PROCESSOR} in 
     908        case $UNAME_PROCESSOR in 
    814909            amd64) 
    815                 echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 
    816             *
    817                 echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 
     910                UNAME_PROCESSOR=x86_64 ;; 
     911            i386
     912                UNAME_PROCESSOR=i586 ;; 
    818913        esac 
    819         exit ;; 
     914        FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 
     915        GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL 
     916        ;; 
    820917    i*:CYGWIN*:*) 
    821         echo ${UNAME_MACHINE}-pc-cygwin 
    822         exit ;; 
     918        GUESS=$UNAME_MACHINE-pc-cygwin 
     919        ;; 
    823920    *:MINGW64*:*) 
    824         echo ${UNAME_MACHINE}-pc-mingw64 
    825         exit ;; 
     921        GUESS=$UNAME_MACHINE-pc-mingw64 
     922        ;; 
    826923    *:MINGW*:*) 
    827         echo ${UNAME_MACHINE}-pc-mingw32 
    828         exit ;; 
    829     i*:MSYS*:*) 
    830         echo ${UNAME_MACHINE}-pc-msys 
    831         exit ;; 
    832     i*:windows32*:*) 
    833         # uname -m includes "-pc" on this system. 
    834         echo ${UNAME_MACHINE}-mingw32 
    835         exit ;; 
     924        GUESS=$UNAME_MACHINE-pc-mingw32 
     925        ;; 
     926    *:MSYS*:*) 
     927        GUESS=$UNAME_MACHINE-pc-msys 
     928        ;; 
    836929    i*:PW*:*) 
    837         echo ${UNAME_MACHINE}-pc-pw32 
    838         exit ;; 
     930        GUESS=$UNAME_MACHINE-pc-pw32 
     931        ;; 
     932    *:SerenityOS:*:*) 
     933        GUESS=$UNAME_MACHINE-pc-serenity 
     934        ;; 
    839935    *:Interix*:*) 
    840         case ${UNAME_MACHINE} in 
     936        case $UNAME_MACHINE in 
    841937            x86) 
    842                 echo i586-pc-interix${UNAME_RELEASE} 
    843                 exit ;; 
     938                GUESS=i586-pc-interix$UNAME_RELEASE 
     939                ;; 
    844940            authenticamd | genuineintel | EM64T) 
    845                 echo x86_64-unknown-interix${UNAME_RELEASE} 
    846                 exit ;; 
     941                GUESS=x86_64-unknown-interix$UNAME_RELEASE 
     942                ;; 
    847943            IA64) 
    848                 echo ia64-unknown-interix${UNAME_RELEASE} 
    849                 exit ;; 
     944                GUESS=ia64-unknown-interix$UNAME_RELEASE 
     945                ;; 
    850946        esac ;; 
    851     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) 
    852         echo i${UNAME_MACHINE}-pc-mks 
    853         exit ;; 
    854     8664:Windows_NT:*) 
    855         echo x86_64-pc-mks 
    856         exit ;; 
    857     i*:Windows_NT*:* | Pentium*:Windows_NT*:*) 
    858         # How do we know it's Interix rather than the generic POSIX subsystem? 
    859         # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we 
    860         # UNAME_MACHINE based on the output of uname instead of i386? 
    861         echo i586-pc-interix 
    862         exit ;; 
    863947    i*:UWIN*:*) 
    864         echo ${UNAME_MACHINE}-pc-uwin 
    865         exit ;; 
     948        GUESS=$UNAME_MACHINE-pc-uwin 
     949        ;; 
    866950    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) 
    867         echo x86_64-unknown-cygwin 
    868         exit ;; 
    869     p*:CYGWIN*:*) 
    870         echo powerpcle-unknown-cygwin 
    871         exit ;; 
     951        GUESS=x86_64-pc-cygwin 
     952        ;; 
    872953    prep*:SunOS:5.*:*) 
    873         echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
    874         exit ;; 
     954        SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 
     955        GUESS=powerpcle-unknown-solaris2$SUN_REL 
     956        ;; 
    875957    *:GNU:*:*) 
    876958        # the GNU system 
    877         echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` 
    878         exit ;; 
     959        GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` 
     960        GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` 
     961        GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL 
     962        ;; 
    879963    *:GNU/*:*:*) 
    880964        # other systems with GNU libc and userland 
    881         echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} 
    882         exit ;; 
    883     i*86:Minix:*:*) 
    884         echo ${UNAME_MACHINE}-pc-minix 
    885         exit ;; 
     965        GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` 
     966        GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 
     967        GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC 
     968        ;; 
     969    *:Minix:*:*) 
     970        GUESS=$UNAME_MACHINE-unknown-minix 
     971        ;; 
    886972    aarch64:Linux:*:*) 
    887         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    888         exit ;; 
     973        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     974        ;; 
    889975    aarch64_be:Linux:*:*) 
    890976        UNAME_MACHINE=aarch64_be 
    891         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    892         exit ;; 
     977        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     978        ;; 
    893979    alpha:Linux:*:*) 
    894         case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in 
     980        case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in 
    895981          EV5)   UNAME_MACHINE=alphaev5 ;; 
    896982          EV56)  UNAME_MACHINE=alphaev56 ;; 
     
    902988        esac 
    903989        objdump --private-headers /bin/sh | grep -q ld.so.1 
    904         if test "$?" = 0 ; then LIBC="gnulibc1" ; fi 
    905         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    906         exit ;; 
    907     arc:Linux:*:* | arceb:Linux:*:*
    908         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    909         exit ;; 
     990        if test "$?" = 0 ; then LIBC=gnulibc1 ; fi 
     991        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     992        ;; 
     993    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*
     994        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     995        ;; 
    910996    arm*:Linux:*:*) 
    911         eval $set_cc_for_build 
     997        set_cc_for_build 
    912998        if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ 
    913999            | grep -q __ARM_EABI__ 
    9141000        then 
    915             echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
     1001            GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
    9161002        else 
    9171003            if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ 
    9181004                | grep -q __ARM_PCS_VFP 
    9191005            then 
    920                 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi 
     1006                GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi 
    9211007            else 
    922                 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf 
     1008                GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf 
    9231009            fi 
    9241010        fi 
    925         exit ;; 
     1011        ;; 
    9261012    avr32*:Linux:*:*) 
    927         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    928         exit ;; 
     1013        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1014        ;; 
    9291015    cris:Linux:*:*) 
    930         echo ${UNAME_MACHINE}-axis-linux-${LIBC} 
    931         exit ;; 
     1016        GUESS=$UNAME_MACHINE-axis-linux-$LIBC 
     1017        ;; 
    9321018    crisv32:Linux:*:*) 
    933         echo ${UNAME_MACHINE}-axis-linux-${LIBC} 
    934         exit ;; 
     1019        GUESS=$UNAME_MACHINE-axis-linux-$LIBC 
     1020        ;; 
     1021    e2k:Linux:*:*) 
     1022        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1023        ;; 
    9351024    frv:Linux:*:*) 
    936         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    937         exit ;; 
     1025        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1026        ;; 
    9381027    hexagon:Linux:*:*) 
    939         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    940         exit ;; 
     1028        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1029        ;; 
    9411030    i*86:Linux:*:*) 
    942         echo ${UNAME_MACHINE}-pc-linux-${LIBC} 
    943         exit ;; 
     1031        GUESS=$UNAME_MACHINE-pc-linux-$LIBC 
     1032        ;; 
    9441033    ia64:Linux:*:*) 
    945         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    946         exit ;; 
     1034        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1035        ;; 
     1036    k1om:Linux:*:*) 
     1037        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1038        ;; 
     1039    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) 
     1040        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1041        ;; 
    9471042    m32r*:Linux:*:*) 
    948         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    949         exit ;; 
     1043        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1044        ;; 
    9501045    m68*:Linux:*:*) 
    951         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    952         exit ;; 
     1046        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1047        ;; 
    9531048    mips:Linux:*:* | mips64:Linux:*:*) 
    954         eval $set_cc_for_build 
    955         sed 's/^        //' << EOF >$dummy.c 
     1049        set_cc_for_build 
     1050        IS_GLIBC=0 
     1051        test x"${LIBC}" = xgnu && IS_GLIBC=1 
     1052        sed 's/^        //' << EOF > "$dummy.c" 
    9561053        #undef CPU 
    957         #undef ${UNAME_MACHINE} 
    958         #undef ${UNAME_MACHINE}el 
     1054        #undef mips 
     1055        #undef mipsel 
     1056        #undef mips64 
     1057        #undef mips64el 
     1058        #if ${IS_GLIBC} && defined(_ABI64) 
     1059        LIBCABI=gnuabi64 
     1060        #else 
     1061        #if ${IS_GLIBC} && defined(_ABIN32) 
     1062        LIBCABI=gnuabin32 
     1063        #else 
     1064        LIBCABI=${LIBC} 
     1065        #endif 
     1066        #endif 
     1067 
     1068        #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 
     1069        CPU=mipsisa64r6 
     1070        #else 
     1071        #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 
     1072        CPU=mipsisa32r6 
     1073        #else 
     1074        #if defined(__mips64) 
     1075        CPU=mips64 
     1076        #else 
     1077        CPU=mips 
     1078        #endif 
     1079        #endif 
     1080        #endif 
     1081 
    9591082        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 
    960         CPU=${UNAME_MACHINE}el 
     1083        MIPS_ENDIAN=el 
    9611084        #else 
    9621085        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 
    963         CPU=${UNAME_MACHINE} 
     1086        MIPS_ENDIAN= 
    9641087        #else 
    965         CPU
     1088        MIPS_ENDIAN
    9661089        #endif 
    9671090        #endif 
    9681091EOF 
    969         eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` 
    970         test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } 
    971         ;; 
    972     or1k:Linux:*:*) 
    973         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    974         exit ;; 
    975     or32:Linux:*:*) 
    976         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    977         exit ;; 
     1092        cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` 
     1093        eval "$cc_set_vars" 
     1094        test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } 
     1095        ;; 
     1096    mips64el:Linux:*:*) 
     1097        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1098        ;; 
     1099    openrisc*:Linux:*:*) 
     1100        GUESS=or1k-unknown-linux-$LIBC 
     1101        ;; 
     1102    or32:Linux:*:* | or1k*:Linux:*:*) 
     1103        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1104        ;; 
    9781105    padre:Linux:*:*) 
    979         echo sparc-unknown-linux-${LIBC} 
    980         exit ;; 
     1106        GUESS=sparc-unknown-linux-$LIBC 
     1107        ;; 
    9811108    parisc64:Linux:*:* | hppa64:Linux:*:*) 
    982         echo hppa64-unknown-linux-${LIBC} 
    983         exit ;; 
     1109        GUESS=hppa64-unknown-linux-$LIBC 
     1110        ;; 
    9841111    parisc:Linux:*:* | hppa:Linux:*:*) 
    9851112        # Look for CPU level 
    9861113        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 
    987           PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; 
    988           PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; 
    989           *)    echo hppa-unknown-linux-${LIBC} ;; 
     1114          PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; 
     1115          PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; 
     1116          *)    GUESS=hppa-unknown-linux-$LIBC ;; 
    9901117        esac 
    991         exit ;; 
     1118        ;; 
    9921119    ppc64:Linux:*:*) 
    993         echo powerpc64-unknown-linux-${LIBC} 
    994         exit ;; 
     1120        GUESS=powerpc64-unknown-linux-$LIBC 
     1121        ;; 
    9951122    ppc:Linux:*:*) 
    996         echo powerpc-unknown-linux-${LIBC} 
    997         exit ;; 
     1123        GUESS=powerpc-unknown-linux-$LIBC 
     1124        ;; 
    9981125    ppc64le:Linux:*:*) 
    999         echo powerpc64le-unknown-linux-${LIBC} 
    1000         exit ;; 
     1126        GUESS=powerpc64le-unknown-linux-$LIBC 
     1127        ;; 
    10011128    ppcle:Linux:*:*) 
    1002         echo powerpcle-unknown-linux-${LIBC} 
    1003         exit ;; 
     1129        GUESS=powerpcle-unknown-linux-$LIBC 
     1130        ;; 
     1131    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) 
     1132        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1133        ;; 
    10041134    s390:Linux:*:* | s390x:Linux:*:*) 
    1005         echo ${UNAME_MACHINE}-ibm-linux-${LIBC} 
    1006         exit ;; 
     1135        GUESS=$UNAME_MACHINE-ibm-linux-$LIBC 
     1136        ;; 
    10071137    sh64*:Linux:*:*) 
    1008         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    1009         exit ;; 
     1138        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1139        ;; 
    10101140    sh*:Linux:*:*) 
    1011         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    1012         exit ;; 
     1141        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1142        ;; 
    10131143    sparc:Linux:*:* | sparc64:Linux:*:*) 
    1014         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    1015         exit ;; 
     1144        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1145        ;; 
    10161146    tile*:Linux:*:*) 
    1017         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    1018         exit ;; 
     1147        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1148        ;; 
    10191149    vax:Linux:*:*) 
    1020         echo ${UNAME_MACHINE}-dec-linux-${LIBC} 
    1021         exit ;; 
     1150        GUESS=$UNAME_MACHINE-dec-linux-$LIBC 
     1151        ;; 
    10221152    x86_64:Linux:*:*) 
    1023         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    1024         exit ;; 
     1153        set_cc_for_build 
     1154        CPU=$UNAME_MACHINE 
     1155        LIBCABI=$LIBC 
     1156        if test "$CC_FOR_BUILD" != no_compiler_found; then 
     1157            ABI=64 
     1158            sed 's/^        //' << EOF > "$dummy.c" 
     1159            #ifdef __i386__ 
     1160            ABI=x86 
     1161            #else 
     1162            #ifdef __ILP32__ 
     1163            ABI=x32 
     1164            #endif 
     1165            #endif 
     1166EOF 
     1167            cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` 
     1168            eval "$cc_set_abi" 
     1169            case $ABI in 
     1170                x86) CPU=i686 ;; 
     1171                x32) LIBCABI=${LIBC}x32 ;; 
     1172            esac 
     1173        fi 
     1174        GUESS=$CPU-pc-linux-$LIBCABI 
     1175        ;; 
    10251176    xtensa*:Linux:*:*) 
    1026         echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 
    1027         exit ;; 
     1177        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 
     1178        ;; 
    10281179    i*86:DYNIX/ptx:4*:*) 
    10291180        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. 
    10301181        # earlier versions are messed up and put the nodename in both 
    10311182        # sysname and nodename. 
    1032         echo i386-sequent-sysv4 
    1033         exit ;; 
     1183        GUESS=i386-sequent-sysv4 
     1184        ;; 
    10341185    i*86:UNIX_SV:4.2MP:2.*) 
    10351186        # Unixware is an offshoot of SVR4, but it has its own version 
     
    10381189        # I just have to hope.  -- rms. 
    10391190        # Use sysv4.2uw... so that sysv4* matches it. 
    1040         echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} 
    1041         exit ;; 
     1191        GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION 
     1192        ;; 
    10421193    i*86:OS/2:*:*) 
    10431194        # If we were able to find `uname', then EMX Unix compatibility 
    10441195        # is probably installed. 
    1045         echo ${UNAME_MACHINE}-pc-os2-emx 
    1046         exit ;; 
     1196        GUESS=$UNAME_MACHINE-pc-os2-emx 
     1197        ;; 
    10471198    i*86:XTS-300:*:STOP) 
    1048         echo ${UNAME_MACHINE}-unknown-stop 
    1049         exit ;; 
     1199        GUESS=$UNAME_MACHINE-unknown-stop 
     1200        ;; 
    10501201    i*86:atheos:*:*) 
    1051         echo ${UNAME_MACHINE}-unknown-atheos 
    1052         exit ;; 
     1202        GUESS=$UNAME_MACHINE-unknown-atheos 
     1203        ;; 
    10531204    i*86:syllable:*:*) 
    1054         echo ${UNAME_MACHINE}-pc-syllable 
    1055         exit ;; 
     1205        GUESS=$UNAME_MACHINE-pc-syllable 
     1206        ;; 
    10561207    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) 
    1057         echo i386-unknown-lynxos${UNAME_RELEASE} 
    1058         exit ;; 
     1208        GUESS=i386-unknown-lynxos$UNAME_RELEASE 
     1209        ;; 
    10591210    i*86:*DOS:*:*) 
    1060         echo ${UNAME_MACHINE}-pc-msdosdjgpp 
    1061         exit ;; 
    1062     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*
    1063         UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` 
     1211        GUESS=$UNAME_MACHINE-pc-msdosdjgpp 
     1212        ;; 
     1213    i*86:*:4.*:*
     1214        UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` 
    10641215        if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then 
    1065                 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} 
     1216                GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL 
    10661217        else 
    1067                 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} 
    1068         fi 
    1069         exit ;; 
     1218                GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL 
     1219        fi 
     1220        ;; 
    10701221    i*86:*:5:[678]*) 
    10711222        # UnixWare 7.x, OpenUNIX and OpenServer 6. 
     
    10751226            *Pent*|*Celeron) UNAME_MACHINE=i686 ;; 
    10761227        esac 
    1077         echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 
    1078         exit ;; 
     1228        GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 
     1229        ;; 
    10791230    i*86:*:3.2:*) 
    10801231        if test -f /usr/options/cb.name; then 
    10811232                UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` 
    1082                 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL 
     1233                GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL 
    10831234        elif /bin/uname -X 2>/dev/null >/dev/null ; then 
    10841235                UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` 
     
    10901241                (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ 
    10911242                        && UNAME_MACHINE=i686 
    1092                 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL 
     1243                GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL 
    10931244        else 
    1094                 echo ${UNAME_MACHINE}-pc-sysv32 
    1095         fi 
    1096         exit ;; 
     1245                GUESS=$UNAME_MACHINE-pc-sysv32 
     1246        fi 
     1247        ;; 
    10971248    pc:*:*:*) 
    10981249        # Left here for compatibility: 
     
    11001251        # the processor, so we play safe by assuming i586. 
    11011252        # Note: whatever this is, it MUST be the same as what config.sub 
    1102         # prints for the "djgpp" host, or else GDB configury will decide that 
     1253        # prints for the "djgpp" host, or else GDB configure will decide that 
    11031254        # this is a cross-build. 
    1104         echo i586-pc-msdosdjgpp 
    1105         exit ;; 
     1255        GUESS=i586-pc-msdosdjgpp 
     1256        ;; 
    11061257    Intel:Mach:3*:*) 
    1107         echo i386-pc-mach3 
    1108         exit ;; 
     1258        GUESS=i386-pc-mach3 
     1259        ;; 
    11091260    paragon:*:*:*) 
    1110         echo i860-intel-osf1 
    1111         exit ;; 
     1261        GUESS=i860-intel-osf1 
     1262        ;; 
    11121263    i860:*:4.*:*) # i860-SVR4 
    11131264        if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then 
    1114           echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 
     1265          GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4 
    11151266        else # Add other i860-SVR4 vendors below as they are discovered. 
    1116           echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4 
    1117         fi 
    1118         exit ;; 
     1267          GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4 
     1268        fi 
     1269        ;; 
    11191270    mini*:CTIX:SYS*5:*) 
    11201271        # "miniframe" 
    1121         echo m68010-convergent-sysv 
    1122         exit ;; 
     1272        GUESS=m68010-convergent-sysv 
     1273        ;; 
    11231274    mc68k:UNIX:SYSTEM5:3.51m) 
    1124         echo m68k-convergent-sysv 
    1125         exit ;; 
     1275        GUESS=m68k-convergent-sysv 
     1276        ;; 
    11261277    M680?0:D-NIX:5.3:*) 
    1127         echo m68k-diab-dnix 
    1128         exit ;; 
     1278        GUESS=m68k-diab-dnix 
     1279        ;; 
    11291280    M68*:*:R3V[5678]*:*) 
    11301281        test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 
     
    11341285        && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 
    11351286        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 
    1136           && { echo i486-ncr-sysv4.3${OS_REL}; exit; } 
     1287          && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } 
    11371288        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 
    1138           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 
     1289          && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 
    11391290    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 
    11401291        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 
     
    11451296            && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 
    11461297        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 
    1147             && { echo i486-ncr-sysv4.3${OS_REL}; exit; } 
     1298            && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } 
    11481299        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 
    1149             && { echo i586-ncr-sysv4.3${OS_REL}; exit; } 
     1300            && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } 
    11501301        /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ 
    1151             && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 
     1302            && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 
    11521303    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) 
    1153         echo m68k-unknown-lynxos${UNAME_RELEASE} 
    1154         exit ;; 
     1304        GUESS=m68k-unknown-lynxos$UNAME_RELEASE 
     1305        ;; 
    11551306    mc68030:UNIX_System_V:4.*:*) 
    1156         echo m68k-atari-sysv4 
    1157         exit ;; 
     1307        GUESS=m68k-atari-sysv4 
     1308        ;; 
    11581309    TSUNAMI:LynxOS:2.*:*) 
    1159         echo sparc-unknown-lynxos${UNAME_RELEASE} 
    1160         exit ;; 
     1310        GUESS=sparc-unknown-lynxos$UNAME_RELEASE 
     1311        ;; 
    11611312    rs6000:LynxOS:2.*:*) 
    1162         echo rs6000-unknown-lynxos${UNAME_RELEASE} 
    1163         exit ;; 
     1313        GUESS=rs6000-unknown-lynxos$UNAME_RELEASE 
     1314        ;; 
    11641315    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) 
    1165         echo powerpc-unknown-lynxos${UNAME_RELEASE} 
    1166         exit ;; 
     1316        GUESS=powerpc-unknown-lynxos$UNAME_RELEASE 
     1317        ;; 
    11671318    SM[BE]S:UNIX_SV:*:*) 
    1168         echo mips-dde-sysv${UNAME_RELEASE} 
    1169         exit ;; 
     1319        GUESS=mips-dde-sysv$UNAME_RELEASE 
     1320        ;; 
    11701321    RM*:ReliantUNIX-*:*:*) 
    1171         echo mips-sni-sysv4 
    1172         exit ;; 
     1322        GUESS=mips-sni-sysv4 
     1323        ;; 
    11731324    RM*:SINIX-*:*:*) 
    1174         echo mips-sni-sysv4 
    1175         exit ;; 
     1325        GUESS=mips-sni-sysv4 
     1326        ;; 
    11761327    *:SINIX-*:*:*) 
    11771328        if uname -p 2>/dev/null >/dev/null ; then 
    11781329                UNAME_MACHINE=`(uname -p) 2>/dev/null` 
    1179                 echo ${UNAME_MACHINE}-sni-sysv4 
     1330                GUESS=$UNAME_MACHINE-sni-sysv4 
    11801331        else 
    1181                 echo ns32k-sni-sysv 
    1182         fi 
    1183         exit ;; 
     1332                GUESS=ns32k-sni-sysv 
     1333        fi 
     1334        ;; 
    11841335    PENTIUM:*:4.0*:*)   # Unisys `ClearPath HMP IX 4000' SVR4/MP effort 
    11851336                        # says <Richard.M.Bartel@ccMail.Census.GOV> 
    1186         echo i586-unisys-sysv4 
    1187         exit ;; 
     1337        GUESS=i586-unisys-sysv4 
     1338        ;; 
    11881339    *:UNIX_System_V:4*:FTX*) 
    11891340        # From Gerald Hewes <hewes@openmarket.com>. 
    11901341        # How about differentiating between stratus architectures? -djm 
    1191         echo hppa1.1-stratus-sysv4 
    1192         exit ;; 
     1342        GUESS=hppa1.1-stratus-sysv4 
     1343        ;; 
    11931344    *:*:*:FTX*) 
    11941345        # From seanf@swdc.stratus.com. 
    1195         echo i860-stratus-sysv4 
    1196         exit ;; 
     1346        GUESS=i860-stratus-sysv4 
     1347        ;; 
    11971348    i*86:VOS:*:*) 
    11981349        # From Paul.Green@stratus.com. 
    1199         echo ${UNAME_MACHINE}-stratus-vos 
    1200         exit ;; 
     1350        GUESS=$UNAME_MACHINE-stratus-vos 
     1351        ;; 
    12011352    *:VOS:*:*) 
    12021353        # From Paul.Green@stratus.com. 
    1203         echo hppa1.1-stratus-vos 
    1204         exit ;; 
     1354        GUESS=hppa1.1-stratus-vos 
     1355        ;; 
    12051356    mc68*:A/UX:*:*) 
    1206         echo m68k-apple-aux${UNAME_RELEASE} 
    1207         exit ;; 
     1357        GUESS=m68k-apple-aux$UNAME_RELEASE 
     1358        ;; 
    12081359    news*:NEWS-OS:6*:*) 
    1209         echo mips-sony-newsos6 
    1210         exit ;; 
     1360        GUESS=mips-sony-newsos6 
     1361        ;; 
    12111362    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) 
    1212         if [ -d /usr/nec ]; then 
    1213                 echo mips-nec-sysv${UNAME_RELEASE} 
     1363        if test -d /usr/nec; then 
     1364                GUESS=mips-nec-sysv$UNAME_RELEASE 
    12141365        else 
    1215                 echo mips-unknown-sysv${UNAME_RELEASE} 
    1216         fi 
    1217         exit ;; 
     1366                GUESS=mips-unknown-sysv$UNAME_RELEASE 
     1367        fi 
     1368        ;; 
    12181369    BeBox:BeOS:*:*)     # BeOS running on hardware made by Be, PPC only. 
    1219         echo powerpc-be-beos 
    1220         exit ;; 
     1370        GUESS=powerpc-be-beos 
     1371        ;; 
    12211372    BeMac:BeOS:*:*)     # BeOS running on Mac or Mac clone, PPC only. 
    1222         echo powerpc-apple-beos 
    1223         exit ;; 
     1373        GUESS=powerpc-apple-beos 
     1374        ;; 
    12241375    BePC:BeOS:*:*)      # BeOS running on Intel PC compatible. 
    1225         echo i586-pc-beos 
    1226         exit ;; 
     1376        GUESS=i586-pc-beos 
     1377        ;; 
    12271378    BePC:Haiku:*:*)     # Haiku running on Intel PC compatible. 
    1228         echo i586-pc-haiku 
    1229         exit ;; 
    1230     x86_64:Haiku:*:*) 
    1231         echo x86_64-unknown-haiku 
    1232         exit ;; 
     1379        GUESS=i586-pc-haiku 
     1380        ;; 
     1381    ppc:Haiku:*:*)      # Haiku running on Apple PowerPC 
     1382        GUESS=powerpc-apple-haiku 
     1383        ;; 
     1384    *:Haiku:*:*)        # Haiku modern gcc (not bound by BeOS compat) 
     1385        GUESS=$UNAME_MACHINE-unknown-haiku 
     1386        ;; 
    12331387    SX-4:SUPER-UX:*:*) 
    1234         echo sx4-nec-superux${UNAME_RELEASE} 
    1235         exit ;; 
     1388        GUESS=sx4-nec-superux$UNAME_RELEASE 
     1389        ;; 
    12361390    SX-5:SUPER-UX:*:*) 
    1237         echo sx5-nec-superux${UNAME_RELEASE} 
    1238         exit ;; 
     1391        GUESS=sx5-nec-superux$UNAME_RELEASE 
     1392        ;; 
    12391393    SX-6:SUPER-UX:*:*) 
    1240         echo sx6-nec-superux${UNAME_RELEASE} 
    1241         exit ;; 
     1394        GUESS=sx6-nec-superux$UNAME_RELEASE 
     1395        ;; 
    12421396    SX-7:SUPER-UX:*:*) 
    1243         echo sx7-nec-superux${UNAME_RELEASE} 
    1244         exit ;; 
     1397        GUESS=sx7-nec-superux$UNAME_RELEASE 
     1398        ;; 
    12451399    SX-8:SUPER-UX:*:*) 
    1246         echo sx8-nec-superux${UNAME_RELEASE} 
    1247         exit ;; 
     1400        GUESS=sx8-nec-superux$UNAME_RELEASE 
     1401        ;; 
    12481402    SX-8R:SUPER-UX:*:*) 
    1249         echo sx8r-nec-superux${UNAME_RELEASE} 
    1250         exit ;; 
     1403        GUESS=sx8r-nec-superux$UNAME_RELEASE 
     1404        ;; 
     1405    SX-ACE:SUPER-UX:*:*) 
     1406        GUESS=sxace-nec-superux$UNAME_RELEASE 
     1407        ;; 
    12511408    Power*:Rhapsody:*:*) 
    1252         echo powerpc-apple-rhapsody${UNAME_RELEASE} 
    1253         exit ;; 
     1409        GUESS=powerpc-apple-rhapsody$UNAME_RELEASE 
     1410        ;; 
    12541411    *:Rhapsody:*:*) 
    1255         echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} 
    1256         exit ;; 
     1412        GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE 
     1413        ;; 
     1414    arm64:Darwin:*:*) 
     1415        GUESS=aarch64-apple-darwin$UNAME_RELEASE 
     1416        ;; 
    12571417    *:Darwin:*:*) 
    1258         UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown 
    1259         eval $set_cc_for_build 
    1260         if test "$UNAME_PROCESSOR" = unknown ; then 
    1261             UNAME_PROCESSOR=powerpc 
    1262         fi 
    1263         if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then 
     1418        UNAME_PROCESSOR=`uname -p` 
     1419        case $UNAME_PROCESSOR in 
     1420            unknown) UNAME_PROCESSOR=powerpc ;; 
     1421        esac 
     1422        if command -v xcode-select > /dev/null 2> /dev/null && \ 
     1423                ! xcode-select --print-path > /dev/null 2> /dev/null ; then 
     1424            # Avoid executing cc if there is no toolchain installed as 
     1425            # cc will be a stub that puts up a graphical alert 
     1426            # prompting the user to install developer tools. 
     1427            CC_FOR_BUILD=no_compiler_found 
     1428        else 
     1429            set_cc_for_build 
     1430        fi 
     1431        if test "$CC_FOR_BUILD" != no_compiler_found; then 
    12641432            if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ 
    1265                 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ 
    1266                 grep IS_64BIT_ARCH >/dev/null 
     1433                   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 
     1434                   grep IS_64BIT_ARCH >/dev/null 
    12671435            then 
    12681436                case $UNAME_PROCESSOR in 
     
    12711439                esac 
    12721440            fi 
    1273         fi 
    1274         echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} 
    1275         exit ;; 
     1441            # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc 
     1442            if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ 
     1443                   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 
     1444                   grep IS_PPC >/dev/null 
     1445            then 
     1446                UNAME_PROCESSOR=powerpc 
     1447            fi 
     1448        elif test "$UNAME_PROCESSOR" = i386 ; then 
     1449            # uname -m returns i386 or x86_64 
     1450            UNAME_PROCESSOR=$UNAME_MACHINE 
     1451        fi 
     1452        GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE 
     1453        ;; 
    12761454    *:procnto*:*:* | *:QNX:[0123456789]*:*) 
    12771455        UNAME_PROCESSOR=`uname -p` 
    1278         if test "$UNAME_PROCESSOR" = "x86"; then 
     1456        if test "$UNAME_PROCESSOR" = x86; then 
    12791457                UNAME_PROCESSOR=i386 
    12801458                UNAME_MACHINE=pc 
    12811459        fi 
    1282         echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} 
    1283         exit ;; 
     1460        GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE 
     1461        ;; 
    12841462    *:QNX:*:4*) 
    1285         echo i386-pc-qnx 
    1286         exit ;; 
    1287     NEO-?:NONSTOP_KERNEL:*:*) 
    1288         echo neo-tandem-nsk${UNAME_RELEASE} 
    1289         exit ;; 
     1463        GUESS=i386-pc-qnx 
     1464        ;; 
     1465    NEO-*:NONSTOP_KERNEL:*:*) 
     1466        GUESS=neo-tandem-nsk$UNAME_RELEASE 
     1467        ;; 
    12901468    NSE-*:NONSTOP_KERNEL:*:*) 
    1291         echo nse-tandem-nsk${UNAME_RELEASE} 
    1292         exit ;; 
    1293     NSR-?:NONSTOP_KERNEL:*:*) 
    1294         echo nsr-tandem-nsk${UNAME_RELEASE} 
    1295         exit ;; 
     1469        GUESS=nse-tandem-nsk$UNAME_RELEASE 
     1470        ;; 
     1471    NSR-*:NONSTOP_KERNEL:*:*) 
     1472        GUESS=nsr-tandem-nsk$UNAME_RELEASE 
     1473        ;; 
     1474    NSV-*:NONSTOP_KERNEL:*:*) 
     1475        GUESS=nsv-tandem-nsk$UNAME_RELEASE 
     1476        ;; 
     1477    NSX-*:NONSTOP_KERNEL:*:*) 
     1478        GUESS=nsx-tandem-nsk$UNAME_RELEASE 
     1479        ;; 
    12961480    *:NonStop-UX:*:*) 
    1297         echo mips-compaq-nonstopux 
    1298         exit ;; 
     1481        GUESS=mips-compaq-nonstopux 
     1482        ;; 
    12991483    BS2000:POSIX*:*:*) 
    1300         echo bs2000-siemens-sysv 
    1301         exit ;; 
     1484        GUESS=bs2000-siemens-sysv 
     1485        ;; 
    13021486    DS/*:UNIX_System_V:*:*) 
    1303         echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} 
    1304         exit ;; 
     1487        GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE 
     1488        ;; 
    13051489    *:Plan9:*:*) 
    13061490        # "uname -m" is not consistent, so use $cputype instead. 386 
    13071491        # is converted to i386 for consistency with other x86 
    13081492        # operating systems. 
    1309         if test "$cputype" = "386"; then 
     1493        if test "${cputype-}" = 386; then 
    13101494            UNAME_MACHINE=i386 
    1311         else 
    1312             UNAME_MACHINE="$cputype" 
    1313         fi 
    1314         echo ${UNAME_MACHINE}-unknown-plan9 
    1315         exit ;; 
     1495        elif test "x${cputype-}" != x; then 
     1496            UNAME_MACHINE=$cputype 
     1497        fi 
     1498        GUESS=$UNAME_MACHINE-unknown-plan9 
     1499        ;; 
    13161500    *:TOPS-10:*:*) 
    1317         echo pdp10-unknown-tops10 
    1318         exit ;; 
     1501        GUESS=pdp10-unknown-tops10 
     1502        ;; 
    13191503    *:TENEX:*:*) 
    1320         echo pdp10-unknown-tenex 
    1321         exit ;; 
     1504        GUESS=pdp10-unknown-tenex 
     1505        ;; 
    13221506    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) 
    1323         echo pdp10-dec-tops20 
    1324         exit ;; 
     1507        GUESS=pdp10-dec-tops20 
     1508        ;; 
    13251509    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) 
    1326         echo pdp10-xkl-tops20 
    1327         exit ;; 
     1510        GUESS=pdp10-xkl-tops20 
     1511        ;; 
    13281512    *:TOPS-20:*:*) 
    1329         echo pdp10-unknown-tops20 
    1330         exit ;; 
     1513        GUESS=pdp10-unknown-tops20 
     1514        ;; 
    13311515    *:ITS:*:*) 
    1332         echo pdp10-unknown-its 
    1333         exit ;; 
     1516        GUESS=pdp10-unknown-its 
     1517        ;; 
    13341518    SEI:*:*:SEIUX) 
    1335         echo mips-sei-seiux${UNAME_RELEASE} 
    1336         exit ;; 
     1519        GUESS=mips-sei-seiux$UNAME_RELEASE 
     1520        ;; 
    13371521    *:DragonFly:*:*) 
    1338         echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` 
    1339         exit ;; 
     1522        DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 
     1523        GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL 
     1524        ;; 
    13401525    *:*VMS:*:*) 
    13411526        UNAME_MACHINE=`(uname -p) 2>/dev/null` 
    1342         case "${UNAME_MACHINE}" in 
    1343             A*) echo alpha-dec-vms ; exit ;; 
    1344             I*) echo ia64-dec-vms ; exit ;; 
    1345             V*) echo vax-dec-vms ; exit ;; 
     1527        case $UNAME_MACHINE in 
     1528            A*) GUESS=alpha-dec-vms ;; 
     1529            I*) GUESS=ia64-dec-vms ;; 
     1530            V*) GUESS=vax-dec-vms ;; 
    13461531        esac ;; 
    13471532    *:XENIX:*:SysV) 
    1348         echo i386-pc-xenix 
    1349         exit ;; 
     1533        GUESS=i386-pc-xenix 
     1534        ;; 
    13501535    i*86:skyos:*:*) 
    1351         echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' 
    1352         exit ;; 
     1536        SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` 
     1537        GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL 
     1538        ;; 
    13531539    i*86:rdos:*:*) 
    1354         echo ${UNAME_MACHINE}-pc-rdos 
    1355         exit ;; 
    1356     i*86:AROS:*:*) 
    1357         echo ${UNAME_MACHINE}-pc-aros 
    1358         exit ;; 
     1540        GUESS=$UNAME_MACHINE-pc-rdos 
     1541        ;; 
     1542    i*86:Fiwix:*:*) 
     1543        GUESS=$UNAME_MACHINE-pc-fiwix 
     1544        ;; 
     1545    *:AROS:*:*) 
     1546        GUESS=$UNAME_MACHINE-unknown-aros 
     1547        ;; 
    13591548    x86_64:VMkernel:*:*) 
    1360         echo ${UNAME_MACHINE}-unknown-esx 
    1361         exit ;; 
     1549        GUESS=$UNAME_MACHINE-unknown-esx 
     1550        ;; 
     1551    amd64:Isilon\ OneFS:*:*) 
     1552        GUESS=x86_64-unknown-onefs 
     1553        ;; 
     1554    *:Unleashed:*:*) 
     1555        GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE 
     1556        ;; 
    13621557esac 
    13631558 
    1364 eval $set_cc_for_build 
    1365 cat >$dummy.c <<EOF 
     1559# Do we have a guess based on uname results? 
     1560if test "x$GUESS" != x; then 
     1561    echo "$GUESS" 
     1562    exit 
     1563fi 
     1564 
     1565# No uname command or uname output not recognized. 
     1566set_cc_for_build 
     1567cat > "$dummy.c" <<EOF 
    13661568#ifdef _SEQUENT_ 
    1367 # include <sys/types.h> 
    1368 # include <sys/utsname.h> 
     1569#include <sys/types.h> 
     1570#include <sys/utsname.h> 
     1571#endif 
     1572#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) 
     1573#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) 
     1574#include <signal.h> 
     1575#if defined(_SIZE_T_) || defined(SIGLOST) 
     1576#include <sys/utsname.h> 
     1577#endif 
     1578#endif 
    13691579#endif 
    13701580main () 
     
    13791589  printf ("m68k-sony-newsos%s\n", 
    13801590#ifdef NEWSOS4 
    1381        "4" 
     1591  "4" 
    13821592#else 
    1383         "" 
    1384 #endif 
    1385         ); exit (0); 
    1386 #endif 
    1387 #endif 
    1388  
    1389 #if defined (__arm) && defined (__acorn) && defined (__unix) 
    1390   printf ("arm-acorn-riscix\n"); exit (0); 
    1391 #endif 
    1392  
    1393 #if defined (hp300) && !defined (hpux) 
    1394   printf ("m68k-hp-bsd\n"); exit (0); 
     1593  "" 
     1594#endif 
     1595  ); exit (0); 
     1596#endif 
    13951597#endif 
    13961598 
     
    14341636 
    14351637#if defined (_SEQUENT_) 
    1436     struct utsname un; 
    1437  
    1438     uname(&un); 
    1439  
    1440     if (strncmp(un.version, "V2", 2) == 0) { 
    1441         printf ("i386-sequent-ptx2\n"); exit (0); 
    1442     } 
    1443     if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ 
    1444         printf ("i386-sequent-ptx1\n"); exit (0); 
    1445     } 
    1446     printf ("i386-sequent-ptx\n"); exit (0); 
    1447  
     1638  struct utsname un; 
     1639 
     1640  uname(&un); 
     1641  if (strncmp(un.version, "V2", 2) == 0) { 
     1642    printf ("i386-sequent-ptx2\n"); exit (0); 
     1643  } 
     1644  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ 
     1645    printf ("i386-sequent-ptx1\n"); exit (0); 
     1646  } 
     1647  printf ("i386-sequent-ptx\n"); exit (0); 
    14481648#endif 
    14491649 
    14501650#if defined (vax) 
    1451 # if !defined (ultrix) 
    1452 #  include <sys/param.h> 
    1453 #  if defined (BSD) 
    1454 #   if BSD == 43 
    1455       printf ("vax-dec-bsd4.3\n"); exit (0); 
    1456 #   else 
    1457 #    if BSD == 199006 
    1458       printf ("vax-dec-bsd4.3reno\n"); exit (0); 
    1459 #    else 
    1460       printf ("vax-dec-bsd\n"); exit (0); 
    1461 #    endif 
    1462 #   endif 
    1463 #  else 
    1464     printf ("vax-dec-bsd\n"); exit (0); 
    1465 #  endif 
    1466 # else 
    1467     printf ("vax-dec-ultrix\n"); exit (0); 
    1468 # endif 
     1651#if !defined (ultrix) 
     1652#include <sys/param.h> 
     1653#if defined (BSD) 
     1654#if BSD == 43 
     1655  printf ("vax-dec-bsd4.3\n"); exit (0); 
     1656#else 
     1657#if BSD == 199006 
     1658  printf ("vax-dec-bsd4.3reno\n"); exit (0); 
     1659#else 
     1660  printf ("vax-dec-bsd\n"); exit (0); 
     1661#endif 
     1662#endif 
     1663#else 
     1664  printf ("vax-dec-bsd\n"); exit (0); 
     1665#endif 
     1666#else 
     1667#if defined(_SIZE_T_) || defined(SIGLOST) 
     1668  struct utsname un; 
     1669  uname (&un); 
     1670  printf ("vax-dec-ultrix%s\n", un.release); exit (0); 
     1671#else 
     1672  printf ("vax-dec-ultrix\n"); exit (0); 
     1673#endif 
     1674#endif 
     1675#endif 
     1676#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) 
     1677#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) 
     1678#if defined(_SIZE_T_) || defined(SIGLOST) 
     1679  struct utsname *un; 
     1680  uname (&un); 
     1681  printf ("mips-dec-ultrix%s\n", un.release); exit (0); 
     1682#else 
     1683  printf ("mips-dec-ultrix\n"); exit (0); 
     1684#endif 
     1685#endif 
    14691686#endif 
    14701687 
     
    14771694EOF 
    14781695 
    1479 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && 
     1696$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && 
    14801697        { echo "$SYSTEM_NAME"; exit; } 
    14811698 
    14821699# Apollos put the system type in the environment. 
    1483  
    1484 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } 
    1485  
    1486 # Convex versions that predate uname can use getsysinfo(1) 
    1487  
    1488 if [ -x /usr/convex/getsysinfo ] 
    1489 then 
    1490     case `getsysinfo -f cpu_type` in 
    1491     c1*) 
    1492         echo c1-convex-bsd 
    1493         exit ;; 
    1494     c2*) 
    1495         if getsysinfo -f scalar_acc 
    1496         then echo c32-convex-bsd 
    1497         else echo c2-convex-bsd 
    1498         fi 
    1499         exit ;; 
    1500     c34*) 
    1501         echo c34-convex-bsd 
    1502         exit ;; 
    1503     c38*) 
    1504         echo c38-convex-bsd 
    1505         exit ;; 
    1506     c4*) 
    1507         echo c4-convex-bsd 
    1508         exit ;; 
    1509     esac 
    1510 fi 
     1700test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } 
     1701 
     1702echo "$0: unable to guess system type" >&2 
     1703 
     1704case $UNAME_MACHINE:$UNAME_SYSTEM in 
     1705    mips:Linux | mips64:Linux) 
     1706        # If we got here on MIPS GNU/Linux, output extra information. 
     1707        cat >&2 <<EOF 
     1708 
     1709NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize 
     1710the system type. Please install a C compiler and try again. 
     1711EOF 
     1712        ;; 
     1713esac 
    15111714 
    15121715cat >&2 <<EOF 
    1513 $0: unable to guess system type 
    1514  
    1515 This script, last modified $timestamp, has failed to recognize 
    1516 the operating system you are using. It is advised that you 
    1517 download the most up to date version of the config scripts from 
    1518  
    1519   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD 
     1716 
     1717This script (version $timestamp), has failed to recognize the 
     1718operating system you are using. If your script is old, overwrite *all* 
     1719copies of config.guess and config.sub with the latest versions from: 
     1720 
     1721  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess 
    15201722and 
    1521   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD 
    1522  
    1523 If the version you run ($0) is already up to date, please 
    1524 send the following data and any information you think might be 
    1525 pertinent to <config-patches@gnu.org> in order to provide the needed 
    1526 information to handle your system. 
     1723  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 
     1724EOF 
     1725 
     1726our_year=`echo $timestamp | sed 's,-.*,,'` 
     1727thisyear=`date +%Y` 
     1728# shellcheck disable=SC2003 
     1729script_age=`expr "$thisyear" - "$our_year"` 
     1730if test "$script_age" -lt 3 ; then 
     1731   cat >&2 <<EOF 
     1732 
     1733If $0 has already been updated, send the following data and any 
     1734information you think might be pertinent to config-patches@gnu.org to 
     1735provide the necessary information to handle your system. 
    15271736 
    15281737config.guess timestamp = $timestamp 
     
    15431752/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` 
    15441753 
    1545 UNAME_MACHINE = ${UNAME_MACHINE} 
    1546 UNAME_RELEASE = ${UNAME_RELEASE} 
    1547 UNAME_SYSTEM  = ${UNAME_SYSTEM} 
    1548 UNAME_VERSION = ${UNAME_VERSION} 
     1754UNAME_MACHINE = "$UNAME_MACHINE" 
     1755UNAME_RELEASE = "$UNAME_RELEASE" 
     1756UNAME_SYSTEM  = "$UNAME_SYSTEM" 
     1757UNAME_VERSION = "$UNAME_VERSION" 
    15491758EOF 
     1759fi 
    15501760 
    15511761exit 1 
    15521762 
    15531763# Local variables: 
    1554 # eval: (add-hook 'write-file-hooks 'time-stamp) 
     1764# eval: (add-hook 'before-save-hook 'time-stamp) 
    15551765# time-stamp-start: "timestamp='" 
    15561766# time-stamp-format: "%:y-%02m-%02d"