source: vendor/diffutils/2.8.1/config/config.guess@ 3037

Last change on this file since 3037 was 2556, checked in by bird, 20 years ago

diffutils 2.8.1

File size: 37.6 KB
RevLine 
[2556]1#! /bin/sh
2# Attempt to guess a canonical system name.
3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4# 2000, 2001, 2002 Free Software Foundation, Inc.
5
6timestamp='2002-03-20'
7
8# This file is free software; you can redistribute it and/or modify it
9# under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
27# Originally written by Per Bothner <[email protected]>.
28# Please send patches to <[email protected]>. Submit a context
29# diff and a properly formatted ChangeLog entry.
30#
31# This script attempts to guess a canonical system name similar to
32# config.sub. If it succeeds, it prints the system name on stdout, and
33# exits with 0. Otherwise, it exits with 1.
34#
35# The plan is that this can be called by configure scripts if you
36# don't specify an explicit build system type.
37
38me=`echo "$0" | sed -e 's,.*/,,'`
39
40usage="\
41Usage: $0 [OPTION]
42
43Output the configuration name of the system \`$me' is run on.
44
45Operation modes:
46 -h, --help print this help, then exit
47 -t, --time-stamp print date of last modification, then exit
48 -v, --version print version number, then exit
49
50Report bugs and patches to <[email protected]>."
51
52version="\
53GNU config.guess ($timestamp)
54
55Originally written by Per Bothner.
56Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
57Free Software Foundation, Inc.
58
59This is free software; see the source for copying conditions. There is NO
60warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
61
62help="
63Try \`$me --help' for more information."
64
65# Parse command line
66while test $# -gt 0 ; do
67 case $1 in
68 --time-stamp | --time* | -t )
69 echo "$timestamp" ; exit 0 ;;
70 --version | -v )
71 echo "$version" ; exit 0 ;;
72 --help | --h* | -h )
73 echo "$usage"; exit 0 ;;
74 -- ) # Stop option processing
75 shift; break ;;
76 - ) # Use stdin as input.
77 break ;;
78 -* )
79 echo "$me: invalid option $1$help" >&2
80 exit 1 ;;
81 * )
82 break ;;
83 esac
84done
85
86if test $# != 0; then
87 echo "$me: too many arguments$help" >&2
88 exit 1
89fi
90
91
92dummy=dummy-$$
93trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
94
95# CC_FOR_BUILD -- compiler used by this script.
96# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
97# use `HOST_CC' if defined, but it is deprecated.
98
99set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
100 ,,) echo "int dummy(){}" > $dummy.c ;
101 for c in cc gcc c89 c99 ; do
102 ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
103 if test $? = 0 ; then
104 CC_FOR_BUILD="$c"; break ;
105 fi ;
106 done ;
107 rm -f $dummy.c $dummy.o $dummy.rel ;
108 if test x"$CC_FOR_BUILD" = x ; then
109 CC_FOR_BUILD=no_compiler_found ;
110 fi
111 ;;
112 ,,*) CC_FOR_BUILD=$CC ;;
113 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
114esac'
115
116# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
117# ([email protected] 1994-08-24)
118if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
119 PATH=$PATH:/.attbin ; export PATH
120fi
121
122UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
123UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
124UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
125UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
126
127# Note: order is significant - the case branches are not exclusive.
128
129case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
130 *:NetBSD:*:*)
131 # NetBSD (nbsd) targets should (where applicable) match one or
132 # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
133 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
134 # switched to ELF, *-*-netbsd* would select the old
135 # object file format. This provides both forward
136 # compatibility and a consistent mechanism for selecting the
137 # object file format.
138 #
139 # Note: NetBSD doesn't particularly care about the vendor
140 # portion of the name. We always set it to "unknown".
141 sysctl="sysctl -n hw.machine_arch"
142 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
143 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
144 case "${UNAME_MACHINE_ARCH}" in
145 arm*) machine=arm-unknown ;;
146 sh3el) machine=shl-unknown ;;
147 sh3eb) machine=sh-unknown ;;
148 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
149 esac
150 # The Operating System including object format, if it has switched
151 # to ELF recently, or will in the future.
152 case "${UNAME_MACHINE_ARCH}" in
153 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
154 eval $set_cc_for_build
155 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
156 | grep __ELF__ >/dev/null
157 then
158 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
159 # Return netbsd for either. FIX?
160 os=netbsd
161 else
162 os=netbsdelf
163 fi
164 ;;
165 *)
166 os=netbsd
167 ;;
168 esac
169 # The OS release
170 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
171 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
172 # contains redundant information, the shorter form:
173 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
174 echo "${machine}-${os}${release}"
175 exit 0 ;;
176 amiga:OpenBSD:*:*)
177 echo m68k-unknown-openbsd${UNAME_RELEASE}
178 exit 0 ;;
179 arc:OpenBSD:*:*)
180 echo mipsel-unknown-openbsd${UNAME_RELEASE}
181 exit 0 ;;
182 hp300:OpenBSD:*:*)
183 echo m68k-unknown-openbsd${UNAME_RELEASE}
184 exit 0 ;;
185 mac68k:OpenBSD:*:*)
186 echo m68k-unknown-openbsd${UNAME_RELEASE}
187 exit 0 ;;
188 macppc:OpenBSD:*:*)
189 echo powerpc-unknown-openbsd${UNAME_RELEASE}
190 exit 0 ;;
191 mvme68k:OpenBSD:*:*)
192 echo m68k-unknown-openbsd${UNAME_RELEASE}
193 exit 0 ;;
194 mvme88k:OpenBSD:*:*)
195 echo m88k-unknown-openbsd${UNAME_RELEASE}
196 exit 0 ;;
197 mvmeppc:OpenBSD:*:*)
198 echo powerpc-unknown-openbsd${UNAME_RELEASE}
199 exit 0 ;;
200 pmax:OpenBSD:*:*)
201 echo mipsel-unknown-openbsd${UNAME_RELEASE}
202 exit 0 ;;
203 sgi:OpenBSD:*:*)
204 echo mipseb-unknown-openbsd${UNAME_RELEASE}
205 exit 0 ;;
206 sun3:OpenBSD:*:*)
207 echo m68k-unknown-openbsd${UNAME_RELEASE}
208 exit 0 ;;
209 wgrisc:OpenBSD:*:*)
210 echo mipsel-unknown-openbsd${UNAME_RELEASE}
211 exit 0 ;;
212 *:OpenBSD:*:*)
213 echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
214 exit 0 ;;
215 alpha:OSF1:*:*)
216 if test $UNAME_RELEASE = "V4.0"; then
217 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
218 fi