Commit | Line | Data |
---|---|---|
9c082ca8 MF |
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 | # | |
306f4178 | 8 | # The simulator's configure.ac should look like: |
9c082ca8 MF |
9 | # |
10 | # dnl Process this file with autoconf to produce a configure script. | |
11 | # AC_PREREQ(2.64)dnl | |
12 | # AC_INIT(Makefile.in) | |
13 | # sinclude(../common/aclocal.m4) | |
14 | # | |
15 | # SIM_AC_COMMON | |
16 | # | |
17 | # ... target specific stuff ... | |
18 | # | |
19 | # SIM_AC_OUTPUT | |
20 | ||
21 | # Include global overrides and fixes for Autoconf. | |
22 | m4_include(../../config/override.m4) | |
23 | sinclude([../../config/zlib.m4]) | |
6bb11ab3 L |
24 | m4_include([../../config/plugins.m4]) |
25 | m4_include([../../libtool.m4]) | |
26 | m4_include([../../ltoptions.m4]) | |
27 | m4_include([../../ltsugar.m4]) | |
28 | m4_include([../../ltversion.m4]) | |
29 | m4_include([../../lt~obsolete.m4]) | |
db2e4d67 | 30 | sinclude([../../config/depstand.m4]) |
9c082ca8 MF |
31 | |
32 | AC_DEFUN([SIM_AC_COMMON], | |
33 | [ | |
34 | AC_REQUIRE([AC_PROG_CC]) | |
35 | # autoconf.info says this should be called right after AC_INIT. | |
36 | AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in) | |
37 | AC_CANONICAL_SYSTEM | |
2232061b | 38 | AC_USE_SYSTEM_EXTENSIONS |
0cb8d851 | 39 | AC_C_BIGENDIAN |
9c082ca8 MF |
40 | AC_ARG_PROGRAM |
41 | AC_PROG_INSTALL | |
42 | ||
43 | # Put a plausible default for CC_FOR_BUILD in Makefile. | |
44 | if test "x$cross_compiling" = "xno"; then | |
45 | CC_FOR_BUILD='$(CC)' | |
46 | else | |
47 | CC_FOR_BUILD=gcc | |
48 | fi | |
49 | AC_SUBST(CC_FOR_BUILD) | |
50 | ||
51 | AC_SUBST(CFLAGS) | |
52 | AC_SUBST(HDEFINES) | |
53 | AR=${AR-ar} | |
54 | AC_SUBST(AR) | |
55 | AC_PROG_RANLIB | |
56 | ||
5f3ef9d0 JB |
57 | # Some of the common include files depend on bfd.h, and bfd.h checks |
58 | # that config.h is included first by testing that the PACKAGE macro | |
59 | # is defined. | |
60 | PACKAGE=sim | |
61 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ]) | |
62 | AC_SUBST(PACKAGE) | |
63 | ||
db2e4d67 MF |
64 | # Dependency checking. |
65 | ZW_CREATE_DEPDIR | |
66 | ZW_PROG_COMPILER_DEPENDENCIES([CC]) | |
67 | ||
68 | # Check for the 'make' the user wants to use. | |
69 | AC_CHECK_PROGS(MAKE, make) | |
70 | MAKE_IS_GNU= | |
71 | case "`$MAKE --version 2>&1 | sed 1q`" in | |
72 | *GNU*) | |
73 | MAKE_IS_GNU=yes | |
74 | ;; | |
75 | esac | |
76 | AM_CONDITIONAL(GMAKE, test "$MAKE_IS_GNU" = yes) | |
77 | ||
9c082ca8 MF |
78 | dnl We don't use gettext, but bfd does. So we do the appropriate checks |
79 | dnl to see if there are intl libraries we should link against. | |
80 | ALL_LINGUAS= | |
81 | ZW_GNU_GETTEXT_SISTER_DIR(../../intl) | |
82 | ||
83 | # Check for common headers. | |
84 | # FIXME: Seems to me this can cause problems for i386-windows hosts. | |
85 | # At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*. | |
86 | AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h) | |
936df756 | 87 | AC_CHECK_HEADERS(sys/time.h sys/times.h sys/resource.h sys/mman.h) |
9c082ca8 MF |
88 | AC_CHECK_HEADERS(fcntl.h fpu_control.h) |
89 | AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h) | |
90 | AC_CHECK_FUNCS(getrusage time sigaction __setfpucw) | |
936df756 MF |
91 | AC_CHECK_FUNCS(mmap munmap lstat truncate ftruncate posix_fallocate) |
92 | AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino], | |
93 | [struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid], | |
94 | [struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size], | |
95 | [struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime], | |
96 | [struct stat.st_mtime], [struct stat.st_ctime]], [], [], | |
97 | [[#ifdef HAVE_SYS_TYPES_H | |
98 | #include <sys/types.h> | |
99 | #endif | |
100 | #ifdef HAVE_SYS_STAT_H | |
101 | #include <sys/stat.h> | |
102 | #endif]]) | |
103 | AC_CHECK_TYPES(socklen_t, [], [], | |
104 | [#include <sys/types.h> | |
105 | #include <sys/socket.h> | |
106 | ]) | |
9c082ca8 MF |
107 | |
108 | # Check for socket libraries | |
109 | AC_CHECK_LIB(socket, bind) | |
110 | AC_CHECK_LIB(nsl, gethostbyname) | |
111 | ||
112 | # BFD conditionally uses zlib, so we must link it in if libbfd does, by | |
113 | # using the same condition. | |
114 | AM_ZLIB | |
115 | ||
6bb11ab3 L |
116 | # BFD uses libdl when when plugins enabled. |
117 | AC_PLUGINS | |
118 | AM_CONDITIONAL(PLUGINS, test "$plugins" = yes) | |
119 | LT_INIT([dlopen]) | |
120 | AC_SUBST(lt_cv_dlopen_libs) | |
121 | ||
9c082ca8 MF |
122 | . ${srcdir}/../../bfd/configure.host |
123 | ||
124 | dnl Standard (and optional) simulator options. | |
125 | dnl Eventually all simulators will support these. | |
126 | dnl Do not add any here that cannot be supported by all simulators. | |
127 | dnl Do not add similar but different options to a particular simulator, | |
128 | dnl all shall eventually behave the same way. | |
129 | ||
130 | ||
131 | dnl We don't use automake, but we still want to support | |
132 | dnl --enable-maintainer-mode. | |
31e6ad7d | 133 | AM_MAINTAINER_MODE |
9c082ca8 MF |
134 | |
135 | ||
9c082ca8 MF |
136 | dnl --enable-sim-debug is for developers of the simulator |
137 | dnl the allowable values are work-in-progress | |
ce39bd38 MF |
138 | AC_MSG_CHECKING([for sim debug setting]) |
139 | sim_debug="0" | |
9c082ca8 | 140 | AC_ARG_ENABLE(sim-debug, |
8d0978fb MF |
141 | [AS_HELP_STRING([--enable-sim-debug=opts], |
142 | [Enable debugging flags (for developers of the sim itself)])], | |
9c082ca8 | 143 | [case "${enableval}" in |
ce39bd38 MF |
144 | yes) sim_debug="7";; |
145 | no) sim_debug="0";; | |
146 | *) sim_debug="($enableval)";; | |
147 | esac])dnl | |
148 | if test "$sim_debug" != "0"; then | |
149 | AC_DEFINE_UNQUOTED([DEBUG], [$sim_debug], [Sim debug setting]) | |
150 | fi | |
151 | AC_DEFINE_UNQUOTED([WITH_DEBUG], [$sim_debug], [Sim debug setting]) | |
152 | AC_MSG_RESULT($sim_debug) | |
9c082ca8 MF |
153 | |
154 | ||
155 | dnl --enable-sim-stdio is for users of the simulator | |
156 | dnl It determines if IO from the program is routed through STDIO (buffered) | |
ce39bd38 MF |
157 | AC_MSG_CHECKING([for sim stdio debug behavior]) |
158 | sim_stdio="0" | |
9c082ca8 | 159 | AC_ARG_ENABLE(sim-stdio, |
8d0978fb MF |
160 | [AS_HELP_STRING([--enable-sim-stdio], |
161 | [Specify whether to use stdio for console input/output])], | |
9c082ca8 | 162 | [case "${enableval}" in |
ce39bd38 MF |
163 | yes) sim_stdio="DO_USE_STDIO";; |
164 | no) sim_stdio="DONT_USE_STDIO";; | |
165 | *) AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);; | |
166 | esac])dnl | |
167 | AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O]) | |
168 | AC_MSG_RESULT($sim_stdio) | |
9c082ca8 MF |
169 | |
170 | ||
171 | dnl --enable-sim-trace is for users of the simulator | |
172 | dnl The argument is either a bitmask of things to enable [exactly what is | |
173 | dnl up to the simulator], or is a comma separated list of names of tracing | |
174 | dnl elements to enable. The latter is only supported on simulators that | |
ce39bd38 MF |
175 | dnl use WITH_TRACE. Default to all tracing but internal debug. |
176 | AC_MSG_CHECKING([for sim trace settings]) | |
177 | sim_trace="~TRACE_debug" | |
9c082ca8 | 178 | AC_ARG_ENABLE(sim-trace, |
8d0978fb MF |
179 | [AS_HELP_STRING([--enable-sim-trace=opts], |
180 | [Enable tracing of simulated programs])], | |
9c082ca8 | 181 | [case "${enableval}" in |
ce39bd38 MF |
182 | yes) sim_trace="-1";; |
183 | no) sim_trace="0";; | |
9c082ca8 | 184 | [[-0-9]]*) |
ce39bd38 | 185 | sim_trace="'(${enableval})'";; |
509deab2 | 186 | [[[:lower:]]]*) |
9c082ca8 MF |
187 | sim_trace="" |
188 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
189 | if test x"$sim_trace" = x; then | |
ce39bd38 | 190 | sim_trace="(TRACE_$x" |
9c082ca8 MF |
191 | else |
192 | sim_trace="${sim_trace}|TRACE_$x" | |
193 | fi | |
194 | done | |
ce39bd38 MF |
195 | sim_trace="$sim_trace)" ;; |
196 | esac])dnl | |
197 | AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings]) | |
198 | AC_MSG_RESULT($sim_trace) | |
9c082ca8 MF |
199 | |
200 | ||
201 | dnl --enable-sim-profile | |
202 | dnl The argument is either a bitmask of things to enable [exactly what is | |
203 | dnl up to the simulator], or is a comma separated list of names of profiling | |
204 | dnl elements to enable. The latter is only supported on simulators that | |
205 | dnl use WITH_PROFILE. | |
ce39bd38 MF |
206 | AC_MSG_CHECKING([for sim profile settings]) |
207 | profile="1" | |
208 | sim_profile="-1" | |
9c082ca8 | 209 | AC_ARG_ENABLE(sim-profile, |
8d0978fb | 210 | [AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])], |
9c082ca8 | 211 | [case "${enableval}" in |
ce39bd38 MF |
212 | yes) profile="1" sim_profile="-1";; |
213 | no) profile="0" sim_profile="0";; | |
9c082ca8 | 214 | [[-0-9]]*) |
ce39bd38 | 215 | profile="(${enableval})" sim_profile="(${enableval})";; |
9c082ca8 | 216 | [[a-z]]*) |
ce39bd38 | 217 | profile="1" |
9c082ca8 MF |
218 | sim_profile="" |
219 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
220 | if test x"$sim_profile" = x; then | |
ce39bd38 | 221 | sim_profile="(PROFILE_$x" |
9c082ca8 MF |
222 | else |
223 | sim_profile="${sim_profile}|PROFILE_$x" | |
224 | fi | |
225 | done | |
ce39bd38 MF |
226 | sim_profile="$sim_profile)" ;; |
227 | esac])dnl | |
228 | AC_DEFINE_UNQUOTED([PROFILE], [$profile], [Sim profile settings]) | |
229 | AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings]) | |
230 | AC_MSG_RESULT($sim_profile) | |
231 | ||
9c082ca8 | 232 | |
35656e95 | 233 | SIM_AC_OPTION_ASSERT |
16f7876d | 234 | SIM_AC_OPTION_ENVIRONMENT |
347fe5bb MF |
235 | SIM_AC_OPTION_INLINE |
236 | ||
bf12d44e | 237 | ACX_PKGVERSION([SIM]) |
9c082ca8 MF |
238 | ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/]) |
239 | AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) | |
240 | AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) | |
241 | ||
242 | dnl Types used by common code | |
243 | AC_TYPE_SIGNAL | |
244 | ||
245 | dnl Detect exe extension | |
246 | AC_EXEEXT | |
247 | ||
9c082ca8 MF |
248 | ]) dnl End of SIM_AC_COMMON |
249 | ||
250 | ||
251 | dnl Additional SIM options that can (optionally) be configured | |
252 | dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined. | |
253 | dnl Simulators that wish to use the relevant option specify the macro | |
306f4178 | 254 | dnl in the simulator specific configure.ac file between the SIM_AC_COMMON |
9c082ca8 MF |
255 | dnl and SIM_AC_OUTPUT lines. |
256 | ||
257 | ||
258 | dnl Specify the running environment. | |
306f4178 | 259 | dnl If the simulator invokes this in its configure.ac then without this option |
9c082ca8 MF |
260 | dnl the default is the user environment and all are runtime selectable. |
261 | dnl If the simulator doesn't invoke this, only the user environment is | |
262 | dnl supported. | |
263 | dnl ??? Until there is demonstrable value in doing something more complicated, | |
264 | dnl let's not. | |
265 | AC_DEFUN([SIM_AC_OPTION_ENVIRONMENT], | |
266 | [ | |
ce39bd38 MF |
267 | AC_MSG_CHECKING([default sim environment setting]) |
268 | sim_environment="ALL_ENVIRONMENT" | |
9c082ca8 | 269 | AC_ARG_ENABLE(sim-environment, |
8d0978fb MF |
270 | [AS_HELP_STRING([--enable-sim-environment=environment], |
271 | [Specify mixed, user, virtual or operating environment])], | |
9c082ca8 | 272 | [case "${enableval}" in |
ce39bd38 MF |
273 | all | ALL) sim_environment="ALL_ENVIRONMENT";; |
274 | user | USER) sim_environment="USER_ENVIRONMENT";; | |
275 | virtual | VIRTUAL) sim_environment="VIRTUAL_ENVIRONMENT";; | |
276 | operating | OPERATING) sim_environment="OPERATING_ENVIRONMENT";; | |
277 | *) AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-environment]);; | |
278 | esac])dnl | |
279 | AC_DEFINE_UNQUOTED([WITH_ENVIRONMENT], [$sim_environment], [Sim default environment]) | |
280 | AC_MSG_RESULT($sim_environment) | |
9c082ca8 | 281 | ]) |
9c082ca8 MF |
282 | |
283 | ||
284 | dnl Specify the alignment restrictions of the target architecture. | |
285 | dnl Without this option all possible alignment restrictions are accommodated. | |
286 | dnl arg[1] is hardwired target alignment | |
287 | dnl arg[2] is default target alignment | |
288 | AC_DEFUN([SIM_AC_OPTION_ALIGNMENT], | |
289 | wire_alignment="[$1]" | |
290 | default_alignment="[$2]" | |
291 | [ | |
292 | AC_ARG_ENABLE(sim-alignment, | |
8d0978fb MF |
293 | [AS_HELP_STRING([--enable-sim-alignment=align], |
294 | [Specify strict, nonstrict or forced alignment of memory accesses])], | |
9c082ca8 MF |
295 | [case "${enableval}" in |
296 | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; | |
297 | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; | |
298 | forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";; | |
299 | yes) if test x"$wire_alignment" != x; then | |
300 | sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" | |
301 | else | |
302 | if test x"$default_alignment" != x; then | |
303 | sim_alignment="-DWITH_ALIGNMENT=${default_alignment}" | |
304 | else | |
305 | echo "No hard-wired alignment for target $target" 1>&6 | |
306 | sim_alignment="-DWITH_ALIGNMENT=0" | |
307 | fi | |
308 | fi;; | |
309 | no) if test x"$default_alignment" != x; then | |
310 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" | |
311 | else | |
312 | if test x"$wire_alignment" != x; then | |
313 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}" | |
314 | else | |
315 | echo "No default alignment for target $target" 1>&6 | |
316 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0" | |
317 | fi | |
318 | fi;; | |
319 | *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";; | |
320 | esac | |
321 | if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then | |
322 | echo "Setting alignment flags = $sim_alignment" 6>&1 | |
323 | fi], | |
324 | [if test x"$default_alignment" != x; then | |
325 | sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" | |
326 | else | |
327 | if test x"$wire_alignment" != x; then | |
328 | sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" | |
329 | else | |
330 | sim_alignment= | |
331 | fi | |
332 | fi])dnl | |
333 | ])dnl | |
334 | AC_SUBST(sim_alignment) | |
335 | ||
336 | ||
337 | dnl Conditionally compile in assertion statements. | |
338 | AC_DEFUN([SIM_AC_OPTION_ASSERT], | |
339 | [ | |
ce39bd38 MF |
340 | AC_MSG_CHECKING([whether to enable sim asserts]) |
341 | sim_assert="1" | |
9c082ca8 | 342 | AC_ARG_ENABLE(sim-assert, |
8d0978fb MF |
343 | [AS_HELP_STRING([--enable-sim-assert], |
344 | [Specify whether to perform random assertions])], | |
9c082ca8 | 345 | [case "${enableval}" in |
ce39bd38 MF |
346 | yes) sim_assert="1";; |
347 | no) sim_assert="0";; | |
348 | *) AC_MSG_ERROR([--enable-sim-assert does not take a value]);; | |
349 | esac])dnl | |
350 | AC_DEFINE_UNQUOTED([WITH_ASSERT], [$sim_assert], [Sim assert settings]) | |
351 | AC_MSG_RESULT($sim_assert) | |
9c082ca8 | 352 | ]) |
9c082ca8 MF |
353 | |
354 | ||
355 | ||
356 | dnl --enable-sim-bitsize is for developers of the simulator | |
357 | dnl It specifies the number of BITS in the target. | |
358 | dnl arg[1] is the number of bits in a word | |
359 | dnl arg[2] is the number assigned to the most significant bit | |
360 | dnl arg[3] is the number of bits in an address | |
361 | dnl arg[4] is the number of bits in an OpenFirmware cell. | |
362 | dnl FIXME: this information should be obtained from bfd/archure | |
363 | AC_DEFUN([SIM_AC_OPTION_BITSIZE], | |
364 | wire_word_bitsize="[$1]" | |
365 | wire_word_msb="[$2]" | |
366 | wire_address_bitsize="[$3]" | |
367 | wire_cell_bitsize="[$4]" | |
368 | [AC_ARG_ENABLE(sim-bitsize, | |
8d0978fb | 369 | [AS_HELP_STRING([--enable-sim-bitsize=N], [Specify target bitsize (32 or 64)])], |
9c082ca8 MF |
370 | [sim_bitsize= |
371 | case "${enableval}" in | |
372 | 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";; | |
373 | 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";; | |
374 | 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; | |
375 | 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; | |
376 | 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then | |
377 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31" | |
378 | else | |
379 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0" | |
380 | fi ;; | |
381 | 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then | |
382 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63" | |
383 | else | |
384 | sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0" | |
385 | fi ;; | |
386 | *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;; | |
387 | esac | |
388 | # address bitsize | |
389 | tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"` | |
390 | case x"${tmp}" in | |
391 | x ) ;; | |
392 | x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;; | |
393 | x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;; | |
394 | * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;; | |
395 | esac | |
396 | # cell bitsize | |
397 | tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"` | |
398 | case x"${tmp}" in | |
399 | x ) ;; | |
400 | x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;; | |
401 | x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;; | |
402 | * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;; | |
403 | esac | |
404 | if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then | |
405 | echo "Setting bitsize flags = $sim_bitsize" 6>&1 | |
406 | fi], | |
407 | [sim_bitsize="" | |
408 | if test x"$wire_word_bitsize" != x; then | |
409 | sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize" | |
410 | fi | |
411 | if test x"$wire_word_msb" != x; then | |
412 | sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb" | |
413 | fi | |
414 | if test x"$wire_address_bitsize" != x; then | |
415 | sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize" | |
416 | fi | |
417 | if test x"$wire_cell_bitsize" != x; then | |
418 | sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize" | |
419 | fi])dnl | |
420 | ]) | |
421 | AC_SUBST(sim_bitsize) | |
422 | ||
423 | ||
424 | ||
425 | dnl --enable-sim-endian={yes,no,big,little} is for simulators | |
426 | dnl that support both big and little endian targets. | |
427 | dnl arg[1] is hardwired target endianness. | |
428 | dnl arg[2] is default target endianness. | |
429 | AC_DEFUN([SIM_AC_OPTION_ENDIAN], | |
430 | [ | |
431 | wire_endian="[$1]" | |
432 | default_endian="[$2]" | |
433 | AC_ARG_ENABLE(sim-endian, | |
8d0978fb MF |
434 | [AS_HELP_STRING([--enable-sim-endian=endian], |
435 | [Specify target byte endian orientation])], | |
9c082ca8 | 436 | [case "${enableval}" in |
1ac72f06 MF |
437 | b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG";; |
438 | l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE";; | |
9c082ca8 | 439 | yes) if test x"$wire_endian" != x; then |
1ac72f06 | 440 | sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}" |
9c082ca8 | 441 | else |
1ac72f06 MF |
442 | if test x"$default_endian" != x; then |
443 | sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}" | |
9c082ca8 MF |
444 | else |
445 | echo "No hard-wired endian for target $target" 1>&6 | |
1ac72f06 | 446 | sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN" |
9c082ca8 MF |
447 | fi |
448 | fi;; | |
449 | no) if test x"$default_endian" != x; then | |
1ac72f06 | 450 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}" |
9c082ca8 MF |
451 | else |
452 | if test x"$wire_endian" != x; then | |
1ac72f06 | 453 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}" |
9c082ca8 MF |
454 | else |
455 | echo "No default endian for target $target" 1>&6 | |
1ac72f06 | 456 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN" |
9c082ca8 MF |
457 | fi |
458 | fi;; | |
459 | *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";; | |
460 | esac | |
461 | if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then | |
462 | echo "Setting endian flags = $sim_endian" 6>&1 | |
463 | fi], | |
464 | [if test x"$default_endian" != x; then | |
1ac72f06 | 465 | sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}" |
9c082ca8 MF |
466 | else |
467 | if test x"$wire_endian" != x; then | |
1ac72f06 | 468 | sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}" |
9c082ca8 MF |
469 | else |
470 | sim_endian= | |
471 | fi | |
472 | fi])dnl | |
473 | ]) | |
474 | AC_SUBST(sim_endian) | |
475 | ||
476 | ||
9c082ca8 MF |
477 | dnl --enable-sim-float is for developers of the simulator |
478 | dnl It specifies the presence of hardware floating point | |
479 | dnl And optionally the bitsize of the floating point register. | |
480 | dnl arg[1] specifies the presence (or absence) of floating point hardware | |
481 | dnl arg[2] specifies the number of bits in a floating point register | |
482 | AC_DEFUN([SIM_AC_OPTION_FLOAT], | |
483 | [ | |
484 | default_sim_float="[$1]" | |
485 | default_sim_float_bitsize="[$2]" | |
486 | AC_ARG_ENABLE(sim-float, | |
8d0978fb MF |
487 | [AS_HELP_STRING([--enable-sim-float], |
488 | [Specify that the target processor has floating point hardware])], | |
9c082ca8 MF |
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, | |
8d0978fb MF |
516 | [AS_HELP_STRING([--enable-sim-scache=size], |
517 | [Specify simulator execution cache size])], | |
9c082ca8 MF |
518 | [case "${enableval}" in |
519 | yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";; | |
520 | no) sim_scache="-DWITH_SCACHE=0" ;; | |
521 | [[0-9]]*) sim_scache="-DWITH_SCACHE=${enableval}";; | |
522 | *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache"); | |
523 | sim_scache="";; | |
524 | esac | |
525 | if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then | |
526 | echo "Setting scache size = $sim_scache" 6>&1 | |
527 | fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"]) | |
528 | ]) | |
529 | AC_SUBST(sim_scache) | |
530 | ||
531 | ||
532 | dnl The argument is the default model if none is specified. | |
533 | AC_DEFUN([SIM_AC_OPTION_DEFAULT_MODEL], | |
534 | [ | |
535 | default_sim_default_model="ifelse([$1],,0,[$1])" | |
536 | AC_ARG_ENABLE(sim-default-model, | |
8d0978fb MF |
537 | [AS_HELP_STRING([--enable-sim-default-model=model], |
538 | [Specify default model to simulate])], | |
9c082ca8 MF |
539 | [case "${enableval}" in |
540 | yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");; | |
541 | *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";; | |
542 | esac | |
543 | if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then | |
544 | echo "Setting default model = $sim_default_model" 6>&1 | |
545 | fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"]) | |
546 | ]) | |
547 | AC_SUBST(sim_default_model) | |
548 | ||
549 | ||
550 | dnl --enable-sim-hardware is for users of the simulator | |
64dd13df | 551 | dnl arg[1] Enable sim-hw by default? ("yes" or "no") |
9c082ca8 MF |
552 | dnl arg[2] is a space separated list of devices that override the defaults |
553 | dnl arg[3] is a space separated list of extra target specific devices. | |
554 | AC_DEFUN([SIM_AC_OPTION_HARDWARE], | |
555 | [ | |
9c082ca8 MF |
556 | if test "[$2]"; then |
557 | hardware="[$2]" | |
558 | else | |
559 | hardware="cfi core pal glue" | |
560 | fi | |
561 | hardware="$hardware [$3]" | |
1517bd27 | 562 | |
9c082ca8 MF |
563 | sim_hw_cflags="-DWITH_HW=1" |
564 | sim_hw="$hardware" | |
565 | sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`" | |
1517bd27 | 566 | |
9c082ca8 | 567 | AC_ARG_ENABLE(sim-hardware, |
1517bd27 | 568 | [AS_HELP_STRING([--enable-sim-hardware=LIST], |
30452bbe MF |
569 | [Specify the hardware to be included in the build.])], |
570 | ,[enable_sim_hardware="[$1]"]) | |
1517bd27 | 571 | case ${enable_sim_hardware} in |
64dd13df MF |
572 | yes|no) ;; |
573 | ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";; | |
574 | *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";; | |
575 | *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';; | |
9c082ca8 | 576 | esac |
1517bd27 | 577 | |
64dd13df | 578 | if test "$enable_sim_hardware" = no; then |
9c082ca8 MF |
579 | sim_hw_objs= |
580 | sim_hw_cflags="-DWITH_HW=0" | |
581 | sim_hw= | |
582 | else | |
583 | sim_hw_cflags="-DWITH_HW=1" | |
584 | # remove duplicates | |
585 | sim_hw="" | |
586 | sim_hw_objs="\$(SIM_COMMON_HW_OBJS)" | |
587 | for i in $hardware ; do | |
588 | case " $sim_hw " in | |
589 | *" $i "*) ;; | |
590 | *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";; | |
591 | esac | |
592 | done | |
3fd38161 | 593 | # mingw does not support sockser |
3fd38161 JS |
594 | case ${host} in |
595 | *mingw*) ;; | |
49cd1634 MF |
596 | *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device |
597 | # that you instatiate. Instead, other code will call into it directly. | |
598 | # At some point, we should convert it over. | |
599 | sim_hw_objs="$sim_hw_objs dv-sockser.o" | |
3fd38161 JS |
600 | AC_DEFINE_UNQUOTED( |
601 | [HAVE_DV_SOCKSER], 1, [Define if dv-sockser is usable.]) | |
602 | ;; | |
603 | esac | |
1517bd27 MF |
604 | if test x"$silent" != x"yes"; then |
605 | echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs" | |
3fd38161 | 606 | fi |
1517bd27 MF |
607 | dnl Some devices require extra libraries. |
608 | case " $hardware " in | |
609 | *" cfi "*) AC_CHECK_LIB(m, log2);; | |
610 | esac | |
9c082ca8 | 611 | fi |
9c082ca8 MF |
612 | ]) |
613 | AC_SUBST(sim_hw_cflags) | |
614 | AC_SUBST(sim_hw_objs) | |
615 | AC_SUBST(sim_hw) | |
616 | ||
617 | ||
618 | dnl --enable-sim-inline is for users that wish to ramp up the simulator's | |
619 | dnl performance by inlining functions. | |
347fe5bb | 620 | dnl Default sims to no inlining. |
9c082ca8 MF |
621 | AC_DEFUN([SIM_AC_OPTION_INLINE], |
622 | [ | |
347fe5bb | 623 | sim_inline="-DDEFAULT_INLINE=m4_ifblank([$1],[0],[$1])" |
9c082ca8 | 624 | AC_ARG_ENABLE(sim-inline, |
8d0978fb MF |
625 | [AS_HELP_STRING([--enable-sim-inline=inlines], |
626 | [Specify which functions should be inlined])], | |
9c082ca8 MF |
627 | [sim_inline="" |
628 | case "$enableval" in | |
629 | no) sim_inline="-DDEFAULT_INLINE=0";; | |
630 | 0) sim_inline="-DDEFAULT_INLINE=0";; | |
631 | yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";; | |
632 | 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";; | |
633 | *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
634 | new_flag="" | |
635 | case "$x" in | |
636 | *_INLINE=*) new_flag="-D$x";; | |
637 | *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; | |
638 | *_INLINE) new_flag="-D$x=ALL_C_INLINE";; | |
639 | *) new_flag="-D$x""_INLINE=ALL_C_INLINE";; | |
640 | esac | |
641 | if test x"$sim_inline" = x""; then | |
642 | sim_inline="$new_flag" | |
643 | else | |
644 | sim_inline="$sim_inline $new_flag" | |
645 | fi | |
646 | done;; | |
647 | esac | |
648 | if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then | |
649 | echo "Setting inline flags = $sim_inline" 6>&1 | |
9c082ca8 MF |
650 | fi])dnl |
651 | ]) | |
652 | AC_SUBST(sim_inline) | |
653 | ||
654 | ||
9c082ca8 MF |
655 | AC_DEFUN([SIM_AC_OPTION_RESERVED_BITS], |
656 | [ | |
657 | default_sim_reserved_bits="ifelse([$1],,1,[$1])" | |
658 | AC_ARG_ENABLE(sim-reserved-bits, | |
8d0978fb MF |
659 | [AS_HELP_STRING([--enable-sim-reserved-bits], |
660 | [Specify whether to check reserved bits in instruction])], | |
9c082ca8 MF |
661 | [case "${enableval}" in |
662 | yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";; | |
663 | no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";; | |
664 | *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";; | |
665 | esac | |
666 | if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then | |
667 | echo "Setting reserved flags = $sim_reserved_bits" 6>&1 | |
668 | fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl | |
669 | ]) | |
670 | AC_SUBST(sim_reserved_bits) | |
671 | ||
672 | ||
673 | AC_DEFUN([SIM_AC_OPTION_SMP], | |
674 | [ | |
ce39bd38 | 675 | AC_MSG_CHECKING([number of sim cpus to support]) |
9c082ca8 | 676 | default_sim_smp="ifelse([$1],,5,[$1])" |
ce39bd38 | 677 | sim_smp="$default_sim_smp"" |
9c082ca8 | 678 | AC_ARG_ENABLE(sim-smp, |
8d0978fb MF |
679 | [AS_HELP_STRING([--enable-sim-smp=n], |
680 | [Specify number of processors to configure for (default ${default_sim_smp})])], | |
9c082ca8 | 681 | [case "${enableval}" in |
ce39bd38 MF |
682 | yes) sim_smp="5";; |
683 | no) sim_smp="0";; | |
684 | *) sim_smp="$enableval";; | |
685 | esac])dnl | |
686 | sim_igen_smp="-N ${sim_smp}" | |
687 | AC_DEFINE_UNQUOTED([WITH_SMP], [$sim_smp], [Sim SMP settings]) | |
688 | AC_MSG_RESULT($sim_smp) | |
9c082ca8 | 689 | ]) |
9c082ca8 MF |
690 | |
691 | ||
9c082ca8 MF |
692 | AC_DEFUN([SIM_AC_OPTION_XOR_ENDIAN], |
693 | [ | |
ce39bd38 | 694 | AC_MSG_CHECKING([for xor endian support]) |
9c082ca8 | 695 | default_sim_xor_endian="ifelse([$1],,8,[$1])" |
ce39bd38 | 696 | sim_xor_endian="$default_sim_xor_endian" |
9c082ca8 | 697 | AC_ARG_ENABLE(sim-xor-endian, |
8d0978fb MF |
698 | [AS_HELP_STRING([--enable-sim-xor-endian=n], |
699 | [Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian})])], | |
9c082ca8 | 700 | [case "${enableval}" in |
ce39bd38 MF |
701 | yes) sim_xor_endian="8";; |
702 | no) sim_xor_endian="0";; | |
703 | *) sim_xor_endian="$enableval";; | |
704 | esac])dnl | |
705 | AC_DEFINE_UNQUOTED([WITH_XOR_ENDIAN], [$sim_xor_endian], [Sim XOR endian settings]) | |
706 | AC_MSG_RESULT($sim_smp) | |
9c082ca8 | 707 | ]) |
9c082ca8 MF |
708 | |
709 | ||
710 | dnl --enable-build-warnings is for developers of the simulator. | |
711 | dnl it enables extra GCC specific warnings. | |
712 | AC_DEFUN([SIM_AC_OPTION_WARNINGS], | |
713 | [ | |
ac0aacdf MF |
714 | AC_ARG_ENABLE(werror, |
715 | AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]), | |
716 | [case "${enableval}" in | |
717 | yes | y) ERROR_ON_WARNING="yes" ;; | |
718 | no | n) ERROR_ON_WARNING="no" ;; | |
719 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; | |
720 | esac]) | |
721 | ||
722 | # Enable -Werror by default when using gcc | |
723 | if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then | |
724 | ERROR_ON_WARNING=yes | |
725 | fi | |
726 | ||
727 | WERROR_CFLAGS="" | |
728 | if test "${ERROR_ON_WARNING}" = yes ; then | |
729 | # NOTE: Disabled in the sim dir due to most sims generating warnings. | |
730 | # WERROR_CFLAGS="-Werror" | |
731 | true | |
9c082ca8 | 732 | fi |
ac0aacdf | 733 | |
ac0aacdf | 734 | build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ |
1a8a700e | 735 | -Wpointer-sign \ |
ac0aacdf | 736 | -Wno-unused -Wunused-value -Wunused-function \ |
1a8a700e MF |
737 | -Wno-switch -Wno-char-subscripts -Wmissing-prototypes |
738 | -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \ | |
739 | -Wold-style-declaration -Wold-style-definition" | |
ac0aacdf MF |
740 | |
741 | # Enable -Wno-format by default when using gcc on mingw since many | |
742 | # GCC versions complain about %I64. | |
743 | case "${host}" in | |
744 | *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;; | |
d3685d60 | 745 | *) build_warnings="$build_warnings -Wformat-nonliteral" ;; |
ac0aacdf MF |
746 | esac |
747 | ||
9c082ca8 | 748 | AC_ARG_ENABLE(build-warnings, |
ac0aacdf | 749 | AS_HELP_STRING([--enable-build-warnings], [enable build-time compiler warnings if gcc is used]), |
9c082ca8 MF |
750 | [case "${enableval}" in |
751 | yes) ;; | |
752 | no) build_warnings="-w";; | |
753 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
754 | build_warnings="${build_warnings} ${t}";; | |
755 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
756 | build_warnings="${t} ${build_warnings}";; | |
757 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
758 | esac | |
759 | if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
760 | echo "Setting compiler warning flags = $build_warnings" 6>&1 | |
761 | fi])dnl | |
762 | AC_ARG_ENABLE(sim-build-warnings, | |
ac0aacdf | 763 | AS_HELP_STRING([--enable-sim-build-warnings], [enable SIM specific build-time compiler warnings if gcc is used]), |
9c082ca8 MF |
764 | [case "${enableval}" in |
765 | yes) ;; | |
766 | no) build_warnings="-w";; | |
767 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
768 | build_warnings="${build_warnings} ${t}";; | |
769 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
770 | build_warnings="${t} ${build_warnings}";; | |
771 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
772 | esac | |
773 | if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
774 | echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 | |
775 | fi])dnl | |
776 | WARN_CFLAGS="" | |
9c082ca8 MF |
777 | if test "x${build_warnings}" != x -a "x$GCC" = xyes |
778 | then | |
779 | AC_MSG_CHECKING(compiler warning flags) | |
780 | # Separate out the -Werror flag as some files just cannot be | |
781 | # compiled with it enabled. | |
782 | for w in ${build_warnings}; do | |
783 | case $w in | |
784 | -Werr*) WERROR_CFLAGS=-Werror ;; | |
785 | *) # Check that GCC accepts it | |
786 | saved_CFLAGS="$CFLAGS" | |
787 | CFLAGS="$CFLAGS $w" | |
788 | AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) | |
789 | CFLAGS="$saved_CFLAGS" | |
790 | esac | |
791 | done | |
ac0aacdf | 792 | AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS}) |
9c082ca8 MF |
793 | fi |
794 | ]) | |
795 | AC_SUBST(WARN_CFLAGS) | |
796 | AC_SUBST(WERROR_CFLAGS) | |
797 | ||
798 | ||
799 | dnl Generate the Makefile in a target specific directory. | |
800 | dnl Substitutions aren't performed on the file in AC_SUBST_FILE, | |
801 | dnl so this is a cover macro to tuck the details away of how we cope. | |
802 | dnl We cope by having autoconf generate two files and then merge them into | |
803 | dnl one afterwards. The two pieces of the common fragment are inserted into | |
804 | dnl the target's fragment at the appropriate points. | |
805 | ||
806 | AC_DEFUN([SIM_AC_OUTPUT], | |
807 | [ | |
9c082ca8 MF |
808 | dnl Make @cgen_breaks@ non-null only if the sim uses CGEN. |
809 | cgen_breaks="" | |
810 | if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then | |
811 | cgen_breaks="break cgen_rtx_error"; | |
812 | fi | |
813 | AC_SUBST(cgen_breaks) | |
814 | AC_CONFIG_FILES(Makefile.sim:Makefile.in) | |
815 | AC_CONFIG_FILES(Make-common.sim:../common/Make-common.in) | |
816 | AC_CONFIG_FILES(.gdbinit:../common/gdbinit.in) | |
817 | AC_CONFIG_COMMANDS([Makefile], | |
818 | [echo "Merging Makefile.sim+Make-common.sim into Makefile ..." | |
819 | rm -f Makesim1.tmp Makesim2.tmp Makefile | |
820 | sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp | |
821 | sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp | |
822 | sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \ | |
823 | -e '/^## COMMON_POST_/ r Makesim2.tmp' \ | |
824 | <Makefile.sim >Makefile | |
825 | rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp | |
826 | ]) | |
827 | AC_CONFIG_COMMANDS([stamp-h], [echo > stamp-h]) | |
828 | AC_OUTPUT | |
829 | ]) | |
830 | ||
831 | sinclude(../../config/gettext-sister.m4) | |
832 | sinclude(../../config/acx.m4) | |
833 | ||
834 | dnl --enable-cgen-maint support | |
835 | AC_DEFUN([SIM_AC_OPTION_CGEN_MAINT], | |
836 | [ | |
837 | cgen_maint=no | |
838 | dnl Default is to use one in build tree. | |
839 | cgen=guile | |
840 | cgendir='$(srcdir)/../../cgen' | |
841 | dnl Having --enable-maintainer-mode take arguments is another way to go. | |
842 | dnl ??? One can argue --with is more appropriate if one wants to specify | |
843 | dnl a directory name, but what we're doing here is an enable/disable kind | |
844 | dnl of thing and specifying both --enable and --with is klunky. | |
845 | dnl If you reeely want this to be --with, go ahead and change it. | |
846 | AC_ARG_ENABLE(cgen-maint, | |
8d0978fb | 847 | [AS_HELP_STRING([--enable-cgen-maint[=DIR]], [build cgen generated files])], |
9c082ca8 MF |
848 | [case "${enableval}" in |
849 | yes) cgen_maint=yes ;; | |
850 | no) cgen_maint=no ;; | |
851 | *) | |
852 | # argument is cgen install directory (not implemented yet). | |
853 | # Having a `share' directory might be more appropriate for the .scm, | |
854 | # .cpu, etc. files. | |
855 | cgendir=${cgen_maint}/lib/cgen | |
856 | cgen=guile | |
857 | ;; | |
858 | esac])dnl | |
859 | dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno) | |
860 | if test x${cgen_maint} != xno ; then | |
861 | CGEN_MAINT='' | |
862 | else | |
863 | CGEN_MAINT='#' | |
864 | fi | |
865 | AC_SUBST(CGEN_MAINT) | |
866 | AC_SUBST(cgendir) | |
867 | AC_SUBST(cgen) | |
868 | ]) |