2
2
# Attempt to guess a canonical system name.
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5
# 2011, 2012 Free Software Foundation, Inc.
3
# Copyright 1992-2013 Free Software Foundation, Inc.
9
7
# This file is free software; you can redistribute it and/or modify it
10
8
# under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
9
# the Free Software Foundation; either version 3 of the License, or
12
10
# (at your option) any later version.
14
12
# This program is distributed in the hope that it will be useful, but
22
20
# As a special exception to the GNU General Public License, if you
23
21
# distribute this file as part of a program that contains a
24
22
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
28
# Originally written by Per Bothner. Please send patches (context
29
# diff format) to <config-patches@gnu.org> and include a ChangeLog
23
# the same distribution terms that you use for the rest of that
24
# program. This Exception is an additional permission under section 7
25
# of the GNU General Public License, version 3 ("GPLv3").
32
# This script attempts to guess a canonical system name similar to
33
# config.sub. If it succeeds, it prints the system name on stdout, and
34
# exits with 0. Otherwise, it exits with 1.
27
# Originally written by Per Bothner.
36
29
# You can get the latest version of this script from:
37
30
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
32
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
39
35
me=`echo "$0" | sed -e 's,.*/,,'`
54
50
GNU config.guess ($timestamp)
56
52
Originally written by Per Bothner.
57
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
58
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
59
Free Software Foundation, Inc.
53
Copyright 1992-2013 Free Software Foundation, Inc.
61
55
This is free software; see the source for copying conditions. There is NO
62
56
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
138
132
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
139
133
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
135
case "${UNAME_SYSTEM}" in
137
# If the system lacks a compiler, then just pick glibc.
138
# We could probably try harder.
141
eval $set_cc_for_build
142
cat <<-EOF > $dummy.c
143
#include <features.h>
144
#if defined(__UCLIBC__)
146
#elif defined(__dietlibc__)
152
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
141
156
# Note: order is significant - the case branches are not exclusive.
143
158
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
200
215
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
201
216
echo "${machine}-${os}${release}"
219
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
220
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
204
223
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
205
224
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
855
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
877
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
858
880
# other systems with GNU libc and userland
859
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
881
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
862
884
echo ${UNAME_MACHINE}-pc-minix
864
886
aarch64:Linux:*:*)
865
echo ${UNAME_MACHINE}-unknown-linux-gnu
887
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
867
889
aarch64_be:Linux:*:*)
868
890
UNAME_MACHINE=aarch64_be
869
echo ${UNAME_MACHINE}-unknown-linux-gnu
891
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
872
894
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
879
901
EV68*) UNAME_MACHINE=alphaev68 ;;
881
903
objdump --private-headers /bin/sh | grep -q ld.so.1
882
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
883
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
904
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
905
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
907
arc:Linux:*:* | arceb:Linux:*:*)
908
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
886
911
eval $set_cc_for_build
887
912
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
888
913
| grep -q __ARM_EABI__
890
echo ${UNAME_MACHINE}-unknown-linux-gnu
915
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
892
917
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
893
918
| grep -q __ARM_PCS_VFP
895
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
920
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
897
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
922
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
901
926
avr32*:Linux:*:*)
902
echo ${UNAME_MACHINE}-unknown-linux-gnu
927
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
905
echo ${UNAME_MACHINE}-axis-linux-gnu
930
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
907
932
crisv32:Linux:*:*)
908
echo ${UNAME_MACHINE}-axis-linux-gnu
933
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
911
echo ${UNAME_MACHINE}-unknown-linux-gnu
936
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
913
938
hexagon:Linux:*:*)
914
echo ${UNAME_MACHINE}-unknown-linux-gnu
939
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
918
eval $set_cc_for_build
919
sed 's/^ //' << EOF >$dummy.c
924
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
925
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
942
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
928
echo ${UNAME_MACHINE}-unknown-linux-gnu
945
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
931
echo ${UNAME_MACHINE}-unknown-linux-gnu
948
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
934
echo ${UNAME_MACHINE}-unknown-linux-gnu
951
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
936
953
mips:Linux:*:* | mips64:Linux:*:*)
937
954
eval $set_cc_for_build
952
969
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
953
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
970
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
973
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
956
echo ${UNAME_MACHINE}-unknown-linux-gnu
976
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
959
echo sparc-unknown-linux-gnu
979
echo sparc-unknown-linux-${LIBC}
961
981
parisc64:Linux:*:* | hppa64:Linux:*:*)
962
echo hppa64-unknown-linux-gnu
982
echo hppa64-unknown-linux-${LIBC}
964
984
parisc:Linux:*:* | hppa:Linux:*:*)
965
985
# Look for CPU level
966
986
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
967
PA7*) echo hppa1.1-unknown-linux-gnu ;;
968
PA8*) echo hppa2.0-unknown-linux-gnu ;;
969
*) echo hppa-unknown-linux-gnu ;;
987
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
988
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
989
*) echo hppa-unknown-linux-${LIBC} ;;
973
echo powerpc64-unknown-linux-gnu
993
echo powerpc64-unknown-linux-${LIBC}
976
echo powerpc-unknown-linux-gnu
996
echo powerpc-unknown-linux-${LIBC}
978
998
s390:Linux:*:* | s390x:Linux:*:*)
979
echo ${UNAME_MACHINE}-ibm-linux
999
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
981
1001
sh64*:Linux:*:*)
982
echo ${UNAME_MACHINE}-unknown-linux-gnu
1002
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
985
echo ${UNAME_MACHINE}-unknown-linux-gnu
1005
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
987
1007
sparc:Linux:*:* | sparc64:Linux:*:*)
988
echo ${UNAME_MACHINE}-unknown-linux-gnu
1008
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
990
1010
tile*:Linux:*:*)
991
echo ${UNAME_MACHINE}-unknown-linux-gnu
1011
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
994
echo ${UNAME_MACHINE}-dec-linux-gnu
1014
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
996
1016
x86_64:Linux:*:*)
997
echo ${UNAME_MACHINE}-unknown-linux-gnu
1017
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
999
1019
xtensa*:Linux:*:*)
1000
echo ${UNAME_MACHINE}-unknown-linux-gnu
1020
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1002
1022
i*86:DYNIX/ptx:4*:*)
1003
1023
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1229
1252
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1230
case $UNAME_PROCESSOR in
1232
eval $set_cc_for_build
1233
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1234
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1235
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1236
grep IS_64BIT_ARCH >/dev/null
1238
UNAME_PROCESSOR="x86_64"
1241
unknown) UNAME_PROCESSOR=powerpc ;;
1253
eval $set_cc_for_build
1254
if test "$UNAME_PROCESSOR" = unknown ; then
1255
UNAME_PROCESSOR=powerpc
1257
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1258
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1259
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1260
grep IS_64BIT_ARCH >/dev/null
1262
case $UNAME_PROCESSOR in
1263
i386) UNAME_PROCESSOR=x86_64 ;;
1264
powerpc) UNAME_PROCESSOR=powerpc64 ;;
1243
1268
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1245
1270
*:procnto*:*:* | *:QNX:[0123456789]*:*)
1256
1281
NEO-?:NONSTOP_KERNEL:*:*)
1257
1282
echo neo-tandem-nsk${UNAME_RELEASE}
1259
NSE-?:NONSTOP_KERNEL:*:*)
1284
NSE-*:NONSTOP_KERNEL:*:*)
1260
1285
echo nse-tandem-nsk${UNAME_RELEASE}
1262
1287
NSR-?:NONSTOP_KERNEL:*:*)