1 |
131 |
jeremybenn |
# This file contains common code used by all simulators.
|
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 |
|
|
#
|
10 |
|
|
# dnl Process this file with autoconf to produce a configure script.
|
11 |
|
|
# sinclude(../common/aclocal.m4)
|
12 |
|
|
# AC_PREREQ(2.5)dnl
|
13 |
|
|
# AC_INIT(Makefile.in)
|
14 |
|
|
#
|
15 |
|
|
# SIM_AC_COMMON
|
16 |
|
|
#
|
17 |
|
|
# ... target specific stuff ...
|
18 |
|
|
#
|
19 |
|
|
# SIM_AC_OUTPUT
|
20 |
|
|
|
21 |
|
|
AC_DEFUN(SIM_AC_COMMON,
|
22 |
|
|
[
|
23 |
|
|
# autoconf.info says this should be called right after AC_INIT.
|
24 |
|
|
AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
|
25 |
|
|
AC_CANONICAL_SYSTEM
|
26 |
|
|
AC_ARG_PROGRAM
|
27 |
|
|
AC_PROG_CC
|
28 |
|
|
AC_PROG_INSTALL
|
29 |
|
|
|
30 |
|
|
# Put a plausible default for CC_FOR_BUILD in Makefile.
|
31 |
|
|
if test "x$cross_compiling" = "xno"; then
|
32 |
|
|
CC_FOR_BUILD='$(CC)'
|
33 |
|
|
else
|
34 |
|
|
CC_FOR_BUILD=gcc
|
35 |
|
|
fi
|
36 |
|
|
AC_SUBST(CC_FOR_BUILD)
|
37 |
|
|
|
38 |
|
|
AC_SUBST(CFLAGS)
|
39 |
|
|
AC_SUBST(HDEFINES)
|
40 |
|
|
AR=${AR-ar}
|
41 |
|
|
AC_SUBST(AR)
|
42 |
|
|
AC_PROG_RANLIB
|
43 |
|
|
|
44 |
|
|
dnl We don't use gettext, but bfd does. So we do the appropriate checks
|
45 |
|
|
dnl to see if there are intl libraries we should link against.
|
46 |
|
|
ALL_LINGUAS=
|
47 |
|
|
ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
|
48 |
|
|
|
49 |
|
|
# Check for common headers.
|
50 |
|
|
# FIXME: Seems to me this can cause problems for i386-windows hosts.
|
51 |
|
|
# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
|
52 |
|
|
AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
|
53 |
|
|
AC_CHECK_HEADERS(sys/time.h sys/resource.h)
|
54 |
|
|
AC_CHECK_HEADERS(fcntl.h fpu_control.h)
|
55 |
|
|
AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
|
56 |
|
|
AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
|
57 |
|
|
|
58 |
|
|
# Check for socket libraries
|
59 |
|
|
AC_CHECK_LIB(socket, bind)
|
60 |
|
|
AC_CHECK_LIB(nsl, gethostbyname)
|
61 |
|
|
|
62 |
|
|
. ${srcdir}/../../bfd/configure.host
|
63 |
|
|
|
64 |
|
|
dnl Standard (and optional) simulator options.
|
65 |
|
|
dnl Eventually all simulators will support these.
|
66 |
|
|
dnl Do not add any here that cannot be supported by all simulators.
|
67 |
|
|
dnl Do not add similar but different options to a particular simulator,
|
68 |
|
|
dnl all shall eventually behave the same way.
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
dnl We don't use automake, but we still want to support
|
72 |
|
|
dnl --enable-maintainer-mode.
|
73 |
|
|
USE_MAINTAINER_MODE=no
|
74 |
|
|
AC_ARG_ENABLE(maintainer-mode,
|
75 |
|
|
[ --enable-maintainer-mode Enable developer functionality.],
|
76 |
|
|
[case "${enableval}" in
|
77 |
|
|
yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
|
78 |
|
|
no) MAINT="#" ;;
|
79 |
|
|
*) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
|
80 |
|
|
esac
|
81 |
|
|
if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
|
82 |
|
|
echo "Setting maintainer mode" 6>&1
|
83 |
|
|
fi],[MAINT="#"])dnl
|
84 |
|
|
AC_SUBST(MAINT)
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
dnl This is a generic option to enable special byte swapping
|
88 |
|
|
dnl insns on *any* cpu.
|
89 |
|
|
AC_ARG_ENABLE(sim-bswap,
|
90 |
|
|
[ --enable-sim-bswap Use Host specific BSWAP instruction.],
|
91 |
|
|
[case "${enableval}" in
|
92 |
|
|
yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
|
93 |
|
|
no) sim_bswap="-DWITH_BSWAP=0";;
|
94 |
|
|
*) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
|
95 |
|
|
esac
|
96 |
|
|
if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
|
97 |
|
|
echo "Setting bswap flags = $sim_bswap" 6>&1
|
98 |
|
|
fi],[sim_bswap=""])dnl
|
99 |
|
|
AC_SUBST(sim_bswap)
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
AC_ARG_ENABLE(sim-cflags,
|
103 |
|
|
[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
|
104 |
|
|
[case "${enableval}" in
|
105 |
|
|
yes) sim_cflags="-O2 -fomit-frame-pointer";;
|
106 |
|
|
trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
|
107 |
|
|
no) sim_cflags="";;
|
108 |
|
|
*) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
109 |
|
|
esac
|
110 |
|
|
if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
|
111 |
|
|
echo "Setting sim cflags = $sim_cflags" 6>&1
|
112 |
|
|
fi],[sim_cflags=""])dnl
|
113 |
|
|
AC_SUBST(sim_cflags)
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
dnl --enable-sim-debug is for developers of the simulator
|
117 |
|
|
dnl the allowable values are work-in-progress
|
118 |
|
|
AC_ARG_ENABLE(sim-debug,
|
119 |
|
|
[ --enable-sim-debug=opts Enable debugging flags],
|
120 |
|
|
[case "${enableval}" in
|
121 |
|
|
yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
|
122 |
|
|
no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
|
123 |
|
|
*) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
|
124 |
|
|
esac
|
125 |
|
|
if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
|
126 |
|
|
echo "Setting sim debug = $sim_debug" 6>&1
|
127 |
|
|
fi],[sim_debug=""])dnl
|
128 |
|
|
AC_SUBST(sim_debug)
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
dnl --enable-sim-stdio is for users of the simulator
|
132 |
|
|
dnl It determines if IO from the program is routed through STDIO (buffered)
|
133 |
|
|
AC_ARG_ENABLE(sim-stdio,
|
134 |
|
|
[ --enable-sim-stdio Specify whether to use stdio for console input/output.],
|
135 |
|
|
[case "${enableval}" in
|
136 |
|
|
yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
|
137 |
|
|
no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
|
138 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
|
139 |
|
|
esac
|
140 |
|
|
if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
|
141 |
|
|
echo "Setting stdio flags = $sim_stdio" 6>&1
|
142 |
|
|
fi],[sim_stdio=""])dnl
|
143 |
|
|
AC_SUBST(sim_stdio)
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
dnl --enable-sim-trace is for users of the simulator
|
147 |
|
|
dnl The argument is either a bitmask of things to enable [exactly what is
|
148 |
|
|
dnl up to the simulator], or is a comma separated list of names of tracing
|
149 |
|
|
dnl elements to enable. The latter is only supported on simulators that
|
150 |
|
|
dnl use WITH_TRACE.
|
151 |
|
|
AC_ARG_ENABLE(sim-trace,
|
152 |
|
|
[ --enable-sim-trace=opts Enable tracing flags],
|
153 |
|
|
[case "${enableval}" in
|
154 |
|
|
yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
|
155 |
|
|
no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
|
156 |
|
|
[[-0-9]]*)
|
157 |
|
|
sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
|
158 |
|
|
[[a-z]]*)
|
159 |
|
|
sim_trace=""
|
160 |
|
|
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
161 |
|
|
if test x"$sim_trace" = x; then
|
162 |
|
|
sim_trace="-DWITH_TRACE='(TRACE_$x"
|
163 |
|
|
else
|
164 |
|
|
sim_trace="${sim_trace}|TRACE_$x"
|
165 |
|
|
fi
|
166 |
|
|
done
|
167 |
|
|
sim_trace="$sim_trace)'" ;;
|
168 |
|
|
esac
|
169 |
|
|
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
|
170 |
|
|
echo "Setting sim trace = $sim_trace" 6>&1
|
171 |
|
|
fi],[sim_trace=""])dnl
|
172 |
|
|
AC_SUBST(sim_trace)
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
dnl --enable-sim-profile
|
176 |
|
|
dnl The argument is either a bitmask of things to enable [exactly what is
|
177 |
|
|
dnl up to the simulator], or is a comma separated list of names of profiling
|
178 |
|
|
dnl elements to enable. The latter is only supported on simulators that
|
179 |
|
|
dnl use WITH_PROFILE.
|
180 |
|
|
AC_ARG_ENABLE(sim-profile,
|
181 |
|
|
[ --enable-sim-profile=opts Enable profiling flags],
|
182 |
|
|
[case "${enableval}" in
|
183 |
|
|
yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
|
184 |
|
|
no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
|
185 |
|
|
[[-0-9]]*)
|
186 |
|
|
sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
|
187 |
|
|
[[a-z]]*)
|
188 |
|
|
sim_profile=""
|
189 |
|
|
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
190 |
|
|
if test x"$sim_profile" = x; then
|
191 |
|
|
sim_profile="-DWITH_PROFILE='(PROFILE_$x"
|
192 |
|
|
else
|
193 |
|
|
sim_profile="${sim_profile}|PROFILE_$x"
|
194 |
|
|
fi
|
195 |
|
|
done
|
196 |
|
|
sim_profile="$sim_profile)'" ;;
|
197 |
|
|
esac
|
198 |
|
|
if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
|
199 |
|
|
echo "Setting sim profile = $sim_profile" 6>&1
|
200 |
|
|
fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl
|
201 |
|
|
AC_SUBST(sim_profile)
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
dnl Types used by common code
|
205 |
|
|
AC_TYPE_SIGNAL
|
206 |
|
|
|
207 |
|
|
dnl Detect exe extension
|
208 |
|
|
AC_EXEEXT
|
209 |
|
|
|
210 |
|
|
dnl These are available to append to as desired.
|
211 |
|
|
sim_link_files=
|
212 |
|
|
sim_link_links=
|
213 |
|
|
|
214 |
|
|
dnl Create tconfig.h either from simulator's tconfig.in or default one
|
215 |
|
|
dnl in common.
|
216 |
|
|
sim_link_links=tconfig.h
|
217 |
|
|
if test -f ${srcdir}/tconfig.in
|
218 |
|
|
then
|
219 |
|
|
sim_link_files=tconfig.in
|
220 |
|
|
else
|
221 |
|
|
sim_link_files=../common/tconfig.in
|
222 |
|
|
fi
|
223 |
|
|
|
224 |
|
|
# targ-vals.def points to the libc macro description file.
|
225 |
|
|
case "${target}" in
|
226 |
|
|
*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
|
227 |
|
|
esac
|
228 |
|
|
sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
|
229 |
|
|
sim_link_links="${sim_link_links} targ-vals.def"
|
230 |
|
|
|
231 |
|
|
]) dnl End of SIM_AC_COMMON
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
dnl Additional SIM options that can (optionally) be configured
|
235 |
|
|
dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
|
236 |
|
|
dnl Simulators that wish to use the relevant option specify the macro
|
237 |
|
|
dnl in the simulator specific configure.in file between the SIM_AC_COMMON
|
238 |
|
|
dnl and SIM_AC_OUTPUT lines.
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
dnl Specify the running environment.
|
242 |
|
|
dnl If the simulator invokes this in its configure.in then without this option
|
243 |
|
|
dnl the default is the user environment and all are runtime selectable.
|
244 |
|
|
dnl If the simulator doesn't invoke this, only the user environment is
|
245 |
|
|
dnl supported.
|
246 |
|
|
dnl ??? Until there is demonstrable value in doing something more complicated,
|
247 |
|
|
dnl let's not.
|
248 |
|
|
AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
|
249 |
|
|
[
|
250 |
|
|
AC_ARG_ENABLE(sim-environment,
|
251 |
|
|
[ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
|
252 |
|
|
[case "${enableval}" in
|
253 |
|
|
all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
|
254 |
|
|
user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
|
255 |
|
|
virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
|
256 |
|
|
operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
|
257 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
|
258 |
|
|
sim_environment="";;
|
259 |
|
|
esac
|
260 |
|
|
if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
|
261 |
|
|
echo "Setting sim environment = $sim_environment" 6>&1
|
262 |
|
|
fi],
|
263 |
|
|
[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
|
264 |
|
|
])
|
265 |
|
|
AC_SUBST(sim_environment)
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
dnl Specify the alignment restrictions of the target architecture.
|
269 |
|
|
dnl Without this option all possible alignment restrictions are accommodated.
|
270 |
|
|
dnl arg[1] is hardwired target alignment
|
271 |
|
|
dnl arg[2] is default target alignment
|
272 |
|
|
AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
|
273 |
|
|
wire_alignment="[$1]"
|
274 |
|
|
default_alignment="[$2]"
|
275 |
|
|
[
|
276 |
|
|
AC_ARG_ENABLE(sim-alignment,
|
277 |
|
|
[ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
|
278 |
|
|
[case "${enableval}" in
|
279 |
|
|
strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
|
280 |
|
|
nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
|
281 |
|
|
forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
|
282 |
|
|
yes) if test x"$wire_alignment" != x; then
|
283 |
|
|
sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
|
284 |
|
|
else
|
285 |
|
|
if test x"$default_alignment" != x; then
|
286 |
|
|
sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
|
287 |
|
|
else
|
288 |
|
|
echo "No hard-wired alignment for target $target" 1>&6
|
289 |
|
|
sim_alignment="-DWITH_ALIGNMENT=0"
|
290 |
|
|
fi
|
291 |
|
|
fi;;
|
292 |
|
|
no) if test x"$default_alignment" != x; then
|
293 |
|
|
sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
|
294 |
|
|
else
|
295 |
|
|
if test x"$wire_alignment" != x; then
|
296 |
|
|
sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
|
297 |
|
|
else
|
298 |
|
|
echo "No default alignment for target $target" 1>&6
|
299 |
|
|
sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
|
300 |
|
|
fi
|
301 |
|
|
fi;;
|
302 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
|
303 |
|
|
esac
|
304 |
|
|
if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
|
305 |
|
|
echo "Setting alignment flags = $sim_alignment" 6>&1
|
306 |
|
|
fi],
|
307 |
|
|
[if test x"$default_alignment" != x; then
|
308 |
|
|
sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
|
309 |
|
|
else
|
310 |
|
|
if test x"$wire_alignment" != x; then
|
311 |
|
|
sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
|
312 |
|
|
else
|
313 |
|
|
sim_alignment=
|
314 |
|
|
fi
|
315 |
|
|
fi])dnl
|
316 |
|
|
])dnl
|
317 |
|
|
AC_SUBST(sim_alignment)
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
dnl Conditionally compile in assertion statements.
|
321 |
|
|
AC_DEFUN(SIM_AC_OPTION_ASSERT,
|
322 |
|
|
[
|
323 |
|
|
AC_ARG_ENABLE(sim-assert,
|
324 |
|
|
[ --enable-sim-assert Specify whether to perform random assertions.],
|
325 |
|
|
[case "${enableval}" in
|
326 |
|
|
yes) sim_assert="-DWITH_ASSERT=1";;
|
327 |
|
|
no) sim_assert="-DWITH_ASSERT=0";;
|
328 |
|
|
*) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
|
329 |
|
|
esac
|
330 |
|
|
if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
|
331 |
|
|
echo "Setting assert flags = $sim_assert" 6>&1
|
332 |
|
|
fi],[sim_assert=""])dnl
|
333 |
|
|
])
|
334 |
|
|
AC_SUBST(sim_assert)
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
dnl --enable-sim-bitsize is for developers of the simulator
|
339 |
|
|
dnl It specifies the number of BITS in the target.
|
340 |
|
|
dnl arg[1] is the number of bits in a word
|
341 |
|
|
dnl arg[2] is the number assigned to the most significant bit
|
342 |
|
|
dnl arg[3] is the number of bits in an address
|
343 |
|
|
dnl arg[4] is the number of bits in an OpenFirmware cell.
|
344 |
|
|
dnl FIXME: this information should be obtained from bfd/archure
|
345 |
|
|
AC_DEFUN(SIM_AC_OPTION_BITSIZE,
|
346 |
|
|
wire_word_bitsize="[$1]"
|
347 |
|
|
wire_word_msb="[$2]"
|
348 |
|
|
wire_address_bitsize="[$3]"
|
349 |
|
|
wire_cell_bitsize="[$4]"
|
350 |
|
|
[AC_ARG_ENABLE(sim-bitsize,
|
351 |
|
|
[ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
|
352 |
|
|
[sim_bitsize=
|
353 |
|
|
case "${enableval}" in
|
354 |
|
|
64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
|
355 |
|
|
32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
|
356 |
|
|
64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
|
357 |
|
|
32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
|
358 |
|
|
32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
|
359 |
|
|
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
|
360 |
|
|
else
|
361 |
|
|
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
|
362 |
|
|
fi ;;
|
363 |
|
|
64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
|
364 |
|
|
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
|
365 |
|
|
else
|
366 |
|
|
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
|
367 |
|
|
fi ;;
|
368 |
|
|
*) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
|
369 |
|
|
esac
|
370 |
|
|
# address bitsize
|
371 |
|
|
tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
|
372 |
|
|
case x"${tmp}" in
|
373 |
|
|
x ) ;;
|
374 |
|
|
x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
|
375 |
|
|
x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
|
376 |
|
|
* ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;
|
377 |
|
|
esac
|
378 |
|
|
# cell bitsize
|
379 |
|
|
tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
|
380 |
|
|
case x"${tmp}" in
|
381 |
|
|
x ) ;;
|
382 |
|
|
x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
|
383 |
|
|
x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
|
384 |
|
|
* ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;
|
385 |
|
|
esac
|
386 |
|
|
if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
|
387 |
|
|
echo "Setting bitsize flags = $sim_bitsize" 6>&1
|
388 |
|
|
fi],
|
389 |
|
|
[sim_bitsize=""
|
390 |
|
|
if test x"$wire_word_bitsize" != x; then
|
391 |
|
|
sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
|
392 |
|
|
fi
|
393 |
|
|
if test x"$wire_word_msb" != x; then
|
394 |
|
|
sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
|
395 |
|
|
fi
|
396 |
|
|
if test x"$wire_address_bitsize" != x; then
|
397 |
|
|
sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
|
398 |
|
|
fi
|
399 |
|
|
if test x"$wire_cell_bitsize" != x; then
|
400 |
|
|
sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
|
401 |
|
|
fi])dnl
|
402 |
|
|
])
|
403 |
|
|
AC_SUBST(sim_bitsize)
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
dnl --enable-sim-endian={yes,no,big,little} is for simulators
|
408 |
|
|
dnl that support both big and little endian targets.
|
409 |
|
|
dnl arg[1] is hardwired target endianness.
|
410 |
|
|
dnl arg[2] is default target endianness.
|
411 |
|
|
AC_DEFUN(SIM_AC_OPTION_ENDIAN,
|
412 |
|
|
[
|
413 |
|
|
wire_endian="[$1]"
|
414 |
|
|
default_endian="[$2]"
|
415 |
|
|
AC_ARG_ENABLE(sim-endian,
|
416 |
|
|
[ --enable-sim-endian=endian Specify target byte endian orientation.],
|
417 |
|
|
[case "${enableval}" in
|
418 |
|
|
b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
419 |
|
|
l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
420 |
|
|
yes) if test x"$wire_endian" != x; then
|
421 |
|
|
sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
|
422 |
|
|
else
|
423 |
|
|
if test x"$default_endian" != x; then
|
424 |
|
|
sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
|
425 |
|
|
else
|
426 |
|
|
echo "No hard-wired endian for target $target" 1>&6
|
427 |
|
|
sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
|
428 |
|
|
fi
|
429 |
|
|
fi;;
|
430 |
|
|
no) if test x"$default_endian" != x; then
|
431 |
|
|
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
|
432 |
|
|
else
|
433 |
|
|
if test x"$wire_endian" != x; then
|
434 |
|
|
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
|
435 |
|
|
else
|
436 |
|
|
echo "No default endian for target $target" 1>&6
|
437 |
|
|
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
|
438 |
|
|
fi
|
439 |
|
|
fi;;
|
440 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
|
441 |
|
|
esac
|
442 |
|
|
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
|
443 |
|
|
echo "Setting endian flags = $sim_endian" 6>&1
|
444 |
|
|
fi],
|
445 |
|
|
[if test x"$default_endian" != x; then
|
446 |
|
|
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
|
447 |
|
|
else
|
448 |
|
|
if test x"$wire_endian" != x; then
|
449 |
|
|
sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
|
450 |
|
|
else
|
451 |
|
|
sim_endian=
|
452 |
|
|
fi
|
453 |
|
|
fi])dnl
|
454 |
|
|
])
|
455 |
|
|
AC_SUBST(sim_endian)
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
dnl --enable-sim-hostendian is for users of the simulator when
|
459 |
|
|
dnl they find that AC_C_BIGENDIAN does not function correctly
|
460 |
|
|
dnl (for instance in a canadian cross)
|
461 |
|
|
AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
|
462 |
|
|
[
|
463 |
|
|
AC_ARG_ENABLE(sim-hostendian,
|
464 |
|
|
[ --enable-sim-hostendian=end Specify host byte endian orientation.],
|
465 |
|
|
[case "${enableval}" in
|
466 |
|
|
no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
|
467 |
|
|
b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
|
468 |
|
|
l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
|
469 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
|
470 |
|
|
esac
|
471 |
|
|
if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
|
472 |
|
|
echo "Setting hostendian flags = $sim_hostendian" 6>&1
|
473 |
|
|
fi],[
|
474 |
|
|
if test "x$cross_compiling" = "xno"; then
|
475 |
|
|
AC_C_BIGENDIAN
|
476 |
|
|
if test $ac_cv_c_bigendian = yes; then
|
477 |
|
|
sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
|
478 |
|
|
else
|
479 |
|
|
sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
|
480 |
|
|
fi
|
481 |
|
|
else
|
482 |
|
|
sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
|
483 |
|
|
fi])dnl
|
484 |
|
|
])
|
485 |
|
|
AC_SUBST(sim_hostendian)
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
dnl --enable-sim-float is for developers of the simulator
|
489 |
|
|
dnl It specifies the presence of hardware floating point
|
490 |
|
|
dnl And optionally the bitsize of the floating point register.
|
491 |
|
|
dnl arg[1] specifies the presence (or absence) of floating point hardware
|
492 |
|
|
dnl arg[2] specifies the number of bits in a floating point register
|
493 |
|
|
AC_DEFUN(SIM_AC_OPTION_FLOAT,
|
494 |
|
|
[
|
495 |
|
|
default_sim_float="[$1]"
|
496 |
|
|
default_sim_float_bitsize="[$2]"
|
497 |
|
|
AC_ARG_ENABLE(sim-float,
|
498 |
|
|
[ --enable-sim-float Specify that the target processor has floating point hardware.],
|
499 |
|
|
[case "${enableval}" in
|
500 |
|
|
yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
|
501 |
|
|
no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
|
502 |
|
|
32) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";;
|
503 |
|
|
64) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";;
|
504 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
|
505 |
|
|
esac
|
506 |
|
|
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
|
507 |
|
|
echo "Setting float flags = $sim_float" 6>&1
|
508 |
|
|
fi],[
|
509 |
|
|
sim_float=
|
510 |
|
|
if test x"${default_sim_float}" != x""; then
|
511 |
|
|
sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
|
512 |
|
|
fi
|
513 |
|
|
if test x"${default_sim_float_bitsize}" != x""; then
|
514 |
|
|
sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
|
515 |
|
|
fi
|
516 |
|
|
])dnl
|
517 |
|
|
])
|
518 |
|
|
AC_SUBST(sim_float)
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
dnl The argument is the default cache size if none is specified.
|
522 |
|
|
AC_DEFUN(SIM_AC_OPTION_SCACHE,
|
523 |
|
|
[
|
524 |
|
|
default_sim_scache="ifelse([$1],,0,[$1])"
|
525 |
|
|
AC_ARG_ENABLE(sim-scache,
|
526 |
|
|
[ --enable-sim-scache=size Specify simulator execution cache size.],
|
527 |
|
|
[case "${enableval}" in
|
528 |
|
|
yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
|
529 |
|
|
no) sim_scache="-DWITH_SCACHE=0" ;;
|
530 |
|
|
[[0-9]]*) sim_scache="-DWITH_SCACHE=${enableval}";;
|
531 |
|
|
*) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
|
532 |
|
|
sim_scache="";;
|
533 |
|
|
esac
|
534 |
|
|
if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
|
535 |
|
|
echo "Setting scache size = $sim_scache" 6>&1
|
536 |
|
|
fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
|
537 |
|
|
])
|
538 |
|
|
AC_SUBST(sim_scache)
|
539 |
|
|
|
540 |
|
|
|
541 |
|
|
dnl The argument is the default model if none is specified.
|
542 |
|
|
AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
|
543 |
|
|
[
|
544 |
|
|
default_sim_default_model="ifelse([$1],,0,[$1])"
|
545 |
|
|
AC_ARG_ENABLE(sim-default-model,
|
546 |
|
|
[ --enable-sim-default-model=model Specify default model to simulate.],
|
547 |
|
|
[case "${enableval}" in
|
548 |
|
|
yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
|
549 |
|
|
*) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
|
550 |
|
|
esac
|
551 |
|
|
if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
|
552 |
|
|
echo "Setting default model = $sim_default_model" 6>&1
|
553 |
|
|
fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
|
554 |
|
|
])
|
555 |
|
|
AC_SUBST(sim_default_model)
|
556 |
|
|
|
557 |
|
|
|
558 |
|
|
dnl --enable-sim-hardware is for users of the simulator
|
559 |
|
|
dnl arg[1] Enable sim-hw by default? ("yes" or "no")
|
560 |
|
|
dnl arg[2] is a space separated list of devices that override the defaults
|
561 |
|
|
dnl arg[3] is a space separated list of extra target specific devices.
|
562 |
|
|
AC_DEFUN(SIM_AC_OPTION_HARDWARE,
|
563 |
|
|
[
|
564 |
|
|
if test x"[$1]" = x"yes"; then
|
565 |
|
|
sim_hw_p=yes
|
566 |
|
|
else
|
567 |
|
|
sim_hw_p=no
|
568 |
|
|
fi
|
569 |
|
|
if test "[$2]"; then
|
570 |
|
|
hardware="core pal glue"
|
571 |
|
|
else
|
572 |
|
|
hardware="core pal glue [$3]"
|
573 |
|
|
fi
|
574 |
|
|
sim_hw_cflags="-DWITH_HW=1"
|
575 |
|
|
sim_hw="$hardware"
|
576 |
|
|
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
|
577 |
|
|
AC_ARG_ENABLE(sim-hardware,
|
578 |
|
|
[ --enable-sim-hardware=LIST Specify the hardware to be included in the build.],
|
579 |
|
|
[
|
580 |
|
|
case "${enableval}" in
|
581 |
|
|
yes) sim_hw_p=yes;;
|
582 |
|
|
no) sim_hw_p=no;;
|
583 |
|
|
,*) sim_hw_p=yes; hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
|
584 |
|
|
*,) sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
|
585 |
|
|
*) sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
|
586 |
|
|
esac
|
587 |
|
|
if test "$sim_hw_p" != yes; then
|
588 |
|
|
sim_hw_objs=
|
589 |
|
|
sim_hw_cflags="-DWITH_HW=0"
|
590 |
|
|
sim_hw=
|
591 |
|
|
else
|
592 |
|
|
sim_hw_cflags="-DWITH_HW=1"
|
593 |
|
|
# remove duplicates
|
594 |
|
|
sim_hw=""
|
595 |
|
|
sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
|
596 |
|
|
for i in $hardware ; do
|
597 |
|
|
case " $sim_hw " in
|
598 |
|
|
*" $i "*) ;;
|
599 |
|
|
*) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
|
600 |
|
|
esac
|
601 |
|
|
done
|
602 |
|
|
fi
|
603 |
|
|
if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
|
604 |
|
|
echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
|
605 |
|
|
fi],[
|
606 |
|
|
if test "$sim_hw_p" != yes; then
|
607 |
|
|
sim_hw_objs=
|
608 |
|
|
sim_hw_cflags="-DWITH_HW=0"
|
609 |
|
|
sim_hw=
|
610 |
|
|
fi
|
611 |
|
|
if test x"$silent" != x"yes"; then
|
612 |
|
|
echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
|
613 |
|
|
fi])dnl
|
614 |
|
|
])
|
615 |
|
|
AC_SUBST(sim_hw_cflags)
|
616 |
|
|
AC_SUBST(sim_hw_objs)
|
617 |
|
|
AC_SUBST(sim_hw)
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
dnl --enable-sim-inline is for users that wish to ramp up the simulator's
|
621 |
|
|
dnl performance by inlining functions.
|
622 |
|
|
dnl Guarantee that unconfigured simulators do not do any inlining
|
623 |
|
|
sim_inline="-DDEFAULT_INLINE=0"
|
624 |
|
|
AC_DEFUN(SIM_AC_OPTION_INLINE,
|
625 |
|
|
[
|
626 |
|
|
default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
|
627 |
|
|
AC_ARG_ENABLE(sim-inline,
|
628 |
|
|
[ --enable-sim-inline=inlines Specify which functions should be inlined.],
|
629 |
|
|
[sim_inline=""
|
630 |
|
|
case "$enableval" in
|
631 |
|
|
no) sim_inline="-DDEFAULT_INLINE=0";;
|
632 |
|
|
0) sim_inline="-DDEFAULT_INLINE=0";;
|
633 |
|
|
yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
|
634 |
|
|
1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
|
635 |
|
|
*) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
636 |
|
|
new_flag=""
|
637 |
|
|
case "$x" in
|
638 |
|
|
*_INLINE=*) new_flag="-D$x";;
|
639 |
|
|
*=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
|
640 |
|
|
*_INLINE) new_flag="-D$x=ALL_C_INLINE";;
|
641 |
|
|
*) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
|
642 |
|
|
esac
|
643 |
|
|
if test x"$sim_inline" = x""; then
|
644 |
|
|
sim_inline="$new_flag"
|
645 |
|
|
else
|
646 |
|
|
sim_inline="$sim_inline $new_flag"
|
647 |
|
|
fi
|
648 |
|
|
done;;
|
649 |
|
|
esac
|
650 |
|
|
if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
|
651 |
|
|
echo "Setting inline flags = $sim_inline" 6>&1
|
652 |
|
|
fi],[
|
653 |
|
|
if test "x$cross_compiling" = "xno"; then
|
654 |
|
|
if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
|
655 |
|
|
sim_inline="${default_sim_inline}"
|
656 |
|
|
if test x"$silent" != x"yes"; then
|
657 |
|
|
echo "Setting inline flags = $sim_inline" 6>&1
|
658 |
|
|
fi
|
659 |
|
|
else
|
660 |
|
|
sim_inline=""
|
661 |
|
|
fi
|
662 |
|
|
else
|
663 |
|
|
sim_inline="-DDEFAULT_INLINE=0"
|
664 |
|
|
fi])dnl
|
665 |
|
|
])
|
666 |
|
|
AC_SUBST(sim_inline)
|
667 |
|
|
|
668 |
|
|
|
669 |
|
|
AC_DEFUN(SIM_AC_OPTION_PACKAGES,
|
670 |
|
|
[
|
671 |
|
|
AC_ARG_ENABLE(sim-packages,
|
672 |
|
|
[ --enable-sim-packages=list Specify the packages to be included in the build.],
|
673 |
|
|
[packages=disklabel
|
674 |
|
|
case "${enableval}" in
|
675 |
|
|
yes) ;;
|
676 |
|
|
no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
|
677 |
|
|
,*) packages="${packages}${enableval}";;
|
678 |
|
|
*,) packages="${enableval}${packages}";;
|
679 |
|
|
*) packages="${enableval}"'';;
|
680 |
|
|
esac
|
681 |
|
|
sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
|
682 |
|
|
sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
|
683 |
|
|
if test x"$silent" != x"yes" && test x"$packages" != x""; then
|
684 |
|
|
echo "Setting packages to $sim_pk_src, $sim_pk_obj"
|
685 |
|
|
fi],[packages=disklabel
|
686 |
|
|
sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
|
687 |
|
|
sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
|
688 |
|
|
if test x"$silent" != x"yes"; then
|
689 |
|
|
echo "Setting packages to $sim_pk_src, $sim_pk_obj"
|
690 |
|
|
fi])dnl
|
691 |
|
|
])
|
692 |
|
|
AC_SUBST(sim_packages)
|
693 |
|
|
|
694 |
|
|
|
695 |
|
|
AC_DEFUN(SIM_AC_OPTION_REGPARM,
|
696 |
|
|
[
|
697 |
|
|
AC_ARG_ENABLE(sim-regparm,
|
698 |
|
|
[ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
|
699 |
|
|
[case "${enableval}" in
|
700 |
|
|
0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
|
701 |
|
|
no) sim_regparm="" ;;
|
702 |
|
|
yes) sim_regparm="-DWITH_REGPARM=3";;
|
703 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
|
704 |
|
|
esac
|
705 |
|
|
if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
|
706 |
|
|
echo "Setting regparm flags = $sim_regparm" 6>&1
|
707 |
|
|
fi],[sim_regparm=""])dnl
|
708 |
|
|
])
|
709 |
|
|
AC_SUBST(sim_regparm)
|
710 |
|
|
|
711 |
|
|
|
712 |
|
|
AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
|
713 |
|
|
[
|
714 |
|
|
default_sim_reserved_bits="ifelse([$1],,1,[$1])"
|
715 |
|
|
AC_ARG_ENABLE(sim-reserved-bits,
|
716 |
|
|
[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
|
717 |
|
|
[case "${enableval}" in
|
718 |
|
|
yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
|
719 |
|
|
no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
|
720 |
|
|
*) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
|
721 |
|
|
esac
|
722 |
|
|
if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
|
723 |
|
|
echo "Setting reserved flags = $sim_reserved_bits" 6>&1
|
724 |
|
|
fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
|
725 |
|
|
])
|
726 |
|
|
AC_SUBST(sim_reserved_bits)
|
727 |
|
|
|
728 |
|
|
|
729 |
|
|
AC_DEFUN(SIM_AC_OPTION_SMP,
|
730 |
|
|
[
|
731 |
|
|
default_sim_smp="ifelse([$1],,5,[$1])"
|
732 |
|
|
AC_ARG_ENABLE(sim-smp,
|
733 |
|
|
[ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
|
734 |
|
|
[case "${enableval}" in
|
735 |
|
|
yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
|
736 |
|
|
no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
|
737 |
|
|
*) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
|
738 |
|
|
esac
|
739 |
|
|
if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
|
740 |
|
|
echo "Setting smp flags = $sim_smp" 6>&1
|
741 |
|
|
fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
|
742 |
|
|
if test x"$silent" != x"yes"; then
|
743 |
|
|
echo "Setting smp flags = $sim_smp" 6>&1
|
744 |
|
|
fi])dnl
|
745 |
|
|
])
|
746 |
|
|
AC_SUBST(sim_smp)
|
747 |
|
|
|
748 |
|
|
|
749 |
|
|
AC_DEFUN(SIM_AC_OPTION_STDCALL,
|
750 |
|
|
[
|
751 |
|
|
AC_ARG_ENABLE(sim-stdcall,
|
752 |
|
|
[ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
|
753 |
|
|
[case "${enableval}" in
|
754 |
|
|
no) sim_stdcall="" ;;
|
755 |
|
|
std*) sim_stdcall="-DWITH_STDCALL=1";;
|
756 |
|
|
yes) sim_stdcall="-DWITH_STDCALL=1";;
|
757 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
|
758 |
|
|
esac
|
759 |
|
|
if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
|
760 |
|
|
echo "Setting function call flags = $sim_stdcall" 6>&1
|
761 |
|
|
fi],[sim_stdcall=""])dnl
|
762 |
|
|
])
|
763 |
|
|
AC_SUBST(sim_stdcall)
|
764 |
|
|
|
765 |
|
|
|
766 |
|
|
AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
|
767 |
|
|
[
|
768 |
|
|
default_sim_xor_endian="ifelse([$1],,8,[$1])"
|
769 |
|
|
AC_ARG_ENABLE(sim-xor-endian,
|
770 |
|
|
[ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
|
771 |
|
|
[case "${enableval}" in
|
772 |
|
|
yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
|
773 |
|
|
no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
|
774 |
|
|
*) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
|
775 |
|
|
esac
|
776 |
|
|
if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
|
777 |
|
|
echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
|
778 |
|
|
fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
|
779 |
|
|
])
|
780 |
|
|
AC_SUBST(sim_xor_endian)
|
781 |
|
|
|
782 |
|
|
|
783 |
|
|
dnl --enable-build-warnings is for developers of the simulator.
|
784 |
|
|
dnl it enables extra GCC specific warnings.
|
785 |
|
|
AC_DEFUN(SIM_AC_OPTION_WARNINGS,
|
786 |
|
|
[
|
787 |
|
|
# NOTE: Don't add -Wall or -Wunused, they both include
|
788 |
|
|
# -Wunused-parameter which reports bogus warnings.
|
789 |
|
|
# NOTE: If you add to this list, remember to update
|
790 |
|
|
# gdb/doc/gdbint.texinfo.
|
791 |
|
|
build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
|
792 |
|
|
-Wformat -Wparentheses -Wpointer-arith"
|
793 |
|
|
# GCC supports -Wuninitialized only with -O or -On, n != 0.
|
794 |
|
|
if test x${CFLAGS+set} = xset; then
|
795 |
|
|
case "${CFLAGS}" in
|
796 |
|
|
*"-O0"* ) ;;
|
797 |
|
|
*"-O"* )
|
798 |
|
|
build_warnings="${build_warnings} -Wuninitialized"
|
799 |
|
|
;;
|
800 |
|
|
esac
|
801 |
|
|
else
|
802 |
|
|
build_warnings="${build_warnings} -Wuninitialized"
|
803 |
|
|
fi
|
804 |
|
|
# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
|
805 |
|
|
# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
|
806 |
|
|
# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
|
807 |
|
|
# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
|
808 |
|
|
# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
|
809 |
|
|
# -Woverloaded-virtual -Winline -Werror"
|
810 |
|
|
AC_ARG_ENABLE(build-warnings,
|
811 |
|
|
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
|
812 |
|
|
[case "${enableval}" in
|
813 |
|
|
yes) ;;
|
814 |
|
|
no) build_warnings="-w";;
|
815 |
|
|
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
816 |
|
|
build_warnings="${build_warnings} ${t}";;
|
817 |
|
|
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
818 |
|
|
build_warnings="${t} ${build_warnings}";;
|
819 |
|
|
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
820 |
|
|
esac
|
821 |
|
|
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
822 |
|
|
echo "Setting compiler warning flags = $build_warnings" 6>&1
|
823 |
|
|
fi])dnl
|
824 |
|
|
AC_ARG_ENABLE(sim-build-warnings,
|
825 |
|
|
[ --enable-gdb-build-warnings Enable SIM specific build-time compiler warnings if gcc is used],
|
826 |
|
|
[case "${enableval}" in
|
827 |
|
|
yes) ;;
|
828 |
|
|
no) build_warnings="-w";;
|
829 |
|
|
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
830 |
|
|
build_warnings="${build_warnings} ${t}";;
|
831 |
|
|
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
832 |
|
|
build_warnings="${t} ${build_warnings}";;
|
833 |
|
|
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
834 |
|
|
esac
|
835 |
|
|
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
836 |
|
|
echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
|
837 |
|
|
fi])dnl
|
838 |
|
|
WARN_CFLAGS=""
|
839 |
|
|
WERROR_CFLAGS=""
|
840 |
|
|
if test "x${build_warnings}" != x -a "x$GCC" = xyes
|
841 |
|
|
then
|
842 |
|
|
AC_MSG_CHECKING(compiler warning flags)
|
843 |
|
|
# Separate out the -Werror flag as some files just cannot be
|
844 |
|
|
# compiled with it enabled.
|
845 |
|
|
for w in ${build_warnings}; do
|
846 |
|
|
case $w in
|
847 |
|
|
-Werr*) WERROR_CFLAGS=-Werror ;;
|
848 |
|
|
*) # Check that GCC accepts it
|
849 |
|
|
saved_CFLAGS="$CFLAGS"
|
850 |
|
|
CFLAGS="$CFLAGS $w"
|
851 |
|
|
AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
|
852 |
|
|
CFLAGS="$saved_CFLAGS"
|
853 |
|
|
esac
|
854 |
|
|
done
|
855 |
|
|
AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
|
856 |
|
|
fi
|
857 |
|
|
])
|
858 |
|
|
AC_SUBST(WARN_CFLAGS)
|
859 |
|
|
AC_SUBST(WERROR_CFLAGS)
|
860 |
|
|
|
861 |
|
|
|
862 |
|
|
dnl Generate the Makefile in a target specific directory.
|
863 |
|
|
dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
|
864 |
|
|
dnl so this is a cover macro to tuck the details away of how we cope.
|
865 |
|
|
dnl We cope by having autoconf generate two files and then merge them into
|
866 |
|
|
dnl one afterwards. The two pieces of the common fragment are inserted into
|
867 |
|
|
dnl the target's fragment at the appropriate points.
|
868 |
|
|
|
869 |
|
|
AC_DEFUN(SIM_AC_OUTPUT,
|
870 |
|
|
[
|
871 |
|
|
AC_LINK_FILES($sim_link_files, $sim_link_links)
|
872 |
|
|
dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
|
873 |
|
|
cgen_breaks=""
|
874 |
|
|
if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
|
875 |
|
|
cgen_breaks="break cgen_rtx_error";
|
876 |
|
|
fi
|
877 |
|
|
AC_SUBST(cgen_breaks)
|
878 |
|
|
AC_CONFIG_FILES(Makefile.sim:Makefile.in)
|
879 |
|
|
AC_CONFIG_FILES(Make-common.sim:../common/Make-common.in)
|
880 |
|
|
AC_CONFIG_FILES(.gdbinit:../common/gdbinit.in)
|
881 |
|
|
AC_CONFIG_COMMANDS([Makefile],
|
882 |
|
|
[echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
|
883 |
|
|
rm -f Makesim1.tmp Makesim2.tmp Makefile
|
884 |
|
|
sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
|
885 |
|
|
sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
|
886 |
|
|
sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
|
887 |
|
|
-e '/^## COMMON_POST_/ r Makesim2.tmp' \
|
888 |
|
|
<Makefile.sim >Makefile
|
889 |
|
|
rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
|
890 |
|
|
])
|
891 |
|
|
AC_CONFIG_COMMANDS([stamp-h], [echo > stamp-h])
|
892 |
|
|
AC_OUTPUT
|
893 |
|
|
])
|
894 |
|
|
|
895 |
|
|
sinclude(../../config/gettext-sister.m4)
|
896 |
|
|
|
897 |
|
|
dnl --enable-cgen-maint support
|
898 |
|
|
AC_DEFUN(SIM_AC_OPTION_CGEN_MAINT,
|
899 |
|
|
[
|
900 |
|
|
cgen_maint=no
|
901 |
|
|
dnl Default is to use one in build tree.
|
902 |
|
|
cgen=guile
|
903 |
|
|
cgendir='$(srcdir)/../../cgen'
|
904 |
|
|
dnl Having --enable-maintainer-mode take arguments is another way to go.
|
905 |
|
|
dnl ??? One can argue --with is more appropriate if one wants to specify
|
906 |
|
|
dnl a directory name, but what we're doing here is an enable/disable kind
|
907 |
|
|
dnl of thing and specifying both --enable and --with is klunky.
|
908 |
|
|
dnl If you reeely want this to be --with, go ahead and change it.
|
909 |
|
|
AC_ARG_ENABLE(cgen-maint,
|
910 |
|
|
[ --enable-cgen-maint[=DIR] build cgen generated files],
|
911 |
|
|
[case "${enableval}" in
|
912 |
|
|
yes) cgen_maint=yes ;;
|
913 |
|
|
no) cgen_maint=no ;;
|
914 |
|
|
*)
|
915 |
|
|
# argument is cgen install directory (not implemented yet).
|
916 |
|
|
# Having a `share' directory might be more appropriate for the .scm,
|
917 |
|
|
# .cpu, etc. files.
|
918 |
|
|
cgendir=${cgen_maint}/lib/cgen
|
919 |
|
|
cgen=guile
|
920 |
|
|
;;
|
921 |
|
|
esac])dnl
|
922 |
|
|
dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno)
|
923 |
|
|
if test x${cgen_maint} != xno ; then
|
924 |
|
|
CGEN_MAINT=''
|
925 |
|
|
else
|
926 |
|
|
CGEN_MAINT='#'
|
927 |
|
|
fi
|
928 |
|
|
AC_SUBST(CGEN_MAINT)
|
929 |
|
|
AC_SUBST(cgendir)
|
930 |
|
|
AC_SUBST(cgen)
|
931 |
|
|
])
|
932 |
|
|
dnl FIXME: When upgrading to modern autoconf, remove
|
933 |
|
|
dnl SIM_CHECK_MEMBER and SIM_CHECK_MEMBERS et al and use
|
934 |
|
|
dnl AC_CHECK_MEMBERS from autoconf.
|
935 |
|
|
dnl
|
936 |
|
|
dnl Translated from a FC2 autoconf-2.59-3 installation.
|
937 |
|
|
dnl AC_CHECK_MEMBER(AGGREGATE.MEMBER,
|
938 |
|
|
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
|
939 |
|
|
dnl [INCLUDES])
|
940 |
|
|
dnl
|
941 |
|
|
dnl ---------------------------------------------------------
|
942 |
|
|
dnl AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
|
943 |
|
|
dnl variables are not a valid argument.
|
944 |
|
|
AC_DEFUN([SIM_CHECK_MEMBER],
|
945 |
|
|
dnl Extract the aggregate name, and the member name
|
946 |
|
|
[AC_CACHE_CHECK([for $1], [ac_]patsubst([$1], [[\. ]], [_]),
|
947 |
|
|
[ac_]patsubst([$1], [[\. ]], [_])[=no;]
|
948 |
|
|
AC_TRY_COMPILE([$4],[
|
949 |
|
|
dnl AGGREGATE ac_aggr;
|
950 |
|
|
static ]patsubst([$1], [\..*])[ ac_aggr;
|
951 |
|
|
dnl ac_aggr.MEMBER;
|
952 |
|
|
if (ac_aggr.]patsubst([$1], [^[^.]*\.])[)
|
953 |
|
|
return 0;],[ac_]patsubst([$1], [[\. ]], [_])[=yes;],
|
954 |
|
|
AC_TRY_COMPILE([$4],[
|
955 |
|
|
dnl AGGREGATE ac_aggr;
|
956 |
|
|
static ]patsubst([$1], [\..*])[ ac_aggr;
|
957 |
|
|
dnl ac_aggr.MEMBER;
|
958 |
|
|
if (sizeof ac_aggr.]patsubst([$1], [^[^.]*\.])[)
|
959 |
|
|
return 0;],
|
960 |
|
|
[ac_]patsubst([$1], [[\. ]], [_])[=yes;],
|
961 |
|
|
[ac_]patsubst([$1], [[\. ]], [_])[=no;]))
|
962 |
|
|
[if test [$]ac_]patsubst([$1], [[\. ]], [_])[ = yes; then :; [$2]
|
963 |
|
|
else :; [$3]
|
964 |
|
|
fi])
|
965 |
|
|
])dnl SIM_CHECK_MEMBER
|
966 |
|
|
dnl
|
967 |
|
|
dnl Translated from a FC2 autoconf-2.59-3 installation.
|
968 |
|
|
dnl SIM_CHECK_MEMBERS([AGGREGATE.MEMBER, ...])
|
969 |
|
|
dnl except we just work with a limited set of fixed includes.
|
970 |
|
|
dnl
|
971 |
|
|
AC_DEFUN([SIM_CHECK_MEMBERS_1],
|
972 |
|
|
[ifelse($#, 1,
|
973 |
|
|
[SIM_CHECK_MEMBER([$1],
|
974 |
|
|
AC_DEFINE_UNQUOTED([HAVE_]translit([$1], [a-z .], [A-Z__]), 1,
|
975 |
|
|
[Define to 1 if ]patsubst([$1],
|
976 |
|
|
[^[^.]*\.])[ is a member of ]patsubst([$1], [\..*])[. ]),,
|
977 |
|
|
[#ifdef HAVE_SYS_TYPES_H
|
978 |
|
|
#include <sys/types.h>
|
979 |
|
|
#endif
|
980 |
|
|
#ifdef HAVE_SYS_STAT_H
|
981 |
|
|
#include <sys/stat.h>
|
982 |
|
|
#endif])],
|
983 |
|
|
[SIM_CHECK_MEMBER([$1],
|
984 |
|
|
AC_DEFINE_UNQUOTED([HAVE_]translit([$1], [a-z .], [A-Z__]), 1,
|
985 |
|
|
[Define to 1 if ]patsubst([$1],
|
986 |
|
|
[^[^.]*\.])[ is a member of ]patsubst([$1], [\..*])[. ]),,
|
987 |
|
|
[#ifdef HAVE_SYS_TYPES_H
|
988 |
|
|
#include <sys/types.h>
|
989 |
|
|
#endif
|
990 |
|
|
#ifdef HAVE_SYS_STAT_H
|
991 |
|
|
#include <sys/stat.h>
|
992 |
|
|
#endif])
|
993 |
|
|
SIM_CHECK_MEMBERS_1(builtin(shift,$@))])])dnl SIM_CHECK_MEMBERS
|
994 |
|
|
dnl
|
995 |
|
|
AC_DEFUN([SIM_CHECK_MEMBERS],
|
996 |
|
|
[ifelse($#, 1, [SIM_CHECK_MEMBERS_1($1)],
|
997 |
|
|
[errprint(__file__:__line__:
|
998 |
|
|
[This SIM_CHECK_MEMBERS only supports one argument,]
|
999 |
|
|
[the list of struct tests])])])dnl SIM_CHECK_MEMBERS
|