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