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 Free Software Foundation,
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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, 2002, 2003, 2004, 2005
60
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."
324
348
case `/usr/bin/uname -p` in
325
349
sparc) echo sparc-icl-nx7; exit ;;
352
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
327
354
sun4H:SunOS:5.*:*)
328
355
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
330
357
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
331
358
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
334
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
360
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
361
echo i386-pc-auroraux${UNAME_RELEASE}
363
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
364
eval $set_cc_for_build
366
# If there is a compiler, see if it is configured for 64-bit objects.
367
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
368
# This test works for both compilers.
369
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
370
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
371
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
372
grep IS_64BIT_ARCH >/dev/null
377
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336
379
sun4*:SunOS:6*:*)
337
380
# According to config.sub, this is the proper way to canonicalize
792
835
echo ${UNAME_MACHINE}-pc-pw32
794
x86:Interix*:[3456]*)
795
echo i586-pc-interix${UNAME_RELEASE}
797
EM64T:Interix*:[3456]* | authenticamd:Interix*:[3456]*)
798
echo x86_64-unknown-interix${UNAME_RELEASE}
838
case ${UNAME_MACHINE} in
840
echo i586-pc-interix${UNAME_RELEASE}
842
authenticamd | genuineintel | EM64T)
843
echo x86_64-unknown-interix${UNAME_RELEASE}
846
echo ia64-unknown-interix${UNAME_RELEASE}
800
849
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
801
850
echo i${UNAME_MACHINE}-pc-mks
803
855
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
804
856
# How do we know it's Interix rather than the generic POSIX subsystem?
805
857
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
823
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
875
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
826
878
# other systems with GNU libc and userland
827
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
879
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
830
882
echo ${UNAME_MACHINE}-pc-minix
833
echo ${UNAME_MACHINE}-unknown-linux-gnu
836
echo ${UNAME_MACHINE}-unknown-linux-gnu
839
echo cris-axis-linux-gnu
842
echo crisv32-axis-linux-gnu
845
echo frv-unknown-linux-gnu
848
echo ${UNAME_MACHINE}-unknown-linux-gnu
851
echo ${UNAME_MACHINE}-unknown-linux-gnu
854
echo ${UNAME_MACHINE}-unknown-linux-gnu
857
eval $set_cc_for_build
858
sed 's/^ //' << EOF >$dummy.c
862
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
865
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
872
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
877
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
880
eval $set_cc_for_build
881
sed 's/^ //' << EOF >$dummy.c
885
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
888
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
895
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
900
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
903
echo or32-unknown-linux-gnu
906
echo powerpc-unknown-linux-gnu
909
echo powerpc64-unknown-linux-gnu
912
885
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
913
886
EV5) UNAME_MACHINE=alphaev5 ;;
918
891
EV67) UNAME_MACHINE=alphaev67 ;;
919
892
EV68*) UNAME_MACHINE=alphaev68 ;;
921
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
922
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
923
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
894
objdump --private-headers /bin/sh | grep -q ld.so.1
895
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
896
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
899
eval $set_cc_for_build
900
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
901
| grep -q __ARM_EABI__
903
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
905
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
909
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
912
echo cris-axis-linux-${LIBC}
915
echo crisv32-axis-linux-${LIBC}
918
echo frv-unknown-linux-${LIBC}
921
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
924
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
927
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
930
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
932
mips:Linux:*:* | mips64:Linux:*:*)
933
eval $set_cc_for_build
934
sed 's/^ //' << EOF >$dummy.c
936
#undef ${UNAME_MACHINE}
937
#undef ${UNAME_MACHINE}el
938
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
939
CPU=${UNAME_MACHINE}el
941
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
948
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
949
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
952
echo or32-unknown-linux-${LIBC}
955
echo sparc-unknown-linux-${LIBC}
957
parisc64:Linux:*:* | hppa64:Linux:*:*)
958
echo hppa64-unknown-linux-${LIBC}
925
960
parisc:Linux:*:* | hppa:Linux:*:*)
926
961
# Look for CPU level
927
962
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
928
PA7*) echo hppa1.1-unknown-linux-gnu ;;
929
PA8*) echo hppa2.0-unknown-linux-gnu ;;
930
*) echo hppa-unknown-linux-gnu ;;
963
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
964
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
965
*) echo hppa-unknown-linux-${LIBC} ;;
933
parisc64:Linux:*:* | hppa64:Linux:*:*)
934
echo hppa64-unknown-linux-gnu
969
echo powerpc64-unknown-linux-${LIBC}
972
echo powerpc-unknown-linux-${LIBC}
936
974
s390:Linux:*:* | s390x:Linux:*:*)
937
975
echo ${UNAME_MACHINE}-ibm-linux
940
echo ${UNAME_MACHINE}-unknown-linux-gnu
978
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
943
echo ${UNAME_MACHINE}-unknown-linux-gnu
981
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
945
983
sparc:Linux:*:* | sparc64:Linux:*:*)
946
echo ${UNAME_MACHINE}-unknown-linux-gnu
984
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
949
echo ${UNAME_MACHINE}-dec-linux-gnu
987
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
951
989
x86_64:Linux:*:*)
952
echo x86_64-unknown-linux-gnu
955
echo xtensa-unknown-linux-gnu
958
# The BFD linker knows what the default object file format is, so
959
# first see if it will tell us. cd to the root directory to prevent
960
# problems with other programs or directories called `ld' in the path.
961
# Set LC_ALL=C to ensure ld outputs messages in English.
962
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
963
| sed -ne '/supported targets:/!d
965
s/.*supported targets: *//
968
case "$ld_supported_targets" in
970
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
973
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
976
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
979
# Either a pre-BFD a.out linker (linux-gnuoldld) or
980
# one that does not give us useful --help.
981
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
984
# Determine whether the default compiler is a.out or elf
985
eval $set_cc_for_build
986
sed 's/^ //' << EOF >$dummy.c
987
#include <features.h>
999
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1009
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1014
test x"${LIBC}" != x && {
1015
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1018
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
990
echo x86_64-unknown-linux-${LIBC}
993
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1020
995
i*86:DYNIX/ptx:4*:*)
1021
996
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1022
997
# earlier versions are messed up and put the nodename in both
1128
1106
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1129
1107
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1130
1108
&& { echo i486-ncr-sysv4; exit; } ;;
1109
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1111
test -r /etc/.relid \
1112
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1113
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1114
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1115
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1116
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1117
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1118
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1131
1119
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1132
1120
echo m68k-unknown-lynxos${UNAME_RELEASE}