1 |
24 |
jeremybenn |
# This file contains common code used by all simulators.
|
2 |
|
|
#
|
3 |
|
|
# common.m4 invokes AC macros used by all simulators and by the common
|
4 |
|
|
# directory. It is intended to be included before any target specific
|
5 |
|
|
# stuff. SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate
|
6 |
|
|
# the Makefile. It is intended to be invoked last.
|
7 |
|
|
#
|
8 |
|
|
# The simulator's configure.in should look like:
|
9 |
|
|
#
|
10 |
|
|
# dnl Process this file with autoconf to produce a configure script.
|
11 |
|
|
# AC_PREREQ(2.5)dnl
|
12 |
|
|
# AC_INIT(Makefile.in)
|
13 |
|
|
# AC_CONFIG_HEADER(config.h:config.in)
|
14 |
|
|
#
|
15 |
|
|
# sinclude(../common/aclocal.m4)
|
16 |
|
|
# sinclude(../common/common.m4)
|
17 |
|
|
#
|
18 |
|
|
# ... target specific stuff ...
|
19 |
|
|
|
20 |
|
|
AC_CANONICAL_SYSTEM
|
21 |
|
|
AC_ARG_PROGRAM
|
22 |
|
|
AC_PROG_CC
|
23 |
|
|
AC_PROG_INSTALL
|
24 |
|
|
|
25 |
|
|
# Put a plausible default for CC_FOR_BUILD in Makefile.
|
26 |
|
|
if test "x$cross_compiling" = "xno"; then
|
27 |
|
|
CC_FOR_BUILD='$(CC)'
|
28 |
|
|
else
|
29 |
|
|
CC_FOR_BUILD=gcc
|
30 |
|
|
fi
|
31 |
|
|
AC_SUBST(CC_FOR_BUILD)
|
32 |
|
|
|
33 |
|
|
AC_SUBST(CFLAGS)
|
34 |
|
|
AC_SUBST(HDEFINES)
|
35 |
|
|
AR=${AR-ar}
|
36 |
|
|
AC_SUBST(AR)
|
37 |
|
|
AC_PROG_RANLIB
|
38 |
|
|
|
39 |
|
|
dnl We don't use gettext, but bfd does. So we do the appropriate checks
|
40 |
|
|
dnl to see if there are intl libraries we should link against.
|
41 |
|
|
ALL_LINGUAS=
|
42 |
|
|
ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
|
43 |
|
|
|
44 |
|
|
# Check for common headers.
|
45 |
|
|
# FIXME: Seems to me this can cause problems for i386-windows hosts.
|
46 |
|
|
# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
|
47 |
|
|
AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
|
48 |
|
|
AC_CHECK_HEADERS(sys/time.h sys/resource.h)
|
49 |
|
|
AC_CHECK_HEADERS(fcntl.h fpu_control.h)
|
50 |
|
|
AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
|
51 |
|
|
AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
|
52 |
|
|
|
53 |
|
|
# Check for socket libraries
|
54 |
|
|
AC_CHECK_LIB(socket, bind)
|
55 |
|
|
AC_CHECK_LIB(nsl, gethostbyname)
|
56 |
|
|
|
57 |
213 |
jeremybenn |
# Added from binutils 2.20.1/bfd
|
58 |
|
|
#Link in zlib if we can. This allows us to read compressed debug sections.
|
59 |
|
|
# This is used only by compress.c.
|
60 |
|
|
AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
|
61 |
|
|
AC_SUBST(LIBS)
|
62 |
|
|
|
63 |
24 |
jeremybenn |
. ${srcdir}/../../bfd/configure.host
|
64 |
|
|
|
65 |
|
|
dnl Standard (and optional) simulator options.
|
66 |
|
|
dnl Eventually all simulators will support these.
|
67 |
|
|
dnl Do not add any here that cannot be supported by all simulators.
|
68 |
|
|
dnl Do not add similar but different options to a particular simulator,
|
69 |
|
|
dnl all shall eventually behave the same way.
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
dnl We don't use automake, but we still want to support
|
73 |
|
|
dnl --enable-maintainer-mode.
|
74 |
|
|
USE_MAINTAINER_MODE=no
|
75 |
|
|
AC_ARG_ENABLE(maintainer-mode,
|
76 |
|
|
[ --enable-maintainer-mode Enable developer functionality.],
|
77 |
|
|
[case "${enableval}" in
|
78 |
|
|
yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
|
79 |
|
|
no) MAINT="#" ;;
|
80 |
|
|
*) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
|
81 |
|
|
esac
|
82 |
|
|
if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
|
83 |
|
|
echo "Setting maintainer mode" 6>&1
|
84 |
|
|
fi],[MAINT="#"])dnl
|
85 |
|
|
AC_SUBST(MAINT)
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
dnl This is a generic option to enable special byte swapping
|
89 |
|
|
dnl insns on *any* cpu.
|
90 |
|
|
AC_ARG_ENABLE(sim-bswap,
|
91 |
|
|
[ --enable-sim-bswap Use Host specific BSWAP instruction.],
|
92 |
|
|
[case "${enableval}" in
|
93 |
|
|
yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
|
94 |
|
|
no) sim_bswap="-DWITH_BSWAP=0";;
|
95 |
|
|
*) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
|
96 |
|
|
esac
|
97 |
|
|
if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
|
98 |
|
|
echo "Setting bswap flags = $sim_bswap" 6>&1
|
99 |
|
|
fi],[sim_bswap=""])dnl
|
100 |
|
|
AC_SUBST(sim_bswap)
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
AC_ARG_ENABLE(sim-cflags,
|
104 |
|
|
[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
|
105 |
|
|
[case "${enableval}" in
|
106 |
|
|
yes) sim_cflags="-O2 -fomit-frame-pointer";;
|
107 |
|
|
trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
|
108 |
|
|
no) sim_cflags="";;
|
109 |
|
|
*) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
110 |
|
|
esac
|
111 |
|
|
if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
|
112 |
|
|
echo "Setting sim cflags = $sim_cflags" 6>&1
|
113 |
|
|
fi],[sim_cflags=""])dnl
|
114 |
|
|
AC_SUBST(sim_cflags)
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
dnl --enable-sim-debug is for developers of the simulator
|
118 |
|
|
dnl the allowable values are work-in-progress
|
119 |
|
|
AC_ARG_ENABLE(sim-debug,
|
120 |
|
|
[ --enable-sim-debug=opts Enable debugging flags],
|
121 |
|
|
[case "${enableval}" in
|
122 |
|
|
yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
|
123 |
|
|
no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
|
124 |
|
|
*) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
|
125 |
|
|
esac
|
126 |
|
|
if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
|
127 |
|
|
echo "Setting sim debug = $sim_debug" 6>&1
|
128 |
|
|
fi],[sim_debug=""])dnl
|
129 |
|
|
AC_SUBST(sim_debug)
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
dnl --enable-sim-stdio is for users of the simulator
|
133 |
|
|
dnl It determines if IO from the program is routed through STDIO (buffered)
|
134 |
|
|
AC_ARG_ENABLE(sim-stdio,
|
135 |
|
|
[ --enable-sim-stdio Specify whether to use stdio for console input/output.],
|
136 |
|
|
[case "${enableval}" in
|
137 |
|
|
yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
|
138 |
|
|
no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
|
139 |
|
|
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
|
140 |
|
|
esac
|
141 |
|
|
if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
|
142 |
|
|
echo "Setting stdio flags = $sim_stdio" 6>&1
|
143 |
|
|
fi],[sim_stdio=""])dnl
|
144 |
|
|
AC_SUBST(sim_stdio)
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
dnl --enable-sim-trace is for users of the simulator
|
148 |
|
|
dnl The argument is either a bitmask of things to enable [exactly what is
|
149 |
|
|
dnl up to the simulator], or is a comma separated list of names of tracing
|
150 |
|
|
dnl elements to enable. The latter is only supported on simulators that
|
151 |
|
|
dnl use WITH_TRACE.
|
152 |
|
|
AC_ARG_ENABLE(sim-trace,
|
153 |
|
|
[ --enable-sim-trace=opts Enable tracing flags],
|
154 |
|
|
[case "${enableval}" in
|
155 |
|
|
yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
|
156 |
|
|
no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
|
157 |
|
|
[[-0-9]]*)
|
158 |
|
|
sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
|
159 |
|
|
[[a-z]]*)
|
160 |
|
|
sim_trace=""
|
161 |
|
|
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
162 |
|
|
if test x"$sim_trace" = x; then
|
163 |
|
|
sim_trace="-DWITH_TRACE='(TRACE_$x"
|
164 |
|
|
else
|
165 |
|
|
sim_trace="${sim_trace}|TRACE_$x"
|
166 |
|
|
fi
|
167 |
|
|
done
|
168 |
|
|
sim_trace="$sim_trace)'" ;;
|
169 |
|
|
esac
|
170 |
|
|
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
|
171 |
|
|
echo "Setting sim trace = $sim_trace" 6>&1
|
172 |
|
|
fi],[sim_trace=""])dnl
|
173 |
|
|
AC_SUBST(sim_trace)
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
dnl --enable-sim-profile
|
177 |
|
|
dnl The argument is either a bitmask of things to enable [exactly what is
|
178 |
|
|
dnl up to the simulator], or is a comma separated list of names of profiling
|
179 |
|
|
dnl elements to enable. The latter is only supported on simulators that
|
180 |
|
|
dnl use WITH_PROFILE.
|
181 |
|
|
AC_ARG_ENABLE(sim-profile,
|
182 |
|
|
[ --enable-sim-profile=opts Enable profiling flags],
|
183 |
|
|
[case "${enableval}" in
|
184 |
|
|
yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
|
185 |
|
|
no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
|
186 |
|
|
[[-0-9]]*)
|
187 |
|
|
sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
|
188 |
|
|
[[a-z]]*)
|
189 |
|
|
sim_profile=""
|
190 |
|
|
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
191 |
|
|
if test x"$sim_profile" = x; then
|
192 |
|
|
sim_profile="-DWITH_PROFILE='(PROFILE_$x"
|
193 |
|
|
else
|
194 |
|
|
sim_profile="${sim_profile}|PROFILE_$x"
|
195 |
|
|
fi
|
196 |
|
|
done
|
197 |
|
|
sim_profile="$sim_profile)'" ;;
|
198 |
|
|
esac
|
199 |
|
|
if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
|
200 |
|
|
echo "Setting sim profile = $sim_profile" 6>&1
|
201 |
|
|
fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl
|
202 |
|
|
AC_SUBST(sim_profile)
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
dnl Types used by common code
|
206 |
|
|
AC_TYPE_SIGNAL
|
207 |
|
|
|
208 |
|
|
dnl Detect exe extension
|
209 |
|
|
AC_EXEEXT
|
210 |
|
|
|
211 |
|
|
dnl These are available to append to as desired.
|
212 |
|
|
sim_link_files=
|
213 |
|
|
sim_link_links=
|
214 |
|
|
|
215 |
|
|
dnl Create tconfig.h either from simulator's tconfig.in or default one
|
216 |
|
|
dnl in common.
|
217 |
|
|
sim_link_links=tconfig.h
|
218 |
|
|
if test -f ${srcdir}/tconfig.in
|
219 |
|
|
then
|
220 |
|
|
sim_link_files=tconfig.in
|
221 |
|
|
else
|
222 |
|
|
sim_link_files=../common/tconfig.in
|
223 |
|
|
fi
|
224 |
|
|
|
225 |
|
|
# targ-vals.def points to the libc macro description file.
|
226 |
|
|
case "${target}" in
|
227 |
|
|
*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
|
228 |
|
|
esac
|
229 |
|
|
sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
|
230 |
|
|
sim_link_links="${sim_link_links} targ-vals.def"
|