Commit | Line | Data |
---|---|---|
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 ! | |
14 | version=1 | |
15 | ||
16 | if [ "$#" = "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 | |
29 | fi | |
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 | ||
37 | case `uname -s` in | |
38 | SunOS) | |
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 | ;; | |
80 | Linux) | |
81 | ostype=linux | |
82 | cputype=`uname -m` | |
83 | ;; | |
84 | *) | |
85 | echo "Unable to identify host OS aborting configure" | |
86 | exit 1 | |
87 | ;; | |
88 | esac | |
89 | ||
90 | processortype=`uname -m`-`uname -p` | |
91 | ||
92 | echo "Configuring for: OS=$ostype CPU=$cputype" | |
93 | ||
94 | combined="$ostype-$cputype" | |
95 | echo $combined | |
96 | ||
97 | case $combined in | |
98 | solaris9-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 | ||
121 | solaris9-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 | ||
145 | solaris9-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 | ||
170 | linux-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 | ;; | |
194 | esac | |
195 | ||
196 | if [ "$fpsim" = "yes" ] | |
197 | then | |
198 | fpsimcomment="" | |
199 | else | |
200 | fpsimcomment="#" | |
201 | fi | |
202 | ||
203 | ||
204 | srcdir=`dirname $0` | |
205 | targdir=`pwd` | |
206 | ||
207 | rm -f $targdir/Makefile $targdir/GNUmakefile $targdir/Makefile.tools | |
208 | ||
209 | cat >> $targdir/GNUmakefile << EOF | |
210 | # Autogenerated Makefile for simulator - DO NOT EDIT | |
211 | ||
212 | CONFVER=$version | |
213 | SRCDIR=$srcdir | |
214 | DESTDIR=$targdir | |
215 | OBJDIR=\$(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 | # | |
222 | NON_DEBUG_BUILD=yes | |
223 | ||
224 | # | |
225 | RELEASE=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 | # | |
296 | INTERNAL_DEFINES = | |
297 | INTERNAL_DEFINES += -DINTERNAL_BUILD=1 | |
298 | INTERNAL_DEFINES += -DVERBOSE=1 | |
299 | INTERNAL_DEFINES += -DERROR_TRAP_GEN=0 | |
300 | INTERNAL_DEFINES += -DPERFORMANCE_CHECK=0 | |
301 | INTERNAL_DEFINES += -DERROR_INJECTION=0 | |
302 | INTERNAL_DEFINES += -DHYPERPRIVILEGED_USE_WARN=0 | |
303 | INTERNAL_DEFINES += -DFAKE_SAM=1 | |
304 | INTERNAL_DEFINES += -DDEBUG_SAM_MODULES=0 | |
305 | INTERNAL_DEFINES += -DROCK_ERRATA_8BYTE_ALIGN=1 | |
306 | ||
307 | # | |
308 | # EXTERNAL used for OpenSparc Release | |
309 | # | |
310 | EXTERNAL_DEFINES = | |
311 | EXTERNAL_DEFINES += -DINTERNAL_BUILD=0 | |
312 | EXTERNAL_DEFINES += -DVERBOSE=0 | |
313 | ||
314 | # | |
315 | # COMMON Defines used for all builds | |
316 | # | |
317 | COMMON_DEFINES = $mf_def | |
318 | COMMON_DEFINES += -DDEBUG=1 | |
319 | #COMMON_DEFINES += -DNDEBUG=1 | |
320 | COMMON_DEFINES += -DCONSOLE_RESET=1 | |
321 | COMMON_DEFINES += -DDEBUG_TL_RAISE=0 | |
322 | COMMON_DEFINES += -DDEBUG_GL_RAISE=0 | |
323 | COMMON_DEFINES += -DVDISK_SUPPORT=$vdisk | |
324 | COMMON_DEFINES += -DWALL_TIME=1 | |
325 | COMMON_DEFINES += -DENABLE_MAGIC_TRAPS=1 | |
326 | ||
327 | DEFINES = $($(RELEASE)_DEFINES) $(COMMON_DEFINES) | |
328 | ||
329 | ||
330 | ifdef 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 | ||
338 | else | |
339 | #DEBUG Build - slower, needed for gdb/dbx debugging | |
340 | CFLAGS=$mf_cflags -DDEBUG_BUILD=1 | |
341 | endif | |
342 | ||
343 | ||
344 | # | |
345 | # include the paths to all our tools | |
346 | # | |
347 | include ./Makefile.tools | |
348 | ||
349 | # | |
350 | # Additional flags and options | |
351 | # | |
352 | ASFLAGS=$mf_asflags | |
353 | SHAREDLIB_CFLAGS=$mf_sharedcflags | |
354 | SHAREDLIB_FLAGS=\$(SHAREDLIB_CFLAGS) $mf_sharedlibflags | |
355 | LDFLAGS=$mf_ldflags | |
356 | LOADLIBS=$mf_loadlibs | |
357 | ||
358 | ||
359 | include $srcdir/Makefile.top | |
360 | EOF | |
361 | ||
362 | cat >> $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 | # | |
369 | AS=$mf_as | |
370 | CC=$mf_cc | |
371 | CPLUS=$mf_cplus | |
372 | ||
373 | CPP=$mf_cpp | |
374 | LEX=$mf_flex | |
375 | ||
376 | LN=/usr/bin/ln | |
377 | CSCOPE=$SUN_STUDIO/bin/cscope | |
378 | ||
379 | MAKEDEPEND=/usr/openwin/bin/makedepend -f .depend | |
380 | ||
381 | EOF | |
382 | ||
383 | cat >> $targdir/Makefile << EOF | |
384 | all 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} \$@ | |
391 | EOF | |
392 | ||
393 | rm -f $targdir/dumbblue.conf && ln -s $srcdir/config/dumbblue.conf $targdir/dumbblue.conf | |
394 | rm -f $targdir/hostnative_asm.S && ln -s $srcdir/host/${cputype}native.S $targdir/hostnative_asm.S | |
395 | rm -f $targdir/hostnative.c && ln -s $srcdir/host/${cputype}native.c $targdir/hostnative.c | |
396 | rm -f $targdir/hostnative_ua200x.c | |
397 | if [ "$fpsim" = "yes" ] | |
398 | then | |
399 | ln -s $srcdir/host/${cputype}native_ua200x.c $targdir/hostnative_ua200x.c | |
400 | fi | |
401 | rm -f $targdir/hostcpu.h && ln -s $srcdir/host/${cputype}.h $targdir/hostcpu.h | |
402 | rm -f $targdir/hostos.h && ln -s $srcdir/host/${ostype}.h $targdir/hostos.h |