# 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 !
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
echo Configuration is current
echo Illegal arguments $
*
# 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.
echo "Unsupported version of Solaris"
case `/bin/isainfo -n` in
case `/bin/isainfo -b` in
echo "64bit sparcv9 mode requried"
case `/bin/isainfo -b` in
echo "64bit amd64 mode requried"
echo "Sparc v9 CPU required"
echo "Unable to identify host OS aborting configure"
processortype
=`uname -m`-`uname -p`
echo "Configuring for: OS=$ostype CPU=$cputype"
combined
="$ostype-$cputype"
toolspath
="$SUN_STUDIO/bin"
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_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"
toolspath
="$SUN_STUDIO/bin"
xaf
="-xarch=amd64 -xmodel=medium"
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_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"
toolspath
="$SUN_STUDIO/bin"
mf_cflags
="-xildoff -xbuiltin -xO0 -g $xaf -v -mt"
mf_cflags_nondebug
="-xildoff -xbuiltin -xspace -xO3 -fast $xaf -v -mt"
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"
mf_cplus
="/pkg/gnu/bin/g++"
mf_cflags_nondebug
="-Wall"
mf_sharedlibflags
="-shared -fPIC"
mf_loadlibs
=-lpthread -lm -lc -ldl
mf_def
="-DHOST_OS_LINUX=1 -DHOST_CPU_I686=1"
rm -f $targdir/Makefile
$targdir/GNUmakefile
$targdir/Makefile.tools
cat >> $targdir/GNUmakefile
<< EOF
# Autogenerated Makefile for simulator - DO NOT EDIT
# 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.
${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.
# 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
# ERROR_INJECTION Enables the generation of correctible and uncorrectible
# errors using the error configuration information
# provided in the .conf file. See README.error_inject
# 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
# 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
# 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
#############################################################################
# INTERNAL used for Sun Development projects
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 += -DINTERNAL_BUILD=0
EXTERNAL_DEFINES += -DVERBOSE=0
# COMMON Defines used for all builds
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)
#NON-DEBUG Build - faster, optimised, not suitable for debugger use
CFLAGS=$mf_cflags_nondebug -DNON_DEBUG_BUILD=1
# strip symbols for external release
#DEBUG Build - slower, needed for gdb/dbx debugging
CFLAGS=$mf_cflags -DDEBUG_BUILD=1
# include the paths to all our tools
# Additional flags and options
SHAREDLIB_CFLAGS=$mf_sharedcflags
SHAREDLIB_FLAGS=\$(SHAREDLIB_CFLAGS) $mf_sharedlibflags
include $srcdir/Makefile.top
cat >> $targdir/Makefile.tools
<< EOF
# Generic paths to compilers/tools
# (any changes will be overwritten the next time the configure script is run)
CSCOPE=$SUN_STUDIO/bin/cscope
MAKEDEPEND=/usr/openwin/bin/makedepend -f .depend
cat >> $targdir/Makefile
<< EOF
@echo 1>&2 "\t\tUse GNU make (/pkg/gnu/bin/gmake)"
@env PATH=/pkg/gnu/bin:/pkg/local/bin:\${PATH} gmake \${MFLAGS} \$@
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
ln -s $srcdir/host
/${cputype}native_ua200x.c
$targdir/hostnative_ua200x.c
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