1 # This file contains common code used by all simulators.
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.
8 # The simulator's configure.in should look like:
10 # dnl Process this file with autoconf to produce a configure script.
11 # sinclude(../common/aclocal.m4)
13 # AC_INIT(Makefile.in)
17 # ... target specific stuff ...
21 AC_DEFUN(SIM_AC_COMMON,
23 # autoconf.info says this should be called right after AC_INIT.
24 AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
26 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
32 # Put a plausible default for CC_FOR_BUILD in Makefile.
33 if test "x$cross_compiling" = "xno"; then
38 AC_SUBST(CC_FOR_BUILD)
46 # Check for common headers.
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*.
49 AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
50 AC_CHECK_HEADERS(sys/time.h sys/resource.h)
51 AC_CHECK_HEADERS(fcntl.h fpu_control.h)
52 AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
54 . ${srcdir}/../../bfd/configure.host
56 dnl Standard (and optional) simulator options.
57 dnl Eventually all simulators will support these.
58 dnl Do not add any here that cannot be supported by all simulators.
59 dnl Do not add similar but different options to a particular simulator,
60 dnl all shall eventually behave the same way.
63 dnl We don't use automake, but we still want to support
64 dnl --enable-maintainer-mode.
65 USE_MAINTAINER_MODE=no
66 AC_ARG_ENABLE(maintainer-mode,
67 [ --enable-maintainer-mode Enable developer functionality.],
68 [case "${enableval}" in
69 yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
71 *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
73 if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
74 echo "Setting maintainer mode" 6>&1
79 dnl This is a generic option to enable special byte swapping
80 dnl insns on *any* cpu.
81 AC_ARG_ENABLE(sim-bswap,
82 [ --enable-sim-bswap Use Host specific BSWAP instruction.],
83 [case "${enableval}" in
84 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
85 no) sim_bswap="-DWITH_BSWAP=0";;
86 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
88 if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
89 echo "Setting bswap flags = $sim_bswap" 6>&1
90 fi],[sim_bswap=""])dnl
94 AC_ARG_ENABLE(sim-cflags,
95 [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
96 [case "${enableval}" in
97 yes) sim_cflags="-O2 -fomit-frame-pointer";;
98 trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
100 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
102 if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
103 echo "Setting sim cflags = $sim_cflags" 6>&1
104 fi],[sim_cflags=""])dnl
108 dnl --enable-sim-debug is for developers of the simulator
109 dnl the allowable values are work-in-progress
110 AC_ARG_ENABLE(sim-debug,
111 [ --enable-sim-debug=opts Enable debugging flags],
112 [case "${enableval}" in
113 yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
114 no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
115 *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
117 if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
118 echo "Setting sim debug = $sim_debug" 6>&1
119 fi],[sim_debug=""])dnl
123 dnl --enable-sim-stdio is for users of the simulator
124 dnl It determines if IO from the program is routed through STDIO (buffered)
125 AC_ARG_ENABLE(sim-stdio,
126 [ --enable-sim-stdio Specify whether to use stdio for console input/output.],
127 [case "${enableval}" in
128 yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
129 no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
130 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
132 if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
133 echo "Setting stdio flags = $sim_stdio" 6>&1
134 fi],[sim_stdio=""])dnl
138 dnl --enable-sim-trace is for users of the simulator
139 dnl The argument is either a bitmask of things to enable [exactly what is
140 dnl up to the simulator], or is a comma separated list of names of tracing
141 dnl elements to enable. The latter is only supported on simulators that
143 AC_ARG_ENABLE(sim-trace,
144 [ --enable-sim-trace=opts Enable tracing flags],
145 [case "${enableval}" in
146 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
147 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
149 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
152 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
153 if test x"$sim_trace" = x; then
154 sim_trace="-DWITH_TRACE='(TRACE_$x"
156 sim_trace="${sim_trace}|TRACE_$x"
159 sim_trace="$sim_trace)'" ;;
161 if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
162 echo "Setting sim trace = $sim_trace" 6>&1
163 fi],[sim_trace=""])dnl
167 dnl --enable-sim-profile
168 dnl The argument is either a bitmask of things to enable [exactly what is
169 dnl up to the simulator], or is a comma separated list of names of profiling
170 dnl elements to enable. The latter is only supported on simulators that
171 dnl use WITH_PROFILE.
172 AC_ARG_ENABLE(sim-profile,
173 [ --enable-sim-profile=opts Enable profiling flags],
174 [case "${enableval}" in
175 yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
176 no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
178 sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
181 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
182 if test x"$sim_profile" = x; then
183 sim_profile="-DWITH_PROFILE='(PROFILE_$x"
185 sim_profile="${sim_profile}|PROFILE_$x"
188 sim_profile="$sim_profile)'" ;;
190 if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
191 echo "Setting sim profile = $sim_profile" 6>&1
192 fi],[sim_profile=""])dnl
193 AC_SUBST(sim_profile)
196 dnl Types used by common code
200 dnl These are available to append to as desired.
204 dnl Create tconfig.h either from simulator's tconfig.in or default one
206 sim_link_links=tconfig.h
207 if test -f ${srcdir}/tconfig.in
209 sim_link_files=tconfig.in
211 sim_link_files=../common/tconfig.in
214 # targ-vals.def points to the libc macro description file.
216 *-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
218 sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
219 sim_link_links="${sim_link_links} targ-vals.def"
221 ]) dnl End of SIM_AC_COMMON
224 dnl Additional SIM options that can (optionally) be configured
225 dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
226 dnl Simulators that wish to use the relevant option specify the macro
227 dnl in the simulator specific configure.in file between the SIM_AC_COMMON
228 dnl and SIM_AC_OUTPUT lines.
231 dnl Specify the running environment.
232 dnl If the simulator invokes this in its configure.in then without this option
233 dnl the default is the user environment and all are runtime selectable.
234 dnl If the simulator doesn't invoke this, only the user environment is
236 dnl ??? Until there is demonstrable value in doing something more complicated,
238 AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
240 AC_ARG_ENABLE(sim-environment,
241 [ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
242 [case "${enableval}" in
243 all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
244 user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
245 virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
246 operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
247 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
250 if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
251 echo "Setting sim environment = $sim_environment" 6>&1
253 [sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
255 AC_SUBST(sim_environment)
258 dnl Specify the alignment restrictions of the target architecture.
259 dnl Without this option all possible alignment restrictions are accommodated.
260 dnl arg[1] is hardwired target alignment
261 dnl arg[2] is default target alignment
262 AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
263 wire_alignment="[$1]"
264 default_alignment="[$2]"
266 AC_ARG_ENABLE(sim-alignment,
267 [ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
268 [case "${enableval}" in
269 strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
270 nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
271 forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
272 yes) if test x"$wire_alignment" != x; then
273 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
275 if test x"$default_alignment" != x; then
276 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
278 echo "No hard-wired alignment for target $target" 1>&6
279 sim_alignment="-DWITH_ALIGNMENT=0"
282 no) if test x"$default_alignment" != x; then
283 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
285 if test x"$wire_alignment" != x; then
286 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
288 echo "No default alignment for target $target" 1>&6
289 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
292 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
294 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
295 echo "Setting alignment flags = $sim_alignment" 6>&1
297 [if test x"$default_alignment" != x; then
298 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
300 if test x"$wire_alignment" != x; then
301 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
307 AC_SUBST(sim_alignment)
310 dnl Conditionally compile in assertion statements.
311 AC_DEFUN(SIM_AC_OPTION_ASSERT,
313 AC_ARG_ENABLE(sim-assert,
314 [ --enable-sim-assert Specify whether to perform random assertions.],
315 [case "${enableval}" in
316 yes) sim_assert="-DWITH_ASSERT=1";;
317 no) sim_assert="-DWITH_ASSERT=0";;
318 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
320 if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
321 echo "Setting assert flags = $sim_assert" 6>&1
322 fi],[sim_assert=""])dnl
328 dnl --enable-sim-bitsize is for developers of the simulator
329 dnl It specifies the number of BITS in the target.
330 dnl arg[1] is the number of bits in a word
331 dnl arg[2] is the number assigned to the most significant bit
332 dnl arg[3] is the number of bits in an address
333 dnl arg[4] is the number of bits in an OpenFirmware cell.
334 dnl FIXME: this information should be obtained from bfd/archure
335 AC_DEFUN(SIM_AC_OPTION_BITSIZE,
336 wire_word_bitsize="[$1]"
338 wire_address_bitsize="[$3]"
339 wire_cell_bitsize="[$4]"
340 [AC_ARG_ENABLE(sim-bitsize,
341 [ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
343 case "${enableval}" in
344 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
345 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
346 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
347 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
348 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
349 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
351 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
353 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
354 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
356 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
358 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
361 tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
364 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
365 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
366 * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;
369 tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
372 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
373 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
374 * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;
376 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
377 echo "Setting bitsize flags = $sim_bitsize" 6>&1
380 if test x"$wire_word_bitsize" != x; then
381 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
383 if test x"$wire_word_msb" != x; then
384 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
386 if test x"$wire_address_bitsize" != x; then
387 sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
389 if test x"$wire_cell_bitsize" != x; then
390 sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
393 AC_SUBST(sim_bitsize)
397 dnl --enable-sim-endian={yes,no,big,little} is for simulators
398 dnl that support both big and little endian targets.
399 dnl arg[1] is hardwired target endianness.
400 dnl arg[2] is default target endianness.
401 AC_DEFUN(SIM_AC_OPTION_ENDIAN,
404 default_endian="[$2]"
405 AC_ARG_ENABLE(sim-endian,
406 [ --enable-sim-endian=endian Specify target byte endian orientation.],
407 [case "${enableval}" in
408 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
409 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
410 yes) if test x"$wire_endian" != x; then
411 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
413 if test x"$default_endian" != x; then
414 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
416 echo "No hard-wired endian for target $target" 1>&6
417 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
420 no) if test x"$default_endian" != x; then
421 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
423 if test x"$wire_endian" != x; then
424 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
426 echo "No default endian for target $target" 1>&6
427 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
430 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
432 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
433 echo "Setting endian flags = $sim_endian" 6>&1
435 [if test x"$default_endian" != x; then
436 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
438 if test x"$wire_endian" != x; then
439 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
448 dnl --enable-sim-hostendian is for users of the simulator when
449 dnl they find that AC_C_BIGENDIAN does not function correctly
450 dnl (for instance in a canadian cross)
451 AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
453 AC_ARG_ENABLE(sim-hostendian,
454 [ --enable-sim-hostendian=end Specify host byte endian orientation.],
455 [case "${enableval}" in
456 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
457 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
458 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
459 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
461 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
462 echo "Setting hostendian flags = $sim_hostendian" 6>&1
464 if test "x$cross_compiling" = "xno"; then
466 if test $ac_cv_c_bigendian = yes; then
467 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
469 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
472 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
475 AC_SUBST(sim_hostendian)
478 dnl --enable-sim-float is for developers of the simulator
479 dnl It specifies the presence of hardware floating point
480 dnl And optionally the bitsize of the floating point register.
481 dnl arg[1] specifies the presence (or absence) of floating point hardware
482 dnl arg[2] specifies the number of bits in a floating point register
483 AC_DEFUN(SIM_AC_OPTION_FLOAT,
485 default_sim_float="[$1]"
486 default_sim_float_bitsize="[$2]"
487 AC_ARG_ENABLE(sim-float,
488 [ --enable-sim-float Specify that the target processor has floating point hardware.],
489 [case "${enableval}" in
490 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
491 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
492 32) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";;
493 64) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";;
494 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
496 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
497 echo "Setting float flags = $sim_float" 6>&1
500 if test x"${default_sim_float}" != x""; then
501 sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
503 if test x"${default_sim_float_bitsize}" != x""; then
504 sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
511 dnl The argument is the default cache size if none is specified.
512 AC_DEFUN(SIM_AC_OPTION_SCACHE,
514 default_sim_scache="ifelse([$1],,0,[$1])"
515 AC_ARG_ENABLE(sim-scache,
516 [ --enable-sim-scache=size Specify simulator execution cache size.],
517 [case "${enableval}" in
518 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
519 no) sim_scache="-DWITH_SCACHE=0" ;;
520 [[0-9]]*) sim_cache=${enableval};;
521 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
524 if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
525 echo "Setting scache size = $sim_scache" 6>&1
526 fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
531 dnl The argument is the default model if none is specified.
532 AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
534 default_sim_default_model="ifelse([$1],,0,[$1])"
535 AC_ARG_ENABLE(sim-default-model,
536 [ --enable-sim-default-model=model Specify default model to simulate.],
537 [case "${enableval}" in
538 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
539 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
541 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
542 echo "Setting default model = $sim_default_model" 6>&1
543 fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
545 AC_SUBST(sim_default_model)
548 dnl --enable-sim-hardware is for users of the simulator
549 dnl arg[1] is a space separated list of devices that override the defaults
550 dnl arg[2] is a space separated list of extra target specific devices.
551 AC_DEFUN(SIM_AC_OPTION_HARDWARE,
553 sim_hardware="-DWITH_HW=1"
554 sim_hw_obj="hw-device.o hw-ports.o hw-properties.o hw-base.o hw-tree.o sim-hw.o"
555 hardware="ifelse([$1],,[core pal glue],[$1]) ifelse([$2],,,[$2])"
556 AC_ARG_ENABLE(sim-hardware,
557 [ --enable-sim-hardware=LIST Specify the hardware to be included in the build.],
559 case "${enableval}" in
561 no) hardware=""; sim_hardware="-DWITH_HW=0"; sim_hw_obj="";;
562 ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
563 *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
564 *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
566 dnl remove duplicates
568 for i in x $hardware ; do
572 *) sim_hw="$sim_hw $i" ;;
575 sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
576 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
577 echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj"
580 sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
581 if test x"$silent" != x"yes"; then
582 echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj"
585 AC_SUBST(sim_hardware)
590 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
591 dnl performance by inlining functions.
592 dnl Guarantee that unconfigured simulators do not do any inlining
593 sim_inline="-DDEFAULT_INLINE=0"
594 AC_DEFUN(SIM_AC_OPTION_INLINE,
596 default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
597 AC_ARG_ENABLE(sim-inline,
598 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
601 no) sim_inline="-DDEFAULT_INLINE=0";;
602 0) sim_inline="-DDEFAULT_INLINE=0";;
603 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
604 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
605 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
608 *_INLINE=*) new_flag="-D$x";;
609 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
610 *_INLINE) new_flag="-D$x=ALL_C_INLINE";;
611 *) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
613 if test x"$sim_inline" = x""; then
614 sim_inline="$new_flag"
616 sim_inline="$sim_inline $new_flag"
620 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
621 echo "Setting inline flags = $sim_inline" 6>&1
622 fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
623 sim_inline="${default_sim_inline}"
624 if test x"$silent" != x"yes"; then
625 echo "Setting inline flags = $sim_inline" 6>&1
634 AC_DEFUN(SIM_AC_OPTION_PACKAGES,
636 AC_ARG_ENABLE(sim-packages,
637 [ --enable-sim-packages=list Specify the packages to be included in the build.],
639 case "${enableval}" in
641 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
642 ,*) packages="${packages}${enableval}";;
643 *,) packages="${enableval}${packages}";;
644 *) packages="${enableval}"'';;
646 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
647 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
648 if test x"$silent" != x"yes" && test x"$packages" != x""; then
649 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
650 fi],[packages=disklabel
651 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
652 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
653 if test x"$silent" != x"yes"; then
654 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
657 AC_SUBST(sim_packages)
660 AC_DEFUN(SIM_AC_OPTION_REGPARM,
662 AC_ARG_ENABLE(sim-regparm,
663 [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
664 [case "${enableval}" in
665 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
666 no) sim_regparm="" ;;
667 yes) sim_regparm="-DWITH_REGPARM=3";;
668 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
670 if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
671 echo "Setting regparm flags = $sim_regparm" 6>&1
672 fi],[sim_regparm=""])dnl
674 AC_SUBST(sim_regparm)
677 AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
679 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
680 AC_ARG_ENABLE(sim-reserved-bits,
681 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
682 [case "${enableval}" in
683 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
684 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
685 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
687 if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
688 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
689 fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
691 AC_SUBST(sim_reserved_bits)
694 AC_DEFUN(SIM_AC_OPTION_SMP,
696 default_sim_smp="ifelse([$1],,5,[$1])"
697 AC_ARG_ENABLE(sim-smp,
698 [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
699 [case "${enableval}" in
700 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
701 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
702 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
704 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
705 echo "Setting smp flags = $sim_smp" 6>&1
706 fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
707 if test x"$silent" != x"yes"; then
708 echo "Setting smp flags = $sim_smp" 6>&1
714 AC_DEFUN(SIM_AC_OPTION_STDCALL,
716 AC_ARG_ENABLE(sim-stdcall,
717 [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
718 [case "${enableval}" in
719 no) sim_stdcall="" ;;
720 std*) sim_stdcall="-DWITH_STDCALL=1";;
721 yes) sim_stdcall="-DWITH_STDCALL=1";;
722 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
724 if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
725 echo "Setting function call flags = $sim_stdcall" 6>&1
726 fi],[sim_stdcall=""])dnl
728 AC_SUBST(sim_stdcall)
731 AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
733 default_sim_xor_endian="ifelse([$1],,8,[$1])"
734 AC_ARG_ENABLE(sim-xor-endian,
735 [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
736 [case "${enableval}" in
737 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
738 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
739 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
741 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
742 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
743 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
745 AC_SUBST(sim_xor_endian)
748 dnl --enable-sim-warnings is for developers of the simulator.
749 dnl it enables extra GCC specific warnings.
750 AC_DEFUN(SIM_AC_OPTION_WARNINGS,
752 AC_ARG_ENABLE(sim-warnings,
753 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
754 [case "${enableval}" in
755 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
756 no) sim_warnings="-w";;
757 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
759 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
760 echo "Setting warning flags = $sim_warnings" 6>&1
761 fi],[sim_warnings=""])dnl
763 AC_SUBST(sim_warnings)
766 dnl Generate the Makefile in a target specific directory.
767 dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
768 dnl so this is a cover macro to tuck the details away of how we cope.
769 dnl We cope by having autoconf generate two files and then merge them into
770 dnl one afterwards. The two pieces of the common fragment are inserted into
771 dnl the target's fragment at the appropriate points.
773 AC_DEFUN(SIM_AC_OUTPUT,
775 AC_LINK_FILES($sim_link_files, $sim_link_links)
776 AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
777 [case "x$CONFIG_FILES" in
779 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
780 rm -f Makesim1.tmp Makesim2.tmp Makefile
781 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
782 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
783 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
784 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
785 <Makefile.sim >Makefile
786 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
789 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac