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.

1050 lines
29 KiB

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