Cleanup INLINE support for simulators using common framework.
[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)
8d0bd988
IC
51AC_CHECK_HEADERS(fcntl.h fpu_control.h)
52AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
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
278bda40 97 yes) sim_cflags="-O2 -fomit-frame-pointer";;
80b7b3a5
SG
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
d89fa2d8
AC
548dnl --enable-sim-hardware is for users of the simulator
549dnl arg[1] is a space separated list of devices that override the defaults
550dnl arg[2] is a space separated list of extra target specific devices.
a77aa7ec
AC
551AC_DEFUN(SIM_AC_OPTION_HARDWARE,
552[
d89fa2d8 553sim_hardware="-DWITH_HW=1"
278bda40 554sim_hw_obj="hw-device.o hw-ports.o hw-properties.o hw-base.o hw-tree.o sim-hw.o"
d89fa2d8 555hardware="ifelse([$1],,[core pal glue],[$1]) ifelse([$2],,,[$2])"
a77aa7ec 556AC_ARG_ENABLE(sim-hardware,
d89fa2d8
AC
557[ --enable-sim-hardware=LIST Specify the hardware to be included in the build.],
558[
a77aa7ec
AC
559case "${enableval}" in
560 yes) ;;
d89fa2d8
AC
561 no) hardware=""; sim_hardware="-DWITH_HW=0"; sim_hw_obj="";;
562 ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
563 *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
564 *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
a77aa7ec 565esac
d89fa2d8
AC
566dnl remove duplicates
567sim_hw=""
568for i in x $hardware ; do
569 case " $f " in
570 x) ;;
571 *" $i "*) ;;
572 *) sim_hw="$sim_hw $i" ;;
573 esac
574done
278bda40 575sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
a77aa7ec 576if test x"$silent" != x"yes" && test x"$hardware" != x""; then
d89fa2d8
AC
577 echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj"
578fi],[
579sim_hw="$hardware"
278bda40 580sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
a77aa7ec 581if test x"$silent" != x"yes"; then
d89fa2d8 582 echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj"
a77aa7ec 583fi])dnl
f2de7dfd 584])
92f91d1f 585AC_SUBST(sim_hardware)
d89fa2d8
AC
586AC_SUBST(sim_hw_obj)
587AC_SUBST(sim_hw)
f2de7dfd 588
80b7b3a5 589
f2de7dfd
AC
590dnl --enable-sim-inline is for users that wish to ramp up the simulator's
591dnl performance by inlining functions.
278bda40
AC
592dnl Guarantee that unconfigured simulators do not do any inlining
593sim_inline="-DDEFAULT_INLINE=0"
f2de7dfd
AC
594AC_DEFUN(SIM_AC_OPTION_INLINE,
595[
596default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
597AC_ARG_ENABLE(sim-inline,
598[ --enable-sim-inline=inlines Specify which functions should be inlined.],
599[sim_inline=""
600case "$enableval" in
601 no) sim_inline="-DDEFAULT_INLINE=0";;
602 0) sim_inline="-DDEFAULT_INLINE=0";;
278bda40 603 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
f2de7dfd
AC
604 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
605 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
606 new_flag=""
607 case "$x" in
608 *_INLINE=*) new_flag="-D$x";;
609 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
278bda40
AC
610 *_INLINE) new_flag="-D$x=ALL_C_INLINE";;
611 *) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
f2de7dfd
AC
612 esac
613 if test x"$sim_inline" = x""; then
614 sim_inline="$new_flag"
615 else
616 sim_inline="$sim_inline $new_flag"
617 fi
618 done;;
619esac
620if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
621 echo "Setting inline flags = $sim_inline" 6>&1
622fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
623 sim_inline="${default_sim_inline}"
624 if test x"$silent" != x"yes"; then
625 echo "Setting inline flags = $sim_inline" 6>&1
626 fi
627else
628 sim_inline=""
629fi])dnl
a77aa7ec 630])
92f91d1f 631AC_SUBST(sim_inline)
a77aa7ec
AC
632
633
634AC_DEFUN(SIM_AC_OPTION_PACKAGES,
635[
636AC_ARG_ENABLE(sim-packages,
637[ --enable-sim-packages=list Specify the packages to be included in the build.],
638[packages=disklabel
639case "${enableval}" in
640 yes) ;;
641 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
642 ,*) packages="${packages}${enableval}";;
643 *,) packages="${enableval}${packages}";;
644 *) packages="${enableval}"'';;
645esac
646sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
647sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
648if test x"$silent" != x"yes" && test x"$packages" != x""; then
649 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
650fi],[packages=disklabel
651sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
652sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
653if test x"$silent" != x"yes"; then
654 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
655fi])dnl
a77aa7ec 656])
92f91d1f 657AC_SUBST(sim_packages)
a77aa7ec
AC
658
659
660AC_DEFUN(SIM_AC_OPTION_REGPARM,
661[
662AC_ARG_ENABLE(sim-regparm,
663[ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
664[case "${enableval}" in
665 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
666 no) sim_regparm="" ;;
667 yes) sim_regparm="-DWITH_REGPARM=3";;
668 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
669esac
670if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
671 echo "Setting regparm flags = $sim_regparm" 6>&1
672fi],[sim_regparm=""])dnl
a77aa7ec 673])
92f91d1f 674AC_SUBST(sim_regparm)
a77aa7ec
AC
675
676
677AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
678[
a35e91c3 679default_sim_reserved_bits="ifelse([$1],,1,[$1])"
a77aa7ec
AC
680AC_ARG_ENABLE(sim-reserved-bits,
681[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
682[case "${enableval}" in
683 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
684 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
685 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
686esac
687if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
688 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
a35e91c3 689fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
a77aa7ec 690])
92f91d1f 691AC_SUBST(sim_reserved_bits)
a77aa7ec
AC
692
693
694AC_DEFUN(SIM_AC_OPTION_SMP,
695[
a35e91c3 696default_sim_smp="ifelse([$1],,5,[$1])"
a77aa7ec 697AC_ARG_ENABLE(sim-smp,
a35e91c3 698[ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
a77aa7ec
AC
699[case "${enableval}" in
700 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
701 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
702 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
703esac
704if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
705 echo "Setting smp flags = $sim_smp" 6>&1
a35e91c3 706fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
a77aa7ec
AC
707if test x"$silent" != x"yes"; then
708 echo "Setting smp flags = $sim_smp" 6>&1
709fi])dnl
f2de7dfd 710])
92f91d1f 711AC_SUBST(sim_smp)
80b7b3a5 712
80b7b3a5 713
a77aa7ec
AC
714AC_DEFUN(SIM_AC_OPTION_STDCALL,
715[
716AC_ARG_ENABLE(sim-stdcall,
717[ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
718[case "${enableval}" in
719 no) sim_stdcall="" ;;
720 std*) sim_stdcall="-DWITH_STDCALL=1";;
721 yes) sim_stdcall="-DWITH_STDCALL=1";;
722 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
723esac
724if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
725 echo "Setting function call flags = $sim_stdcall" 6>&1
726fi],[sim_stdcall=""])dnl
a77aa7ec 727])
92f91d1f 728AC_SUBST(sim_stdcall)
a77aa7ec
AC
729
730
a35e91c3
AC
731AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
732[
733default_sim_xor_endian="ifelse([$1],,8,[$1])"
734AC_ARG_ENABLE(sim-xor-endian,
735[ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
a77aa7ec 736[case "${enableval}" in
a35e91c3
AC
737 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
738 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
739 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
a77aa7ec 740esac
a35e91c3
AC
741if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
742 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
743fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
a35e91c3 744])
92f91d1f 745AC_SUBST(sim_xor_endian)
a77aa7ec
AC
746
747
f2de7dfd
AC
748dnl --enable-sim-warnings is for developers of the simulator.
749dnl it enables extra GCC specific warnings.
750AC_DEFUN(SIM_AC_OPTION_WARNINGS,
751[
752AC_ARG_ENABLE(sim-warnings,
88117054 753[ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
f2de7dfd
AC
754[case "${enableval}" in
755 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
756 no) sim_warnings="-w";;
757 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
758esac
759if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
760 echo "Setting warning flags = $sim_warnings" 6>&1
761fi],[sim_warnings=""])dnl
762])
92f91d1f 763AC_SUBST(sim_warnings)
80b7b3a5 764
80b7b3a5 765
f2de7dfd
AC
766dnl Generate the Makefile in a target specific directory.
767dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
768dnl so this is a cover macro to tuck the details away of how we cope.
769dnl We cope by having autoconf generate two files and then merge them into
770dnl one afterwards. The two pieces of the common fragment are inserted into
771dnl the target's fragment at the appropriate points.
80b7b3a5 772
f2de7dfd
AC
773AC_DEFUN(SIM_AC_OUTPUT,
774[
80b7b3a5 775AC_LINK_FILES($sim_link_files, $sim_link_links)
88d5f8e8
DE
776AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
777[case "x$CONFIG_FILES" in
778 xMakefile*)
f2de7dfd
AC
779 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
780 rm -f Makesim1.tmp Makesim2.tmp Makefile
781 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
782 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
783 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
784 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
785 <Makefile.sim >Makefile
786 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
787 ;;
788 esac
80b7b3a5 789 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
f2de7dfd
AC
790])
791])
This page took 0.094314 seconds and 4 git commands to generate.