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