daily update
[deliverable/binutils-gdb.git] / sim / mips / configure.ac
CommitLineData
c906108c 1dnl Process this file with autoconf to produce a configure script.
b7026657 2AC_PREREQ(2.59)dnl
c906108c 3AC_INIT(Makefile.in)
35695fd6 4AC_CONFIG_HEADER(config.h:config.in)
c906108c 5
f0569246 6sinclude(../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.
10sinclude(../common/common.m4)
11
c906108c
SS
12dnl Options available in this module
13SIM_AC_OPTION_INLINE()
14SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
15SIM_AC_OPTION_HOSTENDIAN
16SIM_AC_OPTION_WARNINGS
e6c674b8 17SIM_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#
25case "${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="";;
32esac
33AC_SUBST(SIM_SUBTARGET)
34
35
36
37#
38# Select the byte order of the target
39#
40mips_endian=
41default_endian=
42case "${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 ;;
51esac
52SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
53
54
55
56#
57# Select the bitsize of the target
58#
59mips_addr_bitsize=
60case "${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 ;;
68esac
69SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
70
71
72
73#
74# Select the floating hardware support of the target
75#
76mips_fpu=HARDWARE_FLOATING_POINT
77mips_fpu_bitsize=
78case "${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 ;;
87esac
88SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
89
90
91
92#
93# Select the level of SMP support
94#
95case "${target}" in
96 *) mips_smp=0 ;;
97esac
98SIM_AC_OPTION_SMP($mips_smp)
99
100
101
102#
103# Select the IGEN architecture
104#
105sim_gen=IGEN
106sim_igen_machine="-M mipsIV"
139181c8 107sim_m16_machine="-M mips16,mipsIII"
c906108c
SS
108sim_igen_filter="32,64,f"
109sim_m16_filter="16"
4c54fc26
CD
110sim_mach_default="mips8000"
111
2a2ce21b
RS
112sim_mipsisa3264_configs="\
113 mipsisa32:mips32,mips16,mips16e,smartmips:32,f:mipsisa32\
114 mipsisa32r2:mips32r2,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2\
115 mipsisa64:mips64,mips3d,mips16,mips16e,mdmx:32,64,f:mipsisa64\
116 mipsisa64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2:32,64,f:mipsisa64r2"
117
c906108c
SS
118case "${target}" in
119 mips*tx39*) sim_gen=IGEN
120 sim_igen_filter="32,f"
121 sim_igen_machine="-M r3900"
122 ;;
123 mips64vr43*-*-*) sim_gen=IGEN
124 sim_igen_machine="-M mipsIV"
4c54fc26 125 sim_mach_default="mips8000"
c906108c
SS
126 ;;
127 mips64vr5*-*-*) sim_gen=IGEN
128 sim_igen_machine="-M vr5000"
4c54fc26 129 sim_mach_default="mips5000"
c906108c
SS
130 ;;
131 mips64vr41*) sim_gen=M16
132 sim_igen_machine="-M vr4100"
133 sim_m16_machine="-M vr4100"
134 sim_igen_filter="32,64,f"
135 sim_m16_filter="16"
4c54fc26 136 sim_mach_default="mips4100"
c906108c 137 ;;
4c54fc26
CD
138 mips64vr-*-* | mips64vrel-*-*)
139 sim_gen=MULTI
140 sim_multi_configs="\
141 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
142 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
143 vr5000:mipsIV:32,64,f:mips4300,mips5000\
144 vr5400:mipsIV,vr5400:32,64,f:mips5400\
145 vr5500:mipsIV,vr5500:32,64,f:mips5500"
146 sim_multi_default=mips5000
147 ;;
3669427c 148 mips*-sde-elf*) sim_gen=M16
8b082fb1 149 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips"
3669427c
TS
150 sim_m16_machine="-M mips16,mips16e,mips64r2"
151 sim_igen_filter="32,64,f"
152 sim_mach_default="mipsisa64r2"
153 ;;
c906108c
SS
154 mips64*-*-*) sim_igen_filter="32,64,f"
155 sim_gen=IGEN
156 ;;
157 mips16*-*-*) sim_gen=M16
158 sim_igen_filter="32,64,f"
159 sim_m16_filter="16"
160 ;;
2a2ce21b
RS
161 mipsisa32r2*-*-*) sim_gen=MULTI
162 sim_multi_configs=$sim_mipsisa3264_configs
163 sim_multi_default="mipsisa32r2"
e70cb6cd 164 ;;
2a2ce21b
RS
165 mipsisa32*-*-*) sim_gen=MULTI
166 sim_multi_configs=$sim_mipsisa3264_configs
167 sim_multi_default="mipsisa32"
1e799e28 168 ;;
2a2ce21b
RS
169 mipsisa64r2*-*-*) sim_gen=MULTI
170 sim_multi_configs=$sim_mipsisa3264_configs
171 sim_multi_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 ;;
2a2ce21b
RS
178 mipsisa64*-*-*) sim_gen=MULTI
179 sim_multi_configs=$sim_mipsisa3264_configs
180 sim_multi_default="mipsisa64"
1e799e28 181 ;;
109ad085 182 mips*lsi*) sim_gen=M16
c906108c
SS
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"
4c54fc26 187 sim_mach_default="mips4000"
109ad085 188 ;;
c906108c
SS
189 mips*-*-*) sim_gen=IGEN
190 sim_igen_filter="32,f"
191 ;;
192esac
4c54fc26
CD
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.
218if 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.in: 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=multi-run.o
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 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 2 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, write to the Free Software
249 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
250
251 --
252
253 This file was generated by sim/mips/configure. */
254
255#include "sim-main.h"
256#include "multi-include.h"
257
258#define SD sd
259#define CPU cpu
260
261void
262sim_engine_run (SIM_DESC sd,
263 int next_cpu_nr,
264 int nr_cpus,
265 int signal) /* ignore */
266{
267 int mach;
268
269 if (STATE_ARCHITECTURE (sd) == NULL)
270 mach = bfd_mach_${sim_multi_default};
271 else
272 mach = STATE_ARCHITECTURE (SD)->mach;
273
274 switch (mach)
275 {
276__EOF__
277
278 for fc in ${sim_multi_configs}; do
279
280 # Split up the entry. ${c} contains the first three elements.
281 # Note: outer sqaure brackets are m4 quotes.
282 c=`echo ${fc} | sed ['s/:[^:]*$//']`
283 bfdmachs=`echo ${fc} | sed 's/.*://'`
284 name=`echo ${c} | sed 's/:.*//'`
285 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
286 filter=`echo ${c} | sed 's/.*://'`
287
288 # Build the following lists:
289 #
290 # sim_multi_flags: all -M and -F flags used by the simulator
291 # sim_multi_src: all makefile-generated source files
292 # sim_multi_obj: the objects for ${sim_multi_src}
293 # sim_multi_igen_configs: igen configuration strings.
294 #
295 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
296 # or m16) followed by the NAME, MACHINE and FILTER part of
297 # the ${sim_multi_configs} entry.
298 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
299
300 # Check whether mips16 handling is needed.
301 case ${c} in
302 *:*mips16*:*)
303 # Run igen twice, once for normal mode and once for mips16.
304 ws="m32 m16"
305
306 # The top-level function for the mips16 simulator is
307 # in a file m16${name}_run.c, generated by the
308 # tmp-run-multi Makefile rule.
309 sim_multi_src="${sim_multi_src} m16${name}_run.c"
310 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
311 sim_multi_flags="${sim_multi_flags} -F 16"
312 ;;
313 *)
314 ws=m32
315 ;;
316 esac
317
318 # Now add the list of igen-generated files to ${sim_multi_src}
319 # and ${sim_multi_obj}.
320 for w in ${ws}; do
321 for base in engine icache idecode model semantics support; do
322 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
323 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
324 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
325 done
326 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
327 done
328
329 # Add an include for the engine.h file. This file declares the
330 # top-level foo_engine_run() function.
331 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
332
333 # Add case statements for this engine to sim_engine_run().
334 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
335 echo " case bfd_mach_${mach}:" >> multi-run.c
336 if test ${mach} = ${sim_multi_default}; then
337 echo " default:" >> multi-run.c
338 sim_seen_default=yes
339 fi
340 done
341 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
342 >> multi-run.c
343 echo " break;" >> multi-run.c
344 done
345
346 # Check whether we added a 'default:' label.
347 if test ${sim_seen_default} = no; then
348 AC_MSG_ERROR(Error in configure.in: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
349 fi
350
351 cat << __EOF__ >> multi-run.c
352 }
353}
354
355int
356mips_mach_multi (SIM_DESC sd)
357{
358 if (STATE_ARCHITECTURE (sd) == NULL)
359 return bfd_mach_${sim_multi_default};
360
361 switch (STATE_ARCHITECTURE (SD)->mach)
362 {
363__EOF__
364
365 # Add case statements for this engine to mips_mach_multi().
366 for fc in ${sim_multi_configs}; do
367
368 # Split up the entry. ${c} contains the first three elements.
369 # Note: outer sqaure brackets are m4 quotes.
370 c=`echo ${fc} | sed ['s/:[^:]*$//']`
371 bfdmachs=`echo ${fc} | sed 's/.*://'`
372
373 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
374 echo " case bfd_mach_${mach}:" >> multi-run.c
375 done
376 done
377
378 cat << __EOF__ >> multi-run.c
379 return (STATE_ARCHITECTURE (SD)->mach);
380 default:
381 return bfd_mach_${sim_multi_default};
382 }
383}
384__EOF__
385
386 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
387else
388 # For clean-extra
389 sim_multi_src=doesnt-exist.c
390
391 if test x"${sim_mach_default}" = x""; then
392 AC_MSG_ERROR(Error in configure.in: \${sim_mach_default} not defined)
393 fi
394 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
395fi
c906108c
SS
396sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
397sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
398AC_SUBST(sim_igen_flags)
399AC_SUBST(sim_m16_flags)
400AC_SUBST(sim_gen)
4c54fc26
CD
401AC_SUBST(sim_multi_flags)
402AC_SUBST(sim_multi_igen_configs)
403AC_SUBST(sim_multi_src)
404AC_SUBST(sim_multi_obj)
c906108c
SS
405
406
407#
408# Add simulated hardware devices
409#
410hw_enabled=no
411case "${target}" in
412 mips*tx39*)
413 hw_enabled=yes
414 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
415 mips_extra_objs="dv-sockser.o"
416 SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
417 ;;
418 *)
419 mips_extra_objs=""
420 ;;
421esac
422SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
423AC_SUBST(mips_extra_objs)
424
425
426# Choose simulator engine
427case "${target}" in
428 *) mips_igen_engine="engine.o"
429 ;;
430esac
431AC_SUBST(mips_igen_engine)
432
433
434AC_PATH_X
435mips_extra_libs=""
436AC_SUBST(mips_extra_libs)
437
438AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h)
439AC_CHECK_LIB(m, fabs)
440AC_CHECK_FUNCS(aint anint sqrt)
441
442SIM_AC_OUTPUT
This page took 0.328952 seconds and 4 git commands to generate.