config.guess 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. #! /bin/sh
  2. # Attempt to guess a canonical system name.
  3. # Copyright (C) 1992, 93, 94, 95, 96, 1997 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 <[email protected]>.
  24. # The master version of this file is at the FSF in /home/gd/gnu/lib.
  25. #
  26. # This script attempts to guess a canonical system name similar to
  27. # config.sub. If it succeeds, it prints the system name on stdout, and
  28. # exits with 0. Otherwise, it exits with 1.
  29. #
  30. # The plan is that this can be called by configure scripts if you
  31. # don't specify an explicit system type (host/target name).
  32. #
  33. # Only a few systems have been added to this list; please add others
  34. # (but try to keep the structure clean).
  35. #
  36. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
  37. # ([email protected] 8/24/94.)
  38. if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
  39. PATH=$PATH:/.attbin ; export PATH
  40. fi
  41. UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
  42. UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
  43. UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
  44. UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
  45. trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
  46. # Note: order is significant - the case branches are not exclusive.
  47. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
  48. alpha:OSF1:*:*)
  49. if test $UNAME_RELEASE = "V4.0"; then
  50. UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
  51. fi
  52. # A Vn.n version is a released version.
  53. # A Tn.n version is a released field test version.
  54. # A Xn.n version is an unreleased experimental baselevel.
  55. # 1.2 uses "1.2" for uname -r.
  56. cat <<EOF >dummy.s
  57. .globl main
  58. .ent main
  59. main:
  60. .frame \$30,0,\$26,0
  61. .prologue 0
  62. .long 0x47e03d80 # implver $0
  63. lda \$2,259
  64. .long 0x47e20c21 # amask $2,$1
  65. srl \$1,8,\$2
  66. sll \$2,2,\$2
  67. sll \$0,3,\$0
  68. addl \$1,\$0,\$0
  69. addl \$2,\$0,\$0
  70. ret \$31,(\$26),1
  71. .end main
  72. EOF
  73. ${CC-cc} dummy.s -o dummy 2>/dev/null
  74. if test "$?" = 0 ; then
  75. ./dummy
  76. case "$?" in
  77. 7)
  78. UNAME_MACHINE="alpha"
  79. ;;
  80. 15)
  81. UNAME_MACHINE="alphaev5"
  82. ;;
  83. 14)
  84. UNAME_MACHINE="alphaev56"
  85. ;;
  86. 10)
  87. UNAME_MACHINE="alphapca56"
  88. ;;
  89. 16)
  90. UNAME_MACHINE="alphaev6"
  91. ;;
  92. esac
  93. fi
  94. rm -f dummy.s dummy
  95. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
  96. exit 0 ;;
  97. 21064:Windows_NT:50:3)
  98. echo alpha-dec-winnt3.5
  99. exit 0 ;;
  100. Amiga*:UNIX_System_V:4.0:*)
  101. echo m68k-cbm-sysv4
  102. exit 0;;
  103. amiga:NetBSD:*:*)
  104. echo m68k-cbm-netbsd${UNAME_RELEASE}
  105. exit 0 ;;
  106. amiga:OpenBSD:*:*)
  107. echo m68k-unknown-openbsd${UNAME_RELEASE}
  108. exit 0 ;;
  109. arc64:OpenBSD:*:*)
  110. echo mips64el-unknown-openbsd${UNAME_RELEASE}
  111. exit 0 ;;
  112. arc:OpenBSD:*:*)
  113. echo mipsel-unknown-openbsd${UNAME_RELEASE}
  114. exit 0 ;;
  115. hkmips:OpenBSD:*:*)
  116. echo mips-unknown-openbsd${UNAME_RELEASE}
  117. exit 0 ;;
  118. pmax:OpenBSD:*:*)
  119. echo mipsel-unknown-openbsd${UNAME_RELEASE}
  120. exit 0 ;;
  121. sgi:OpenBSD:*:*)
  122. echo mips-unknown-openbsd${UNAME_RELEASE}
  123. exit 0 ;;
  124. wgrisc:OpenBSD:*:*)
  125. echo mipsel-unknown-openbsd${UNAME_RELEASE}
  126. exit 0 ;;
  127. arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  128. echo arm-acorn-riscix${UNAME_RELEASE}
  129. exit 0;;
  130. arm32:NetBSD:*:*)
  131. echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  132. exit 0 ;;
  133. SR2?01:HI-UX/MPP:*:*)
  134. echo hppa1.1-hitachi-hiuxmpp
  135. exit 0;;
  136. Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
  137. # [email protected] (Earle F. Ake) contributed MIS and NILE.
  138. if test "`(/bin/universe) 2>/dev/null`" = att ; then
  139. echo pyramid-pyramid-sysv3
  140. else
  141. echo pyramid-pyramid-bsd
  142. fi
  143. exit 0 ;;
  144. NILE:*:*:dcosx)
  145. echo pyramid-pyramid-svr4
  146. exit 0 ;;
  147. sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
  148. echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  149. exit 0 ;;
  150. i86pc:SunOS:5.*:*)
  151. echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  152. exit 0 ;;
  153. sun4*:SunOS:6*:*)
  154. # According to config.sub, this is the proper way to canonicalize
  155. # SunOS6. Hard to guess exactly what SunOS6 will be like, but
  156. # it's likely to be more like Solaris than SunOS4.
  157. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  158. exit 0 ;;
  159. sun4*:SunOS:*:*)
  160. case "`/usr/bin/arch -k`" in
  161. Series*|S4*)
  162. UNAME_RELEASE=`uname -v`
  163. ;;
  164. esac
  165. # Japanese Language versions have a version number like `4.1.3-JL'.
  166. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
  167. exit 0 ;;
  168. sun3*:SunOS:*:*)
  169. echo m68k-sun-sunos${UNAME_RELEASE}
  170. exit 0 ;;
  171. sun*:*:4.2BSD:*)
  172. UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
  173. test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
  174. case "`/bin/arch`" in
  175. sun3)
  176. echo m68k-sun-sunos${UNAME_RELEASE}
  177. ;;
  178. sun4)
  179. echo sparc-sun-sunos${UNAME_RELEASE}
  180. ;;
  181. esac
  182. exit 0 ;;
  183. aushp:SunOS:*:*)
  184. echo sparc-auspex-sunos${UNAME_RELEASE}
  185. exit 0 ;;
  186. atari*:NetBSD:*:*)
  187. echo m68k-atari-netbsd${UNAME_RELEASE}
  188. exit 0 ;;
  189. atari*:OpenBSD:*:*)
  190. echo m68k-unknown-openbsd${UNAME_RELEASE}
  191. exit 0 ;;
  192. sun3*:NetBSD:*:*)
  193. echo m68k-sun-netbsd${UNAME_RELEASE}
  194. exit 0 ;;
  195. sun3*:OpenBSD:*:*)
  196. echo m68k-unknown-openbsd${UNAME_RELEASE}
  197. exit 0 ;;
  198. mac68k:NetBSD:*:*)
  199. echo m68k-apple-netbsd${UNAME_RELEASE}
  200. exit 0 ;;
  201. mac68k:OpenBSD:*:*)
  202. echo m68k-unknown-openbsd${UNAME_RELEASE}
  203. exit 0 ;;
  204. mvme68k:OpenBSD:*:*)
  205. echo m68k-unknown-openbsd${UNAME_RELEASE}
  206. exit 0 ;;
  207. mvme88k:OpenBSD:*:*)
  208. echo m88k-unknown-openbsd${UNAME_RELEASE}
  209. exit 0 ;;
  210. powerpc:machten:*:*)
  211. echo powerpc-apple-machten${UNAME_RELEASE}
  212. exit 0 ;;
  213. RISC*:Mach:*:*)
  214. echo mips-dec-mach_bsd4.3
  215. exit 0 ;;
  216. RISC*:ULTRIX:*:*)
  217. echo mips-dec-ultrix${UNAME_RELEASE}
  218. exit 0 ;;
  219. VAX*:ULTRIX*:*:*)
  220. echo vax-dec-ultrix${UNAME_RELEASE}
  221. exit 0 ;;
  222. 2020:CLIX:*:*)
  223. echo clipper-intergraph-clix${UNAME_RELEASE}
  224. exit 0 ;;
  225. mips:*:*:UMIPS | mips:*:*:RISCos)
  226. sed 's/^ //' << EOF >dummy.c
  227. int main (argc, argv) int argc; char **argv; {
  228. #if defined (host_mips) && defined (MIPSEB)
  229. #if defined (SYSTYPE_SYSV)
  230. printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
  231. #endif
  232. #if defined (SYSTYPE_SVR4)
  233. printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
  234. #endif
  235. #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
  236. printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
  237. #endif
  238. #endif
  239. exit (-1);
  240. }
  241. EOF
  242. ${CC-cc} dummy.c -o dummy \
  243. && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
  244. && rm dummy.c dummy && exit 0
  245. rm -f dummy.c dummy
  246. echo mips-mips-riscos${UNAME_RELEASE}
  247. exit 0 ;;
  248. Night_Hawk:Power_UNIX:*:*)
  249. echo powerpc-harris-powerunix
  250. exit 0 ;;
  251. m88k:CX/UX:7*:*)
  252. echo m88k-harris-cxux7
  253. exit 0 ;;
  254. m88k:*:4*:R4*)
  255. echo m88k-motorola-sysv4
  256. exit 0 ;;
  257. m88k:*:3*:R3*)
  258. echo m88k-motorola-sysv3
  259. exit 0 ;;
  260. AViiON:dgux:*:*)
  261. # DG/UX returns AViiON for all architectures
  262. UNAME_PROCESSOR=`/usr/bin/uname -p`
  263. if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
  264. if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
  265. -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
  266. echo m88k-dg-dgux${UNAME_RELEASE}
  267. else
  268. echo m88k-dg-dguxbcs${UNAME_RELEASE}
  269. fi
  270. else echo i586-dg-dgux${UNAME_RELEASE}
  271. fi
  272. exit 0 ;;
  273. M88*:DolphinOS:*:*) # DolphinOS (SVR3)
  274. echo m88k-dolphin-sysv3
  275. exit 0 ;;
  276. M88*:*:R3*:*)
  277. # Delta 88k system running SVR3
  278. echo m88k-motorola-sysv3
  279. exit 0 ;;
  280. XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
  281. echo m88k-tektronix-sysv3
  282. exit 0 ;;
  283. Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
  284. echo m68k-tektronix-bsd
  285. exit 0 ;;
  286. *:IRIX*:*:*)
  287. echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
  288. exit 0 ;;
  289. ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
  290. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
  291. exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
  292. i?86:AIX:*:*)
  293. echo i386-ibm-aix
  294. exit 0 ;;
  295. *:AIX:2:3)
  296. if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
  297. sed 's/^ //' << EOF >dummy.c
  298. #include <sys/systemcfg.h>
  299. main()
  300. {
  301. if (!__power_pc())
  302. exit(1);
  303. puts("powerpc-ibm-aix3.2.5");
  304. exit(0);
  305. }
  306. EOF
  307. ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
  308. rm -f dummy.c dummy
  309. echo rs6000-ibm-aix3.2.5
  310. elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
  311. echo rs6000-ibm-aix3.2.4
  312. else
  313. echo rs6000-ibm-aix3.2
  314. fi
  315. exit 0 ;;
  316. *:AIX:*:4)
  317. if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
  318. IBM_ARCH=rs6000
  319. else
  320. IBM_ARCH=powerpc
  321. fi
  322. if [ -x /usr/bin/oslevel ] ; then
  323. IBM_REV=`/usr/bin/oslevel`
  324. else
  325. IBM_REV=4.${UNAME_RELEASE}
  326. fi
  327. echo ${IBM_ARCH}-ibm-aix${IBM_REV}
  328. exit 0 ;;
  329. *:AIX:*:*)
  330. echo rs6000-ibm-aix
  331. exit 0 ;;
  332. ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  333. echo romp-ibm-bsd4.4
  334. exit 0 ;;
  335. ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
  336. echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
  337. exit 0 ;; # report: romp-ibm BSD 4.3
  338. *:BOSX:*:*)
  339. echo rs6000-bull-bosx
  340. exit 0 ;;
  341. DPX/2?00:B.O.S.:*:*)
  342. echo m68k-bull-sysv3
  343. exit 0 ;;
  344. 9000/[34]??:4.3bsd:1.*:*)
  345. echo m68k-hp-bsd
  346. exit 0 ;;
  347. hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
  348. echo m68k-hp-bsd4.4
  349. exit 0 ;;
  350. 9000/[3478]??:HP-UX:*:*)
  351. case "${UNAME_MACHINE}" in
  352. 9000/31? ) HP_ARCH=m68000 ;;
  353. 9000/[34]?? ) HP_ARCH=m68k ;;
  354. 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
  355. 9000/8?? ) HP_ARCH=hppa1.0 ;;
  356. esac
  357. HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  358. echo ${HP_ARCH}-hp-hpux${HPUX_REV}
  359. exit 0 ;;
  360. 3050*:HI-UX:*:*)
  361. sed 's/^ //' << EOF >dummy.c
  362. #include <unistd.h>
  363. int
  364. main ()
  365. {
  366. long cpu = sysconf (_SC_CPU_VERSION);
  367. /* The order matters, because CPU_IS_HP_MC68K erroneously returns
  368. true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
  369. results, however. */
  370. if (CPU_IS_PA_RISC (cpu))
  371. {
  372. switch (cpu)
  373. {
  374. case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
  375. case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
  376. case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
  377. default: puts ("hppa-hitachi-hiuxwe2"); break;
  378. }
  379. }
  380. else if (CPU_IS_HP_MC68K (cpu))
  381. puts ("m68k-hitachi-hiuxwe2");
  382. else puts ("unknown-hitachi-hiuxwe2");
  383. exit (0);
  384. }
  385. EOF
  386. ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
  387. rm -f dummy.c dummy
  388. echo unknown-hitachi-hiuxwe2
  389. exit 0 ;;
  390. 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
  391. echo hppa1.1-hp-bsd
  392. exit 0 ;;
  393. 9000/8??:4.3bsd:*:*)
  394. echo hppa1.0-hp-bsd
  395. exit 0 ;;
  396. hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
  397. echo hppa1.1-hp-osf
  398. exit 0 ;;
  399. hp8??:OSF1:*:*)
  400. echo hppa1.0-hp-osf
  401. exit 0 ;;
  402. i?86:OSF1:*:*)
  403. if [ -x /usr/sbin/sysversion ] ; then
  404. echo ${UNAME_MACHINE}-unknown-osf1mk
  405. else
  406. echo ${UNAME_MACHINE}-unknown-osf1
  407. fi
  408. exit 0 ;;
  409. parisc*:Lites*:*:*)
  410. echo hppa1.1-hp-lites
  411. exit 0 ;;
  412. C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
  413. echo c1-convex-bsd
  414. exit 0 ;;
  415. C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
  416. if getsysinfo -f scalar_acc
  417. then echo c32-convex-bsd
  418. else echo c2-convex-bsd
  419. fi
  420. exit 0 ;;
  421. C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
  422. echo c34-convex-bsd
  423. exit 0 ;;
  424. C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
  425. echo c38-convex-bsd
  426. exit 0 ;;
  427. C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
  428. echo c4-convex-bsd
  429. exit 0 ;;
  430. CRAY*X-MP:*:*:*)
  431. echo xmp-cray-unicos
  432. exit 0 ;;
  433. CRAY*Y-MP:*:*:*)
  434. echo ymp-cray-unicos${UNAME_RELEASE}
  435. exit 0 ;;
  436. CRAY*[A-Z]90:*:*:*)
  437. echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
  438. | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
  439. -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
  440. exit 0 ;;
  441. CRAY*TS:*:*:*)
  442. echo t90-cray-unicos${UNAME_RELEASE}
  443. exit 0 ;;
  444. CRAY-2:*:*:*)
  445. echo cray2-cray-unicos
  446. exit 0 ;;
  447. F300:UNIX_System_V:*:*)
  448. FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
  449. FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
  450. echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
  451. exit 0 ;;
  452. F301:UNIX_System_V:*:*)
  453. echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
  454. exit 0 ;;
  455. hp3[0-9][05]:NetBSD:*:*)
  456. echo m68k-hp-netbsd${UNAME_RELEASE}
  457. exit 0 ;;
  458. hp300:OpenBSD:*:*)
  459. echo m68k-unknown-openbsd${UNAME_RELEASE}
  460. exit 0 ;;
  461. i?86:BSD/386:*:* | *:BSD/OS:*:*)
  462. echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
  463. exit 0 ;;
  464. *:FreeBSD:*:*)
  465. echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
  466. exit 0 ;;
  467. *:NetBSD:*:*)
  468. echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  469. exit 0 ;;
  470. *:OpenBSD:*:*)
  471. echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  472. exit 0 ;;
  473. i*:CYGWIN*:*)
  474. echo i386-pc-cygwin32
  475. exit 0 ;;
  476. i*:MINGW*:*)
  477. echo i386-pc-mingw32
  478. exit 0 ;;
  479. p*:CYGWIN*:*)
  480. echo powerpcle-unknown-cygwin32
  481. exit 0 ;;
  482. prep*:SunOS:5.*:*)
  483. echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  484. exit 0 ;;
  485. *:GNU:*:*)
  486. echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
  487. exit 0 ;;
  488. *:Linux:*:*)
  489. # The BFD linker knows what the default object file format is, so
  490. # first see if it will tell us.
  491. ld_help_string=`ld --help 2>&1`
  492. ld_supported_emulations=`echo $ld_help_string \
  493. | sed -ne '/supported emulations:/!d
  494. s/[ ][ ]*/ /g
  495. s/.*supported emulations: *//
  496. s/ .*//
  497. p'`
  498. case "$ld_supported_emulations" in
  499. i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
  500. i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
  501. sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
  502. m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
  503. elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
  504. esac
  505. if test "${UNAME_MACHINE}" = "alpha" ; then
  506. sed 's/^ //' <<EOF >dummy.s
  507. .globl main
  508. .ent main
  509. main:
  510. .frame \$30,0,\$26,0
  511. .prologue 0
  512. .long 0x47e03d80 # implver $0
  513. lda \$2,259
  514. .long 0x47e20c21 # amask $2,$1
  515. srl \$1,8,\$2
  516. sll \$2,2,\$2
  517. sll \$0,3,\$0
  518. addl \$1,\$0,\$0
  519. addl \$2,\$0,\$0
  520. ret \$31,(\$26),1
  521. .end main
  522. EOF
  523. LIBC=""
  524. ${CC-cc} dummy.s -o dummy 2>/dev/null
  525. if test "$?" = 0 ; then
  526. ./dummy
  527. case "$?" in
  528. 7)
  529. UNAME_MACHINE="alpha"
  530. ;;
  531. 15)
  532. UNAME_MACHINE="alphaev5"
  533. ;;
  534. 14)
  535. UNAME_MACHINE="alphaev56"
  536. ;;
  537. 10)
  538. UNAME_MACHINE="alphapca56"
  539. ;;
  540. 16)
  541. UNAME_MACHINE="alphaev6"
  542. ;;
  543. esac
  544. objdump --private-headers dummy | \
  545. grep ld.so.1 > /dev/null
  546. if test "$?" = 0 ; then
  547. LIBC="libc1"
  548. fi
  549. fi
  550. rm -f dummy.s dummy
  551. echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
  552. elif test "${UNAME_MACHINE}" = "mips" ; then
  553. cat >dummy.c <<EOF
  554. main(argc, argv)
  555. int argc;
  556. char *argv[];
  557. {
  558. #ifdef __MIPSEB__
  559. printf ("%s-unknown-linux-gnu\n", argv[1]);
  560. #endif
  561. #ifdef __MIPSEL__
  562. printf ("%sel-unknown-linux-gnu\n", argv[1]);
  563. #endif
  564. return 0;
  565. }
  566. EOF
  567. ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
  568. rm -f dummy.c dummy
  569. else
  570. # Either a pre-BFD a.out linker (linux-gnuoldld)
  571. # or one that does not give us useful --help.
  572. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
  573. # If ld does not provide *any* "supported emulations:"
  574. # that means it is gnuoldld.
  575. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
  576. test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
  577. case "${UNAME_MACHINE}" in
  578. i?86)
  579. VENDOR=pc;
  580. ;;
  581. *)
  582. VENDOR=unknown;
  583. ;;
  584. esac
  585. # Determine whether the default compiler is a.out or elf
  586. cat >dummy.c <<EOF
  587. #include <features.h>
  588. main(argc, argv)
  589. int argc;
  590. char *argv[];
  591. {
  592. #ifdef __ELF__
  593. # ifdef __GLIBC__
  594. # if __GLIBC__ >= 2
  595. printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
  596. # else
  597. printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
  598. # endif
  599. # else
  600. printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
  601. # endif
  602. #else
  603. printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
  604. #endif
  605. return 0;
  606. }
  607. EOF
  608. ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
  609. rm -f dummy.c dummy
  610. fi ;;
  611. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
  612. # are messed up and put the nodename in both sysname and nodename.
  613. i?86:DYNIX/ptx:4*:*)
  614. echo i386-sequent-sysv4
  615. exit 0 ;;
  616. i?86:UNIX_SV:4.2MP:2.*)
  617. # Unixware is an offshoot of SVR4, but it has its own version
  618. # number series starting with 2...
  619. # I am not positive that other SVR4 systems won't match this,
  620. # I just have to hope. -- rms.
  621. # Use sysv4.2uw... so that sysv4* matches it.
  622. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
  623. exit 0 ;;
  624. i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
  625. if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
  626. echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
  627. else
  628. echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
  629. fi
  630. exit 0 ;;
  631. i?86:*:3.2:*)
  632. if test -f /usr/options/cb.name; then
  633. UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
  634. echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
  635. elif /bin/uname -X 2>/dev/null >/dev/null ; then
  636. UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  637. (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  638. (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  639. && UNAME_MACHINE=i586
  640. echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
  641. else
  642. echo ${UNAME_MACHINE}-pc-sysv32
  643. fi
  644. exit 0 ;;
  645. pc:*:*:*)
  646. # uname -m prints for DJGPP always 'pc', but it prints nothing about
  647. # the processor, so we play safe by assuming i386.
  648. echo i386-pc-msdosdjgpp
  649. exit 0 ;;
  650. Intel:Mach:3*:*)
  651. echo i386-pc-mach3
  652. exit 0 ;;
  653. paragon:*:*:*)
  654. echo i860-intel-osf1
  655. exit 0 ;;
  656. i860:*:4.*:*) # i860-SVR4
  657. if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
  658. echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
  659. else # Add other i860-SVR4 vendors below as they are discovered.
  660. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
  661. fi
  662. exit 0 ;;
  663. mini*:CTIX:SYS*5:*)
  664. # "miniframe"
  665. echo m68010-convergent-sysv
  666. exit 0 ;;
  667. M68*:*:R3V[567]*:*)
  668. test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
  669. 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
  670. OS_REL=''
  671. test -r /etc/.relid \
  672. && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
  673. /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  674. && echo i486-ncr-sysv4.3${OS_REL} && exit 0
  675. /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
  676. && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
  677. 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
  678. /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  679. && echo i486-ncr-sysv4 && exit 0 ;;
  680. m68*:LynxOS:2.*:*)
  681. echo m68k-unknown-lynxos${UNAME_RELEASE}
  682. exit 0 ;;
  683. mc68030:UNIX_System_V:4.*:*)
  684. echo m68k-atari-sysv4
  685. exit 0 ;;
  686. i?86:LynxOS:2.*:*)
  687. echo i386-unknown-lynxos${UNAME_RELEASE}
  688. exit 0 ;;
  689. TSUNAMI:LynxOS:2.*:*)
  690. echo sparc-unknown-lynxos${UNAME_RELEASE}
  691. exit 0 ;;
  692. rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
  693. echo rs6000-unknown-lynxos${UNAME_RELEASE}
  694. exit 0 ;;
  695. SM[BE]S:UNIX_SV:*:*)
  696. echo mips-dde-sysv${UNAME_RELEASE}
  697. exit 0 ;;
  698. RM*:SINIX-*:*:*)
  699. echo mips-sni-sysv4
  700. exit 0 ;;
  701. *:SINIX-*:*:*)
  702. if uname -p 2>/dev/null >/dev/null ; then
  703. UNAME_MACHINE=`(uname -p) 2>/dev/null`
  704. echo ${UNAME_MACHINE}-sni-sysv4
  705. else
  706. echo ns32k-sni-sysv
  707. fi
  708. exit 0 ;;
  709. PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
  710. # says <[email protected]>
  711. echo i586-unisys-sysv4
  712. exit 0 ;;
  713. *:UNIX_System_V:4*:FTX*)
  714. # From Gerald Hewes <[email protected]>.
  715. # How about differentiating between stratus architectures? -djm
  716. echo hppa1.1-stratus-sysv4
  717. exit 0 ;;
  718. *:*:*:FTX*)
  719. # From [email protected].
  720. echo i860-stratus-sysv4
  721. exit 0 ;;
  722. mc68*:A/UX:*:*)
  723. echo m68k-apple-aux${UNAME_RELEASE}
  724. exit 0 ;;
  725. news*:NEWS-OS:*:6*)
  726. echo mips-sony-newsos6
  727. exit 0 ;;
  728. R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
  729. if [ -d /usr/nec ]; then
  730. echo mips-nec-sysv${UNAME_RELEASE}
  731. else
  732. echo mips-unknown-sysv${UNAME_RELEASE}
  733. fi
  734. exit 0 ;;
  735. esac
  736. #echo '(No uname command or uname output not recognized.)' 1>&2
  737. #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
  738. cat >dummy.c <<EOF
  739. #ifdef _SEQUENT_
  740. # include <sys/types.h>
  741. # include <sys/utsname.h>
  742. #endif
  743. main ()
  744. {
  745. #if defined (sony)
  746. #if defined (MIPSEB)
  747. /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
  748. I don't know.... */
  749. printf ("mips-sony-bsd\n"); exit (0);
  750. #else
  751. #include <sys/param.h>
  752. printf ("m68k-sony-newsos%s\n",
  753. #ifdef NEWSOS4
  754. "4"
  755. #else
  756. ""
  757. #endif
  758. ); exit (0);
  759. #endif
  760. #endif
  761. #if defined (__arm) && defined (__acorn) && defined (__unix)
  762. printf ("arm-acorn-riscix"); exit (0);
  763. #endif
  764. #if defined (hp300) && !defined (hpux)
  765. printf ("m68k-hp-bsd\n"); exit (0);
  766. #endif
  767. #if defined (NeXT)
  768. #if !defined (__ARCHITECTURE__)
  769. #define __ARCHITECTURE__ "m68k"
  770. #endif
  771. int version;
  772. version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  773. printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  774. exit (0);
  775. #endif
  776. #if defined (MULTIMAX) || defined (n16)
  777. #if defined (UMAXV)
  778. printf ("ns32k-encore-sysv\n"); exit (0);
  779. #else
  780. #if defined (CMU)
  781. printf ("ns32k-encore-mach\n"); exit (0);
  782. #else
  783. printf ("ns32k-encore-bsd\n"); exit (0);
  784. #endif
  785. #endif
  786. #endif
  787. #if defined (__386BSD__)
  788. printf ("i386-pc-bsd\n"); exit (0);
  789. #endif
  790. #if defined (sequent)
  791. #if defined (i386)
  792. printf ("i386-sequent-dynix\n"); exit (0);
  793. #endif
  794. #if defined (ns32000)
  795. printf ("ns32k-sequent-dynix\n"); exit (0);
  796. #endif
  797. #endif
  798. #if defined (_SEQUENT_)
  799. struct utsname un;
  800. uname(&un);
  801. if (strncmp(un.version, "V2", 2) == 0) {
  802. printf ("i386-sequent-ptx2\n"); exit (0);
  803. }
  804. if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
  805. printf ("i386-sequent-ptx1\n"); exit (0);
  806. }
  807. printf ("i386-sequent-ptx\n"); exit (0);
  808. #endif
  809. #if defined (vax)
  810. #if !defined (ultrix)
  811. printf ("vax-dec-bsd\n"); exit (0);
  812. #else
  813. printf ("vax-dec-ultrix\n"); exit (0);
  814. #endif
  815. #endif
  816. #if defined (alliant) && defined (i860)
  817. printf ("i860-alliant-bsd\n"); exit (0);
  818. #endif
  819. exit (1);
  820. }
  821. EOF
  822. ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
  823. rm -f dummy.c dummy
  824. # Apollos put the system type in the environment.
  825. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
  826. # Convex versions that predate uname can use getsysinfo(1)
  827. if [ -x /usr/convex/getsysinfo ]
  828. then
  829. case `getsysinfo -f cpu_type` in
  830. c1*)
  831. echo c1-convex-bsd
  832. exit 0 ;;
  833. c2*)
  834. if getsysinfo -f scalar_acc
  835. then echo c32-convex-bsd
  836. else echo c2-convex-bsd
  837. fi
  838. exit 0 ;;
  839. c34*)
  840. echo c34-convex-bsd
  841. exit 0 ;;
  842. c38*)
  843. echo c38-convex-bsd
  844. exit 0 ;;
  845. c4*)
  846. echo c4-convex-bsd
  847. exit 0 ;;
  848. esac
  849. fi
  850. #echo '(Unable to guess system type)' 1>&2
  851. exit 1