diff options
author | Per Bothner <per@bothner.com> | 1993-01-20 01:20:29 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1993-01-20 01:20:29 +0000 |
commit | cc83d8b091c8f4e467d92c5e6175f7f26dced4ce (patch) | |
tree | 82b0dcb3b9b98b9968856637f0e974aefac0e7e4 | |
parent | ec16f7015b91a7324011b41f6a13dfab0fd5d21a (diff) | |
download | gdb-cc83d8b091c8f4e467d92c5e6175f7f26dced4ce.zip gdb-cc83d8b091c8f4e467d92c5e6175f7f26dced4ce.tar.gz gdb-cc83d8b091c8f4e467d92c5e6175f7f26dced4ce.tar.bz2 |
* 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.
-rw-r--r-- | .Sanitize | 1 | ||||
-rwxr-xr-x | guess-systype | 65 |
2 files changed, 66 insertions, 0 deletions
@@ -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 0000000..3d2bbce --- /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 <<EOF +main() +{ +#if defined (sony) +#if defined (MIPSEB) + exit(1); +#else + printf("m68k-sony-newsos\n"); +#endif +#endif +} +EOF + +${CC-cc} dummy.c -o dummy && dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +echo "(No uname comamnd or uname output not recognized." 1>&2 +echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +echo "Unable to guess system type)" 1>&2 + +exit 1 + |