* Added "test0" test bucket from SCEI. Due to changes in the behavior specs
[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
412c4e94
AC
329dnl arg[3] is the number of bits in an address
330dnl arg[4] is the number of bits in an OpenFirmware cell.
462cfbc4
DE
331dnl FIXME: this information should be obtained from bfd/archure
332AC_DEFUN(SIM_AC_OPTION_BITSIZE,
412c4e94
AC
333wire_word_bitsize="[$1]"
334wire_word_msb="[$2]"
335wire_address_bitsize="[$3]"
336wire_cell_bitsize="[$4]"
462cfbc4 337[AC_ARG_ENABLE(sim-bitsize,
412c4e94
AC
338[ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
339[sim_bitsize=
340case "${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
462cfbc4
DE
346 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
347 else
348 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
349 fi ;;
412c4e94 350 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
462cfbc4
DE
351 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
352 else
353 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
354 fi ;;
412c4e94
AC
355 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
356esac
357# address bitsize
358tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
359case x"${tmp}" in
360 x ) ;;
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") ;;
364esac
365# cell bitsize
366tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
367case x"${tmp}" in
368 x ) ;;
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") ;;
462cfbc4
DE
372esac
373if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
374 echo "Setting bitsize flags = $sim_bitsize" 6>&1
375fi],
376[sim_bitsize=""
412c4e94
AC
377if test x"$wire_word_bitsize" != x; then
378 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
379fi
380if test x"$wire_word_msb" != x; then
381 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
382fi
383if test x"$wire_address_bitsize" != x; then
384 sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
462cfbc4 385fi
412c4e94
AC
386if test x"$wire_cell_bitsize" != x; then
387 sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
462cfbc4
DE
388fi])dnl
389])
390AC_SUBST(sim_bitsize)
391
392
393
f2de7dfd
AC
394dnl --enable-sim-endian={yes,no,big,little} is for simulators
395dnl that support both big and little endian targets.
247fccde
AC
396dnl arg[1] is hardwired target endianness.
397dnl arg[2] is default target endianness.
f2de7dfd 398AC_DEFUN(SIM_AC_OPTION_ENDIAN,
8cd89e77 399[
92f91d1f
AC
400wire_endian="[$1]"
401default_endian="[$2]"
f2de7dfd
AC
402AC_ARG_ENABLE(sim-endian,
403[ --enable-sim-endian=endian Specify target byte endian orientation.],
404[case "${enableval}" in
f2de7dfd
AC
405 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
406 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
247fccde
AC
407 yes) if test x"$wire_endian" != x; then
408 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
409 else
92f91d1f
AC
410 if test x"$default_endian" != x; then
411 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
412 else
413 echo "No hard-wired endian for target $target" 1>&6
414 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
415 fi
247fccde
AC
416 fi;;
417 no) if test x"$default_endian" != x; then
418 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
419 else
92f91d1f
AC
420 if test x"$wire_endian" != x; then
421 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
422 else
423 echo "No default endian for target $target" 1>&6
424 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
425 fi
247fccde 426 fi;;
f2de7dfd
AC
427 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
428esac
429if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
430 echo "Setting endian flags = $sim_endian" 6>&1
92f91d1f
AC
431fi],
432[if test x"$default_endian" != x; then
433 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
434else
435 if test x"$wire_endian" != x; then
436 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
437 else
438 sim_endian=
439 fi
440fi])dnl
f2de7dfd 441])
92f91d1f 442AC_SUBST(sim_endian)
8cd89e77 443
80b7b3a5 444
f2de7dfd
AC
445dnl --enable-sim-hostendian is for users of the simulator when
446dnl they find that AC_C_BIGENDIAN does not function correctly
447dnl (for instance in a canadian cross)
448AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
449[
450AC_ARG_ENABLE(sim-hostendian,
462cfbc4 451[ --enable-sim-hostendian=end Specify host byte endian orientation.],
f2de7dfd
AC
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="";;
457esac
458if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
459 echo "Setting hostendian flags = $sim_hostendian" 6>&1
460fi],[
461if test "x$cross_compiling" = "xno"; then
462 AC_C_BIGENDIAN
463 if test $ac_cv_c_bigendian = yes; then
464 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
465 else
466 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
467 fi
468else
469 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
470fi])dnl
a77aa7ec 471])
92f91d1f 472AC_SUBST(sim_hostendian)
a77aa7ec
AC
473
474
475AC_DEFUN(SIM_AC_OPTION_FLOAT,
476[
a35e91c3 477default_sim_floating_point="ifelse([$1],,0,[$1])"
a77aa7ec 478AC_ARG_ENABLE(sim-float,
a35e91c3 479[ --enable-sim-float Specify that the target processor has floating point hardware.],
a77aa7ec
AC
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="";;
484esac
485if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
486 echo "Setting float flags = $sim_float" 6>&1
a35e91c3 487fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
a77aa7ec 488])
92f91d1f 489AC_SUBST(sim_float)
a77aa7ec
AC
490
491
247fccde
AC
492dnl The argument is the default cache size if none is specified.
493AC_DEFUN(SIM_AC_OPTION_SCACHE,
494[
495default_sim_scache="ifelse([$1],,0,[$1])"
496AC_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}";;
462cfbc4 500 no) sim_scache="-DWITH_SCACHE=0" ;;
247fccde
AC
501 [[0-9]]*) sim_cache=${enableval};;
502 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
503 sim_scache="";;
504esac
505if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
506 echo "Setting scache size = $sim_scache" 6>&1
507fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
247fccde 508])
92f91d1f 509AC_SUBST(sim_scache)
247fccde
AC
510
511
512dnl The argument is the default model if none is specified.
513AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
514[
515default_sim_default_model="ifelse([$1],,0,[$1])"
516AC_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}\"'";;
521esac
522if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
523 echo "Setting default model = $sim_default_model" 6>&1
524fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
247fccde 525])
92f91d1f 526AC_SUBST(sim_default_model)
247fccde
AC
527
528
a77aa7ec
AC
529AC_DEFUN(SIM_AC_OPTION_HARDWARE,
530[
531AC_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"
534case "${enableval}" in
535 yes) ;;
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}"'';;
540esac
541sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
542sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
543if test x"$silent" != x"yes" && test x"$hardware" != x""; then
544 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
545fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
546sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
547sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
548if test x"$silent" != x"yes"; then
549 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
550fi])dnl
f2de7dfd 551])
92f91d1f 552AC_SUBST(sim_hardware)
f2de7dfd 553
80b7b3a5 554
f2de7dfd
AC
555dnl --enable-sim-inline is for users that wish to ramp up the simulator's
556dnl performance by inlining functions.
557AC_DEFUN(SIM_AC_OPTION_INLINE,
558[
559default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
560AC_ARG_ENABLE(sim-inline,
561[ --enable-sim-inline=inlines Specify which functions should be inlined.],
562[sim_inline=""
563case "$enableval" in
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
569 new_flag=""
570 case "$x" in
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";;
575 esac
576 if test x"$sim_inline" = x""; then
577 sim_inline="$new_flag"
578 else
579 sim_inline="$sim_inline $new_flag"
580 fi
581 done;;
582esac
583if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
584 echo "Setting inline flags = $sim_inline" 6>&1
585fi],[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
589 fi
590else
591 sim_inline=""
592fi])dnl
a77aa7ec 593])
92f91d1f 594AC_SUBST(sim_inline)
a77aa7ec
AC
595
596
597AC_DEFUN(SIM_AC_OPTION_PACKAGES,
598[
599AC_ARG_ENABLE(sim-packages,
600[ --enable-sim-packages=list Specify the packages to be included in the build.],
601[packages=disklabel
602case "${enableval}" in
603 yes) ;;
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}"'';;
608esac
609sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
610sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
611if test x"$silent" != x"yes" && test x"$packages" != x""; then
612 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
613fi],[packages=disklabel
614sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
615sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
616if test x"$silent" != x"yes"; then
617 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
618fi])dnl
a77aa7ec 619])
92f91d1f 620AC_SUBST(sim_packages)
a77aa7ec
AC
621
622
623AC_DEFUN(SIM_AC_OPTION_REGPARM,
624[
625AC_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="";;
632esac
633if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
634 echo "Setting regparm flags = $sim_regparm" 6>&1
635fi],[sim_regparm=""])dnl
a77aa7ec 636])
92f91d1f 637AC_SUBST(sim_regparm)
a77aa7ec
AC
638
639
640AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
641[
a35e91c3 642default_sim_reserved_bits="ifelse([$1],,1,[$1])"
a77aa7ec
AC
643AC_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="";;
649esac
650if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
651 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
a35e91c3 652fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
a77aa7ec 653])
92f91d1f 654AC_SUBST(sim_reserved_bits)
a77aa7ec
AC
655
656
657AC_DEFUN(SIM_AC_OPTION_SMP,
658[
a35e91c3 659default_sim_smp="ifelse([$1],,5,[$1])"
a77aa7ec 660AC_ARG_ENABLE(sim-smp,
a35e91c3 661[ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
a77aa7ec
AC
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";;
666esac
667if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
668 echo "Setting smp flags = $sim_smp" 6>&1
a35e91c3 669fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
a77aa7ec
AC
670if test x"$silent" != x"yes"; then
671 echo "Setting smp flags = $sim_smp" 6>&1
672fi])dnl
f2de7dfd 673])
92f91d1f 674AC_SUBST(sim_smp)
80b7b3a5 675
80b7b3a5 676
a77aa7ec
AC
677AC_DEFUN(SIM_AC_OPTION_STDCALL,
678[
679AC_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="";;
686esac
687if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
688 echo "Setting function call flags = $sim_stdcall" 6>&1
689fi],[sim_stdcall=""])dnl
a77aa7ec 690])
92f91d1f 691AC_SUBST(sim_stdcall)
a77aa7ec
AC
692
693
a35e91c3
AC
694AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
695[
696default_sim_xor_endian="ifelse([$1],,8,[$1])"
697AC_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}).],
a77aa7ec 699[case "${enableval}" in
a35e91c3
AC
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";;
a77aa7ec 703esac
a35e91c3
AC
704if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
705 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
706fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
a35e91c3 707])
92f91d1f 708AC_SUBST(sim_xor_endian)
a77aa7ec
AC
709
710
f2de7dfd
AC
711dnl --enable-sim-warnings is for developers of the simulator.
712dnl it enables extra GCC specific warnings.
713AC_DEFUN(SIM_AC_OPTION_WARNINGS,
714[
715AC_ARG_ENABLE(sim-warnings,
88117054 716[ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
f2de7dfd
AC
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"`;;
721esac
722if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
723 echo "Setting warning flags = $sim_warnings" 6>&1
724fi],[sim_warnings=""])dnl
725])
92f91d1f 726AC_SUBST(sim_warnings)
80b7b3a5 727
80b7b3a5 728
f2de7dfd
AC
729dnl Generate the Makefile in a target specific directory.
730dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
731dnl so this is a cover macro to tuck the details away of how we cope.
732dnl We cope by having autoconf generate two files and then merge them into
733dnl one afterwards. The two pieces of the common fragment are inserted into
734dnl the target's fragment at the appropriate points.
80b7b3a5 735
f2de7dfd
AC
736AC_DEFUN(SIM_AC_OUTPUT,
737[
80b7b3a5 738AC_LINK_FILES($sim_link_files, $sim_link_links)
88d5f8e8
DE
739AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
740[case "x$CONFIG_FILES" in
741 xMakefile*)
f2de7dfd
AC
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
750 ;;
751 esac
80b7b3a5 752 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
f2de7dfd
AC
753])
754])
This page took 0.091058 seconds and 4 git commands to generate.