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. | |
b45caf05 | 24 | AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in) |
80b7b3a5 SG |
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 | ||
fc4198bb TT |
46 | dnl We don't use gettext, but bfd does. So we do the appropriate checks |
47 | dnl to see if there are intl libraries we should link against. | |
48 | ALL_LINGUAS= | |
49 | CY_GNU_GETTEXT | |
50 | ||
fbda74b1 | 51 | # Check for common headers. |
63ddb6bd DE |
52 | # FIXME: Seems to me this can cause problems for i386-windows hosts. |
53 | # At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*. | |
84c6d152 DE |
54 | AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h) |
55 | AC_CHECK_HEADERS(sys/time.h sys/resource.h) | |
8d0bd988 IC |
56 | AC_CHECK_HEADERS(fcntl.h fpu_control.h) |
57 | AC_CHECK_FUNCS(getrusage time sigaction __setfpucw) | |
fbda74b1 | 58 | |
80b7b3a5 SG |
59 | . ${srcdir}/../../bfd/configure.host |
60 | ||
a77aa7ec | 61 | dnl Standard (and optional) simulator options. |
80b7b3a5 SG |
62 | dnl Eventually all simulators will support these. |
63 | dnl Do not add any here that cannot be supported by all simulators. | |
64 | dnl Do not add similar but different options to a particular simulator, | |
65 | dnl all shall eventually behave the same way. | |
66 | ||
f2de7dfd | 67 | |
462cfbc4 DE |
68 | dnl We don't use automake, but we still want to support |
69 | dnl --enable-maintainer-mode. | |
84c6d152 | 70 | USE_MAINTAINER_MODE=no |
462cfbc4 DE |
71 | AC_ARG_ENABLE(maintainer-mode, |
72 | [ --enable-maintainer-mode Enable developer functionality.], | |
73 | [case "${enableval}" in | |
84c6d152 | 74 | yes) MAINT="" USE_MAINTAINER_MODE=yes ;; |
462cfbc4 DE |
75 | no) MAINT="#" ;; |
76 | *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;; | |
77 | esac | |
78 | if test x"$silent" != x"yes" && test x"$MAINT" = x""; then | |
79 | echo "Setting maintainer mode" 6>&1 | |
80 | fi],[MAINT="#"])dnl | |
81 | AC_SUBST(MAINT) | |
82 | ||
83 | ||
f2de7dfd AC |
84 | dnl This is a generic option to enable special byte swapping |
85 | dnl insns on *any* cpu. | |
86 | AC_ARG_ENABLE(sim-bswap, | |
87 | [ --enable-sim-bswap Use Host specific BSWAP instruction.], | |
88 | [case "${enableval}" in | |
a77aa7ec | 89 | yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";; |
f2de7dfd AC |
90 | no) sim_bswap="-DWITH_BSWAP=0";; |
91 | *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";; | |
92 | esac | |
93 | if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then | |
94 | echo "Setting bswap flags = $sim_bswap" 6>&1 | |
95 | fi],[sim_bswap=""])dnl | |
96 | AC_SUBST(sim_bswap) | |
97 | ||
98 | ||
80b7b3a5 SG |
99 | AC_ARG_ENABLE(sim-cflags, |
100 | [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator], | |
101 | [case "${enableval}" in | |
278bda40 | 102 | yes) sim_cflags="-O2 -fomit-frame-pointer";; |
80b7b3a5 SG |
103 | trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";; |
104 | no) sim_cflags="";; | |
105 | *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
106 | esac | |
107 | if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then | |
108 | echo "Setting sim cflags = $sim_cflags" 6>&1 | |
109 | fi],[sim_cflags=""])dnl | |
110 | AC_SUBST(sim_cflags) | |
111 | ||
f2de7dfd | 112 | |
80b7b3a5 SG |
113 | dnl --enable-sim-debug is for developers of the simulator |
114 | dnl the allowable values are work-in-progress | |
115 | AC_ARG_ENABLE(sim-debug, | |
116 | [ --enable-sim-debug=opts Enable debugging flags], | |
117 | [case "${enableval}" in | |
fbda74b1 DE |
118 | yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";; |
119 | no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";; | |
120 | *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";; | |
80b7b3a5 SG |
121 | esac |
122 | if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then | |
123 | echo "Setting sim debug = $sim_debug" 6>&1 | |
124 | fi],[sim_debug=""])dnl | |
125 | AC_SUBST(sim_debug) | |
126 | ||
f2de7dfd | 127 | |
a35e91c3 AC |
128 | dnl --enable-sim-stdio is for users of the simulator |
129 | dnl It determines if IO from the program is routed through STDIO (buffered) | |
130 | AC_ARG_ENABLE(sim-stdio, | |
131 | [ --enable-sim-stdio Specify whether to use stdio for console input/output.], | |
132 | [case "${enableval}" in | |
133 | yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";; | |
134 | no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";; | |
135 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";; | |
136 | esac | |
137 | if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then | |
138 | echo "Setting stdio flags = $sim_stdio" 6>&1 | |
139 | fi],[sim_stdio=""])dnl | |
140 | AC_SUBST(sim_stdio) | |
141 | ||
142 | ||
143 | dnl --enable-sim-trace is for users of the simulator | |
247fccde AC |
144 | dnl The argument is either a bitmask of things to enable [exactly what is |
145 | dnl up to the simulator], or is a comma separated list of names of tracing | |
146 | dnl elements to enable. The latter is only supported on simulators that | |
147 | dnl use WITH_TRACE. | |
a35e91c3 AC |
148 | AC_ARG_ENABLE(sim-trace, |
149 | [ --enable-sim-trace=opts Enable tracing flags], | |
150 | [case "${enableval}" in | |
247fccde | 151 | yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; |
a35e91c3 | 152 | no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; |
247fccde AC |
153 | [[-0-9]]*) |
154 | sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; | |
155 | [[a-z]]*) | |
156 | sim_trace="" | |
157 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
158 | if test x"$sim_trace" = x; then | |
159 | sim_trace="-DWITH_TRACE='(TRACE_$x" | |
160 | else | |
161 | sim_trace="${sim_trace}|TRACE_$x" | |
162 | fi | |
163 | done | |
164 | sim_trace="$sim_trace)'" ;; | |
a35e91c3 AC |
165 | esac |
166 | if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then | |
167 | echo "Setting sim trace = $sim_trace" 6>&1 | |
168 | fi],[sim_trace=""])dnl | |
169 | AC_SUBST(sim_trace) | |
170 | ||
171 | ||
247fccde AC |
172 | dnl --enable-sim-profile |
173 | dnl The argument is either a bitmask of things to enable [exactly what is | |
174 | dnl up to the simulator], or is a comma separated list of names of profiling | |
175 | dnl elements to enable. The latter is only supported on simulators that | |
176 | dnl use WITH_PROFILE. | |
177 | AC_ARG_ENABLE(sim-profile, | |
178 | [ --enable-sim-profile=opts Enable profiling flags], | |
179 | [case "${enableval}" in | |
180 | yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";; | |
181 | no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";; | |
182 | [[-0-9]]*) | |
183 | sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";; | |
184 | [[a-z]]*) | |
185 | sim_profile="" | |
186 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
187 | if test x"$sim_profile" = x; then | |
188 | sim_profile="-DWITH_PROFILE='(PROFILE_$x" | |
189 | else | |
190 | sim_profile="${sim_profile}|PROFILE_$x" | |
191 | fi | |
192 | done | |
193 | sim_profile="$sim_profile)'" ;; | |
194 | esac | |
195 | if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then | |
196 | echo "Setting sim profile = $sim_profile" 6>&1 | |
197 | fi],[sim_profile=""])dnl | |
198 | AC_SUBST(sim_profile) | |
199 | ||
200 | ||
63ddb6bd DE |
201 | dnl Types used by common code |
202 | AC_TYPE_SIGNAL | |
203 | ||
204 | ||
a35e91c3 AC |
205 | dnl These are available to append to as desired. |
206 | sim_link_files= | |
207 | sim_link_links= | |
208 | ||
209 | dnl Create tconfig.h either from simulator's tconfig.in or default one | |
210 | dnl in common. | |
211 | sim_link_links=tconfig.h | |
212 | if test -f ${srcdir}/tconfig.in | |
213 | then | |
214 | sim_link_files=tconfig.in | |
215 | else | |
216 | sim_link_files=../common/tconfig.in | |
217 | fi | |
218 | ||
219 | # targ-vals.def points to the libc macro description file. | |
220 | case "${target}" in | |
221 | *-*-*) TARG_VALS_DEF=../common/nltvals.def ;; | |
222 | esac | |
223 | sim_link_files="${sim_link_files} ${TARG_VALS_DEF}" | |
224 | sim_link_links="${sim_link_links} targ-vals.def" | |
225 | ||
226 | ]) dnl End of SIM_AC_COMMON | |
227 | ||
228 | ||
229 | dnl Additional SIM options that can (optionally) be configured | |
230 | dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined. | |
231 | dnl Simulators that wish to use the relevant option specify the macro | |
232 | dnl in the simulator specific configure.in file between the SIM_AC_COMMON | |
233 | dnl and SIM_AC_OUTPUT lines. | |
234 | ||
235 | ||
462cfbc4 DE |
236 | dnl Specify the running environment. |
237 | dnl If the simulator invokes this in its configure.in then without this option | |
238 | dnl the default is the user environment and all are runtime selectable. | |
239 | dnl If the simulator doesn't invoke this, only the user environment is | |
240 | dnl supported. | |
241 | dnl ??? Until there is demonstrable value in doing something more complicated, | |
242 | dnl let's not. | |
243 | AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT, | |
244 | [ | |
245 | AC_ARG_ENABLE(sim-environment, | |
246 | [ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.], | |
247 | [case "${enableval}" in | |
248 | all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";; | |
249 | user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";; | |
250 | virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";; | |
251 | operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";; | |
252 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment"); | |
253 | sim_environment="";; | |
254 | esac | |
255 | if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then | |
256 | echo "Setting sim environment = $sim_environment" 6>&1 | |
257 | fi], | |
258 | [sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl | |
259 | ]) | |
260 | AC_SUBST(sim_environment) | |
261 | ||
262 | ||
a35e91c3 | 263 | dnl Specify the alignment restrictions of the target architecture. |
794e9ac9 | 264 | dnl Without this option all possible alignment restrictions are accommodated. |
b45caf05 AC |
265 | dnl arg[1] is hardwired target alignment |
266 | dnl arg[2] is default target alignment | |
a35e91c3 | 267 | AC_DEFUN(SIM_AC_OPTION_ALIGNMENT, |
794e9ac9 AC |
268 | wire_alignment="[$1]" |
269 | default_alignment="[$2]" | |
a35e91c3 AC |
270 | [ |
271 | AC_ARG_ENABLE(sim-alignment, | |
b45caf05 | 272 | [ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.], |
a35e91c3 | 273 | [case "${enableval}" in |
b45caf05 AC |
274 | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; |
275 | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; | |
276 | forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";; | |
277 | yes) if test x"$wire_alignment" != x; then | |
278 | sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" | |
279 | else | |
794e9ac9 AC |
280 | if test x"$default_alignment" != x; then |
281 | sim_alignment="-DWITH_ALIGNMENT=${default_alignment}" | |
282 | else | |
283 | echo "No hard-wired alignment for target $target" 1>&6 | |
284 | sim_alignment="-DWITH_ALIGNMENT=0" | |
285 | fi | |
b45caf05 AC |
286 | fi;; |
287 | no) if test x"$default_alignment" != x; then | |
288 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" | |
289 | else | |
794e9ac9 AC |
290 | if test x"$wire_alignment" != x; then |
291 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}" | |
292 | else | |
293 | echo "No default alignment for target $target" 1>&6 | |
294 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0" | |
295 | fi | |
b45caf05 AC |
296 | fi;; |
297 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";; | |
a35e91c3 AC |
298 | esac |
299 | if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then | |
300 | echo "Setting alignment flags = $sim_alignment" 6>&1 | |
794e9ac9 AC |
301 | fi], |
302 | [if test x"$default_alignment" != x; then | |
303 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" | |
304 | else | |
305 | if test x"$wire_alignment" != x; then | |
306 | sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" | |
307 | else | |
308 | sim_alignment= | |
309 | fi | |
310 | fi])dnl | |
a35e91c3 | 311 | ])dnl |
92f91d1f | 312 | AC_SUBST(sim_alignment) |
a35e91c3 AC |
313 | |
314 | ||
315 | dnl Conditionally compile in assertion statements. | |
316 | AC_DEFUN(SIM_AC_OPTION_ASSERT, | |
317 | [ | |
318 | AC_ARG_ENABLE(sim-assert, | |
319 | [ --enable-sim-assert Specify whether to perform random assertions.], | |
320 | [case "${enableval}" in | |
321 | yes) sim_assert="-DWITH_ASSERT=1";; | |
322 | no) sim_assert="-DWITH_ASSERT=0";; | |
323 | *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";; | |
324 | esac | |
325 | if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then | |
326 | echo "Setting assert flags = $sim_assert" 6>&1 | |
327 | fi],[sim_assert=""])dnl | |
a35e91c3 | 328 | ]) |
92f91d1f | 329 | AC_SUBST(sim_assert) |
a35e91c3 AC |
330 | |
331 | ||
462cfbc4 DE |
332 | |
333 | dnl --enable-sim-bitsize is for developers of the simulator | |
334 | dnl It specifies the number of BITS in the target. | |
335 | dnl arg[1] is the number of bits in a word | |
336 | dnl arg[2] is the number assigned to the most significant bit | |
412c4e94 AC |
337 | dnl arg[3] is the number of bits in an address |
338 | dnl arg[4] is the number of bits in an OpenFirmware cell. | |
462cfbc4 DE |
339 | dnl FIXME: this information should be obtained from bfd/archure |
340 | AC_DEFUN(SIM_AC_OPTION_BITSIZE, | |
412c4e94 AC |
341 | wire_word_bitsize="[$1]" |
342 | wire_word_msb="[$2]" | |
343 | wire_address_bitsize="[$3]" | |
344 | wire_cell_bitsize="[$4]" | |
462cfbc4 | 345 | [AC_ARG_ENABLE(sim-bitsize, |
412c4e94 AC |
346 | [ --enable-sim-bitsize=N Specify target bitsize (32 or 64).], |
347 | [sim_bitsize= | |
348 | case "${enableval}" in | |
349 | 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";; | |
350 | 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";; | |
351 | 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; | |
352 | 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; | |
353 | 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then | |
462cfbc4 DE |
354 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31" |
355 | else | |
356 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0" | |
357 | fi ;; | |
412c4e94 | 358 | 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then |
462cfbc4 DE |
359 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63" |
360 | else | |
361 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0" | |
362 | fi ;; | |
412c4e94 AC |
363 | *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;; |
364 | esac | |
365 | # address bitsize | |
366 | tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"` | |
367 | case x"${tmp}" in | |
368 | x ) ;; | |
369 | x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;; | |
370 | x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;; | |
371 | * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;; | |
372 | esac | |
373 | # cell bitsize | |
374 | tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"` | |
375 | case x"${tmp}" in | |
376 | x ) ;; | |
377 | x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;; | |
378 | x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;; | |
379 | * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;; | |
462cfbc4 DE |
380 | esac |
381 | if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then | |
382 | echo "Setting bitsize flags = $sim_bitsize" 6>&1 | |
383 | fi], | |
384 | [sim_bitsize="" | |
412c4e94 AC |
385 | if test x"$wire_word_bitsize" != x; then |
386 | sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize" | |
387 | fi | |
388 | if test x"$wire_word_msb" != x; then | |
389 | sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb" | |
390 | fi | |
391 | if test x"$wire_address_bitsize" != x; then | |
392 | sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize" | |
462cfbc4 | 393 | fi |
412c4e94 AC |
394 | if test x"$wire_cell_bitsize" != x; then |
395 | sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize" | |
462cfbc4 DE |
396 | fi])dnl |
397 | ]) | |
398 | AC_SUBST(sim_bitsize) | |
399 | ||
400 | ||
401 | ||
f2de7dfd AC |
402 | dnl --enable-sim-endian={yes,no,big,little} is for simulators |
403 | dnl that support both big and little endian targets. | |
247fccde AC |
404 | dnl arg[1] is hardwired target endianness. |
405 | dnl arg[2] is default target endianness. | |
f2de7dfd | 406 | AC_DEFUN(SIM_AC_OPTION_ENDIAN, |
8cd89e77 | 407 | [ |
92f91d1f AC |
408 | wire_endian="[$1]" |
409 | default_endian="[$2]" | |
f2de7dfd AC |
410 | AC_ARG_ENABLE(sim-endian, |
411 | [ --enable-sim-endian=endian Specify target byte endian orientation.], | |
412 | [case "${enableval}" in | |
f2de7dfd AC |
413 | b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";; |
414 | l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";; | |
247fccde AC |
415 | yes) if test x"$wire_endian" != x; then |
416 | sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" | |
417 | else | |
92f91d1f AC |
418 | if test x"$default_endian" != x; then |
419 | sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}" | |
420 | else | |
421 | echo "No hard-wired endian for target $target" 1>&6 | |
422 | sim_endian="-DWITH_TARGET_BYTE_ORDER=0" | |
423 | fi | |
247fccde AC |
424 | fi;; |
425 | no) if test x"$default_endian" != x; then | |
426 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" | |
427 | else | |
92f91d1f AC |
428 | if test x"$wire_endian" != x; then |
429 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}" | |
430 | else | |
431 | echo "No default endian for target $target" 1>&6 | |
432 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0" | |
433 | fi | |
247fccde | 434 | fi;; |
f2de7dfd AC |
435 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";; |
436 | esac | |
437 | if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then | |
438 | echo "Setting endian flags = $sim_endian" 6>&1 | |
92f91d1f AC |
439 | fi], |
440 | [if test x"$default_endian" != x; then | |
441 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" | |
442 | else | |
443 | if test x"$wire_endian" != x; then | |
444 | sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" | |
445 | else | |
446 | sim_endian= | |
447 | fi | |
448 | fi])dnl | |
f2de7dfd | 449 | ]) |
92f91d1f | 450 | AC_SUBST(sim_endian) |
8cd89e77 | 451 | |
80b7b3a5 | 452 | |
f2de7dfd AC |
453 | dnl --enable-sim-hostendian is for users of the simulator when |
454 | dnl they find that AC_C_BIGENDIAN does not function correctly | |
455 | dnl (for instance in a canadian cross) | |
456 | AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN, | |
457 | [ | |
458 | AC_ARG_ENABLE(sim-hostendian, | |
462cfbc4 | 459 | [ --enable-sim-hostendian=end Specify host byte endian orientation.], |
f2de7dfd AC |
460 | [case "${enableval}" in |
461 | no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";; | |
462 | b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";; | |
463 | l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";; | |
464 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";; | |
465 | esac | |
466 | if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then | |
467 | echo "Setting hostendian flags = $sim_hostendian" 6>&1 | |
468 | fi],[ | |
469 | if test "x$cross_compiling" = "xno"; then | |
470 | AC_C_BIGENDIAN | |
471 | if test $ac_cv_c_bigendian = yes; then | |
472 | sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN" | |
473 | else | |
474 | sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN" | |
475 | fi | |
476 | else | |
477 | sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" | |
478 | fi])dnl | |
a77aa7ec | 479 | ]) |
92f91d1f | 480 | AC_SUBST(sim_hostendian) |
a77aa7ec AC |
481 | |
482 | ||
84c6d152 DE |
483 | dnl --enable-sim-float is for developers of the simulator |
484 | dnl It specifies the presence of hardware floating point | |
485 | dnl And optionally the bitsize of the floating point register. | |
486 | dnl arg[1] specifies the presence (or absence) of floating point hardware | |
487 | dnl arg[2] specifies the number of bits in a floating point register | |
a77aa7ec AC |
488 | AC_DEFUN(SIM_AC_OPTION_FLOAT, |
489 | [ | |
84c6d152 DE |
490 | default_sim_float="[$1]" |
491 | default_sim_float_bitsize="[$2]" | |
a77aa7ec | 492 | AC_ARG_ENABLE(sim-float, |
a35e91c3 | 493 | [ --enable-sim-float Specify that the target processor has floating point hardware.], |
a77aa7ec AC |
494 | [case "${enableval}" in |
495 | yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";; | |
496 | no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";; | |
84c6d152 DE |
497 | 32) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";; |
498 | 64) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";; | |
a77aa7ec AC |
499 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";; |
500 | esac | |
501 | if test x"$silent" != x"yes" && test x"$sim_float" != x""; then | |
502 | echo "Setting float flags = $sim_float" 6>&1 | |
84c6d152 DE |
503 | fi],[ |
504 | sim_float= | |
505 | if test x"${default_sim_float}" != x""; then | |
506 | sim_float="-DWITH_FLOATING_POINT=${default_sim_float}" | |
507 | fi | |
508 | if test x"${default_sim_float_bitsize}" != x""; then | |
509 | sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}" | |
510 | fi | |
511 | ])dnl | |
a77aa7ec | 512 | ]) |
92f91d1f | 513 | AC_SUBST(sim_float) |
a77aa7ec AC |
514 | |
515 | ||
247fccde AC |
516 | dnl The argument is the default cache size if none is specified. |
517 | AC_DEFUN(SIM_AC_OPTION_SCACHE, | |
518 | [ | |
519 | default_sim_scache="ifelse([$1],,0,[$1])" | |
520 | AC_ARG_ENABLE(sim-scache, | |
521 | [ --enable-sim-scache=size Specify simulator execution cache size.], | |
522 | [case "${enableval}" in | |
523 | yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";; | |
462cfbc4 | 524 | no) sim_scache="-DWITH_SCACHE=0" ;; |
247fccde AC |
525 | [[0-9]]*) sim_cache=${enableval};; |
526 | *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache"); | |
527 | sim_scache="";; | |
528 | esac | |
529 | if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then | |
530 | echo "Setting scache size = $sim_scache" 6>&1 | |
531 | fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"]) | |
247fccde | 532 | ]) |
92f91d1f | 533 | AC_SUBST(sim_scache) |
247fccde AC |
534 | |
535 | ||
536 | dnl The argument is the default model if none is specified. | |
537 | AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL, | |
538 | [ | |
539 | default_sim_default_model="ifelse([$1],,0,[$1])" | |
540 | AC_ARG_ENABLE(sim-default-model, | |
541 | [ --enable-sim-default-model=model Specify default model to simulate.], | |
542 | [case "${enableval}" in | |
543 | yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");; | |
544 | *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";; | |
545 | esac | |
546 | if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then | |
547 | echo "Setting default model = $sim_default_model" 6>&1 | |
548 | fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"]) | |
247fccde | 549 | ]) |
92f91d1f | 550 | AC_SUBST(sim_default_model) |
247fccde AC |
551 | |
552 | ||
d89fa2d8 AC |
553 | dnl --enable-sim-hardware is for users of the simulator |
554 | dnl arg[1] is a space separated list of devices that override the defaults | |
555 | dnl arg[2] is a space separated list of extra target specific devices. | |
a77aa7ec AC |
556 | AC_DEFUN(SIM_AC_OPTION_HARDWARE, |
557 | [ | |
d89fa2d8 | 558 | sim_hardware="-DWITH_HW=1" |
278bda40 | 559 | sim_hw_obj="hw-device.o hw-ports.o hw-properties.o hw-base.o hw-tree.o sim-hw.o" |
d89fa2d8 | 560 | hardware="ifelse([$1],,[core pal glue],[$1]) ifelse([$2],,,[$2])" |
a77aa7ec | 561 | AC_ARG_ENABLE(sim-hardware, |
d89fa2d8 AC |
562 | [ --enable-sim-hardware=LIST Specify the hardware to be included in the build.], |
563 | [ | |
a77aa7ec AC |
564 | case "${enableval}" in |
565 | yes) ;; | |
d89fa2d8 AC |
566 | no) hardware=""; sim_hardware="-DWITH_HW=0"; sim_hw_obj="";; |
567 | ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";; | |
568 | *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";; | |
569 | *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';; | |
a77aa7ec | 570 | esac |
d89fa2d8 AC |
571 | dnl remove duplicates |
572 | sim_hw="" | |
573 | for i in x $hardware ; do | |
574 | case " $f " in | |
575 | x) ;; | |
576 | *" $i "*) ;; | |
577 | *) sim_hw="$sim_hw $i" ;; | |
578 | esac | |
579 | done | |
278bda40 | 580 | sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`" |
a77aa7ec | 581 | if test x"$silent" != x"yes" && test x"$hardware" != x""; then |
d89fa2d8 AC |
582 | echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj" |
583 | fi],[ | |
584 | sim_hw="$hardware" | |
278bda40 | 585 | sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`" |
a77aa7ec | 586 | if test x"$silent" != x"yes"; then |
d89fa2d8 | 587 | echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj" |
a77aa7ec | 588 | fi])dnl |
f2de7dfd | 589 | ]) |
92f91d1f | 590 | AC_SUBST(sim_hardware) |
d89fa2d8 AC |
591 | AC_SUBST(sim_hw_obj) |
592 | AC_SUBST(sim_hw) | |
f2de7dfd | 593 | |
80b7b3a5 | 594 | |
f2de7dfd AC |
595 | dnl --enable-sim-inline is for users that wish to ramp up the simulator's |
596 | dnl performance by inlining functions. | |
278bda40 AC |
597 | dnl Guarantee that unconfigured simulators do not do any inlining |
598 | sim_inline="-DDEFAULT_INLINE=0" | |
f2de7dfd AC |
599 | AC_DEFUN(SIM_AC_OPTION_INLINE, |
600 | [ | |
601 | default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])" | |
602 | AC_ARG_ENABLE(sim-inline, | |
603 | [ --enable-sim-inline=inlines Specify which functions should be inlined.], | |
604 | [sim_inline="" | |
605 | case "$enableval" in | |
606 | no) sim_inline="-DDEFAULT_INLINE=0";; | |
607 | 0) sim_inline="-DDEFAULT_INLINE=0";; | |
278bda40 | 608 | yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";; |
f2de7dfd AC |
609 | 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";; |
610 | *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
611 | new_flag="" | |
612 | case "$x" in | |
613 | *_INLINE=*) new_flag="-D$x";; | |
614 | *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; | |
278bda40 AC |
615 | *_INLINE) new_flag="-D$x=ALL_C_INLINE";; |
616 | *) new_flag="-D$x""_INLINE=ALL_C_INLINE";; | |
f2de7dfd AC |
617 | esac |
618 | if test x"$sim_inline" = x""; then | |
619 | sim_inline="$new_flag" | |
620 | else | |
621 | sim_inline="$sim_inline $new_flag" | |
622 | fi | |
623 | done;; | |
624 | esac | |
625 | if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then | |
626 | echo "Setting inline flags = $sim_inline" 6>&1 | |
fc4198bb TT |
627 | fi],[ |
628 | if test "x$cross_compiling" = "xno"; then | |
629 | if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then | |
630 | sim_inline="${default_sim_inline}" | |
631 | if test x"$silent" != x"yes"; then | |
632 | echo "Setting inline flags = $sim_inline" 6>&1 | |
633 | fi | |
634 | else | |
635 | sim_inline="" | |
f2de7dfd AC |
636 | fi |
637 | else | |
fc4198bb | 638 | sim_inline="-DDEFAULT_INLINE=0" |
f2de7dfd | 639 | fi])dnl |
a77aa7ec | 640 | ]) |
92f91d1f | 641 | AC_SUBST(sim_inline) |
a77aa7ec AC |
642 | |
643 | ||
644 | AC_DEFUN(SIM_AC_OPTION_PACKAGES, | |
645 | [ | |
646 | AC_ARG_ENABLE(sim-packages, | |
647 | [ --enable-sim-packages=list Specify the packages to be included in the build.], | |
648 | [packages=disklabel | |
649 | case "${enableval}" in | |
650 | yes) ;; | |
651 | no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";; | |
652 | ,*) packages="${packages}${enableval}";; | |
653 | *,) packages="${enableval}${packages}";; | |
654 | *) packages="${enableval}"'';; | |
655 | esac | |
656 | sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` | |
657 | sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` | |
658 | if test x"$silent" != x"yes" && test x"$packages" != x""; then | |
659 | echo "Setting packages to $sim_pk_src, $sim_pk_obj" | |
660 | fi],[packages=disklabel | |
661 | sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` | |
662 | sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` | |
663 | if test x"$silent" != x"yes"; then | |
664 | echo "Setting packages to $sim_pk_src, $sim_pk_obj" | |
665 | fi])dnl | |
a77aa7ec | 666 | ]) |
92f91d1f | 667 | AC_SUBST(sim_packages) |
a77aa7ec AC |
668 | |
669 | ||
670 | AC_DEFUN(SIM_AC_OPTION_REGPARM, | |
671 | [ | |
672 | AC_ARG_ENABLE(sim-regparm, | |
673 | [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.], | |
674 | [case "${enableval}" in | |
675 | 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";; | |
676 | no) sim_regparm="" ;; | |
677 | yes) sim_regparm="-DWITH_REGPARM=3";; | |
678 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";; | |
679 | esac | |
680 | if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then | |
681 | echo "Setting regparm flags = $sim_regparm" 6>&1 | |
682 | fi],[sim_regparm=""])dnl | |
a77aa7ec | 683 | ]) |
92f91d1f | 684 | AC_SUBST(sim_regparm) |
a77aa7ec AC |
685 | |
686 | ||
687 | AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS, | |
688 | [ | |
a35e91c3 | 689 | default_sim_reserved_bits="ifelse([$1],,1,[$1])" |
a77aa7ec AC |
690 | AC_ARG_ENABLE(sim-reserved-bits, |
691 | [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.], | |
692 | [case "${enableval}" in | |
693 | yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";; | |
694 | no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";; | |
695 | *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";; | |
696 | esac | |
697 | if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then | |
698 | echo "Setting reserved flags = $sim_reserved_bits" 6>&1 | |
a35e91c3 | 699 | fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl |
a77aa7ec | 700 | ]) |
92f91d1f | 701 | AC_SUBST(sim_reserved_bits) |
a77aa7ec AC |
702 | |
703 | ||
704 | AC_DEFUN(SIM_AC_OPTION_SMP, | |
705 | [ | |
a35e91c3 | 706 | default_sim_smp="ifelse([$1],,5,[$1])" |
a77aa7ec | 707 | AC_ARG_ENABLE(sim-smp, |
a35e91c3 | 708 | [ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).], |
a77aa7ec AC |
709 | [case "${enableval}" in |
710 | yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";; | |
711 | no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";; | |
712 | *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";; | |
713 | esac | |
714 | if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then | |
715 | echo "Setting smp flags = $sim_smp" 6>&1 | |
a35e91c3 | 716 | fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}" |
a77aa7ec AC |
717 | if test x"$silent" != x"yes"; then |
718 | echo "Setting smp flags = $sim_smp" 6>&1 | |
719 | fi])dnl | |
f2de7dfd | 720 | ]) |
92f91d1f | 721 | AC_SUBST(sim_smp) |
80b7b3a5 | 722 | |
80b7b3a5 | 723 | |
a77aa7ec AC |
724 | AC_DEFUN(SIM_AC_OPTION_STDCALL, |
725 | [ | |
726 | AC_ARG_ENABLE(sim-stdcall, | |
727 | [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.], | |
728 | [case "${enableval}" in | |
729 | no) sim_stdcall="" ;; | |
730 | std*) sim_stdcall="-DWITH_STDCALL=1";; | |
731 | yes) sim_stdcall="-DWITH_STDCALL=1";; | |
732 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";; | |
733 | esac | |
734 | if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then | |
735 | echo "Setting function call flags = $sim_stdcall" 6>&1 | |
736 | fi],[sim_stdcall=""])dnl | |
a77aa7ec | 737 | ]) |
92f91d1f | 738 | AC_SUBST(sim_stdcall) |
a77aa7ec AC |
739 | |
740 | ||
a35e91c3 AC |
741 | AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN, |
742 | [ | |
743 | default_sim_xor_endian="ifelse([$1],,8,[$1])" | |
744 | AC_ARG_ENABLE(sim-xor-endian, | |
745 | [ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).], | |
a77aa7ec | 746 | [case "${enableval}" in |
a35e91c3 AC |
747 | yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";; |
748 | no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";; | |
749 | *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";; | |
a77aa7ec | 750 | esac |
a35e91c3 AC |
751 | if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then |
752 | echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 | |
753 | fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl | |
a35e91c3 | 754 | ]) |
92f91d1f | 755 | AC_SUBST(sim_xor_endian) |
a77aa7ec AC |
756 | |
757 | ||
f2de7dfd AC |
758 | dnl --enable-sim-warnings is for developers of the simulator. |
759 | dnl it enables extra GCC specific warnings. | |
760 | AC_DEFUN(SIM_AC_OPTION_WARNINGS, | |
761 | [ | |
762 | AC_ARG_ENABLE(sim-warnings, | |
88117054 | 763 | [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings], |
f2de7dfd AC |
764 | [case "${enableval}" in |
765 | yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";; | |
766 | no) sim_warnings="-w";; | |
767 | *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
768 | esac | |
769 | if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then | |
770 | echo "Setting warning flags = $sim_warnings" 6>&1 | |
771 | fi],[sim_warnings=""])dnl | |
772 | ]) | |
92f91d1f | 773 | AC_SUBST(sim_warnings) |
80b7b3a5 | 774 | |
80b7b3a5 | 775 | |
f2de7dfd AC |
776 | dnl Generate the Makefile in a target specific directory. |
777 | dnl Substitutions aren't performed on the file in AC_SUBST_FILE, | |
778 | dnl so this is a cover macro to tuck the details away of how we cope. | |
779 | dnl We cope by having autoconf generate two files and then merge them into | |
780 | dnl one afterwards. The two pieces of the common fragment are inserted into | |
781 | dnl the target's fragment at the appropriate points. | |
80b7b3a5 | 782 | |
f2de7dfd AC |
783 | AC_DEFUN(SIM_AC_OUTPUT, |
784 | [ | |
80b7b3a5 | 785 | AC_LINK_FILES($sim_link_files, $sim_link_links) |
88d5f8e8 DE |
786 | AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in, |
787 | [case "x$CONFIG_FILES" in | |
788 | xMakefile*) | |
f2de7dfd AC |
789 | echo "Merging Makefile.sim+Make-common.sim into Makefile ..." |
790 | rm -f Makesim1.tmp Makesim2.tmp Makefile | |
791 | sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp | |
792 | sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp | |
793 | sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \ | |
794 | -e '/^## COMMON_POST_/ r Makesim2.tmp' \ | |
795 | <Makefile.sim >Makefile | |
796 | rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp | |
797 | ;; | |
798 | esac | |
80b7b3a5 | 799 | case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac |
f2de7dfd AC |
800 | ]) |
801 | ]) | |
fc4198bb TT |
802 | |
803 | # This file is derived from `gettext.m4'. The difference is that the | |
804 | # included macros assume Cygnus-style source and build trees. | |
805 | ||
806 | # Macro to add for using GNU gettext. | |
807 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
808 | # | |
809 | # This file file be copied and used freely without restrictions. It can | |
810 | # be used in projects which are not available under the GNU Public License | |
811 | # but which still want to provide support for the GNU gettext functionality. | |
812 | # Please note that the actual code is *not* freely available. | |
813 | ||
814 | # serial 3 | |
815 | ||
816 | AC_DEFUN(CY_WITH_NLS, | |
817 | [AC_MSG_CHECKING([whether NLS is requested]) | |
818 | dnl Default is enabled NLS | |
819 | AC_ARG_ENABLE(nls, | |
820 | [ --disable-nls do not use Native Language Support], | |
821 | USE_NLS=$enableval, USE_NLS=yes) | |
822 | AC_MSG_RESULT($USE_NLS) | |
823 | AC_SUBST(USE_NLS) | |
824 | ||
825 | USE_INCLUDED_LIBINTL=no | |
826 | ||
827 | dnl If we use NLS figure out what method | |
828 | if test "$USE_NLS" = "yes"; then | |
829 | AC_DEFINE(ENABLE_NLS) | |
830 | AC_MSG_CHECKING([whether included gettext is requested]) | |
831 | AC_ARG_WITH(included-gettext, | |
832 | [ --with-included-gettext use the GNU gettext library included here], | |
833 | nls_cv_force_use_gnu_gettext=$withval, | |
834 | nls_cv_force_use_gnu_gettext=no) | |
835 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) | |
836 | ||
837 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" | |
838 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then | |
839 | dnl User does not insist on using GNU NLS library. Figure out what | |
840 | dnl to use. If gettext or catgets are available (in this order) we | |
841 | dnl use this. Else we have to fall back to GNU NLS library. | |
842 | dnl catgets is only used if permitted by option --with-catgets. | |
843 | nls_cv_header_intl= | |
844 | nls_cv_header_libgt= | |
845 | CATOBJEXT=NONE | |
846 | ||
847 | AC_CHECK_HEADER(libintl.h, | |
848 | [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, | |
849 | [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")], | |
850 | gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) | |
851 | ||
852 | if test "$gt_cv_func_gettext_libc" != "yes"; then | |
853 | AC_CHECK_LIB(intl, bindtextdomain, | |
854 | [AC_CACHE_CHECK([for gettext in libintl], | |
855 | gt_cv_func_gettext_libintl, | |
856 | [AC_TRY_LINK([], [return (int) gettext ("")], | |
857 | gt_cv_func_gettext_libintl=yes, | |
858 | gt_cv_func_gettext_libintl=no)])]) | |
859 | fi | |
860 | ||
861 | if test "$gt_cv_func_gettext_libc" = "yes" \ | |
862 | || test "$gt_cv_func_gettext_libintl" = "yes"; then | |
863 | AC_DEFINE(HAVE_GETTEXT) | |
864 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
865 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl | |
866 | if test "$MSGFMT" != "no"; then | |
867 | AC_CHECK_FUNCS(dcgettext) | |
868 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
869 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
870 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
871 | AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; | |
872 | return _nl_msg_cat_cntr], | |
873 | [CATOBJEXT=.gmo | |
874 | DATADIRNAME=share], | |
875 | [CATOBJEXT=.mo | |
876 | DATADIRNAME=lib]) | |
877 | INSTOBJEXT=.mo | |
878 | fi | |
879 | fi | |
880 | ]) | |
881 | ||
882 | dnl In the standard gettext, we would now check for catgets. | |
883 | dnl However, we never want to use catgets for our releases. | |
884 | ||
885 | if test "$CATOBJEXT" = "NONE"; then | |
886 | dnl Neither gettext nor catgets in included in the C library. | |
887 | dnl Fall back on GNU gettext library. | |
888 | nls_cv_use_gnu_gettext=yes | |
889 | fi | |
890 | fi | |
891 | ||
892 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | |
893 | dnl Mark actions used to generate GNU NLS library. | |
894 | INTLOBJS="\$(GETTOBJS)" | |
895 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
896 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) | |
897 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
898 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
899 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
900 | AC_SUBST(MSGFMT) | |
901 | USE_INCLUDED_LIBINTL=yes | |
902 | CATOBJEXT=.gmo | |
903 | INSTOBJEXT=.mo | |
904 | DATADIRNAME=share | |
905 | INTLDEPS='$(top_builddir)/../intl/libintl.a' | |
906 | INTLLIBS=$INTLDEPS | |
907 | LIBS=`echo $LIBS | sed -e 's/-lintl//'` | |
908 | nls_cv_header_intl=libintl.h | |
909 | nls_cv_header_libgt=libgettext.h | |
910 | fi | |
911 | ||
912 | dnl Test whether we really found GNU xgettext. | |
913 | if test "$XGETTEXT" != ":"; then | |
914 | dnl If it is no GNU xgettext we define it as : so that the | |
915 | dnl Makefiles still can work. | |
916 | if $XGETTEXT --omit-header /dev/null 2> /dev/null; then | |
917 | : ; | |
918 | else | |
919 | AC_MSG_RESULT( | |
920 | [found xgettext programs is not GNU xgettext; ignore it]) | |
921 | XGETTEXT=":" | |
922 | fi | |
923 | fi | |
924 | ||
925 | # We need to process the po/ directory. | |
926 | POSUB=po | |
927 | else | |
928 | DATADIRNAME=share | |
929 | nls_cv_header_intl=libintl.h | |
930 | nls_cv_header_libgt=libgettext.h | |
931 | fi | |
932 | ||
933 | # If this is used in GNU gettext we have to set USE_NLS to `yes' | |
934 | # because some of the sources are only built for this goal. | |
935 | if test "$PACKAGE" = gettext; then | |
936 | USE_NLS=yes | |
937 | USE_INCLUDED_LIBINTL=yes | |
938 | fi | |
939 | ||
940 | dnl These rules are solely for the distribution goal. While doing this | |
941 | dnl we only have to keep exactly one list of the available catalogs | |
942 | dnl in configure.in. | |
943 | for lang in $ALL_LINGUAS; do | |
944 | GMOFILES="$GMOFILES $lang.gmo" | |
945 | POFILES="$POFILES $lang.po" | |
946 | done | |
947 | ||
948 | dnl Make all variables we use known to autoconf. | |
949 | AC_SUBST(USE_INCLUDED_LIBINTL) | |
950 | AC_SUBST(CATALOGS) | |
951 | AC_SUBST(CATOBJEXT) | |
952 | AC_SUBST(DATADIRNAME) | |
953 | AC_SUBST(GMOFILES) | |
954 | AC_SUBST(INSTOBJEXT) | |
955 | AC_SUBST(INTLDEPS) | |
956 | AC_SUBST(INTLLIBS) | |
957 | AC_SUBST(INTLOBJS) | |
958 | AC_SUBST(POFILES) | |
959 | AC_SUBST(POSUB) | |
960 | ]) | |
961 | ||
962 | AC_DEFUN(CY_GNU_GETTEXT, | |
963 | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl | |
964 | AC_REQUIRE([AC_PROG_CC])dnl | |
965 | AC_REQUIRE([AC_PROG_RANLIB])dnl | |
966 | AC_REQUIRE([AC_ISC_POSIX])dnl | |
967 | AC_REQUIRE([AC_HEADER_STDC])dnl | |
968 | AC_REQUIRE([AC_C_CONST])dnl | |
969 | AC_REQUIRE([AC_C_INLINE])dnl | |
970 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | |
971 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | |
972 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | |
973 | AC_REQUIRE([AC_FUNC_MMAP])dnl | |
974 | ||
975 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ | |
976 | unistd.h values.h sys/param.h]) | |
977 | AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ | |
978 | __argz_count __argz_stringify __argz_next]) | |
979 | ||
980 | if test "${ac_cv_func_stpcpy+set}" != "set"; then | |
981 | AC_CHECK_FUNCS(stpcpy) | |
982 | fi | |
983 | if test "${ac_cv_func_stpcpy}" = "yes"; then | |
984 | AC_DEFINE(HAVE_STPCPY) | |
985 | fi | |
986 | ||
987 | AM_LC_MESSAGES | |
988 | CY_WITH_NLS | |
989 | ||
990 | if test "x$CATOBJEXT" != "x"; then | |
991 | if test "x$ALL_LINGUAS" = "x"; then | |
992 | LINGUAS= | |
993 | else | |
994 | AC_MSG_CHECKING(for catalogs to be installed) | |
995 | NEW_LINGUAS= | |
996 | for lang in ${LINGUAS=$ALL_LINGUAS}; do | |
997 | case "$ALL_LINGUAS" in | |
998 | *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; | |
999 | esac | |
1000 | done | |
1001 | LINGUAS=$NEW_LINGUAS | |
1002 | AC_MSG_RESULT($LINGUAS) | |
1003 | fi | |
1004 | ||
1005 | dnl Construct list of names of catalog files to be constructed. | |
1006 | if test -n "$LINGUAS"; then | |
1007 | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done | |
1008 | fi | |
1009 | fi | |
1010 | ||
1011 | dnl The reference to <locale.h> in the installed <libintl.h> file | |
1012 | dnl must be resolved because we cannot expect the users of this | |
1013 | dnl to define HAVE_LOCALE_H. | |
1014 | if test $ac_cv_header_locale_h = yes; then | |
1015 | INCLUDE_LOCALE_H="#include <locale.h>" | |
1016 | else | |
1017 | INCLUDE_LOCALE_H="\ | |
1018 | /* The system does not provide the header <locale.h>. Take care yourself. */" | |
1019 | fi | |
1020 | AC_SUBST(INCLUDE_LOCALE_H) | |
1021 | ||
1022 | dnl Determine which catalog format we have (if any is needed) | |
1023 | dnl For now we know about two different formats: | |
1024 | dnl Linux libc-5 and the normal X/Open format | |
1025 | if test -f $srcdir/po2tbl.sed.in; then | |
1026 | if test "$CATOBJEXT" = ".cat"; then | |
1027 | AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) | |
1028 | ||
1029 | dnl Transform the SED scripts while copying because some dumb SEDs | |
1030 | dnl cannot handle comments. | |
1031 | sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed | |
1032 | fi | |
1033 | dnl po2tbl.sed is always needed. | |
1034 | sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ | |
1035 | $srcdir/po2tbl.sed.in > po2tbl.sed | |
1036 | fi | |
1037 | ||
1038 | dnl In the intl/Makefile.in we have a special dependency which makes | |
1039 | dnl only sense for gettext. We comment this out for non-gettext | |
1040 | dnl packages. | |
1041 | if test "$PACKAGE" = "gettext"; then | |
1042 | GT_NO="#NO#" | |
1043 | GT_YES= | |
1044 | else | |
1045 | GT_NO= | |
1046 | GT_YES="#YES#" | |
1047 | fi | |
1048 | AC_SUBST(GT_NO) | |
1049 | AC_SUBST(GT_YES) | |
1050 | ||
1051 | MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" | |
1052 | AC_SUBST(MKINSTALLDIRS) | |
1053 | ||
1054 | dnl *** For now the libtool support in intl/Makefile is not for real. | |
1055 | l= | |
1056 | AC_SUBST(l) | |
1057 | ||
1058 | dnl Generate list of files to be processed by xgettext which will | |
1059 | dnl be included in po/Makefile. But only do this if the po directory | |
1060 | dnl exists in srcdir. | |
1061 | if test -d $srcdir/po; then | |
1062 | test -d po || mkdir po | |
1063 | if test "x$srcdir" != "x."; then | |
1064 | if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then | |
1065 | posrcprefix="$srcdir/" | |
1066 | else | |
1067 | posrcprefix="../$srcdir/" | |
1068 | fi | |
1069 | else | |
1070 | posrcprefix="../" | |
1071 | fi | |
1072 | rm -f po/POTFILES | |
1073 | sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ | |
1074 | < $srcdir/po/POTFILES.in > po/POTFILES | |
1075 | fi | |
1076 | ]) | |
1077 | ||
1078 | # Search path for a program which passes the given test. | |
1079 | # Ulrich Drepper <drepper@cygnus.com>, 1996. | |
1080 | # | |
1081 | # This file file be copied and used freely without restrictions. It can | |
1082 | # be used in projects which are not available under the GNU Public License | |
1083 | # but which still want to provide support for the GNU gettext functionality. | |
1084 | # Please note that the actual code is *not* freely available. | |
1085 | ||
1086 | # serial 1 | |
1087 | ||
1088 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | |
1089 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | |
1090 | AC_DEFUN(AM_PATH_PROG_WITH_TEST, | |
1091 | [# Extract the first word of "$2", so it can be a program name with args. | |
1092 | set dummy $2; ac_word=[$]2 | |
1093 | AC_MSG_CHECKING([for $ac_word]) | |
1094 | AC_CACHE_VAL(ac_cv_path_$1, | |
1095 | [case "[$]$1" in | |
1096 | /*) | |
1097 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | |
1098 | ;; | |
1099 | *) | |
1100 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
1101 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | |
1102 | test -z "$ac_dir" && ac_dir=. | |
1103 | if test -f $ac_dir/$ac_word; then | |
1104 | if [$3]; then | |
1105 | ac_cv_path_$1="$ac_dir/$ac_word" | |
1106 | break | |
1107 | fi | |
1108 | fi | |
1109 | done | |
1110 | IFS="$ac_save_ifs" | |
1111 | dnl If no 4th arg is given, leave the cache variable unset, | |
1112 | dnl so AC_PATH_PROGS will keep looking. | |
1113 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | |
1114 | ])dnl | |
1115 | ;; | |
1116 | esac])dnl | |
1117 | $1="$ac_cv_path_$1" | |
1118 | if test -n "[$]$1"; then | |
1119 | AC_MSG_RESULT([$]$1) | |
1120 | else | |
1121 | AC_MSG_RESULT(no) | |
1122 | fi | |
1123 | AC_SUBST($1)dnl | |
1124 | ]) | |
1125 | ||
1126 | # Check whether LC_MESSAGES is available in <locale.h>. | |
1127 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
1128 | # | |
1129 | # This file file be copied and used freely without restrictions. It can | |
1130 | # be used in projects which are not available under the GNU Public License | |
1131 | # but which still want to provide support for the GNU gettext functionality. | |
1132 | # Please note that the actual code is *not* freely available. | |
1133 | ||
1134 | # serial 1 | |
1135 | ||
1136 | AC_DEFUN(AM_LC_MESSAGES, | |
1137 | [if test $ac_cv_header_locale_h = yes; then | |
1138 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, | |
1139 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], | |
1140 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) | |
1141 | if test $am_cv_val_LC_MESSAGES = yes; then | |
1142 | AC_DEFINE(HAVE_LC_MESSAGES) | |
1143 | fi | |
1144 | fi]) | |
1145 |