nsarch 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851
  1. #! /bin/sh
  2. #
  3. # BEGIN COPYRIGHT BLOCK
  4. # This Program is free software; you can redistribute it and/or modify it under
  5. # the terms of the GNU General Public License as published by the Free Software
  6. # Foundation; version 2 of the License.
  7. #
  8. # This Program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  14. # Place, Suite 330, Boston, MA 02111-1307 USA.
  15. #
  16. # In addition, as a special exception, Red Hat, Inc. gives You the additional
  17. # right to link the code of this Program with code not covered under the GNU
  18. # General Public License ("Non-GPL Code") and to distribute linked combinations
  19. # including the two, subject to the limitations in this paragraph. Non-GPL Code
  20. # permitted under this exception must only link to the code of this Program
  21. # through those well defined interfaces identified in the file named EXCEPTION
  22. # found in the source code files (the "Approved Interfaces"). The files of
  23. # Non-GPL Code may instantiate templates or use macros or inline functions from
  24. # the Approved Interfaces without causing the resulting work to be covered by
  25. # the GNU General Public License. Only Red Hat, Inc. may make changes or
  26. # additions to the list of Approved Interfaces. You must obey the GNU General
  27. # Public License in all respects for all of the Program code and other code used
  28. # in conjunction with the Program except the Non-GPL Code covered by this
  29. # exception. If you modify this file, you may extend this exception to your
  30. # version of the file, but you are not obligated to do so. If you do not wish to
  31. # provide this exception without modification, you must delete this exception
  32. # statement from your version and license this file solely under the GPL without
  33. # exception.
  34. #
  35. #
  36. # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  37. # Copyright (C) 2005 Red Hat, Inc.
  38. # All rights reserved.
  39. # END COPYRIGHT BLOCK
  40. #
  41. #
  42. # Name: nsarch
  43. #
  44. # Description: this file determines the system name and outputs the
  45. # platform information in a format used by build
  46. # scripts and utilities; this file is based on the GNU
  47. # "config.guess" utility; the GNU copyleft is provided
  48. # somewhere below...
  49. #
  50. # We need to provide the following definitions:
  51. #
  52. # Variable Description
  53. # -------- -----------
  54. # NS_NAME: one word, all upper case system name usually from uname -s that
  55. # can be used for Makefiles and #defines
  56. #
  57. # NS_RELEASE: release number of the OS; if there's a trademark name (like UnixWare),
  58. # then this is typically the release number of the marketing name
  59. # (like UnixWare 2.1) rather than the version of generic Unix it is
  60. # based on (like System V r4.2)
  61. # this number comes generally from uname -r, but on some systems
  62. # we need to use uname -v
  63. #
  64. # NS_PRETTY_NAME: one word, mixed case system name similar to NS_NAME, but useful
  65. # for scripts that output something for users to see
  66. #--------------------------------------------------------------------------
  67. # GNU's copyleft for "configure.guess"
  68. #
  69. # Attempt to guess a canonical system name.
  70. # Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
  71. #
  72. # This file is free software; you can redistribute it and/or modify it
  73. # under the terms of the GNU General Public License as published by
  74. # the Free Software Foundation; either version 2 of the License, or
  75. # (at your option) any later version.
  76. #
  77. # This program is distributed in the hope that it will be useful, but
  78. # WITHOUT ANY WARRANTY; without even the implied warranty of
  79. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  80. # General Public License for more details.
  81. #
  82. # You should have received a copy of the GNU General Public License
  83. # along with this program; if not, write to the Free Software
  84. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  85. #
  86. # As a special exception to the GNU General Public License, if you
  87. # distribute this file as part of a program that contains a
  88. # configuration script generated by Autoconf, you may include it under
  89. # the same distribution terms that you use for the rest of that program.
  90. # Written by Per Bothner <[email protected]>.
  91. # The master version of this file is at the FSF in /home/gd/gnu/lib.
  92. #
  93. # This script attempts to guess a canonical system name similar to
  94. # config.sub. If it succeeds, it prints the system name on stdout, and
  95. # exits with 0. Otherwise, it exits with 1.
  96. #
  97. # The plan is that this can be called by configure scripts if you
  98. # don't specify an explicit system type (host/target name).
  99. #
  100. # Only a few systems have been added to this list; please add others
  101. # (but try to keep the structure clean).
  102. #
  103. #--------------------------------------------------------------------------
  104. # shell functions
  105. output_format='standard'
  106. divider=''
  107. pretty=0
  108. usage(){
  109. echo "Usage: $0 [ [-full {-under | -dash | -none} {-pretty} ] | -gnu ]"
  110. echo
  111. echo " <no args> Default to output OS name only; suitable for use"
  112. echo " in makefiles and compiler defines"
  113. echo " -f, -full, --full) Full output includes OS name and release number"
  114. echo " -d, -dash, --dash) use with -f to specify a dash separator"
  115. echo " -u, -under, --under) use with -f to specify a underscore separator"
  116. echo " -n, -none, --none) use with -f to specify no separator"
  117. echo " -p, -pretty, --pretty) Print prettier mixed case version of OS name"
  118. echo " -g, -gnu, --gnu) GNU-style: <chip_arch>-<vendor>-<os_release>"
  119. echo " -h, -help, --help) Print this usage message"
  120. echo; echo
  121. }
  122. get_opt(){
  123. ARGS=$*
  124. cntr=0
  125. while [ $cntr -lt $# ]
  126. do
  127. case $1 in
  128. -h|-help|--help) usage
  129. exit 0;;
  130. -f|-full|--full) output_format="full";;
  131. -d|-dash|--dash) divider="dash";;
  132. -u|-under|--under) divider="underscore";;
  133. -n|-none|--none) divider="none";;
  134. -p|-pretty|--pretty) pretty=1;;
  135. -g|-gnu|--gnu) output_format="gnu";;
  136. *) echo "Error: unknown argument: $1"; echo
  137. usage
  138. exit 1;;
  139. esac
  140. shift
  141. done
  142. }
  143. ns_printf(){
  144. # handle the case where we didn't set NS_NAME
  145. if [ -z "${NS_NAME}" ]; then
  146. NS_NAME="${UNAME_SYSTEM}"
  147. fi
  148. # handle the case where we don't have a pretty name
  149. if [ -z "${NS_PRETTY_NAME}" ]; then
  150. NS_PRETTY_NAME="${NS_NAME}"
  151. fi
  152. # determine which output format to use
  153. case ${output_format} in
  154. 'standard')
  155. if [ $pretty -eq 1 ]; then
  156. echo ${NS_PRETTY_NAME}
  157. else
  158. echo ${NS_NAME}
  159. fi;;
  160. 'full')
  161. if [ $pretty -eq 1 ]; then
  162. case "$divider" in
  163. 'dash') echo ${NS_PRETTY_NAME} ${NS_RELEASE} | sed -e 's/ /-/';;
  164. 'underscore') echo ${NS_PRETTY_NAME} ${NS_RELEASE} | sed -e 's/ /_/';;
  165. 'none') echo ${NS_PRETTY_NAME} ${NS_RELEASE} | sed -e 's/ //';;
  166. *) echo ${NS_PRETTY_NAME} ${NS_RELEASE};;
  167. esac
  168. else
  169. # since we're outputing full, we don't need the redundant "4"
  170. # in the ${NS_NAME}
  171. if [ ${NS_NAME} = "SUNOS4" ]; then
  172. NS_NAME="SUNOS"
  173. fi
  174. case "$divider" in
  175. 'dash') echo ${NS_NAME} ${NS_RELEASE} | sed -e 's/ /-/';;
  176. 'underscore') echo ${NS_NAME} ${NS_RELEASE} | sed -e 's/ /_/';;
  177. 'none') echo ${NS_NAME} ${NS_RELEASE} | sed -e 's/ //';;
  178. *) echo ${NS_NAME} ${NS_RELEASE};;
  179. esac
  180. fi;;
  181. 'gnu') echo ${GNU_NAME};;
  182. esac
  183. }
  184. #--------------------------------------------------------------------------
  185. # main - get the arguments and start running
  186. get_opt $*
  187. #--------------------------------------------------------------------------
  188. # everything that follows is GNU's config.guess slightly modified locally
  189. # NT doesn't have /dev/null
  190. #UNAME_MACHINE=`(uname -m) 2> /dev/null` || UNAME_MACHINE=unknown
  191. #UNAME_RELEASE=`(uname -r) 2> /dev/null` || UNAME_RELEASE=unknown
  192. #UNAME_SYSTEM=`(uname -s) 2> /dev/null` || UNAME_SYSTEM=unknown
  193. #UNAME_VERSION=`(uname -v) 2> /dev/null` || UNAME_VERSION=unknown
  194. UNAME_MACHINE=`(uname -m)` || UNAME_MACHINE=unknown
  195. UNAME_RELEASE=`(uname -r)` || UNAME_RELEASE=unknown
  196. UNAME_SYSTEM=`(uname -s)` || UNAME_SYSTEM=unknown
  197. UNAME_VERSION=`(uname -v)` || UNAME_VERSION=unknown
  198. trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
  199. # Note: order is significant - the case branches are not exclusive.
  200. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
  201. alpha:OSF1:*:*)
  202. # A Vn.n version is a released version.
  203. # A Tn.n version is a released field test version.
  204. # A Xn.n version is an unreleased experimental baselevel.
  205. # 1.2 uses "1.2" for uname -r.
  206. #echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
  207. GNU_NAME="alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`"
  208. NS_NAME="${UNAME_SYSTEM}"
  209. NS_RELEASE="`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`"
  210. ns_printf
  211. exit 0 ;;
  212. 21064:Windows_NT:50:3)
  213. #echo alpha-dec-winnt3.5
  214. GNU_NAME="alpha-dec-winnt3.5"
  215. NS_NAME="WINNT"
  216. NS_RELEASE="${UNAME_RELEASE}"
  217. ns_printf
  218. exit 0 ;;
  219. Amiga*:UNIX_System_V:4.0:*)
  220. echo m68k-cbm-sysv4
  221. exit 0;;
  222. amiga:NetBSD:*:*)
  223. echo m68k-cbm-netbsd${UNAME_RELEASE}
  224. exit 0 ;;
  225. amiga:OpenBSD:*:*)
  226. echo m68k-cbm-openbsd${UNAME_RELEASE}
  227. exit 0 ;;
  228. arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  229. echo arm-acorn-riscix${UNAME_RELEASE}
  230. exit 0;;
  231. Pyramid*:OSx*:*:*)
  232. if test "`(/bin/universe) 2>/dev/null`" = att ; then
  233. #echo pyramid-pyramid-sysv3
  234. GNU_NAME="pyramid-pyramid-sysv3"
  235. else
  236. #echo pyramid-pyramid-bsd
  237. GNU_NAME="pyramid-pyramid-bsd"
  238. fi
  239. ns_printf
  240. exit 0 ;;
  241. sun4*:SunOS:5.*:*)
  242. #echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  243. GNU_NAME="sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`"
  244. NS_NAME="SOLARIS"
  245. NS_PRETTY_NAME="Solaris"
  246. NS_RELEASE="`echo ${UNAME_RELEASE}|sed -e 's/[^.]*/2/'`"
  247. ns_printf
  248. exit 0 ;;
  249. i86pc:SunOS:5.*:*)
  250. #echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  251. GNU_NAME="i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`"
  252. NS_NAME="SOLARISx86"
  253. NS_PRETTY_NAME="Solaris-x86"
  254. NS_RELEASE="`echo ${UNAME_RELEASE}|sed -e 's/[^.]*/2/'`"
  255. ns_printf
  256. exit 0 ;;
  257. sun4*:SunOS:6*:*)
  258. # According to config.sub, this is the proper way to canonicalize
  259. # SunOS6. Hard to guess exactly what SunOS6 will be like, but
  260. # it's likely to be more like Solaris than SunOS4.
  261. #echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  262. GNU_NAME="sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`"
  263. ns_printf
  264. exit 0 ;;
  265. sun4*:SunOS:*:*)
  266. case "`/usr/bin/arch -k`" in
  267. Series*|S4*)
  268. UNAME_RELEASE=`uname -v`
  269. ;;
  270. esac
  271. # Japanese Language versions have a version number like `4.1.3-JL'.
  272. #echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
  273. GNU_NAME="sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`"
  274. NS_NAME="SUNOS4"
  275. NS_PRETTY_NAME="SunOS"
  276. NS_RELEASE="${UNAME_RELEASE}"
  277. ns_printf
  278. exit 0 ;;
  279. sun3*:SunOS:*:*)
  280. echo m68k-sun-sunos${UNAME_RELEASE}
  281. exit 0 ;;
  282. atari*:NetBSD:*:*)
  283. echo m68k-atari-netbsd${UNAME_RELEASE}
  284. exit 0 ;;
  285. atari*:OpenBSD:*:*)
  286. echo m68k-atari-openbsd${UNAME_RELEASE}
  287. exit 0 ;;
  288. sun3*:NetBSD:*:*)
  289. echo m68k-sun-netbsd${UNAME_RELEASE}
  290. exit 0 ;;
  291. sun3*:OpenBSD:*:*)
  292. echo m68k-sun-openbsd${UNAME_RELEASE}
  293. exit 0 ;;
  294. mac68k:NetBSD:*:*)
  295. echo m68k-apple-netbsd${UNAME_RELEASE}
  296. exit 0 ;;
  297. mac68k:OpenBSD:*:*)
  298. echo m68k-apple-openbsd${UNAME_RELEASE}
  299. exit 0 ;;
  300. RISC*:ULTRIX:*:*)
  301. #echo mips-dec-ultrix${UNAME_RELEASE}
  302. GNU_NAME="mips-dec-ultrix${UNAME_RELEASE}"
  303. ns_printf
  304. exit 0 ;;
  305. VAX*:ULTRIX*:*:*)
  306. #echo vax-dec-ultrix${UNAME_RELEASE}
  307. GNU_NAME="vax-dec-ultrix${UNAME_RELEASE}"
  308. ns_printf
  309. exit 0 ;;
  310. mips:*:4*:UMIPS)
  311. echo mips-mips-riscos4sysv
  312. exit 0 ;;
  313. mips:*:5*:RISCos)
  314. echo mips-mips-riscos${UNAME_RELEASE}
  315. exit 0 ;;
  316. Night_Hawk:Power_UNIX:*:*)
  317. echo powerpc-harris-powerunix
  318. exit 0 ;;
  319. m88k:CX/UX:7*:*)
  320. echo m88k-harris-cxux7
  321. exit 0 ;;
  322. m88k:*:4*:R4*)
  323. echo m88k-motorola-sysv4
  324. exit 0 ;;
  325. m88k:*:3*:R3*)
  326. echo m88k-motorola-sysv3
  327. exit 0 ;;
  328. AViiON:dgux:*:*)
  329. # DG/UX returns AViiON for all architectures
  330. UNAME_PROCESSOR=`/usr/bin/uname -p`
  331. if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88100 ] ; then
  332. if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
  333. -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
  334. #echo m88k-dg-dgux${UNAME_RELEASE}
  335. GNU_NAME="m88k-dg-dgux${UNAME_RELEASE}"
  336. else
  337. #echo m88k-dg-dguxbcs${UNAME_RELEASE}
  338. GNU_NAME="m88k-dg-dguxbcs${UNAME_RELEASE}"
  339. fi
  340. else
  341. #echo i586-dg-dgux${UNAME_RELEASE}
  342. GNU_NAME="i586-dg-dgux${UNAME_RELEASE}"
  343. fi
  344. ns_printf
  345. exit 0 ;;
  346. M88*:DolphinOS:*:*) # DolphinOS (SVR3)
  347. echo m88k-dolphin-sysv3
  348. exit 0 ;;
  349. M88*:*:R3*:*)
  350. # Delta 88k system running SVR3
  351. echo m88k-motorola-sysv3
  352. exit 0 ;;
  353. XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
  354. echo m88k-tektronix-sysv3
  355. exit 0 ;;
  356. Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
  357. echo m68k-tektronix-bsd
  358. exit 0 ;;
  359. *:IRIX*:*:*)
  360. #echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
  361. GNU_NAME="mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`"
  362. NS_NAME="IRIX"
  363. NS_RELEASE="`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`"
  364. ns_printf
  365. exit 0 ;;
  366. ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
  367. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
  368. exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
  369. i[34]86:AIX:*)
  370. echo i386-ibm-aix
  371. exit 0 ;;
  372. *:AIX:2:3)
  373. if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
  374. # commenting out this test program - unable to execute
  375. # cc on some machines...
  376. #sed 's/^ //' << EOF >dummy.c
  377. ##include <sys/systemcfg.h>
  378. #
  379. #main()
  380. # {
  381. # if (!__power_pc())
  382. # exit(1);
  383. # puts("powerpc-ibm-aix3.2.5");
  384. # exit(0);
  385. # }
  386. #EOF
  387. #${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
  388. #rm -f dummy.c dummy
  389. #echo rs6000-ibm-aix3.2.5
  390. GNU_NAME="rs6000-ibm-aix3.2.5"
  391. NS_RELEASE="3.2.5"
  392. elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
  393. #echo rs6000-ibm-aix3.2.4
  394. GNU_NAME="rs6000-ibm-aix3.2.4"
  395. NS_RELEASE="3.2.4"
  396. else
  397. #echo rs6000-ibm-aix3.2
  398. GNU_NAME="rs6000-ibm-aix3.2"
  399. NS_RELEASE="3.2"
  400. fi
  401. ns_printf
  402. exit 0 ;;
  403. *:AIX:*:4)
  404. if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
  405. IBM_ARCH=rs6000
  406. else
  407. IBM_ARCH=powerpc
  408. fi
  409. if [ -x /usr/bin/oslevel ] ; then
  410. IBM_REV=`/usr/bin/oslevel`
  411. else
  412. IBM_REV=4.${UNAME_RELEASE}
  413. fi
  414. #echo ${IBM_ARCH}-ibm-aix${IBM_REV}
  415. GNU_NAME="${IBM_ARCH}-ibm-aix${IBM_REV}"
  416. NS_RELEASE="${IBM_REV}"
  417. ns_printf
  418. exit 0 ;;
  419. *:AIX:*:*)
  420. #echo rs6000-ibm-aix
  421. GNU_NAME="rs6000-ibm-aix"
  422. ns_printf
  423. exit 0 ;;
  424. ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  425. echo romp-ibm-bsd4.4
  426. exit 0 ;;
  427. ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
  428. echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
  429. exit 0 ;; # report: romp-ibm BSD 4.3
  430. *:BOSX:*:*)
  431. echo rs6000-bull-bosx
  432. exit 0 ;;
  433. DPX/2?00:B.O.S.:*:*)
  434. echo m68k-bull-sysv3
  435. exit 0 ;;
  436. 9000/[34]??:4.3bsd:1.*:*)
  437. echo m68k-hp-bsd
  438. exit 0 ;;
  439. hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
  440. echo m68k-hp-bsd4.4
  441. exit 0 ;;
  442. 9000/[3478]??:HP-UX:*:*)
  443. case "${UNAME_MACHINE}" in
  444. 9000/31? ) HP_ARCH=m68000 ;;
  445. 9000/[34]?? ) HP_ARCH=m68k ;;
  446. 9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
  447. 9000/8?? ) HP_ARCH=hppa1.0 ;;
  448. esac
  449. HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  450. #echo ${HP_ARCH}-hp-hpux${HPUX_REV}
  451. GNU_NAME="${HP_ARCH}-hp-hpux${HPUX_REV}"
  452. NS_NAME="HPUX"
  453. NS_PRETTY_NAME="HP-UX"
  454. NS_RELEASE="${HPUX_REV}"
  455. ns_printf
  456. exit 0 ;;
  457. ia64:HP-UX:*:*)
  458. HP_ARCH=hpia
  459. HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  460. GNU_NAME="${HP_ARCH}-hp-hpux${HPUX_REV}"
  461. NS_NAME="HPUX"
  462. NS_PRETTY_NAME="HP-UX"
  463. NS_RELEASE="${HPUX_REV}"
  464. ns_printf
  465. exit 0 ;;
  466. 3050*:HI-UX:*:*)
  467. sed 's/^ //' << EOF >dummy.c
  468. #include <unistd.h>
  469. int
  470. main ()
  471. {
  472. long cpu = sysconf (_SC_CPU_VERSION);
  473. /* The order matters, because CPU_IS_HP_MC68K erroneously returns
  474. true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
  475. results, however. */
  476. if (CPU_IS_PA_RISC (cpu))
  477. {
  478. switch (cpu)
  479. {
  480. case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
  481. case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
  482. case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
  483. default: puts ("hppa-hitachi-hiuxwe2"); break;
  484. }
  485. }
  486. else if (CPU_IS_HP_MC68K (cpu))
  487. puts ("m68k-hitachi-hiuxwe2");
  488. else puts ("unknown-hitachi-hiuxwe2");
  489. exit (0);
  490. }
  491. EOF
  492. ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
  493. rm -f dummy.c dummy
  494. echo unknown-hitachi-hiuxwe2
  495. exit 0 ;;
  496. 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
  497. echo hppa1.1-hp-bsd
  498. exit 0 ;;
  499. 9000/8??:4.3bsd:*:*)
  500. echo hppa1.0-hp-bsd
  501. exit 0 ;;
  502. hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
  503. echo hppa1.1-hp-osf
  504. exit 0 ;;
  505. hp8??:OSF1:*:*)
  506. echo hppa1.0-hp-osf
  507. exit 0 ;;
  508. parisc*:Lites*:*:*)
  509. echo hppa1.1-hp-lites
  510. exit 0 ;;
  511. C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
  512. echo c1-convex-bsd
  513. exit 0 ;;
  514. C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
  515. if getsysinfo -f scalar_acc
  516. then echo c32-convex-bsd
  517. else echo c2-convex-bsd
  518. fi
  519. exit 0 ;;
  520. C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
  521. echo c34-convex-bsd
  522. exit 0 ;;
  523. C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
  524. echo c38-convex-bsd
  525. exit 0 ;;
  526. C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
  527. echo c4-convex-bsd
  528. exit 0 ;;
  529. CRAY*X-MP:*:*:*)
  530. echo xmp-cray-unicos
  531. exit 0 ;;
  532. CRAY*Y-MP:*:*:*)
  533. echo ymp-cray-unicos${UNAME_RELEASE}
  534. exit 0 ;;
  535. CRAY*C90:*:*:*)
  536. echo c90-cray-unicos${UNAME_RELEASE}
  537. exit 0 ;;
  538. CRAY-2:*:*:*)
  539. echo cray2-cray-unicos
  540. exit 0 ;;
  541. hp3[0-9][05]:NetBSD:*:*)
  542. echo m68k-hp-netbsd${UNAME_RELEASE}
  543. exit 0 ;;
  544. hp3[0-9][05]:OpenBSD:*:*)
  545. echo m68k-hp-openbsd${UNAME_RELEASE}
  546. exit 0 ;;
  547. i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
  548. #echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
  549. GNU_NAME="${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}"
  550. NS_NAME="BSDI"
  551. NS_PRETTY_NAME="BSDI"
  552. NS_RELEASE="${UNAME_RELEASE}"
  553. ns_printf
  554. exit 0 ;;
  555. *:FreeBSD:*:*)
  556. echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
  557. exit 0 ;;
  558. *:NetBSD:*:*)
  559. echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  560. exit 0 ;;
  561. *:OpenBSD:*:*)
  562. echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  563. exit 0 ;;
  564. i*:CYGWIN*:*)
  565. #echo i386-unknown-cygwin32
  566. GNU_NAME="i386-unknown-cygwin32"
  567. NS_NAME="WINNT"
  568. NS_PRETTY_NAME="WinNT"
  569. NS_RELEASE="${UNAME_RELEASE}"
  570. ns_printf
  571. exit 0 ;;
  572. p*:CYGWIN*:*)
  573. echo powerpcle-unknown-cygwin32
  574. exit 0 ;;
  575. prep*:SunOS:5.*:*)
  576. echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  577. exit 0 ;;
  578. *:GNU:*:*)
  579. echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
  580. exit 0 ;;
  581. *:Linux:*:*)
  582. # The BFD linker knows what the default object file format is, so
  583. # first see if it will tell us.
  584. ld_help_string=`ld --help 2>&1`
  585. if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
  586. #echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
  587. GNU_NAME="${UNAME_MACHINE}-unknown-linux"
  588. NS_NAME="${UNAME_SYSTEM}"
  589. NS_RELEASE="${UNAME_RELEASE}"
  590. if echo "$NS_RELEASE" | grep >/dev/null 2>&1 "2.0."; then
  591. NS_RELEASE="2.0"
  592. fi
  593. ns_printf
  594. exit 0
  595. elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
  596. #echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
  597. GNU_NAME="${UNAME_MACHINE}-unknown-linuxaout"
  598. NS_NAME="${UNAME_SYSTEM}"
  599. NS_RELEASE="${UNAME_RELEASE}"
  600. ns_printf
  601. exit 0
  602. elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
  603. #echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
  604. GNU_NAME="${UNAME_MACHINE}-unknown-linuxcoff"
  605. NS_NAME="${UNAME_SYSTEM}"
  606. NS_RELEASE="${UNAME_RELEASE}"
  607. ns_printf
  608. exit 0
  609. elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
  610. #echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
  611. GNU_NAME="${UNAME_MACHINE}-unknown-linux"
  612. NS_NAME="${UNAME_SYSTEM}"
  613. NS_RELEASE="${UNAME_RELEASE}"
  614. ns_printf
  615. exit 0
  616. elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
  617. #echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
  618. GNU_NAME="${UNAME_MACHINE}-unknown-linuxaout"
  619. NS_NAME="${UNAME_SYSTEM}"
  620. NS_RELEASE="${UNAME_RELEASE}"
  621. ns_printf
  622. exit 0
  623. elif test "${UNAME_MACHINE}" = "alpha" ; then
  624. #echo alpha-unknown-linux ; exit 0
  625. GNU_NAME="alpha-unknown-linux"
  626. NS_NAME="${UNAME_SYSTEM}"
  627. NS_RELEASE="${UNAME_RELEASE}"
  628. ns_printf
  629. exit 0
  630. else
  631. # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
  632. # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
  633. test ! -d /usr/lib/ldscripts/. \
  634. && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
  635. # Determine whether the default compiler is a.out or elf
  636. cat >dummy.c <<EOF
  637. main(argc, argv)
  638. int argc;
  639. char *argv[];
  640. {
  641. #ifdef __ELF__
  642. printf ("%s-unknown-linux\n", argv[1]);
  643. #else
  644. printf ("%s-unknown-linuxaout\n", argv[1]);
  645. #endif
  646. return 0;
  647. }
  648. EOF
  649. ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
  650. rm -f dummy.c dummy
  651. fi ;;
  652. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
  653. # are messed up and put the nodename in both sysname and nodename.
  654. i[34]86:DYNIX/ptx:4*:*)
  655. echo i386-sequent-sysv4
  656. exit 0 ;;
  657. i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
  658. #if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
  659. #echo ${UNAME_MACHINE}-unixware-sysv${UNAME_RELEASE}
  660. if grep SCO /usr/include/sco_values.h >/dev/null 2>/dev/null; then
  661. #echo ${UNAME_MACHINE}-unknown-unixware${UNAME_VERSION}
  662. # check for UDK, which is like building on Gemini
  663. # assumes correct "cc" is first in PATH
  664. if cc -V 2>&1 | grep "CCS. 3.2" >/dev/null 2>/dev/null; then
  665. NS_NAME="UnixWare"
  666. NS_RELEASE="5"
  667. else
  668. NS_NAME="UNIXWARE"
  669. NS_RELEASE="${UNAME_VERSION}"
  670. fi
  671. GNU_NAME="${UNAME_MACHINE}-unknown-unixware${UNAME_VERSION}"
  672. NS_PRETTY_NAME="UnixWare"
  673. ns_printf
  674. else
  675. echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
  676. fi
  677. exit 0 ;;
  678. i[34]86:UnixWare:5*:*)
  679. GNU_NAME="${UNAME_MACHINE}-unknown-unixware${UNAME_VERSION}"
  680. NS_NAME="UnixWare"
  681. NS_PRETTY_NAME="UnixWare"
  682. NS_RELEASE="${UNAME_VERSION}"
  683. ns_printf
  684. exit 0 ;;
  685. i[34]86:SCO_SV:3.2:*)
  686. if /bin/uname -X 2>/dev/null >/dev/null ; then
  687. UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  688. (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  689. (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  690. && UNAME_MACHINE=i586
  691. GNU_NAME="${UNAME_MACHINE}-unknown-sco`echo $UNAME_REL|sed -e 's/.*v//`"
  692. NS_NAME="SCO"
  693. NS_PRETTY_NAME="SCO"
  694. NS_RELEASE="`echo $UNAME_REL|sed -e 's/.*v//`"
  695. ns_printf
  696. fi
  697. exit 0 ;;
  698. i[34]86:*:3.2:*)
  699. if test -f /usr/options/cb.name; then
  700. UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
  701. echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
  702. elif /bin/uname -X 2>/dev/null >/dev/null ; then
  703. UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  704. (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  705. (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  706. && UNAME_MACHINE=i586
  707. #echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
  708. GNU_NAME="${UNAME_MACHINE}-unknown-sco${UNAME_REL}"
  709. NS_NAME="SCO"
  710. NS_PRETTY_NAME="SCO"
  711. NS_RELEASE="${UNAME_RELEASE}"
  712. ns_printf
  713. else
  714. echo ${UNAME_MACHINE}-unknown-sysv32
  715. fi
  716. exit 0 ;;
  717. Intel:Mach:3*:*)
  718. echo i386-unknown-mach3
  719. exit 0 ;;
  720. paragon:*:*:*)
  721. echo i860-intel-osf1
  722. exit 0 ;;
  723. i860:*:4.*:*) # i860-SVR4
  724. if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
  725. echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
  726. else # Add other i860-SVR4 vendors below as they are discovered.
  727. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
  728. fi
  729. exit 0 ;;
  730. mini*:CTIX:SYS*5:*)
  731. # "miniframe"
  732. echo m68010-convergent-sysv
  733. exit 0 ;;
  734. M680[234]0:*:R3V[567]*:*)
  735. test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
  736. 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
  737. uname -p 2>/dev/null | grep 86 >/dev/null \
  738. && echo i486-ncr-sysv4.3 && exit 0 ;;
  739. 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
  740. uname -p 2>/dev/null | grep 86 >/dev/null \
  741. && echo i486-ncr-sysv4 && exit 0 ;;
  742. 3[34]??/3[34]??:*:4.0:* | 3[34]??/3[34]??,*:*:4.0:*)
  743. #uname -p 2>/dev/null | grep Pentium >/dev/null \
  744. # && echo i586-ncr-sysv4 && exit 0 ;;
  745. uname -p 2>/dev/null | grep Pentium >/dev/null
  746. if [ "$?" -eq 0 ]; then
  747. GNU_NAME="i586-ncr-sysv${UNAME_RELEASE}"
  748. NS_NAME="NCR"
  749. NS_RELEASE="${UNAME_VERSION}"
  750. ns_printf
  751. else
  752. GNU_NAME="unknown-ncr-sysv${UNAME_RELEASE}"
  753. NS_NAME="NCR"
  754. NS_RELEASE="${UNAME_VERSION}"
  755. ns_printf
  756. fi
  757. exit 0 ;;
  758. m680[234]0:LynxOS:2.[23]*:*)
  759. echo m68k-lynx-lynxos${UNAME_RELEASE}
  760. exit 0 ;;
  761. mc68030:UNIX_System_V:4.*:*)
  762. echo m68k-atari-sysv4
  763. exit 0 ;;
  764. i[34]86:LynxOS:2.[23]*:*)
  765. echo i386-lynx-lynxos${UNAME_RELEASE}
  766. exit 0 ;;
  767. TSUNAMI:LynxOS:2.[23]*:*)
  768. echo sparc-lynx-lynxos${UNAME_RELEASE}
  769. exit 0 ;;
  770. rs6000:LynxOS:2.[23]*:*)
  771. echo rs6000-lynx-lynxos${UNAME_RELEASE}
  772. exit 0 ;;
  773. RM*:SINIX-*:*:*)
  774. #echo mips-sni-sysv4
  775. GNU_NAME="mips-sni-sysv4"
  776. NS_NAME="ReliantUNIX"
  777. NS_PRETTY_NAME="Sinix"
  778. NS_RELEASE="${UNAME_RELEASE}"
  779. ns_printf
  780. exit 0 ;;
  781. *:SINIX-*:*:*)
  782. if uname -p 2>/dev/null >/dev/null ; then
  783. UNAME_MACHINE=`(uname -p) 2>/dev/null`
  784. #echo ${UNAME_MACHINE}-sni-sysv4
  785. GNU_NAME="${UNAME_MACHINE}-sni-sysv4"
  786. else
  787. #echo ns32k-sni-sysv
  788. GNU_NAME="ns32k-sni-sysv"
  789. fi
  790. ns_printf
  791. exit 0 ;;
  792. mc68*:A/UX:*:*)
  793. echo m68k-apple-aux${UNAME_RELEASE}
  794. exit 0 ;;
  795. R?000:*System_V*:*:*)
  796. if [ -d /usr/nec ]; then
  797. #echo mips-nec-sysv${UNAME_RELEASE}
  798. GNU_NAME="mips-nec-sysv${UNAME_RELEASE}"
  799. NS_NAME="NEC"
  800. NS_RELEASE="${UNAME_RELEASE}"
  801. ns_printf
  802. else
  803. echo mips-unknown-sysv${UNAME_RELEASE}
  804. fi
  805. exit 0 ;;
  806. *:NEWS-OS:*:*)
  807. GNU_NAME="mips-sony-newsos"
  808. NS_NAME="SONY"
  809. NS_RELEASE="${UNAME_RELEASE}"
  810. exit 0 ;;
  811. *86:Windows_NT:4*:*)
  812. GNU_NAME="x86-unknown-winnt4"
  813. NS_NAME="WINNT"
  814. NS_PRETTY_NAME="WinNT"
  815. NS_RELEASE="${UNAME_RELEASE}"
  816. ns_printf
  817. exit 0 ;;
  818. *:WINNT:4*:*)
  819. GNU_NAME="x86-unknown-winnt4"
  820. NS_NAME="WINNT"
  821. NS_PRETTY_NAME="WinNT"
  822. NS_RELEASE="${UNAME_RELEASE}"
  823. ns_printf
  824. exit 0 ;;
  825. *:WINNT:*:*)
  826. GNU_NAME="x86-unknown-winnt"
  827. NS_NAME="WINNT"
  828. NS_PRETTY_NAME="WinNT"
  829. NS_RELEASE="${UNAME_RELEASE}"
  830. ns_printf
  831. exit 0 ;;
  832. esac
  833. echo '(Unable to guess system type)' 1>&2
  834. exit 1