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