Commit | Line | Data |
---|---|---|
c906108c | 1 | dnl Process this file with autoconf to produce a configure script. |
b7026657 | 2 | AC_PREREQ(2.59)dnl |
c906108c | 3 | AC_INIT(Makefile.in) |
35695fd6 | 4 | AC_CONFIG_HEADER(config.h:config.in) |
c906108c | 5 | |
f0569246 | 6 | sinclude(../common/aclocal.m4) |
c906108c | 7 | |
35695fd6 AC |
8 | # Bugs in autoconf 2.59 break the call to SIM_AC_COMMON, hack around |
9 | # it by inlining the macro's contents. | |
10 | sinclude(../common/common.m4) | |
11 | ||
c906108c SS |
12 | dnl Options available in this module |
13 | SIM_AC_OPTION_INLINE() | |
14 | SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT) | |
15 | SIM_AC_OPTION_HOSTENDIAN | |
16 | SIM_AC_OPTION_WARNINGS | |
e6c674b8 | 17 | SIM_AC_OPTION_RESERVED_BITS(1) |
c906108c SS |
18 | |
19 | # DEPRECATED | |
20 | # | |
21 | # Instead of defining a `subtarget' macro, code should be checking | |
22 | # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture | |
23 | # in question. | |
24 | # | |
25 | case "${target}" in | |
4c54fc26 | 26 | mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; |
c906108c | 27 | mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";; |
109ad085 | 28 | mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; |
1e799e28 CD |
29 | mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; |
30 | mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; | |
c906108c SS |
31 | *) SIM_SUBTARGET="";; |
32 | esac | |
33 | AC_SUBST(SIM_SUBTARGET) | |
34 | ||
35 | ||
36 | ||
37 | # | |
38 | # Select the byte order of the target | |
39 | # | |
40 | mips_endian= | |
41 | default_endian= | |
42 | case "${target}" in | |
43 | mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;; | |
7a292a7a | 44 | mips64vr*el-*-*) default_endian=LITTLE_ENDIAN ;; |
c906108c SS |
45 | mips64*-*-*) default_endian=BIG_ENDIAN ;; |
46 | mips16*-*-*) default_endian=BIG_ENDIAN ;; | |
1e799e28 CD |
47 | mipsisa32*-*-*) default_endian=BIG_ENDIAN ;; |
48 | mipsisa64*-*-*) default_endian=BIG_ENDIAN ;; | |
c906108c SS |
49 | mips*-*-*) default_endian=BIG_ENDIAN ;; |
50 | *) default_endian=BIG_ENDIAN ;; | |
51 | esac | |
52 | SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian) | |
53 | ||
54 | ||
55 | ||
56 | # | |
57 | # Select the bitsize of the target | |
58 | # | |
59 | mips_addr_bitsize= | |
60 | case "${target}" in | |
4b5d35ee | 61 | mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;; |
c906108c SS |
62 | mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;; |
63 | mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;; | |
1e799e28 CD |
64 | mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;; |
65 | mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;; | |
c906108c SS |
66 | mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;; |
67 | *) mips_bitsize=64 ; mips_msb=63 ;; | |
68 | esac | |
69 | SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize) | |
70 | ||
71 | ||
72 | ||
73 | # | |
74 | # Select the floating hardware support of the target | |
75 | # | |
76 | mips_fpu=HARDWARE_FLOATING_POINT | |
77 | mips_fpu_bitsize= | |
78 | case "${target}" in | |
4b5d35ee TS |
79 | mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;; |
80 | mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;; | |
c906108c SS |
81 | mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;; |
82 | mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;; | |
1e799e28 CD |
83 | mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;; |
84 | mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;; | |
c906108c SS |
85 | mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;; |
86 | *) mips_fpu=HARD_FLOATING_POINT ;; | |
87 | esac | |
88 | SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize) | |
89 | ||
90 | ||
91 | ||
92 | # | |
93 | # Select the level of SMP support | |
94 | # | |
95 | case "${target}" in | |
96 | *) mips_smp=0 ;; | |
97 | esac | |
98 | SIM_AC_OPTION_SMP($mips_smp) | |
99 | ||
100 | ||
101 | ||
102 | # | |
103 | # Select the IGEN architecture | |
104 | # | |
105 | sim_gen=IGEN | |
106 | sim_igen_machine="-M mipsIV" | |
139181c8 | 107 | sim_m16_machine="-M mips16,mipsIII" |
c906108c SS |
108 | sim_igen_filter="32,64,f" |
109 | sim_m16_filter="16" | |
4c54fc26 CD |
110 | sim_mach_default="mips8000" |
111 | ||
c906108c SS |
112 | case "${target}" in |
113 | mips*tx39*) sim_gen=IGEN | |
114 | sim_igen_filter="32,f" | |
115 | sim_igen_machine="-M r3900" | |
116 | ;; | |
117 | mips64vr43*-*-*) sim_gen=IGEN | |
118 | sim_igen_machine="-M mipsIV" | |
4c54fc26 | 119 | sim_mach_default="mips8000" |
c906108c SS |
120 | ;; |
121 | mips64vr5*-*-*) sim_gen=IGEN | |
122 | sim_igen_machine="-M vr5000" | |
4c54fc26 | 123 | sim_mach_default="mips5000" |
c906108c SS |
124 | ;; |
125 | mips64vr41*) sim_gen=M16 | |
126 | sim_igen_machine="-M vr4100" | |
127 | sim_m16_machine="-M vr4100" | |
128 | sim_igen_filter="32,64,f" | |
129 | sim_m16_filter="16" | |
4c54fc26 | 130 | sim_mach_default="mips4100" |
c906108c | 131 | ;; |
4c54fc26 CD |
132 | mips64vr-*-* | mips64vrel-*-*) |
133 | sim_gen=MULTI | |
134 | sim_multi_configs="\ | |
135 | vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\ | |
136 | vr4120:mipsIII,mips16,vr4120:32,64:mips4120\ | |
137 | vr5000:mipsIV:32,64,f:mips4300,mips5000\ | |
138 | vr5400:mipsIV,vr5400:32,64,f:mips5400\ | |
139 | vr5500:mipsIV,vr5500:32,64,f:mips5500" | |
140 | sim_multi_default=mips5000 | |
141 | ;; | |
3669427c | 142 | mips*-sde-elf*) sim_gen=M16 |
8b082fb1 | 143 | sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips" |
3669427c TS |
144 | sim_m16_machine="-M mips16,mips16e,mips64r2" |
145 | sim_igen_filter="32,64,f" | |
146 | sim_mach_default="mipsisa64r2" | |
147 | ;; | |
c906108c SS |
148 | mips64*-*-*) sim_igen_filter="32,64,f" |
149 | sim_gen=IGEN | |
150 | ;; | |
151 | mips16*-*-*) sim_gen=M16 | |
152 | sim_igen_filter="32,64,f" | |
153 | sim_m16_filter="16" | |
154 | ;; | |
b16d63da | 155 | mipsisa32r2*-*-*) sim_gen=M16 |
8b082fb1 | 156 | sim_igen_machine="-M mips32r2,mips16,mips16e,mdmx,dsp,dsp2,smartmips" |
b16d63da | 157 | sim_m16_machine="-M mips16,mips16e,mips32r2" |
e70cb6cd CD |
158 | sim_igen_filter="32,f" |
159 | sim_mach_default="mipsisa32r2" | |
160 | ;; | |
b16d63da | 161 | mipsisa32*-*-*) sim_gen=M16 |
3669427c | 162 | sim_igen_machine="-M mips32,mips16,mips16e,smartmips" |
b16d63da | 163 | sim_m16_machine="-M mips16,mips16e,mips32" |
1e799e28 | 164 | sim_igen_filter="32,f" |
4c54fc26 | 165 | sim_mach_default="mipsisa32" |
1e799e28 | 166 | ;; |
b16d63da | 167 | mipsisa64r2*-*-*) sim_gen=M16 |
8b082fb1 | 168 | sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2" |
b16d63da | 169 | sim_m16_machine="-M mips16,mips16e,mips64r2" |
e70cb6cd CD |
170 | sim_igen_filter="32,64,f" |
171 | sim_mach_default="mipsisa64r2" | |
172 | ;; | |
7cbea089 | 173 | mipsisa64sb1*-*-*) sim_gen=IGEN |
109ad085 | 174 | sim_igen_machine="-M mips64,mips3d,sb1" |
7cbea089 | 175 | sim_igen_filter="32,64,f" |
4c54fc26 | 176 | sim_mach_default="mips_sb1" |
7cbea089 | 177 | ;; |
b16d63da | 178 | mipsisa64*-*-*) sim_gen=M16 |
3669427c | 179 | sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx" |
b16d63da | 180 | sim_m16_machine="-M mips16,mips16e,mips64" |
1e799e28 | 181 | sim_igen_filter="32,64,f" |
4c54fc26 | 182 | sim_mach_default="mipsisa64" |
1e799e28 | 183 | ;; |
109ad085 | 184 | mips*lsi*) sim_gen=M16 |
c906108c SS |
185 | sim_igen_machine="-M mipsIII,mips16" |
186 | sim_m16_machine="-M mips16,mipsIII" | |
187 | sim_igen_filter="32,f" | |
188 | sim_m16_filter="16" | |
4c54fc26 | 189 | sim_mach_default="mips4000" |
109ad085 | 190 | ;; |
c906108c SS |
191 | mips*-*-*) sim_gen=IGEN |
192 | sim_igen_filter="32,f" | |
193 | ;; | |
194 | esac | |
4c54fc26 CD |
195 | |
196 | # The MULTI generator can combine several simulation engines into one. | |
197 | # executable. A configuration which uses the MULTI should set two | |
198 | # variables: ${sim_multi_configs} and ${sim_multi_default}. | |
199 | # | |
200 | # ${sim_multi_configs} is the list of engines to build. Each | |
201 | # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS, | |
202 | # where: | |
203 | # | |
204 | # - NAME is a C-compatible prefix for the engine, | |
205 | # - MACHINE is a -M argument, | |
206 | # - FILTER is a -F argument, and | |
207 | # - BFDMACHS is a comma-separated list of bfd machines that the | |
208 | # simulator can run. | |
209 | # | |
210 | # Each entry will have a separate simulation engine whose prefix is | |
211 | # m32<NAME>. If the machine list includes "mips16", there will also | |
212 | # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be | |
213 | # generated using the same machine list as the 32-bit version, | |
214 | # but the filter will be "16" instead of FILTER. | |
215 | # | |
216 | # The simulator compares the bfd mach against BFDMACHS to decide | |
217 | # which engine to use. Entries in BFDMACHS should be bfd_mach | |
218 | # values with "bfd_mach_" removed. ${sim_multi_default} says | |
219 | # which entry should be the default. | |
220 | if test ${sim_gen} = MULTI; then | |
221 | ||
222 | # Simple sanity check. | |
223 | if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then | |
224 | AC_MSG_ERROR(Error in configure.in: MULTI simulator not set up correctly) | |
225 | fi | |
226 | ||
227 | # Start in a known state. | |
228 | rm -f multi-include.h multi-run.c | |
229 | sim_multi_flags= | |
230 | sim_multi_src= | |
231 | sim_multi_obj=multi-run.o | |
232 | sim_multi_igen_configs= | |
233 | sim_seen_default=no | |
234 | ||
235 | cat << __EOF__ > multi-run.c | |
236 | /* Main entry point for MULTI simulators. | |
237 | Copyright (C) 2003 Free Software Foundation, Inc. | |
238 | ||
239 | This program is free software; you can redistribute it and/or modify | |
240 | it under the terms of the GNU General Public License as published by | |
241 | the Free Software Foundation; either version 2 of the License, or | |
242 | (at your option) any later version. | |
243 | ||
244 | This program is distributed in the hope that it will be useful, | |
245 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
246 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
247 | GNU General Public License for more details. | |
248 | ||
249 | You should have received a copy of the GNU General Public License | |
250 | along with this program; if not, write to the Free Software | |
251 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
252 | ||
253 | -- | |
254 | ||
255 | This file was generated by sim/mips/configure. */ | |
256 | ||
257 | #include "sim-main.h" | |
258 | #include "multi-include.h" | |
259 | ||
260 | #define SD sd | |
261 | #define CPU cpu | |
262 | ||
263 | void | |
264 | sim_engine_run (SIM_DESC sd, | |
265 | int next_cpu_nr, | |
266 | int nr_cpus, | |
267 | int signal) /* ignore */ | |
268 | { | |
269 | int mach; | |
270 | ||
271 | if (STATE_ARCHITECTURE (sd) == NULL) | |
272 | mach = bfd_mach_${sim_multi_default}; | |
273 | else | |
274 | mach = STATE_ARCHITECTURE (SD)->mach; | |
275 | ||
276 | switch (mach) | |
277 | { | |
278 | __EOF__ | |
279 | ||
280 | for fc in ${sim_multi_configs}; do | |
281 | ||
282 | # Split up the entry. ${c} contains the first three elements. | |
283 | # Note: outer sqaure brackets are m4 quotes. | |
284 | c=`echo ${fc} | sed ['s/:[^:]*$//']` | |
285 | bfdmachs=`echo ${fc} | sed 's/.*://'` | |
286 | name=`echo ${c} | sed 's/:.*//'` | |
287 | machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'` | |
288 | filter=`echo ${c} | sed 's/.*://'` | |
289 | ||
290 | # Build the following lists: | |
291 | # | |
292 | # sim_multi_flags: all -M and -F flags used by the simulator | |
293 | # sim_multi_src: all makefile-generated source files | |
294 | # sim_multi_obj: the objects for ${sim_multi_src} | |
295 | # sim_multi_igen_configs: igen configuration strings. | |
296 | # | |
297 | # Each entry in ${sim_multi_igen_configs} is a prefix (m32 | |
298 | # or m16) followed by the NAME, MACHINE and FILTER part of | |
299 | # the ${sim_multi_configs} entry. | |
300 | sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}" | |
301 | ||
302 | # Check whether mips16 handling is needed. | |
303 | case ${c} in | |
304 | *:*mips16*:*) | |
305 | # Run igen twice, once for normal mode and once for mips16. | |
306 | ws="m32 m16" | |
307 | ||
308 | # The top-level function for the mips16 simulator is | |
309 | # in a file m16${name}_run.c, generated by the | |
310 | # tmp-run-multi Makefile rule. | |
311 | sim_multi_src="${sim_multi_src} m16${name}_run.c" | |
312 | sim_multi_obj="${sim_multi_obj} m16${name}_run.o" | |
313 | sim_multi_flags="${sim_multi_flags} -F 16" | |
314 | ;; | |
315 | *) | |
316 | ws=m32 | |
317 | ;; | |
318 | esac | |
319 | ||
320 | # Now add the list of igen-generated files to ${sim_multi_src} | |
321 | # and ${sim_multi_obj}. | |
322 | for w in ${ws}; do | |
323 | for base in engine icache idecode model semantics support; do | |
324 | sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c" | |
325 | sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h" | |
326 | sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o" | |
327 | done | |
328 | sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}" | |
329 | done | |
330 | ||
331 | # Add an include for the engine.h file. This file declares the | |
332 | # top-level foo_engine_run() function. | |
333 | echo "#include \"${w}${name}_engine.h\"" >> multi-include.h | |
334 | ||
335 | # Add case statements for this engine to sim_engine_run(). | |
336 | for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do | |
337 | echo " case bfd_mach_${mach}:" >> multi-run.c | |
338 | if test ${mach} = ${sim_multi_default}; then | |
339 | echo " default:" >> multi-run.c | |
340 | sim_seen_default=yes | |
341 | fi | |
342 | done | |
343 | echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \ | |
344 | >> multi-run.c | |
345 | echo " break;" >> multi-run.c | |
346 | done | |
347 | ||
348 | # Check whether we added a 'default:' label. | |
349 | if test ${sim_seen_default} = no; then | |
350 | AC_MSG_ERROR(Error in configure.in: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default}) | |
351 | fi | |
352 | ||
353 | cat << __EOF__ >> multi-run.c | |
354 | } | |
355 | } | |
356 | ||
357 | int | |
358 | mips_mach_multi (SIM_DESC sd) | |
359 | { | |
360 | if (STATE_ARCHITECTURE (sd) == NULL) | |
361 | return bfd_mach_${sim_multi_default}; | |
362 | ||
363 | switch (STATE_ARCHITECTURE (SD)->mach) | |
364 | { | |
365 | __EOF__ | |
366 | ||
367 | # Add case statements for this engine to mips_mach_multi(). | |
368 | for fc in ${sim_multi_configs}; do | |
369 | ||
370 | # Split up the entry. ${c} contains the first three elements. | |
371 | # Note: outer sqaure brackets are m4 quotes. | |
372 | c=`echo ${fc} | sed ['s/:[^:]*$//']` | |
373 | bfdmachs=`echo ${fc} | sed 's/.*://'` | |
374 | ||
375 | for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do | |
376 | echo " case bfd_mach_${mach}:" >> multi-run.c | |
377 | done | |
378 | done | |
379 | ||
380 | cat << __EOF__ >> multi-run.c | |
381 | return (STATE_ARCHITECTURE (SD)->mach); | |
382 | default: | |
383 | return bfd_mach_${sim_multi_default}; | |
384 | } | |
385 | } | |
386 | __EOF__ | |
387 | ||
388 | SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI" | |
389 | else | |
390 | # For clean-extra | |
391 | sim_multi_src=doesnt-exist.c | |
392 | ||
393 | if test x"${sim_mach_default}" = x""; then | |
394 | AC_MSG_ERROR(Error in configure.in: \${sim_mach_default} not defined) | |
395 | fi | |
396 | SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}" | |
397 | fi | |
c906108c SS |
398 | sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}" |
399 | sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}" | |
400 | AC_SUBST(sim_igen_flags) | |
401 | AC_SUBST(sim_m16_flags) | |
402 | AC_SUBST(sim_gen) | |
4c54fc26 CD |
403 | AC_SUBST(sim_multi_flags) |
404 | AC_SUBST(sim_multi_igen_configs) | |
405 | AC_SUBST(sim_multi_src) | |
406 | AC_SUBST(sim_multi_obj) | |
c906108c SS |
407 | |
408 | ||
409 | # | |
410 | # Add simulated hardware devices | |
411 | # | |
412 | hw_enabled=no | |
413 | case "${target}" in | |
414 | mips*tx39*) | |
415 | hw_enabled=yes | |
416 | hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio" | |
417 | mips_extra_objs="dv-sockser.o" | |
418 | SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1" | |
419 | ;; | |
420 | *) | |
421 | mips_extra_objs="" | |
422 | ;; | |
423 | esac | |
424 | SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices) | |
425 | AC_SUBST(mips_extra_objs) | |
426 | ||
427 | ||
428 | # Choose simulator engine | |
429 | case "${target}" in | |
430 | *) mips_igen_engine="engine.o" | |
431 | ;; | |
432 | esac | |
433 | AC_SUBST(mips_igen_engine) | |
434 | ||
435 | ||
436 | AC_PATH_X | |
437 | mips_extra_libs="" | |
438 | AC_SUBST(mips_extra_libs) | |
439 | ||
440 | AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h) | |
441 | AC_CHECK_LIB(m, fabs) | |
442 | AC_CHECK_FUNCS(aint anint sqrt) | |
443 | ||
444 | SIM_AC_OUTPUT |