]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/mips/configure.ac
sim: convert to bfd_endian
[thirdparty/binutils-gdb.git] / sim / mips / configure.ac
CommitLineData
c906108c 1dnl Process this file with autoconf to produce a configure script.
6ffe910a 2AC_PREREQ(2.64)dnl
c906108c 3AC_INIT(Makefile.in)
9c082ca8 4sinclude(../common/acinclude.m4)
c906108c 5
6ffe910a 6SIM_AC_COMMON
35695fd6 7
c906108c
SS
8dnl Options available in this module
9SIM_AC_OPTION_INLINE()
10SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
11SIM_AC_OPTION_HOSTENDIAN
12SIM_AC_OPTION_WARNINGS
e6c674b8 13SIM_AC_OPTION_RESERVED_BITS(1)
c906108c
SS
14
15# DEPRECATED
16#
17# Instead of defining a `subtarget' macro, code should be checking
18# the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
19# in question.
20#
21case "${target}" in
4c54fc26 22 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
c906108c 23 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
109ad085 24 mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
cc220243 25 mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
1e799e28
CD
26 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
27 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
c906108c
SS
28 *) SIM_SUBTARGET="";;
29esac
30AC_SUBST(SIM_SUBTARGET)
31
32
33
34#
35# Select the byte order of the target
36#
37mips_endian=
38default_endian=
39case "${target}" in
1ac72f06
MF
40 mips64el*-*-*) mips_endian=LITTLE ;;
41 mips64vr*el-*-*) default_endian=LITTLE ;;
42 mips64*-*-*) default_endian=BIG ;;
43 mips16*-*-*) default_endian=BIG ;;
44 mipsisa32*-*-*) default_endian=BIG ;;
45 mipsisa64*-*-*) default_endian=BIG ;;
46 mips*-*-*) default_endian=BIG ;;
47 *) default_endian=BIG ;;
c906108c
SS
48esac
49SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
50
51
52
53#
54# Select the bitsize of the target
55#
56mips_addr_bitsize=
57case "${target}" in
4b5d35ee 58 mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
cc220243 59 mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
c906108c
SS
60 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
61 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
1e799e28
CD
62 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
63 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
c906108c
SS
64 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
65 *) mips_bitsize=64 ; mips_msb=63 ;;
66esac
67SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
68
69
70
71#
72# Select the floating hardware support of the target
73#
74mips_fpu=HARDWARE_FLOATING_POINT
75mips_fpu_bitsize=
76case "${target}" in
4b5d35ee
TS
77 mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
78 mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
cc220243 79 mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
c906108c
SS
80 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
81 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
1e799e28
CD
82 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
83 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
c906108c
SS
84 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
85 *) mips_fpu=HARD_FLOATING_POINT ;;
86esac
87SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
88
89
90
91#
92# Select the level of SMP support
93#
94case "${target}" in
95 *) mips_smp=0 ;;
96esac
97SIM_AC_OPTION_SMP($mips_smp)
98
99
100
101#
102# Select the IGEN architecture
103#
104sim_gen=IGEN
105sim_igen_machine="-M mipsIV"
139181c8 106sim_m16_machine="-M mips16,mipsIII"
c906108c
SS
107sim_igen_filter="32,64,f"
108sim_m16_filter="16"
4c54fc26
CD
109sim_mach_default="mips8000"
110
c906108c
SS
111case "${target}" in
112 mips*tx39*) sim_gen=IGEN
113 sim_igen_filter="32,f"
114 sim_igen_machine="-M r3900"
115 ;;
116 mips64vr43*-*-*) sim_gen=IGEN
117 sim_igen_machine="-M mipsIV"
4c54fc26 118 sim_mach_default="mips8000"
c906108c
SS
119 ;;
120 mips64vr5*-*-*) sim_gen=IGEN
121 sim_igen_machine="-M vr5000"
4c54fc26 122 sim_mach_default="mips5000"
c906108c
SS
123 ;;
124 mips64vr41*) sim_gen=M16
125 sim_igen_machine="-M vr4100"
126 sim_m16_machine="-M vr4100"
127 sim_igen_filter="32,64,f"
128 sim_m16_filter="16"
4c54fc26 129 sim_mach_default="mips4100"
c906108c 130 ;;
4c54fc26
CD
131 mips64vr-*-* | mips64vrel-*-*)
132 sim_gen=MULTI
133 sim_multi_configs="\
134 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
135 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
136 vr5000:mipsIV:32,64,f:mips4300,mips5000\
137 vr5400:mipsIV,vr5400:32,64,f:mips5400\
138 vr5500:mipsIV,vr5500:32,64,f:mips5500"
139 sim_multi_default=mips5000
140 ;;
cc220243 141 mips*-sde-elf* | mips*-mti-elf*)
8e394ffc
AB
142 sim_gen=MULTI
143 sim_multi_configs="\
144 micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
145 mips64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,64,f:mipsisa64r2"
146 sim_multi_default=mipsisa64r2
3669427c 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 ;;
8e394ffc
AB
155 mipsisa32r2*-*-*) sim_gen=MULTI
156 sim_multi_configs="\
157 micromips:micromips32,micromipsdsp:32,f:mips_micromips\
158 mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
159 sim_multi_default=mipsisa32r2
e70cb6cd 160 ;;
d5fb0879
RS
161 mipsisa32*-*-*) sim_gen=M16
162 sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
163 sim_m16_machine="-M mips16,mips16e,mips32"
164 sim_igen_filter="32,f"
165 sim_mach_default="mipsisa32"
1e799e28 166 ;;
d5fb0879
RS
167 mipsisa64r2*-*-*) sim_gen=M16
168 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
169 sim_m16_machine="-M mips16,mips16e,mips64r2"
170 sim_igen_filter="32,64,f"
171 sim_mach_default="mipsisa64r2"
e70cb6cd 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 ;;
d5fb0879
RS
178 mipsisa64*-*-*) sim_gen=M16
179 sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
180 sim_m16_machine="-M mips16,mips16e,mips64"
181 sim_igen_filter="32,64,f"
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 ;;
194esac
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.
220if test ${sim_gen} = MULTI; then
221
222 # Simple sanity check.
223 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
306f4178 224 AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
4c54fc26
CD
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=
8e394ffc 231 sim_multi_obj=
4c54fc26
CD
232 sim_multi_igen_configs=
233 sim_seen_default=no
234
235 cat << __EOF__ > multi-run.c
236/* Main entry point for MULTI simulators.
618f726f 237 Copyright (C) 2003-2016 Free Software Foundation, Inc.
4c54fc26
CD
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
35ee6e1e 241 the Free Software Foundation; either version 3 of the License, or
4c54fc26
CD
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
35ee6e1e 250 along with this program. If not, see <http://www.gnu.org/licenses/>.
4c54fc26
CD
251
252 --
253
254 This file was generated by sim/mips/configure. */
255
256#include "sim-main.h"
257#include "multi-include.h"
8e394ffc
AB
258#include "elf-bfd.h"
259#include "elf/mips.h"
4c54fc26
CD
260
261#define SD sd
262#define CPU cpu
263
264void
265sim_engine_run (SIM_DESC sd,
266 int next_cpu_nr,
267 int nr_cpus,
268 int signal) /* ignore */
269{
270 int mach;
271
272 if (STATE_ARCHITECTURE (sd) == NULL)
273 mach = bfd_mach_${sim_multi_default};
8e394ffc
AB
274 else if (elf_elfheader (sd->base.prog_bfd)->e_flags
275 & EF_MIPS_ARCH_ASE_MICROMIPS)
276 mach = bfd_mach_mips_micromips;
4c54fc26
CD
277 else
278 mach = STATE_ARCHITECTURE (SD)->mach;
279
280 switch (mach)
281 {
282__EOF__
283
284 for fc in ${sim_multi_configs}; do
285
286 # Split up the entry. ${c} contains the first three elements.
287 # Note: outer sqaure brackets are m4 quotes.
288 c=`echo ${fc} | sed ['s/:[^:]*$//']`
289 bfdmachs=`echo ${fc} | sed 's/.*://'`
290 name=`echo ${c} | sed 's/:.*//'`
291 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
292 filter=`echo ${c} | sed 's/.*://'`
293
294 # Build the following lists:
295 #
296 # sim_multi_flags: all -M and -F flags used by the simulator
297 # sim_multi_src: all makefile-generated source files
298 # sim_multi_obj: the objects for ${sim_multi_src}
299 # sim_multi_igen_configs: igen configuration strings.
300 #
301 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
302 # or m16) followed by the NAME, MACHINE and FILTER part of
303 # the ${sim_multi_configs} entry.
304 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
305
8e394ffc 306 # Check whether special handling is needed.
4c54fc26
CD
307 case ${c} in
308 *:*mips16*:*)
309 # Run igen twice, once for normal mode and once for mips16.
310 ws="m32 m16"
311
312 # The top-level function for the mips16 simulator is
313 # in a file m16${name}_run.c, generated by the
314 # tmp-run-multi Makefile rule.
315 sim_multi_src="${sim_multi_src} m16${name}_run.c"
316 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
317 sim_multi_flags="${sim_multi_flags} -F 16"
318 ;;
8e394ffc
AB
319 *:*micromips32*:*)
320 # Run igen thrice, once for micromips32, once for micromips16,
321 # and once for m32.
322 ws="micromips_m32 micromips16 micromips32"
323
324 # The top-level function for the micromips simulator is
325 # in a file micromips${name}_run.c, generated by the
326 # tmp-run-multi Makefile rule.
327 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
328 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
329 sim_multi_flags="${sim_multi_flags} -F 16,32"
330 ;;
331 *:*micromips64*:*)
332 # Run igen thrice, once for micromips64, once for micromips16,
333 # and once for m64.
334 ws="micromips_m64 micromips16 micromips64"
335
336 # The top-level function for the micromips simulator is
337 # in a file micromips${name}_run.c, generated by the
338 # tmp-run-multi Makefile rule.
339 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
340 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
341 sim_multi_flags="${sim_multi_flags} -F 16,32,64"
342 ;;
4c54fc26
CD
343 *)
344 ws=m32
345 ;;
346 esac
347
348 # Now add the list of igen-generated files to ${sim_multi_src}
349 # and ${sim_multi_obj}.
350 for w in ${ws}; do
351 for base in engine icache idecode model semantics support; do
352 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
353 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
354 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
355 done
356 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
357 done
358
359 # Add an include for the engine.h file. This file declares the
360 # top-level foo_engine_run() function.
361 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
362
363 # Add case statements for this engine to sim_engine_run().
364 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
365 echo " case bfd_mach_${mach}:" >> multi-run.c
366 if test ${mach} = ${sim_multi_default}; then
367 echo " default:" >> multi-run.c
368 sim_seen_default=yes
369 fi
370 done
371 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
372 >> multi-run.c
373 echo " break;" >> multi-run.c
374 done
375
376 # Check whether we added a 'default:' label.
377 if test ${sim_seen_default} = no; then
306f4178 378 AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
4c54fc26
CD
379 fi
380
381 cat << __EOF__ >> multi-run.c
382 }
383}
384
385int
386mips_mach_multi (SIM_DESC sd)
387{
388 if (STATE_ARCHITECTURE (sd) == NULL)
389 return bfd_mach_${sim_multi_default};
390
391 switch (STATE_ARCHITECTURE (SD)->mach)
392 {
393__EOF__
394
395 # Add case statements for this engine to mips_mach_multi().
396 for fc in ${sim_multi_configs}; do
397
398 # Split up the entry. ${c} contains the first three elements.
399 # Note: outer sqaure brackets are m4 quotes.
400 c=`echo ${fc} | sed ['s/:[^:]*$//']`
401 bfdmachs=`echo ${fc} | sed 's/.*://'`
402
403 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
404 echo " case bfd_mach_${mach}:" >> multi-run.c
405 done
406 done
407
408 cat << __EOF__ >> multi-run.c
409 return (STATE_ARCHITECTURE (SD)->mach);
410 default:
411 return bfd_mach_${sim_multi_default};
412 }
413}
414__EOF__
415
416 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
417else
418 # For clean-extra
419 sim_multi_src=doesnt-exist.c
420
421 if test x"${sim_mach_default}" = x""; then
306f4178 422 AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
4c54fc26
CD
423 fi
424 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
425fi
c906108c
SS
426sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
427sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
8e394ffc
AB
428sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
429sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
c906108c
SS
430AC_SUBST(sim_igen_flags)
431AC_SUBST(sim_m16_flags)
8e394ffc
AB
432AC_SUBST(sim_micromips_flags)
433AC_SUBST(sim_micromips16_flags)
c906108c 434AC_SUBST(sim_gen)
4c54fc26
CD
435AC_SUBST(sim_multi_flags)
436AC_SUBST(sim_multi_igen_configs)
437AC_SUBST(sim_multi_src)
438AC_SUBST(sim_multi_obj)
c906108c
SS
439#
440# Add simulated hardware devices
441#
442hw_enabled=no
443case "${target}" in
444 mips*tx39*)
445 hw_enabled=yes
446 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
c906108c
SS
447 ;;
448 *)
c906108c
SS
449 ;;
450esac
451SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
c906108c
SS
452
453
454# Choose simulator engine
455case "${target}" in
456 *) mips_igen_engine="engine.o"
457 ;;
458esac
459AC_SUBST(mips_igen_engine)
460
461
462AC_PATH_X
463mips_extra_libs=""
464AC_SUBST(mips_extra_libs)
465
c906108c
SS
466AC_CHECK_LIB(m, fabs)
467AC_CHECK_FUNCS(aint anint sqrt)
468
469SIM_AC_OUTPUT