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