22# Attempt to guess a canonical system name.
33# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
44# Free Software Foundation, Inc.
5- #
5+
6+ version=' 2000-10-23'
7+
68# This file is free software; you can redistribute it and/or modify it
79# under the terms of the GNU General Public License as published by
810# the Free Software Foundation; either version 2 of the License, or
3638# (but try to keep the structure clean).
3739#
3840
41+ me=` echo" $0 " | sed -e' s,.*/,,' `
42+
43+ usage=" \
44+ Usage:$0 [OPTION]
45+
46+ Output the configuration name of this system.
47+
48+ Operation modes:
49+ -h, --help print this help, then exit
50+ -V, --version print version number, then exit"
51+
52+ help="
53+ Try\` $me --help' for more information."
54+
55+ # Parse command line
56+ while test $# -gt 0; do
57+ case " $1 " in
58+ --version | --vers* | -V )
59+ echo " $version " ; exit 0 ;;
60+ --help | --h* | -h )
61+ echo " $usage " ; exit 0 ;;
62+ -- )# Stop option processing
63+ shift ; break ;;
64+ - )# Use stdin as input.
65+ break ;;
66+ -* )
67+ exec >&2
68+ echo " $me : invalid option$1 "
69+ echo " $help "
70+ exit 1 ;;
71+ * )
72+ break ;;
73+ esac
74+ done
75+
76+ if test $# ! = 0; then
77+ echo " $me : too many arguments$help " >&2
78+ exit 1
79+ fi
80+
3981# Use $HOST_CC if defined. $CC may point to a cross-compiler
4082if test x" $CC_FOR_BUILD " = x; then
4183if test x" $HOST_CC " ! = x; then
@@ -77,7 +119,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
77119# object file format.
78120# Determine the machine/vendor (is the vendor relevant).
79121case " ${UNAME_MACHINE} " in
80- amiga) machine=m68k-cbm ;;
122+ amiga) machine=m68k-unknown ;;
81123 arm32) machine=arm-unknown ;;
82124 atari* ) machine=m68k-atari ;;
83125 sun3* ) machine=m68k-sun ;;
173215echo alpha-dec-winnt3.5
174216exit 0 ;;
175217 Amiga* :UNIX_System_V:4.0:* )
176- echo m68k-cbm -sysv4
218+ echo m68k-unknown -sysv4
177219exit 0;;
178220 amiga:OpenBSD:* :* )
179221echo m68k-unknown-openbsd${UNAME_RELEASE}
360402 AViiON:dgux:* :* )
361403# DG/UX returns AViiON for all architectures
362404 UNAME_PROCESSOR=` /usr/bin/uname -p`
363- if [$UNAME_PROCESSOR = mc88100 ]|| [$UNAME_PROCESSOR = mc88110]
405+ if [$UNAME_PROCESSOR = mc88100 ]|| [$UNAME_PROCESSOR = mc88110 ]
364406then
365407if [${TARGET_BINARY_INTERFACE} x= m88kdguxelfx ]|| \
366408 [${TARGET_BINARY_INTERFACE} x= x ]
458500 9000/[34]?? ) HP_ARCH=m68k ;;
459501 9000/[678][0-9][0-9])
460502 sed' s/^ //' << EOF >$dummy .c
503+
504+ #define _HPUX_SOURCE
461505 #include <stdlib.h>
462506 #include <unistd.h>
463507
614658echo ${UNAME_MACHINE} -unknown-bsdi${UNAME_RELEASE}
615659exit 0 ;;
616660* :FreeBSD:* :* )
617- if test -x /usr/bin/objformat; then
618- if test " elf" =" ` /usr/bin/objformat` " ; then
619- echo ${UNAME_MACHINE} -unknown-freebsdelf` echo${UNAME_RELEASE} | sed -e' s/[-_].*//' `
620- exit 0
621- fi
622- fi
623661echo ${UNAME_MACHINE} -unknown-freebsd` echo${UNAME_RELEASE} | sed -e' s/[-(].*//' `
624662exit 0 ;;
625663* :OpenBSD:* :* )
631669 i* :MINGW* :* )
632670echo ${UNAME_MACHINE} -pc-mingw32
633671exit 0 ;;
672+ i* :PW* :* )
673+ echo ${UNAME_MACHINE} -pc-pw32
674+ exit 0 ;;
634675 i* :Windows_NT* :* | Pentium* :Windows_NT* :* )
635676# How do we know it's Interix rather than the generic POSIX subsystem?
636677# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -649,13 +690,15 @@ EOF
649690* :GNU:* :* )
650691echo ` echo${UNAME_MACHINE} | sed -e' s,[-/].*$,,' ` -unknown-gnu` echo${UNAME_RELEASE} | sed -e' s,/.*$,,' `
651692exit 0 ;;
693+ i* 86:Minix:* :* )
694+ echo ${UNAME_MACHINE} -pc-minix
695+ exit 0 ;;
652696* :Linux:* :* )
653697
654698# The BFD linker knows what the default object file format is, so
655699# first see if it will tell us. cd to the root directory to prevent
656700# problems with other programs or directories called `ld' in the path.
657- ld_help_string=` cd /; ld --help2>&1 `
658- ld_supported_emulations=` echo$ld_help_string \
701+ ld_supported_emulations=` cd /; ld --help2>&1 \
659702| sed -ne' /supported emulations:/!d
660703 s/[ ][ ]*/ /g
661704 s/.*supported emulations: *//
670713echo " ${UNAME_MACHINE} -pc-linux-gnuaout"
671714exit 0
672715;;
716+ elf_i? 86)
717+ TENTATIVE=" ${UNAME_MACHINE} -pc-linux-gnu"
718+ ;;
673719 i? 86coff)
674720echo " ${UNAME_MACHINE} -pc-linux-gnucoff"
675721exit 0
726772echo powerpc-unknown-linux-gnu${LIBC}
727773exit 0
728774;;
775+ shelf_linux)
776+ echo " ${UNAME_MACHINE} -unknown-linux-gnu"
777+ exit 0
778+ ;;
729779esac
730780
731781if test " ${UNAME_MACHINE} " =" alpha" ; then
@@ -807,14 +857,30 @@ EOF
807857 rm -f$dummy .c$dummy
808858elif test " ${UNAME_MACHINE} " =" s390" ; then
809859echo s390-ibm-linux&& exit 0
860+ elif test " ${UNAME_MACHINE} " =" x86_64" ; then
861+ echo x86_64-unknown-linux-gnu&& exit 0
862+ elif test " ${UNAME_MACHINE} " =" parisc" -o" ${UNAME_MACHINE} " =" hppa" ; then
863+ # Look for CPU level
864+ case ` grep' ^cpu[^a-z]*:' /proc/cpuinfo2> /dev/null| cut -d' ' -f2` in
865+ PA7* )
866+ echo hppa1.1-unknown-linux-gnu
867+ ;;
868+ PA8* )
869+ echo hppa2.0-unknown-linux-gnu
870+ ;;
871+ * )
872+ echo hppa-unknown-linux-gnu
873+ ;;
874+ esac
875+ exit 0
810876else
811877# Either a pre-BFD a.out linker (linux-gnuoldld)
812878# or one that does not give us useful --help.
813879# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
814880# If ld does not provide *any* "supported emulations:"
815881# that means it is gnuoldld.
816- echo " $ld_help_string " | grep > /dev/null 2>&1 " supported emulations: "
817- test $? ! = 0 && echo " ${UNAME_MACHINE} -pc-linux-gnuoldld" && exit 0
882+ test -z " $ld_supported_emulations " \
883+ && echo " ${UNAME_MACHINE} -pc-linux-gnuoldld" && exit 0
818884
819885case " ${UNAME_MACHINE} " in
820886 i? 86)
851917EOF
852918$CC_FOR_BUILD $dummy .c -o$dummy 2> /dev/null&& ./$dummy " ${UNAME_MACHINE} " && rm$dummy .c$dummy && exit 0
853919 rm -f$dummy .c$dummy
920+ test x" ${TENTATIVE} " ! = x&& echo " ${TENTATIVE} " && exit 0
854921fi ;;
855922# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
856923# are messed up and put the nodename in both sysname and nodename.
928995exit 0 ;;
929996 M68* :* :R3V[567]* :* )
930997test -r /sysV68&& echo ' m68k-motorola-sysv' && exit 0 ;;
931- 3[34]?? :* :4.0:3.0 | 3[34]?? ,* :* :4.0:3.0 | 4850:* :4.0:3.0)
998+ 3[34]?? :* :4.0:3.0 | 3[34]?? A: * :4.0:3.0 | 3[34] ?? ,* :* :4.0:3.0 | 4850:* :4.0:3.0)
932999OS_REL=' '
9331000test -r /etc/.relid \
9341001&& OS_REL=.` sed -n' s/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
9871054 mc68* :A/UX:* :* )
9881055echo m68k-apple-aux${UNAME_RELEASE}
9891056exit 0 ;;
990- news* :NEWS-OS:* :6 * )
1057+ news* :NEWS-OS:6 * : * )
9911058echo mips-sony-newsos6
9921059exit 0 ;;
9931060 R[34]000:* System_V* :* :* | R4000:UNIX_SYSV:* :* | R* 000:UNIX_SV:* :* )
@@ -1018,24 +1085,41 @@ EOF
10181085* :Rhapsody:* :* )
10191086echo ${UNAME_MACHINE} -apple-rhapsody${UNAME_RELEASE}
10201087exit 0 ;;
1021- Power* :Mac* OS:* :* )
1022- echo powerpc-apple-macos${UNAME_RELEASE}
1023- exit 0 ;;
1024- * :Mac* OS:* :* )
1025- echo ${UNAME_MACHINE} -apple-macos${UNAME_RELEASE}
1088+ * :Darwin:* :* )
1089+ echo ` uname -p` -apple-darwin${UNAME_RELEASE}
10261090exit 0 ;;
10271091* :procnto* :* :* |* :QNX:[0123456789]* :* )
10281092if test " ${UNAME_MACHINE} " =" x86pc" ; then
10291093UNAME_MACHINE=pc
10301094fi
10311095echo ` uname -p` -${UNAME_MACHINE} -nto-qnx
1032- exit 0;;
1096+ exit 0 ;;
10331097* :QNX:* :4* )
10341098echo i386-pc-qnx
10351099exit 0 ;;
1036- NSR-W :NONSTOP_KERNEL:* :* )
1100+ NSR-[KW] :NONSTOP_KERNEL:* :* )
10371101echo nsr-tandem-nsk${UNAME_RELEASE}
10381102exit 0 ;;
1103+ * :NonStop-UX:* :* )
1104+ echo mips-compaq-nonstopux
1105+ exit 0 ;;
1106+ BS2000:POSIX* :* :* )
1107+ echo bs2000-siemens-sysv
1108+ exit 0 ;;
1109+ DS/* :UNIX_System_V:* :* )
1110+ echo ${UNAME_MACHINE} -${UNAME_SYSTEM} -${UNAME_RELEASE}
1111+ exit 0 ;;
1112+ * :Plan9:* :* )
1113+ # "uname -m" is not consistent, so use $cputype instead. 386
1114+ # is converted to i386 for consistency with other x86
1115+ # operating systems.
1116+ if test " $cputype " =" 386" ; then
1117+ UNAME_MACHINE=i386
1118+ else
1119+ UNAME_MACHINE=" $cputype "
1120+ fi
1121+ echo ${UNAME_MACHINE} -unknown-plan9
1122+ exit 0 ;;
10391123esac
10401124
10411125# echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1175,6 +1259,47 @@ then
11751259esac
11761260fi
11771261
1178- # echo '(Unable to guess system type)' 1>&2
1262+ cat>&2 << EOF
1263+ $0 : unable to guess system type
1264+
1265+ The$version version of this script cannot recognize your system type.
1266+ Please download the most up to date version of the config scripts:
1267+
1268+ ftp://ftp.gnu.org/pub/gnu/config/
1269+
1270+ If the version you run ($0 ) is already up to date, please
1271+ send the following data and any information you think might be
1272+ pertinent to <config-patches@gnu.org> in order to provide the needed
1273+ information to handle your system.
1274+
1275+ config.guess version =$version
1276+
1277+ uname -m =` (uname -m)2> /dev/null|| echo unknown`
1278+ uname -r =` (uname -r)2> /dev/null|| echo unknown`
1279+ uname -s =` (uname -s)2> /dev/null|| echo unknown`
1280+ uname -v =` (uname -v)2> /dev/null|| echo unknown`
1281+
1282+ /usr/bin/uname -p =` (/usr/bin/uname -p)2> /dev/null`
1283+ /bin/uname -X =` (/bin/uname -X)2> /dev/null`
1284+
1285+ hostinfo =` (hostinfo)2> /dev/null`
1286+ /bin/universe =` (/bin/universe)2> /dev/null`
1287+ /usr/bin/arch -k =` (/usr/bin/arch -k)2> /dev/null`
1288+ /bin/arch =` (/bin/arch)2> /dev/null`
1289+ /usr/bin/oslevel =` (/usr/bin/oslevel)2> /dev/null`
1290+ /usr/convex/getsysinfo =` (/usr/convex/getsysinfo)2> /dev/null`
1291+
1292+ UNAME_MACHINE =${UNAME_MACHINE}
1293+ UNAME_RELEASE =${UNAME_RELEASE}
1294+ UNAME_SYSTEM =${UNAME_SYSTEM}
1295+ UNAME_VERSION =${UNAME_VERSION}
1296+ EOF
11791297
11801298exit 1
1299+
1300+ # Local variables:
1301+ # eval: (add-hook 'write-file-hooks 'time-stamp)
1302+ # time-stamp-start: "version='"
1303+ # time-stamp-format: "%:y-%02m-%02d"
1304+ # time-stamp-end: "'"
1305+ # End: