summaryrefslogtreecommitdiff
path: root/devel/cpuflags/files/cpuflags.Linux
blob: e2cea2740e6ca978c9341ca7b8e9cdc960edb1a2 (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
#!/bin/sh
# $NetBSD: cpuflags.Linux,v 1.5 2001/11/27 12:26:12 abs Exp $

hw_model=`uname -m`

case $hw_model in
    # i386
    i386)	FLAGS='-march=i386'		;;
    i486)	FLAGS='-march=i486'		;;
    i586)	FLAGS='-march=pentium'		;;
    i686)	FLAGS='-march=pentiumpro'	;;
    #
    *)		echo "Unknown hw.model '$hw_model'"			>&2
		echo "Please send machine details to abs@netbsd.org"	>&2
						;;
esac

# Fixup flags for old gcc
if [ -n "$FLAGS" ]; then
    gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {sub("egcs-","");print $3}'`
    FLAGS=`awk -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
	{if (gcc_ver < $1){map["-m"$2] = "-m"$3}}
	END{if (map[flags]) {print map[flags]}else {print flags}}
	' <<EOD
2.90	arch=i386		no-486
2.90	arch=i486		486
2.90	arch=pentium		486
2.90	arch=pentiumpro		486
2.90	cpu=supersparc		supersparc
2.90	cpu=sparclite		sparclite
2.90	cpu=cypress		cypress
2.90	cpu=v9			v8
2.90	cpu=arm610		6
2.90	cpu=strongarm110	6
2.90	cpu=arm710		6
2.95	arch=k6			arch=pentium
EOD
`
fi


echo $FLAGS

exit 0