-
Notifications
You must be signed in to change notification settings - Fork 1
/
systype.in
211 lines (199 loc) · 5.08 KB
/
systype.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#! /bin/sh
CC="@CC@"
CFLAGS="@CFLAGS@"
GCC="@GCC@"
srcdir=@srcdir@
# oper-:arch-:syst-:chip-:kern-
# oper = operating system type; e.g., sunos-4.1.4
# arch = machine language; e.g., sparc
# syst = which binaries can run; e.g., sun4
# chip = chip model; e.g., micro-2-80
# kern = kernel version; e.g., sun4m
# dependence: arch --- chip
# \ \
# oper --- syst --- kern
# so, for example, syst is interpreted in light of oper, but chip is not.
# anyway, no slashes, no extra colons, no uppercase letters.
# the point of the extra -'s is to ease parsing: can add hierarchies later.
# e.g., *:i386-*:*:pentium-*:* would handle pentium-100 as well as pentium,
# and i386-486 (486s do have more instructions, you know) as well as i386.
# the idea here is to include ALL useful available information.
sys="`uname -s 2>/dev/null | tr '/:[A-Z]' '..[a-z]'`"
if [ x"$sys" != x ]
then
unamer="`uname -r 2>/dev/null | tr /: ..`"
unamem="`uname -m 2>/dev/null | tr /: ..`"
unamev="`uname -v 2>/dev/null | tr /: ..`"
case "$sys" in
bsd.os)
# in bsd 4.4, uname -v does not have useful info.
# in bsd 4.4, uname -m is arch, not chip.
oper="$sys-$unamer"
arch="$unamem"
syst=""
chip="`sysctl -n hw.model 2>/dev/null`"
kern=""
;;
freebsd)
# see above about bsd 4.4
oper="$sys-$unamer"
arch="$unamem"
syst=""
chip="`sysctl -n hw.model 2>/dev/null`" # hopefully
kern=""
;;
netbsd)
# see above about bsd 4.4
oper="$sys-$unamer"
arch="$unamem"
syst=""
chip="`sysctl -n hw.model 2>/dev/null`" # hopefully
kern=""
;;
linux)
# i'd really like to know what distribution the user has ...
# as in bsd 4.4, uname -v does not have useful info.
oper="$sys-$unamer" # not oper!
syst=""
chip="$unamem"
case "$chip" in
i386|i486|i586|i686)
arch="i386"
;;
alpha)
arch="alpha"
;;
esac
;;
aix)
# naturally IBM has to get uname -r and uname -v backwards. dorks.
oper="$sys-$unamev-$unamer"
arch="`arch 2>/dev/null | tr /: ..`"
syst=""
chip="$unamem"
kern=""
;;
sunos)
oper="$sys-$unamer-$unamev"
arch="`(uname -p 2>/dev/null || mach 2>/dev/null ) | tr /: ..`"
syst="`arch 2>/dev/null | tr /: ..`"
chip="$unamem" # this is wrong; is there any way to get the real info?
kern="`arch -k 2>/dev/null | tr /: ..`"
;;
unix_sv)
oper="$sys-$unamer-$unamev"
arch="`uname -m 2>/dev/null`"
syst=""
chip="$unamem"
kern=""
;;
beos)
oper="$sys-$unamer-$unamev"
case "$unamem" in
*BePC*)
arch="i386";
chip="";
if /bin/sysinfo -cpu 2>/dev/null >/dev/null ; then
(/bin/sysinfo -cpu 2>/dev/null |grep PentiumPro >/dev/null) && chip=ppro;
test "$chip" = "" && \
(/bin/sysinfo -cpu 2>/dev/null |grep Pentium >/dev/null) && chip=pentium;
fi
;;
esac
;;
*)
need_config_guess=1;
;;
esac
else
need_config_guess=1;
fi
if test "x$need_config_guess" = x1 ; then
cg=`$srcdir/config.guess` # cpu-company-system
if test "x$cg" = x ; then
# damned, config.guess does nothing if it doesn't support the
# system.
oper="`uname -s 2>/dev/null | tr '/:[A-Z]' '..[a-z]'`"
chip="`uname -m 2>/dev/null | tr /: ..`"
if test "x$oper" = x ; then
oper="unknown"
fi
else
# cpu-company-system
# chip-useless-oper+version
# i586-unknown-sco3.2v4.2
# m68k-hp-hpux9.00
# i486-unknown-linux
chip="`echo $cg | sed s/-.*//`"
oper="`echo $cg | sed s/.*-// | tr '[A-Z]' '[a-z]'`"
case "$oper" in
*[0-9]*)
# sco3.2v4.2
# hpux9.00
x="`echo $oper|sed 's/[0-9].*//'`"
y="`echo $oper|sed 's/^[a-z]*//'`"
oper="$x-$y";
;;
*linux*)
oper=linux-"`uname -r`"
;;
esac
fi
fi
case "$chip" in
80486)
# let's try to be consistent here. (BSD/OS)
chip=i486
;;
i486DX)
# respect the hyphen hierarchy. (FreeBSD)
chip=i486-dx
;;
i486.DX2)
# respect the hyphen hierarchy. (FreeBSD)
chip=i486-dx2
;;
Intel.586)
# no, you nitwits, there is no such chip. (NeXTStep)
chip=pentium
;;
i586)
# no, you nitwits, there is no such chip. (Linux)
chip=pentium
# djb, stop bashing linux alone, bash to GNU people too ...
# config.guess also does this!
;;
i686)
# STOP SAYING THAT! (Linux)
chip=ppro
esac
if test "x$arch" = x ; then
if test "x$chip" = i386 -o "x$chip" = i486 -o "x$chip" = "pentium" \
-o "x$chip" = "ppro" ; then
arch="i386";
fi
fi
x=`echo "$oper-:$arch-:$syst-:$chip-:$kern-" | tr ' [A-Z]' '.[a-z]'`
if test x"$@" = x ; then
echo "Future @PACKAGE@ versions will include a list of systems this version" >&2
echo "was compiled under (that's what you send this message for). In case" >&2
echo "want to see a shorthand expression of your real name in this list" >&2
echo "you may provide it here:" >&2
echo "Realname: " >&2
read realname
else
realname="$@"
fi
echo # BeOS /bin/mail doesn't generate any header ...
echo ""
echo "SYS: $x"
echo "PACKAGE: @PACKAGE@ @VERSION@"
cc="`echo \"$CC\"|sed 's/ .*//'`"
x=`$CC --version </dev/null 2>/dev/null`
echo "CC: $cc $x"
echo "CFLAGS: $CFLAGS"
if test "x$realname" = x ; then
:
else
echo "REALNAME: $realname"
fi