blob: 75be09084cbd71fcc6ef993b18dd1a5027dd667b (
plain)
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
|
# $NetBSD: subr_Darwin,v 1.1 2010/12/05 11:19:39 abs Exp $
AWK=awk
SED=sed
display_hw_details()
{
cat <<END
OS : '$(uname)'
OS version : '$(uname -r)'
hw.model : '$hw_model'
hw.machine : '$hw_machine'
hw.machine_arch : '$hw_machine_arch'
CPU : '$cpu'
END
echo "$cpu_details"
}
extract_hw_details()
{
hw_model=$(sysctl -n hw.model | $SED 's/^ *//')
hw_machine=$(sysctl -n hw.machine)
hw_machine_arch=$(uname -p)
cpu_details=$(hostinfo| $AWK '/^Processor type:/{print $3}')
# We're almost certainly crosscompiling
if [ -n "$MACHINE" -a "$hw_machine" != "$MACHINE" ]; then
echo
exit
fi
}
determine_arch()
{
ARCH=
case $hw_machine_arch in
powerpc) case $cpu_details in # Examples
ppc7450) ARCH='-mcpu=7450' ;; #
ppc750) ARCH='-mcpu=750' ;; # Beige G3
ppc970) ARCH='-mcpu=970' ;; #
esac ;;
esac
echo $ARCH
}
determine_features()
{
FEATURES=
case $hw_machine_arch in
i386 | x86_64)
if [ -n "$cpu_feature_SSE3" ] ; then
FEATURES="-mfpmath=sse -msse3"
elif [ -n "$cpu_feature_SSE2" ] ; then
FEATURES="-mfpmath=sse -msse2"
elif [ -n "$cpu_feature_SSE" ] ; then
FEATURES="-mfpmath=sse -msse"
fi
;;
m68k)
case "$(egrep '^fpu0 ' /var/run/dmesg.boot)" in
*\(emulator\)*) FEATURES="-msoft-float" ;;
*\(no\ math\ support\)*) FEATURES="-msoft-float" ;;
esac
;;
esac
echo $FEATURES
}
|