49
46
-h, --help print this help, then exit
50
47
-t, --time-stamp print date of last modification, then exit
52
Report bugs and patches to <config-patches@gnu.org>.
54
Written by Per Bothner.
55
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
56
Free Software Foundation, Inc. See the source for copying conditions."
48
-v, --version print version number, then exit
50
Report bugs and patches to <config-patches@gnu.org>."
53
GNU config.guess ($timestamp)
55
Originally written by Per Bothner.
56
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
57
Free Software Foundation, Inc.
59
This is free software; see the source for copying conditions. There is NO
60
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
59
63
Try \`$me --help' for more information."
87
trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
93
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
89
95
# CC_FOR_BUILD -- compiler used by this script.
90
96
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
91
97
# use `HOST_CC' if defined, but it is deprecated.
93
case $CC_FOR_BUILD,$HOST_CC,$CC in
94
,,) echo "int dummy(){}" > $dummy.c
99
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
100
,,) echo "int dummy(){}" > $dummy.c ;
95
101
for c in cc gcc c89 ; do
96
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
102
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
97
103
if test $? = 0 ; then
98
CC_FOR_BUILD="$c"; break
101
rm -f $dummy.c $dummy.o
104
CC_FOR_BUILD="$c"; break ;
107
rm -f $dummy.c $dummy.o $dummy.rel ;
102
108
if test x"$CC_FOR_BUILD" = x ; then
103
CC_FOR_BUILD=no_compiler_found
109
CC_FOR_BUILD=no_compiler_found ;
106
112
,,*) CC_FOR_BUILD=$CC ;;
107
113
,*,*) CC_FOR_BUILD=$HOST_CC ;;
110
116
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
111
# (ghazi@noc.rutgers.edu 8/24/94.)
117
# (ghazi@noc.rutgers.edu 1994-08-24)
112
118
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
113
119
PATH=$PATH:/.attbin ; export PATH
123
129
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
125
# Netbsd (nbsd) targets should (where applicable) match one or
131
# NetBSD (nbsd) targets should (where applicable) match one or
126
132
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
127
133
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
128
134
# switched to ELF, *-*-netbsd* would select the old
129
135
# object file format. This provides both forward
130
136
# compatibility and a consistent mechanism for selecting the
131
137
# object file format.
132
# Determine the machine/vendor (is the vendor relevant).
133
case "${UNAME_MACHINE}" in
134
amiga) machine=m68k-unknown ;;
135
arm32) machine=arm-unknown ;;
136
atari*) machine=m68k-atari ;;
137
sun3*) machine=m68k-sun ;;
138
mac68k) machine=m68k-apple ;;
139
macppc) machine=powerpc-apple ;;
140
hp3[0-9][05]) machine=m68k-hp ;;
141
ibmrt|romp-ibm) machine=romp-ibm ;;
142
*) machine=${UNAME_MACHINE}-unknown ;;
139
# Note: NetBSD doesn't particularly care about the vendor
140
# portion of the name. We always set it to "unknown".
141
UNAME_MACHINE_ARCH=`(uname -p) 2>/dev/null` || \
142
UNAME_MACHINE_ARCH=unknown
143
case "${UNAME_MACHINE_ARCH}" in
144
arm*) machine=arm-unknown ;;
145
sh3el) machine=shl-unknown ;;
146
sh3eb) machine=sh-unknown ;;
147
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
144
149
# The Operating System including object format, if it has switched
145
150
# to ELF recently, or will in the future.
146
case "${UNAME_MACHINE}" in
147
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
151
case "${UNAME_MACHINE_ARCH}" in
152
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
153
eval $set_cc_for_build
148
154
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
149
155
| grep __ELF__ >/dev/null
736
762
echo ${UNAME_MACHINE}-pc-minix
765
echo ${UNAME_MACHINE}-unknown-linux-gnu
768
echo ${UNAME_MACHINE}-unknown-linux
771
echo ${UNAME_MACHINE}-unknown-linux-gnu
774
eval $set_cc_for_build
775
sed 's/^ //' << EOF >$dummy.c
779
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
782
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
789
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
791
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
794
echo powerpc-unknown-linux-gnu
797
echo powerpc64-unknown-linux-gnu
800
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
801
EV5) UNAME_MACHINE=alphaev5 ;;
802
EV56) UNAME_MACHINE=alphaev56 ;;
803
PCA56) UNAME_MACHINE=alphapca56 ;;
804
PCA57) UNAME_MACHINE=alphapca56 ;;
805
EV6) UNAME_MACHINE=alphaev6 ;;
806
EV67) UNAME_MACHINE=alphaev67 ;;
807
EV68*) UNAME_MACHINE=alphaev68 ;;
809
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
810
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
811
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
813
parisc:Linux:*:* | hppa:Linux:*:*)
815
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
816
PA7*) echo hppa1.1-unknown-linux-gnu ;;
817
PA8*) echo hppa2.0-unknown-linux-gnu ;;
818
*) echo hppa-unknown-linux-gnu ;;
821
parisc64:Linux:*:* | hppa64:Linux:*:*)
822
echo hppa64-unknown-linux-gnu
824
s390:Linux:*:* | s390x:Linux:*:*)
825
echo ${UNAME_MACHINE}-ibm-linux
828
echo ${UNAME_MACHINE}-unknown-linux-gnu
830
sparc:Linux:*:* | sparc64:Linux:*:*)
831
echo ${UNAME_MACHINE}-unknown-linux-gnu
834
echo x86_64-unknown-linux-gnu
740
837
# The BFD linker knows what the default object file format is, so
741
838
# first see if it will tell us. cd to the root directory to prevent
742
839
# problems with other programs or directories called `ld' in the path.
743
ld_supported_emulations=`cd /; ld --help 2>&1 \
744
| sed -ne '/supported emulations:/!d
840
# Export LANG=C to prevent ld from outputting information in other
842
ld_supported_targets=`LANG=C; export LANG; cd /; ld --help 2>&1 \
843
| sed -ne '/supported targets:/!d
746
s/.*supported emulations: *//
845
s/.*supported targets: *//
749
case "$ld_supported_emulations" in
751
echo "${UNAME_MACHINE}-unknown-linux"
848
case "$ld_supported_targets" in
850
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
755
853
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
759
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
762
856
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
766
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
770
echo "${UNAME_MACHINE}-unknown-linux-gnu"
774
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
778
echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
782
echo "${UNAME_MACHINE}-unknown-linux-gnu"
786
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
789
elf32ppc | elf32ppclinux)
790
# Determine Lib Version
792
#include <features.h>
793
#if defined(__GLIBC__)
794
extern char __libc_version[];
795
extern char __libc_release[];
801
#if defined(__GLIBC__)
802
printf("%s %s\n", __libc_version, __libc_release);
810
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
811
if test "$?" = 0 ; then
812
./$dummy | grep 1\.99 > /dev/null
813
if test "$?" = 0 ; then
817
rm -f $dummy.c $dummy
818
echo powerpc-unknown-linux-gnu${LIBC}
822
echo "${UNAME_MACHINE}-unknown-linux-gnu"
859
# Either a pre-BFD a.out linker (linux-gnuoldld) or
860
# one that does not give us useful --help.
861
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
827
if test "${UNAME_MACHINE}" = "alpha" ; then
831
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
838
.frame \$30,16,\$26,0
841
.long 0x47e03d80 # implver \$0
843
.long 0x47e20c21 # amask \$2,\$1
854
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
855
if test "$?" = 0 ; then
858
UNAME_MACHINE="alpha"
861
UNAME_MACHINE="alphaev5"
864
UNAME_MACHINE="alphaev56"
867
UNAME_MACHINE="alphapca56"
870
UNAME_MACHINE="alphaev6"
873
UNAME_MACHINE="alphaev67"
877
objdump --private-headers $dummy | \
878
grep ld.so.1 > /dev/null
879
if test "$?" = 0 ; then
883
rm -f $dummy.s $dummy
884
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
885
elif test "${UNAME_MACHINE}" = "mips" ; then
888
#include <stdio.h> /* for printf() prototype */
889
int main (int argc, char *argv[]) {
891
int main (argc, argv) int argc; char *argv[]; {
894
printf ("%s-unknown-linux-gnu\n", argv[1]);
897
printf ("%sel-unknown-linux-gnu\n", argv[1]);
902
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
903
rm -f $dummy.c $dummy
904
elif test "${UNAME_MACHINE}" = "s390"; then
905
echo s390-ibm-linux && exit 0
906
elif test "${UNAME_MACHINE}" = "x86_64"; then
907
echo x86_64-unknown-linux-gnu && exit 0
908
elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then
910
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
912
echo hppa1.1-unknown-linux-gnu
915
echo hppa2.0-unknown-linux-gnu
918
echo hppa-unknown-linux-gnu
923
# Either a pre-BFD a.out linker (linux-gnuoldld)
924
# or one that does not give us useful --help.
925
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
926
# If ld does not provide *any* "supported emulations:"
927
# that means it is gnuoldld.
928
test -z "$ld_supported_emulations" \
929
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
931
case "${UNAME_MACHINE}" in
939
# Determine whether the default compiler is a.out or elf
941
#include <features.h>
943
#include <stdio.h> /* for printf() prototype */
944
int main (int argc, char *argv[]) {
946
int main (argc, argv) int argc; char *argv[]; {
951
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
953
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
956
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
959
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
964
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
965
rm -f $dummy.c $dummy
966
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
968
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
969
# are messed up and put the nodename in both sysname and nodename.
864
# Determine whether the default compiler is a.out or elf
865
eval $set_cc_for_build
866
sed 's/^ //' << EOF >$dummy.c
867
#include <features.h>
879
#ifdef __INTEL_COMPILER
886
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
888
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
889
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
892
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
893
# earlier versions are messed up and put the nodename in both
894
# sysname and nodename.
971
895
echo i386-sequent-sysv4
973
i?86:UNIX_SV:4.2MP:2.*)
897
i*86:UNIX_SV:4.2MP:2.*)
974
898
# Unixware is an offshoot of SVR4, but it has its own version
975
899
# number series starting with 2...
976
900
# I am not positive that other SVR4 systems won't match this,