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(config.h: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)
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 This is a generic option to enable special byte swapping
62 dnl insns on *any* cpu.
63 AC_ARG_ENABLE(sim-bswap,
64 [ --enable-sim-bswap Use Host specific BSWAP instruction.],
65 [case "${enableval}" in
66 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
67 no) sim_bswap="-DWITH_BSWAP=0";;
68 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
70 if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
71 echo "Setting bswap flags = $sim_bswap" 6>&1
72 fi],[sim_bswap=""])dnl
76 AC_ARG_ENABLE(sim-cflags,
77 [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
78 [case "${enableval}" in
79 yes) sim_cflags="-O2";;
80 trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
82 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
84 if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
85 echo "Setting sim cflags = $sim_cflags" 6>&1
86 fi],[sim_cflags=""])dnl
90 dnl --enable-sim-debug is for developers of the simulator
91 dnl the allowable values are work-in-progress
92 AC_ARG_ENABLE(sim-debug,
93 [ --enable-sim-debug=opts Enable debugging flags],
94 [case "${enableval}" in
95 yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
96 no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
97 *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
99 if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
100 echo "Setting sim debug = $sim_debug" 6>&1
101 fi],[sim_debug=""])dnl
105 dnl --enable-sim-stdio is for users of the simulator
106 dnl It determines if IO from the program is routed through STDIO (buffered)
107 AC_ARG_ENABLE(sim-stdio,
108 [ --enable-sim-stdio Specify whether to use stdio for console input/output.],
109 [case "${enableval}" in
110 yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
111 no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
112 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
114 if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
115 echo "Setting stdio flags = $sim_stdio" 6>&1
116 fi],[sim_stdio=""])dnl
120 dnl --enable-sim-trace is for users of the simulator
121 dnl The argument is either a bitmask of things to enable [exactly what is
122 dnl up to the simulator], or is a comma separated list of names of tracing
123 dnl elements to enable. The latter is only supported on simulators that
125 AC_ARG_ENABLE(sim-trace,
126 [ --enable-sim-trace=opts Enable tracing flags],
127 [case "${enableval}" in
128 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
129 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
131 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
134 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
135 if test x"$sim_trace" = x; then
136 sim_trace="-DWITH_TRACE='(TRACE_$x"
138 sim_trace="${sim_trace}|TRACE_$x"
141 sim_trace="$sim_trace)'" ;;
143 if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
144 echo "Setting sim trace = $sim_trace" 6>&1
145 fi],[sim_trace=""])dnl
149 dnl --enable-sim-profile
150 dnl The argument is either a bitmask of things to enable [exactly what is
151 dnl up to the simulator], or is a comma separated list of names of profiling
152 dnl elements to enable. The latter is only supported on simulators that
153 dnl use WITH_PROFILE.
154 AC_ARG_ENABLE(sim-profile,
155 [ --enable-sim-profile=opts Enable profiling flags],
156 [case "${enableval}" in
157 yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
158 no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
160 sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
163 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
164 if test x"$sim_profile" = x; then
165 sim_profile="-DWITH_PROFILE='(PROFILE_$x"
167 sim_profile="${sim_profile}|PROFILE_$x"
170 sim_profile="$sim_profile)'" ;;
172 if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
173 echo "Setting sim profile = $sim_profile" 6>&1
174 fi],[sim_profile=""])dnl
175 AC_SUBST(sim_profile)
178 dnl Types used by common code
182 dnl These are available to append to as desired.
186 dnl Create tconfig.h either from simulator's tconfig.in or default one
188 sim_link_links=tconfig.h
189 if test -f ${srcdir}/tconfig.in
191 sim_link_files=tconfig.in
193 sim_link_files=../common/tconfig.in
196 # targ-vals.def points to the libc macro description file.
198 *-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
200 sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
201 sim_link_links="${sim_link_links} targ-vals.def"
203 ]) dnl End of SIM_AC_COMMON
206 dnl Additional SIM options that can (optionally) be configured
207 dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
208 dnl Simulators that wish to use the relevant option specify the macro
209 dnl in the simulator specific configure.in file between the SIM_AC_COMMON
210 dnl and SIM_AC_OUTPUT lines.
213 dnl Specify the alignment restrictions of the target architecture.
214 dnl Without this option all possible alignment restrictions are accomidated.
215 AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
217 AC_ARG_ENABLE(sim-alignment,
218 [ --enable-sim-alignment=align Specify strict or nonstrict alignment.],
219 [case "${enableval}" in
220 yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
221 no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
222 0 | default | DEFAULT) sim_alignment="-DWITH_ALIGNMENT=0";;
223 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
225 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
226 echo "Setting alignment flags = $sim_alignment" 6>&1
227 fi],[sim_alignment=""])dnl
228 AC_SUBST(sim_alignment)
232 dnl Conditionally compile in assertion statements.
233 AC_DEFUN(SIM_AC_OPTION_ASSERT,
235 AC_ARG_ENABLE(sim-assert,
236 [ --enable-sim-assert Specify whether to perform random assertions.],
237 [case "${enableval}" in
238 yes) sim_assert="-DWITH_ASSERT=1";;
239 no) sim_assert="-DWITH_ASSERT=0";;
240 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
242 if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
243 echo "Setting assert flags = $sim_assert" 6>&1
244 fi],[sim_assert=""])dnl
249 dnl --enable-sim-endian={yes,no,big,little} is for simulators
250 dnl that support both big and little endian targets.
251 dnl arg[1] is hardwired target endianness.
252 dnl arg[2] is default target endianness.
253 AC_DEFUN(SIM_AC_OPTION_ENDIAN,
255 wire_endian="ifelse([$1],,ifelse([$2],,,[$2]),[$1])"
256 default_endian="ifelse([$2],,ifelse([$1],,,[$1]),[$2])"
257 default_sim_endian="ifelse([$1],,ifelse([$2],,,-DWITH_DEFAULT_TARGET_BYTE_ORDER=[$2]),-DWITH_TARGET_BYTE_ORDER=[$1])"
258 AC_ARG_ENABLE(sim-endian,
259 [ --enable-sim-endian=endian Specify target byte endian orientation.],
260 [case "${enableval}" in
261 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
262 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
263 yes) if test x"$wire_endian" != x; then
264 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
266 echo "No hard-wired endian for target $target" 1>&6
267 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
269 no) if test x"$default_endian" != x; then
270 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
272 echo "No default endian for target $target" 1>&6
273 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
275 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
277 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
278 echo "Setting endian flags = $sim_endian" 6>&1
279 fi],[sim_endian="${default_sim_endian}"])dnl
284 dnl --enable-sim-hostendian is for users of the simulator when
285 dnl they find that AC_C_BIGENDIAN does not function correctly
286 dnl (for instance in a canadian cross)
287 AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
289 AC_ARG_ENABLE(sim-hostendian,
290 [ --enable-sim-hostendain=end Specify host byte endian orientation.],
291 [case "${enableval}" in
292 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
293 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
294 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
295 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
297 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
298 echo "Setting hostendian flags = $sim_hostendian" 6>&1
300 if test "x$cross_compiling" = "xno"; then
302 if test $ac_cv_c_bigendian = yes; then
303 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
305 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
308 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
310 AC_SUBST(sim_hostendian)
314 AC_DEFUN(SIM_AC_OPTION_FLOAT,
316 default_sim_floating_point="ifelse([$1],,0,[$1])"
317 AC_ARG_ENABLE(sim-float,
318 [ --enable-sim-float Specify that the target processor has floating point hardware.],
319 [case "${enableval}" in
320 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
321 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
322 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
324 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
325 echo "Setting float flags = $sim_float" 6>&1
326 fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
331 dnl The argument is the default cache size if none is specified.
332 AC_DEFUN(SIM_AC_OPTION_SCACHE,
334 default_sim_scache="ifelse([$1],,0,[$1])"
335 AC_ARG_ENABLE(sim-scache,
336 [ --enable-sim-scache=size Specify simulator execution cache size.],
337 [case "${enableval}" in
338 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
340 [[0-9]]*) sim_cache=${enableval};;
341 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
344 if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
345 echo "Setting scache size = $sim_scache" 6>&1
346 fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
351 dnl The argument is the default model if none is specified.
352 AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
354 default_sim_default_model="ifelse([$1],,0,[$1])"
355 AC_ARG_ENABLE(sim-default-model,
356 [ --enable-sim-default-model=model Specify default model to simulate.],
357 [case "${enableval}" in
358 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
359 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
361 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
362 echo "Setting default model = $sim_default_model" 6>&1
363 fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
364 AC_SUBST(sim_default_model)
368 AC_DEFUN(SIM_AC_OPTION_HARDWARE,
370 AC_ARG_ENABLE(sim-hardware,
371 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
372 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
373 case "${enableval}" in
375 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
376 ,*) hardware="${hardware}${enableval}";;
377 *,) hardware="${enableval}${hardware}";;
378 *) hardware="${enableval}"'';;
380 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
381 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
382 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
383 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
384 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
385 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
386 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
387 if test x"$silent" != x"yes"; then
388 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
390 AC_SUBST(sim_hardware)
394 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
395 dnl performance by inlining functions.
396 AC_DEFUN(SIM_AC_OPTION_INLINE,
398 default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
399 AC_ARG_ENABLE(sim-inline,
400 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
403 no) sim_inline="-DDEFAULT_INLINE=0";;
404 0) sim_inline="-DDEFAULT_INLINE=0";;
405 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
406 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
407 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
410 *_INLINE=*) new_flag="-D$x";;
411 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
412 *_INLINE) new_flag="-D$x=ALL_INLINE";;
413 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
415 if test x"$sim_inline" = x""; then
416 sim_inline="$new_flag"
418 sim_inline="$sim_inline $new_flag"
422 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
423 echo "Setting inline flags = $sim_inline" 6>&1
424 fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
425 sim_inline="${default_sim_inline}"
426 if test x"$silent" != x"yes"; then
427 echo "Setting inline flags = $sim_inline" 6>&1
436 AC_DEFUN(SIM_AC_OPTION_PACKAGES,
438 AC_ARG_ENABLE(sim-packages,
439 [ --enable-sim-packages=list Specify the packages to be included in the build.],
441 case "${enableval}" in
443 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
444 ,*) packages="${packages}${enableval}";;
445 *,) packages="${enableval}${packages}";;
446 *) packages="${enableval}"'';;
448 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
449 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
450 if test x"$silent" != x"yes" && test x"$packages" != x""; then
451 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
452 fi],[packages=disklabel
453 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
454 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
455 if test x"$silent" != x"yes"; then
456 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
458 AC_SUBST(sim_packages)
462 AC_DEFUN(SIM_AC_OPTION_REGPARM,
464 AC_ARG_ENABLE(sim-regparm,
465 [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
466 [case "${enableval}" in
467 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
468 no) sim_regparm="" ;;
469 yes) sim_regparm="-DWITH_REGPARM=3";;
470 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
472 if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
473 echo "Setting regparm flags = $sim_regparm" 6>&1
474 fi],[sim_regparm=""])dnl
475 AC_SUBST(sim_regparm)
479 AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
481 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
482 AC_ARG_ENABLE(sim-reserved-bits,
483 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
484 [case "${enableval}" in
485 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
486 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
487 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
489 if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
490 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
491 fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
492 AC_SUBST(sim_reserved_bits)
496 AC_DEFUN(SIM_AC_OPTION_SMP,
498 default_sim_smp="ifelse([$1],,5,[$1])"
499 AC_ARG_ENABLE(sim-smp,
500 [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
501 [case "${enableval}" in
502 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
503 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
504 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
506 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
507 echo "Setting smp flags = $sim_smp" 6>&1
508 fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
509 if test x"$silent" != x"yes"; then
510 echo "Setting smp flags = $sim_smp" 6>&1
516 AC_DEFUN(SIM_AC_OPTION_STDCALL,
518 AC_ARG_ENABLE(sim-stdcall,
519 [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
520 [case "${enableval}" in
521 no) sim_stdcall="" ;;
522 std*) sim_stdcall="-DWITH_STDCALL=1";;
523 yes) sim_stdcall="-DWITH_STDCALL=1";;
524 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
526 if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
527 echo "Setting function call flags = $sim_stdcall" 6>&1
528 fi],[sim_stdcall=""])dnl
529 AC_SUBST(sim_stdcall)
533 AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
535 default_sim_xor_endian="ifelse([$1],,8,[$1])"
536 AC_ARG_ENABLE(sim-xor-endian,
537 [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
538 [case "${enableval}" in
539 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
540 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
541 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
543 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
544 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
545 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
546 AC_SUBST(sim_xor_endian)
550 dnl --enable-sim-warnings is for developers of the simulator.
551 dnl it enables extra GCC specific warnings.
552 AC_DEFUN(SIM_AC_OPTION_WARNINGS,
554 AC_ARG_ENABLE(sim-warnings,
555 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
556 [case "${enableval}" in
557 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
558 no) sim_warnings="-w";;
559 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
561 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
562 echo "Setting warning flags = $sim_warnings" 6>&1
563 fi],[sim_warnings=""])dnl
564 AC_SUBST(sim_warnings)
568 dnl Generate the Makefile in a target specific directory.
569 dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
570 dnl so this is a cover macro to tuck the details away of how we cope.
571 dnl We cope by having autoconf generate two files and then merge them into
572 dnl one afterwards. The two pieces of the common fragment are inserted into
573 dnl the target's fragment at the appropriate points.
575 AC_DEFUN(SIM_AC_OUTPUT,
577 AC_LINK_FILES($sim_link_files, $sim_link_links)
578 AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in,
579 [case "x$CONFIG_FILES" in xMakefile*)
580 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
581 rm -f Makesim1.tmp Makesim2.tmp Makefile
582 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
583 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
584 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
585 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
586 <Makefile.sim >Makefile
587 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
590 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac