Show
Ignore:
Timestamp:
12/29/03 22:20:58 (5 years ago)
Author:
miyoshi
Message:

Sync up with Emacs-21.3.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/emacs-merge/config.guess

    r63 r3212  
    11#! /bin/sh 
    22# Attempt to guess a canonical system name. 
    3 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 
    4 #   Free Software Foundation, Inc. 
    5  
    6 version='2000-11-10
     3#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 
     4#   2000, 2001, 2002 Free Software Foundation, Inc. 
     5 
     6timestamp='2002-11-13
    77 
    88# This file is free software; you can redistribute it and/or modify it 
     
    2525# the same distribution terms that you use for the rest of that program. 
    2626 
    27 # Written by Per Bothner <bothner@cygnus.com>. 
    28 # Please send patches to <config-patches@gnu.org>. 
     27# Originally written by Per Bothner <per@bothner.com>. 
     28# Please send patches to <config-patches@gnu.org>.  Submit a context 
     29# diff and a properly formatted ChangeLog entry. 
    2930# 
    3031# This script attempts to guess a canonical system name similar to 
     
    3334# 
    3435# The plan is that this can be called by configure scripts if you 
    35 # don't specify an explicit system type (host/target name). 
    36 
    37 # Only a few systems have been added to this list; please add others 
    38 # (but try to keep the structure clean). 
    39 
     36# don't specify an explicit build system type. 
    4037 
    4138me=`echo "$0" | sed -e 's,.*/,,'` 
     
    4441Usage: $0 [OPTION] 
    4542 
    46 Output the configuration name of this system
     43Output the configuration name of the system \`$me' is run on
    4744 
    4845Operation modes: 
    49   -h, --help               print this help, then exit 
    50   -V, --version            print version number, then exit" 
     46  -h, --help         print this help, then exit 
     47  -t, --time-stamp   print date of last modification, then exit 
     48  -v, --version      print version number, then exit 
     49 
     50Report bugs and patches to <config-patches@gnu.org>." 
     51 
     52version="\ 
     53GNU config.guess ($timestamp) 
     54 
     55Originally written by Per Bothner. 
     56Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 
     57Free Software Foundation, Inc. 
     58 
     59This is free software; see the source for copying conditions.  There is NO 
     60warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 
    5161 
    5262help=" 
     
    5565# Parse command line 
    5666while test $# -gt 0 ; do 
    57   case "$1" in 
    58     --version | --vers* | -V ) 
     67  case $1 in 
     68    --time-stamp | --time* | -t ) 
     69       echo "$timestamp" ; exit 0 ;; 
     70    --version | -v ) 
    5971       echo "$version" ; exit 0 ;; 
    6072    --help | --h* | -h ) 
     
    6577       break ;; 
    6678    -* ) 
    67        exec >&2 
    68        echo "$me: invalid option $1" 
    69        echo "$help" 
     79       echo "$me: invalid option $1$help" >&2 
    7080       exit 1 ;; 
    7181    * ) 
     
    7989fi 
    8090 
    81  
    82 dummy=dummy-$$ 
    83 trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 
    84  
    85 # Use $HOST_CC if defined. $CC may point to a cross-compiler 
    86 if test x"$CC_FOR_BUILD" = x; then 
    87   if test x"$HOST_CC" != x; then 
    88     CC_FOR_BUILD="$HOST_CC" 
    89   else 
    90     if test x"$CC" != x; then 
    91       CC_FOR_BUILD="$CC" 
    92     else 
    93       echo 'int dummy(){}' >$dummy.c 
    94       for c in cc c89 gcc; do  
    95         ($c $dummy.c -c) >/dev/null 2>&1 
    96         if test $? = 0; then 
    97           CC_FOR_BUILD="$c"; break 
    98         fi 
    99       done 
    100       rm -f $dummy.c $dummy.o 
    101       if test x"$CC_FOR_BUILD" = x; then 
    102         CC_FOR_BUILD=no_compiler_found 
    103       fi 
    104     fi 
    105   fi 
    106 fi 
    107  
     91trap 'exit 1' 1 2 15 
     92 
     93# CC_FOR_BUILD -- compiler used by this script. Note that the use of a 
     94# compiler to aid in system detection is discouraged as it requires 
     95# temporary files to be created and, as you can see below, it is a 
     96# headache to deal with in a portable fashion. 
     97 
     98# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still 
     99# use `HOST_CC' if defined, but it is deprecated. 
     100 
     101# This shell variable is my proudest work .. or something. --bje 
     102 
     103set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; 
     104(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) 
     105   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; 
     106dummy=$tmpdir/dummy ; 
     107files="$dummy.c $dummy.o $dummy.rel $dummy" ; 
     108trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; 
     109case $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        rm -f $files ; 
     117        if test x"$CC_FOR_BUILD" = x ; then 
     118          CC_FOR_BUILD=no_compiler_found ; 
     119        fi 
     120        ;; 
     121 ,,*)   CC_FOR_BUILD=$CC ;; 
     122 ,*,*)  CC_FOR_BUILD=$HOST_CC ;; 
     123esac ; 
     124unset files' 
    108125 
    109126# This is needed to find uname on a Pyramid OSx when run in the BSD universe. 
    110 # (ghazi@noc.rutgers.edu 8/24/94.
     127# (ghazi@noc.rutgers.edu 1994-08-24
    111128if (test -f /.attbin/uname) >/dev/null 2>&1 ; then 
    112129        PATH=$PATH:/.attbin ; export PATH 
     
    115132UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown 
    116133UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 
    117 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 
     134UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 
    118135UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown 
    119136 
     
    122139case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 
    123140    *:NetBSD:*:*) 
    124         # Netbsd (nbsd) targets should (where applicable) match one or 
     141        # NetBSD (nbsd) targets should (where applicable) match one or 
    125142        # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, 
    126143        # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently 
     
    129146        # compatibility and a consistent mechanism for selecting the 
    130147        # object file format. 
    131         # Determine the machine/vendor (is the vendor relevant). 
    132         case "${UNAME_MACHINE}" in 
    133             amiga) machine=m68k-unknown ;; 
    134             arm32) machine=arm-unknown ;; 
    135             atari*) machine=m68k-atari ;; 
    136             sun3*) machine=m68k-sun ;; 
    137             mac68k) machine=m68k-apple ;; 
    138             macppc) machine=powerpc-apple ;; 
    139             hp3[0-9][05]) machine=m68k-hp ;; 
    140             ibmrt|romp-ibm) machine=romp-ibm ;; 
    141             *) machine=${UNAME_MACHINE}-unknown ;; 
     148        # 
     149        # Note: NetBSD doesn't particularly care about the vendor 
     150        # portion of the name.  We always set it to "unknown". 
     151        sysctl="sysctl -n hw.machine_arch" 
     152        UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ 
     153            /usr/sbin/$sysctl 2>/dev/null || echo unknown)` 
     154        case "${UNAME_MACHINE_ARCH}" in 
     155            armeb) machine=armeb-unknown ;; 
     156            arm*) machine=arm-unknown ;; 
     157            sh3el) machine=shl-unknown ;; 
     158            sh3eb) machine=sh-unknown ;; 
     159            *) machine=${UNAME_MACHINE_ARCH}-unknown ;; 
    142160        esac 
    143         # The Operating System including object format. 
    144         if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 
    145                 | grep __ELF__ >/dev/null 
    146         then 
    147             # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). 
    148             # Return netbsd for either.  FIX? 
    149             os=netbsd 
    150         else 
    151             os=netbsdelf 
    152         fi 
     161        # The Operating System including object format, if it has switched 
     162        # to ELF recently, or will in the future. 
     163        case "${UNAME_MACHINE_ARCH}" in 
     164            arm*|i386|m68k|ns32k|sh3*|sparc|vax) 
     165                eval $set_cc_for_build 
     166                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 
     167                        | grep __ELF__ >/dev/null 
     168                then 
     169                    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). 
     170                    # Return netbsd for either.  FIX? 
     171                    os=netbsd 
     172                else 
     173                    os=netbsdelf 
     174                fi 
     175                ;; 
     176            *) 
     177                os=netbsd 
     178                ;; 
     179        esac 
    153180        # The OS release 
    154181        release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` 
     
    158185        echo "${machine}-${os}${release}" 
    159186        exit 0 ;; 
     187    amiga:OpenBSD:*:*) 
     188        echo m68k-unknown-openbsd${UNAME_RELEASE} 
     189        exit 0 ;; 
     190    arc:OpenBSD:*:*) 
     191        echo mipsel-unknown-openbsd${UNAME_RELEASE} 
     192        exit 0 ;; 
     193    hp300:OpenBSD:*:*) 
     194        echo m68k-unknown-openbsd${UNAME_RELEASE} 
     195        exit 0 ;; 
     196    mac68k:OpenBSD:*:*) 
     197        echo m68k-unknown-openbsd${UNAME_RELEASE} 
     198        exit 0 ;; 
     199    macppc:OpenBSD:*:*) 
     200        echo powerpc-unknown-openbsd${UNAME_RELEASE} 
     201        exit 0 ;; 
     202    mvme68k:OpenBSD:*:*) 
     203        echo m68k-unknown-openbsd${UNAME_RELEASE} 
     204        exit 0 ;; 
     205    mvme88k:OpenBSD:*:*) 
     206        echo m88k-unknown-openbsd${UNAME_RELEASE} 
     207        exit 0 ;; 
     208    mvmeppc:OpenBSD:*:*) 
     209        echo powerpc-unknown-openbsd${UNAME_RELEASE} 
     210        exit 0 ;; 
     211    pmax:OpenBSD:*:*) 
     212        echo mipsel-unknown-openbsd${UNAME_RELEASE} 
     213        exit 0 ;; 
     214    sgi:OpenBSD:*:*) 
     215        echo mipseb-unknown-openbsd${UNAME_RELEASE} 
     216        exit 0 ;; 
     217    sun3:OpenBSD:*:*) 
     218        echo m68k-unknown-openbsd${UNAME_RELEASE} 
     219        exit 0 ;; 
     220    wgrisc:OpenBSD:*:*) 
     221        echo mipsel-unknown-openbsd${UNAME_RELEASE} 
     222        exit 0 ;; 
     223    *:OpenBSD:*:*) 
     224        echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} 
     225        exit 0 ;; 
    160226    alpha:OSF1:*:*) 
    161227        if test $UNAME_RELEASE = "V4.0"; then 
     
    166232        # A Xn.n version is an unreleased experimental baselevel. 
    167233        # 1.2 uses "1.2" for uname -r. 
     234        eval $set_cc_for_build 
    168235        cat <<EOF >$dummy.s 
    169236        .data 
     
    191258        .end main 
    192259EOF 
    193         $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null 
     260        $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null 
    194261        if test "$?" = 0 ; then 
    195                 case `./$dummy` in 
     262                case `$dummy` in 
    196263                        0-0) 
    197264                                UNAME_MACHINE="alpha" 
     
    212279                                UNAME_MACHINE="alphaev67" 
    213280                                ;; 
     281                        2-1307) 
     282                                UNAME_MACHINE="alphaev68" 
     283                                ;; 
     284                        3-1307) 
     285                                UNAME_MACHINE="alphaev7" 
     286                                ;; 
    214287                esac 
    215288        fi 
    216         rm -f $dummy.s $dummy 
     289        rm -f $dummy.s $dummy && rmdir $tmpdir 
    217290        echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 
    218291        exit 0 ;; 
     
    229302        echo m68k-unknown-sysv4 
    230303        exit 0;; 
    231     amiga:OpenBSD:*:*) 
    232         echo m68k-unknown-openbsd${UNAME_RELEASE} 
    233         exit 0 ;; 
    234304    *:[Aa]miga[Oo][Ss]:*:*) 
    235305        echo ${UNAME_MACHINE}-unknown-amigaos 
    236306        exit 0 ;; 
    237     arc64:OpenBSD:*:*) 
    238         echo mips64el-unknown-openbsd${UNAME_RELEASE} 
    239         exit 0 ;; 
    240     arc:OpenBSD:*:*) 
    241         echo mipsel-unknown-openbsd${UNAME_RELEASE} 
    242         exit 0 ;; 
    243     hkmips:OpenBSD:*:*) 
    244         echo mips-unknown-openbsd${UNAME_RELEASE} 
    245         exit 0 ;; 
    246     pmax:OpenBSD:*:*) 
    247         echo mipsel-unknown-openbsd${UNAME_RELEASE} 
    248         exit 0 ;; 
    249     sgi:OpenBSD:*:*) 
    250         echo mips-unknown-openbsd${UNAME_RELEASE} 
    251         exit 0 ;; 
    252     wgrisc:OpenBSD:*:*) 
    253         echo mipsel-unknown-openbsd${UNAME_RELEASE} 
     307    *:[Mm]orph[Oo][Ss]:*:*) 
     308        echo ${UNAME_MACHINE}-unknown-morphos 
    254309        exit 0 ;; 
    255310    *:OS/390:*:*) 
     
    259314        echo arm-acorn-riscix${UNAME_RELEASE} 
    260315        exit 0;; 
    261     SR2?01:HI-UX/MPP:*:*
     316    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*
    262317        echo hppa1.1-hitachi-hiuxmpp 
    263318        exit 0;; 
     
    273328        echo pyramid-pyramid-svr4 
    274329        exit 0 ;; 
     330    DRS?6000:UNIX_SV:4.2*:7*) 
     331        case `/usr/bin/uname -p` in 
     332            sparc) echo sparc-icl-nx7 && exit 0 ;; 
     333        esac ;; 
    275334    sun4H:SunOS:5.*:*) 
    276335        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 
     
    301360        exit 0 ;; 
    302361    sun*:*:4.2BSD:*) 
    303         UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 
     362        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 
    304363        test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 
    305364        case "`/bin/arch`" in 
     
    314373    aushp:SunOS:*:*) 
    315374        echo sparc-auspex-sunos${UNAME_RELEASE} 
    316         exit 0 ;; 
    317     atari*:OpenBSD:*:*) 
    318         echo m68k-unknown-openbsd${UNAME_RELEASE} 
    319375        exit 0 ;; 
    320376    # The situation for MiNT is a little confusing.  The machine name 
     
    344400        echo m68k-unknown-mint${UNAME_RELEASE} 
    345401        exit 0 ;; 
    346     sun3*:OpenBSD:*:*) 
    347         echo m68k-unknown-openbsd${UNAME_RELEASE} 
    348         exit 0 ;; 
    349     mac68k:OpenBSD:*:*) 
    350         echo m68k-unknown-openbsd${UNAME_RELEASE} 
    351         exit 0 ;; 
    352     mvme68k:OpenBSD:*:*) 
    353         echo m68k-unknown-openbsd${UNAME_RELEASE} 
    354         exit 0 ;; 
    355     mvme88k:OpenBSD:*:*) 
    356         echo m88k-unknown-openbsd${UNAME_RELEASE} 
    357         exit 0 ;; 
    358402    powerpc:machten:*:*) 
    359403        echo powerpc-apple-machten${UNAME_RELEASE} 
     
    372416        exit 0 ;; 
    373417    mips:*:*:UMIPS | mips:*:*:RISCos) 
     418        eval $set_cc_for_build 
    374419        sed 's/^        //' << EOF >$dummy.c 
    375420#ifdef __cplusplus 
     
    393438        } 
    394439EOF 
    395         $CC_FOR_BUILD $dummy.c -o $dummy
    396           && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ 
    397           && rm $dummy.c $dummy && exit 0 
    398         rm -f $dummy.c $dummy 
     440        $CC_FOR_BUILD -o $dummy $dummy.c
     441          && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ 
     442          && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 
     443        rm -f $dummy.c $dummy && rmdir $tmpdir 
    399444        echo mips-mips-riscos${UNAME_RELEASE} 
     445        exit 0 ;; 
     446    Motorola:PowerMAX_OS:*:*) 
     447        echo powerpc-motorola-powermax 
     448        exit 0 ;; 
     449    Motorola:*:4.3:PL8-*) 
     450        echo powerpc-harris-powermax 
     451        exit 0 ;; 
     452    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) 
     453        echo powerpc-harris-powermax 
    400454        exit 0 ;; 
    401455    Night_Hawk:Power_UNIX:*:*) 
     
    446500        echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id 
    447501        exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX ' 
    448     i?86:AIX:*:*) 
     502    i*86:AIX:*:*) 
    449503        echo i386-ibm-aix 
     504        exit 0 ;; 
     505    ia64:AIX:*:*) 
     506        if [ -x /usr/bin/oslevel ] ; then 
     507                IBM_REV=`/usr/bin/oslevel` 
     508        else 
     509                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 
     510        fi 
     511        echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} 
    450512        exit 0 ;; 
    451513    *:AIX:2:3) 
    452514        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 
     515                eval $set_cc_for_build 
    453516                sed 's/^                //' << EOF >$dummy.c 
    454517                #include <sys/systemcfg.h> 
     
    462525                        } 
    463526EOF 
    464                 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 
    465                 rm -f $dummy.c $dummy 
     527                $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 
     528                rm -f $dummy.c $dummy && rmdir $tmpdir 
    466529                echo rs6000-ibm-aix3.2.5 
    467530        elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then 
     
    471534        fi 
    472535        exit 0 ;; 
    473     *:AIX:*:4
    474         IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` 
    475         if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then 
     536    *:AIX:*:[45]
     537        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 
     538        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then 
    476539                IBM_ARCH=rs6000 
    477540        else 
     
    481544                IBM_REV=`/usr/bin/oslevel` 
    482545        else 
    483                 IBM_REV=4.${UNAME_RELEASE} 
     546                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 
    484547        fi 
    485548        echo ${IBM_ARCH}-ibm-aix${IBM_REV} 
     
    507570        exit 0 ;; 
    508571    9000/[34678]??:HP-UX:*:*) 
     572        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 
    509573        case "${UNAME_MACHINE}" in 
    510574            9000/31? )            HP_ARCH=m68000 ;; 
    511575            9000/[34]?? )         HP_ARCH=m68k ;; 
    512576            9000/[678][0-9][0-9]) 
    513               sed 's/^              //' << EOF >$dummy.c 
     577                if [ -x /usr/bin/getconf ]; then 
     578                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` 
     579                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` 
     580                    case "${sc_cpu_version}" in 
     581                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 
     582                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 
     583                      532)                      # CPU_PA_RISC2_0 
     584                        case "${sc_kernel_bits}" in 
     585                          32) HP_ARCH="hppa2.0n" ;; 
     586                          64) HP_ARCH="hppa2.0w" ;; 
     587                          '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20 
     588                        esac ;; 
     589                    esac 
     590                fi 
     591                if [ "${HP_ARCH}" = "" ]; then 
     592                    eval $set_cc_for_build 
     593                    sed 's/^              //' << EOF >$dummy.c 
    514594 
    515595              #define _HPUX_SOURCE 
     
    544624              } 
    545625EOF 
    546         (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` 
    547         if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi 
    548         rm -f $dummy.c $dummy 
     626                    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` 
     627                    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi 
     628                    rm -f $dummy.c $dummy && rmdir $tmpdir 
     629                fi ;; 
    549630        esac 
     631        echo ${HP_ARCH}-hp-hpux${HPUX_REV} 
     632        exit 0 ;; 
     633    ia64:HP-UX:*:*) 
    550634        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 
    551         echo ${HP_ARCH}-hp-hpux${HPUX_REV} 
     635        echo ia64-hp-hpux${HPUX_REV} 
    552636        exit 0 ;; 
    553637    3050*:HI-UX:*:*) 
     638        eval $set_cc_for_build 
    554639        sed 's/^        //' << EOF >$dummy.c 
    555640        #include <unistd.h> 
     
    577662        } 
    578663EOF 
    579         $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 
    580         rm -f $dummy.c $dummy 
     664        $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 
     665        rm -f $dummy.c $dummy && rmdir $tmpdir 
    581666        echo unknown-hitachi-hiuxwe2 
    582667        exit 0 ;; 
     
    587672        echo hppa1.0-hp-bsd 
    588673        exit 0 ;; 
    589     *9??*:MPE/iX:*:*
     674    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*
    590675        echo hppa1.0-hp-mpeix 
    591676        exit 0 ;; 
     
    596681        echo hppa1.0-hp-osf 
    597682        exit 0 ;; 
    598     i?86:OSF1:*:*) 
     683    i*86:OSF1:*:*) 
    599684        if [ -x /usr/sbin/sysversion ] ; then 
    600685            echo ${UNAME_MACHINE}-unknown-osf1mk 
     
    605690    parisc*:Lites*:*:*) 
    606691        echo hppa1.1-hp-lites 
    607         exit 0 ;; 
    608     hppa*:OpenBSD:*:*) 
    609         echo hppa-unknown-openbsd 
    610692        exit 0 ;; 
    611693    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) 
     
    627709        echo c4-convex-bsd 
    628710        exit 0 ;; 
    629     CRAY*X-MP:*:*:*) 
    630         echo xmp-cray-unicos 
    631         exit 0 ;; 
    632711    CRAY*Y-MP:*:*:*) 
    633         echo ymp-cray-unicos${UNAME_RELEASE} 
     712        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    634713        exit 0 ;; 
    635714    CRAY*[A-Z]90:*:*:*) 
    636715        echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ 
    637716        | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ 
    638               -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ 
     717              -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ 
     718              -e 's/\.[^.]*$/.X/' 
    639719        exit 0 ;; 
    640720    CRAY*TS:*:*:*) 
    641721        echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    642722        exit 0 ;; 
     723    CRAY*T3D:*:*:*) 
     724        echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
     725        exit 0 ;; 
    643726    CRAY*T3E:*:*:*) 
    644         echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
     727        echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    645728        exit 0 ;; 
    646729    CRAY*SV1:*:*:*) 
    647730        echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
    648731        exit 0 ;; 
    649     CRAY-2:*:*:*) 
    650         echo cray2-cray-unicos 
    651         exit 0 ;; 
    652     F300:UNIX_System_V:*:*) 
     732    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) 
     733        FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 
    653734        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 
    654735        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` 
    655         echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 
     736        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 
    656737        exit 0 ;; 
    657     F301:UNIX_System_V:*:*) 
    658        echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` 
    659        exit 0 ;; 
    660     hp300:OpenBSD:*:*) 
    661         echo m68k-unknown-openbsd${UNAME_RELEASE} 
    662         exit 0 ;; 
    663     i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 
     738    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 
    664739        echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} 
    665740        exit 0 ;; 
     
    671746        exit 0 ;; 
    672747    *:FreeBSD:*:*) 
    673         echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` 
    674         exit 0 ;; 
    675     *:OpenBSD:*:*) 
    676         echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` 
     748        # Determine whether the default compiler uses glibc. 
     749        eval $set_cc_for_build 
     750        sed 's/^        //' << EOF >$dummy.c 
     751        #include <features.h> 
     752        #if __GLIBC__ >= 2 
     753        LIBC=gnu 
     754        #else 
     755        LIBC= 
     756        #endif 
     757EOF 
     758        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` 
     759        rm -f $dummy.c && rmdir $tmpdir 
     760        echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} 
    677761        exit 0 ;; 
    678762    i*:CYGWIN*:*) 
     
    684768    i*:PW*:*) 
    685769        echo ${UNAME_MACHINE}-pc-pw32 
     770        exit 0 ;; 
     771    x86:Interix*:3*) 
     772        echo i386-pc-interix3 
     773        exit 0 ;; 
     774    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) 
     775        echo i${UNAME_MACHINE}-pc-mks 
    686776        exit 0 ;; 
    687777    i*:Windows_NT*:* | Pentium*:Windows_NT*:*) 
     
    706796        echo ${UNAME_MACHINE}-pc-minix 
    707797        exit 0 ;; 
    708     *:Linux:*:*) 
    709  
     798    arm*:Linux:*:*) 
     799        echo ${UNAME_MACHINE}-unknown-linux-gnu 
     800        exit 0 ;; 
     801    ia64:Linux:*:*) 
     802        echo ${UNAME_MACHINE}-unknown-linux-gnu 
     803        exit 0 ;; 
     804    m68*:Linux:*:*) 
     805        echo ${UNAME_MACHINE}-unknown-linux-gnu 
     806        exit 0 ;; 
     807    mips:Linux:*:*) 
     808        eval $set_cc_for_build 
     809        sed 's/^        //' << EOF >$dummy.c 
     810        #undef CPU 
     811        #undef mips 
     812        #undef mipsel 
     813        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 
     814        CPU=mipsel 
     815        #else 
     816        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 
     817        CPU=mips 
     818        #else 
     819        CPU= 
     820        #endif 
     821        #endif 
     822EOF 
     823        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` 
     824        rm -f $dummy.c && rmdir $tmpdir 
     825        test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 
     826        ;; 
     827    ppc:Linux:*:*) 
     828        echo powerpc-unknown-linux-gnu 
     829        exit 0 ;; 
     830    ppc64:Linux:*:*) 
     831        echo powerpc64-unknown-linux-gnu 
     832        exit 0 ;; 
     833    alpha:Linux:*:*) 
     834        case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in 
     835          EV5)   UNAME_MACHINE=alphaev5 ;; 
     836          EV56)  UNAME_MACHINE=alphaev56 ;; 
     837          PCA56) UNAME_MACHINE=alphapca56 ;; 
     838          PCA57) UNAME_MACHINE=alphapca56 ;; 
     839          EV6)   UNAME_MACHINE=alphaev6 ;; 
     840          EV67)  UNAME_MACHINE=alphaev67 ;; 
     841          EV68*) UNAME_MACHINE=alphaev68 ;; 
     842        esac 
     843        objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null 
     844        if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi 
     845        echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} 
     846        exit 0 ;; 
     847    parisc:Linux:*:* | hppa:Linux:*:*) 
     848        # Look for CPU level 
     849        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 
     850          PA7*) echo hppa1.1-unknown-linux-gnu ;; 
     851          PA8*) echo hppa2.0-unknown-linux-gnu ;; 
     852          *)    echo hppa-unknown-linux-gnu ;; 
     853        esac 
     854        exit 0 ;; 
     855    parisc64:Linux:*:* | hppa64:Linux:*:*) 
     856        echo hppa64-unknown-linux-gnu 
     857        exit 0 ;; 
     858    s390:Linux:*:* | s390x:Linux:*:*) 
     859        echo ${UNAME_MACHINE}-ibm-linux 
     860        exit 0 ;; 
     861    sh*:Linux:*:*) 
     862        echo ${UNAME_MACHINE}-unknown-linux-gnu 
     863        exit 0 ;; 
     864    sparc:Linux:*:* | sparc64:Linux:*:*) 
     865        echo ${UNAME_MACHINE}-unknown-linux-gnu 
     866        exit 0 ;; 
     867    x86_64:Linux:*:*) 
     868        echo x86_64-unknown-linux-gnu 
     869        exit 0 ;; 
     870    i*86:Linux:*:*) 
    710871        # The BFD linker knows what the default object file format is, so 
    711872        # first see if it will tell us. cd to the root directory to prevent 
    712873        # problems with other programs or directories called `ld' in the path. 
    713         ld_supported_emulations=`cd /; ld --help 2>&1 \ 
    714                          | sed -ne '/supported emulations:/!d 
     874        # Set LC_ALL=C to ensure ld outputs messages in English. 
     875        ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ 
     876                         | sed -ne '/supported targets:/!d 
    715877                                    s/[         ][      ]*/ /g 
    716                                     s/.*supported emulations: *// 
     878                                    s/.*supported targets: *// 
    717879                                    s/ .*// 
    718880                                    p'` 
    719         case "$ld_supported_emulations" in 
    720           *ia64) 
    721                 echo "${UNAME_MACHINE}-unknown-linux" 
    722                 exit 0 
    723                 ;; 
    724           i?86linux) 
    725                 echo "${UNAME_MACHINE}-pc-linux-gnuaout" 
    726                 exit 0 
    727                 ;; 
    728           elf_i?86) 
     881        case "$ld_supported_targets" in 
     882          elf32-i386) 
    729883                TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" 
    730884                ;; 
    731           i?86coff) 
     885          a.out-i386-linux) 
     886                echo "${UNAME_MACHINE}-pc-linux-gnuaout" 
     887                exit 0 ;; 
     888          coff-i386) 
    732889                echo "${UNAME_MACHINE}-pc-linux-gnucoff" 
    733                 exit 0 
    734                 ;; 
    735           sparclinux) 
    736                 echo "${UNAME_MACHINE}-unknown-linux-gnuaout" 
    737                 exit 0 
    738                 ;; 
    739           elf32_sparc) 
    740                 echo "${UNAME_MACHINE}-unknown-linux-gnu" 
    741                 exit 0 
    742                 ;; 
    743           armlinux) 
    744                 echo "${UNAME_MACHINE}-unknown-linux-gnuaout" 
    745                 exit 0 
    746                 ;; 
    747           elf32arm*) 
    748                 echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" 
    749                 exit 0 
    750                 ;; 
    751           armelf_linux*) 
    752                 echo "${UNAME_MACHINE}-unknown-linux-gnu" 
    753                 exit 0 
    754                 ;; 
    755           m68klinux) 
    756                 echo "${UNAME_MACHINE}-unknown-linux-gnuaout" 
    757                 exit 0 
    758                 ;; 
    759           elf32ppc | elf32ppclinux) 
    760                 # Determine Lib Version 
    761                 cat >$dummy.c <<EOF 
    762 #include <features.h> 
    763 #if defined(__GLIBC__) 
    764 extern char __libc_version[]; 
    765 extern char __libc_release[]; 
    766 #endif 
    767 main(argc, argv) 
    768      int argc; 
    769      char *argv[]; 
    770 
    771 #if defined(__GLIBC__) 
    772   printf("%s %s\n", __libc_version, __libc_release); 
    773 #else 
    774   printf("unkown\n"); 
    775 #endif 
    776   return 0; 
    777 
     890                exit 0 ;; 
     891          "") 
     892                # Either a pre-BFD a.out linker (linux-gnuoldld) or 
     893                # one that does not give us useful --help. 
     894                echo "${UNAME_MACHINE}-pc-linux-gnuoldld" 
     895                exit 0 ;; 
     896        esac 
     897        # Determine whether the default compiler is a.out or elf 
     898        eval $set_cc_for_build 
     899        sed 's/^        //' << EOF >$dummy.c 
     900        #include <features.h> 
     901        #ifdef __ELF__ 
     902        # ifdef __GLIBC__ 
     903        #  if __GLIBC__ >= 2 
     904        LIBC=gnu 
     905        #  else 
     906        LIBC=gnulibc1 
     907        #  endif 
     908        # else 
     909        LIBC=gnulibc1 
     910        # endif 
     911        #else 
     912        #ifdef __INTEL_COMPILER 
     913        LIBC=gnu 
     914        #else 
     915        LIBC=gnuaout 
     916        #endif 
     917        #endif 
    778918EOF 
    779                 LIBC="" 
    780                 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null 
    781                 if test "$?" = 0 ; then 
    782                         ./$dummy | grep 1\.99 > /dev/null 
    783                         if test "$?" = 0 ; then 
    784                                 LIBC="libc1" 
    785                         fi 
    786                 fi 
    787                 rm -f $dummy.c $dummy 
    788                 echo powerpc-unknown-linux-gnu${LIBC} 
    789                 exit 0 
    790                 ;; 
    791           shelf_linux) 
    792                 echo "${UNAME_MACHINE}-unknown-linux-gnu" 
    793                 exit 0 
    794                 ;; 
    795         esac 
    796  
    797         if test "${UNAME_MACHINE}" = "alpha" ; then 
    798                 cat <<EOF >$dummy.s 
    799                         .data 
    800                 \$Lformat: 
    801                         .byte 37,100,45,37,120,10,0     # "%d-%x\n" 
    802  
    803                         .text 
    804                         .globl main 
    805                         .align 4 
    806                         .ent main 
    807                 main: 
    808                         .frame \$30,16,\$26,0 
    809                         ldgp \$29,0(\$27) 
    810                         .prologue 1 
    811                         .long 0x47e03d80 # implver \$0 
    812                         lda \$2,-1 
    813                         .long 0x47e20c21 # amask \$2,\$1 
    814                         lda \$16,\$Lformat 
    815                         mov \$0,\$17 
    816                         not \$1,\$18 
    817                         jsr \$26,printf 
    818                         ldgp \$29,0(\$26) 
    819                         mov 0,\$16 
    820                         jsr \$26,exit 
    821                         .end main 
    822 EOF 
    823                 LIBC="" 
    824                 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null 
    825                 if test "$?" = 0 ; then 
    826                         case `./$dummy` in 
    827                         0-0) 
    828                                 UNAME_MACHINE="alpha" 
    829                                 ;; 
    830                         1-0) 
    831                                 UNAME_MACHINE="alphaev5" 
    832                                 ;; 
    833                         1-1) 
    834                                 UNAME_MACHINE="alphaev56" 
    835                                 ;; 
    836                         1-101) 
    837                                 UNAME_MACHINE="alphapca56" 
    838                                 ;; 
    839                         2-303) 
    840                                 UNAME_MACHINE="alphaev6" 
    841                                 ;; 
    842                         2-307) 
    843                                 UNAME_MACHINE="alphaev67" 
    844                                 ;; 
    845                         esac 
    846  
    847                         objdump --private-headers $dummy | \ 
    848                           grep ld.so.1 > /dev/null 
    849                         if test "$?" = 0 ; then 
    850                                 LIBC="libc1" 
    851                         fi 
    852                 fi 
    853                 rm -f $dummy.s $dummy 
    854                 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 
    855         elif test "${UNAME_MACHINE}" = "mips" ; then 
    856           cat >$dummy.c <<EOF 
    857 #ifdef __cplusplus 
    858 #include <stdio.h>  /* for printf() prototype */ 
    859         int main (int argc, char *argv[]) { 
    860 #else 
    861         int main (argc, argv) int argc; char *argv[]; { 
    862 #endif 
    863 #ifdef __MIPSEB__ 
    864   printf ("%s-unknown-linux-gnu\n", argv[1]); 
    865 #endif 
    866 #ifdef __MIPSEL__ 
    867   printf ("%sel-unknown-linux-gnu\n", argv[1]); 
    868 #endif 
    869   return 0; 
    870 
    871 EOF 
    872           $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 
    873           rm -f $dummy.c $dummy 
    874         elif test "${UNAME_MACHINE}" = "s390"; then 
    875           echo s390-ibm-linux && exit 0 
    876         elif test "${UNAME_MACHINE}" = "x86_64"; then 
    877           echo x86_64-unknown-linux-gnu && exit 0 
    878         elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then 
    879           # Look for CPU level 
    880           case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 
    881             PA7*) 
    882                 echo hppa1.1-unknown-linux-gnu 
    883                 ;; 
    884             PA8*) 
    885                 echo hppa2.0-unknown-linux-gnu 
    886                 ;; 
    887             *) 
    888                 echo hppa-unknown-linux-gnu 
    889                 ;; 
    890           esac 
    891           exit 0 
    892         else 
    893           # Either a pre-BFD a.out linker (linux-gnuoldld) 
    894           # or one that does not give us useful --help. 
    895           # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. 
    896           # If ld does not provide *any* "supported emulations:" 
    897           # that means it is gnuoldld. 
    898           test -z "$ld_supported_emulations" \ 
    899             && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 
    900  
    901           case "${UNAME_MACHINE}" in 
    902           i?86) 
    903             VENDOR=pc; 
    904             ;; 
    905           *) 
    906             VENDOR=unknown; 
    907             ;; 
    908           esac 
    909           # Determine whether the default compiler is a.out or elf 
    910           cat >$dummy.c <<EOF 
    911 #include <features.h> 
    912 #ifdef __cplusplus 
    913 #include <stdio.h>  /* for printf() prototype */ 
    914         int main (int argc, char *argv[]) { 
    915 #else 
    916         int main (argc, argv) int argc; char *argv[]; { 
    917 #endif 
    918 #ifdef __ELF__ 
    919 # ifdef __GLIBC__ 
    920 #  if __GLIBC__ >= 2 
    921     printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); 
    922 #  else 
    923     printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); 
    924 #  endif 
    925 # else 
    926    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); 
    927 # endif 
    928 #else 
    929   printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); 
    930 #endif 
    931   return 0; 
    932