mips - for r5900 generate igen simulator.
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
CommitLineData
80b7b3a5 1# This file contains common code used by all simulators.
8cd89e77
DE
2#
3# SIM_AC_COMMON invokes AC macros used by all simulators and by the common
4# directory. It is intended to be invoked before any target specific stuff.
5# SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.
6# It is intended to be invoked last.
7#
8# The simulator's configure.in should look like:
9#
f2de7dfd
AC
10# dnl Process this file with autoconf to produce a configure script.
11# sinclude(../common/aclocal.m4)
8cd89e77
DE
12# AC_PREREQ(2.5)dnl
13# AC_INIT(Makefile.in)
f2de7dfd 14#
8cd89e77
DE
15# SIM_AC_COMMON
16#
17# ... target specific stuff ...
18#
19# SIM_AC_OUTPUT
80b7b3a5
SG
20
21AC_DEFUN(SIM_AC_COMMON,
22[
23# autoconf.info says this should be called right after AC_INIT.
b45caf05 24AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
80b7b3a5
SG
25
26AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
27AC_CANONICAL_SYSTEM
28AC_ARG_PROGRAM
29AC_PROG_CC
30AC_PROG_INSTALL
80b7b3a5
SG
31
32# Put a plausible default for CC_FOR_BUILD in Makefile.
80b7b3a5
SG
33if test "x$cross_compiling" = "xno"; then
34 CC_FOR_BUILD='$(CC)'
35else
36 CC_FOR_BUILD=gcc
37fi
38AC_SUBST(CC_FOR_BUILD)
39
40AC_SUBST(CFLAGS)
41AC_SUBST(HDEFINES)
42AR=${AR-ar}
43AC_SUBST(AR)
44AC_PROG_RANLIB
45
fbda74b1 46# Check for common headers.
63ddb6bd
DE
47# FIXME: Seems to me this can cause problems for i386-windows hosts.
48# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
49AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h sys/time.h sys/resource.h)
462cfbc4 50AC_CHECK_FUNCS(getrusage time sigaction)
fbda74b1 51
80b7b3a5
SG
52. ${srcdir}/../../bfd/configure.host
53
a77aa7ec 54dnl Standard (and optional) simulator options.
80b7b3a5
SG
55dnl Eventually all simulators will support these.
56dnl Do not add any here that cannot be supported by all simulators.
57dnl Do not add similar but different options to a particular simulator,
58dnl all shall eventually behave the same way.
59
f2de7dfd 60
462cfbc4
DE
61dnl We don't use automake, but we still want to support
62dnl --enable-maintainer-mode.
63AC_ARG_ENABLE(maintainer-mode,
64[ --enable-maintainer-mode Enable developer functionality.],
65[case "${enableval}" in
66 yes) MAINT="" ;;
67 no) MAINT="#" ;;
68 *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
69esac
70if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
71 echo "Setting maintainer mode" 6>&1
72fi],[MAINT="#"])dnl
73AC_SUBST(MAINT)
74
75
f2de7dfd
AC
76dnl This is a generic option to enable special byte swapping
77dnl insns on *any* cpu.
78AC_ARG_ENABLE(sim-bswap,
79[ --enable-sim-bswap Use Host specific BSWAP instruction.],
80[case "${enableval}" in
a77aa7ec 81 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
f2de7dfd
AC
82 no) sim_bswap="-DWITH_BSWAP=0";;
83 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
84esac
85if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
86 echo "Setting bswap flags = $sim_bswap" 6>&1
87fi],[sim_bswap=""])dnl
88AC_SUBST(sim_bswap)
89
90
80b7b3a5
SG
91AC_ARG_ENABLE(sim-cflags,
92[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
93[case "${enableval}" in
94 yes) sim_cflags="-O2";;
95 trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
96 no) sim_cflags="";;
97 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
98esac
99if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
100 echo "Setting sim cflags = $sim_cflags" 6>&1
101fi],[sim_cflags=""])dnl
102AC_SUBST(sim_cflags)
103
f2de7dfd 104
80b7b3a5
SG
105dnl --enable-sim-debug is for developers of the simulator
106dnl the allowable values are work-in-progress
107AC_ARG_ENABLE(sim-debug,
108[ --enable-sim-debug=opts Enable debugging flags],
109[case "${enableval}" in
fbda74b1
DE
110 yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
111 no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
112 *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
80b7b3a5
SG
113esac
114if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
115 echo "Setting sim debug = $sim_debug" 6>&1
116fi],[sim_debug=""])dnl
117AC_SUBST(sim_debug)
118
f2de7dfd 119
a35e91c3
AC
120dnl --enable-sim-stdio is for users of the simulator
121dnl It determines if IO from the program is routed through STDIO (buffered)
122AC_ARG_ENABLE(sim-stdio,
123[ --enable-sim-stdio Specify whether to use stdio for console input/output.],
124[case "${enableval}" in
125 yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
126 no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
127 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
128esac
129if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
130 echo "Setting stdio flags = $sim_stdio" 6>&1
131fi],[sim_stdio=""])dnl
132AC_SUBST(sim_stdio)
133
134
135dnl --enable-sim-trace is for users of the simulator
247fccde
AC
136dnl The argument is either a bitmask of things to enable [exactly what is
137dnl up to the simulator], or is a comma separated list of names of tracing
138dnl elements to enable. The latter is only supported on simulators that
139dnl use WITH_TRACE.
a35e91c3
AC
140AC_ARG_ENABLE(sim-trace,
141[ --enable-sim-trace=opts Enable tracing flags],
142[case "${enableval}" in
247fccde 143 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
a35e91c3 144 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
247fccde
AC
145 [[-0-9]]*)
146 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
147 [[a-z]]*)
148 sim_trace=""
149 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
150 if test x"$sim_trace" = x; then
151 sim_trace="-DWITH_TRACE='(TRACE_$x"
152 else
153 sim_trace="${sim_trace}|TRACE_$x"
154 fi
155 done
156 sim_trace="$sim_trace)'" ;;
a35e91c3
AC
157esac
158if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
159 echo "Setting sim trace = $sim_trace" 6>&1
160fi],[sim_trace=""])dnl
161AC_SUBST(sim_trace)
162
163
247fccde
AC
164dnl --enable-sim-profile
165dnl The argument is either a bitmask of things to enable [exactly what is
166dnl up to the simulator], or is a comma separated list of names of profiling
167dnl elements to enable. The latter is only supported on simulators that
168dnl use WITH_PROFILE.
169AC_ARG_ENABLE(sim-profile,
170[ --enable-sim-profile=opts Enable profiling flags],
171[case "${enableval}" in
172 yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
173 no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
174 [[-0-9]]*)
175 sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
176 [[a-z]]*)
177 sim_profile=""
178 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
179 if test x"$sim_profile" = x; then
180 sim_profile="-DWITH_PROFILE='(PROFILE_$x"
181 else
182 sim_profile="${sim_profile}|PROFILE_$x"
183 fi
184 done
185 sim_profile="$sim_profile)'" ;;
186esac
187if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
188 echo "Setting sim profile = $sim_profile" 6>&1
189fi],[sim_profile=""])dnl
190AC_SUBST(sim_profile)
191
192
63ddb6bd
DE
193dnl Types used by common code
194AC_TYPE_SIGNAL
195
196
a35e91c3
AC
197dnl These are available to append to as desired.
198sim_link_files=
199sim_link_links=
200
201dnl Create tconfig.h either from simulator's tconfig.in or default one
202dnl in common.
203sim_link_links=tconfig.h
204if test -f ${srcdir}/tconfig.in
205then
206 sim_link_files=tconfig.in
207else
208 sim_link_files=../common/tconfig.in
209fi
210
211# targ-vals.def points to the libc macro description file.
212case "${target}" in
213*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
214esac
215sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
216sim_link_links="${sim_link_links} targ-vals.def"
217
218]) dnl End of SIM_AC_COMMON
219
220
221dnl Additional SIM options that can (optionally) be configured
222dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
223dnl Simulators that wish to use the relevant option specify the macro
224dnl in the simulator specific configure.in file between the SIM_AC_COMMON
225dnl and SIM_AC_OUTPUT lines.
226
227
462cfbc4
DE
228dnl Specify the running environment.
229dnl If the simulator invokes this in its configure.in then without this option
230dnl the default is the user environment and all are runtime selectable.
231dnl If the simulator doesn't invoke this, only the user environment is
232dnl supported.
233dnl ??? Until there is demonstrable value in doing something more complicated,
234dnl let's not.
235AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
236[
237AC_ARG_ENABLE(sim-environment,
238[ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
239[case "${enableval}" in
240 all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
241 user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
242 virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
243 operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
244 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
245 sim_environment="";;
246esac
247if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
248 echo "Setting sim environment = $sim_environment" 6>&1
249fi],
250[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
251])
252AC_SUBST(sim_environment)
253
254
a35e91c3 255dnl Specify the alignment restrictions of the target architecture.
794e9ac9 256dnl Without this option all possible alignment restrictions are accommodated.
b45caf05
AC
257dnl arg[1] is hardwired target alignment
258dnl arg[2] is default target alignment
a35e91c3 259AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
794e9ac9
AC
260wire_alignment="[$1]"
261default_alignment="[$2]"
a35e91c3
AC
262[
263AC_ARG_ENABLE(sim-alignment,
b45caf05 264[ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
a35e91c3 265[case "${enableval}" in
b45caf05
AC
266 strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
267 nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
268 forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
269 yes) if test x"$wire_alignment" != x; then
270 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
271 else
794e9ac9
AC
272 if test x"$default_alignment" != x; then
273 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
274 else
275 echo "No hard-wired alignment for target $target" 1>&6
276 sim_alignment="-DWITH_ALIGNMENT=0"
277 fi
b45caf05
AC
278 fi;;
279 no) if test x"$default_alignment" != x; then
280 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
281 else
794e9ac9
AC
282 if test x"$wire_alignment" != x; then
283 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
284 else
285 echo "No default alignment for target $target" 1>&6
286 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
287 fi
b45caf05
AC
288 fi;;
289 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
a35e91c3
AC
290esac
291if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
292 echo "Setting alignment flags = $sim_alignment" 6>&1
794e9ac9
AC
293fi],
294[if test x"$default_alignment" != x; then
295 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
296else
297 if test x"$wire_alignment" != x; then
298 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
299 else
300 sim_alignment=
301 fi
302fi])dnl
a35e91c3 303])dnl
92f91d1f 304AC_SUBST(sim_alignment)
a35e91c3
AC
305
306
307dnl Conditionally compile in assertion statements.
308AC_DEFUN(SIM_AC_OPTION_ASSERT,
309[
310AC_ARG_ENABLE(sim-assert,
311[ --enable-sim-assert Specify whether to perform random assertions.],
312[case "${enableval}" in
313 yes) sim_assert="-DWITH_ASSERT=1";;
314 no) sim_assert="-DWITH_ASSERT=0";;
315 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
316esac
317if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
318 echo "Setting assert flags = $sim_assert" 6>&1
319fi],[sim_assert=""])dnl
a35e91c3 320])
92f91d1f 321AC_SUBST(sim_assert)
a35e91c3
AC
322
323
462cfbc4
DE
324
325dnl --enable-sim-bitsize is for developers of the simulator
326dnl It specifies the number of BITS in the target.
327dnl arg[1] is the number of bits in a word
328dnl arg[2] is the number assigned to the most significant bit
329dnl In the future this macro may also take arguments for specifying
330dnl the number of bits in an address and an Open Firmware cell.
331dnl FIXME: this information should be obtained from bfd/archure
332AC_DEFUN(SIM_AC_OPTION_BITSIZE,
333wire_bitsize="[$1]"
334wire_msb="[$2]"
335[AC_ARG_ENABLE(sim-bitsize,
336[ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
337[case "${enableval}" in
338 64,63) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
339 32,31) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
340 64,0) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
341 32,0) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
342 32) if test x"$wire_msb" != x -a x"$wire_msb" != x0; then
343 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
344 else
345 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
346 fi ;;
347 64) if test x"$wire_msb" != x -a x"$wire_msb" != x0; then
348 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
349 else
350 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
351 fi ;;
352 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
353esac
354if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
355 echo "Setting bitsize flags = $sim_bitsize" 6>&1
356fi],
357[sim_bitsize=""
358if test x"$wire_bitsize" != x; then
359 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_bitsize"
360fi
361if test x"$wire_msb" != x; then
362 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_msb"
363fi])dnl
364])
365AC_SUBST(sim_bitsize)
366
367
368
f2de7dfd
AC
369dnl --enable-sim-endian={yes,no,big,little} is for simulators
370dnl that support both big and little endian targets.
247fccde
AC
371dnl arg[1] is hardwired target endianness.
372dnl arg[2] is default target endianness.
f2de7dfd 373AC_DEFUN(SIM_AC_OPTION_ENDIAN,
8cd89e77 374[
92f91d1f
AC
375wire_endian="[$1]"
376default_endian="[$2]"
f2de7dfd
AC
377AC_ARG_ENABLE(sim-endian,
378[ --enable-sim-endian=endian Specify target byte endian orientation.],
379[case "${enableval}" in
f2de7dfd
AC
380 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
381 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
247fccde
AC
382 yes) if test x"$wire_endian" != x; then
383 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
384 else
92f91d1f
AC
385 if test x"$default_endian" != x; then
386 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
387 else
388 echo "No hard-wired endian for target $target" 1>&6
389 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
390 fi
247fccde
AC
391 fi;;
392 no) if test x"$default_endian" != x; then
393 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
394 else
92f91d1f
AC
395 if test x"$wire_endian" != x; then
396 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
397 else
398 echo "No default endian for target $target" 1>&6
399 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
400 fi
247fccde 401 fi;;
f2de7dfd
AC
402 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
403esac
404if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
405 echo "Setting endian flags = $sim_endian" 6>&1
92f91d1f
AC
406fi],
407[if test x"$default_endian" != x; then
408 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
409else
410 if test x"$wire_endian" != x; then
411 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
412 else
413 sim_endian=
414 fi
415fi])dnl
f2de7dfd 416])
92f91d1f 417AC_SUBST(sim_endian)
8cd89e77 418
80b7b3a5 419
f2de7dfd
AC
420dnl --enable-sim-hostendian is for users of the simulator when
421dnl they find that AC_C_BIGENDIAN does not function correctly
422dnl (for instance in a canadian cross)
423AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
424[
425AC_ARG_ENABLE(sim-hostendian,
462cfbc4 426[ --enable-sim-hostendian=end Specify host byte endian orientation.],
f2de7dfd
AC
427[case "${enableval}" in
428 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
429 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
430 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
431 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
432esac
433if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
434 echo "Setting hostendian flags = $sim_hostendian" 6>&1
435fi],[
436if test "x$cross_compiling" = "xno"; then
437 AC_C_BIGENDIAN
438 if test $ac_cv_c_bigendian = yes; then
439 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
440 else
441 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
442 fi
443else
444 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
445fi])dnl
a77aa7ec 446])
92f91d1f 447AC_SUBST(sim_hostendian)
a77aa7ec
AC
448
449
450AC_DEFUN(SIM_AC_OPTION_FLOAT,
451[
a35e91c3 452default_sim_floating_point="ifelse([$1],,0,[$1])"
a77aa7ec 453AC_ARG_ENABLE(sim-float,
a35e91c3 454[ --enable-sim-float Specify that the target processor has floating point hardware.],
a77aa7ec
AC
455[case "${enableval}" in
456 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
457 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
458 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
459esac
460if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
461 echo "Setting float flags = $sim_float" 6>&1
a35e91c3 462fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
a77aa7ec 463])
92f91d1f 464AC_SUBST(sim_float)
a77aa7ec
AC
465
466
247fccde
AC
467dnl The argument is the default cache size if none is specified.
468AC_DEFUN(SIM_AC_OPTION_SCACHE,
469[
470default_sim_scache="ifelse([$1],,0,[$1])"
471AC_ARG_ENABLE(sim-scache,
472[ --enable-sim-scache=size Specify simulator execution cache size.],
473[case "${enableval}" in
474 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
462cfbc4 475 no) sim_scache="-DWITH_SCACHE=0" ;;
247fccde
AC
476 [[0-9]]*) sim_cache=${enableval};;
477 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
478 sim_scache="";;
479esac
480if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
481 echo "Setting scache size = $sim_scache" 6>&1
482fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
247fccde 483])
92f91d1f 484AC_SUBST(sim_scache)
247fccde
AC
485
486
487dnl The argument is the default model if none is specified.
488AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
489[
490default_sim_default_model="ifelse([$1],,0,[$1])"
491AC_ARG_ENABLE(sim-default-model,
492[ --enable-sim-default-model=model Specify default model to simulate.],
493[case "${enableval}" in
494 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
495 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
496esac
497if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
498 echo "Setting default model = $sim_default_model" 6>&1
499fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
247fccde 500])
92f91d1f 501AC_SUBST(sim_default_model)
247fccde
AC
502
503
a77aa7ec
AC
504AC_DEFUN(SIM_AC_OPTION_HARDWARE,
505[
506AC_ARG_ENABLE(sim-hardware,
507[ --enable-sim-hardware=list Specify the hardware to be included in the build.],
508[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
509case "${enableval}" in
510 yes) ;;
511 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
512 ,*) hardware="${hardware}${enableval}";;
513 *,) hardware="${enableval}${hardware}";;
514 *) hardware="${enableval}"'';;
515esac
516sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
517sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
518if test x"$silent" != x"yes" && test x"$hardware" != x""; then
519 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
520fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
521sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
522sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
523if test x"$silent" != x"yes"; then
524 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
525fi])dnl
f2de7dfd 526])
92f91d1f 527AC_SUBST(sim_hardware)
f2de7dfd 528
80b7b3a5 529
f2de7dfd
AC
530dnl --enable-sim-inline is for users that wish to ramp up the simulator's
531dnl performance by inlining functions.
532AC_DEFUN(SIM_AC_OPTION_INLINE,
533[
534default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
535AC_ARG_ENABLE(sim-inline,
536[ --enable-sim-inline=inlines Specify which functions should be inlined.],
537[sim_inline=""
538case "$enableval" in
539 no) sim_inline="-DDEFAULT_INLINE=0";;
540 0) sim_inline="-DDEFAULT_INLINE=0";;
541 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
542 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
543 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
544 new_flag=""
545 case "$x" in
546 *_INLINE=*) new_flag="-D$x";;
547 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
548 *_INLINE) new_flag="-D$x=ALL_INLINE";;
549 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
550 esac
551 if test x"$sim_inline" = x""; then
552 sim_inline="$new_flag"
553 else
554 sim_inline="$sim_inline $new_flag"
555 fi
556 done;;
557esac
558if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
559 echo "Setting inline flags = $sim_inline" 6>&1
560fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
561 sim_inline="${default_sim_inline}"
562 if test x"$silent" != x"yes"; then
563 echo "Setting inline flags = $sim_inline" 6>&1
564 fi
565else
566 sim_inline=""
567fi])dnl
a77aa7ec 568])
92f91d1f 569AC_SUBST(sim_inline)
a77aa7ec
AC
570
571
572AC_DEFUN(SIM_AC_OPTION_PACKAGES,
573[
574AC_ARG_ENABLE(sim-packages,
575[ --enable-sim-packages=list Specify the packages to be included in the build.],
576[packages=disklabel
577case "${enableval}" in
578 yes) ;;
579 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
580 ,*) packages="${packages}${enableval}";;
581 *,) packages="${enableval}${packages}";;
582 *) packages="${enableval}"'';;
583esac
584sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
585sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
586if test x"$silent" != x"yes" && test x"$packages" != x""; then
587 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
588fi],[packages=disklabel
589sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
590sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
591if test x"$silent" != x"yes"; then
592 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
593fi])dnl
a77aa7ec 594])
92f91d1f 595AC_SUBST(sim_packages)
a77aa7ec
AC
596
597
598AC_DEFUN(SIM_AC_OPTION_REGPARM,
599[
600AC_ARG_ENABLE(sim-regparm,
601[ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
602[case "${enableval}" in
603 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
604 no) sim_regparm="" ;;
605 yes) sim_regparm="-DWITH_REGPARM=3";;
606 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
607esac
608if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
609 echo "Setting regparm flags = $sim_regparm" 6>&1
610fi],[sim_regparm=""])dnl
a77aa7ec 611])
92f91d1f 612AC_SUBST(sim_regparm)
a77aa7ec
AC
613
614
615AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
616[
a35e91c3 617default_sim_reserved_bits="ifelse([$1],,1,[$1])"
a77aa7ec
AC
618AC_ARG_ENABLE(sim-reserved-bits,
619[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
620[case "${enableval}" in
621 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
622 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
623 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
624esac
625if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
626 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
a35e91c3 627fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
a77aa7ec 628])
92f91d1f 629AC_SUBST(sim_reserved_bits)
a77aa7ec
AC
630
631
632AC_DEFUN(SIM_AC_OPTION_SMP,
633[
a35e91c3 634default_sim_smp="ifelse([$1],,5,[$1])"
a77aa7ec 635AC_ARG_ENABLE(sim-smp,
a35e91c3 636[ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
a77aa7ec
AC
637[case "${enableval}" in
638 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
639 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
640 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
641esac
642if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
643 echo "Setting smp flags = $sim_smp" 6>&1
a35e91c3 644fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
a77aa7ec
AC
645if test x"$silent" != x"yes"; then
646 echo "Setting smp flags = $sim_smp" 6>&1
647fi])dnl
f2de7dfd 648])
92f91d1f 649AC_SUBST(sim_smp)
80b7b3a5 650
80b7b3a5 651
a77aa7ec
AC
652AC_DEFUN(SIM_AC_OPTION_STDCALL,
653[
654AC_ARG_ENABLE(sim-stdcall,
655[ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
656[case "${enableval}" in
657 no) sim_stdcall="" ;;
658 std*) sim_stdcall="-DWITH_STDCALL=1";;
659 yes) sim_stdcall="-DWITH_STDCALL=1";;
660 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
661esac
662if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
663 echo "Setting function call flags = $sim_stdcall" 6>&1
664fi],[sim_stdcall=""])dnl
a77aa7ec 665])
92f91d1f 666AC_SUBST(sim_stdcall)
a77aa7ec
AC
667
668
a35e91c3
AC
669AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
670[
671default_sim_xor_endian="ifelse([$1],,8,[$1])"
672AC_ARG_ENABLE(sim-xor-endian,
673[ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
a77aa7ec 674[case "${enableval}" in
a35e91c3
AC
675 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
676 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
677 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
a77aa7ec 678esac
a35e91c3
AC
679if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
680 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
681fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
a35e91c3 682])
92f91d1f 683AC_SUBST(sim_xor_endian)
a77aa7ec
AC
684
685
f2de7dfd
AC
686dnl --enable-sim-warnings is for developers of the simulator.
687dnl it enables extra GCC specific warnings.
688AC_DEFUN(SIM_AC_OPTION_WARNINGS,
689[
690AC_ARG_ENABLE(sim-warnings,
88117054 691[ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
f2de7dfd
AC
692[case "${enableval}" in
693 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
694 no) sim_warnings="-w";;
695 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
696esac
697if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
698 echo "Setting warning flags = $sim_warnings" 6>&1
699fi],[sim_warnings=""])dnl
700])
92f91d1f 701AC_SUBST(sim_warnings)
80b7b3a5 702
80b7b3a5 703
f2de7dfd
AC
704dnl Generate the Makefile in a target specific directory.
705dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
706dnl so this is a cover macro to tuck the details away of how we cope.
707dnl We cope by having autoconf generate two files and then merge them into
708dnl one afterwards. The two pieces of the common fragment are inserted into
709dnl the target's fragment at the appropriate points.
80b7b3a5 710
f2de7dfd
AC
711AC_DEFUN(SIM_AC_OUTPUT,
712[
80b7b3a5 713AC_LINK_FILES($sim_link_files, $sim_link_links)
88d5f8e8
DE
714AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
715[case "x$CONFIG_FILES" in
716 xMakefile*)
f2de7dfd
AC
717 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
718 rm -f Makesim1.tmp Makesim2.tmp Makefile
719 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
720 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
721 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
722 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
723 <Makefile.sim >Makefile
724 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
725 ;;
726 esac
80b7b3a5 727 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
f2de7dfd
AC
728])
729])
This page took 0.08696 seconds and 4 git commands to generate.