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