]> git.sur5r.net Git - openldap/blob - build/config.guess
Prepare for .22
[openldap] / build / config.guess
1 #! /bin/sh
2 # Attempt to guess a canonical system name.
3 #   Copyright 1998-2005 The OpenLDAP Foundation.
4 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
5 #   2000, 2001, 2002 Free Software Foundation, Inc.
6
7 timestamp='2002-10-21-OpenLDAP'
8 # $OpenLDAP$
9
10 # This file is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 # General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
28
29 # This file is distributed with OpenLDAP Software, which contains a
30 # configuration script generated by Autoconf, and is distributable
31 # under the same distributions terms as OpenLDAP inself.
32
33 ## Copyright 1998-2005 The OpenLDAP Foundation.
34 ## All rights reserved.
35 ##
36 ## Redistribution and use in source and binary forms, with or without
37 ## modification, are permitted only as authorized by the OpenLDAP
38 ## Public License.
39 ##
40 ## A copy of this license is available in the file LICENSE in the
41 ## top-level directory of the distribution or, alternatively, at
42 ## <http://www.OpenLDAP.org/license.html>.
43
44 # Originally written by Per Bothner <per@bothner.com>.
45 # Please send patches to <config-patches@gnu.org>.  Submit a context
46 # diff and a properly formatted ChangeLog entry.
47 #
48 # This script attempts to guess a canonical system name similar to
49 # config.sub.  If it succeeds, it prints the system name on stdout, and
50 # exits with 0.  Otherwise, it exits with 1.
51 #
52 # The plan is that this can be called by configure scripts if you
53 # don't specify an explicit build system type.
54
55 me=`echo "$0" | sed -e 's,.*/,,'`
56
57 usage="\
58 Usage: $0 [OPTION]
59
60 Output the configuration name of the system \`$me' is run on.
61
62 Operation modes:
63   -h, --help         print this help, then exit
64   -t, --time-stamp   print date of last modification, then exit
65   -v, --version      print version number, then exit
66
67 Report bugs and patches to <config-patches@gnu.org>."
68
69 version="\
70 GNU config.guess ($timestamp)
71
72 Originally written by Per Bothner.
73 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
74 Free Software Foundation, Inc.
75
76 This is free software; see the source for copying conditions.  There is NO
77 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
78
79 help="
80 Try \`$me --help' for more information."
81
82 # Parse command line
83 while test $# -gt 0 ; do
84   case $1 in
85     --time-stamp | --time* | -t )
86        echo "$timestamp" ; exit 0 ;;
87     --version | -v )
88        echo "$version" ; exit 0 ;;
89     --help | --h* | -h )
90        echo "$usage"; exit 0 ;;
91     -- )     # Stop option processing
92        shift; break ;;
93     - ) # Use stdin as input.
94        break ;;
95     -* )
96        echo "$me: invalid option $1$help" >&2
97        exit 1 ;;
98     * )
99        break ;;
100   esac
101 done
102
103 if test $# != 0; then
104   echo "$me: too many arguments$help" >&2
105   exit 1
106 fi
107
108 trap 'exit 1' 1 2 15
109
110 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
111 # compiler to aid in system detection is discouraged as it requires
112 # temporary files to be created and, as you can see below, it is a
113 # headache to deal with in a portable fashion.
114
115 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
116 # use `HOST_CC' if defined, but it is deprecated.
117
118 # This shell variable is my proudest work .. or something. --bje
119
120 set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
121 (old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
122    || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
123 dummy=$tmpdir/dummy ;
124 files="$dummy.c $dummy.o $dummy.rel $dummy" ;
125 trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
126 case $CC_FOR_BUILD,$HOST_CC,$CC in
127  ,,)    echo "int x;" > $dummy.c ;
128         for c in cc gcc c89 c99 ; do
129           if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
130              CC_FOR_BUILD="$c"; break ;
131           fi ;
132         done ;
133         rm -f $files ;
134         if test x"$CC_FOR_BUILD" = x ; then
135           CC_FOR_BUILD=no_compiler_found ;
136         fi
137         ;;
138  ,,*)   CC_FOR_BUILD=$CC ;;
139  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
140 esac ;
141 unset files'
142
143 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
144 # (ghazi@noc.rutgers.edu 1994-08-24)
145 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
146         PATH=$PATH:/.attbin ; export PATH
147 fi
148
149 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
150 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
151 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
152 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
153
154 # Note: order is significant - the case branches are not exclusive.
155
156 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
157     *:NetBSD:*:*)
158         # NetBSD (nbsd) targets should (where applicable) match one or
159         # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
160         # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
161         # switched to ELF, *-*-netbsd* would select the old
162         # object file format.  This provides both forward
163         # compatibility and a consistent mechanism for selecting the
164         # object file format.
165         #
166         # Note: NetBSD doesn't particularly care about the vendor
167         # portion of the name.  We always set it to "unknown".
168         sysctl="sysctl -n hw.machine_arch"
169         UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
170             /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
171         case "${UNAME_MACHINE_ARCH}" in
172             armeb) machine=armeb-unknown ;;
173             arm*) machine=arm-unknown ;;
174             sh3el) machine=shl-unknown ;;
175             sh3eb) machine=sh-unknown ;;
176             *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
177         esac
178         # The Operating System including object format, if it has switched
179         # to ELF recently, or will in the future.
180         case "${UNAME_MACHINE_ARCH}" in
181             arm*|i386|m68k|ns32k|sh3*|sparc|vax)
182                 eval $set_cc_for_build
183                 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
184                         | grep __ELF__ >/dev/null
185                 then
186                     # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
187                     # Return netbsd for either.  FIX?
188                     os=netbsd
189                 else
190                     os=netbsdelf
191                 fi
192                 ;;
193             *)
194                 os=netbsd
195                 ;;
196         esac
197         # The OS release
198         release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
199         # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
200         # contains redundant information, the shorter form:
201         # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
202         echo "${machine}-${os}${release}"
203         exit 0 ;;
204     amiga:OpenBSD:*:*)
205         echo m68k-unknown-openbsd${UNAME_RELEASE}
206         exit 0 ;;
207     arc:OpenBSD:*:*)
208         echo mipsel-unknown-openbsd${UNAME_RELEASE}
209         exit 0 ;;
210     hp300:OpenBSD:*:*)
211         echo m68k-unknown-openbsd${UNAME_RELEASE}
212         exit 0 ;;
213     mac68k:OpenBSD:*:*)
214         echo m68k-unknown-openbsd${UNAME_RELEASE}
215         exit 0 ;;
216     macppc:OpenBSD:*:*)
217         echo powerpc-unknown-openbsd${UNAME_RELEASE}
218         exit 0 ;;
219     mvme68k:OpenBSD:*:*)
220         echo m68k-unknown-openbsd${UNAME_RELEASE}
221         exit 0 ;;
222     mvme88k:OpenBSD:*:*)
223         echo m88k-unknown-openbsd${UNAME_RELEASE}
224         exit 0 ;;
225     mvmeppc:OpenBSD:*:*)
226         echo powerpc-unknown-openbsd${UNAME_RELEASE}
227         exit 0 ;;
228     pmax:OpenBSD:*:*)
229         echo mipsel-unknown-openbsd${UNAME_RELEASE}
230         exit 0 ;;
231     sgi:OpenBSD:*:*)
232         echo mipseb-unknown-openbsd${UNAME_RELEASE}
233         exit 0 ;;
234     sun3:OpenBSD:*:*)
235         echo m68k-unknown-openbsd${UNAME_RELEASE}
236         exit 0 ;;
237     wgrisc:OpenBSD:*:*)
238         echo mipsel-unknown-openbsd${UNAME_RELEASE}
239         exit 0 ;;
240     *:OpenBSD:*:*)
241         echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
242         exit 0 ;;
243     alpha:OSF1:*:*)
244         if test $UNAME_RELEASE = "V4.0"; then
245                 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
246         fi
247         # A Vn.n version is a released version.
248         # A Tn.n version is a released field test version.
249         # A Xn.n version is an unreleased experimental baselevel.
250         # 1.2 uses "1.2" for uname -r.
251         eval $set_cc_for_build
252         cat <<EOF >$dummy.s
253         .data
254 \$Lformat:
255         .byte 37,100,45,37,120,10,0     # "%d-%x\n"
256
257         .text
258         .globl main
259         .align 4
260         .ent main
261 main:
262         .frame \$30,16,\$26,0
263         ldgp \$29,0(\$27)
264         .prologue 1
265         .long 0x47e03d80 # implver \$0
266         lda \$2,-1
267         .long 0x47e20c21 # amask \$2,\$1
268         lda \$16,\$Lformat
269         mov \$0,\$17
270         not \$1,\$18
271         jsr \$26,printf
272         ldgp \$29,0(\$26)
273         mov 0,\$16
274         jsr \$26,exit
275         .end main
276 EOF
277         $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
278         if test "$?" = 0 ; then
279                 case `$dummy` in
280                         0-0)
281                                 UNAME_MACHINE="alpha"
282                                 ;;
283                         1-0)
284                                 UNAME_MACHINE="alphaev5"
285                                 ;;
286                         1-1)
287                                 UNAME_MACHINE="alphaev56"
288                                 ;;
289                         1-101)
290                                 UNAME_MACHINE="alphapca56"
291                                 ;;
292                         2-303)
293                                 UNAME_MACHINE="alphaev6"
294                                 ;;
295                         2-307)
296                                 UNAME_MACHINE="alphaev67"
297                                 ;;
298                         2-1307)
299                                 UNAME_MACHINE="alphaev68"
300                                 ;;
301                         3-1307)
302                                 UNAME_MACHINE="alphaev7"
303                                 ;;
304                 esac
305         fi
306         rm -f $dummy.s $dummy && rmdir $tmpdir
307         echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
308         exit 0 ;;
309     Alpha\ *:Windows_NT*:*)
310         # How do we know it's Interix rather than the generic POSIX subsystem?
311         # Should we change UNAME_MACHINE based on the output of uname instead
312         # of the specific Alpha model?
313         echo alpha-pc-interix
314         exit 0 ;;
315     21064:Windows_NT:50:3)
316         echo alpha-dec-winnt3.5
317         exit 0 ;;
318     Amiga*:UNIX_System_V:4.0:*)
319         echo m68k-unknown-sysv4
320         exit 0;;
321     *:[Aa]miga[Oo][Ss]:*:*)
322         echo ${UNAME_MACHINE}-unknown-amigaos
323         exit 0 ;;
324     *:[Mm]orph[Oo][Ss]:*:*)
325         echo ${UNAME_MACHINE}-unknown-morphos
326         exit 0 ;;
327     *:OS/390:*:*)
328         echo i370-ibm-openedition
329         exit 0 ;;
330     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
331         echo arm-acorn-riscix${UNAME_RELEASE}
332         exit 0;;
333     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
334         echo hppa1.1-hitachi-hiuxmpp
335         exit 0;;
336     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
337         # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
338         if test "`(/bin/universe) 2>/dev/null`" = att ; then
339                 echo pyramid-pyramid-sysv3
340         else
341                 echo pyramid-pyramid-bsd
342         fi
343         exit 0 ;;
344     NILE*:*:*:dcosx)
345         echo pyramid-pyramid-svr4
346         exit 0 ;;
347     DRS?6000:UNIX_SV:4.2*:7*)
348         case `/usr/bin/uname -p` in
349             sparc) echo sparc-icl-nx7 && exit 0 ;;
350         esac ;;
351     sun4H:SunOS:5.*:*)
352         echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
353         exit 0 ;;
354     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
355         echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
356         exit 0 ;;
357     i86pc:SunOS:5.*:*)
358         echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
359         exit 0 ;;
360     sun4*:SunOS:6*:*)
361         # According to config.sub, this is the proper way to canonicalize
362         # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
363         # it's likely to be more like Solaris than SunOS4.
364         echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
365         exit 0 ;;
366     sun4*:SunOS:*:*)
367         case "`/usr/bin/arch -k`" in
368             Series*|S4*)
369                 UNAME_RELEASE=`uname -v`
370                 ;;
371         esac
372         # Japanese Language versions have a version number like `4.1.3-JL'.
373         echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
374         exit 0 ;;
375     sun3*:SunOS:*:*)
376         echo m68k-sun-sunos${UNAME_RELEASE}
377         exit 0 ;;
378     sun*:*:4.2BSD:*)
379         UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
380         test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
381         case "`/bin/arch`" in
382             sun3)
383                 echo m68k-sun-sunos${UNAME_RELEASE}
384                 ;;
385             sun4)
386                 echo sparc-sun-sunos${UNAME_RELEASE}
387                 ;;
388         esac
389         exit 0 ;;
390     aushp:SunOS:*:*)
391         echo sparc-auspex-sunos${UNAME_RELEASE}
392         exit 0 ;;
393     # The situation for MiNT is a little confusing.  The machine name
394     # can be virtually everything (everything which is not
395     # "atarist" or "atariste" at least should have a processor
396     # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
397     # to the lowercase version "mint" (or "freemint").  Finally
398     # the system name "TOS" denotes a system which is actually not
399     # MiNT.  But MiNT is downward compatible to TOS, so this should
400     # be no problem.
401     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
402         echo m68k-atari-mint${UNAME_RELEASE}
403         exit 0 ;;
404     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
405         echo m68k-atari-mint${UNAME_RELEASE}
406         exit 0 ;;
407     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
408         echo m68k-atari-mint${UNAME_RELEASE}
409         exit 0 ;;
410     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
411         echo m68k-milan-mint${UNAME_RELEASE}
412         exit 0 ;;
413     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
414         echo m68k-hades-mint${UNAME_RELEASE}
415         exit 0 ;;
416     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
417         echo m68k-unknown-mint${UNAME_RELEASE}
418         exit 0 ;;
419     powerpc:machten:*:*)
420         echo powerpc-apple-machten${UNAME_RELEASE}
421         exit 0 ;;
422     RISC*:Mach:*:*)
423         echo mips-dec-mach_bsd4.3
424         exit 0 ;;
425     RISC*:ULTRIX:*:*)
426         echo mips-dec-ultrix${UNAME_RELEASE}
427         exit 0 ;;
428     VAX*:ULTRIX*:*:*)
429         echo vax-dec-ultrix${UNAME_RELEASE}
430         exit 0 ;;
431     2020:CLIX:*:* | 2430:CLIX:*:*)
432         echo clipper-intergraph-clix${UNAME_RELEASE}
433         exit 0 ;;
434     mips:*:*:UMIPS | mips:*:*:RISCos)
435         eval $set_cc_for_build
436         sed 's/^        //' << EOF >$dummy.c
437 #ifdef __cplusplus
438 #include <stdio.h>  /* for printf() prototype */
439         int main (int argc, char *argv[]) {
440 #else
441         int main (argc, argv) int argc; char *argv[]; {
442 #endif
443         #if defined (host_mips) && defined (MIPSEB)
444         #if defined (SYSTYPE_SYSV)
445           printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
446         #endif
447         #if defined (SYSTYPE_SVR4)
448           printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
449         #endif
450         #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
451           printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
452         #endif
453         #endif
454           exit (-1);
455         }
456 EOF
457         $CC_FOR_BUILD -o $dummy $dummy.c \
458           && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
459           && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
460         rm -f $dummy.c $dummy && rmdir $tmpdir
461         echo mips-mips-riscos${UNAME_RELEASE}
462         exit 0 ;;
463     Motorola:PowerMAX_OS:*:*)
464         echo powerpc-motorola-powermax
465         exit 0 ;;
466     Motorola:*:4.3:PL8-*)
467         echo powerpc-harris-powermax
468         exit 0 ;;
469     Night_Hawk:*:*:PowerMAX_OS)
470         echo powerpc-harris-powermax
471         exit 0 ;;
472     Night_Hawk:Power_UNIX:*:*)
473         echo powerpc-harris-powerunix
474         exit 0 ;;
475     m88k:CX/UX:7*:*)
476         echo m88k-harris-cxux7
477         exit 0 ;;
478     m88k:*:4*:R4*)
479         echo m88k-motorola-sysv4
480         exit 0 ;;
481     m88k:*:3*:R3*)
482         echo m88k-motorola-sysv3
483         exit 0 ;;
484     AViiON:dgux:*:*)
485         # DG/UX returns AViiON for all architectures
486         UNAME_PROCESSOR=`/usr/bin/uname -p`
487         if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
488         then
489             if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
490                [ ${TARGET_BINARY_INTERFACE}x = x ]
491             then
492                 echo m88k-dg-dgux${UNAME_RELEASE}
493             else
494                 echo m88k-dg-dguxbcs${UNAME_RELEASE}
495             fi
496         else
497             echo i586-dg-dgux${UNAME_RELEASE}
498         fi
499         exit 0 ;;
500     M88*:DolphinOS:*:*) # DolphinOS (SVR3)
501         echo m88k-dolphin-sysv3
502         exit 0 ;;
503     M88*:*:R3*:*)
504         # Delta 88k system running SVR3
505         echo m88k-motorola-sysv3
506         exit 0 ;;
507     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
508         echo m88k-tektronix-sysv3
509         exit 0 ;;
510     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
511         echo m68k-tektronix-bsd
512         exit 0 ;;
513     *:IRIX*:*:*)
514         echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
515         exit 0 ;;
516     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
517         echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
518         exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
519     i*86:AIX:*:*)
520         echo i386-ibm-aix
521         exit 0 ;;
522     ia64:AIX:*:*)
523         if [ -x /usr/bin/oslevel ] ; then
524                 IBM_REV=`/usr/bin/oslevel`
525         else
526                 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
527         fi
528         echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
529         exit 0 ;;
530     *:AIX:2:3)
531         if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
532                 eval $set_cc_for_build
533                 sed 's/^                //' << EOF >$dummy.c
534                 #include <sys/systemcfg.h>
535
536                 main()
537                         {
538                         if (!__power_pc())
539                                 exit(1);
540                         puts("powerpc-ibm-aix3.2.5");
541                         exit(0);
542                         }
543 EOF
544                 $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
545                 rm -f $dummy.c $dummy && rmdir $tmpdir
546                 echo rs6000-ibm-aix3.2.5
547         elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
548                 echo rs6000-ibm-aix3.2.4
549         else
550                 echo rs6000-ibm-aix3.2
551         fi
552         exit 0 ;;
553     *:AIX:*:[45])
554         IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
555         if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
556                 IBM_ARCH=rs6000
557         else
558                 IBM_ARCH=powerpc
559         fi
560         if [ -x /usr/bin/oslevel ] ; then
561                 IBM_REV=`/usr/bin/oslevel`
562         else
563                 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
564         fi
565         echo ${IBM_ARCH}-ibm-aix${IBM_REV}
566         exit 0 ;;
567     *:AIX:*:*)
568         echo rs6000-ibm-aix
569         exit 0 ;;
570     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
571         echo romp-ibm-bsd4.4
572         exit 0 ;;
573     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
574         echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
575         exit 0 ;;                           # report: romp-ibm BSD 4.3
576     *:BOSX:*:*)
577         echo rs6000-bull-bosx
578         exit 0 ;;
579     DPX/2?00:B.O.S.:*:*)
580         echo m68k-bull-sysv3
581         exit 0 ;;
582     9000/[34]??:4.3bsd:1.*:*)
583         echo m68k-hp-bsd
584         exit 0 ;;
585     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
586         echo m68k-hp-bsd4.4
587         exit 0 ;;
588     9000/[34678]??:HP-UX:*:*)
589         HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
590         case "${UNAME_MACHINE}" in
591             9000/31? )            HP_ARCH=m68000 ;;
592             9000/[34]?? )         HP_ARCH=m68k ;;
593             9000/[678][0-9][0-9])
594                 if [ -x /usr/bin/getconf ]; then
595                     sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
596                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
597                     case "${sc_cpu_version}" in
598                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
599                       528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
600                       532)                      # CPU_PA_RISC2_0
601                         case "${sc_kernel_bits}" in
602                           32) HP_ARCH="hppa2.0n" ;;
603                           64) HP_ARCH="hppa2.0w" ;;
604                           '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
605                         esac ;;
606                     esac
607                 fi
608                 if [ "${HP_ARCH}" = "" ]; then
609                     eval $set_cc_for_build
610                     sed 's/^              //' << EOF >$dummy.c
611
612               #define _HPUX_SOURCE
613               #include <stdlib.h>
614               #include <unistd.h>
615
616               int main ()
617               {
618               #if defined(_SC_KERNEL_BITS)
619                   long bits = sysconf(_SC_KERNEL_BITS);
620               #endif
621                   long cpu  = sysconf (_SC_CPU_VERSION);
622
623                   switch (cpu)
624                 {
625                 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
626                 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
627                 case CPU_PA_RISC2_0:
628               #if defined(_SC_KERNEL_BITS)
629                     switch (bits)
630                         {
631                         case 64: puts ("hppa2.0w"); break;
632                         case 32: puts ("hppa2.0n"); break;
633                         default: puts ("hppa2.0"); break;
634                         } break;
635               #else  /* !defined(_SC_KERNEL_BITS) */
636                     puts ("hppa2.0"); break;
637               #endif
638                 default: puts ("hppa1.0"); break;
639                 }
640                   exit (0);
641               }
642 EOF
643                     (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
644                     if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
645                     rm -f $dummy.c $dummy && rmdir $tmpdir
646                 fi ;;
647         esac
648         echo ${HP_ARCH}-hp-hpux${HPUX_REV}
649         exit 0 ;;
650     ia64:HP-UX:*:*)
651         HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
652         echo ia64-hp-hpux${HPUX_REV}
653         exit 0 ;;
654     3050*:HI-UX:*:*)
655         eval $set_cc_for_build
656         sed 's/^        //' << EOF >$dummy.c
657         #include <unistd.h>
658         int
659         main ()
660         {
661           long cpu = sysconf (_SC_CPU_VERSION);
662           /* The order matters, because CPU_IS_HP_MC68K erroneously returns
663              true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
664              results, however.  */
665           if (CPU_IS_PA_RISC (cpu))
666             {
667               switch (cpu)
668                 {
669                   case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
670                   case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
671                   case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
672                   default: puts ("hppa-hitachi-hiuxwe2"); break;
673                 }
674             }
675           else if (CPU_IS_HP_MC68K (cpu))
676             puts ("m68k-hitachi-hiuxwe2");
677           else puts ("unknown-hitachi-hiuxwe2");
678           exit (0);
679         }
680 EOF
681         $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
682         rm -f $dummy.c $dummy && rmdir $tmpdir
683         echo unknown-hitachi-hiuxwe2
684         exit 0 ;;
685     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
686         echo hppa1.1-hp-bsd
687         exit 0 ;;
688     9000/8??:4.3bsd:*:*)
689         echo hppa1.0-hp-bsd
690         exit 0 ;;
691     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
692         echo hppa1.0-hp-mpeix
693         exit 0 ;;
694     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
695         echo hppa1.1-hp-osf
696         exit 0 ;;
697     hp8??:OSF1:*:*)
698         echo hppa1.0-hp-osf
699         exit 0 ;;
700     i*86:OSF1:*:*)
701         if [ -x /usr/sbin/sysversion ] ; then
702             echo ${UNAME_MACHINE}-unknown-osf1mk
703         else
704             echo ${UNAME_MACHINE}-unknown-osf1
705         fi
706         exit 0 ;;
707     parisc*:Lites*:*:*)
708         echo hppa1.1-hp-lites
709         exit 0 ;;
710     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
711         echo c1-convex-bsd
712         exit 0 ;;
713     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
714         if getsysinfo -f scalar_acc
715         then echo c32-convex-bsd
716         else echo c2-convex-bsd
717         fi
718         exit 0 ;;
719     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
720         echo c34-convex-bsd
721         exit 0 ;;
722     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
723         echo c38-convex-bsd
724         exit 0 ;;
725     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
726         echo c4-convex-bsd
727         exit 0 ;;
728     CRAY*Y-MP:*:*:*)
729         echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
730         exit 0 ;;
731     CRAY*[A-Z]90:*:*:*)
732         echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
733         | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
734               -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
735               -e 's/\.[^.]*$/.X/'
736         exit 0 ;;
737     CRAY*TS:*:*:*)
738         echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
739         exit 0 ;;
740     CRAY*T3D:*:*:*)
741         echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
742         exit 0 ;;
743     CRAY*T3E:*:*:*)
744         echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
745         exit 0 ;;
746     CRAY*SV1:*:*:*)
747         echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
748         exit 0 ;;
749     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
750         FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
751         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
752         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
753         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
754         exit 0 ;;
755     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
756         echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
757         exit 0 ;;
758     sparc*:BSD/OS:*:*)
759         echo sparc-unknown-bsdi${UNAME_RELEASE}
760         exit 0 ;;
761     *:BSD/OS:*:*)
762         echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
763         exit 0 ;;
764     *:FreeBSD:*:*)
765         # Determine whether the default compiler uses glibc.
766         eval $set_cc_for_build
767         sed 's/^        //' << EOF >$dummy.c
768         #include <features.h>
769         #if __GLIBC__ >= 2
770         LIBC=gnu
771         #else
772         LIBC=
773         #endif
774 EOF
775         eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
776         rm -f $dummy.c && rmdir $tmpdir
777         echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
778         exit 0 ;;
779     i*:CYGWIN*:*)
780         echo ${UNAME_MACHINE}-pc-cygwin
781         exit 0 ;;
782     i*:MINGW*:*)
783         echo ${UNAME_MACHINE}-pc-mingw32
784         exit 0 ;;
785     i*:PW*:*)
786         echo ${UNAME_MACHINE}-pc-pw32
787         exit 0 ;;
788     x86:Interix*:3*)
789         echo i386-pc-interix3
790         exit 0 ;;
791     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
792         # How do we know it's Interix rather than the generic POSIX subsystem?
793         # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
794         # UNAME_MACHINE based on the output of uname instead of i386?
795         echo i386-pc-interix
796         exit 0 ;;
797     i*:UWIN*:*)
798         echo ${UNAME_MACHINE}-pc-uwin
799         exit 0 ;;
800     p*:CYGWIN*:*)
801         echo powerpcle-unknown-cygwin
802         exit 0 ;;
803     prep*:SunOS:5.*:*)
804         echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
805         exit 0 ;;
806     *:GNU:*:*)
807         echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
808         exit 0 ;;
809     i*86:Minix:*:*)
810         echo ${UNAME_MACHINE}-pc-minix
811         exit 0 ;;
812     arm*:Linux:*:*)
813         echo ${UNAME_MACHINE}-unknown-linux-gnu
814         exit 0 ;;
815     ia64:Linux:*:*)
816         echo ${UNAME_MACHINE}-unknown-linux-gnu
817         exit 0 ;;
818     m68*:Linux:*:*)
819         echo ${UNAME_MACHINE}-unknown-linux-gnu
820         exit 0 ;;
821     mips:Linux:*:*)
822         eval $set_cc_for_build
823         sed 's/^        //' << EOF >$dummy.c
824         #undef CPU
825         #undef mips
826         #undef mipsel
827         #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
828         CPU=mipsel
829         #else
830         #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
831         CPU=mips
832         #else
833         CPU=
834         #endif
835         #endif
836 EOF
837         eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
838         rm -f $dummy.c && rmdir $tmpdir
839         test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
840         ;;
841     ppc:Linux:*:*)
842         echo powerpc-unknown-linux-gnu
843         exit 0 ;;
844     ppc64:Linux:*:*)
845         echo powerpc64-unknown-linux-gnu
846         exit 0 ;;
847     alpha:Linux:*:*)
848         case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
849           EV5)   UNAME_MACHINE=alphaev5 ;;
850           EV56)  UNAME_MACHINE=alphaev56 ;;
851           PCA56) UNAME_MACHINE=alphapca56 ;;
852           PCA57) UNAME_MACHINE=alphapca56 ;;
853           EV6)   UNAME_MACHINE=alphaev6 ;;
854           EV67)  UNAME_MACHINE=alphaev67 ;;
855           EV68*) UNAME_MACHINE=alphaev68 ;;
856         esac
857         objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
858         if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
859         echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
860         exit 0 ;;
861     parisc:Linux:*:* | hppa:Linux:*:*)
862         # Look for CPU level
863         case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
864           PA7*) echo hppa1.1-unknown-linux-gnu ;;
865           PA8*) echo hppa2.0-unknown-linux-gnu ;;
866           *)    echo hppa-unknown-linux-gnu ;;
867         esac
868         exit 0 ;;
869     parisc64:Linux:*:* | hppa64:Linux:*:*)
870         echo hppa64-unknown-linux-gnu
871         exit 0 ;;
872     s390:Linux:*:* | s390x:Linux:*:*)
873         echo ${UNAME_MACHINE}-ibm-linux
874         exit 0 ;;
875     sh*:Linux:*:*)
876         echo ${UNAME_MACHINE}-unknown-linux-gnu
877         exit 0 ;;
878     sparc:Linux:*:* | sparc64:Linux:*:*)
879         echo ${UNAME_MACHINE}-unknown-linux-gnu
880         exit 0 ;;
881     x86_64:Linux:*:*)
882         echo x86_64-unknown-linux-gnu
883         exit 0 ;;
884     i*86:Linux:*:*)
885         # The BFD linker knows what the default object file format is, so
886         # first see if it will tell us. cd to the root directory to prevent
887         # problems with other programs or directories called `ld' in the path.
888         # Set LC_ALL=C to ensure ld outputs messages in English.
889         ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
890                          | sed -ne '/supported targets:/!d
891                                     s/[         ][      ]*/ /g
892                                     s/.*supported targets: *//
893                                     s/ .*//
894                                     p'`
895         case "$ld_supported_targets" in
896           elf32-i386)
897                 TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
898                 ;;
899           a.out-i386-linux)
900                 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
901                 exit 0 ;;
902           coff-i386)
903                 echo "${UNAME_MACHINE}-pc-linux-gnucoff"
904                 exit 0 ;;
905           "")
906                 # Either a pre-BFD a.out linker (linux-gnuoldld) or
907                 # one that does not give us useful --help.
908                 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
909                 exit 0 ;;
910         esac
911         # Determine whether the default compiler is a.out or elf
912         eval $set_cc_for_build
913         sed 's/^        //' << EOF >$dummy.c
914         #include <features.h>
915         #ifdef __ELF__
916         # ifdef __GLIBC__
917         #  if __GLIBC__ >= 2
918         LIBC=gnu
919         #  else
920         LIBC=gnulibc1
921         #  endif
922         # else
923         LIBC=gnulibc1
924         # endif
925         #else
926         #ifdef __INTEL_COMPILER
927         LIBC=gnu
928         #else
929         LIBC=gnuaout
930         #endif
931         #endif
932 EOF
933         eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
934         rm -f $dummy.c && rmdir $tmpdir
935         test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
936         test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
937         ;;
938     i*86:DYNIX/ptx:4*:*)
939         # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
940         # earlier versions are messed up and put the nodename in both
941         # sysname and nodename.
942         echo i386-sequent-sysv4
943         exit 0 ;;
944     i*86:UNIX_SV:4.2MP:2.*)
945         # Unixware is an offshoot of SVR4, but it has its own version
946         # number series starting with 2...
947         # I am not positive that other SVR4 systems won't match this,
948         # I just have to hope.  -- rms.
949         # Use sysv4.2uw... so that sysv4* matches it.
950         echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
951         exit 0 ;;
952     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
953         UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
954         if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
955                 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
956         else
957                 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
958         fi
959         exit 0 ;;
960     i*86:*:5:[78]*)
961         case `/bin/uname -X | grep "^Machine"` in
962             *486*)           UNAME_MACHINE=i486 ;;
963             *Pentium)        UNAME_MACHINE=i586 ;;
964             *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
965         esac
966         echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
967         exit 0 ;;
968     i*86:*:3.2:*)
969         if test -f /usr/options/cb.name; then
970                 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
971                 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
972         elif /bin/uname -X 2>/dev/null >/dev/null ; then
973                 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
974                 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
975                 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
976                         && UNAME_MACHINE=i586
977                 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
978                         && UNAME_MACHINE=i686
979                 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
980                         && UNAME_MACHINE=i686
981                 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
982         else
983                 echo ${UNAME_MACHINE}-pc-sysv32
984         fi
985         exit 0 ;;
986     i*86:*DOS:*:*)
987         echo ${UNAME_MACHINE}-pc-msdosdjgpp
988         exit 0 ;;
989     pc:*:*:*)
990         # Left here for compatibility:
991         # uname -m prints for DJGPP always 'pc', but it prints nothing about
992         # the processor, so we play safe by assuming i386.
993         echo i386-pc-msdosdjgpp
994         exit 0 ;;
995     Intel:Mach:3*:*)
996         echo i386-pc-mach3
997         exit 0 ;;
998     paragon:*:*:*)
999         echo i860-intel-osf1
1000         exit 0 ;;
1001     i860:*:4.*:*) # i860-SVR4
1002         if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1003           echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1004         else # Add other i860-SVR4 vendors below as they are discovered.
1005           echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1006         fi
1007         exit 0 ;;
1008     mini*:CTIX:SYS*5:*)
1009         # "miniframe"
1010         echo m68010-convergent-sysv
1011         exit 0 ;;
1012     mc68k:UNIX:SYSTEM5:3.51m)
1013         echo m68k-convergent-sysv
1014         exit 0 ;;
1015     M68*:*:R3V[567]*:*)
1016         test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1017     3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
1018         OS_REL=''
1019         test -r /etc/.relid \
1020         && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1021         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1022           && echo i486-ncr-sysv4.3${OS_REL} && exit 0
1023         /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1024           && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
1025     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1026         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1027           && echo i486-ncr-sysv4 && exit 0 ;;
1028     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1029         echo m68k-unknown-lynxos${UNAME_RELEASE}
1030         exit 0 ;;
1031     mc68030:UNIX_System_V:4.*:*)
1032         echo m68k-atari-sysv4
1033         exit 0 ;;
1034     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1035         echo i386-unknown-lynxos${UNAME_RELEASE}
1036         exit 0 ;;
1037     TSUNAMI:LynxOS:2.*:*)
1038         echo sparc-unknown-lynxos${UNAME_RELEASE}
1039         exit 0 ;;
1040     rs6000:LynxOS:2.*:*)
1041         echo rs6000-unknown-lynxos${UNAME_RELEASE}
1042         exit 0 ;;
1043     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1044         echo powerpc-unknown-lynxos${UNAME_RELEASE}
1045         exit 0 ;;
1046     SM[BE]S:UNIX_SV:*:*)
1047         echo mips-dde-sysv${UNAME_RELEASE}
1048         exit 0 ;;
1049     RM*:ReliantUNIX-*:*:*)
1050         echo mips-sni-sysv4
1051         exit 0 ;;
1052     RM*:SINIX-*:*:*)
1053         echo mips-sni-sysv4
1054         exit 0 ;;
1055     *:SINIX-*:*:*)
1056         if uname -p 2>/dev/null >/dev/null ; then
1057                 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1058                 echo ${UNAME_MACHINE}-sni-sysv4
1059         else
1060                 echo ns32k-sni-sysv
1061         fi
1062         exit 0 ;;
1063     PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1064                       # says <Richard.M.Bartel@ccMail.Census.GOV>
1065         echo i586-unisys-sysv4
1066         exit 0 ;;
1067     *:UNIX_System_V:4*:FTX*)
1068         # From Gerald Hewes <hewes@openmarket.com>.
1069         # How about differentiating between stratus architectures? -djm
1070         echo hppa1.1-stratus-sysv4
1071         exit 0 ;;
1072     *:*:*:FTX*)
1073         # From seanf@swdc.stratus.com.
1074         echo i860-stratus-sysv4
1075         exit 0 ;;
1076     *:VOS:*:*)
1077         # From Paul.Green@stratus.com.
1078         echo hppa1.1-stratus-vos
1079         exit 0 ;;
1080     mc68*:A/UX:*:*)
1081         echo m68k-apple-aux${UNAME_RELEASE}
1082         exit 0 ;;
1083     news*:NEWS-OS:6*:*)
1084         echo mips-sony-newsos6
1085         exit 0 ;;
1086     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1087         if [ -d /usr/nec ]; then
1088                 echo mips-nec-sysv${UNAME_RELEASE}
1089         else
1090                 echo mips-unknown-sysv${UNAME_RELEASE}
1091         fi
1092         exit 0 ;;
1093     BeBox:BeOS:*:*)     # BeOS running on hardware made by Be, PPC only.
1094         echo powerpc-be-beos
1095         exit 0 ;;
1096     BeMac:BeOS:*:*)     # BeOS running on Mac or Mac clone, PPC only.
1097         echo powerpc-apple-beos
1098         exit 0 ;;
1099     BePC:BeOS:*:*)      # BeOS running on Intel PC compatible.
1100         echo i586-pc-beos
1101         exit 0 ;;
1102     SX-4:SUPER-UX:*:*)
1103         echo sx4-nec-superux${UNAME_RELEASE}
1104         exit 0 ;;
1105     SX-5:SUPER-UX:*:*)
1106         echo sx5-nec-superux${UNAME_RELEASE}
1107         exit 0 ;;
1108     SX-6:SUPER-UX:*:*)
1109         echo sx6-nec-superux${UNAME_RELEASE}
1110         exit 0 ;;
1111     Power*:Rhapsody:*:*)
1112         echo powerpc-apple-rhapsody${UNAME_RELEASE}
1113         exit 0 ;;
1114     *:Rhapsody:*:*)
1115         echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1116         exit 0 ;;
1117     *:Darwin:*:*)
1118         echo `uname -p`-apple-darwin${UNAME_RELEASE}
1119         exit 0 ;;
1120     *:procnto*:*:* | *:QNX:[0123456789]*:*)
1121         UNAME_PROCESSOR=`uname -p`
1122         if test "$UNAME_PROCESSOR" = "x86"; then
1123                 UNAME_PROCESSOR=i386
1124                 UNAME_MACHINE=pc
1125         fi
1126         echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1127         exit 0 ;;
1128     *:QNX:*:4*)
1129         echo i386-pc-qnx
1130         exit 0 ;;
1131     NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
1132         echo nsr-tandem-nsk${UNAME_RELEASE}
1133         exit 0 ;;
1134     *:NonStop-UX:*:*)
1135         echo mips-compaq-nonstopux
1136         exit 0 ;;
1137     BS2000:POSIX*:*:*)
1138         echo bs2000-siemens-sysv
1139         exit 0 ;;
1140     DS/*:UNIX_System_V:*:*)
1141         echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1142         exit 0 ;;
1143     *:Plan9:*:*)
1144         # "uname -m" is not consistent, so use $cputype instead. 386
1145         # is converted to i386 for consistency with other x86
1146         # operating systems.
1147         if test "$cputype" = "386"; then
1148             UNAME_MACHINE=i386
1149         else
1150             UNAME_MACHINE="$cputype"
1151         fi
1152         echo ${UNAME_MACHINE}-unknown-plan9
1153         exit 0 ;;
1154     i*86:OS/2:*:*)
1155         # If we were able to find `uname', then EMX Unix compatibility
1156         # is probably installed.
1157         echo ${UNAME_MACHINE}-pc-os2-emx
1158         exit 0 ;;
1159     *:TOPS-10:*:*)
1160         echo pdp10-unknown-tops10
1161         exit 0 ;;
1162     *:TENEX:*:*)
1163         echo pdp10-unknown-tenex
1164         exit 0 ;;
1165     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1166         echo pdp10-dec-tops20
1167         exit 0 ;;
1168     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1169         echo pdp10-xkl-tops20
1170         exit 0 ;;
1171     *:TOPS-20:*:*)
1172         echo pdp10-unknown-tops20
1173         exit 0 ;;
1174     *:ITS:*:*)
1175         echo pdp10-unknown-its
1176         exit 0 ;;
1177     i*86:XTS-300:*:STOP)
1178         echo ${UNAME_MACHINE}-unknown-stop
1179         exit 0 ;;
1180     i*86:atheos:*:*)
1181         echo ${UNAME_MACHINE}-unknown-atheos
1182         exit 0 ;;
1183 esac
1184
1185 #echo '(No uname command or uname output not recognized.)' 1>&2
1186 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1187
1188 eval $set_cc_for_build
1189 cat >$dummy.c <<EOF
1190 #ifdef _SEQUENT_
1191 # include <sys/types.h>
1192 # include <sys/utsname.h>
1193 #endif
1194 main ()
1195 {
1196 #if defined (sony)
1197 #if defined (MIPSEB)
1198   /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1199      I don't know....  */
1200   printf ("mips-sony-bsd\n"); exit (0);
1201 #else
1202 #include <sys/param.h>
1203   printf ("m68k-sony-newsos%s\n",
1204 #ifdef NEWSOS4
1205           "4"
1206 #else
1207           ""
1208 #endif
1209          ); exit (0);
1210 #endif
1211 #endif
1212
1213 #if defined (__arm) && defined (__acorn) && defined (__unix)
1214   printf ("arm-acorn-riscix"); exit (0);
1215 #endif
1216
1217 #if defined (hp300) && !defined (hpux)
1218   printf ("m68k-hp-bsd\n"); exit (0);
1219 #endif
1220
1221 #if defined (NeXT)
1222 #if !defined (__ARCHITECTURE__)
1223 #define __ARCHITECTURE__ "m68k"
1224 #endif
1225   int version;
1226   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1227   if (version < 4)
1228     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1229   else
1230     printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1231   exit (0);
1232 #endif
1233
1234 #if defined (MULTIMAX) || defined (n16)
1235 #if defined (UMAXV)
1236   printf ("ns32k-encore-sysv\n"); exit (0);
1237 #else
1238 #if defined (CMU)
1239   printf ("ns32k-encore-mach\n"); exit (0);
1240 #else
1241   printf ("ns32k-encore-bsd\n"); exit (0);
1242 #endif
1243 #endif
1244 #endif
1245
1246 #if defined (__386BSD__)
1247   printf ("i386-pc-bsd\n"); exit (0);
1248 #endif
1249
1250 #if defined (sequent)
1251 #if defined (i386)
1252   printf ("i386-sequent-dynix\n"); exit (0);
1253 #endif
1254 #if defined (ns32000)
1255   printf ("ns32k-sequent-dynix\n"); exit (0);
1256 #endif
1257 #endif
1258
1259 #if defined (_SEQUENT_)
1260     struct utsname un;
1261
1262     uname(&un);
1263
1264     if (strncmp(un.version, "V2", 2) == 0) {
1265         printf ("i386-sequent-ptx2\n"); exit (0);
1266     }
1267     if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1268         printf ("i386-sequent-ptx1\n"); exit (0);
1269     }
1270     printf ("i386-sequent-ptx\n"); exit (0);
1271
1272 #endif
1273
1274 #if defined (vax)
1275 # if !defined (ultrix)
1276 #  include <sys/param.h>
1277 #  if defined (BSD)
1278 #   if BSD == 43
1279       printf ("vax-dec-bsd4.3\n"); exit (0);
1280 #   else
1281 #    if BSD == 199006
1282       printf ("vax-dec-bsd4.3reno\n"); exit (0);
1283 #    else
1284       printf ("vax-dec-bsd\n"); exit (0);
1285 #    endif
1286 #   endif
1287 #  else
1288     printf ("vax-dec-bsd\n"); exit (0);
1289 #  endif
1290 # else
1291     printf ("vax-dec-ultrix\n"); exit (0);
1292 # endif
1293 #endif
1294
1295 #if defined (alliant) && defined (i860)
1296   printf ("i860-alliant-bsd\n"); exit (0);
1297 #endif
1298
1299   exit (1);
1300 }
1301 EOF
1302
1303 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
1304 rm -f $dummy.c $dummy && rmdir $tmpdir
1305
1306 # Apollos put the system type in the environment.
1307
1308 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1309
1310 # Convex versions that predate uname can use getsysinfo(1)
1311
1312 if [ -x /usr/convex/getsysinfo ]
1313 then
1314     case `getsysinfo -f cpu_type` in
1315     c1*)
1316         echo c1-convex-bsd
1317         exit 0 ;;
1318     c2*)
1319         if getsysinfo -f scalar_acc
1320         then echo c32-convex-bsd
1321         else echo c2-convex-bsd
1322         fi
1323         exit 0 ;;
1324     c34*)
1325         echo c34-convex-bsd
1326         exit 0 ;;
1327     c38*)
1328         echo c38-convex-bsd
1329         exit 0 ;;
1330     c4*)
1331         echo c4-convex-bsd
1332         exit 0 ;;
1333     esac
1334 fi
1335
1336 cat >&2 <<EOF
1337 $0: unable to guess system type
1338
1339 This script, last modified $timestamp, has failed to recognize
1340 the operating system you are using. It is advised that you
1341 download the most up to date version of the config scripts from
1342
1343     ftp://ftp.gnu.org/pub/gnu/config/
1344
1345 If the version you run ($0) is already up to date, please
1346 send the following data and any information you think might be
1347 pertinent to <config-patches@gnu.org> in order to provide the needed
1348 information to handle your system.
1349
1350 config.guess timestamp = $timestamp
1351
1352 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1353 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1354 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1355 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1356
1357 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1358 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1359
1360 hostinfo               = `(hostinfo) 2>/dev/null`
1361 /bin/universe          = `(/bin/universe) 2>/dev/null`
1362 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1363 /bin/arch              = `(/bin/arch) 2>/dev/null`
1364 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1365 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1366
1367 UNAME_MACHINE = ${UNAME_MACHINE}
1368 UNAME_RELEASE = ${UNAME_RELEASE}
1369 UNAME_SYSTEM  = ${UNAME_SYSTEM}
1370 UNAME_VERSION = ${UNAME_VERSION}
1371 EOF
1372
1373 exit 1
1374
1375 # Local variables:
1376 # eval: (add-hook 'write-file-hooks 'time-stamp)
1377 # time-stamp-start: "timestamp='"
1378 # time-stamp-format: "%:y-%02m-%02d"
1379 # time-stamp-end: "'"
1380 # End: