You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1183 lines
32 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. #! /bin/sh
  2. # Attempt to guess a canonical system name.
  3. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
  4. # Free Software Foundation, Inc.
  5. #
  6. # This file is free software; you can redistribute it and/or modify it
  7. # under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. #
  20. # As a special exception to the GNU General Public License, if you
  21. # distribute this file as part of a program that contains a
  22. # configuration script generated by Autoconf, you may include it under
  23. # the same distribution terms that you use for the rest of that program.
  24. # Written by Per Bothner <bothner@cygnus.com>.
  25. # Please send patches to <config-patches@gnu.org>.
  26. #
  27. # This script attempts to guess a canonical system name similar to
  28. # config.sub. If it succeeds, it prints the system name on stdout, and
  29. # exits with 0. Otherwise, it exits with 1.
  30. #
  31. # The plan is that this can be called by configure scripts if you
  32. # don't specify an explicit system type (host/target name).
  33. #
  34. # Only a few systems have been added to this list; please add others
  35. # (but try to keep the structure clean).
  36. #
  37. # Use $HOST_CC if defined. $CC may point to a cross-compiler
  38. if test x"$CC_FOR_BUILD" = x; then
  39. if test x"$HOST_CC" != x; then
  40. CC_FOR_BUILD="$HOST_CC"
  41. else
  42. if test x"$CC" != x; then
  43. CC_FOR_BUILD="$CC"
  44. else
  45. CC_FOR_BUILD=cc
  46. fi
  47. fi
  48. fi
  49. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
  50. # (ghazi@noc.rutgers.edu 8/24/94.)
  51. if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
  52. PATH=$PATH:/.attbin ; export PATH
  53. fi
  54. UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
  55. UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
  56. UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
  57. UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
  58. dummy=dummy-$$
  59. trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
  60. # Note: order is significant - the case branches are not exclusive.
  61. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
  62. *:NetBSD:*:*)
  63. # Netbsd (nbsd) targets should (where applicable) match one or
  64. # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
  65. # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
  66. # switched to ELF, *-*-netbsd* would select the old
  67. # object file format. This provides both forward
  68. # compatibility and a consistent mechanism for selecting the
  69. # object file format.
  70. # Determine the machine/vendor (is the vendor relevant).
  71. case "${UNAME_MACHINE}" in
  72. amiga) machine=m68k-cbm ;;
  73. arm32) machine=arm-unknown ;;
  74. atari*) machine=m68k-atari ;;
  75. sun3*) machine=m68k-sun ;;
  76. mac68k) machine=m68k-apple ;;
  77. macppc) machine=powerpc-apple ;;
  78. hp3[0-9][05]) machine=m68k-hp ;;
  79. ibmrt|romp-ibm) machine=romp-ibm ;;
  80. *) machine=${UNAME_MACHINE}-unknown ;;
  81. esac
  82. # The Operating System including object format.
  83. if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
  84. | grep __ELF__ >/dev/null
  85. then
  86. # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
  87. # Return netbsd for either. FIX?
  88. os=netbsd
  89. else
  90. os=netbsdelf
  91. fi
  92. # The OS release
  93. release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  94. # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
  95. # contains redundant information, the shorter form:
  96. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
  97. echo "${machine}-${os}${release}"
  98. exit 0 ;;
  99. alpha:OSF1:*:*)
  100. if test $UNAME_RELEASE = "V4.0"; then
  101. UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
  102. fi
  103. # A Vn.n version is a released version.
  104. # A Tn.n version is a released field test version.
  105. # A Xn.n version is an unreleased experimental baselevel.
  106. # 1.2 uses "1.2" for uname -r.
  107. cat <<EOF >$dummy.s
  108. .data
  109. \$Lformat:
  110. .byte 37,100,45,37,120,10,0 # "%d-%x\n"
  111. .text
  112. .globl main
  113. .align 4
  114. .ent main
  115. main:
  116. .frame \$30,16,\$26,0
  117. ldgp \$29,0(\$27)
  118. .prologue 1
  119. .long 0x47e03d80 # implver \$0
  120. lda \$2,-1
  121. .long 0x47e20c21 # amask \$2,\$1
  122. lda \$16,\$Lformat
  123. mov \$0,\$17
  124. not \$1,\$18
  125. jsr \$26,printf
  126. ldgp \$29,0(\$26)
  127. mov 0,\$16
  128. jsr \$26,exit
  129. .end main
  130. EOF
  131. $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
  132. if test "$?" = 0 ; then
  133. case `./$dummy` in
  134. 0-0)
  135. UNAME_MACHINE="alpha"
  136. ;;
  137. 1-0)
  138. UNAME_MACHINE="alphaev5"
  139. ;;
  140. 1-1)
  141. UNAME_MACHINE="alphaev56"
  142. ;;
  143. 1-101)
  144. UNAME_MACHINE="alphapca56"
  145. ;;
  146. 2-303)
  147. UNAME_MACHINE="alphaev6"
  148. ;;
  149. 2-307)
  150. UNAME_MACHINE="alphaev67"
  151. ;;
  152. esac
  153. fi
  154. rm -f $dummy.s $dummy
  155. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  156. exit 0 ;;
  157. Alpha\ *:Windows_NT*:*)
  158. # How do we know it's Interix rather than the generic POSIX subsystem?
  159. # Should we change UNAME_MACHINE based on the output of uname instead
  160. # of the specific Alpha model?
  161. echo alpha-pc-interix
  162. exit 0 ;;
  163. 21064:Windows_NT:50:3)
  164. echo alpha-dec-winnt3.5
  165. exit 0 ;;
  166. Amiga*:UNIX_System_V:4.0:*)
  167. echo m68k-cbm-sysv4
  168. exit 0;;
  169. amiga:OpenBSD:*:*)
  170. echo m68k-unknown-openbsd${UNAME_RELEASE}
  171. exit 0 ;;
  172. *:[Aa]miga[Oo][Ss]:*:*)
  173. echo ${UNAME_MACHINE}-unknown-amigaos
  174. exit 0 ;;
  175. arc64:OpenBSD:*:*)
  176. echo mips64el-unknown-openbsd${UNAME_RELEASE}
  177. exit 0 ;;
  178. arc:OpenBSD:*:*)
  179. echo mipsel-unknown-openbsd${UNAME_RELEASE}
  180. exit 0 ;;
  181. hkmips:OpenBSD:*:*)
  182. echo mips-unknown-openbsd${UNAME_RELEASE}
  183. exit 0 ;;
  184. pmax:OpenBSD:*:*)
  185. echo mipsel-unknown-openbsd${UNAME_RELEASE}
  186. exit 0 ;;
  187. sgi:OpenBSD:*:*)
  188. echo mips-unknown-openbsd${UNAME_RELEASE}
  189. exit 0 ;;
  190. wgrisc:OpenBSD:*:*)
  191. echo mipsel-unknown-openbsd${UNAME_RELEASE}
  192. exit 0 ;;
  193. *:OS/390:*:*)
  194. echo i370-ibm-openedition
  195. exit 0 ;;
  196. arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  197. echo arm-acorn-riscix${UNAME_RELEASE}
  198. exit 0;;
  199. SR2?01:HI-UX/MPP:*:*)
  200. echo hppa1.1-hitachi-hiuxmpp
  201. exit 0;;
  202. Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
  203. # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
  204. if test "`(/bin/universe) 2>/dev/null`" = att ; then
  205. echo pyramid-pyramid-sysv3
  206. else
  207. echo pyramid-pyramid-bsd
  208. fi
  209. exit 0 ;;
  210. NILE*:*:*:dcosx)
  211. echo pyramid-pyramid-svr4
  212. exit 0 ;;
  213. sun4H:SunOS:5.*:*)
  214. echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  215. exit 0 ;;
  216. sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
  217. echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  218. exit 0 ;;
  219. i86pc:SunOS:5.*:*)
  220. echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  221. exit 0 ;;
  222. sun4*:SunOS:6*:*)
  223. # According to config.sub, this is the proper way to canonicalize
  224. # SunOS6. Hard to guess exactly what SunOS6 will be like, but
  225. # it's likely to be more like Solaris than SunOS4.
  226. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  227. exit 0 ;;
  228. sun4*:SunOS:*:*)
  229. case "`/usr/bin/arch -k`" in
  230. Series*|S4*)
  231. UNAME_RELEASE=`uname -v`
  232. ;;
  233. esac
  234. # Japanese Language versions have a version number like `4.1.3-JL'.
  235. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
  236. exit 0 ;;
  237. sun3*:SunOS:*:*)
  238. echo m68k-sun-sunos${UNAME_RELEASE}
  239. exit 0 ;;
  240. sun*:*:4.2BSD:*)
  241. UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
  242. test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
  243. case "`/bin/arch`" in
  244. sun3)
  245. echo m68k-sun-sunos${UNAME_RELEASE}
  246. ;;
  247. sun4)
  248. echo sparc-sun-sunos${UNAME_RELEASE}
  249. ;;
  250. esac
  251. exit 0 ;;
  252. aushp:SunOS:*:*)
  253. echo sparc-auspex-sunos${UNAME_RELEASE}
  254. exit 0 ;;
  255. atari*:OpenBSD:*:*)
  256. echo m68k-unknown-openbsd${UNAME_RELEASE}
  257. exit 0 ;;
  258. # The situation for MiNT is a little confusing. The machine name
  259. # can be virtually everything (everything which is not
  260. # "atarist" or "atariste" at least should have a processor
  261. # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
  262. # to the lowercase version "mint" (or "freemint"). Finally
  263. # the system name "TOS" denotes a system which is actually not
  264. # MiNT. But MiNT is downward compatible to TOS, so this should
  265. # be no problem.
  266. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
  267. echo m68k-atari-mint${UNAME_RELEASE}
  268. exit 0 ;;
  269. atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
  270. echo m68k-atari-mint${UNAME_RELEASE}
  271. exit 0 ;;
  272. *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
  273. echo m68k-atari-mint${UNAME_RELEASE}
  274. exit 0 ;;
  275. milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
  276. echo m68k-milan-mint${UNAME_RELEASE}
  277. exit 0 ;;
  278. hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
  279. echo m68k-hades-mint${UNAME_RELEASE}
  280. exit 0 ;;
  281. *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
  282. echo m68k-unknown-mint${UNAME_RELEASE}
  283. exit 0 ;;
  284. sun3*:OpenBSD:*:*)
  285. echo m68k-unknown-openbsd${UNAME_RELEASE}
  286. exit 0 ;;
  287. mac68k:OpenBSD:*:*)
  288. echo m68k-unknown-openbsd${UNAME_RELEASE}
  289. exit 0 ;;
  290. mvme68k:OpenBSD:*:*)
  291. echo m68k-unknown-openbsd${UNAME_RELEASE}
  292. exit 0 ;;
  293. mvme88k:OpenBSD:*:*)
  294. echo m88k-unknown-openbsd${UNAME_RELEASE}
  295. exit 0 ;;
  296. powerpc:machten:*:*)
  297. echo powerpc-apple-machten${UNAME_RELEASE}
  298. exit 0 ;;
  299. RISC*:Mach:*:*)
  300. echo mips-dec-mach_bsd4.3
  301. exit 0 ;;
  302. RISC*:ULTRIX:*:*)
  303. echo mips-dec-ultrix${UNAME_RELEASE}
  304. exit 0 ;;
  305. VAX*:ULTRIX*:*:*)
  306. echo vax-dec-ultrix${UNAME_RELEASE}
  307. exit 0 ;;
  308. 2020:CLIX:*:* | 2430:CLIX:*:*)
  309. echo clipper-intergraph-clix${UNAME_RELEASE}
  310. exit 0 ;;
  311. mips:*:*:UMIPS | mips:*:*:RISCos)
  312. sed 's/^ //' << EOF >$dummy.c
  313. #ifdef __cplusplus
  314. #include <stdio.h> /* for printf() prototype */
  315. int main (int argc, char *argv[]) {
  316. #else
  317. int main (argc, argv) int argc; char *argv[]; {
  318. #endif
  319. #if defined (host_mips) && defined (MIPSEB)
  320. #if defined (SYSTYPE_SYSV)
  321. printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
  322. #endif
  323. #if defined (SYSTYPE_SVR4)
  324. printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
  325. #endif
  326. #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
  327. printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
  328. #endif
  329. #endif
  330. exit (-1);
  331. }
  332. EOF
  333. $CC_FOR_BUILD $dummy.c -o $dummy \
  334. && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
  335. && rm $dummy.c $dummy && exit 0
  336. rm -f $dummy.c $dummy
  337. echo mips-mips-riscos${UNAME_RELEASE}
  338. exit 0 ;;
  339. Night_Hawk:Power_UNIX:*:*)
  340. echo powerpc-harris-powerunix
  341. exit 0 ;;
  342. m88k:CX/UX:7*:*)
  343. echo m88k-harris-cxux7
  344. exit 0 ;;
  345. m88k:*:4*:R4*)
  346. echo m88k-motorola-sysv4
  347. exit 0 ;;
  348. m88k:*:3*:R3*)
  349. echo m88k-motorola-sysv3
  350. exit 0 ;;
  351. AViiON:dgux:*:*)
  352. # DG/UX returns AViiON for all architectures
  353. UNAME_PROCESSOR=`/usr/bin/uname -p`
  354. if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
  355. then
  356. if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
  357. [ ${TARGET_BINARY_INTERFACE}x = x ]
  358. then
  359. echo m88k-dg-dgux${UNAME_RELEASE}
  360. else
  361. echo m88k-dg-dguxbcs${UNAME_RELEASE}
  362. fi
  363. else
  364. echo i586-dg-dgux${UNAME_RELEASE}
  365. fi
  366. exit 0 ;;
  367. M88*:DolphinOS:*:*) # DolphinOS (SVR3)
  368. echo m88k-dolphin-sysv3
  369. exit 0 ;;
  370. M88*:*:R3*:*)
  371. # Delta 88k system running SVR3
  372. echo m88k-motorola-sysv3
  373. exit 0 ;;
  374. XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
  375. echo m88k-tektronix-sysv3
  376. exit 0 ;;
  377. Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
  378. echo m68k-tektronix-bsd
  379. exit 0 ;;
  380. *:IRIX*:*:*)
  381. echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
  382. exit 0 ;;
  383. ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
  384. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
  385. exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
  386. i?86:AIX:*:*)
  387. echo i386-ibm-aix
  388. exit 0 ;;
  389. *:AIX:2:3)
  390. if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
  391. sed 's/^ //' << EOF >$dummy.c
  392. #include <sys/systemcfg.h>
  393. main()
  394. {
  395. if (!__power_pc())
  396. exit(1);
  397. puts("powerpc-ibm-aix3.2.5");
  398. exit(0);
  399. }
  400. EOF
  401. $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
  402. rm -f $dummy.c $dummy
  403. echo rs6000-ibm-aix3.2.5
  404. elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
  405. echo rs6000-ibm-aix3.2.4
  406. else
  407. echo rs6000-ibm-aix3.2
  408. fi
  409. exit 0 ;;
  410. *:AIX:*:4)
  411. IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
  412. if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
  413. IBM_ARCH=rs6000
  414. else
  415. IBM_ARCH=powerpc
  416. fi
  417. if [ -x /usr/bin/oslevel ] ; then
  418. IBM_REV=`/usr/bin/oslevel`
  419. else
  420. IBM_REV=4.${UNAME_RELEASE}
  421. fi
  422. echo ${IBM_ARCH}-ibm-aix${IBM_REV}
  423. exit 0 ;;
  424. *:AIX:*:*)
  425. echo rs6000-ibm-aix
  426. exit 0 ;;
  427. ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  428. echo romp-ibm-bsd4.4
  429. exit 0 ;;
  430. ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
  431. echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
  432. exit 0 ;; # report: romp-ibm BSD 4.3
  433. *:BOSX:*:*)
  434. echo rs6000-bull-bosx
  435. exit 0 ;;
  436. DPX/2?00:B.O.S.:*:*)
  437. echo m68k-bull-sysv3
  438. exit 0 ;;
  439. 9000/[34]??:4.3bsd:1.*:*)
  440. echo m68k-hp-bsd
  441. exit 0 ;;
  442. hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
  443. echo m68k-hp-bsd4.4
  444. exit 0 ;;
  445. 9000/[34678]??:HP-UX:*:*)
  446. case "${UNAME_MACHINE}" in
  447. 9000/31? ) HP_ARCH=m68000 ;;
  448. 9000/[34]?? ) HP_ARCH=m68k ;;
  449. 9000/[678][0-9][0-9])
  450. sed 's/^ //' << EOF >$dummy.c
  451. #define _HPUX_SOURCE
  452. #include <stdlib.h>
  453. #include <unistd.h>
  454. int main ()
  455. {
  456. #if defined(_SC_KERNEL_BITS)
  457. long bits = sysconf(_SC_KERNEL_BITS);
  458. #endif
  459. long cpu = sysconf (_SC_CPU_VERSION);
  460. switch (cpu)
  461. {
  462. case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
  463. case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
  464. case CPU_PA_RISC2_0:
  465. #if defined(_SC_KERNEL_BITS)
  466. switch (bits)
  467. {
  468. case 64: puts ("hppa2.0w"); break;
  469. case 32: puts ("hppa2.0n"); break;
  470. default: puts ("hppa2.0"); break;
  471. } break;
  472. #else /* !defined(_SC_KERNEL_BITS) */
  473. puts ("hppa2.0"); break;
  474. #endif
  475. default: puts ("hppa1.0"); break;
  476. }
  477. exit (0);
  478. }
  479. EOF
  480. (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
  481. rm -f $dummy.c $dummy
  482. esac
  483. HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  484. echo ${HP_ARCH}-hp-hpux${HPUX_REV}
  485. exit 0 ;;
  486. 3050*:HI-UX:*:*)
  487. sed 's/^ //' << EOF >$dummy.c
  488. #include <unistd.h>
  489. int
  490. main ()
  491. {
  492. long cpu = sysconf (_SC_CPU_VERSION);
  493. /* The order matters, because CPU_IS_HP_MC68K erroneously returns
  494. true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
  495. results, however. */
  496. if (CPU_IS_PA_RISC (cpu))
  497. {
  498. switch (cpu)
  499. {
  500. case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
  501. case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
  502. case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
  503. default: puts ("hppa-hitachi-hiuxwe2"); break;
  504. }
  505. }
  506. else if (CPU_IS_HP_MC68K (cpu))
  507. puts ("m68k-hitachi-hiuxwe2");
  508. else puts ("unknown-hitachi-hiuxwe2");
  509. exit (0);
  510. }
  511. EOF
  512. $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
  513. rm -f $dummy.c $dummy
  514. echo unknown-hitachi-hiuxwe2
  515. exit 0 ;;
  516. 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
  517. echo hppa1.1-hp-bsd
  518. exit 0 ;;
  519. 9000/8??:4.3bsd:*:*)
  520. echo hppa1.0-hp-bsd
  521. exit 0 ;;
  522. *9??*:MPE/iX:*:*)
  523. echo hppa1.0-hp-mpeix
  524. exit 0 ;;
  525. hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
  526. echo hppa1.1-hp-osf
  527. exit 0 ;;
  528. hp8??:OSF1:*:*)
  529. echo hppa1.0-hp-osf
  530. exit 0 ;;
  531. i?86:OSF1:*:*)
  532. if [ -x /usr/sbin/sysversion ] ; then
  533. echo ${UNAME_MACHINE}-unknown-osf1mk
  534. else
  535. echo ${UNAME_MACHINE}-unknown-osf1
  536. fi
  537. exit 0 ;;
  538. parisc*:Lites*:*:*)
  539. echo hppa1.1-hp-lites
  540. exit 0 ;;
  541. hppa*:OpenBSD:*:*)
  542. echo hppa-unknown-openbsd
  543. exit 0 ;;
  544. C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
  545. echo c1-convex-bsd
  546. exit 0 ;;
  547. C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
  548. if getsysinfo -f scalar_acc
  549. then echo c32-convex-bsd
  550. else echo c2-convex-bsd
  551. fi
  552. exit 0 ;;
  553. C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
  554. echo c34-convex-bsd
  555. exit 0 ;;
  556. C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
  557. echo c38-convex-bsd
  558. exit 0 ;;
  559. C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
  560. echo c4-convex-bsd
  561. exit 0 ;;
  562. CRAY*X-MP:*:*:*)
  563. echo xmp-cray-unicos
  564. exit 0 ;;
  565. CRAY*Y-MP:*:*:*)
  566. echo ymp-cray-unicos${UNAME_RELEASE}
  567. exit 0 ;;
  568. CRAY*[A-Z]90:*:*:*)
  569. echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
  570. | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
  571. -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
  572. exit 0 ;;
  573. CRAY*TS:*:*:*)
  574. echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  575. exit 0 ;;
  576. CRAY*T3E:*:*:*)
  577. echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  578. exit 0 ;;
  579. CRAY*SV1:*:*:*)
  580. echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  581. exit 0 ;;
  582. CRAY-2:*:*:*)
  583. echo cray2-cray-unicos
  584. exit 0 ;;
  585. F300:UNIX_System_V:*:*)
  586. FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
  587. FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
  588. echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
  589. exit 0 ;;
  590. F301:UNIX_System_V:*:*)
  591. echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
  592. exit 0 ;;
  593. hp300:OpenBSD:*:*)
  594. echo m68k-unknown-openbsd${UNAME_RELEASE}
  595. exit 0 ;;
  596. i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
  597. echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
  598. exit 0 ;;
  599. sparc*:BSD/OS:*:*)
  600. echo sparc-unknown-bsdi${UNAME_RELEASE}
  601. exit 0 ;;
  602. *:BSD/OS:*:*)
  603. echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
  604. exit 0 ;;
  605. *:FreeBSD:*:*)
  606. echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
  607. exit 0 ;;
  608. *:OpenBSD:*:*)
  609. echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  610. exit 0 ;;
  611. i*:CYGWIN*:*)
  612. echo ${UNAME_MACHINE}-pc-cygwin
  613. exit 0 ;;
  614. i*:MINGW*:*)
  615. echo ${UNAME_MACHINE}-pc-mingw32
  616. exit 0 ;;
  617. i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
  618. # How do we know it's Interix rather than the generic POSIX subsystem?
  619. # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
  620. # UNAME_MACHINE based on the output of uname instead of i386?
  621. echo i386-pc-interix
  622. exit 0 ;;
  623. i*:UWIN*:*)
  624. echo ${UNAME_MACHINE}-pc-uwin
  625. exit 0 ;;
  626. p*:CYGWIN*:*)
  627. echo powerpcle-unknown-cygwin
  628. exit 0 ;;
  629. prep*:SunOS:5.*:*)
  630. echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  631. exit 0 ;;
  632. *:GNU:*:*)
  633. echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
  634. exit 0 ;;
  635. *:Linux:*:*)
  636. # The BFD linker knows what the default object file format is, so
  637. # first see if it will tell us. cd to the root directory to prevent
  638. # problems with other programs or directories called `ld' in the path.
  639. ld_help_string=`cd /; ld --help 2>&1`
  640. ld_supported_emulations=`echo $ld_help_string \
  641. | sed -ne '/supported emulations:/!d
  642. s/[ ][ ]*/ /g
  643. s/.*supported emulations: *//
  644. s/ .*//
  645. p'`
  646. case "$ld_supported_emulations" in
  647. *ia64)
  648. echo "${UNAME_MACHINE}-unknown-linux"
  649. exit 0
  650. ;;
  651. i?86linux)
  652. echo "${UNAME_MACHINE}-pc-linux-gnuaout"
  653. exit 0
  654. ;;
  655. elf_i?86)
  656. echo "${UNAME_MACHINE}-pc-linux"
  657. exit 0
  658. ;;
  659. i?86coff)
  660. echo "${UNAME_MACHINE}-pc-linux-gnucoff"
  661. exit 0
  662. ;;
  663. sparclinux)
  664. echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
  665. exit 0
  666. ;;
  667. armlinux)
  668. echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
  669. exit 0
  670. ;;
  671. elf32arm*)
  672. echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
  673. exit 0
  674. ;;
  675. armelf_linux*)
  676. echo "${UNAME_MACHINE}-unknown-linux-gnu"
  677. exit 0
  678. ;;
  679. m68klinux)
  680. echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
  681. exit 0
  682. ;;
  683. elf32ppc | elf32ppclinux)
  684. # Determine Lib Version
  685. cat >$dummy.c <<EOF
  686. #include <features.h>
  687. #if defined(__GLIBC__)
  688. extern char __libc_version[];
  689. extern char __libc_release[];
  690. #endif
  691. main(argc, argv)
  692. int argc;
  693. char *argv[];
  694. {
  695. #if defined(__GLIBC__)
  696. printf("%s %s\n", __libc_version, __libc_release);
  697. #else
  698. printf("unkown\n");
  699. #endif
  700. return 0;
  701. }
  702. EOF
  703. LIBC=""
  704. $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
  705. if test "$?" = 0 ; then
  706. ./$dummy | grep 1\.99 > /dev/null
  707. if test "$?" = 0 ; then
  708. LIBC="libc1"
  709. fi
  710. fi
  711. rm -f $dummy.c $dummy
  712. echo powerpc-unknown-linux-gnu${LIBC}
  713. exit 0
  714. ;;
  715. esac
  716. if test "${UNAME_MACHINE}" = "alpha" ; then
  717. cat <<EOF >$dummy.s
  718. .data
  719. \$Lformat:
  720. .byte 37,100,45,37,120,10,0 # "%d-%x\n"
  721. .text
  722. .globl main
  723. .align 4
  724. .ent main
  725. main:
  726. .frame \$30,16,\$26,0
  727. ldgp \$29,0(\$27)
  728. .prologue 1
  729. .long 0x47e03d80 # implver \$0
  730. lda \$2,-1
  731. .long 0x47e20c21 # amask \$2,\$1
  732. lda \$16,\$Lformat
  733. mov \$0,\$17
  734. not \$1,\$18
  735. jsr \$26,printf
  736. ldgp \$29,0(\$26)
  737. mov 0,\$16
  738. jsr \$26,exit
  739. .end main
  740. EOF
  741. LIBC=""
  742. $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
  743. if test "$?" = 0 ; then
  744. case `./$dummy` in
  745. 0-0)
  746. UNAME_MACHINE="alpha"
  747. ;;
  748. 1-0)
  749. UNAME_MACHINE="alphaev5"
  750. ;;
  751. 1-1)
  752. UNAME_MACHINE="alphaev56"
  753. ;;
  754. 1-101)
  755. UNAME_MACHINE="alphapca56"
  756. ;;
  757. 2-303)
  758. UNAME_MACHINE="alphaev6"
  759. ;;
  760. 2-307)
  761. UNAME_MACHINE="alphaev67"
  762. ;;
  763. esac
  764. objdump --private-headers $dummy | \
  765. grep ld.so.1 > /dev/null
  766. if test "$?" = 0 ; then
  767. LIBC="libc1"
  768. fi
  769. fi
  770. rm -f $dummy.s $dummy
  771. echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
  772. elif test "${UNAME_MACHINE}" = "mips" ; then
  773. cat >$dummy.c <<EOF
  774. #ifdef __cplusplus
  775. #include <stdio.h> /* for printf() prototype */
  776. int main (int argc, char *argv[]) {
  777. #else
  778. int main (argc, argv) int argc; char *argv[]; {
  779. #endif
  780. #ifdef __MIPSEB__
  781. printf ("%s-unknown-linux-gnu\n", argv[1]);
  782. #endif
  783. #ifdef __MIPSEL__
  784. printf ("%sel-unknown-linux-gnu\n", argv[1]);
  785. #endif
  786. return 0;
  787. }
  788. EOF
  789. $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
  790. rm -f $dummy.c $dummy
  791. elif test "${UNAME_MACHINE}" = "s390"; then
  792. echo s390-ibm-linux && exit 0
  793. else
  794. # Either a pre-BFD a.out linker (linux-gnuoldld)
  795. # or one that does not give us useful --help.
  796. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
  797. # If ld does not provide *any* "supported emulations:"
  798. # that means it is gnuoldld.
  799. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
  800. test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
  801. case "${UNAME_MACHINE}" in
  802. i?86)
  803. VENDOR=pc;
  804. ;;
  805. *)
  806. VENDOR=unknown;
  807. ;;
  808. esac
  809. # Determine whether the default compiler is a.out or elf
  810. cat >$dummy.c <<EOF
  811. #include <features.h>
  812. #ifdef __cplusplus
  813. #include <stdio.h> /* for printf() prototype */
  814. int main (int argc, char *argv[]) {
  815. #else
  816. int main (argc, argv) int argc; char *argv[]; {
  817. #endif
  818. #ifdef __ELF__
  819. # ifdef __GLIBC__
  820. # if __GLIBC__ >= 2
  821. printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
  822. # else
  823. printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
  824. # endif
  825. # else
  826. printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
  827. # endif
  828. #else
  829. printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
  830. #endif
  831. return 0;
  832. }
  833. EOF
  834. $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
  835. rm -f $dummy.c $dummy
  836. fi ;;
  837. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
  838. # are messed up and put the nodename in both sysname and nodename.
  839. i?86:DYNIX/ptx:4*:*)
  840. echo i386-sequent-sysv4
  841. exit 0 ;;
  842. i?86:UNIX_SV:4.2MP:2.*)
  843. # Unixware is an offshoot of SVR4, but it has its own version
  844. # number series starting with 2...
  845. # I am not positive that other SVR4 systems won't match this,
  846. # I just have to hope. -- rms.
  847. # Use sysv4.2uw... so that sysv4* matches it.
  848. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
  849. exit 0 ;;
  850. i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
  851. UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
  852. if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
  853. echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
  854. else
  855. echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
  856. fi
  857. exit 0 ;;
  858. i?86:*:5:7*)
  859. # Fixed at (any) Pentium or better
  860. UNAME_MACHINE=i586
  861. if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
  862. echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
  863. else
  864. echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
  865. fi
  866. exit 0 ;;
  867. i?86:*:3.2:*)
  868. if test -f /usr/options/cb.name; then
  869. UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
  870. echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
  871. elif /bin/uname -X 2>/dev/null >/dev/null ; then
  872. UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  873. (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  874. (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  875. && UNAME_MACHINE=i586
  876. (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
  877. && UNAME_MACHINE=i686
  878. (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
  879. && UNAME_MACHINE=i686
  880. echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
  881. else
  882. echo ${UNAME_MACHINE}-pc-sysv32
  883. fi
  884. exit 0 ;;
  885. i?86:*DOS:*:*)
  886. echo ${UNAME_MACHINE}-pc-msdosdjgpp
  887. exit 0 ;;
  888. pc:*:*:*)
  889. # Left here for compatibility:
  890. # uname -m prints for DJGPP always 'pc', but it prints nothing about
  891. # the processor, so we play safe by assuming i386.
  892. echo i386-pc-msdosdjgpp
  893. exit 0 ;;
  894. Intel:Mach:3*:*)
  895. echo i386-pc-mach3
  896. exit 0 ;;
  897. paragon:*:*:*)
  898. echo i860-intel-osf1
  899. exit 0 ;;
  900. i860:*:4.*:*) # i860-SVR4
  901. if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
  902. echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
  903. else # Add other i860-SVR4 vendors below as they are discovered.
  904. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
  905. fi
  906. exit 0 ;;
  907. mini*:CTIX:SYS*5:*)
  908. # "miniframe"
  909. echo m68010-convergent-sysv
  910. exit 0 ;;
  911. M68*:*:R3V[567]*:*)
  912. test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
  913. 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
  914. OS_REL=''
  915. test -r /etc/.relid \
  916. && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
  917. /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  918. && echo i486-ncr-sysv4.3${OS_REL} && exit 0
  919. /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
  920. && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
  921. 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
  922. /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  923. && echo i486-ncr-sysv4 && exit 0 ;;
  924. m68*:LynxOS:2.*:*)
  925. echo m68k-unknown-lynxos${UNAME_RELEASE}
  926. exit 0 ;;
  927. mc68030:UNIX_System_V:4.*:*)
  928. echo m68k-atari-sysv4
  929. exit 0 ;;
  930. i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
  931. echo i386-unknown-lynxos${UNAME_RELEASE}
  932. exit 0 ;;
  933. TSUNAMI:LynxOS:2.*:*)
  934. echo sparc-unknown-lynxos${UNAME_RELEASE}
  935. exit 0 ;;
  936. rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
  937. echo rs6000-unknown-lynxos${UNAME_RELEASE}
  938. exit 0 ;;
  939. SM[BE]S:UNIX_SV:*:*)
  940. echo mips-dde-sysv${UNAME_RELEASE}
  941. exit 0 ;;
  942. RM*:ReliantUNIX-*:*:*)
  943. echo mips-sni-sysv4
  944. exit 0 ;;
  945. RM*:SINIX-*:*:*)
  946. echo mips-sni-sysv4
  947. exit 0 ;;
  948. *:SINIX-*:*:*)
  949. if uname -p 2>/dev/null >/dev/null ; then
  950. UNAME_MACHINE=`(uname -p) 2>/dev/null`
  951. echo ${UNAME_MACHINE}-sni-sysv4
  952. else
  953. echo ns32k-sni-sysv
  954. fi
  955. exit 0 ;;
  956. PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
  957. # says <Richard.M.Bartel@ccMail.Census.GOV>
  958. echo i586-unisys-sysv4
  959. exit 0 ;;
  960. *:UNIX_System_V:4*:FTX*)
  961. # From Gerald Hewes <hewes@openmarket.com>.
  962. # How about differentiating between stratus architectures? -djm
  963. echo hppa1.1-stratus-sysv4
  964. exit 0 ;;
  965. *:*:*:FTX*)
  966. # From seanf@swdc.stratus.com.
  967. echo i860-stratus-sysv4
  968. exit 0 ;;
  969. mc68*:A/UX:*:*)
  970. echo m68k-apple-aux${UNAME_RELEASE}
  971. exit 0 ;;
  972. news*:NEWS-OS:*:6*)
  973. echo mips-sony-newsos6
  974. exit 0 ;;
  975. R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
  976. if [ -d /usr/nec ]; then
  977. echo mips-nec-sysv${UNAME_RELEASE}
  978. else
  979. echo mips-unknown-sysv${UNAME_RELEASE}
  980. fi
  981. exit 0 ;;
  982. BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
  983. echo powerpc-be-beos
  984. exit 0 ;;
  985. BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
  986. echo powerpc-apple-beos
  987. exit 0 ;;
  988. BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
  989. echo i586-pc-beos
  990. exit 0 ;;
  991. SX-4:SUPER-UX:*:*)
  992. echo sx4-nec-superux${UNAME_RELEASE}
  993. exit 0 ;;
  994. SX-5:SUPER-UX:*:*)
  995. echo sx5-nec-superux${UNAME_RELEASE}
  996. exit 0 ;;
  997. Power*:Rhapsody:*:*)
  998. echo powerpc-apple-rhapsody${UNAME_RELEASE}
  999. exit 0 ;;
  1000. *:Rhapsody:*:*)
  1001. echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
  1002. exit 0 ;;
  1003. *:Darwin:*:*)
  1004. echo `uname -p`-apple-darwin${UNAME_RELEASE}
  1005. exit 0 ;;
  1006. *:procnto*:*:* | *:QNX:[0123456789]*:*)
  1007. if test "${UNAME_MACHINE}" = "x86pc"; then
  1008. UNAME_MACHINE=pc
  1009. fi
  1010. echo `uname -p`-${UNAME_MACHINE}-nto-qnx
  1011. exit 0 ;;
  1012. *:QNX:*:4*)
  1013. echo i386-pc-qnx
  1014. exit 0 ;;
  1015. NSR-W:NONSTOP_KERNEL:*:*)
  1016. echo nsr-tandem-nsk${UNAME_RELEASE}
  1017. exit 0 ;;
  1018. BS2000:POSIX*:*:*)
  1019. echo bs2000-siemens-sysv
  1020. exit 0 ;;
  1021. DS/*:UNIX_System_V:*:*)
  1022. echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
  1023. exit 0 ;;
  1024. esac
  1025. #echo '(No uname command or uname output not recognized.)' 1>&2
  1026. #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
  1027. cat >$dummy.c <<EOF
  1028. #ifdef _SEQUENT_
  1029. # include <sys/types.h>
  1030. # include <sys/utsname.h>
  1031. #endif
  1032. main ()
  1033. {
  1034. #if defined (sony)
  1035. #if defined (MIPSEB)
  1036. /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
  1037. I don't know.... */
  1038. printf ("mips-sony-bsd\n"); exit (0);
  1039. #else
  1040. #include <sys/param.h>
  1041. printf ("m68k-sony-newsos%s\n",
  1042. #ifdef NEWSOS4
  1043. "4"
  1044. #else
  1045. ""
  1046. #endif
  1047. ); exit (0);
  1048. #endif
  1049. #endif
  1050. #if defined (__arm) && defined (__acorn) && defined (__unix)
  1051. printf ("arm-acorn-riscix"); exit (0);
  1052. #endif
  1053. #if defined (hp300) && !defined (hpux)
  1054. printf ("m68k-hp-bsd\n"); exit (0);
  1055. #endif
  1056. #if defined (NeXT)
  1057. #if !defined (__ARCHITECTURE__)
  1058. #define __ARCHITECTURE__ "m68k"
  1059. #endif
  1060. int version;
  1061. version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  1062. if (version < 4)
  1063. printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  1064. else
  1065. printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
  1066. exit (0);
  1067. #endif
  1068. #if defined (MULTIMAX) || defined (n16)
  1069. #if defined (UMAXV)
  1070. printf ("ns32k-encore-sysv\n"); exit (0);
  1071. #else
  1072. #if defined (CMU)
  1073. printf ("ns32k-encore-mach\n"); exit (0);
  1074. #else
  1075. printf ("ns32k-encore-bsd\n"); exit (0);
  1076. #endif
  1077. #endif
  1078. #endif
  1079. #if defined (__386BSD__)
  1080. printf ("i386-pc-bsd\n"); exit (0);
  1081. #endif
  1082. #if defined (sequent)
  1083. #if defined (i386)
  1084. printf ("i386-sequent-dynix\n"); exit (0);
  1085. #endif
  1086. #if defined (ns32000)
  1087. printf ("ns32k-sequent-dynix\n"); exit (0);
  1088. #endif
  1089. #endif
  1090. #if defined (_SEQUENT_)
  1091. struct utsname un;
  1092. uname(&un);
  1093. if (strncmp(un.version, "V2", 2) == 0) {
  1094. printf ("i386-sequent-ptx2\n"); exit (0);
  1095. }
  1096. if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
  1097. printf ("i386-sequent-ptx1\n"); exit (0);
  1098. }
  1099. printf ("i386-sequent-ptx\n"); exit (0);
  1100. #endif
  1101. #if defined (vax)
  1102. #if !defined (ultrix)
  1103. printf ("vax-dec-bsd\n"); exit (0);
  1104. #else
  1105. printf ("vax-dec-ultrix\n"); exit (0);
  1106. #endif
  1107. #endif
  1108. #if defined (alliant) && defined (i860)
  1109. printf ("i860-alliant-bsd\n"); exit (0);
  1110. #endif
  1111. exit (1);
  1112. }
  1113. EOF
  1114. $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
  1115. rm -f $dummy.c $dummy
  1116. # Apollos put the system type in the environment.
  1117. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
  1118. # Convex versions that predate uname can use getsysinfo(1)
  1119. if [ -x /usr/convex/getsysinfo ]
  1120. then
  1121. case `getsysinfo -f cpu_type` in
  1122. c1*)
  1123. echo c1-convex-bsd
  1124. exit 0 ;;
  1125. c2*)
  1126. if getsysinfo -f scalar_acc
  1127. then echo c32-convex-bsd
  1128. else echo c2-convex-bsd
  1129. fi
  1130. exit 0 ;;
  1131. c34*)
  1132. echo c34-convex-bsd
  1133. exit 0 ;;
  1134. c38*)
  1135. echo c38-convex-bsd
  1136. exit 0 ;;
  1137. c4*)
  1138. echo c4-convex-bsd
  1139. exit 0 ;;
  1140. esac
  1141. fi
  1142. #echo '(Unable to guess system type)' 1>&2
  1143. exit 1