In legion build config, updated path to GNU tools and updated deprecated Sun CC flag...
[OpenSPARC-T2-SAM] / legion / src / configure.opensparc
CommitLineData
920dae64
AT
1#!/bin/sh
2
3#
4# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
5# Use is subject to license terms.
6#
7# ident "@(#)configure.opensparc 1.1 07/10/12 SMI"
8#
9
10# Eventually this will be a real GNU autoconfig script
11# but for now we hack something for a Sun 64bit SPARC host
12
13# Roll this number if ever you edit this file !
14version=1
15
16if [ "$#" = "2" ] ; then
17 if [ "$1" = "testconfigure" ] ; then
18 if [ "$2" != "$version" ] ; then
19 echo configure script in source tree does not match build area configuration
20 echo please re-configure your build area
21 exit 1
22 fi
23 echo Configuration is current
24 exit 0
25 else
26 echo Illegal arguments $*
27 exit 1
28 fi
29fi
30
31
32#
33# Now some nasty hacks to figure out what kind of CPU we're on ...
34# More of these again when we get Opterons to play with.
35#
36
37case `uname -s` in
38SunOS)
39 case `uname -r` in
40 5.8|5.9|5.10*|5.11)
41 ostype=solaris9 ;;
42 *)
43 echo "Unsupported version of Solaris"
44 exit 1
45 ;;
46 esac
47 case `/bin/isainfo -n` in
48 sparcv9)
49 case `/bin/isainfo -b` in
50 64)
51 cputype=sparcv9 ;;
52 *)
53 echo "64bit sparcv9 mode requried"
54 exit 1
55 ;;
56 esac
57 ;;
58
59 amd64)
60 case `/bin/isainfo -b` in
61 64)
62 cputype=i686 ;;
63 *)
64 echo "64bit amd64 mode requried"
65 exit 1
66 ;;
67 esac
68 ;;
69
70 i386)
71 cputype=i386
72 ;;
73
74 *)
75 echo "Sparc v9 CPU required"
76 exit 1
77 ;;
78 esac
79 ;;
80Linux)
81 ostype=linux
82 cputype=`uname -m`
83 ;;
84*)
85 echo "Unable to identify host OS aborting configure"
86 exit 1
87 ;;
88esac
89
90processortype=`uname -m`-`uname -p`
91
92echo "Configuring for: OS=$ostype CPU=$cputype"
93
94combined="$ostype-$cputype"
95echo $combined
96
97case $combined in
98solaris9-sparcv9)
99 toolspath="$SUN_STUDIO/bin"
512be353 100 gnupath="/usr/sfw/bin"
920dae64
AT
101
102 mf_as="/usr/ccs/bin/as"
103 mf_asflags="-xarch=v9a"
104 mf_cc="$toolspath/cc"
105 mf_cplus="$toolspath/CC"
512be353
AT
106 mf_cflags="-xildoff -xO0 -g -m64 -v -mt -xcode=pic32 -KPIC"
107 mf_cflags_nondebug="-xildoff -xspace -xO3 -fast -m64 -v -mt -xcode=pic32 -KPIC"
920dae64
AT
108 mf_cpp="$gnupath/cpp"
109 mf_flex="$gnupath/flex"
110
111 mf_sharedcflags=
112 mf_sharedlibflags="-G -L ./plugins"
512be353 113 mf_ldflags="-m64 -R'\$\$ORIGIN/plugins'"
920dae64
AT
114 mf_loadlibs="-lpthread -lsocket -lnsl -lm -lc -ldl"
115
116 mf_def="-DHOST_OS_SOLARIS9=1 -DHOST_CPU_SPARC_V9=1"
117 vdisk=1
118 fpsim=yes
119 ;;
120
121solaris9-i686)
122 toolspath="$SUN_STUDIO/bin"
123 gnupath="/pkg/gnu/bin"
124
125 xaf="-xarch=amd64 -xmodel=medium"
126 mf_as="/usr/ccs/bin/as"
127 mf_asflags="$xaf"
128 mf_cc="$toolspath/cc"
129 mf_cplus="$toolspath/CC"
130 mf_cflags="-xildoff -xbuiltin -xO0 -g $xaf -Ui386 -U__i386 -v -mt"
131 mf_cflags_nondebug="-xildoff -xbuiltin -xspace -xO3 -fast $xaf -Ui386 -U__i386 -v -mt"
132 mf_cpp="$gnupath/cpp"
133 mf_flex="$gnupath/flex"
134
135 mf_sharedcflags="-K pic"
136 mf_sharedlibflags="-G -L ./plugins"
137 mf_ldflags="$xaf -R'\$\$ORIGIN/plugins'"
138 mf_loadlibs="-lpthread -lsocket -lnsl -lm -lc -ldl"
139
140 mf_def="-DHOST_OS_SOLARIS9=1 -DHOST_CPU_I686=1"
141 vdisk=0
142 fpsim=no
143 ;;
144
145solaris9-i386)
146 toolspath="$SUN_STUDIO/bin"
147 gnupath="/pkg/gnu/bin"
148
149 xaf="-xarch=sse2"
150 xafs=""
151 mf_as="/usr/ccs/bin/as"
152 mf_asflags="$xafs"
153 mf_cc="$toolspath/cc"
154 mf_cplus="$toolspath/CC"
155 mf_cflags="-xildoff -xbuiltin -xO0 -g $xaf -v -mt"
156 mf_cflags_nondebug="-xildoff -xbuiltin -xspace -xO3 -fast $xaf -v -mt"
157 mf_cpp="$gnupath/cpp"
158 mf_flex="$gnupath/flex"
159
160 mf_sharedcflags="-K pic"
161 mf_sharedlibflags="-G -L ./plugins"
162 mf_ldflags="$xaf -R'\$\$ORIGIN/plugins'"
163 mf_loadlibs="-lpthread -lsocket -lnsl -lm -lc -ldl"
164
165 mf_def="-DHOST_OS_SOLARIS9=1 -DHOST_CPU_I386=1"
166 vdisk=0
167 fpsim=no
168 ;;
169
170linux-i686)
171 mf_as="/usr/bin/as"
172 mf_asflags=""
173 mf_cc="/usr/bin/gcc"
174 mf_cplus="/pkg/gnu/bin/g++"
175 mf_cflags="-g -Wall"
176 mf_cflags_nondebug="-Wall"
177 mf_cpp="/usr/bin/cpp"
178 mf_flex="/usr/bin/flex"
179
180 mf_sharedcflags=
181 mf_sharedlibflags="-shared -fPIC"
182 mf_ldflags=-rdynamic
183 mf_loadlibs=-lpthread -lm -lc -ldl
184
185 mf_def="-DHOST_OS_LINUX=1 -DHOST_CPU_I686=1"
186 vdisk=0
187 fpsim=no
188 ;;
189
190*)
191 echo "internal error"
192 exit 1
193 ;;
194esac
195
196if [ "$fpsim" = "yes" ]
197then
198 fpsimcomment=""
199else
200 fpsimcomment="#"
201fi
202
203
204srcdir=`dirname $0`
205targdir=`pwd`
206
207rm -f $targdir/Makefile $targdir/GNUmakefile $targdir/Makefile.tools
208
209cat >> $targdir/GNUmakefile << EOF
210# Autogenerated Makefile for simulator - DO NOT EDIT
211
212CONFVER=$version
213SRCDIR=$srcdir
214DESTDIR=$targdir
215OBJDIR=\$(DESTDIR)
216
217#
218# By default we build a non-debug version of legion which is optimised
219# to run fast but is not suitable for debugging (using gdb or dbx).
220# For an Debug version, comment out the NON_DEBUG_BUILD line below.
221#
222NON_DEBUG_BUILD=yes
223
224#
225RELEASE=EXTERNAL
226
227$(RELEASE)_BUILD=true
228
229
230${fpsimcomment}BUILDFPSIM=yes
231
232#
233# By default we let the C preprocessor expand macros as part of
234# the compilation process, by for some of the more convoluted files
235# it is sometimes useful when debugging to have a pre-processed source
236# file to debug against instead of the original macro-laden version.
237# define this variable to select this option. By default it is disabled.
238#REMOVEMACROS=yes
239
240
241# ENABLE_MAGIC_TRAPS Enables the use of what ever magic traps have been
242# defined for your target CPU(s)
243#
244# PERFORMANCE_CHECK Enables the generation of per-thread performance
245# statistics gathering. Useful if you want to look at
246# how well the simulator is doing on instruction
247# throughput.
248#
249# ERROR_INJECTION Enables the generation of correctible and uncorrectible
250# errors using the error configuration information
251# provided in the .conf file. See README.error_inject
252# for more details.
253#
254# CONSOLE_RESET Enable the serial console device to force a reset of
255# any processor within its same domain.
256#
257# DEBUG_TL_RAISE Compiling with these flags causes legion to
258# DEBUG_GL_RAISE trash GL or TL levels when the %tl or %gl
259# registers are written with lower values by
260# privileged code. This catches any old
261# remaining assumptions that disrupting
262# traps cannot happen with interrupt enable off.
263# In sun4v the hypervisor can receive such traps
264# so the guest OS needs to be careful. This debug
265# tests the guest's compliance with the new usage
266# rules.
267#
268# VDISK_SUPPORT Include memory device 'virtual_disk' support.
269#
270# ERROR_TRAP_GEN Value of 1 enables the Error Trap Generation framework.
271# value of 2 also enables legion diagnostic messages for
272# this framework.
273#
274# WALL_TIME Includes support for the '--walltime' option which
275# scales TICK/STICK to the hosts TOD instead of
276# the default case of legion's TOD being scaled to
277# TICK(STICK) that tracks simulated instruction count.
278#
279# HYPERPRIVILEGED_USE_WARN When not zero, enables EXEC_WARNINGs when some
280# instruction or feature is used unexpectedly in
281# hyperprivileged mode, eg save/restore
282#
283# VERBOSE If defined, legion will print all messages, otherwise
284# only essential messages will be printed. The user can
285# override this using the -v or --verbose option.
286#
287# INTERNAL_BUILD Is used to control whether something should be built
288# for Internal use only.
289#
290#############################################################################
291
292
293#
294# INTERNAL used for Sun Development projects
295#
296INTERNAL_DEFINES =
297INTERNAL_DEFINES += -DINTERNAL_BUILD=1
298INTERNAL_DEFINES += -DVERBOSE=1
299INTERNAL_DEFINES += -DERROR_TRAP_GEN=0
300INTERNAL_DEFINES += -DPERFORMANCE_CHECK=0
301INTERNAL_DEFINES += -DERROR_INJECTION=0
302INTERNAL_DEFINES += -DHYPERPRIVILEGED_USE_WARN=0
303INTERNAL_DEFINES += -DFAKE_SAM=1
304INTERNAL_DEFINES += -DDEBUG_SAM_MODULES=0
305INTERNAL_DEFINES += -DROCK_ERRATA_8BYTE_ALIGN=1
306
307#
308# EXTERNAL used for OpenSparc Release
309#
310EXTERNAL_DEFINES =
311EXTERNAL_DEFINES += -DINTERNAL_BUILD=0
312EXTERNAL_DEFINES += -DVERBOSE=0
313
314#
315# COMMON Defines used for all builds
316#
317COMMON_DEFINES = $mf_def
318COMMON_DEFINES += -DDEBUG=1
319#COMMON_DEFINES += -DNDEBUG=1
320COMMON_DEFINES += -DCONSOLE_RESET=1
321COMMON_DEFINES += -DDEBUG_TL_RAISE=0
322COMMON_DEFINES += -DDEBUG_GL_RAISE=0
323COMMON_DEFINES += -DVDISK_SUPPORT=$vdisk
324COMMON_DEFINES += -DWALL_TIME=1
325COMMON_DEFINES += -DENABLE_MAGIC_TRAPS=1
326
327DEFINES = $($(RELEASE)_DEFINES) $(COMMON_DEFINES)
328
329
330ifdef NON_DEBUG_BUILD
331 #NON-DEBUG Build - faster, optimised, not suitable for debugger use
332 CFLAGS=$mf_cflags_nondebug -DNON_DEBUG_BUILD=1
333 ifndef INTERNAL_BUILD
334 # strip symbols for external release
335 CFLAGS+= -s
336 endif
337
338else
339 #DEBUG Build - slower, needed for gdb/dbx debugging
340 CFLAGS=$mf_cflags -DDEBUG_BUILD=1
341endif
342
343
344#
345# include the paths to all our tools
346#
347include ./Makefile.tools
348
349#
350# Additional flags and options
351#
352ASFLAGS=$mf_asflags
353SHAREDLIB_CFLAGS=$mf_sharedcflags
354SHAREDLIB_FLAGS=\$(SHAREDLIB_CFLAGS) $mf_sharedlibflags
355LDFLAGS=$mf_ldflags
356LOADLIBS=$mf_loadlibs
357
358
359include $srcdir/Makefile.top
360EOF
361
362cat >> $targdir/Makefile.tools << EOF
363#
364# Generic paths to compilers/tools
365#
366# DO NOT EDIT THIS FILE:
367# (any changes will be overwritten the next time the configure script is run)
368#
369AS=$mf_as
370CC=$mf_cc
371CPLUS=$mf_cplus
372
373CPP=$mf_cpp
374LEX=$mf_flex
375
376LN=/usr/bin/ln
377CSCOPE=$SUN_STUDIO/bin/cscope
378
379MAKEDEPEND=/usr/openwin/bin/makedepend -f .depend
380
381EOF
382
383cat >> $targdir/Makefile << EOF
384all clean:
385 @echo 1>&2 ""
386 @echo 1>&2 ""
387 @echo 1>&2 "\t\tUse GNU make (/pkg/gnu/bin/gmake)"
388 @echo 1>&2 ""
389 @echo 1>&2 ""
390 @env PATH=/pkg/gnu/bin:/pkg/local/bin:\${PATH} gmake \${MFLAGS} \$@
391EOF
392
393rm -f $targdir/dumbblue.conf && ln -s $srcdir/config/dumbblue.conf $targdir/dumbblue.conf
394rm -f $targdir/hostnative_asm.S && ln -s $srcdir/host/${cputype}native.S $targdir/hostnative_asm.S
395rm -f $targdir/hostnative.c && ln -s $srcdir/host/${cputype}native.c $targdir/hostnative.c
396rm -f $targdir/hostnative_ua200x.c
397if [ "$fpsim" = "yes" ]
398then
399 ln -s $srcdir/host/${cputype}native_ua200x.c $targdir/hostnative_ua200x.c
400fi
401rm -f $targdir/hostcpu.h && ln -s $srcdir/host/${cputype}.h $targdir/hostcpu.h
402rm -f $targdir/hostos.h && ln -s $srcdir/host/${ostype}.h $targdir/hostos.h