From: Per Bothner Date: Wed, 20 Jan 1993 01:20:29 +0000 (+0000) Subject: * guess-systype: New shell script. Attempts to guess the X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc83d8b091c8f4e467d92c5e6175f7f26dced4ce;p=binutils-gdb.git * guess-systype: New shell script. Attempts to guess the canonical host name of the executing host. Only a few hosts are supported so far. * configure: Call guess-systype if no host is specified. --- diff --git a/.Sanitize b/.Sanitize index ce7c344fdaa..ebe76d561aa 100644 --- a/.Sanitize +++ b/.Sanitize @@ -62,6 +62,7 @@ glob gprof grep groff +guess-systype h8300sim include ispell diff --git a/guess-systype b/guess-systype new file mode 100755 index 00000000000..3d2bbcec2e9 --- /dev/null +++ b/guess-systype @@ -0,0 +1,65 @@ +#!/bin/sh + +# This script attempts to guess a canonical system name +# similar to the output of config.sub. +# If it succeeds, it prints the system name on stdout, and exits with 0. +# Otherwise, it prints an error message on stderr, and exits with 1. + +# The plan is that this can be called by configure scripts if you don't +# specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; +# please add others (but try to keep the structure clean). + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + sun4*:SunOS:5.*:*) + echo sparc-sun-solaris + exit 0 ;; + sun4*:SunOS:*:*) + echo sparc-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + *:IRIX:*:*) + echo mips-sgi-irix${UNAME_RELEASE} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; +esac + +# uname didn't exit or help; try another approach. + +cat >dummy.c <&2 +echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +echo "Unable to guess system type)" 1>&2 + +exit 1 +