pkgsrc/devel/cpuflags/files/cpuflags.NetBSD
abs fbe2f48940 Updated cpuflags to 0.10:
There are no vax specific gcc optimisation flags (mores the pity).
2001-09-16 16:30:08 +00:00

87 lines
2.2 KiB
Bash
Executable file

#!/bin/sh
# $NetBSD: cpuflags.NetBSD,v 1.10 2001/09/16 16:30:08 abs Exp $
if [ -x /sbin/sysctl ] ;then
SYSCTL=/sbin/sysctl
else
SYSCTL=/usr/sbin/sysctl # NetBSD 1.3
fi
hw_model=`$SYSCTL -n hw.model`
case $hw_model in
# i386
*386-class*) FLAGS='-march=i386' ;;
*486-class*) FLAGS='-march=i486' ;;
*586-class*) FLAGS='-march=pentium' ;;
*686-class*) FLAGS='-march=pentiumpro' ;;
#
# sparc
MB86904* | MB86907*) FLAGS="-mcpu=supersparc" ;; # ss5
TMS390Z50*) FLAGS="-mcpu=supersparc" ;; # ss10/ss20
MB86930* | MB86934*) FLAGS="-mcpu=sparclite" ;; # from gcc
MB86900/1A*) FLAGS="-mcpu=cypress" ;; # ss1+
CY7C601*) FLAGS="-mcpu=cypress" ;; # ss2
# under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl
SUNW,UltraSPARC*) FLAGS="-mcpu=v9" ;; # Ultra
#
# arm32
ARM610*) FLAGS="-mcpu=arm610" ;; # risc pc
ARM710*) FLAGS="-mcpu=arm710" ;; # risc pc
SA-110*)
hw_machine=`$SYSCTL -n hw.machine` # arm32 split post 1.5
case $hw_machine in
cats|dnard|hpcarm|netwinder)
FLAGS="-mcpu=strongarm110" ;;
*)
# The memorybus in strongarm risc pc machines cannot support
# certain strongarm instructions, but in 1.5 and earlier all
# strongarm machines are 'arm32', so uname or sysctl no use
if egrep -q ofbus0|footbridge0 /var/run/dmesg.boot 2>/dev/null \
; then
FLAGS="-mcpu=strongarm110" # dnard/cats
else
FLAGS="-march=armv3m -mtune=strongarm" # risc pc
fi
esac ;;
#
# vax
#
*)
hw_machine=`$SYSCTL -n hw.machine` # arm32 split post 1.5
case $hw_machine in
vax)
;; # No VAX specific gcc flags :(
*)
echo "Unknown hw.model '$hw_model'" >&2
esac
esac
if [ -n "$FLAGS" ]; then
gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {print $3}'`
case $gcc_ver in
egcs* )
gcc_ver=2.8 ;;
esac
# Old gcc, such as 2.7.x in NetBSD 1.3
if [ "$gcc_ver" \< 2.8 ]; then
FLAGS=`awk -v "flags=$FLAGS" '
{map["-m"$1] = "-m"$2}
END{print map[flags]}' <<EOD
arch=i386 no-486
arch=i486 486
arch=pentium 486
arch=pentiumpro 486
cpu=supersparc supersparc
cpu=sparclite sparclite
cpu=cypress cypress
cpu=v9 v8
EOD
`
fi
fi
echo $FLAGS
exit 0