2
2
# Attempt to guess a canonical system name.
3
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5
5
# Free Software Foundation, Inc.
9
9
# This file is free software; you can redistribute it and/or modify it
10
10
# under the terms of the GNU General Public License as published by
27
27
# the same distribution terms that you use for the rest of that program.
30
# Originally written by Per Bothner <per@bothner.com>.
31
# Please send patches to <config-patches@gnu.org>. Submit a context
32
# diff and a properly formatted ChangeLog entry.
30
# Originally written by Per Bothner. Please send patches (context
31
# diff format) to <config-patches@gnu.org> and include a ChangeLog
34
34
# This script attempts to guess a canonical system name similar to
35
35
# config.sub. If it succeeds, it prints the system name on stdout, and
36
36
# exits with 0. Otherwise, it exits with 1.
38
# The plan is that this can be called by configure scripts if you
39
# don't specify an explicit build system type.
38
# You can get the latest version of this script from:
39
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
41
41
me=`echo "$0" | sed -e 's,.*/,,'`
56
56
GNU config.guess ($timestamp)
58
58
Originally written by Per Bothner.
59
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
60
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
59
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
61
Software Foundation, Inc.
62
63
This is free software; see the source for copying conditions. There is NO
63
64
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
106
107
set_cc_for_build='
107
108
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
109
110
: ${TMPDIR=/tmp} ;
110
111
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111
112
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
170
171
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
171
172
eval $set_cc_for_build
172
173
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173
| grep __ELF__ >/dev/null
175
176
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
176
177
# Return netbsd for either. FIX?
333
334
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
334
335
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
337
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
338
echo i386-pc-auroraux${UNAME_RELEASE}
336
340
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
337
341
eval $set_cc_for_build
808
812
echo ${UNAME_MACHINE}-pc-pw32
811
815
case ${UNAME_MACHINE} in
813
817
echo i586-pc-interix${UNAME_RELEASE}
815
EM64T | authenticamd | genuineintel)
819
authenticamd | genuineintel | EM64T)
816
820
echo x86_64-unknown-interix${UNAME_RELEASE}
822
826
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
823
827
echo i${UNAME_MACHINE}-pc-mks
825
832
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
826
833
# How do we know it's Interix rather than the generic POSIX subsystem?
827
834
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
852
859
echo ${UNAME_MACHINE}-pc-minix
862
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
863
EV5) UNAME_MACHINE=alphaev5 ;;
864
EV56) UNAME_MACHINE=alphaev56 ;;
865
PCA56) UNAME_MACHINE=alphapca56 ;;
866
PCA57) UNAME_MACHINE=alphapca56 ;;
867
EV6) UNAME_MACHINE=alphaev6 ;;
868
EV67) UNAME_MACHINE=alphaev67 ;;
869
EV68*) UNAME_MACHINE=alphaev68 ;;
871
objdump --private-headers /bin/sh | grep -q ld.so.1
872
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
873
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
855
876
eval $set_cc_for_build
856
877
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
874
895
echo frv-unknown-linux-gnu
899
eval $set_cc_for_build
900
sed 's/^ //' << EOF >$dummy.c
905
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
906
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
877
909
echo ${UNAME_MACHINE}-unknown-linux-gnu
883
915
echo ${UNAME_MACHINE}-unknown-linux-gnu
886
eval $set_cc_for_build
887
sed 's/^ //' << EOF >$dummy.c
891
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
894
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
901
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
906
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
909
eval $set_cc_for_build
910
sed 's/^ //' << EOF >$dummy.c
914
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
917
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
924
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
917
mips:Linux:*:* | mips64:Linux:*:*)
918
eval $set_cc_for_build
919
sed 's/^ //' << EOF >$dummy.c
921
#undef ${UNAME_MACHINE}
922
#undef ${UNAME_MACHINE}el
923
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
924
CPU=${UNAME_MACHINE}el
926
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
933
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
929
934
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
932
937
echo or32-unknown-linux-gnu
935
echo powerpc-unknown-linux-gnu
938
echo powerpc64-unknown-linux-gnu
941
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
942
EV5) UNAME_MACHINE=alphaev5 ;;
943
EV56) UNAME_MACHINE=alphaev56 ;;
944
PCA56) UNAME_MACHINE=alphapca56 ;;
945
PCA57) UNAME_MACHINE=alphapca56 ;;
946
EV6) UNAME_MACHINE=alphaev6 ;;
947
EV67) UNAME_MACHINE=alphaev67 ;;
948
EV68*) UNAME_MACHINE=alphaev68 ;;
950
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
951
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
952
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
955
940
echo sparc-unknown-linux-gnu
942
parisc64:Linux:*:* | hppa64:Linux:*:*)
943
echo hppa64-unknown-linux-gnu
957
945
parisc:Linux:*:* | hppa:Linux:*:*)
958
946
# Look for CPU level
959
947
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
962
950
*) echo hppa-unknown-linux-gnu ;;
965
parisc64:Linux:*:* | hppa64:Linux:*:*)
966
echo hppa64-unknown-linux-gnu
954
echo powerpc64-unknown-linux-gnu
957
echo powerpc-unknown-linux-gnu
968
959
s390:Linux:*:* | s390x:Linux:*:*)
969
960
echo ${UNAME_MACHINE}-ibm-linux
986
980
xtensa*:Linux:*:*)
987
981
echo ${UNAME_MACHINE}-unknown-linux-gnu
990
# The BFD linker knows what the default object file format is, so
991
# first see if it will tell us. cd to the root directory to prevent
992
# problems with other programs or directories called `ld' in the path.
993
# Set LC_ALL=C to ensure ld outputs messages in English.
994
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
995
| sed -ne '/supported targets:/!d
997
s/.*supported targets: *//
1000
case "$ld_supported_targets" in
1002
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1005
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
1008
# Either a pre-BFD a.out linker (linux-gnuoldld) or
1009
# one that does not give us useful --help.
1010
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
1013
# Determine whether the default compiler is a.out or elf
1014
eval $set_cc_for_build
1015
sed 's/^ //' << EOF >$dummy.c
1016
#include <features.h>
1028
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1038
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1043
test x"${LIBC}" != x && {
1044
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1047
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1049
983
i*86:DYNIX/ptx:4*:*)
1050
984
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1051
985
# earlier versions are messed up and put the nodename in both
1074
1008
i*86:syllable:*:*)
1075
1009
echo ${UNAME_MACHINE}-pc-syllable
1077
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1011
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1078
1012
echo i386-unknown-lynxos${UNAME_RELEASE}
1182
1116
rs6000:LynxOS:2.*:*)
1183
1117
echo rs6000-unknown-lynxos${UNAME_RELEASE}
1185
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1119
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1186
1120
echo powerpc-unknown-lynxos${UNAME_RELEASE}
1188
1122
SM[BE]S:UNIX_SV:*:*)
1276
1210
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1277
1211
case $UNAME_PROCESSOR in
1213
eval $set_cc_for_build
1214
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1215
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1216
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1217
grep IS_64BIT_ARCH >/dev/null
1219
UNAME_PROCESSOR="x86_64"
1278
1222
unknown) UNAME_PROCESSOR=powerpc ;;
1280
1224
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}