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