#!/bin/sh # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)configure.opensparc 1.1 07/10/12 SMI" # # Eventually this will be a real GNU autoconfig script # but for now we hack something for a Sun 64bit SPARC host # Roll this number if ever you edit this file ! version=1 if [ "$#" = "2" ] ; then if [ "$1" = "testconfigure" ] ; then if [ "$2" != "$version" ] ; then echo configure script in source tree does not match build area configuration echo please re-configure your build area exit 1 fi echo Configuration is current exit 0 else echo Illegal arguments $* exit 1 fi fi # # Now some nasty hacks to figure out what kind of CPU we're on ... # More of these again when we get Opterons to play with. # case `uname -s` in SunOS) case `uname -r` in 5.8|5.9|5.10*|5.11) ostype=solaris9 ;; *) echo "Unsupported version of Solaris" exit 1 ;; esac case `/bin/isainfo -n` in sparcv9) case `/bin/isainfo -b` in 64) cputype=sparcv9 ;; *) echo "64bit sparcv9 mode requried" exit 1 ;; esac ;; amd64) case `/bin/isainfo -b` in 64) cputype=i686 ;; *) echo "64bit amd64 mode requried" exit 1 ;; esac ;; i386) cputype=i386 ;; *) echo "Sparc v9 CPU required" exit 1 ;; esac ;; Linux) ostype=linux cputype=`uname -m` ;; *) echo "Unable to identify host OS aborting configure" exit 1 ;; esac processortype=`uname -m`-`uname -p` echo "Configuring for: OS=$ostype CPU=$cputype" combined="$ostype-$cputype" echo $combined case $combined in solaris9-sparcv9) toolspath="$SUN_STUDIO/bin" gnupath="/pkg/gnu/bin" mf_as="/usr/ccs/bin/as" mf_asflags="-xarch=v9a" mf_cc="$toolspath/cc" mf_cplus="$toolspath/CC" mf_cflags="-xildoff -xO0 -g -xarch=v9 -v -mt -xcode=pic32 -KPIC" mf_cflags_nondebug="-xildoff -xspace -xO3 -fast -xarch=v9 -v -mt -xcode=pic32 -KPIC" mf_cpp="$gnupath/cpp" mf_flex="$gnupath/flex" mf_sharedcflags= mf_sharedlibflags="-G -L ./plugins" mf_ldflags="-xarch=v9 -R'\$\$ORIGIN/plugins'" mf_loadlibs="-lpthread -lsocket -lnsl -lm -lc -ldl" mf_def="-DHOST_OS_SOLARIS9=1 -DHOST_CPU_SPARC_V9=1" vdisk=1 fpsim=yes ;; solaris9-i686) toolspath="$SUN_STUDIO/bin" gnupath="/pkg/gnu/bin" xaf="-xarch=amd64 -xmodel=medium" mf_as="/usr/ccs/bin/as" mf_asflags="$xaf" mf_cc="$toolspath/cc" mf_cplus="$toolspath/CC" mf_cflags="-xildoff -xbuiltin -xO0 -g $xaf -Ui386 -U__i386 -v -mt" mf_cflags_nondebug="-xildoff -xbuiltin -xspace -xO3 -fast $xaf -Ui386 -U__i386 -v -mt" mf_cpp="$gnupath/cpp" mf_flex="$gnupath/flex" mf_sharedcflags="-K pic" mf_sharedlibflags="-G -L ./plugins" mf_ldflags="$xaf -R'\$\$ORIGIN/plugins'" mf_loadlibs="-lpthread -lsocket -lnsl -lm -lc -ldl" mf_def="-DHOST_OS_SOLARIS9=1 -DHOST_CPU_I686=1" vdisk=0 fpsim=no ;; solaris9-i386) toolspath="$SUN_STUDIO/bin" gnupath="/pkg/gnu/bin" xaf="-xarch=sse2" xafs="" mf_as="/usr/ccs/bin/as" mf_asflags="$xafs" mf_cc="$toolspath/cc" mf_cplus="$toolspath/CC" mf_cflags="-xildoff -xbuiltin -xO0 -g $xaf -v -mt" mf_cflags_nondebug="-xildoff -xbuiltin -xspace -xO3 -fast $xaf -v -mt" mf_cpp="$gnupath/cpp" mf_flex="$gnupath/flex" mf_sharedcflags="-K pic" mf_sharedlibflags="-G -L ./plugins" mf_ldflags="$xaf -R'\$\$ORIGIN/plugins'" mf_loadlibs="-lpthread -lsocket -lnsl -lm -lc -ldl" mf_def="-DHOST_OS_SOLARIS9=1 -DHOST_CPU_I386=1" vdisk=0 fpsim=no ;; linux-i686) mf_as="/usr/bin/as" mf_asflags="" mf_cc="/usr/bin/gcc" mf_cplus="/pkg/gnu/bin/g++" mf_cflags="-g -Wall" mf_cflags_nondebug="-Wall" mf_cpp="/usr/bin/cpp" mf_flex="/usr/bin/flex" mf_sharedcflags= mf_sharedlibflags="-shared -fPIC" mf_ldflags=-rdynamic mf_loadlibs=-lpthread -lm -lc -ldl mf_def="-DHOST_OS_LINUX=1 -DHOST_CPU_I686=1" vdisk=0 fpsim=no ;; *) echo "internal error" exit 1 ;; esac if [ "$fpsim" = "yes" ] then fpsimcomment="" else fpsimcomment="#" fi srcdir=`dirname $0` targdir=`pwd` rm -f $targdir/Makefile $targdir/GNUmakefile $targdir/Makefile.tools cat >> $targdir/GNUmakefile << EOF # Autogenerated Makefile for simulator - DO NOT EDIT CONFVER=$version SRCDIR=$srcdir DESTDIR=$targdir OBJDIR=\$(DESTDIR) # # By default we build a non-debug version of legion which is optimised # to run fast but is not suitable for debugging (using gdb or dbx). # For an Debug version, comment out the NON_DEBUG_BUILD line below. # NON_DEBUG_BUILD=yes # RELEASE=EXTERNAL $(RELEASE)_BUILD=true ${fpsimcomment}BUILDFPSIM=yes # # By default we let the C preprocessor expand macros as part of # the compilation process, by for some of the more convoluted files # it is sometimes useful when debugging to have a pre-processed source # file to debug against instead of the original macro-laden version. # define this variable to select this option. By default it is disabled. #REMOVEMACROS=yes # ENABLE_MAGIC_TRAPS Enables the use of what ever magic traps have been # defined for your target CPU(s) # # PERFORMANCE_CHECK Enables the generation of per-thread performance # statistics gathering. Useful if you want to look at # how well the simulator is doing on instruction # throughput. # # ERROR_INJECTION Enables the generation of correctible and uncorrectible # errors using the error configuration information # provided in the .conf file. See README.error_inject # for more details. # # CONSOLE_RESET Enable the serial console device to force a reset of # any processor within its same domain. # # DEBUG_TL_RAISE Compiling with these flags causes legion to # DEBUG_GL_RAISE trash GL or TL levels when the %tl or %gl # registers are written with lower values by # privileged code. This catches any old # remaining assumptions that disrupting # traps cannot happen with interrupt enable off. # In sun4v the hypervisor can receive such traps # so the guest OS needs to be careful. This debug # tests the guest's compliance with the new usage # rules. # # VDISK_SUPPORT Include memory device 'virtual_disk' support. # # ERROR_TRAP_GEN Value of 1 enables the Error Trap Generation framework. # value of 2 also enables legion diagnostic messages for # this framework. # # WALL_TIME Includes support for the '--walltime' option which # scales TICK/STICK to the hosts TOD instead of # the default case of legion's TOD being scaled to # TICK(STICK) that tracks simulated instruction count. # # HYPERPRIVILEGED_USE_WARN When not zero, enables EXEC_WARNINGs when some # instruction or feature is used unexpectedly in # hyperprivileged mode, eg save/restore # # VERBOSE If defined, legion will print all messages, otherwise # only essential messages will be printed. The user can # override this using the -v or --verbose option. # # INTERNAL_BUILD Is used to control whether something should be built # for Internal use only. # ############################################################################# # # INTERNAL used for Sun Development projects # INTERNAL_DEFINES = INTERNAL_DEFINES += -DINTERNAL_BUILD=1 INTERNAL_DEFINES += -DVERBOSE=1 INTERNAL_DEFINES += -DERROR_TRAP_GEN=0 INTERNAL_DEFINES += -DPERFORMANCE_CHECK=0 INTERNAL_DEFINES += -DERROR_INJECTION=0 INTERNAL_DEFINES += -DHYPERPRIVILEGED_USE_WARN=0 INTERNAL_DEFINES += -DFAKE_SAM=1 INTERNAL_DEFINES += -DDEBUG_SAM_MODULES=0 INTERNAL_DEFINES += -DROCK_ERRATA_8BYTE_ALIGN=1 # # EXTERNAL used for OpenSparc Release # EXTERNAL_DEFINES = EXTERNAL_DEFINES += -DINTERNAL_BUILD=0 EXTERNAL_DEFINES += -DVERBOSE=0 # # COMMON Defines used for all builds # COMMON_DEFINES = $mf_def COMMON_DEFINES += -DDEBUG=1 #COMMON_DEFINES += -DNDEBUG=1 COMMON_DEFINES += -DCONSOLE_RESET=1 COMMON_DEFINES += -DDEBUG_TL_RAISE=0 COMMON_DEFINES += -DDEBUG_GL_RAISE=0 COMMON_DEFINES += -DVDISK_SUPPORT=$vdisk COMMON_DEFINES += -DWALL_TIME=1 COMMON_DEFINES += -DENABLE_MAGIC_TRAPS=1 DEFINES = $($(RELEASE)_DEFINES) $(COMMON_DEFINES) ifdef NON_DEBUG_BUILD #NON-DEBUG Build - faster, optimised, not suitable for debugger use CFLAGS=$mf_cflags_nondebug -DNON_DEBUG_BUILD=1 ifndef INTERNAL_BUILD # strip symbols for external release CFLAGS+= -s endif else #DEBUG Build - slower, needed for gdb/dbx debugging CFLAGS=$mf_cflags -DDEBUG_BUILD=1 endif # # include the paths to all our tools # include ./Makefile.tools # # Additional flags and options # ASFLAGS=$mf_asflags SHAREDLIB_CFLAGS=$mf_sharedcflags SHAREDLIB_FLAGS=\$(SHAREDLIB_CFLAGS) $mf_sharedlibflags LDFLAGS=$mf_ldflags LOADLIBS=$mf_loadlibs include $srcdir/Makefile.top EOF cat >> $targdir/Makefile.tools << EOF # # Generic paths to compilers/tools # # DO NOT EDIT THIS FILE: # (any changes will be overwritten the next time the configure script is run) # AS=$mf_as CC=$mf_cc CPLUS=$mf_cplus CPP=$mf_cpp LEX=$mf_flex LN=/usr/bin/ln CSCOPE=$SUN_STUDIO/bin/cscope MAKEDEPEND=/usr/openwin/bin/makedepend -f .depend EOF cat >> $targdir/Makefile << EOF all clean: @echo 1>&2 "" @echo 1>&2 "" @echo 1>&2 "\t\tUse GNU make (/pkg/gnu/bin/gmake)" @echo 1>&2 "" @echo 1>&2 "" @env PATH=/pkg/gnu/bin:/pkg/local/bin:\${PATH} gmake \${MFLAGS} \$@ EOF rm -f $targdir/dumbblue.conf && ln -s $srcdir/config/dumbblue.conf $targdir/dumbblue.conf rm -f $targdir/hostnative_asm.S && ln -s $srcdir/host/${cputype}native.S $targdir/hostnative_asm.S rm -f $targdir/hostnative.c && ln -s $srcdir/host/${cputype}native.c $targdir/hostnative.c rm -f $targdir/hostnative_ua200x.c if [ "$fpsim" = "yes" ] then ln -s $srcdir/host/${cputype}native_ua200x.c $targdir/hostnative_ua200x.c fi rm -f $targdir/hostcpu.h && ln -s $srcdir/host/${cputype}.h $targdir/hostcpu.h rm -f $targdir/hostos.h && ln -s $srcdir/host/${ostype}.h $targdir/hostos.h