home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 2001 January / CT_SW0101.ISO / pc / software / kommunik / ftp / kmago112.tgz / kmago112.tar / kmago-1.1.2 / admin / config.guess < prev    next >
Text File  |  2001-01-17  |  38KB  |  1,357 lines

  1. #! /bin/sh
  2. # 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. timestamp='2000-12-02'
  7.  
  8. # This file is free software; you can redistribute it and/or modify it
  9. # under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26.  
  27. # Written by Per Bothner <bothner@cygnus.com>.
  28. # Please send patches to <config-patches@gnu.org>.
  29. #
  30. # This script attempts to guess a canonical system name similar to
  31. # config.sub.  If it succeeds, it prints the system name on stdout, and
  32. # exits with 0.  Otherwise, it exits with 1.
  33. #
  34. # The plan is that this can be called by configure scripts if you
  35. # don't specify an explicit build system type.
  36. #
  37. # Only a few systems have been added to this list; please add others
  38. # (but try to keep the structure clean).
  39. #
  40.  
  41. me=`echo "$0" | sed -e 's,.*/,,'`
  42.  
  43. usage="\
  44. Usage: $0 [OPTION]
  45.  
  46. Output the configuration name of the system \`$me' is run on.
  47.  
  48. Operation modes:
  49.   -h, --help         print this help, then exit
  50.   -t, --time-stamp   print date of last modification, then exit
  51.  
  52. Report bugs and patches to <config-patches@gnu.org>.
  53.  
  54. Written by Per Bothner.
  55. Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
  56. Free Software Foundation, Inc.  See the source for copying conditions."
  57.  
  58. help="
  59. Try \`$me --help' for more information."
  60.  
  61. # Parse command line
  62. while test $# -gt 0 ; do
  63.   case $1 in
  64.     --time-stamp | --time* | -t)
  65.        echo "$timestamp" ; exit 0 ;;
  66.     --help | --h* | -h )
  67.        echo "$usage"; exit 0 ;;
  68.     -- )     # Stop option processing
  69.        shift; break ;;
  70.     - )    # Use stdin as input.
  71.        break ;;
  72.     -* )
  73.        echo "$me: invalid option $1$help" >&2
  74.        exit 1 ;;
  75.     * )
  76.        break ;;
  77.   esac
  78. done
  79.  
  80. if test $# != 0; then
  81.   echo "$me: too many arguments$help" >&2
  82.   exit 1
  83. fi
  84.  
  85.  
  86. dummy=dummy-$$
  87. trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
  88.  
  89. # CC_FOR_BUILD -- compiler used by this script.
  90. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
  91. # use `HOST_CC' if defined, but it is deprecated.
  92.  
  93. case $CC_FOR_BUILD,$HOST_CC,$CC in
  94.  ,,)    echo "int dummy(){}" > $dummy.c
  95.     for c in cc gcc c89 ; do
  96.       ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
  97.       if test $? = 0 ; then
  98.          CC_FOR_BUILD="$c"; break
  99.       fi
  100.     done
  101.     rm -f $dummy.c $dummy.o
  102.     if test x"$CC_FOR_BUILD" = x ; then
  103.       CC_FOR_BUILD=no_compiler_found
  104.     fi
  105.     ;;
  106.  ,,*)   CC_FOR_BUILD=$CC ;;
  107.  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
  108. esac
  109.  
  110. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
  111. # (ghazi@noc.rutgers.edu 8/24/94.)
  112. if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
  113.     PATH=$PATH:/.attbin ; export PATH
  114. fi
  115.  
  116. UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
  117. UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
  118. UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
  119. UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
  120.  
  121. # Note: order is significant - the case branches are not exclusive.
  122.  
  123. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
  124.     *:NetBSD:*:*)
  125.     # Netbsd (nbsd) targets should (where applicable) match one or
  126.     # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
  127.     # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
  128.     # switched to ELF, *-*-netbsd* would select the old
  129.     # object file format.  This provides both forward
  130.     # compatibility and a consistent mechanism for selecting the
  131.     # object file format.
  132.     # Determine the machine/vendor (is the vendor relevant).
  133.     case "${UNAME_MACHINE}" in
  134.         amiga) machine=m68k-unknown ;;
  135.         arm32) machine=arm-unknown ;;
  136.         atari*) machine=m68k-atari ;;
  137.         sun3*) machine=m68k-sun ;;
  138.         mac68k) machine=m68k-apple ;;
  139.         macppc) machine=powerpc-apple ;;
  140.         hp3[0-9][05]) machine=m68k-hp ;;
  141.         ibmrt|romp-ibm) machine=romp-ibm ;;
  142.         *) machine=${UNAME_MACHINE}-unknown ;;
  143.     esac
  144.     # The Operating System including object format, if it has switched
  145.     # to ELF recently, or will in the future.
  146.     case "${UNAME_MACHINE}" in
  147.         i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
  148.         if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
  149.             | grep __ELF__ >/dev/null
  150.         then
  151.             # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
  152.             # Return netbsd for either.  FIX?
  153.             os=netbsd
  154.         else
  155.             os=netbsdelf
  156.         fi
  157.         ;;
  158.         *)
  159.             os=netbsd
  160.         ;;
  161.     esac
  162.     # The OS release
  163.     release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  164.     # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
  165.     # contains redundant information, the shorter form:
  166.     # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
  167.     echo "${machine}-${os}${release}"
  168.     exit 0 ;;
  169.     alpha:OSF1:*:*)
  170.     if test $UNAME_RELEASE = "V4.0"; then
  171.         UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
  172.     fi
  173.     # A Vn.n version is a released version.
  174.     # A Tn.n version is a released field test version.
  175.     # A Xn.n version is an unreleased experimental baselevel.
  176.     # 1.2 uses "1.2" for uname -r.
  177.     cat <<EOF >$dummy.s
  178.     .data
  179. \$Lformat:
  180.     .byte 37,100,45,37,120,10,0    # "%d-%x\n"
  181.  
  182.     .text
  183.     .globl main
  184.     .align 4
  185.     .ent main
  186. main:
  187.     .frame \$30,16,\$26,0
  188.     ldgp \$29,0(\$27)
  189.     .prologue 1
  190.     .long 0x47e03d80 # implver \$0
  191.     lda \$2,-1
  192.     .long 0x47e20c21 # amask \$2,\$1
  193.     lda \$16,\$Lformat
  194.     mov \$0,\$17
  195.     not \$1,\$18
  196.     jsr \$26,printf
  197.     ldgp \$29,0(\$26)
  198.     mov 0,\$16
  199.     jsr \$26,exit
  200.     .end main
  201. EOF
  202.     $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
  203.     if test "$?" = 0 ; then
  204.         case `./$dummy` in
  205.             0-0)
  206.                 UNAME_MACHINE="alpha"
  207.                 ;;
  208.             1-0)
  209.                 UNAME_MACHINE="alphaev5"
  210.                 ;;
  211.             1-1)
  212.                 UNAME_MACHINE="alphaev56"
  213.                 ;;
  214.             1-101)
  215.                 UNAME_MACHINE="alphapca56"
  216.                 ;;
  217.             2-303)
  218.                 UNAME_MACHINE="alphaev6"
  219.                 ;;
  220.             2-307)
  221.                 UNAME_MACHINE="alphaev67"
  222.                 ;;
  223.         esac
  224.     fi
  225.     rm -f $dummy.s $dummy
  226.     echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  227.     exit 0 ;;
  228.     Alpha\ *:Windows_NT*:*)
  229.     # How do we know it's Interix rather than the generic POSIX subsystem?
  230.     # Should we change UNAME_MACHINE based on the output of uname instead
  231.     # of the specific Alpha model?
  232.     echo alpha-pc-interix
  233.     exit 0 ;;
  234.     21064:Windows_NT:50:3)
  235.     echo alpha-dec-winnt3.5
  236.     exit 0 ;;
  237.     Amiga*:UNIX_System_V:4.0:*)
  238.     echo m68k-unknown-sysv4
  239.     exit 0;;
  240.     amiga:OpenBSD:*:*)
  241.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  242.     exit 0 ;;
  243.     *:[Aa]miga[Oo][Ss]:*:*)
  244.     echo ${UNAME_MACHINE}-unknown-amigaos
  245.     exit 0 ;;
  246.     arc64:OpenBSD:*:*)
  247.     echo mips64el-unknown-openbsd${UNAME_RELEASE}
  248.     exit 0 ;;
  249.     arc:OpenBSD:*:*)
  250.     echo mipsel-unknown-openbsd${UNAME_RELEASE}
  251.     exit 0 ;;
  252.     hkmips:OpenBSD:*:*)
  253.     echo mips-unknown-openbsd${UNAME_RELEASE}
  254.     exit 0 ;;
  255.     pmax:OpenBSD:*:*)
  256.     echo mipsel-unknown-openbsd${UNAME_RELEASE}
  257.     exit 0 ;;
  258.     sgi:OpenBSD:*:*)
  259.     echo mips-unknown-openbsd${UNAME_RELEASE}
  260.     exit 0 ;;
  261.     wgrisc:OpenBSD:*:*)
  262.     echo mipsel-unknown-openbsd${UNAME_RELEASE}
  263.     exit 0 ;;
  264.     *:OS/390:*:*)
  265.     echo i370-ibm-openedition
  266.     exit 0 ;;
  267.     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  268.     echo arm-acorn-riscix${UNAME_RELEASE}
  269.     exit 0;;
  270.     SR2?01:HI-UX/MPP:*:*)
  271.     echo hppa1.1-hitachi-hiuxmpp
  272.     exit 0;;
  273.     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
  274.     # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
  275.     if test "`(/bin/universe) 2>/dev/null`" = att ; then
  276.         echo pyramid-pyramid-sysv3
  277.     else
  278.         echo pyramid-pyramid-bsd
  279.     fi
  280.     exit 0 ;;
  281.     NILE*:*:*:dcosx)
  282.     echo pyramid-pyramid-svr4
  283.     exit 0 ;;
  284.     sun4H:SunOS:5.*:*)
  285.     echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  286.     exit 0 ;;
  287.     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
  288.     echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  289.     exit 0 ;;
  290.     i86pc:SunOS:5.*:*)
  291.     echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  292.     exit 0 ;;
  293.     sun4*:SunOS:6*:*)
  294.     # According to config.sub, this is the proper way to canonicalize
  295.     # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
  296.     # it's likely to be more like Solaris than SunOS4.
  297.     echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  298.     exit 0 ;;
  299.     sun4*:SunOS:*:*)
  300.     case "`/usr/bin/arch -k`" in
  301.         Series*|S4*)
  302.         UNAME_RELEASE=`uname -v`
  303.         ;;
  304.     esac
  305.     # Japanese Language versions have a version number like `4.1.3-JL'.
  306.     echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
  307.     exit 0 ;;
  308.     sun3*:SunOS:*:*)
  309.     echo m68k-sun-sunos${UNAME_RELEASE}
  310.     exit 0 ;;
  311.     sun*:*:4.2BSD:*)
  312.     UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
  313.     test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
  314.     case "`/bin/arch`" in
  315.         sun3)
  316.         echo m68k-sun-sunos${UNAME_RELEASE}
  317.         ;;
  318.         sun4)
  319.         echo sparc-sun-sunos${UNAME_RELEASE}
  320.         ;;
  321.     esac
  322.     exit 0 ;;
  323.     aushp:SunOS:*:*)
  324.     echo sparc-auspex-sunos${UNAME_RELEASE}
  325.     exit 0 ;;
  326.     atari*:OpenBSD:*:*)
  327.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  328.     exit 0 ;;
  329.     # The situation for MiNT is a little confusing.  The machine name
  330.     # can be virtually everything (everything which is not
  331.     # "atarist" or "atariste" at least should have a processor
  332.     # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
  333.     # to the lowercase version "mint" (or "freemint").  Finally
  334.     # the system name "TOS" denotes a system which is actually not
  335.     # MiNT.  But MiNT is downward compatible to TOS, so this should
  336.     # be no problem.
  337.     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
  338.         echo m68k-atari-mint${UNAME_RELEASE}
  339.     exit 0 ;;
  340.     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
  341.     echo m68k-atari-mint${UNAME_RELEASE}
  342.         exit 0 ;;
  343.     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
  344.         echo m68k-atari-mint${UNAME_RELEASE}
  345.     exit 0 ;;
  346.     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
  347.         echo m68k-milan-mint${UNAME_RELEASE}
  348.         exit 0 ;;
  349.     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
  350.         echo m68k-hades-mint${UNAME_RELEASE}
  351.         exit 0 ;;
  352.     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
  353.         echo m68k-unknown-mint${UNAME_RELEASE}
  354.         exit 0 ;;
  355.     sun3*:OpenBSD:*:*)
  356.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  357.     exit 0 ;;
  358.     mac68k:OpenBSD:*:*)
  359.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  360.     exit 0 ;;
  361.     mvme68k:OpenBSD:*:*)
  362.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  363.     exit 0 ;;
  364.     mvme88k:OpenBSD:*:*)
  365.     echo m88k-unknown-openbsd${UNAME_RELEASE}
  366.     exit 0 ;;
  367.     powerpc:machten:*:*)
  368.     echo powerpc-apple-machten${UNAME_RELEASE}
  369.     exit 0 ;;
  370.     RISC*:Mach:*:*)
  371.     echo mips-dec-mach_bsd4.3
  372.     exit 0 ;;
  373.     RISC*:ULTRIX:*:*)
  374.     echo mips-dec-ultrix${UNAME_RELEASE}
  375.     exit 0 ;;
  376.     VAX*:ULTRIX*:*:*)
  377.     echo vax-dec-ultrix${UNAME_RELEASE}
  378.     exit 0 ;;
  379.     2020:CLIX:*:* | 2430:CLIX:*:*)
  380.     echo clipper-intergraph-clix${UNAME_RELEASE}
  381.     exit 0 ;;
  382.     mips:*:*:UMIPS | mips:*:*:RISCos)
  383.     sed 's/^    //' << EOF >$dummy.c
  384. #ifdef __cplusplus
  385. #include <stdio.h>  /* for printf() prototype */
  386.     int main (int argc, char *argv[]) {
  387. #else
  388.     int main (argc, argv) int argc; char *argv[]; {
  389. #endif
  390.     #if defined (host_mips) && defined (MIPSEB)
  391.     #if defined (SYSTYPE_SYSV)
  392.       printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
  393.     #endif
  394.     #if defined (SYSTYPE_SVR4)
  395.       printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
  396.     #endif
  397.     #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
  398.       printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
  399.     #endif
  400.     #endif
  401.       exit (-1);
  402.     }
  403. EOF
  404.     $CC_FOR_BUILD $dummy.c -o $dummy \
  405.       && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
  406.       && rm $dummy.c $dummy && exit 0
  407.     rm -f $dummy.c $dummy
  408.     echo mips-mips-riscos${UNAME_RELEASE}
  409.     exit 0 ;;
  410.     Night_Hawk:Power_UNIX:*:*)
  411.     echo powerpc-harris-powerunix
  412.     exit 0 ;;
  413.     m88k:CX/UX:7*:*)
  414.     echo m88k-harris-cxux7
  415.     exit 0 ;;
  416.     m88k:*:4*:R4*)
  417.     echo m88k-motorola-sysv4
  418.     exit 0 ;;
  419.     m88k:*:3*:R3*)
  420.     echo m88k-motorola-sysv3
  421.     exit 0 ;;
  422.     AViiON:dgux:*:*)
  423.         # DG/UX returns AViiON for all architectures
  424.         UNAME_PROCESSOR=`/usr/bin/uname -p`
  425.     if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
  426.     then
  427.         if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
  428.            [ ${TARGET_BINARY_INTERFACE}x = x ]
  429.         then
  430.         echo m88k-dg-dgux${UNAME_RELEASE}
  431.         else
  432.         echo m88k-dg-dguxbcs${UNAME_RELEASE}
  433.         fi
  434.     else
  435.         echo i586-dg-dgux${UNAME_RELEASE}
  436.     fi
  437.      exit 0 ;;
  438.     M88*:DolphinOS:*:*)    # DolphinOS (SVR3)
  439.     echo m88k-dolphin-sysv3
  440.     exit 0 ;;
  441.     M88*:*:R3*:*)
  442.     # Delta 88k system running SVR3
  443.     echo m88k-motorola-sysv3
  444.     exit 0 ;;
  445.     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
  446.     echo m88k-tektronix-sysv3
  447.     exit 0 ;;
  448.     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
  449.     echo m68k-tektronix-bsd
  450.     exit 0 ;;
  451.     *:IRIX*:*:*)
  452.     echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
  453.     exit 0 ;;
  454.     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
  455.     echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
  456.     exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
  457.     i?86:AIX:*:*)
  458.     echo i386-ibm-aix
  459.     exit 0 ;;
  460.     *:AIX:2:3)
  461.     if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
  462.         sed 's/^        //' << EOF >$dummy.c
  463.         #include <sys/systemcfg.h>
  464.  
  465.         main()
  466.             {
  467.             if (!__power_pc())
  468.                 exit(1);
  469.             puts("powerpc-ibm-aix3.2.5");
  470.             exit(0);
  471.             }
  472. EOF
  473.         $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
  474.         rm -f $dummy.c $dummy
  475.         echo rs6000-ibm-aix3.2.5
  476.     elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
  477.         echo rs6000-ibm-aix3.2.4
  478.     else
  479.         echo rs6000-ibm-aix3.2
  480.     fi
  481.     exit 0 ;;
  482.     *:AIX:*:4)
  483.     IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
  484.     if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
  485.         IBM_ARCH=rs6000
  486.     else
  487.         IBM_ARCH=powerpc
  488.     fi
  489.     if [ -x /usr/bin/oslevel ] ; then
  490.         IBM_REV=`/usr/bin/oslevel`
  491.     else
  492.         IBM_REV=4.${UNAME_RELEASE}
  493.     fi
  494.     echo ${IBM_ARCH}-ibm-aix${IBM_REV}
  495.     exit 0 ;;
  496.     *:AIX:*:*)
  497.     echo rs6000-ibm-aix
  498.     exit 0 ;;
  499.     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  500.     echo romp-ibm-bsd4.4
  501.     exit 0 ;;
  502.     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
  503.     echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
  504.     exit 0 ;;                           # report: romp-ibm BSD 4.3
  505.     *:BOSX:*:*)
  506.     echo rs6000-bull-bosx
  507.     exit 0 ;;
  508.     DPX/2?00:B.O.S.:*:*)
  509.     echo m68k-bull-sysv3
  510.     exit 0 ;;
  511.     9000/[34]??:4.3bsd:1.*:*)
  512.     echo m68k-hp-bsd
  513.     exit 0 ;;
  514.     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
  515.     echo m68k-hp-bsd4.4
  516.     exit 0 ;;
  517.     9000/[34678]??:HP-UX:*:*)
  518.     HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  519.     case "${UNAME_MACHINE}" in
  520.         9000/31? )            HP_ARCH=m68000 ;;
  521.         9000/[34]?? )         HP_ARCH=m68k ;;
  522.         9000/[678][0-9][0-9])
  523.               case "${HPUX_REV}" in
  524.                 11.[0-9][0-9])
  525.                   if [ -x /usr/bin/getconf ]; then
  526.                     sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
  527.                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
  528.                     case "${sc_cpu_version}" in
  529.                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
  530.                       528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
  531.                       532)                      # CPU_PA_RISC2_0
  532.                         case "${sc_kernel_bits}" in
  533.                           32) HP_ARCH="hppa2.0n" ;;
  534.                           64) HP_ARCH="hppa2.0w" ;;
  535.                         esac ;;
  536.                     esac
  537.                   fi ;;
  538.               esac
  539.               if [ "${HP_ARCH}" = "" ]; then
  540.               sed 's/^              //' << EOF >$dummy.c
  541.  
  542.               #define _HPUX_SOURCE
  543.               #include <stdlib.h>
  544.               #include <unistd.h>
  545.  
  546.               int main ()
  547.               {
  548.               #if defined(_SC_KERNEL_BITS)
  549.                   long bits = sysconf(_SC_KERNEL_BITS);
  550.               #endif
  551.                   long cpu  = sysconf (_SC_CPU_VERSION);
  552.  
  553.                   switch (cpu)
  554.                   {
  555.                   case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
  556.                   case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
  557.                   case CPU_PA_RISC2_0:
  558.               #if defined(_SC_KERNEL_BITS)
  559.                       switch (bits)
  560.                       {
  561.                       case 64: puts ("hppa2.0w"); break;
  562.                       case 32: puts ("hppa2.0n"); break;
  563.                       default: puts ("hppa2.0"); break;
  564.                       } break;
  565.               #else  /* !defined(_SC_KERNEL_BITS) */
  566.                       puts ("hppa2.0"); break;
  567.               #endif
  568.                   default: puts ("hppa1.0"); break;
  569.                   }
  570.                   exit (0);
  571.               }
  572. EOF
  573.     (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
  574.     if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
  575.     rm -f $dummy.c $dummy
  576.     fi ;;
  577.     esac
  578.     echo ${HP_ARCH}-hp-hpux${HPUX_REV}
  579.     exit 0 ;;
  580.     3050*:HI-UX:*:*)
  581.     sed 's/^    //' << EOF >$dummy.c
  582.     #include <unistd.h>
  583.     int
  584.     main ()
  585.     {
  586.       long cpu = sysconf (_SC_CPU_VERSION);
  587.       /* The order matters, because CPU_IS_HP_MC68K erroneously returns
  588.          true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
  589.          results, however.  */
  590.       if (CPU_IS_PA_RISC (cpu))
  591.         {
  592.           switch (cpu)
  593.         {
  594.           case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
  595.           case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
  596.           case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
  597.           default: puts ("hppa-hitachi-hiuxwe2"); break;
  598.         }
  599.         }
  600.       else if (CPU_IS_HP_MC68K (cpu))
  601.         puts ("m68k-hitachi-hiuxwe2");
  602.       else puts ("unknown-hitachi-hiuxwe2");
  603.       exit (0);
  604.     }
  605. EOF
  606.     $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
  607.     rm -f $dummy.c $dummy
  608.     echo unknown-hitachi-hiuxwe2
  609.     exit 0 ;;
  610.     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
  611.     echo hppa1.1-hp-bsd
  612.     exit 0 ;;
  613.     9000/8??:4.3bsd:*:*)
  614.     echo hppa1.0-hp-bsd
  615.     exit 0 ;;
  616.     *9??*:MPE/iX:*:*)
  617.     echo hppa1.0-hp-mpeix
  618.     exit 0 ;;
  619.     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
  620.     echo hppa1.1-hp-osf
  621.     exit 0 ;;
  622.     hp8??:OSF1:*:*)
  623.     echo hppa1.0-hp-osf
  624.     exit 0 ;;
  625.     i?86:OSF1:*:*)
  626.     if [ -x /usr/sbin/sysversion ] ; then
  627.         echo ${UNAME_MACHINE}-unknown-osf1mk
  628.     else
  629.         echo ${UNAME_MACHINE}-unknown-osf1
  630.     fi
  631.     exit 0 ;;
  632.     parisc*:Lites*:*:*)
  633.     echo hppa1.1-hp-lites
  634.     exit 0 ;;
  635.     hppa*:OpenBSD:*:*)
  636.     echo hppa-unknown-openbsd
  637.     exit 0 ;;
  638.     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
  639.     echo c1-convex-bsd
  640.         exit 0 ;;
  641.     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
  642.     if getsysinfo -f scalar_acc
  643.     then echo c32-convex-bsd
  644.     else echo c2-convex-bsd
  645.     fi
  646.         exit 0 ;;
  647.     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
  648.     echo c34-convex-bsd
  649.         exit 0 ;;
  650.     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
  651.     echo c38-convex-bsd
  652.         exit 0 ;;
  653.     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
  654.     echo c4-convex-bsd
  655.         exit 0 ;;
  656.     CRAY*X-MP:*:*:*)
  657.     echo xmp-cray-unicos
  658.         exit 0 ;;
  659.     CRAY*Y-MP:*:*:*)
  660.     echo ymp-cray-unicos${UNAME_RELEASE}
  661.     exit 0 ;;
  662.     CRAY*[A-Z]90:*:*:*)
  663.     echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
  664.     | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
  665.           -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
  666.     exit 0 ;;
  667.     CRAY*TS:*:*:*)
  668.     echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  669.     exit 0 ;;
  670.     CRAY*T3D:*:*:*)
  671.     echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  672.     exit 0 ;;
  673.     CRAY*T3E:*:*:*)
  674.     echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  675.     exit 0 ;;
  676.     CRAY*SV1:*:*:*)
  677.     echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  678.     exit 0 ;;
  679.     CRAY-2:*:*:*)
  680.     echo cray2-cray-unicos
  681.         exit 0 ;;
  682.     F300:UNIX_System_V:*:*)
  683.         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
  684.         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
  685.         echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
  686.         exit 0 ;;
  687.     F301:UNIX_System_V:*:*)
  688.        echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
  689.        exit 0 ;;
  690.     hp300:OpenBSD:*:*)
  691.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  692.     exit 0 ;;
  693.     i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
  694.     echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
  695.     exit 0 ;;
  696.     sparc*:BSD/OS:*:*)
  697.     echo sparc-unknown-bsdi${UNAME_RELEASE}
  698.     exit 0 ;;
  699.     *:BSD/OS:*:*)
  700.     echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
  701.     exit 0 ;;
  702.     *:FreeBSD:*:*)
  703.     echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
  704.     exit 0 ;;
  705.     *:OpenBSD:*:*)
  706.     echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  707.     exit 0 ;;
  708.     i*:CYGWIN*:*)
  709.     echo ${UNAME_MACHINE}-pc-cygwin
  710.     exit 0 ;;
  711.     i*:MINGW*:*)
  712.     echo ${UNAME_MACHINE}-pc-mingw32
  713.     exit 0 ;;
  714.     i*:PW*:*)
  715.     echo ${UNAME_MACHINE}-pc-pw32
  716.     exit 0 ;;
  717.     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
  718.     # How do we know it's Interix rather than the generic POSIX subsystem?
  719.     # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
  720.     # UNAME_MACHINE based on the output of uname instead of i386?
  721.     echo i386-pc-interix
  722.     exit 0 ;;
  723.     i*:UWIN*:*)
  724.     echo ${UNAME_MACHINE}-pc-uwin
  725.     exit 0 ;;
  726.     p*:CYGWIN*:*)
  727.     echo powerpcle-unknown-cygwin
  728.     exit 0 ;;
  729.     prep*:SunOS:5.*:*)
  730.     echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  731.     exit 0 ;;
  732.     *:GNU:*:*)
  733.     echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
  734.     exit 0 ;;
  735.     i*86:Minix:*:*)
  736.     echo ${UNAME_MACHINE}-pc-minix
  737.     exit 0 ;;
  738.     *:Linux:*:*)
  739.  
  740.     # The BFD linker knows what the default object file format is, so
  741.     # first see if it will tell us. cd to the root directory to prevent
  742.     # problems with other programs or directories called `ld' in the path.
  743.     ld_supported_emulations=`cd /; ld --help 2>&1 \
  744.              | sed -ne '/supported emulations:/!d
  745.                     s/[     ][     ]*/ /g
  746.                     s/.*supported emulations: *//
  747.                     s/ .*//
  748.                     p'`
  749.         case "$ld_supported_emulations" in
  750.       *ia64)
  751.         echo "${UNAME_MACHINE}-unknown-linux"
  752.         exit 0
  753.         ;;
  754.       i?86linux)
  755.         echo "${UNAME_MACHINE}-pc-linux-gnuaout"
  756.         exit 0
  757.         ;;
  758.       elf_i?86)
  759.         TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
  760.         ;;
  761.       i?86coff)
  762.         echo "${UNAME_MACHINE}-pc-linux-gnucoff"
  763.         exit 0
  764.         ;;
  765.       sparclinux)
  766.         echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
  767.         exit 0
  768.         ;;
  769.       elf32_sparc)
  770.         echo "${UNAME_MACHINE}-unknown-linux-gnu"
  771.         exit 0
  772.         ;;
  773.       armlinux)
  774.         echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
  775.         exit 0
  776.         ;;
  777.       elf32arm*)
  778.         echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
  779.         exit 0
  780.         ;;
  781.       armelf_linux*)
  782.         echo "${UNAME_MACHINE}-unknown-linux-gnu"
  783.         exit 0
  784.         ;;
  785.       m68klinux)
  786.         echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
  787.         exit 0
  788.         ;;
  789.       elf32ppc | elf32ppclinux)
  790.         # Determine Lib Version
  791.         cat >$dummy.c <<EOF
  792. #include <features.h>
  793. #if defined(__GLIBC__)
  794. extern char __libc_version[];
  795. extern char __libc_release[];
  796. #endif
  797. main(argc, argv)
  798.      int argc;
  799.      char *argv[];
  800. {
  801. #if defined(__GLIBC__)
  802.   printf("%s %s\n", __libc_version, __libc_release);
  803. #else
  804.   printf("unkown\n");
  805. #endif
  806.   return 0;
  807. }
  808. EOF
  809.         LIBC=""
  810.         $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
  811.         if test "$?" = 0 ; then
  812.             ./$dummy | grep 1\.99 > /dev/null
  813.             if test "$?" = 0 ; then
  814.                 LIBC="libc1"
  815.             fi
  816.         fi
  817.         rm -f $dummy.c $dummy
  818.         echo powerpc-unknown-linux-gnu${LIBC}
  819.         exit 0
  820.         ;;
  821.       shelf_linux)
  822.         echo "${UNAME_MACHINE}-unknown-linux-gnu"
  823.         exit 0
  824.         ;;
  825.     esac
  826.  
  827.     if test "${UNAME_MACHINE}" = "alpha" ; then
  828.         cat <<EOF >$dummy.s
  829.             .data
  830.         \$Lformat:
  831.             .byte 37,100,45,37,120,10,0    # "%d-%x\n"
  832.  
  833.             .text
  834.             .globl main
  835.             .align 4
  836.             .ent main
  837.         main:
  838.             .frame \$30,16,\$26,0
  839.             ldgp \$29,0(\$27)
  840.             .prologue 1
  841.             .long 0x47e03d80 # implver \$0
  842.             lda \$2,-1
  843.             .long 0x47e20c21 # amask \$2,\$1
  844.             lda \$16,\$Lformat
  845.             mov \$0,\$17
  846.             not \$1,\$18
  847.             jsr \$26,printf
  848.             ldgp \$29,0(\$26)
  849.             mov 0,\$16
  850.             jsr \$26,exit
  851.             .end main
  852. EOF
  853.         LIBC=""
  854.         $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
  855.         if test "$?" = 0 ; then
  856.             case `./$dummy` in
  857.             0-0)
  858.                 UNAME_MACHINE="alpha"
  859.                 ;;
  860.             1-0)
  861.                 UNAME_MACHINE="alphaev5"
  862.                 ;;
  863.             1-1)
  864.                 UNAME_MACHINE="alphaev56"
  865.                 ;;
  866.             1-101)
  867.                 UNAME_MACHINE="alphapca56"
  868.                 ;;
  869.             2-303)
  870.                 UNAME_MACHINE="alphaev6"
  871.                 ;;
  872.             2-307)
  873.                 UNAME_MACHINE="alphaev67"
  874.                 ;;
  875.             esac
  876.  
  877.             objdump --private-headers $dummy | \
  878.               grep ld.so.1 > /dev/null
  879.             if test "$?" = 0 ; then
  880.                 LIBC="libc1"
  881.             fi
  882.         fi
  883.         rm -f $dummy.s $dummy
  884.         echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
  885.     elif test "${UNAME_MACHINE}" = "mips" ; then
  886.       cat >$dummy.c <<EOF
  887. #ifdef __cplusplus
  888. #include <stdio.h>  /* for printf() prototype */
  889.     int main (int argc, char *argv[]) {
  890. #else
  891.     int main (argc, argv) int argc; char *argv[]; {
  892. #endif
  893. #ifdef __MIPSEB__
  894.   printf ("%s-unknown-linux-gnu\n", argv[1]);
  895. #endif
  896. #ifdef __MIPSEL__
  897.   printf ("%sel-unknown-linux-gnu\n", argv[1]);
  898. #endif
  899.   return 0;
  900. }
  901. EOF
  902.       $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
  903.       rm -f $dummy.c $dummy
  904.     elif test "${UNAME_MACHINE}" = "s390"; then
  905.       echo s390-ibm-linux && exit 0
  906.     elif test "${UNAME_MACHINE}" = "x86_64"; then
  907.       echo x86_64-unknown-linux-gnu && exit 0
  908.     elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then
  909.       # Look for CPU level
  910.       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
  911.         PA7*)
  912.         echo hppa1.1-unknown-linux-gnu
  913.         ;;
  914.         PA8*)
  915.         echo hppa2.0-unknown-linux-gnu
  916.         ;;
  917.         *)
  918.         echo hppa-unknown-linux-gnu
  919.         ;;
  920.       esac
  921.       exit 0
  922.     else
  923.       # Either a pre-BFD a.out linker (linux-gnuoldld)
  924.       # or one that does not give us useful --help.
  925.       # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
  926.       # If ld does not provide *any* "supported emulations:"
  927.       # that means it is gnuoldld.
  928.       test -z "$ld_supported_emulations" \
  929.         && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
  930.  
  931.       case "${UNAME_MACHINE}" in
  932.       i?86)
  933.         VENDOR=pc;
  934.         ;;
  935.       *)
  936.         VENDOR=unknown;
  937.         ;;
  938.       esac
  939.       # Determine whether the default compiler is a.out or elf
  940.       cat >$dummy.c <<EOF
  941. #include <features.h>
  942. #ifdef __cplusplus
  943. #include <stdio.h>  /* for printf() prototype */
  944.     int main (int argc, char *argv[]) {
  945. #else
  946.     int main (argc, argv) int argc; char *argv[]; {
  947. #endif
  948. #ifdef __ELF__
  949. # ifdef __GLIBC__
  950. #  if __GLIBC__ >= 2
  951.     printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
  952. #  else
  953.     printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
  954. #  endif
  955. # else
  956.    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
  957. # endif
  958. #else
  959.   printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
  960. #endif
  961.   return 0;
  962. }
  963. EOF
  964.       $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
  965.       rm -f $dummy.c $dummy
  966.       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
  967.     fi ;;
  968. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
  969. # are messed up and put the nodename in both sysname and nodename.
  970.     i?86:DYNIX/ptx:4*:*)
  971.     echo i386-sequent-sysv4
  972.     exit 0 ;;
  973.     i?86:UNIX_SV:4.2MP:2.*)
  974.         # Unixware is an offshoot of SVR4, but it has its own version
  975.         # number series starting with 2...
  976.         # I am not positive that other SVR4 systems won't match this,
  977.     # I just have to hope.  -- rms.
  978.         # Use sysv4.2uw... so that sysv4* matches it.
  979.     echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
  980.     exit 0 ;;
  981.     i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
  982.     UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
  983.     if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
  984.         echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
  985.     else
  986.         echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
  987.     fi
  988.     exit 0 ;;
  989.     i?86:*:5:7*)
  990.         # Fixed at (any) Pentium or better
  991.         UNAME_MACHINE=i586
  992.         if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
  993.         echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
  994.     else
  995.         echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
  996.     fi
  997.     exit 0 ;;
  998.     i?86:*:3.2:*)
  999.     if test -f /usr/options/cb.name; then
  1000.         UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
  1001.         echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
  1002.     elif /bin/uname -X 2>/dev/null >/dev/null ; then
  1003.         UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  1004.         (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  1005.         (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  1006.             && UNAME_MACHINE=i586
  1007.         (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
  1008.             && UNAME_MACHINE=i686
  1009.         (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
  1010.             && UNAME_MACHINE=i686
  1011.         echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
  1012.     else
  1013.         echo ${UNAME_MACHINE}-pc-sysv32
  1014.     fi
  1015.     exit 0 ;;
  1016.     i?86:*DOS:*:*)
  1017.     echo ${UNAME_MACHINE}-pc-msdosdjgpp
  1018.     exit 0 ;;
  1019.     pc:*:*:*)
  1020.     # Left here for compatibility:
  1021.         # uname -m prints for DJGPP always 'pc', but it prints nothing about
  1022.         # the processor, so we play safe by assuming i386.
  1023.     echo i386-pc-msdosdjgpp
  1024.         exit 0 ;;
  1025.     Intel:Mach:3*:*)
  1026.     echo i386-pc-mach3
  1027.     exit 0 ;;
  1028.     paragon:*:*:*)
  1029.     echo i860-intel-osf1
  1030.     exit 0 ;;
  1031.     i860:*:4.*:*) # i860-SVR4
  1032.     if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
  1033.       echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
  1034.     else # Add other i860-SVR4 vendors below as they are discovered.
  1035.       echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
  1036.     fi
  1037.     exit 0 ;;
  1038.     mini*:CTIX:SYS*5:*)
  1039.     # "miniframe"
  1040.     echo m68010-convergent-sysv
  1041.     exit 0 ;;
  1042.     M68*:*:R3V[567]*:*)
  1043.     test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
  1044.     3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
  1045.     OS_REL=''
  1046.     test -r /etc/.relid \
  1047.     && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
  1048.     /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  1049.       && echo i486-ncr-sysv4.3${OS_REL} && exit 0
  1050.     /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
  1051.       && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
  1052.     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
  1053.         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  1054.           && echo i486-ncr-sysv4 && exit 0 ;;
  1055.     m68*:LynxOS:2.*:*)
  1056.     echo m68k-unknown-lynxos${UNAME_RELEASE}
  1057.     exit 0 ;;
  1058.     mc68030:UNIX_System_V:4.*:*)
  1059.     echo m68k-atari-sysv4
  1060.     exit 0 ;;
  1061.     i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
  1062.     echo i386-unknown-lynxos${UNAME_RELEASE}
  1063.     exit 0 ;;
  1064.     TSUNAMI:LynxOS:2.*:*)
  1065.     echo sparc-unknown-lynxos${UNAME_RELEASE}
  1066.     exit 0 ;;
  1067.     rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
  1068.     echo rs6000-unknown-lynxos${UNAME_RELEASE}
  1069.     exit 0 ;;
  1070.     SM[BE]S:UNIX_SV:*:*)
  1071.     echo mips-dde-sysv${UNAME_RELEASE}
  1072.     exit 0 ;;
  1073.     RM*:ReliantUNIX-*:*:*)
  1074.     echo mips-sni-sysv4
  1075.     exit 0 ;;
  1076.     RM*:SINIX-*:*:*)
  1077.     echo mips-sni-sysv4
  1078.     exit 0 ;;
  1079.     *:SINIX-*:*:*)
  1080.     if uname -p 2>/dev/null >/dev/null ; then
  1081.         UNAME_MACHINE=`(uname -p) 2>/dev/null`
  1082.         echo ${UNAME_MACHINE}-sni-sysv4
  1083.     else
  1084.         echo ns32k-sni-sysv
  1085.     fi
  1086.     exit 0 ;;
  1087.     PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
  1088.                            # says <Richard.M.Bartel@ccMail.Census.GOV>
  1089.         echo i586-unisys-sysv4
  1090.         exit 0 ;;
  1091.     *:UNIX_System_V:4*:FTX*)
  1092.     # From Gerald Hewes <hewes@openmarket.com>.
  1093.     # How about differentiating between stratus architectures? -djm
  1094.     echo hppa1.1-stratus-sysv4
  1095.     exit 0 ;;
  1096.     *:*:*:FTX*)
  1097.     # From seanf@swdc.stratus.com.
  1098.     echo i860-stratus-sysv4
  1099.     exit 0 ;;
  1100.     mc68*:A/UX:*:*)
  1101.     echo m68k-apple-aux${UNAME_RELEASE}
  1102.     exit 0 ;;
  1103.     news*:NEWS-OS:6*:*)
  1104.     echo mips-sony-newsos6
  1105.     exit 0 ;;
  1106.     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
  1107.     if [ -d /usr/nec ]; then
  1108.             echo mips-nec-sysv${UNAME_RELEASE}
  1109.     else
  1110.             echo mips-unknown-sysv${UNAME_RELEASE}
  1111.     fi
  1112.         exit 0 ;;
  1113.     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
  1114.     echo powerpc-be-beos
  1115.     exit 0 ;;
  1116.     BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
  1117.     echo powerpc-apple-beos
  1118.     exit 0 ;;
  1119.     BePC:BeOS:*:*)    # BeOS running on Intel PC compatible.
  1120.     echo i586-pc-beos
  1121.     exit 0 ;;
  1122.     SX-4:SUPER-UX:*:*)
  1123.     echo sx4-nec-superux${UNAME_RELEASE}
  1124.     exit 0 ;;
  1125.     SX-5:SUPER-UX:*:*)
  1126.     echo sx5-nec-superux${UNAME_RELEASE}
  1127.     exit 0 ;;
  1128.     Power*:Rhapsody:*:*)
  1129.     echo powerpc-apple-rhapsody${UNAME_RELEASE}
  1130.     exit 0 ;;
  1131.     *:Rhapsody:*:*)
  1132.     echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
  1133.     exit 0 ;;
  1134.     *:Darwin:*:*)
  1135.     echo `uname -p`-apple-darwin${UNAME_RELEASE}
  1136.     exit 0 ;;
  1137.     *:procnto*:*:* | *:QNX:[0123456789]*:*)
  1138.     if test "${UNAME_MACHINE}" = "x86pc"; then
  1139.         UNAME_MACHINE=pc
  1140.     fi
  1141.     echo `uname -p`-${UNAME_MACHINE}-nto-qnx
  1142.     exit 0 ;;
  1143.     *:QNX:*:4*)
  1144.     echo i386-pc-qnx
  1145.     exit 0 ;;
  1146.     NSR-[KW]:NONSTOP_KERNEL:*:*)
  1147.     echo nsr-tandem-nsk${UNAME_RELEASE}
  1148.     exit 0 ;;
  1149.     *:NonStop-UX:*:*)
  1150.     echo mips-compaq-nonstopux
  1151.     exit 0 ;;
  1152.     BS2000:POSIX*:*:*)
  1153.     echo bs2000-siemens-sysv
  1154.     exit 0 ;;
  1155.     DS/*:UNIX_System_V:*:*)
  1156.     echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
  1157.     exit 0 ;;
  1158.     *:Plan9:*:*)
  1159.     # "uname -m" is not consistent, so use $cputype instead. 386
  1160.     # is converted to i386 for consistency with other x86
  1161.     # operating systems.
  1162.     if test "$cputype" = "386"; then
  1163.         UNAME_MACHINE=i386
  1164.     else
  1165.         UNAME_MACHINE="$cputype"
  1166.     fi
  1167.     echo ${UNAME_MACHINE}-unknown-plan9
  1168.     exit 0 ;;
  1169.     i?86:OS/2:*:*)
  1170.     # If we were able to find `uname', then EMX Unix compatibility
  1171.     # is probably installed.
  1172.     echo ${UNAME_MACHINE}-pc-os2-emx
  1173.     exit 0 ;;
  1174. esac
  1175.  
  1176. #echo '(No uname command or uname output not recognized.)' 1>&2
  1177. #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
  1178.  
  1179. cat >$dummy.c <<EOF
  1180. #ifdef _SEQUENT_
  1181. # include <sys/types.h>
  1182. # include <sys/utsname.h>
  1183. #endif
  1184. main ()
  1185. {
  1186. #if defined (sony)
  1187. #if defined (MIPSEB)
  1188.   /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
  1189.      I don't know....  */
  1190.   printf ("mips-sony-bsd\n"); exit (0);
  1191. #else
  1192. #include <sys/param.h>
  1193.   printf ("m68k-sony-newsos%s\n",
  1194. #ifdef NEWSOS4
  1195.           "4"
  1196. #else
  1197.       ""
  1198. #endif
  1199.          ); exit (0);
  1200. #endif
  1201. #endif
  1202.  
  1203. #if defined (__arm) && defined (__acorn) && defined (__unix)
  1204.   printf ("arm-acorn-riscix"); exit (0);
  1205. #endif
  1206.  
  1207. #if defined (hp300) && !defined (hpux)
  1208.   printf ("m68k-hp-bsd\n"); exit (0);
  1209. #endif
  1210.  
  1211. #if defined (NeXT)
  1212. #if !defined (__ARCHITECTURE__)
  1213. #define __ARCHITECTURE__ "m68k"
  1214. #endif
  1215.   int version;
  1216.   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  1217.   if (version < 4)
  1218.     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  1219.   else
  1220.     printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
  1221.   exit (0);
  1222. #endif
  1223.  
  1224. #if defined (MULTIMAX) || defined (n16)
  1225. #if defined (UMAXV)
  1226.   printf ("ns32k-encore-sysv\n"); exit (0);
  1227. #else
  1228. #if defined (CMU)
  1229.   printf ("ns32k-encore-mach\n"); exit (0);
  1230. #else
  1231.   printf ("ns32k-encore-bsd\n"); exit (0);
  1232. #endif
  1233. #endif
  1234. #endif
  1235.  
  1236. #if defined (__386BSD__)
  1237.   printf ("i386-pc-bsd\n"); exit (0);
  1238. #endif
  1239.  
  1240. #if defined (sequent)
  1241. #if defined (i386)
  1242.   printf ("i386-sequent-dynix\n"); exit (0);
  1243. #endif
  1244. #if defined (ns32000)
  1245.   printf ("ns32k-sequent-dynix\n"); exit (0);
  1246. #endif
  1247. #endif
  1248.  
  1249. #if defined (_SEQUENT_)
  1250.     struct utsname un;
  1251.  
  1252.     uname(&un);
  1253.  
  1254.     if (strncmp(un.version, "V2", 2) == 0) {
  1255.     printf ("i386-sequent-ptx2\n"); exit (0);
  1256.     }
  1257.     if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
  1258.     printf ("i386-sequent-ptx1\n"); exit (0);
  1259.     }
  1260.     printf ("i386-sequent-ptx\n"); exit (0);
  1261.  
  1262. #endif
  1263.  
  1264. #if defined (vax)
  1265. #if !defined (ultrix)
  1266.   printf ("vax-dec-bsd\n"); exit (0);
  1267. #else
  1268.   printf ("vax-dec-ultrix\n"); exit (0);
  1269. #endif
  1270. #endif
  1271.  
  1272. #if defined (alliant) && defined (i860)
  1273.   printf ("i860-alliant-bsd\n"); exit (0);
  1274. #endif
  1275.  
  1276.   exit (1);
  1277. }
  1278. EOF
  1279.  
  1280. $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
  1281. rm -f $dummy.c $dummy
  1282.  
  1283. # Apollos put the system type in the environment.
  1284.  
  1285. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
  1286.  
  1287. # Convex versions that predate uname can use getsysinfo(1)
  1288.  
  1289. if [ -x /usr/convex/getsysinfo ]
  1290. then
  1291.     case `getsysinfo -f cpu_type` in
  1292.     c1*)
  1293.     echo c1-convex-bsd
  1294.     exit 0 ;;
  1295.     c2*)
  1296.     if getsysinfo -f scalar_acc
  1297.     then echo c32-convex-bsd
  1298.     else echo c2-convex-bsd
  1299.     fi
  1300.     exit 0 ;;
  1301.     c34*)
  1302.     echo c34-convex-bsd
  1303.     exit 0 ;;
  1304.     c38*)
  1305.     echo c38-convex-bsd
  1306.     exit 0 ;;
  1307.     c4*)
  1308.     echo c4-convex-bsd
  1309.     exit 0 ;;
  1310.     esac
  1311. fi
  1312.  
  1313. cat >&2 <<EOF
  1314. $0: unable to guess system type
  1315.  
  1316. The $version version of this script cannot recognize your system type.
  1317. Please download the most up to date version of the config scripts:
  1318.  
  1319.     ftp://ftp.gnu.org/pub/gnu/config/
  1320.  
  1321. If the version you run ($0) is already up to date, please
  1322. send the following data and any information you think might be
  1323. pertinent to <config-patches@gnu.org> in order to provide the needed
  1324. information to handle your system.
  1325.  
  1326. config.guess version = $version
  1327.  
  1328. uname -m = `(uname -m) 2>/dev/null || echo unknown`
  1329. uname -r = `(uname -r) 2>/dev/null || echo unknown`
  1330. uname -s = `(uname -s) 2>/dev/null || echo unknown`
  1331. uname -v = `(uname -v) 2>/dev/null || echo unknown`
  1332.  
  1333. /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
  1334. /bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
  1335.  
  1336. hostinfo               = `(hostinfo) 2>/dev/null`
  1337. /bin/universe          = `(/bin/universe) 2>/dev/null`
  1338. /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
  1339. /bin/arch              = `(/bin/arch) 2>/dev/null`
  1340. /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
  1341. /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
  1342.  
  1343. UNAME_MACHINE = ${UNAME_MACHINE}
  1344. UNAME_RELEASE = ${UNAME_RELEASE}
  1345. UNAME_SYSTEM  = ${UNAME_SYSTEM}
  1346. UNAME_VERSION = ${UNAME_VERSION}
  1347. EOF
  1348.  
  1349. exit 1
  1350.  
  1351. # Local variables:
  1352. # eval: (add-hook 'write-file-hooks 'time-stamp)
  1353. # time-stamp-start: "timestamp='"
  1354. # time-stamp-format: "%:y-%02m-%02d"
  1355. # time-stamp-end: "'"
  1356. # End:
  1357.