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