Hopefully the final lot of test files.
[exim.git] / src / scripts / arch-type
CommitLineData
61ec970d
PH
1#! /bin/sh
2# $Cambridge: exim/src/scripts/arch-type,v 1.1 2004/10/06 15:07:40 ph10 Exp $
3
4# Shell script to determine the architecture type.
5
6# If EXIM_ARCHTYPE is set, use it. This allows a manual override.
7
8case "$EXIM_ARCHTYPE" in ?*) arch="$EXIM_ARCHTYPE";; esac
9
10# Otherwise, try to get a value from the uname command. When uname -p gives
11# "unknown" or something containing spaces, try -m.
12
13case "$arch" in '') arch=`uname -p 2> /dev/null`;; esac
14case "$arch" in ''|unknown|*\ *) arch=`uname -m 2> /dev/null`;; esac
15
16# Otherwise, see if ARCHTYPE is set. Some versions of NetBSD set it to
17# "NetBSD", which isn't very helpful. However, we expect uname to have
18# worked under NetBSD, so this shouldn't matter.
19
20case "$arch" in '') arch="$ARCHTYPE";; esac
21
22# Otherwise, as a cheap test, try shell's HOSTTYPE, but as tcsh sometimes sets
23# it to the OS name, ignore it if running with tcsh.
24
25case "$SHELL" in ?*tcsh) HOSTTYPE="";; esac
26
27case "$arch++$HOSTTYPE" in
28++?*) arch="$HOSTTYPE"
29 # Fix up disagreements :-)
30 case "$arch" in
31 sun4*) arch=sparc;;
32
33# Comment by Vadim Vygonets:
34# Maybe sun4/sun4c/sun4m and sun4u (or whatever else they call the
35# Ultras, sparc64?) should be different platforms. Maybe not.
36# NetBSD and OpenBSD (the latter is not supported) think about them
37# as different platforms. Solaris doesn't seem to. I have no idea
38# about Linux.
39
40 sgi) arch=mips;;
41 MIPSEL) arch=mips;;
42 esac
43 ;;
44esac
45
46# Give up if failed.
47
48case "$arch" in
49'') echo "" 1>&2
50 echo "*** Failed to determine the machine architecture type." 1>&2
51 echo "" 1>&2
52 echo UnKnown
53 exit 1;;
54esac
55
56# Get rid of any gash characters in the string
57
58arch=`echo $arch | sed 's,[^-+_.a-zA-Z0-9],,g'`
59
60# Some further fixups needed
61
62case "$arch" in
63i[3456]86*) arch=i386;;
64RISC) arch=mips;; # MIPS Ultrix
65IP22) arch=mips;;
669000[78][0-9][0-9]) arch=hp9000s700;;
679000[34][0-9][0-9]) arch=hp9000s400;;
683050R) arch=3050;;
69esac
70
71# OK, the script seems to have worked. Pass the value back.
72
73echo "$arch"
74
75# End of arch-type