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