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