]>
Commit | Line | Data |
---|---|---|
760b3e8b MF |
1 | dnl Copyright (C) 1997-2021 Free Software Foundation, Inc. |
2 | dnl | |
3 | dnl This program is free software; you can redistribute it and/or modify | |
4 | dnl it under the terms of the GNU General Public License as published by | |
5 | dnl the Free Software Foundation; either version 3 of the License, or | |
6 | dnl (at your option) any later version. | |
7 | dnl | |
8 | dnl This program is distributed in the hope that it will be useful, | |
9 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | dnl GNU General Public License for more details. | |
12 | dnl | |
13 | dnl You should have received a copy of the GNU General Public License | |
14 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | dnl | |
16 | dnl SIM_AC_COMMON invokes AC macros used by all simulators and by the common | |
17 | dnl directory. It is intended to be invoked before any target specific stuff. | |
18 | dnl SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile. | |
19 | dnl It is intended to be invoked last. | |
20 | dnl | |
21 | dnl See README-HACKING for more details. | |
22 | AC_DEFUN([SIM_AC_COMMON], | |
c2783492 MF |
23 | [dnl |
24 | SIM_AC_TOOLCHAIN | |
760b3e8b | 25 | AC_CONFIG_HEADERS([config.h:config.in]) |
760b3e8b MF |
26 | |
27 | # Some of the common include files depend on bfd.h, and bfd.h checks | |
28 | # that config.h is included first by testing that the PACKAGE macro | |
29 | # is defined. | |
30 | PACKAGE=sim | |
31 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ]) | |
32 | AC_SUBST(PACKAGE) | |
33 | ||
34 | # Dependency checking. | |
35 | ZW_CREATE_DEPDIR | |
36 | ZW_PROG_COMPILER_DEPENDENCIES([CC]) | |
37 | ||
760b3e8b MF |
38 | dnl We don't use gettext, but bfd does. So we do the appropriate checks |
39 | dnl to see if there are intl libraries we should link against. | |
40 | ALL_LINGUAS= | |
41 | ZW_GNU_GETTEXT_SISTER_DIR(../../intl) | |
42 | ||
760b3e8b MF |
43 | # Check for socket libraries |
44 | AC_CHECK_LIB(socket, bind) | |
45 | AC_CHECK_LIB(nsl, gethostbyname) | |
46 | ||
47 | # BFD conditionally uses zlib, so we must link it in if libbfd does, by | |
48 | # using the same condition. | |
49 | AM_ZLIB | |
50 | ||
51 | # BFD uses libdl when when plugins enabled. | |
52 | AC_PLUGINS | |
53 | AM_CONDITIONAL(PLUGINS, test "$plugins" = yes) | |
54 | LT_INIT([dlopen]) | |
55 | AC_SUBST(lt_cv_dlopen_libs) | |
56 | ||
57 | dnl Standard (and optional) simulator options. | |
58 | dnl Eventually all simulators will support these. | |
59 | dnl Do not add any here that cannot be supported by all simulators. | |
60 | dnl Do not add similar but different options to a particular simulator, | |
61 | dnl all shall eventually behave the same way. | |
62 | ||
63 | ||
64 | dnl We don't use automake, but we still want to support | |
65 | dnl --enable-maintainer-mode. | |
66 | AM_MAINTAINER_MODE | |
67 | ||
68 | ||
69 | dnl --enable-sim-debug is for developers of the simulator | |
70 | dnl the allowable values are work-in-progress | |
71 | AC_MSG_CHECKING([for sim debug setting]) | |
72 | sim_debug="0" | |
73 | AC_ARG_ENABLE(sim-debug, | |
74 | [AS_HELP_STRING([--enable-sim-debug=opts], | |
75 | [Enable debugging flags (for developers of the sim itself)])], | |
76 | [case "${enableval}" in | |
77 | yes) sim_debug="7";; | |
78 | no) sim_debug="0";; | |
79 | *) sim_debug="($enableval)";; | |
80 | esac])dnl | |
81 | if test "$sim_debug" != "0"; then | |
82 | AC_DEFINE_UNQUOTED([DEBUG], [$sim_debug], [Sim debug setting]) | |
83 | fi | |
84 | AC_DEFINE_UNQUOTED([WITH_DEBUG], [$sim_debug], [Sim debug setting]) | |
85 | AC_MSG_RESULT($sim_debug) | |
86 | ||
87 | ||
88 | dnl --enable-sim-stdio is for users of the simulator | |
89 | dnl It determines if IO from the program is routed through STDIO (buffered) | |
90 | AC_MSG_CHECKING([for sim stdio debug behavior]) | |
91 | sim_stdio="0" | |
92 | AC_ARG_ENABLE(sim-stdio, | |
93 | [AS_HELP_STRING([--enable-sim-stdio], | |
94 | [Specify whether to use stdio for console input/output])], | |
95 | [case "${enableval}" in | |
96 | yes) sim_stdio="DO_USE_STDIO";; | |
97 | no) sim_stdio="DONT_USE_STDIO";; | |
98 | *) AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);; | |
99 | esac])dnl | |
100 | AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O]) | |
101 | AC_MSG_RESULT($sim_stdio) | |
102 | ||
103 | ||
104 | dnl --enable-sim-trace is for users of the simulator | |
105 | dnl The argument is either a bitmask of things to enable [exactly what is | |
106 | dnl up to the simulator], or is a comma separated list of names of tracing | |
107 | dnl elements to enable. The latter is only supported on simulators that | |
108 | dnl use WITH_TRACE. Default to all tracing but internal debug. | |
109 | AC_MSG_CHECKING([for sim trace settings]) | |
110 | sim_trace="~TRACE_debug" | |
111 | AC_ARG_ENABLE(sim-trace, | |
112 | [AS_HELP_STRING([--enable-sim-trace=opts], | |
113 | [Enable tracing of simulated programs])], | |
114 | [case "${enableval}" in | |
115 | yes) sim_trace="-1";; | |
116 | no) sim_trace="0";; | |
117 | [[-0-9]]*) | |
118 | sim_trace="'(${enableval})'";; | |
119 | [[[:lower:]]]*) | |
120 | sim_trace="" | |
121 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
122 | if test x"$sim_trace" = x; then | |
123 | sim_trace="(TRACE_$x" | |
124 | else | |
125 | sim_trace="${sim_trace}|TRACE_$x" | |
126 | fi | |
127 | done | |
128 | sim_trace="$sim_trace)" ;; | |
129 | esac])dnl | |
130 | AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings]) | |
131 | AC_MSG_RESULT($sim_trace) | |
132 | ||
133 | ||
134 | dnl --enable-sim-profile | |
135 | dnl The argument is either a bitmask of things to enable [exactly what is | |
136 | dnl up to the simulator], or is a comma separated list of names of profiling | |
137 | dnl elements to enable. The latter is only supported on simulators that | |
138 | dnl use WITH_PROFILE. | |
139 | AC_MSG_CHECKING([for sim profile settings]) | |
140 | profile="1" | |
141 | sim_profile="-1" | |
142 | AC_ARG_ENABLE(sim-profile, | |
143 | [AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])], | |
144 | [case "${enableval}" in | |
145 | yes) profile="1" sim_profile="-1";; | |
146 | no) profile="0" sim_profile="0";; | |
147 | [[-0-9]]*) | |
148 | profile="(${enableval})" sim_profile="(${enableval})";; | |
149 | [[a-z]]*) | |
150 | profile="1" | |
151 | sim_profile="" | |
152 | for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | |
153 | if test x"$sim_profile" = x; then | |
154 | sim_profile="(PROFILE_$x" | |
155 | else | |
156 | sim_profile="${sim_profile}|PROFILE_$x" | |
157 | fi | |
158 | done | |
159 | sim_profile="$sim_profile)" ;; | |
160 | esac])dnl | |
161 | AC_DEFINE_UNQUOTED([PROFILE], [$profile], [Sim profile settings]) | |
162 | AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings]) | |
163 | AC_MSG_RESULT($sim_profile) | |
164 | ||
165 | ||
760b3e8b MF |
166 | SIM_AC_OPTION_INLINE |
167 | ||
168 | ACX_PKGVERSION([SIM]) | |
169 | ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/]) | |
170 | AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) | |
171 | AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) | |
172 | ||
760b3e8b MF |
173 | dnl Detect exe extension |
174 | AC_EXEEXT | |
175 | ]) dnl End of SIM_AC_COMMON |