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 sys/time.h sys/resource.h)
50 AC_CHECK_FUNCS(getrusage time sigaction)
52 . ${srcdir}/../../bfd/configure.host
54 dnl Standard (and optional) simulator options.
55 dnl Eventually all simulators will support these.
56 dnl Do not add any here that cannot be supported by all simulators.
57 dnl Do not add similar but different options to a particular simulator,
58 dnl all shall eventually behave the same way.
61 dnl We don't use automake, but we still want to support
62 dnl --enable-maintainer-mode.
63 AC_ARG_ENABLE(maintainer-mode,
64 [ --enable-maintainer-mode Enable developer functionality.],
65 [case "${enableval}" in
68 *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
70 if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
71 echo "Setting maintainer mode" 6>&1
76 dnl This is a generic option to enable special byte swapping
77 dnl insns on *any* cpu.
78 AC_ARG_ENABLE(sim-bswap,
79 [ --enable-sim-bswap Use Host specific BSWAP instruction.],
80 [case "${enableval}" in
81 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
82 no) sim_bswap="-DWITH_BSWAP=0";;
83 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
85 if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
86 echo "Setting bswap flags = $sim_bswap" 6>&1
87 fi],[sim_bswap=""])dnl
91 AC_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="";;
97 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
99 if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
100 echo "Setting sim cflags = $sim_cflags" 6>&1
101 fi],[sim_cflags=""])dnl
105 dnl --enable-sim-debug is for developers of the simulator
106 dnl the allowable values are work-in-progress
107 AC_ARG_ENABLE(sim-debug,
108 [ --enable-sim-debug=opts Enable debugging flags],
109 [case "${enableval}" in
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})'";;
114 if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
115 echo "Setting sim debug = $sim_debug" 6>&1
116 fi],[sim_debug=""])dnl
120 dnl --enable-sim-stdio is for users of the simulator
121 dnl It determines if IO from the program is routed through STDIO (buffered)
122 AC_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="";;
129 if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
130 echo "Setting stdio flags = $sim_stdio" 6>&1
131 fi],[sim_stdio=""])dnl
135 dnl --enable-sim-trace is for users of the simulator
136 dnl The argument is either a bitmask of things to enable [exactly what is
137 dnl up to the simulator], or is a comma separated list of names of tracing
138 dnl elements to enable. The latter is only supported on simulators that
140 AC_ARG_ENABLE(sim-trace,
141 [ --enable-sim-trace=opts Enable tracing flags],
142 [case "${enableval}" in
143 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
144 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
146 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
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"
153 sim_trace="${sim_trace}|TRACE_$x"
156 sim_trace="$sim_trace)'" ;;
158 if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
159 echo "Setting sim trace = $sim_trace" 6>&1
160 fi],[sim_trace=""])dnl
164 dnl --enable-sim-profile
165 dnl The argument is either a bitmask of things to enable [exactly what is
166 dnl up to the simulator], or is a comma separated list of names of profiling
167 dnl elements to enable. The latter is only supported on simulators that
168 dnl use WITH_PROFILE.
169 AC_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";;
175 sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
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"
182 sim_profile="${sim_profile}|PROFILE_$x"
185 sim_profile="$sim_profile)'" ;;
187 if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
188 echo "Setting sim profile = $sim_profile" 6>&1
189 fi],[sim_profile=""])dnl
190 AC_SUBST(sim_profile)
193 dnl Types used by common code
197 dnl These are available to append to as desired.
201 dnl Create tconfig.h either from simulator's tconfig.in or default one
203 sim_link_links=tconfig.h
204 if test -f ${srcdir}/tconfig.in
206 sim_link_files=tconfig.in
208 sim_link_files=../common/tconfig.in
211 # targ-vals.def points to the libc macro description file.
213 *-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
215 sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
216 sim_link_links="${sim_link_links} targ-vals.def"
218 ]) dnl End of SIM_AC_COMMON
221 dnl Additional SIM options that can (optionally) be configured
222 dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
223 dnl Simulators that wish to use the relevant option specify the macro
224 dnl in the simulator specific configure.in file between the SIM_AC_COMMON
225 dnl and SIM_AC_OUTPUT lines.
228 dnl Specify the running environment.
229 dnl If the simulator invokes this in its configure.in then without this option
230 dnl the default is the user environment and all are runtime selectable.
231 dnl If the simulator doesn't invoke this, only the user environment is
233 dnl ??? Until there is demonstrable value in doing something more complicated,
235 AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
237 AC_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");
247 if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
248 echo "Setting sim environment = $sim_environment" 6>&1
250 [sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
252 AC_SUBST(sim_environment)
255 dnl Specify the alignment restrictions of the target architecture.
256 dnl Without this option all possible alignment restrictions are accommodated.
257 dnl arg[1] is hardwired target alignment
258 dnl arg[2] is default target alignment
259 AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
260 wire_alignment="[$1]"
261 default_alignment="[$2]"
263 AC_ARG_ENABLE(sim-alignment,
264 [ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
265 [case "${enableval}" in
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}"
272 if test x"$default_alignment" != x; then
273 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
275 echo "No hard-wired alignment for target $target" 1>&6
276 sim_alignment="-DWITH_ALIGNMENT=0"
279 no) if test x"$default_alignment" != x; then
280 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
282 if test x"$wire_alignment" != x; then
283 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
285 echo "No default alignment for target $target" 1>&6
286 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
289 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
291 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
292 echo "Setting alignment flags = $sim_alignment" 6>&1
294 [if test x"$default_alignment" != x; then
295 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
297 if test x"$wire_alignment" != x; then
298 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
304 AC_SUBST(sim_alignment)
307 dnl Conditionally compile in assertion statements.
308 AC_DEFUN(SIM_AC_OPTION_ASSERT,
310 AC_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="";;
317 if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
318 echo "Setting assert flags = $sim_assert" 6>&1
319 fi],[sim_assert=""])dnl
325 dnl --enable-sim-bitsize is for developers of the simulator
326 dnl It specifies the number of BITS in the target.
327 dnl arg[1] is the number of bits in a word
328 dnl arg[2] is the number assigned to the most significant bit
329 dnl arg[3] is the number of bits in an address
330 dnl arg[4] is the number of bits in an OpenFirmware cell.
331 dnl FIXME: this information should be obtained from bfd/archure
332 AC_DEFUN(SIM_AC_OPTION_BITSIZE,
333 wire_word_bitsize="[$1]"
335 wire_address_bitsize="[$3]"
336 wire_cell_bitsize="[$4]"
337 [AC_ARG_ENABLE(sim-bitsize,
338 [ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
340 case "${enableval}" in
341 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
342 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
343 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
344 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
345 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
346 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
348 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
350 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
351 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
353 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
355 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
358 tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
361 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
362 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
363 * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;
366 tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
369 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
370 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
371 * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;
373 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
374 echo "Setting bitsize flags = $sim_bitsize" 6>&1
377 if test x"$wire_word_bitsize" != x; then
378 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
380 if test x"$wire_word_msb" != x; then
381 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
383 if test x"$wire_address_bitsize" != x; then
384 sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
386 if test x"$wire_cell_bitsize" != x; then
387 sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
390 AC_SUBST(sim_bitsize)
394 dnl --enable-sim-endian={yes,no,big,little} is for simulators
395 dnl that support both big and little endian targets.
396 dnl arg[1] is hardwired target endianness.
397 dnl arg[2] is default target endianness.
398 AC_DEFUN(SIM_AC_OPTION_ENDIAN,
401 default_endian="[$2]"
402 AC_ARG_ENABLE(sim-endian,
403 [ --enable-sim-endian=endian Specify target byte endian orientation.],
404 [case "${enableval}" in
405 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
406 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
407 yes) if test x"$wire_endian" != x; then
408 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
410 if test x"$default_endian" != x; then
411 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
413 echo "No hard-wired endian for target $target" 1>&6
414 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
417 no) if test x"$default_endian" != x; then
418 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
420 if test x"$wire_endian" != x; then
421 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
423 echo "No default endian for target $target" 1>&6
424 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
427 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
429 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
430 echo "Setting endian flags = $sim_endian" 6>&1
432 [if test x"$default_endian" != x; then
433 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
435 if test x"$wire_endian" != x; then
436 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
445 dnl --enable-sim-hostendian is for users of the simulator when
446 dnl they find that AC_C_BIGENDIAN does not function correctly
447 dnl (for instance in a canadian cross)
448 AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
450 AC_ARG_ENABLE(sim-hostendian,
451 [ --enable-sim-hostendian=end Specify host byte endian orientation.],
452 [case "${enableval}" in
453 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
454 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
455 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
456 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
458 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
459 echo "Setting hostendian flags = $sim_hostendian" 6>&1
461 if test "x$cross_compiling" = "xno"; then
463 if test $ac_cv_c_bigendian = yes; then
464 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
466 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
469 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
472 AC_SUBST(sim_hostendian)
475 AC_DEFUN(SIM_AC_OPTION_FLOAT,
477 default_sim_floating_point="ifelse([$1],,0,[$1])"
478 AC_ARG_ENABLE(sim-float,
479 [ --enable-sim-float Specify that the target processor has floating point hardware.],
480 [case "${enableval}" in
481 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
482 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
483 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
485 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
486 echo "Setting float flags = $sim_float" 6>&1
487 fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
492 dnl The argument is the default cache size if none is specified.
493 AC_DEFUN(SIM_AC_OPTION_SCACHE,
495 default_sim_scache="ifelse([$1],,0,[$1])"
496 AC_ARG_ENABLE(sim-scache,
497 [ --enable-sim-scache=size Specify simulator execution cache size.],
498 [case "${enableval}" in
499 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
500 no) sim_scache="-DWITH_SCACHE=0" ;;
501 [[0-9]]*) sim_cache=${enableval};;
502 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
505 if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
506 echo "Setting scache size = $sim_scache" 6>&1
507 fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
512 dnl The argument is the default model if none is specified.
513 AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
515 default_sim_default_model="ifelse([$1],,0,[$1])"
516 AC_ARG_ENABLE(sim-default-model,
517 [ --enable-sim-default-model=model Specify default model to simulate.],
518 [case "${enableval}" in
519 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
520 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
522 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
523 echo "Setting default model = $sim_default_model" 6>&1
524 fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
526 AC_SUBST(sim_default_model)
529 AC_DEFUN(SIM_AC_OPTION_HARDWARE,
531 AC_ARG_ENABLE(sim-hardware,
532 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
533 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
534 case "${enableval}" in
536 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
537 ,*) hardware="${hardware}${enableval}";;
538 *,) hardware="${enableval}${hardware}";;
539 *) hardware="${enableval}"'';;
541 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
542 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
543 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
544 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
545 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
546 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
547 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
548 if test x"$silent" != x"yes"; then
549 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
552 AC_SUBST(sim_hardware)
555 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
556 dnl performance by inlining functions.
557 AC_DEFUN(SIM_AC_OPTION_INLINE,
559 default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
560 AC_ARG_ENABLE(sim-inline,
561 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
564 no) sim_inline="-DDEFAULT_INLINE=0";;
565 0) sim_inline="-DDEFAULT_INLINE=0";;
566 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
567 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
568 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
571 *_INLINE=*) new_flag="-D$x";;
572 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
573 *_INLINE) new_flag="-D$x=ALL_INLINE";;
574 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
576 if test x"$sim_inline" = x""; then
577 sim_inline="$new_flag"
579 sim_inline="$sim_inline $new_flag"
583 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
584 echo "Setting inline flags = $sim_inline" 6>&1
585 fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
586 sim_inline="${default_sim_inline}"
587 if test x"$silent" != x"yes"; then
588 echo "Setting inline flags = $sim_inline" 6>&1
597 AC_DEFUN(SIM_AC_OPTION_PACKAGES,
599 AC_ARG_ENABLE(sim-packages,
600 [ --enable-sim-packages=list Specify the packages to be included in the build.],
602 case "${enableval}" in
604 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
605 ,*) packages="${packages}${enableval}";;
606 *,) packages="${enableval}${packages}";;
607 *) packages="${enableval}"'';;
609 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
610 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
611 if test x"$silent" != x"yes" && test x"$packages" != x""; then
612 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
613 fi],[packages=disklabel
614 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
615 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
616 if test x"$silent" != x"yes"; then
617 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
620 AC_SUBST(sim_packages)
623 AC_DEFUN(SIM_AC_OPTION_REGPARM,
625 AC_ARG_ENABLE(sim-regparm,
626 [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
627 [case "${enableval}" in
628 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
629 no) sim_regparm="" ;;
630 yes) sim_regparm="-DWITH_REGPARM=3";;
631 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
633 if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
634 echo "Setting regparm flags = $sim_regparm" 6>&1
635 fi],[sim_regparm=""])dnl
637 AC_SUBST(sim_regparm)
640 AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
642 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
643 AC_ARG_ENABLE(sim-reserved-bits,
644 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
645 [case "${enableval}" in
646 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
647 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
648 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
650 if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
651 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
652 fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
654 AC_SUBST(sim_reserved_bits)
657 AC_DEFUN(SIM_AC_OPTION_SMP,
659 default_sim_smp="ifelse([$1],,5,[$1])"
660 AC_ARG_ENABLE(sim-smp,
661 [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
662 [case "${enableval}" in
663 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
664 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
665 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
667 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
668 echo "Setting smp flags = $sim_smp" 6>&1
669 fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
670 if test x"$silent" != x"yes"; then
671 echo "Setting smp flags = $sim_smp" 6>&1
677 AC_DEFUN(SIM_AC_OPTION_STDCALL,
679 AC_ARG_ENABLE(sim-stdcall,
680 [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
681 [case "${enableval}" in
682 no) sim_stdcall="" ;;
683 std*) sim_stdcall="-DWITH_STDCALL=1";;
684 yes) sim_stdcall="-DWITH_STDCALL=1";;
685 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
687 if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
688 echo "Setting function call flags = $sim_stdcall" 6>&1
689 fi],[sim_stdcall=""])dnl
691 AC_SUBST(sim_stdcall)
694 AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
696 default_sim_xor_endian="ifelse([$1],,8,[$1])"
697 AC_ARG_ENABLE(sim-xor-endian,
698 [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
699 [case "${enableval}" in
700 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
701 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
702 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
704 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
705 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
706 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
708 AC_SUBST(sim_xor_endian)
711 dnl --enable-sim-warnings is for developers of the simulator.
712 dnl it enables extra GCC specific warnings.
713 AC_DEFUN(SIM_AC_OPTION_WARNINGS,
715 AC_ARG_ENABLE(sim-warnings,
716 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
717 [case "${enableval}" in
718 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
719 no) sim_warnings="-w";;
720 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
722 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
723 echo "Setting warning flags = $sim_warnings" 6>&1
724 fi],[sim_warnings=""])dnl
726 AC_SUBST(sim_warnings)
729 dnl Generate the Makefile in a target specific directory.
730 dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
731 dnl so this is a cover macro to tuck the details away of how we cope.
732 dnl We cope by having autoconf generate two files and then merge them into
733 dnl one afterwards. The two pieces of the common fragment are inserted into
734 dnl the target's fragment at the appropriate points.
736 AC_DEFUN(SIM_AC_OUTPUT,
738 AC_LINK_FILES($sim_link_files, $sim_link_links)
739 AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
740 [case "x$CONFIG_FILES" in
742 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
743 rm -f Makesim1.tmp Makesim2.tmp Makefile
744 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
745 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
746 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
747 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
748 <Makefile.sim >Makefile
749 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
752 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac