* 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.
This commit is contained in:
Per Bothner 1993-01-20 01:20:29 +00:00
parent ec16f7015b
commit cc83d8b091
2 changed files with 66 additions and 0 deletions

View File

@ -62,6 +62,7 @@ glob
gprof
grep
groff
guess-systype
h8300sim
include
ispell

65
guess-systype Executable file
View File

@ -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