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
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,.*/,,'`
832
848
echo ${UNAME_MACHINE}-pc-uwin
834
850
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
835
echo x86_64-unknown-cygwin
851
echo x86_64-${VENDOR}-cygwin
838
echo powerpcle-unknown-cygwin
854
echo powerpcle-${VENDOR}-cygwin
840
856
prep*:SunOS:5.*:*)
841
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
857
echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
845
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
861
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
848
864
# other systems with GNU libc and userland
849
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
865
echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
852
868
echo ${UNAME_MACHINE}-pc-minix
871
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
872
EV5) UNAME_MACHINE=alphaev5 ;;
873
EV56) UNAME_MACHINE=alphaev56 ;;
874
PCA56) UNAME_MACHINE=alphapca56 ;;
875
PCA57) UNAME_MACHINE=alphapca56 ;;
876
EV6) UNAME_MACHINE=alphaev6 ;;
877
EV67) UNAME_MACHINE=alphaev67 ;;
878
EV68*) UNAME_MACHINE=alphaev68 ;;
880
objdump --private-headers /bin/sh | grep -q ld.so.1
881
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
882
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
855
885
eval $set_cc_for_build
856
886
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
857
887
| grep -q __ARM_EABI__
859
echo ${UNAME_MACHINE}-unknown-linux-gnu
889
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
861
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
891
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi
864
894
avr32*:Linux:*:*)
865
echo ${UNAME_MACHINE}-unknown-linux-gnu
895
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
868
898
echo cris-axis-linux-gnu
871
901
echo crisv32-axis-linux-gnu
874
echo frv-unknown-linux-gnu
904
echo frv-${VENDOR}-linux-gnu
908
eval $set_cc_for_build
909
sed 's/^ //' << EOF >$dummy.c
914
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
915
echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
877
echo ${UNAME_MACHINE}-unknown-linux-gnu
918
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
880
echo ${UNAME_MACHINE}-unknown-linux-gnu
921
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
883
echo ${UNAME_MACHINE}-unknown-linux-gnu
924
echo ${UNAME_MACHINE}-${VENDOR}-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 '
929
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
926
mips:Linux:*:* | mips64:Linux:*:*)
927
eval $set_cc_for_build
928
sed 's/^ //' << EOF >$dummy.c
930
#undef ${UNAME_MACHINE}
931
#undef ${UNAME_MACHINE}el
932
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
933
CPU=${UNAME_MACHINE}el
935
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
942
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
943
test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
932
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}
946
echo or32-${VENDOR}-linux-gnu
955
echo sparc-unknown-linux-gnu
949
echo sparc-${VENDOR}-linux-gnu
951
parisc64:Linux:*:* | hppa64:Linux:*:*)
952
echo hppa64-${VENDOR}-linux-gnu
957
954
parisc:Linux:*:* | hppa:Linux:*:*)
958
955
# Look for CPU level
959
956
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
960
PA7*) echo hppa1.1-unknown-linux-gnu ;;
961
PA8*) echo hppa2.0-unknown-linux-gnu ;;
962
*) echo hppa-unknown-linux-gnu ;;
957
PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
958
PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
959
*) echo hppa-${VENDOR}-linux-gnu ;;
965
parisc64:Linux:*:* | hppa64:Linux:*:*)
966
echo hppa64-unknown-linux-gnu
963
echo powerpc64-${VENDOR}-linux-gnu
966
echo powerpc-${VENDOR}-linux-gnu
968
968
s390:Linux:*:* | s390x:Linux:*:*)
969
969
echo ${UNAME_MACHINE}-ibm-linux
972
echo ${UNAME_MACHINE}-unknown-linux-gnu
972
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
975
echo ${UNAME_MACHINE}-unknown-linux-gnu
975
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
977
977
sparc:Linux:*:* | sparc64:Linux:*:*)
978
echo ${UNAME_MACHINE}-unknown-linux-gnu
978
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
981
981
echo ${UNAME_MACHINE}-dec-linux-gnu
983
983
x86_64:Linux:*:*)
984
echo x86_64-unknown-linux-gnu
984
echo x86_64-${VENDOR}-linux-gnu
986
986
xtensa*:Linux:*:*)
987
echo ${UNAME_MACHINE}-unknown-linux-gnu
987
echo ${UNAME_MACHINE}-${VENDOR}-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
989
i*86:DYNIX/ptx:4*:*)
1050
990
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1051
991
# earlier versions are messed up and put the nodename in both