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