Remove need to update <targ>/Makefile.in when adding optional options
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
1 # This file contains common code used by all simulators.
2 #
3 # SIM_AC_COMMON invokes AC macros used by all simulators and by the common
4 # directory. It is intended to be invoked before any target specific stuff.
5 # SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.
6 # It is intended to be invoked last.
7 #
8 # The simulator's configure.in should look like:
9 #
10 # dnl Process this file with autoconf to produce a configure script.
11 # sinclude(../common/aclocal.m4)
12 # AC_PREREQ(2.5)dnl
13 # AC_INIT(Makefile.in)
14 #
15 # SIM_AC_COMMON
16 #
17 # ... target specific stuff ...
18 #
19 # SIM_AC_OUTPUT
20
21 AC_DEFUN(SIM_AC_COMMON,
22 [
23 # autoconf.info says this should be called right after AC_INIT.
24 AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
25
26 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
27 AC_CANONICAL_SYSTEM
28 AC_ARG_PROGRAM
29 AC_PROG_CC
30 AC_PROG_INSTALL
31
32 # Put a plausible default for CC_FOR_BUILD in Makefile.
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
46 # Check for common headers.
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)
51
52 . ${srcdir}/../../bfd/configure.host
53
54 dnl Standard (and optional) simulator options.
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
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
66 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
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
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
89
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
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})'";;
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
104
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 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.
125 AC_ARG_ENABLE(sim-trace,
126 [ --enable-sim-trace=opts Enable tracing flags],
127 [case "${enableval}" in
128 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
129 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
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)'" ;;
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
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
178 dnl Types used by common code
179 AC_TYPE_SIGNAL
180
181
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 accommodated.
215 dnl arg[1] is hardwired target alignment
216 dnl arg[2] is default target alignment
217 AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
218 wire_alignment="[$1]"
219 default_alignment="[$2]"
220 [
221 AC_ARG_ENABLE(sim-alignment,
222 [ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
223 [case "${enableval}" in
224 strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
225 nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
226 forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
227 yes) if test x"$wire_alignment" != x; then
228 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
229 else
230 if test x"$default_alignment" != x; then
231 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
232 else
233 echo "No hard-wired alignment for target $target" 1>&6
234 sim_alignment="-DWITH_ALIGNMENT=0"
235 fi
236 fi;;
237 no) if test x"$default_alignment" != x; then
238 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
239 else
240 if test x"$wire_alignment" != x; then
241 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
242 else
243 echo "No default alignment for target $target" 1>&6
244 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
245 fi
246 fi;;
247 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
248 esac
249 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
250 echo "Setting alignment flags = $sim_alignment" 6>&1
251 fi],
252 [if test x"$default_alignment" != x; then
253 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
254 else
255 if test x"$wire_alignment" != x; then
256 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
257 else
258 sim_alignment=
259 fi
260 fi])dnl
261 ])dnl
262 AC_SUBST(sim_alignment)
263
264
265 dnl Conditionally compile in assertion statements.
266 AC_DEFUN(SIM_AC_OPTION_ASSERT,
267 [
268 AC_ARG_ENABLE(sim-assert,
269 [ --enable-sim-assert Specify whether to perform random assertions.],
270 [case "${enableval}" in
271 yes) sim_assert="-DWITH_ASSERT=1";;
272 no) sim_assert="-DWITH_ASSERT=0";;
273 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
274 esac
275 if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
276 echo "Setting assert flags = $sim_assert" 6>&1
277 fi],[sim_assert=""])dnl
278 ])
279 AC_SUBST(sim_assert)
280
281
282 dnl --enable-sim-endian={yes,no,big,little} is for simulators
283 dnl that support both big and little endian targets.
284 dnl arg[1] is hardwired target endianness.
285 dnl arg[2] is default target endianness.
286 AC_DEFUN(SIM_AC_OPTION_ENDIAN,
287 [
288 wire_endian="[$1]"
289 default_endian="[$2]"
290 AC_ARG_ENABLE(sim-endian,
291 [ --enable-sim-endian=endian Specify target byte endian orientation.],
292 [case "${enableval}" in
293 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
294 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
295 yes) if test x"$wire_endian" != x; then
296 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
297 else
298 if test x"$default_endian" != x; then
299 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
300 else
301 echo "No hard-wired endian for target $target" 1>&6
302 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
303 fi
304 fi;;
305 no) if test x"$default_endian" != x; then
306 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
307 else
308 if test x"$wire_endian" != x; then
309 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
310 else
311 echo "No default endian for target $target" 1>&6
312 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
313 fi
314 fi;;
315 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
316 esac
317 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
318 echo "Setting endian flags = $sim_endian" 6>&1
319 fi],
320 [if test x"$default_endian" != x; then
321 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
322 else
323 if test x"$wire_endian" != x; then
324 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
325 else
326 sim_endian=
327 fi
328 fi])dnl
329 ])
330 AC_SUBST(sim_endian)
331
332
333 dnl --enable-sim-hostendian is for users of the simulator when
334 dnl they find that AC_C_BIGENDIAN does not function correctly
335 dnl (for instance in a canadian cross)
336 AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
337 [
338 AC_ARG_ENABLE(sim-hostendian,
339 [ --enable-sim-hostendain=end Specify host byte endian orientation.],
340 [case "${enableval}" in
341 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
342 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
343 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
344 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
345 esac
346 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
347 echo "Setting hostendian flags = $sim_hostendian" 6>&1
348 fi],[
349 if test "x$cross_compiling" = "xno"; then
350 AC_C_BIGENDIAN
351 if test $ac_cv_c_bigendian = yes; then
352 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
353 else
354 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
355 fi
356 else
357 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
358 fi])dnl
359 ])
360 AC_SUBST(sim_hostendian)
361
362
363 AC_DEFUN(SIM_AC_OPTION_FLOAT,
364 [
365 default_sim_floating_point="ifelse([$1],,0,[$1])"
366 AC_ARG_ENABLE(sim-float,
367 [ --enable-sim-float Specify that the target processor has floating point hardware.],
368 [case "${enableval}" in
369 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
370 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
371 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
372 esac
373 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
374 echo "Setting float flags = $sim_float" 6>&1
375 fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
376 ])
377 AC_SUBST(sim_float)
378
379
380 dnl The argument is the default cache size if none is specified.
381 AC_DEFUN(SIM_AC_OPTION_SCACHE,
382 [
383 default_sim_scache="ifelse([$1],,0,[$1])"
384 AC_ARG_ENABLE(sim-scache,
385 [ --enable-sim-scache=size Specify simulator execution cache size.],
386 [case "${enableval}" in
387 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
388 no) sim_scace= ;;
389 [[0-9]]*) sim_cache=${enableval};;
390 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
391 sim_scache="";;
392 esac
393 if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
394 echo "Setting scache size = $sim_scache" 6>&1
395 fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
396 ])
397 AC_SUBST(sim_scache)
398
399
400 dnl The argument is the default model if none is specified.
401 AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
402 [
403 default_sim_default_model="ifelse([$1],,0,[$1])"
404 AC_ARG_ENABLE(sim-default-model,
405 [ --enable-sim-default-model=model Specify default model to simulate.],
406 [case "${enableval}" in
407 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
408 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
409 esac
410 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
411 echo "Setting default model = $sim_default_model" 6>&1
412 fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
413 ])
414 AC_SUBST(sim_default_model)
415
416
417 AC_DEFUN(SIM_AC_OPTION_HARDWARE,
418 [
419 AC_ARG_ENABLE(sim-hardware,
420 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
421 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
422 case "${enableval}" in
423 yes) ;;
424 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
425 ,*) hardware="${hardware}${enableval}";;
426 *,) hardware="${enableval}${hardware}";;
427 *) hardware="${enableval}"'';;
428 esac
429 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
430 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
431 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
432 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
433 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
434 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
435 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
436 if test x"$silent" != x"yes"; then
437 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
438 fi])dnl
439 ])
440 AC_SUBST(sim_hardware)
441
442
443 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
444 dnl performance by inlining functions.
445 AC_DEFUN(SIM_AC_OPTION_INLINE,
446 [
447 default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
448 AC_ARG_ENABLE(sim-inline,
449 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
450 [sim_inline=""
451 case "$enableval" in
452 no) sim_inline="-DDEFAULT_INLINE=0";;
453 0) sim_inline="-DDEFAULT_INLINE=0";;
454 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
455 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
456 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
457 new_flag=""
458 case "$x" in
459 *_INLINE=*) new_flag="-D$x";;
460 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
461 *_INLINE) new_flag="-D$x=ALL_INLINE";;
462 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
463 esac
464 if test x"$sim_inline" = x""; then
465 sim_inline="$new_flag"
466 else
467 sim_inline="$sim_inline $new_flag"
468 fi
469 done;;
470 esac
471 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
472 echo "Setting inline flags = $sim_inline" 6>&1
473 fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
474 sim_inline="${default_sim_inline}"
475 if test x"$silent" != x"yes"; then
476 echo "Setting inline flags = $sim_inline" 6>&1
477 fi
478 else
479 sim_inline=""
480 fi])dnl
481 ])
482 AC_SUBST(sim_inline)
483
484
485 AC_DEFUN(SIM_AC_OPTION_PACKAGES,
486 [
487 AC_ARG_ENABLE(sim-packages,
488 [ --enable-sim-packages=list Specify the packages to be included in the build.],
489 [packages=disklabel
490 case "${enableval}" in
491 yes) ;;
492 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
493 ,*) packages="${packages}${enableval}";;
494 *,) packages="${enableval}${packages}";;
495 *) packages="${enableval}"'';;
496 esac
497 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
498 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
499 if test x"$silent" != x"yes" && test x"$packages" != x""; then
500 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
501 fi],[packages=disklabel
502 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
503 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
504 if test x"$silent" != x"yes"; then
505 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
506 fi])dnl
507 ])
508 AC_SUBST(sim_packages)
509
510
511 AC_DEFUN(SIM_AC_OPTION_REGPARM,
512 [
513 AC_ARG_ENABLE(sim-regparm,
514 [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
515 [case "${enableval}" in
516 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
517 no) sim_regparm="" ;;
518 yes) sim_regparm="-DWITH_REGPARM=3";;
519 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
520 esac
521 if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
522 echo "Setting regparm flags = $sim_regparm" 6>&1
523 fi],[sim_regparm=""])dnl
524 ])
525 AC_SUBST(sim_regparm)
526
527
528 AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
529 [
530 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
531 AC_ARG_ENABLE(sim-reserved-bits,
532 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
533 [case "${enableval}" in
534 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
535 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
536 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
537 esac
538 if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
539 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
540 fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
541 ])
542 AC_SUBST(sim_reserved_bits)
543
544
545 AC_DEFUN(SIM_AC_OPTION_SMP,
546 [
547 default_sim_smp="ifelse([$1],,5,[$1])"
548 AC_ARG_ENABLE(sim-smp,
549 [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
550 [case "${enableval}" in
551 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
552 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
553 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
554 esac
555 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
556 echo "Setting smp flags = $sim_smp" 6>&1
557 fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
558 if test x"$silent" != x"yes"; then
559 echo "Setting smp flags = $sim_smp" 6>&1
560 fi])dnl
561 ])
562 AC_SUBST(sim_smp)
563
564
565 AC_DEFUN(SIM_AC_OPTION_STDCALL,
566 [
567 AC_ARG_ENABLE(sim-stdcall,
568 [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
569 [case "${enableval}" in
570 no) sim_stdcall="" ;;
571 std*) sim_stdcall="-DWITH_STDCALL=1";;
572 yes) sim_stdcall="-DWITH_STDCALL=1";;
573 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
574 esac
575 if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
576 echo "Setting function call flags = $sim_stdcall" 6>&1
577 fi],[sim_stdcall=""])dnl
578 ])
579 AC_SUBST(sim_stdcall)
580
581
582 AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
583 [
584 default_sim_xor_endian="ifelse([$1],,8,[$1])"
585 AC_ARG_ENABLE(sim-xor-endian,
586 [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
587 [case "${enableval}" in
588 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
589 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
590 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
591 esac
592 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
593 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
594 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
595 ])
596 AC_SUBST(sim_xor_endian)
597
598
599 dnl --enable-sim-warnings is for developers of the simulator.
600 dnl it enables extra GCC specific warnings.
601 AC_DEFUN(SIM_AC_OPTION_WARNINGS,
602 [
603 AC_ARG_ENABLE(sim-warnings,
604 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
605 [case "${enableval}" in
606 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
607 no) sim_warnings="-w";;
608 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
609 esac
610 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
611 echo "Setting warning flags = $sim_warnings" 6>&1
612 fi],[sim_warnings=""])dnl
613 ])
614 AC_SUBST(sim_warnings)
615
616
617 dnl Generate the Makefile in a target specific directory.
618 dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
619 dnl so this is a cover macro to tuck the details away of how we cope.
620 dnl We cope by having autoconf generate two files and then merge them into
621 dnl one afterwards. The two pieces of the common fragment are inserted into
622 dnl the target's fragment at the appropriate points.
623
624 AC_DEFUN(SIM_AC_OUTPUT,
625 [
626 AC_LINK_FILES($sim_link_files, $sim_link_links)
627 AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
628 [case "x$CONFIG_FILES" in
629 xMakefile*)
630 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
631 rm -f Makesim1.tmp Makesim2.tmp Makefile
632 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
633 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
634 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
635 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
636 <Makefile.sim >Makefile
637 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
638 ;;
639 esac
640 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
641 ])
642 ])
This page took 0.047222 seconds and 4 git commands to generate.