#!/bin/sh # $NetBSD: cpuflags.SunOS,v 1.4 2004/09/23 11:41:10 abs Exp $ PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH if [ "$1" = -v ] ; then shift opt_v=1 fi if [ -n "$1" ]; then CC=$1 else CC=gcc fi display_hw_details() { echo " OS : '`uname`'" echo " arch : '$hw_arch'" } hw_arch=`/usr/bin/uname -m` case $hw_arch in sun4c | sun4 ) FLAGS='-mcpu=cypress' ;; sun4m ) FLAGS='-mcpu=supersparc' ;; sun4u ) FLAGS='-mcpu=v9' ;; esac ############ # Everything from this point common between all cpuflags variants. if [ -n "$opt_v" ] ; then if [ -z "$NONE" ] ; then echo "CPUFLAGS=Unknown" else echo "CPUFLAGS=None" fi display_hw_details exit fi if [ -z "$FLAGS" -a -z "$NONE" ] ; then echo 'Unknown machine - please send details to abs@netbsd.org' >&2 display_hw_details >&2 fi # Fixup options for older gccs. # Entries can be recursive - eg: # -march=k6-3 -> -march=k6 -> -march=pentium -> -march=i486 # # The format of table is # gcc_version_in_which_option_was_introduced new_option old_option if [ -n "$FLAGS" ]; then gcc_ver=`${CC} -dumpversion | sed 's/^egcs-//'` FLAGS=`awk -F: -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" ' { if (gcc_ver < $1){map[$2] = ""$3} } END { while (flags in map) {flags = map[flags]} print flags } ' <