Commit | Line | Data |
---|---|---|
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 | |
21 | AC_DEFUN(SIM_AC_COMMON, | |
22 | [ | |
23 | # autoconf.info says this should be called right after AC_INIT. | |
b45caf05 | 24 | AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in) |
80b7b3a5 SG |
25 | |
26 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..) | |
27 | AC_CANONICAL_SYSTEM | |
28 | AC_ARG_PROGRAM | |
29 | AC_PROG_CC | |
30 | AC_PROG_INSTALL | |
80b7b3a5 SG |
31 | |
32 | # Put a plausible default for CC_FOR_BUILD in Makefile. | |
80b7b3a5 SG |
33 | if test "x$cross_compiling" = "xno"; then |
34 | CC_FOR_BUILD='$(CC)' | |
35 | else | |
36 | CC_FOR_BUILD=gcc | |
37 | fi | |
38 | AC_SUBST(CC_FOR_BUILD) | |
39 | ||
40 | AC_SUBST(CFLAGS) | |
41 | AC_SUBST(HDEFINES) | |
42 | AR=${AR-ar} | |
43 | AC_SUBST(AR) | |
44 | AC_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*. | |
49 | AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h sys/time.h sys/resource.h) | |
50 | AC_CHECK_FUNCS(getrusage time) | |
fbda74b1 | 51 | |
80b7b3a5 SG |
52 | . ${srcdir}/../../bfd/configure.host |
53 | ||
a77aa7ec | 54 | dnl Standard (and optional) simulator options. |
80b7b3a5 SG |
55 | dnl Eventually all simulators will support these. |
56 | dnl Do not add any here that cannot be supported by all simulators. | |
57 | dnl Do not add similar but different options to a particular simulator, | |
58 | dnl all shall eventually behave the same way. | |
59 | ||
f2de7dfd AC |
60 | |
61 | dnl This is a generic option to enable special byte swapping | |
62 | dnl insns on *any* cpu. | |
63 | AC_ARG_ENABLE(sim-bswap, | |
64 | [ --enable-sim-bswap Use Host specific BSWAP instruction.], | |
65 | [case "${enableval}" in | |
a77aa7ec | 66 | yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";; |
f2de7dfd AC |
67 | no) sim_bswap="-DWITH_BSWAP=0";; |
68 | *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";; | |
69 | esac | |
70 | if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then | |
71 | echo "Setting bswap flags = $sim_bswap" 6>&1 | |
72 | fi],[sim_bswap=""])dnl | |
73 | AC_SUBST(sim_bswap) | |
74 | ||
75 | ||
80b7b3a5 SG |
76 | AC_ARG_ENABLE(sim-cflags, |
77 | [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator], | |
78 | [case "${enableval}" in | |
79 | yes) sim_cflags="-O2";; | |
80 | trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";; | |
81 | no) sim_cflags="";; | |
82 | *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
83 | esac | |
84 | if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then | |
85 | echo "Setting sim cflags = $sim_cflags" 6>&1 | |
86 | fi],[sim_cflags=""])dnl | |
87 | AC_SUBST(sim_cflags) | |
88 | ||
f2de7dfd | 89 | |
80b7b3a5 SG |
90 | dnl --enable-sim-debug is for developers of the simulator |
91 | dnl the allowable values are work-in-progress | |
92 | AC_ARG_ENABLE(sim-debug, | |
93 | [ --enable-sim-debug=opts Enable debugging flags], | |
94 | [case "${enableval}" in | |
fbda74b1 DE |
95 | yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";; |
96 | no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";; | |
97 | *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";; | |
80b7b3a5 SG |
98 | esac |
99 | if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then | |
100 | echo "Setting sim debug = $sim_debug" 6>&1 | |
101 | fi],[sim_debug=""])dnl | |
102 | AC_SUBST(sim_debug) | |
103 | ||
f2de7dfd | 104 | |
a35e91c3 AC |
105 | dnl --enable-sim-stdio is for users of the simulator |
106 | dnl It determines if IO from the program is routed through STDIO (buffered) | |
107 | AC_ARG_ENABLE(sim-stdio, | |
108 | [ --enable-sim-stdio Specify whether to use stdio for console input/output.], | |
109 | [case "${enableval}" in | |
110 | yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";; | |
111 | no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";; | |
112 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";; | |
113 | esac | |
114 | if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then | |
115 | echo "Setting stdio flags = $sim_stdio" 6>&1 | |
116 | fi],[sim_stdio=""])dnl | |
117 | AC_SUBST(sim_stdio) | |
118 | ||
119 | ||
120 | dnl --enable-sim-trace is for users of the simulator | |
247fccde AC |
121 | dnl The argument is either a bitmask of things to enable [exactly what is |
122 | dnl up to the simulator], or is a comma separated list of names of tracing | |
123 | dnl elements to enable. The latter is only supported on simulators that | |
124 | dnl use WITH_TRACE. | |
a35e91c3 AC |
125 | AC_ARG_ENABLE(sim-trace, |
126 | [ --enable-sim-trace=opts Enable tracing flags], | |
127 | [case "${enableval}" in | |
247fccde | 128 | yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; |
a35e91c3 | 129 | no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; |
247fccde AC |
130 | [[-0-9]]*) |
131 | sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; | |
132 | [[a-z]]*) | |
133 | sim_trace="" | |
134 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
135 | if test x"$sim_trace" = x; then | |
136 | sim_trace="-DWITH_TRACE='(TRACE_$x" | |
137 | else | |
138 | sim_trace="${sim_trace}|TRACE_$x" | |
139 | fi | |
140 | done | |
141 | sim_trace="$sim_trace)'" ;; | |
a35e91c3 AC |
142 | esac |
143 | if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then | |
144 | echo "Setting sim trace = $sim_trace" 6>&1 | |
145 | fi],[sim_trace=""])dnl | |
146 | AC_SUBST(sim_trace) | |
147 | ||
148 | ||
247fccde AC |
149 | dnl --enable-sim-profile |
150 | dnl The argument is either a bitmask of things to enable [exactly what is | |
151 | dnl up to the simulator], or is a comma separated list of names of profiling | |
152 | dnl elements to enable. The latter is only supported on simulators that | |
153 | dnl use WITH_PROFILE. | |
154 | AC_ARG_ENABLE(sim-profile, | |
155 | [ --enable-sim-profile=opts Enable profiling flags], | |
156 | [case "${enableval}" in | |
157 | yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";; | |
158 | no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";; | |
159 | [[-0-9]]*) | |
160 | sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";; | |
161 | [[a-z]]*) | |
162 | sim_profile="" | |
163 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
164 | if test x"$sim_profile" = x; then | |
165 | sim_profile="-DWITH_PROFILE='(PROFILE_$x" | |
166 | else | |
167 | sim_profile="${sim_profile}|PROFILE_$x" | |
168 | fi | |
169 | done | |
170 | sim_profile="$sim_profile)'" ;; | |
171 | esac | |
172 | if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then | |
173 | echo "Setting sim profile = $sim_profile" 6>&1 | |
174 | fi],[sim_profile=""])dnl | |
175 | AC_SUBST(sim_profile) | |
176 | ||
177 | ||
63ddb6bd DE |
178 | dnl Types used by common code |
179 | AC_TYPE_SIGNAL | |
180 | ||
181 | ||
a35e91c3 AC |
182 | dnl These are available to append to as desired. |
183 | sim_link_files= | |
184 | sim_link_links= | |
185 | ||
186 | dnl Create tconfig.h either from simulator's tconfig.in or default one | |
187 | dnl in common. | |
188 | sim_link_links=tconfig.h | |
189 | if test -f ${srcdir}/tconfig.in | |
190 | then | |
191 | sim_link_files=tconfig.in | |
192 | else | |
193 | sim_link_files=../common/tconfig.in | |
194 | fi | |
195 | ||
196 | # targ-vals.def points to the libc macro description file. | |
197 | case "${target}" in | |
198 | *-*-*) TARG_VALS_DEF=../common/nltvals.def ;; | |
199 | esac | |
200 | sim_link_files="${sim_link_files} ${TARG_VALS_DEF}" | |
201 | sim_link_links="${sim_link_links} targ-vals.def" | |
202 | ||
203 | ]) dnl End of SIM_AC_COMMON | |
204 | ||
205 | ||
206 | dnl Additional SIM options that can (optionally) be configured | |
207 | dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined. | |
208 | dnl Simulators that wish to use the relevant option specify the macro | |
209 | dnl in the simulator specific configure.in file between the SIM_AC_COMMON | |
210 | dnl and SIM_AC_OUTPUT lines. | |
211 | ||
212 | ||
213 | dnl Specify the alignment restrictions of the target architecture. | |
214 | dnl Without this option all possible alignment restrictions are accomidated. | |
b45caf05 AC |
215 | dnl arg[1] is hardwired target alignment |
216 | dnl arg[2] is default target alignment | |
a35e91c3 | 217 | AC_DEFUN(SIM_AC_OPTION_ALIGNMENT, |
b45caf05 AC |
218 | wire_alignment="ifelse([$2],,ifelse([$1],,,[$1]),[$2])" |
219 | default_alignment="ifelse([$2],,ifelse([$1],,,[$1]),[$2])" | |
220 | default_sim_alignment="ifelse([$1],,ifelse([$2],,,-DWITH_DEFAULT_ALIGNMENT=[$2]),-DWITH_ALIGNMENT=[$1])" | |
a35e91c3 AC |
221 | [ |
222 | AC_ARG_ENABLE(sim-alignment, | |
b45caf05 | 223 | [ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.], |
a35e91c3 | 224 | [case "${enableval}" in |
b45caf05 AC |
225 | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; |
226 | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; | |
227 | forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";; | |
228 | yes) if test x"$wire_alignment" != x; then | |
229 | sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" | |
230 | else | |
231 | echo "No hard-wired alignment for target $target" 1>&6 | |
232 | sim_alignment="-DWITH_ALIGNMENT=0" | |
233 | fi;; | |
234 | no) if test x"$default_alignment" != x; then | |
235 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" | |
236 | else | |
237 | echo "No default alignment for target $target" 1>&6 | |
238 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0" | |
239 | fi;; | |
240 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";; | |
a35e91c3 AC |
241 | esac |
242 | if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then | |
243 | echo "Setting alignment flags = $sim_alignment" 6>&1 | |
b45caf05 | 244 | fi],[sim_alignment="${default_sim_alignment}"])dnl |
a35e91c3 AC |
245 | AC_SUBST(sim_alignment) |
246 | ])dnl | |
247 | ||
248 | ||
249 | dnl Conditionally compile in assertion statements. | |
250 | AC_DEFUN(SIM_AC_OPTION_ASSERT, | |
251 | [ | |
252 | AC_ARG_ENABLE(sim-assert, | |
253 | [ --enable-sim-assert Specify whether to perform random assertions.], | |
254 | [case "${enableval}" in | |
255 | yes) sim_assert="-DWITH_ASSERT=1";; | |
256 | no) sim_assert="-DWITH_ASSERT=0";; | |
257 | *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";; | |
258 | esac | |
259 | if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then | |
260 | echo "Setting assert flags = $sim_assert" 6>&1 | |
261 | fi],[sim_assert=""])dnl | |
262 | AC_SUBST(sim_assert) | |
263 | ]) | |
264 | ||
265 | ||
f2de7dfd AC |
266 | dnl --enable-sim-endian={yes,no,big,little} is for simulators |
267 | dnl that support both big and little endian targets. | |
247fccde AC |
268 | dnl arg[1] is hardwired target endianness. |
269 | dnl arg[2] is default target endianness. | |
f2de7dfd | 270 | AC_DEFUN(SIM_AC_OPTION_ENDIAN, |
8cd89e77 | 271 | [ |
247fccde AC |
272 | wire_endian="ifelse([$1],,ifelse([$2],,,[$2]),[$1])" |
273 | default_endian="ifelse([$2],,ifelse([$1],,,[$1]),[$2])" | |
274 | default_sim_endian="ifelse([$1],,ifelse([$2],,,-DWITH_DEFAULT_TARGET_BYTE_ORDER=[$2]),-DWITH_TARGET_BYTE_ORDER=[$1])" | |
f2de7dfd AC |
275 | AC_ARG_ENABLE(sim-endian, |
276 | [ --enable-sim-endian=endian Specify target byte endian orientation.], | |
277 | [case "${enableval}" in | |
f2de7dfd AC |
278 | b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";; |
279 | l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";; | |
247fccde AC |
280 | yes) if test x"$wire_endian" != x; then |
281 | sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" | |
282 | else | |
283 | echo "No hard-wired endian for target $target" 1>&6 | |
284 | sim_endian="-DWITH_TARGET_BYTE_ORDER=0" | |
285 | fi;; | |
286 | no) if test x"$default_endian" != x; then | |
287 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" | |
288 | else | |
289 | echo "No default endian for target $target" 1>&6 | |
290 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0" | |
291 | fi;; | |
f2de7dfd AC |
292 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";; |
293 | esac | |
294 | if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then | |
295 | echo "Setting endian flags = $sim_endian" 6>&1 | |
296 | fi],[sim_endian="${default_sim_endian}"])dnl | |
a77aa7ec | 297 | AC_SUBST(sim_endian) |
f2de7dfd | 298 | ]) |
8cd89e77 | 299 | |
80b7b3a5 | 300 | |
f2de7dfd AC |
301 | dnl --enable-sim-hostendian is for users of the simulator when |
302 | dnl they find that AC_C_BIGENDIAN does not function correctly | |
303 | dnl (for instance in a canadian cross) | |
304 | AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN, | |
305 | [ | |
306 | AC_ARG_ENABLE(sim-hostendian, | |
307 | [ --enable-sim-hostendain=end Specify host byte endian orientation.], | |
308 | [case "${enableval}" in | |
309 | no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";; | |
310 | b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";; | |
311 | l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";; | |
312 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";; | |
313 | esac | |
314 | if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then | |
315 | echo "Setting hostendian flags = $sim_hostendian" 6>&1 | |
316 | fi],[ | |
317 | if test "x$cross_compiling" = "xno"; then | |
318 | AC_C_BIGENDIAN | |
319 | if test $ac_cv_c_bigendian = yes; then | |
320 | sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN" | |
321 | else | |
322 | sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN" | |
323 | fi | |
324 | else | |
325 | sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" | |
326 | fi])dnl | |
a77aa7ec AC |
327 | AC_SUBST(sim_hostendian) |
328 | ]) | |
329 | ||
330 | ||
331 | AC_DEFUN(SIM_AC_OPTION_FLOAT, | |
332 | [ | |
a35e91c3 | 333 | default_sim_floating_point="ifelse([$1],,0,[$1])" |
a77aa7ec | 334 | AC_ARG_ENABLE(sim-float, |
a35e91c3 | 335 | [ --enable-sim-float Specify that the target processor has floating point hardware.], |
a77aa7ec AC |
336 | [case "${enableval}" in |
337 | yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";; | |
338 | no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";; | |
339 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";; | |
340 | esac | |
341 | if test x"$silent" != x"yes" && test x"$sim_float" != x""; then | |
342 | echo "Setting float flags = $sim_float" 6>&1 | |
a35e91c3 | 343 | fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl |
a77aa7ec AC |
344 | AC_SUBST(sim_float) |
345 | ]) | |
346 | ||
347 | ||
247fccde AC |
348 | dnl The argument is the default cache size if none is specified. |
349 | AC_DEFUN(SIM_AC_OPTION_SCACHE, | |
350 | [ | |
351 | default_sim_scache="ifelse([$1],,0,[$1])" | |
352 | AC_ARG_ENABLE(sim-scache, | |
353 | [ --enable-sim-scache=size Specify simulator execution cache size.], | |
354 | [case "${enableval}" in | |
355 | yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";; | |
356 | no) sim_scace= ;; | |
357 | [[0-9]]*) sim_cache=${enableval};; | |
358 | *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache"); | |
359 | sim_scache="";; | |
360 | esac | |
361 | if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then | |
362 | echo "Setting scache size = $sim_scache" 6>&1 | |
363 | fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"]) | |
364 | AC_SUBST(sim_scache) | |
365 | ]) | |
366 | ||
367 | ||
368 | dnl The argument is the default model if none is specified. | |
369 | AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL, | |
370 | [ | |
371 | default_sim_default_model="ifelse([$1],,0,[$1])" | |
372 | AC_ARG_ENABLE(sim-default-model, | |
373 | [ --enable-sim-default-model=model Specify default model to simulate.], | |
374 | [case "${enableval}" in | |
375 | yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");; | |
376 | *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";; | |
377 | esac | |
378 | if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then | |
379 | echo "Setting default model = $sim_default_model" 6>&1 | |
380 | fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"]) | |
381 | AC_SUBST(sim_default_model) | |
382 | ]) | |
383 | ||
384 | ||
a77aa7ec AC |
385 | AC_DEFUN(SIM_AC_OPTION_HARDWARE, |
386 | [ | |
387 | AC_ARG_ENABLE(sim-hardware, | |
388 | [ --enable-sim-hardware=list Specify the hardware to be included in the build.], | |
389 | [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide" | |
390 | case "${enableval}" in | |
391 | yes) ;; | |
392 | no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";; | |
393 | ,*) hardware="${hardware}${enableval}";; | |
394 | *,) hardware="${enableval}${hardware}";; | |
395 | *) hardware="${enableval}"'';; | |
396 | esac | |
397 | sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` | |
398 | sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` | |
399 | if test x"$silent" != x"yes" && test x"$hardware" != x""; then | |
400 | echo "Setting hardware to $sim_hw_src, $sim_hw_obj" | |
401 | fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide" | |
402 | sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` | |
403 | sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` | |
404 | if test x"$silent" != x"yes"; then | |
405 | echo "Setting hardware to $sim_hw_src, $sim_hw_obj" | |
406 | fi])dnl | |
407 | AC_SUBST(sim_hardware) | |
f2de7dfd AC |
408 | ]) |
409 | ||
80b7b3a5 | 410 | |
f2de7dfd AC |
411 | dnl --enable-sim-inline is for users that wish to ramp up the simulator's |
412 | dnl performance by inlining functions. | |
413 | AC_DEFUN(SIM_AC_OPTION_INLINE, | |
414 | [ | |
415 | default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])" | |
416 | AC_ARG_ENABLE(sim-inline, | |
417 | [ --enable-sim-inline=inlines Specify which functions should be inlined.], | |
418 | [sim_inline="" | |
419 | case "$enableval" in | |
420 | no) sim_inline="-DDEFAULT_INLINE=0";; | |
421 | 0) sim_inline="-DDEFAULT_INLINE=0";; | |
422 | yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";; | |
423 | 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";; | |
424 | *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
425 | new_flag="" | |
426 | case "$x" in | |
427 | *_INLINE=*) new_flag="-D$x";; | |
428 | *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; | |
429 | *_INLINE) new_flag="-D$x=ALL_INLINE";; | |
430 | *) new_flag="-D$x""_INLINE=ALL_INLINE";; | |
431 | esac | |
432 | if test x"$sim_inline" = x""; then | |
433 | sim_inline="$new_flag" | |
434 | else | |
435 | sim_inline="$sim_inline $new_flag" | |
436 | fi | |
437 | done;; | |
438 | esac | |
439 | if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then | |
440 | echo "Setting inline flags = $sim_inline" 6>&1 | |
441 | fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then | |
442 | sim_inline="${default_sim_inline}" | |
443 | if test x"$silent" != x"yes"; then | |
444 | echo "Setting inline flags = $sim_inline" 6>&1 | |
445 | fi | |
446 | else | |
447 | sim_inline="" | |
448 | fi])dnl | |
a77aa7ec AC |
449 | AC_SUBST(sim_inline) |
450 | ]) | |
451 | ||
452 | ||
453 | AC_DEFUN(SIM_AC_OPTION_PACKAGES, | |
454 | [ | |
455 | AC_ARG_ENABLE(sim-packages, | |
456 | [ --enable-sim-packages=list Specify the packages to be included in the build.], | |
457 | [packages=disklabel | |
458 | case "${enableval}" in | |
459 | yes) ;; | |
460 | no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";; | |
461 | ,*) packages="${packages}${enableval}";; | |
462 | *,) packages="${enableval}${packages}";; | |
463 | *) packages="${enableval}"'';; | |
464 | esac | |
465 | sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` | |
466 | sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` | |
467 | if test x"$silent" != x"yes" && test x"$packages" != x""; then | |
468 | echo "Setting packages to $sim_pk_src, $sim_pk_obj" | |
469 | fi],[packages=disklabel | |
470 | sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` | |
471 | sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` | |
472 | if test x"$silent" != x"yes"; then | |
473 | echo "Setting packages to $sim_pk_src, $sim_pk_obj" | |
474 | fi])dnl | |
475 | AC_SUBST(sim_packages) | |
476 | ]) | |
477 | ||
478 | ||
479 | AC_DEFUN(SIM_AC_OPTION_REGPARM, | |
480 | [ | |
481 | AC_ARG_ENABLE(sim-regparm, | |
482 | [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.], | |
483 | [case "${enableval}" in | |
484 | 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";; | |
485 | no) sim_regparm="" ;; | |
486 | yes) sim_regparm="-DWITH_REGPARM=3";; | |
487 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";; | |
488 | esac | |
489 | if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then | |
490 | echo "Setting regparm flags = $sim_regparm" 6>&1 | |
491 | fi],[sim_regparm=""])dnl | |
492 | AC_SUBST(sim_regparm) | |
493 | ]) | |
494 | ||
495 | ||
496 | AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS, | |
497 | [ | |
a35e91c3 | 498 | default_sim_reserved_bits="ifelse([$1],,1,[$1])" |
a77aa7ec AC |
499 | AC_ARG_ENABLE(sim-reserved-bits, |
500 | [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.], | |
501 | [case "${enableval}" in | |
502 | yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";; | |
503 | no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";; | |
504 | *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";; | |
505 | esac | |
506 | if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then | |
507 | echo "Setting reserved flags = $sim_reserved_bits" 6>&1 | |
a35e91c3 | 508 | fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl |
a77aa7ec AC |
509 | AC_SUBST(sim_reserved_bits) |
510 | ]) | |
511 | ||
512 | ||
513 | AC_DEFUN(SIM_AC_OPTION_SMP, | |
514 | [ | |
a35e91c3 | 515 | default_sim_smp="ifelse([$1],,5,[$1])" |
a77aa7ec | 516 | AC_ARG_ENABLE(sim-smp, |
a35e91c3 | 517 | [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).], |
a77aa7ec AC |
518 | [case "${enableval}" in |
519 | yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";; | |
520 | no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";; | |
521 | *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";; | |
522 | esac | |
523 | if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then | |
524 | echo "Setting smp flags = $sim_smp" 6>&1 | |
a35e91c3 | 525 | fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}" |
a77aa7ec AC |
526 | if test x"$silent" != x"yes"; then |
527 | echo "Setting smp flags = $sim_smp" 6>&1 | |
528 | fi])dnl | |
529 | AC_SUBST(sim_smp) | |
f2de7dfd | 530 | ]) |
80b7b3a5 | 531 | |
80b7b3a5 | 532 | |
a77aa7ec AC |
533 | AC_DEFUN(SIM_AC_OPTION_STDCALL, |
534 | [ | |
535 | AC_ARG_ENABLE(sim-stdcall, | |
536 | [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.], | |
537 | [case "${enableval}" in | |
538 | no) sim_stdcall="" ;; | |
539 | std*) sim_stdcall="-DWITH_STDCALL=1";; | |
540 | yes) sim_stdcall="-DWITH_STDCALL=1";; | |
541 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";; | |
542 | esac | |
543 | if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then | |
544 | echo "Setting function call flags = $sim_stdcall" 6>&1 | |
545 | fi],[sim_stdcall=""])dnl | |
546 | AC_SUBST(sim_stdcall) | |
547 | ]) | |
548 | ||
549 | ||
a35e91c3 AC |
550 | AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN, |
551 | [ | |
552 | default_sim_xor_endian="ifelse([$1],,8,[$1])" | |
553 | AC_ARG_ENABLE(sim-xor-endian, | |
554 | [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).], | |
a77aa7ec | 555 | [case "${enableval}" in |
a35e91c3 AC |
556 | yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";; |
557 | no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";; | |
558 | *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";; | |
a77aa7ec | 559 | esac |
a35e91c3 AC |
560 | if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then |
561 | echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 | |
562 | fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl | |
563 | AC_SUBST(sim_xor_endian) | |
564 | ]) | |
a77aa7ec AC |
565 | |
566 | ||
f2de7dfd AC |
567 | dnl --enable-sim-warnings is for developers of the simulator. |
568 | dnl it enables extra GCC specific warnings. | |
569 | AC_DEFUN(SIM_AC_OPTION_WARNINGS, | |
570 | [ | |
571 | AC_ARG_ENABLE(sim-warnings, | |
88117054 | 572 | [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings], |
f2de7dfd AC |
573 | [case "${enableval}" in |
574 | yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";; | |
575 | no) sim_warnings="-w";; | |
576 | *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
577 | esac | |
578 | if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then | |
579 | echo "Setting warning flags = $sim_warnings" 6>&1 | |
580 | fi],[sim_warnings=""])dnl | |
a77aa7ec | 581 | AC_SUBST(sim_warnings) |
f2de7dfd | 582 | ]) |
80b7b3a5 | 583 | |
80b7b3a5 | 584 | |
f2de7dfd AC |
585 | dnl Generate the Makefile in a target specific directory. |
586 | dnl Substitutions aren't performed on the file in AC_SUBST_FILE, | |
587 | dnl so this is a cover macro to tuck the details away of how we cope. | |
588 | dnl We cope by having autoconf generate two files and then merge them into | |
589 | dnl one afterwards. The two pieces of the common fragment are inserted into | |
590 | dnl the target's fragment at the appropriate points. | |
80b7b3a5 | 591 | |
f2de7dfd AC |
592 | AC_DEFUN(SIM_AC_OUTPUT, |
593 | [ | |
80b7b3a5 | 594 | AC_LINK_FILES($sim_link_files, $sim_link_links) |
88d5f8e8 DE |
595 | AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in, |
596 | [case "x$CONFIG_FILES" in | |
597 | xMakefile*) | |
f2de7dfd AC |
598 | echo "Merging Makefile.sim+Make-common.sim into Makefile ..." |
599 | rm -f Makesim1.tmp Makesim2.tmp Makefile | |
600 | sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp | |
601 | sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp | |
602 | sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \ | |
603 | -e '/^## COMMON_POST_/ r Makesim2.tmp' \ | |
604 | <Makefile.sim >Makefile | |
605 | rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp | |
606 | ;; | |
607 | esac | |
80b7b3a5 | 608 | case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac |
f2de7dfd AC |
609 | ]) |
610 | ]) |