source: trunk/src/gcc/config.guess@ 1213

Last change on this file since 1213 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 40.5 KB
Line 
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, 2003 Free Software Foundation, Inc.
5
6timestamp='2003-01-30'
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
91trap 'exit 1' 1 2 15
92
93# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
94# compiler to aid in system detection is discouraged as it requires
95# temporary files to be created and, as you can see below, it is a
96# headache to deal with in a portable fashion.
97
98# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
99# use `HOST_CC' if defined, but it is deprecated.
100
101# Portable tmp directory creation inspired by the Autoconf team.
102
103set_cc_for_build='
104trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
105trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
106: ${TMPDIR=/tmp} ;
107 { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
108 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
109 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
110dummy=$tmp/dummy ;
111tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
112case $CC_FOR_BUILD,$HOST_CC,$CC in
113 ,,) echo "int x;" > $dummy.c ;
114 for c in cc gcc c89 c99 ; do
115 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
116 CC_FOR_BUILD="$c"; break ;
117 fi ;
118 done ;
119 if test x"$CC_FOR_BUILD" = x ; then
120 CC_FOR_BUILD=no_compiler_found ;
121 fi
122 ;;
123 ,,*) CC_FOR_BUILD=$CC ;;
124 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
125esac ;'
126
127# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
128# ([email protected] 1994-08-24)
129if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
130 PATH=$PATH:/.attbin ; export PATH
131fi
132
133UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
134UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
135UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
136UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
137
138# Note: order is significant - the case branches are not exclusive.
139
140case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
141 *:NetBSD:*:*)
142 # NetBSD (nbsd) targets should (where applicable) match one or
143 # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
144 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
145 # switched to ELF, *-*-netbsd* would select the old
146 # object file format. This provides both forward
147 # compatibility and a consistent mechanism for selecting the
148 # object file format.
149 #
150 # Note: NetBSD doesn't particularly care about the vendor
151 # portion of the name. We always set it to "unknown".
152 sysctl="sysctl -n hw.machine_arch"
153 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
154 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
155 case "${UNAME_MACHINE_ARCH}" in
156 armeb) machine=armeb-unknown ;;
157 arm*) machine=arm-unknown ;;
158 sh3el) machine=shl-unknown ;;
159 sh3eb) machine=sh-unknown ;;
160 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
161 esac
162 # The Operating System including object format, if it has switched
163 # to ELF recently, or will in the future.
164 case "${UNAME_MACHINE_ARCH}" in
165 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
166 eval $set_cc_for_build
167 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
168 | grep __ELF__ >/dev/null
169 then
170 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
171 # Return netbsd for either. FIX?
172 os=netbsd
173 else
174 os=netbsdelf
175 fi
176 ;;
177 *)
178 os=netbsd
179 ;;
180 esac
181 # The OS release
182 # Debian GNU/NetBSD machines have a different userland, and
183 # thus, need a distinct triplet. However, they do not need
184 # kernel version information, so it can be replaced with a
185 # suitable tag, in the style of linux-gnu.
186 case "${UNAME_VERSION}" in
187 Debian*)
188 release='-gnu'
189 ;;
190 *)
191 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
192 ;;
193 esac
194 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
195 # contains redundant information, the shorter form:
196 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
197 echo "${machine}-${os}${release}"
198 exit 0 ;;
199 amiga:OpenBSD:*:*)
200 echo m68k-unknown-openbsd${UNAME_RELEASE}
201 exit 0 ;;
202 arc:OpenBSD:*:*)
203 echo mipsel-unknown-openbsd${UNAME_RELEASE}
204 exit 0 ;;
205 hp300:OpenBSD:*:*)
206 echo m68k-unknown-openbsd${UNAME_RELEASE}
207 exit 0 ;;
208 mac68k:OpenBSD:*:*)
209 echo m68k-unknown-openbsd${UNAME_RELEASE}
210 exit 0 ;;
211 macppc:OpenBSD:*:*)
212 echo powerpc-unknown-openbsd${UNAME_RELEASE}
213 exit 0 ;;
214 mvme68k:OpenBSD:*:*)
215 echo m68k-unknown-openbsd${UNAME_RELEASE}
216 exit 0 ;;
217 mvme88k:OpenBSD:*:*)
218 echo m88k-unknown-openbsd${UNAME_RELEASE}
219 exit 0 ;;
220 mvmeppc:OpenBSD:*:*)
221 echo powerpc-unknown-openbsd${UNAME_RELEASE}
222 exit 0 ;;
223 pmax:OpenBSD:*:*)
224 echo mipsel-unknown-openbsd${UNAME_RELEASE}
225 exit 0 ;;
226 sgi:OpenBSD:*:*)
227 echo mipseb-unknown-openbsd${UNAME_RELEASE}
228 exit 0 ;;
229 sun3:OpenBSD:*:*)
230 echo m68k-unknown-openbsd${UNAME_RELEASE}
231 exit 0 ;;
232 wgrisc:OpenBSD:*:*)
233 echo mipsel-unknown-openbsd${UNAME_RELEASE}
234 exit 0 ;;
235 *:OpenBSD:*:*)
236 echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
237 exit 0 ;;
238 *:MicroBSD:*:*)
239 echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE}
240 exit 0 ;;
241 alpha:OSF1:*:*)
242 if test $UNAME_RELEASE = "V4.0"; then
243 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
244 fi
245 # According to Compaq, /usr/sbin/psrinfo has been available on
246 # OSF/1 and Tru64 systems produced since 1995. I hope that
247 # covers most systems running today. This code pipes the CPU
248 # types through head -n 1, so we only detect the type of CPU 0.
249 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
250 case "$ALPHA_CPU_TYPE" in
251 "EV4 (21064)")
252 UNAME_MACHINE="alpha" ;;
253 "EV4.5 (21064)")
254 UNAME_MACHINE="alpha" ;;
255 "LCA4 (21066/21068)")
256 UNAME_MACHINE="alpha" ;;
257 "EV5 (21164)")
258 UNAME_MACHINE="alphaev5" ;;
259 "EV5.6 (21164A)")
260 UNAME_MACHINE="alphaev56" ;;
261 "EV5.6 (21164PC)")
262 UNAME_MACHINE="alphapca56" ;;
263 "EV5.7 (21164PC)")
264 UNAME_MACHINE="alphapca57" ;;
265 "EV6 (21264)")
266 UNAME_MACHINE="alphaev6" ;;
267 "EV6.7 (21264A)")
268 UNAME_MACHINE="alphaev67" ;;
269 "EV6.8CB (21264C)")
270 UNAME_MACHINE="alphaev68" ;;
271 "EV6.8AL (21264B)")
272 UNAME_MACHINE="alphaev68" ;;
273 "EV6.8CX (21264D)")
274 UNAME_MACHINE="alphaev68" ;;
275 "EV6.9A (21264/EV69A)")
276 UNAME_MACHINE="alphaev69" ;;
277 "EV7 (21364)")
278 UNAME_MACHINE="alphaev7" ;;
279 "EV7.9 (21364A)")
280 UNAME_MACHINE="alphaev79" ;;
281 esac
282 # A Vn.n version is a released version.
283 # A Tn.n version is a released field test version.
284 # A Xn.n version is an unreleased experimental baselevel.
285 # 1.2 uses "1.2" for uname -r.
286 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
287 exit 0 ;;
288 Alpha\ *:Windows_NT*:*)
289 # How do we know it's Interix rather than the generic POSIX subsystem?
290 # Should we change UNAME_MACHINE based on the output of uname instead
291 # of the specific Alpha model?
292 echo alpha-pc-interix
293 exit 0 ;;
294 21064:Windows_NT:50:3)
295 echo alpha-dec-winnt3.5
296 exit 0 ;;
297 Amiga*:UNIX_System_V:4.0:*)
298 echo m68k-unknown-sysv4
299 exit 0;;
300 *:[Aa]miga[Oo][Ss]:*:*)
301 echo ${UNAME_MACHINE}-unknown-amigaos
302 exit 0 ;;
303 *:[Mm]orph[Oo][Ss]:*:*)
304 echo ${UNAME_MACHINE}-unknown-morphos
305 exit 0 ;;
306 *:OS/390:*:*)
307 echo i370-ibm-openedition
308 exit 0 ;;
309 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
310 echo arm-acorn-riscix${UNAME_RELEASE}
311 exit 0;;
312 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
313 echo hppa1.1-hitachi-hiuxmpp
314 exit 0;;
315 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
316 # [email protected] (Earle F. Ake) contributed MIS and NILE.
317 if test "`(/bin/universe) 2>/dev/null`" = att ; then
318 echo pyramid-pyramid-sysv3
319 else
320 echo pyramid-pyramid-bsd
321 fi
322 exit 0 ;;
323 NILE*:*:*:dcosx)
324 echo pyramid-pyramid-svr4
325 exit 0 ;;
326 DRS?6000:UNIX_SV:4.2*:7*)
327 case `/usr/bin/uname -p` in
328 sparc) echo sparc-icl-nx7 && exit 0 ;;
329 esac ;;
330 sun4H:SunOS:5.*:*)
331 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
332 exit 0 ;;
333 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
334 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335 exit 0 ;;
336 i86pc:SunOS:5.*:*)
337 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
338 exit 0 ;;
339 sun4*:SunOS:6*:*)
340 # According to config.sub, this is the proper way to canonicalize
341 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
342 # it's likely to be more like Solaris than SunOS4.
343 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
344 exit 0 ;;
345 sun4*:SunOS:*:*)
346 case "`/usr/bin/arch -k`" in
347 Series*|S4*)
348 UNAME_RELEASE=`uname -v`
349 ;;
350 esac
351 # Japanese Language versions have a version number like `4.1.3-JL'.
352 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
353 exit 0 ;;
354 sun3*:SunOS:*:*)
355 echo m68k-sun-sunos${UNAME_RELEASE}
356 exit 0 ;;
357 sun*:*:4.2BSD:*)
358 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
359 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
360 case "`/bin/arch`" in
361 sun3)
362 echo m68k-sun-sunos${UNAME_RELEASE}
363 ;;
364 sun4)
365 echo sparc-sun-sunos${UNAME_RELEASE}
366 ;;
367 esac
368 exit 0 ;;
369 aushp:SunOS:*:*)
370 echo sparc-auspex-sunos${UNAME_RELEASE}
371 exit 0 ;;
372 # The situation for MiNT is a little confusing. The machine name
373 # can be virtually everything (everything which is not
374 # "atarist" or "atariste" at least should have a processor
375 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
376 # to the lowercase version "mint" (or "freemint"). Finally
377 # the system name "TOS" denotes a system which is actually not
378 # MiNT. But MiNT is downward compatible to TOS, so this should
379 # be no problem.
380 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
381 echo m68k-atari-mint${UNAME_RELEASE}
382 exit 0 ;;
383 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
384 echo m68k-atari-mint${UNAME_RELEASE}
385 exit 0 ;;
386 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
387 echo m68k-atari-mint${UNAME_RELEASE}
388 exit 0 ;;
389 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
390 echo m68k-milan-mint${UNAME_RELEASE}
391 exit 0 ;;
392 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
393 echo m68k-hades-mint${UNAME_RELEASE}
394 exit 0 ;;
395 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
396 echo m68k-unknown-mint${UNAME_RELEASE}
397 exit 0 ;;
398 powerpc:machten:*:*)
399 echo powerpc-apple-machten${UNAME_RELEASE}
400 exit 0 ;;
401 RISC*:Mach:*:*)
402 echo mips-dec-mach_bsd4.3
403 exit 0 ;;
404 RISC*:ULTRIX:*:*)
405 echo mips-dec-ultrix${UNAME_RELEASE}
406 exit 0 ;;
407 VAX*:ULTRIX*:*:*)
408 echo vax-dec-ultrix${UNAME_RELEASE}
409 exit 0 ;;
410 2020:CLIX:*:* | 2430:CLIX:*:*)
411 echo clipper-intergraph-clix${UNAME_RELEASE}
412 exit 0 ;;
413 mips:*:*:UMIPS | mips:*:*:RISCos)
414 eval $set_cc_for_build
415 sed 's/^ //' << EOF >$dummy.c
416#ifdef __cplusplus
417#include <stdio.h> /* for printf() prototype */
418 int main (int argc, char *argv[]) {
419#else
420 int main (argc, argv) int argc; char *argv[]; {
421#endif
422 #if defined (host_mips) && defined (MIPSEB)
423 #if defined (SYSTYPE_SYSV)
424 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
425 #endif
426 #if defined (SYSTYPE_SVR4)
427 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
428 #endif
429 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
430 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
431 #endif
432 #endif
433 exit (-1);
434 }
435EOF
436 $CC_FOR_BUILD -o $dummy $dummy.c \
437 && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
438 && exit 0
439 echo mips-mips-riscos${UNAME_RELEASE}
440 exit 0 ;;
441 Motorola:PowerMAX_OS:*:*)
442 echo powerpc-motorola-powermax
443 exit 0 ;;
444 Motorola:*:4.3:PL8-*)
445 echo powerpc-harris-powermax
446 exit 0 ;;
447 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
448 echo powerpc-harris-powermax
449 exit 0 ;;
450 Night_Hawk:Power_UNIX:*:*)
451 echo powerpc-harris-powerunix