* dv-sockser.c, dv-sockser.h: New files.
[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)
50 AC_CHECK_HEADERS(sys/time.h sys/resource.h)
51 AC_CHECK_HEADERS(fcntl.h)
52 AC_CHECK_FUNCS(getrusage time sigaction)
53
54 . ${srcdir}/../../bfd/configure.host
55
56 dnl Standard (and optional) simulator options.
57 dnl Eventually all simulators will support these.
58 dnl Do not add any here that cannot be supported by all simulators.
59 dnl Do not add similar but different options to a particular simulator,
60 dnl all shall eventually behave the same way.
61
62
63 dnl We don't use automake, but we still want to support
64 dnl --enable-maintainer-mode.
65 USE_MAINTAINER_MODE=no
66 AC_ARG_ENABLE(maintainer-mode,
67 [ --enable-maintainer-mode Enable developer functionality.],
68 [case "${enableval}" in
69 yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
70 no) MAINT="#" ;;
71 *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
72 esac
73 if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
74 echo "Setting maintainer mode" 6>&1
75 fi],[MAINT="#"])dnl
76 AC_SUBST(MAINT)
77
78
79 dnl This is a generic option to enable special byte swapping
80 dnl insns on *any* cpu.
81 AC_ARG_ENABLE(sim-bswap,
82 [ --enable-sim-bswap Use Host specific BSWAP instruction.],
83 [case "${enableval}" in
84 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
85 no) sim_bswap="-DWITH_BSWAP=0";;
86 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
87 esac
88 if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
89 echo "Setting bswap flags = $sim_bswap" 6>&1
90 fi],[sim_bswap=""])dnl
91 AC_SUBST(sim_bswap)
92
93
94 AC_ARG_ENABLE(sim-cflags,
95 [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
96 [case "${enableval}" in
97 yes) sim_cflags="-O2";;
98 trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
99 no) sim_cflags="";;
100 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
101 esac
102 if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
103 echo "Setting sim cflags = $sim_cflags" 6>&1
104 fi],[sim_cflags=""])dnl
105 AC_SUBST(sim_cflags)
106
107
108 dnl --enable-sim-debug is for developers of the simulator
109 dnl the allowable values are work-in-progress
110 AC_ARG_ENABLE(sim-debug,
111 [ --enable-sim-debug=opts Enable debugging flags],
112 [case "${enableval}" in
113 yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
114 no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
115 *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
116 esac
117 if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
118 echo "Setting sim debug = $sim_debug" 6>&1
119 fi],[sim_debug=""])dnl
120 AC_SUBST(sim_debug)
121
122
123 dnl --enable-sim-stdio is for users of the simulator
124 dnl It determines if IO from the program is routed through STDIO (buffered)
125 AC_ARG_ENABLE(sim-stdio,
126 [ --enable-sim-stdio Specify whether to use stdio for console input/output.],
127 [case "${enableval}" in
128 yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
129 no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
130 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
131 esac
132 if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
133 echo "Setting stdio flags = $sim_stdio" 6>&1
134 fi],[sim_stdio=""])dnl
135 AC_SUBST(sim_stdio)
136
137
138 dnl --enable-sim-trace is for users of the simulator
139 dnl The argument is either a bitmask of things to enable [exactly what is
140 dnl up to the simulator], or is a comma separated list of names of tracing
141 dnl elements to enable. The latter is only supported on simulators that
142 dnl use WITH_TRACE.
143 AC_ARG_ENABLE(sim-trace,
144 [ --enable-sim-trace=opts Enable tracing flags],
145 [case "${enableval}" in
146 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
147 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
148 [[-0-9]]*)
149 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
150 [[a-z]]*)
151 sim_trace=""
152 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
153 if test x"$sim_trace" = x; then
154 sim_trace="-DWITH_TRACE='(TRACE_$x"
155 else
156 sim_trace="${sim_trace}|TRACE_$x"
157 fi
158 done
159 sim_trace="$sim_trace)'" ;;
160 esac
161 if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
162 echo "Setting sim trace = $sim_trace" 6>&1
163 fi],[sim_trace=""])dnl
164 AC_SUBST(sim_trace)
165
166
167 dnl --enable-sim-profile
168 dnl The argument is either a bitmask of things to enable [exactly what is
169 dnl up to the simulator], or is a comma separated list of names of profiling
170 dnl elements to enable. The latter is only supported on simulators that
171 dnl use WITH_PROFILE.
172 AC_ARG_ENABLE(sim-profile,
173 [ --enable-sim-profile=opts Enable profiling flags],
174 [case "${enableval}" in
175 yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
176 no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
177 [[-0-9]]*)
178 sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
179 [[a-z]]*)
180 sim_profile=""
181 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
182 if test x"$sim_profile" = x; then
183 sim_profile="-DWITH_PROFILE='(PROFILE_$x"
184 else
185 sim_profile="${sim_profile}|PROFILE_$x"
186 fi
187 done
188 sim_profile="$sim_profile)'" ;;
189 esac
190 if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
191 echo "Setting sim profile = $sim_profile" 6>&1
192 fi],[sim_profile=""])dnl
193 AC_SUBST(sim_profile)
194
195
196 dnl Types used by common code
197 AC_TYPE_SIGNAL
198
199
200 dnl These are available to append to as desired.
201 sim_link_files=
202 sim_link_links=
203
204 dnl Create tconfig.h either from simulator's tconfig.in or default one
205 dnl in common.
206 sim_link_links=tconfig.h
207 if test -f ${srcdir}/tconfig.in
208 then
209 sim_link_files=tconfig.in
210 else
211 sim_link_files=../common/tconfig.in
212 fi
213
214 # targ-vals.def points to the libc macro description file.
215 case "${target}" in
216 *-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
217 esac
218 sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
219 sim_link_links="${sim_link_links} targ-vals.def"
220
221 ]) dnl End of SIM_AC_COMMON
222
223
224 dnl Additional SIM options that can (optionally) be configured
225 dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
226 dnl Simulators that wish to use the relevant option specify the macro
227 dnl in the simulator specific configure.in file between the SIM_AC_COMMON
228 dnl and SIM_AC_OUTPUT lines.
229
230
231 dnl Specify the running environment.
232 dnl If the simulator invokes this in its configure.in then without this option
233 dnl the default is the user environment and all are runtime selectable.
234 dnl If the simulator doesn't invoke this, only the user environment is
235 dnl supported.
236 dnl ??? Until there is demonstrable value in doing something more complicated,
237 dnl let's not.
238 AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
239 [
240 AC_ARG_ENABLE(sim-environment,
241 [ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
242 [case "${enableval}" in
243 all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
244 user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
245 virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
246 operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
247 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
248 sim_environment="";;
249 esac
250 if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
251 echo "Setting sim environment = $sim_environment" 6>&1
252 fi],
253 [sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
254 ])
255 AC_SUBST(sim_environment)
256
257
258 dnl Specify the alignment restrictions of the target architecture.
259 dnl Without this option all possible alignment restrictions are accommodated.
260 dnl arg[1] is hardwired target alignment
261 dnl arg[2] is default target alignment
262 AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
263 wire_alignment="[$1]"
264 default_alignment="[$2]"
265 [
266 AC_ARG_ENABLE(sim-alignment,
267 [ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
268 [case "${enableval}" in
269 strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
270 nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
271 forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
272 yes) if test x"$wire_alignment" != x; then
273 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
274 else
275 if test x"$default_alignment" != x; then
276 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
277 else
278 echo "No hard-wired alignment for target $target" 1>&6
279 sim_alignment="-DWITH_ALIGNMENT=0"
280 fi
281 fi;;
282 no) if test x"$default_alignment" != x; then
283 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
284 else
285 if test x"$wire_alignment" != x; then
286 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
287 else
288 echo "No default alignment for target $target" 1>&6
289 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
290 fi
291 fi;;
292 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
293 esac
294 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
295 echo "Setting alignment flags = $sim_alignment" 6>&1
296 fi],
297 [if test x"$default_alignment" != x; then
298 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
299 else
300 if test x"$wire_alignment" != x; then
301 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
302 else
303 sim_alignment=
304 fi
305 fi])dnl
306 ])dnl
307 AC_SUBST(sim_alignment)
308
309
310 dnl Conditionally compile in assertion statements.
311 AC_DEFUN(SIM_AC_OPTION_ASSERT,
312 [
313 AC_ARG_ENABLE(sim-assert,
314 [ --enable-sim-assert Specify whether to perform random assertions.],
315 [case "${enableval}" in
316 yes) sim_assert="-DWITH_ASSERT=1";;
317 no) sim_assert="-DWITH_ASSERT=0";;
318 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
319 esac
320 if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
321 echo "Setting assert flags = $sim_assert" 6>&1
322 fi],[sim_assert=""])dnl
323 ])
324 AC_SUBST(sim_assert)
325
326
327
328 dnl --enable-sim-bitsize is for developers of the simulator
329 dnl It specifies the number of BITS in the target.
330 dnl arg[1] is the number of bits in a word
331 dnl arg[2] is the number assigned to the most significant bit
332 dnl arg[3] is the number of bits in an address
333 dnl arg[4] is the number of bits in an OpenFirmware cell.
334 dnl FIXME: this information should be obtained from bfd/archure
335 AC_DEFUN(SIM_AC_OPTION_BITSIZE,
336 wire_word_bitsize="[$1]"
337 wire_word_msb="[$2]"
338 wire_address_bitsize="[$3]"
339 wire_cell_bitsize="[$4]"
340 [AC_ARG_ENABLE(sim-bitsize,
341 [ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
342 [sim_bitsize=
343 case "${enableval}" in
344 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
345 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
346 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
347 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
348 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
349 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
350 else
351 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
352 fi ;;
353 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
354 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
355 else
356 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
357 fi ;;
358 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
359 esac
360 # address bitsize
361 tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
362 case x"${tmp}" in
363 x ) ;;
364 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
365 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
366 * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;
367 esac
368 # cell bitsize
369 tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
370 case x"${tmp}" in
371 x ) ;;
372 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
373 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
374 * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;
375 esac
376 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
377 echo "Setting bitsize flags = $sim_bitsize" 6>&1
378 fi],
379 [sim_bitsize=""
380 if test x"$wire_word_bitsize" != x; then
381 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
382 fi
383 if test x"$wire_word_msb" != x; then
384 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
385 fi
386 if test x"$wire_address_bitsize" != x; then
387 sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
388 fi
389 if test x"$wire_cell_bitsize" != x; then
390 sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
391 fi])dnl
392 ])
393 AC_SUBST(sim_bitsize)
394
395
396
397 dnl --enable-sim-endian={yes,no,big,little} is for simulators
398 dnl that support both big and little endian targets.
399 dnl arg[1] is hardwired target endianness.
400 dnl arg[2] is default target endianness.
401 AC_DEFUN(SIM_AC_OPTION_ENDIAN,
402 [
403 wire_endian="[$1]"
404 default_endian="[$2]"
405 AC_ARG_ENABLE(sim-endian,
406 [ --enable-sim-endian=endian Specify target byte endian orientation.],
407 [case "${enableval}" in
408 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
409 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
410 yes) if test x"$wire_endian" != x; then
411 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
412 else
413 if test x"$default_endian" != x; then
414 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
415 else
416 echo "No hard-wired endian for target $target" 1>&6
417 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
418 fi
419 fi;;
420 no) if test x"$default_endian" != x; then
421 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
422 else
423 if test x"$wire_endian" != x; then
424 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
425 else
426 echo "No default endian for target $target" 1>&6
427 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
428 fi
429 fi;;
430 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
431 esac
432 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
433 echo "Setting endian flags = $sim_endian" 6>&1
434 fi],
435 [if test x"$default_endian" != x; then
436 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
437 else
438 if test x"$wire_endian" != x; then
439 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
440 else
441 sim_endian=
442 fi
443 fi])dnl
444 ])
445 AC_SUBST(sim_endian)
446
447
448 dnl --enable-sim-hostendian is for users of the simulator when
449 dnl they find that AC_C_BIGENDIAN does not function correctly
450 dnl (for instance in a canadian cross)
451 AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
452 [
453 AC_ARG_ENABLE(sim-hostendian,
454 [ --enable-sim-hostendian=end Specify host byte endian orientation.],
455 [case "${enableval}" in
456 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
457 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
458 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
459 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
460 esac
461 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
462 echo "Setting hostendian flags = $sim_hostendian" 6>&1
463 fi],[
464 if test "x$cross_compiling" = "xno"; then
465 AC_C_BIGENDIAN
466 if test $ac_cv_c_bigendian = yes; then
467 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
468 else
469 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
470 fi
471 else
472 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
473 fi])dnl
474 ])
475 AC_SUBST(sim_hostendian)
476
477
478 dnl --enable-sim-float is for developers of the simulator
479 dnl It specifies the presence of hardware floating point
480 dnl And optionally the bitsize of the floating point register.
481 dnl arg[1] specifies the presence (or absence) of floating point hardware
482 dnl arg[2] specifies the number of bits in a floating point register
483 AC_DEFUN(SIM_AC_OPTION_FLOAT,
484 [
485 default_sim_float="[$1]"
486 default_sim_float_bitsize="[$2]"
487 AC_ARG_ENABLE(sim-float,
488 [ --enable-sim-float Specify that the target processor has floating point hardware.],
489 [case "${enableval}" in
490 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
491 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
492 32) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";;
493 64) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";;
494 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
495 esac
496 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
497 echo "Setting float flags = $sim_float" 6>&1
498 fi],[
499 sim_float=
500 if test x"${default_sim_float}" != x""; then
501 sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
502 fi
503 if test x"${default_sim_float_bitsize}" != x""; then
504 sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
505 fi
506 ])dnl
507 ])
508 AC_SUBST(sim_float)
509
510
511 dnl The argument is the default cache size if none is specified.
512 AC_DEFUN(SIM_AC_OPTION_SCACHE,
513 [
514 default_sim_scache="ifelse([$1],,0,[$1])"
515 AC_ARG_ENABLE(sim-scache,
516 [ --enable-sim-scache=size Specify simulator execution cache size.],
517 [case "${enableval}" in
518 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
519 no) sim_scache="-DWITH_SCACHE=0" ;;
520 [[0-9]]*) sim_cache=${enableval};;
521 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
522 sim_scache="";;
523 esac
524 if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
525 echo "Setting scache size = $sim_scache" 6>&1
526 fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
527 ])
528 AC_SUBST(sim_scache)
529
530
531 dnl The argument is the default model if none is specified.
532 AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
533 [
534 default_sim_default_model="ifelse([$1],,0,[$1])"
535 AC_ARG_ENABLE(sim-default-model,
536 [ --enable-sim-default-model=model Specify default model to simulate.],
537 [case "${enableval}" in
538 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
539 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
540 esac
541 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
542 echo "Setting default model = $sim_default_model" 6>&1
543 fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
544 ])
545 AC_SUBST(sim_default_model)
546
547
548 AC_DEFUN(SIM_AC_OPTION_HARDWARE,
549 [
550 AC_ARG_ENABLE(sim-hardware,
551 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
552 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
553 case "${enableval}" in
554 yes) ;;
555 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
556 ,*) hardware="${hardware}${enableval}";;
557 *,) hardware="${enableval}${hardware}";;
558 *) hardware="${enableval}"'';;
559 esac
560 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
561 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
562 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
563 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
564 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
565 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
566 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
567 if test x"$silent" != x"yes"; then
568 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
569 fi])dnl
570 ])
571 AC_SUBST(sim_hardware)
572
573
574 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
575 dnl performance by inlining functions.
576 AC_DEFUN(SIM_AC_OPTION_INLINE,
577 [
578 default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
579 AC_ARG_ENABLE(sim-inline,
580 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
581 [sim_inline=""
582 case "$enableval" in
583 no) sim_inline="-DDEFAULT_INLINE=0";;
584 0) sim_inline="-DDEFAULT_INLINE=0";;
585 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
586 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
587 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
588 new_flag=""
589 case "$x" in
590 *_INLINE=*) new_flag="-D$x";;
591 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
592 *_INLINE) new_flag="-D$x=ALL_INLINE";;
593 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
594 esac
595 if test x"$sim_inline" = x""; then
596 sim_inline="$new_flag"
597 else
598 sim_inline="$sim_inline $new_flag"
599 fi
600 done;;
601 esac
602 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
603 echo "Setting inline flags = $sim_inline" 6>&1
604 fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
605 sim_inline="${default_sim_inline}"
606 if test x"$silent" != x"yes"; then
607 echo "Setting inline flags = $sim_inline" 6>&1
608 fi
609 else
610 sim_inline=""
611 fi])dnl
612 ])
613 AC_SUBST(sim_inline)
614
615
616 AC_DEFUN(SIM_AC_OPTION_PACKAGES,
617 [
618 AC_ARG_ENABLE(sim-packages,
619 [ --enable-sim-packages=list Specify the packages to be included in the build.],
620 [packages=disklabel
621 case "${enableval}" in
622 yes) ;;
623 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
624 ,*) packages="${packages}${enableval}";;
625 *,) packages="${enableval}${packages}";;
626 *) packages="${enableval}"'';;
627 esac
628 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
629 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
630 if test x"$silent" != x"yes" && test x"$packages" != x""; then
631 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
632 fi],[packages=disklabel
633 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
634 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
635 if test x"$silent" != x"yes"; then
636 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
637 fi])dnl
638 ])
639 AC_SUBST(sim_packages)
640
641
642 AC_DEFUN(SIM_AC_OPTION_REGPARM,
643 [
644 AC_ARG_ENABLE(sim-regparm,
645 [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
646 [case "${enableval}" in
647 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
648 no) sim_regparm="" ;;
649 yes) sim_regparm="-DWITH_REGPARM=3";;
650 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
651 esac
652 if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
653 echo "Setting regparm flags = $sim_regparm" 6>&1
654 fi],[sim_regparm=""])dnl
655 ])
656 AC_SUBST(sim_regparm)
657
658
659 AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
660 [
661 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
662 AC_ARG_ENABLE(sim-reserved-bits,
663 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
664 [case "${enableval}" in
665 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
666 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
667 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
668 esac
669 if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
670 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
671 fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
672 ])
673 AC_SUBST(sim_reserved_bits)
674
675
676 AC_DEFUN(SIM_AC_OPTION_SMP,
677 [
678 default_sim_smp="ifelse([$1],,5,[$1])"
679 AC_ARG_ENABLE(sim-smp,
680 [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
681 [case "${enableval}" in
682 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
683 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
684 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
685 esac
686 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
687 echo "Setting smp flags = $sim_smp" 6>&1
688 fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
689 if test x"$silent" != x"yes"; then
690 echo "Setting smp flags = $sim_smp" 6>&1
691 fi])dnl
692 ])
693 AC_SUBST(sim_smp)
694
695
696 AC_DEFUN(SIM_AC_OPTION_STDCALL,
697 [
698 AC_ARG_ENABLE(sim-stdcall,
699 [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
700 [case "${enableval}" in
701 no) sim_stdcall="" ;;
702 std*) sim_stdcall="-DWITH_STDCALL=1";;
703 yes) sim_stdcall="-DWITH_STDCALL=1";;
704 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
705 esac
706 if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
707 echo "Setting function call flags = $sim_stdcall" 6>&1
708 fi],[sim_stdcall=""])dnl
709 ])
710 AC_SUBST(sim_stdcall)
711
712
713 AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
714 [
715 default_sim_xor_endian="ifelse([$1],,8,[$1])"
716 AC_ARG_ENABLE(sim-xor-endian,
717 [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
718 [case "${enableval}" in
719 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
720 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
721 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
722 esac
723 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
724 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
725 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
726 ])
727 AC_SUBST(sim_xor_endian)
728
729
730 dnl --enable-sim-warnings is for developers of the simulator.
731 dnl it enables extra GCC specific warnings.
732 AC_DEFUN(SIM_AC_OPTION_WARNINGS,
733 [
734 AC_ARG_ENABLE(sim-warnings,
735 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings],
736 [case "${enableval}" in
737 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
738 no) sim_warnings="-w";;
739 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
740 esac
741 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
742 echo "Setting warning flags = $sim_warnings" 6>&1
743 fi],[sim_warnings=""])dnl
744 ])
745 AC_SUBST(sim_warnings)
746
747
748 dnl Generate the Makefile in a target specific directory.
749 dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
750 dnl so this is a cover macro to tuck the details away of how we cope.
751 dnl We cope by having autoconf generate two files and then merge them into
752 dnl one afterwards. The two pieces of the common fragment are inserted into
753 dnl the target's fragment at the appropriate points.
754
755 AC_DEFUN(SIM_AC_OUTPUT,
756 [
757 AC_LINK_FILES($sim_link_files, $sim_link_links)
758 AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
759 [case "x$CONFIG_FILES" in
760 xMakefile*)
761 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
762 rm -f Makesim1.tmp Makesim2.tmp Makefile
763 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
764 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
765 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
766 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
767 <Makefile.sim >Makefile
768 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
769 ;;
770 esac
771 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
772 ])
773 ])
This page took 0.047098 seconds and 5 git commands to generate.