* cgen-trace.c (trace_insn): Pass pc to trace_prefix for virtual insns.
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
CommitLineData
80b7b3a5 1# This file contains common code used by all simulators.
8cd89e77
DE
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#
8# The simulator's configure.in should look like:
9#
f2de7dfd
AC
10# dnl Process this file with autoconf to produce a configure script.
11# sinclude(../common/aclocal.m4)
8cd89e77
DE
12# AC_PREREQ(2.5)dnl
13# AC_INIT(Makefile.in)
f2de7dfd 14#
8cd89e77
DE
15# SIM_AC_COMMON
16#
17# ... target specific stuff ...
18#
19# SIM_AC_OUTPUT
80b7b3a5
SG
20
21AC_DEFUN(SIM_AC_COMMON,
22[
23# autoconf.info says this should be called right after AC_INIT.
b45caf05 24AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
80b7b3a5
SG
25
26AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
27AC_CANONICAL_SYSTEM
28AC_ARG_PROGRAM
29AC_PROG_CC
30AC_PROG_INSTALL
80b7b3a5
SG
31
32# Put a plausible default for CC_FOR_BUILD in Makefile.
80b7b3a5
SG
33if test "x$cross_compiling" = "xno"; then
34 CC_FOR_BUILD='$(CC)'
35else
36 CC_FOR_BUILD=gcc
37fi
38AC_SUBST(CC_FOR_BUILD)
39
40AC_SUBST(CFLAGS)
41AC_SUBST(HDEFINES)
42AR=${AR-ar}
43AC_SUBST(AR)
44AC_PROG_RANLIB
45
fc4198bb
TT
46dnl We don't use gettext, but bfd does. So we do the appropriate checks
47dnl to see if there are intl libraries we should link against.
48ALL_LINGUAS=
49CY_GNU_GETTEXT
50
fbda74b1 51# Check for common headers.
63ddb6bd
DE
52# FIXME: Seems to me this can cause problems for i386-windows hosts.
53# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
84c6d152
DE
54AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
55AC_CHECK_HEADERS(sys/time.h sys/resource.h)
8d0bd988
IC
56AC_CHECK_HEADERS(fcntl.h fpu_control.h)
57AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
fbda74b1 58
b9a9cde4
AC
59# Check for socket libraries
60AC_CHECK_LIB(socket, bind)
61AC_CHECK_LIB(nsl, gethostbyname)
62
80b7b3a5
SG
63. ${srcdir}/../../bfd/configure.host
64
a77aa7ec 65dnl Standard (and optional) simulator options.
80b7b3a5
SG
66dnl Eventually all simulators will support these.
67dnl Do not add any here that cannot be supported by all simulators.
68dnl Do not add similar but different options to a particular simulator,
69dnl all shall eventually behave the same way.
70
f2de7dfd 71
462cfbc4
DE
72dnl We don't use automake, but we still want to support
73dnl --enable-maintainer-mode.
84c6d152 74USE_MAINTAINER_MODE=no
462cfbc4
DE
75AC_ARG_ENABLE(maintainer-mode,
76[ --enable-maintainer-mode Enable developer functionality.],
77[case "${enableval}" in
84c6d152 78 yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
462cfbc4
DE
79 no) MAINT="#" ;;
80 *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
81esac
82if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
83 echo "Setting maintainer mode" 6>&1
84fi],[MAINT="#"])dnl
85AC_SUBST(MAINT)
86
87
f2de7dfd
AC
88dnl This is a generic option to enable special byte swapping
89dnl insns on *any* cpu.
90AC_ARG_ENABLE(sim-bswap,
91[ --enable-sim-bswap Use Host specific BSWAP instruction.],
92[case "${enableval}" in
a77aa7ec 93 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
f2de7dfd
AC
94 no) sim_bswap="-DWITH_BSWAP=0";;
95 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
96esac
97if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
98 echo "Setting bswap flags = $sim_bswap" 6>&1
99fi],[sim_bswap=""])dnl
100AC_SUBST(sim_bswap)
101
102
80b7b3a5
SG
103AC_ARG_ENABLE(sim-cflags,
104[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
105[case "${enableval}" in
278bda40 106 yes) sim_cflags="-O2 -fomit-frame-pointer";;
80b7b3a5
SG
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"`;;
110esac
111if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
112 echo "Setting sim cflags = $sim_cflags" 6>&1
113fi],[sim_cflags=""])dnl
114AC_SUBST(sim_cflags)
115
f2de7dfd 116
80b7b3a5
SG
117dnl --enable-sim-debug is for developers of the simulator
118dnl the allowable values are work-in-progress
119AC_ARG_ENABLE(sim-debug,
120[ --enable-sim-debug=opts Enable debugging flags],
121[case "${enableval}" in
fbda74b1
DE
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})'";;
80b7b3a5
SG
125esac
126if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
127 echo "Setting sim debug = $sim_debug" 6>&1
128fi],[sim_debug=""])dnl
129AC_SUBST(sim_debug)
130
f2de7dfd 131
a35e91c3
AC
132dnl --enable-sim-stdio is for users of the simulator
133dnl It determines if IO from the program is routed through STDIO (buffered)
134AC_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="";;
140esac
141if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
142 echo "Setting stdio flags = $sim_stdio" 6>&1
143fi],[sim_stdio=""])dnl
144AC_SUBST(sim_stdio)
145
146
147dnl --enable-sim-trace is for users of the simulator
247fccde
AC
148dnl The argument is either a bitmask of things to enable [exactly what is
149dnl up to the simulator], or is a comma separated list of names of tracing
150dnl elements to enable. The latter is only supported on simulators that
151dnl use WITH_TRACE.
a35e91c3
AC
152AC_ARG_ENABLE(sim-trace,
153[ --enable-sim-trace=opts Enable tracing flags],
154[case "${enableval}" in
247fccde 155 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
a35e91c3 156 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
247fccde
AC
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)'" ;;
a35e91c3
AC
169esac
170if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
171 echo "Setting sim trace = $sim_trace" 6>&1
172fi],[sim_trace=""])dnl
173AC_SUBST(sim_trace)
174
175
247fccde
AC
176dnl --enable-sim-profile
177dnl The argument is either a bitmask of things to enable [exactly what is
178dnl up to the simulator], or is a comma separated list of names of profiling
179dnl elements to enable. The latter is only supported on simulators that
180dnl use WITH_PROFILE.
181AC_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)'" ;;
198esac
199if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
200 echo "Setting sim profile = $sim_profile" 6>&1
201fi],[sim_profile=""])dnl
202AC_SUBST(sim_profile)
203
204
63ddb6bd
DE
205dnl Types used by common code
206AC_TYPE_SIGNAL
207
b9a9cde4
AC
208dnl Detect exe extension
209AM_EXEEXT
63ddb6bd 210
a35e91c3
AC
211dnl These are available to append to as desired.
212sim_link_files=
213sim_link_links=
214
215dnl Create tconfig.h either from simulator's tconfig.in or default one
216dnl in common.
217sim_link_links=tconfig.h
218if test -f ${srcdir}/tconfig.in
219then
220 sim_link_files=tconfig.in
221else
222 sim_link_files=../common/tconfig.in
223fi
224
225# targ-vals.def points to the libc macro description file.
226case "${target}" in
227*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
228esac
229sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
230sim_link_links="${sim_link_links} targ-vals.def"
231
232]) dnl End of SIM_AC_COMMON
233
234
235dnl Additional SIM options that can (optionally) be configured
236dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
237dnl Simulators that wish to use the relevant option specify the macro
238dnl in the simulator specific configure.in file between the SIM_AC_COMMON
239dnl and SIM_AC_OUTPUT lines.
240
241
462cfbc4
DE
242dnl Specify the running environment.
243dnl If the simulator invokes this in its configure.in then without this option
244dnl the default is the user environment and all are runtime selectable.
245dnl If the simulator doesn't invoke this, only the user environment is
246dnl supported.
247dnl ??? Until there is demonstrable value in doing something more complicated,
248dnl let's not.
249AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
250[
251AC_ARG_ENABLE(sim-environment,
252[ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
253[case "${enableval}" in
254 all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
255 user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
256 virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
257 operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
258 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
259 sim_environment="";;
260esac
261if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
262 echo "Setting sim environment = $sim_environment" 6>&1
263fi],
264[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
265])
266AC_SUBST(sim_environment)
267
268
a35e91c3 269dnl Specify the alignment restrictions of the target architecture.
794e9ac9 270dnl Without this option all possible alignment restrictions are accommodated.
b45caf05
AC
271dnl arg[1] is hardwired target alignment
272dnl arg[2] is default target alignment
a35e91c3 273AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
794e9ac9
AC
274wire_alignment="[$1]"
275default_alignment="[$2]"
a35e91c3
AC
276[
277AC_ARG_ENABLE(sim-alignment,
b45caf05 278[ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
a35e91c3 279[case "${enableval}" in
b45caf05
AC
280 strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
281 nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
282 forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
283 yes) if test x"$wire_alignment" != x; then
284 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
285 else
794e9ac9
AC
286 if test x"$default_alignment" != x; then
287 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
288 else
289 echo "No hard-wired alignment for target $target" 1>&6
290 sim_alignment="-DWITH_ALIGNMENT=0"
291 fi
b45caf05
AC
292 fi;;
293 no) if test x"$default_alignment" != x; then
294 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
295 else
794e9ac9
AC
296 if test x"$wire_alignment" != x; then
297 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
298 else
299 echo "No default alignment for target $target" 1>&6
300 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
301 fi
b45caf05
AC
302 fi;;
303 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
a35e91c3
AC
304esac
305if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
306 echo "Setting alignment flags = $sim_alignment" 6>&1
794e9ac9
AC
307fi],
308[if test x"$default_alignment" != x; then
309 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
310else
311 if test x"$wire_alignment" != x; then
312 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
313 else
314 sim_alignment=
315 fi
316fi])dnl
a35e91c3 317])dnl
92f91d1f 318AC_SUBST(sim_alignment)
a35e91c3
AC
319
320
321dnl Conditionally compile in assertion statements.
322AC_DEFUN(SIM_AC_OPTION_ASSERT,
323[
324AC_ARG_ENABLE(sim-assert,
325[ --enable-sim-assert Specify whether to perform random assertions.],
326[case "${enableval}" in
327 yes) sim_assert="-DWITH_ASSERT=1";;
328 no) sim_assert="-DWITH_ASSERT=0";;
329 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
330esac
331if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
332 echo "Setting assert flags = $sim_assert" 6>&1
333fi],[sim_assert=""])dnl
a35e91c3 334])
92f91d1f 335AC_SUBST(sim_assert)
a35e91c3
AC
336
337
462cfbc4
DE
338
339dnl --enable-sim-bitsize is for developers of the simulator
340dnl It specifies the number of BITS in the target.
341dnl arg[1] is the number of bits in a word
342dnl arg[2] is the number assigned to the most significant bit
412c4e94
AC
343dnl arg[3] is the number of bits in an address
344dnl arg[4] is the number of bits in an OpenFirmware cell.
462cfbc4
DE
345dnl FIXME: this information should be obtained from bfd/archure
346AC_DEFUN(SIM_AC_OPTION_BITSIZE,
412c4e94
AC
347wire_word_bitsize="[$1]"
348wire_word_msb="[$2]"
349wire_address_bitsize="[$3]"
350wire_cell_bitsize="[$4]"
462cfbc4 351[AC_ARG_ENABLE(sim-bitsize,
412c4e94
AC
352[ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
353[sim_bitsize=
354case "${enableval}" in
355 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
356 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
357 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
358 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
359 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
462cfbc4
DE
360 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
361 else
362 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
363 fi ;;
412c4e94 364 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
462cfbc4
DE
365 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
366 else
367 sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
368 fi ;;
412c4e94
AC
369 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
370esac
371# address bitsize
372tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
373case x"${tmp}" in
374 x ) ;;
375 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
376 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
377 * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;
378esac
379# cell bitsize
380tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
381case x"${tmp}" in
382 x ) ;;
383 x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
384 x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
385 * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;
462cfbc4
DE
386esac
387if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
388 echo "Setting bitsize flags = $sim_bitsize" 6>&1
389fi],
390[sim_bitsize=""
412c4e94
AC
391if test x"$wire_word_bitsize" != x; then
392 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
393fi
394if test x"$wire_word_msb" != x; then
395 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
396fi
397if test x"$wire_address_bitsize" != x; then
398 sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
462cfbc4 399fi
412c4e94
AC
400if test x"$wire_cell_bitsize" != x; then
401 sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
462cfbc4
DE
402fi])dnl
403])
404AC_SUBST(sim_bitsize)
405
406
407
f2de7dfd
AC
408dnl --enable-sim-endian={yes,no,big,little} is for simulators
409dnl that support both big and little endian targets.
247fccde
AC
410dnl arg[1] is hardwired target endianness.
411dnl arg[2] is default target endianness.
f2de7dfd 412AC_DEFUN(SIM_AC_OPTION_ENDIAN,
8cd89e77 413[
92f91d1f
AC
414wire_endian="[$1]"
415default_endian="[$2]"
f2de7dfd
AC
416AC_ARG_ENABLE(sim-endian,
417[ --enable-sim-endian=endian Specify target byte endian orientation.],
418[case "${enableval}" in
f2de7dfd
AC
419 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
420 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
247fccde
AC
421 yes) if test x"$wire_endian" != x; then
422 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
423 else
92f91d1f
AC
424 if test x"$default_endian" != x; then
425 sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
426 else
427 echo "No hard-wired endian for target $target" 1>&6
428 sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
429 fi
247fccde
AC
430 fi;;
431 no) if test x"$default_endian" != x; then
432 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
433 else
92f91d1f
AC
434 if test x"$wire_endian" != x; then
435 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
436 else
437 echo "No default endian for target $target" 1>&6
438 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
439 fi
247fccde 440 fi;;
f2de7dfd
AC
441 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
442esac
443if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
444 echo "Setting endian flags = $sim_endian" 6>&1
92f91d1f
AC
445fi],
446[if test x"$default_endian" != x; then
447 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
448else
449 if test x"$wire_endian" != x; then
450 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
451 else
452 sim_endian=
453 fi
454fi])dnl
f2de7dfd 455])
92f91d1f 456AC_SUBST(sim_endian)
8cd89e77 457
80b7b3a5 458
f2de7dfd
AC
459dnl --enable-sim-hostendian is for users of the simulator when
460dnl they find that AC_C_BIGENDIAN does not function correctly
461dnl (for instance in a canadian cross)
462AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
463[
464AC_ARG_ENABLE(sim-hostendian,
462cfbc4 465[ --enable-sim-hostendian=end Specify host byte endian orientation.],
f2de7dfd
AC
466[case "${enableval}" in
467 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
468 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
469 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
470 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
471esac
472if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
473 echo "Setting hostendian flags = $sim_hostendian" 6>&1
474fi],[
475if test "x$cross_compiling" = "xno"; then
476 AC_C_BIGENDIAN
477 if test $ac_cv_c_bigendian = yes; then
478 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
479 else
480 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
481 fi
482else
483 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
484fi])dnl
a77aa7ec 485])
92f91d1f 486AC_SUBST(sim_hostendian)
a77aa7ec
AC
487
488
84c6d152
DE
489dnl --enable-sim-float is for developers of the simulator
490dnl It specifies the presence of hardware floating point
491dnl And optionally the bitsize of the floating point register.
492dnl arg[1] specifies the presence (or absence) of floating point hardware
493dnl arg[2] specifies the number of bits in a floating point register
a77aa7ec
AC
494AC_DEFUN(SIM_AC_OPTION_FLOAT,
495[
84c6d152
DE
496default_sim_float="[$1]"
497default_sim_float_bitsize="[$2]"
a77aa7ec 498AC_ARG_ENABLE(sim-float,
a35e91c3 499[ --enable-sim-float Specify that the target processor has floating point hardware.],
a77aa7ec
AC
500[case "${enableval}" in
501 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
502 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
84c6d152
DE
503 32) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";;
504 64) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";;
a77aa7ec
AC
505 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
506esac
507if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
508 echo "Setting float flags = $sim_float" 6>&1
84c6d152
DE
509fi],[
510sim_float=
511if test x"${default_sim_float}" != x""; then
512 sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
513fi
514if test x"${default_sim_float_bitsize}" != x""; then
515 sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
516fi
517])dnl
a77aa7ec 518])
92f91d1f 519AC_SUBST(sim_float)
a77aa7ec
AC
520
521
247fccde
AC
522dnl The argument is the default cache size if none is specified.
523AC_DEFUN(SIM_AC_OPTION_SCACHE,
524[
525default_sim_scache="ifelse([$1],,0,[$1])"
526AC_ARG_ENABLE(sim-scache,
527[ --enable-sim-scache=size Specify simulator execution cache size.],
528[case "${enableval}" in
529 yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
462cfbc4 530 no) sim_scache="-DWITH_SCACHE=0" ;;
247fccde
AC
531 [[0-9]]*) sim_cache=${enableval};;
532 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
533 sim_scache="";;
534esac
535if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
536 echo "Setting scache size = $sim_scache" 6>&1
537fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
247fccde 538])
92f91d1f 539AC_SUBST(sim_scache)
247fccde
AC
540
541
542dnl The argument is the default model if none is specified.
543AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
544[
545default_sim_default_model="ifelse([$1],,0,[$1])"
546AC_ARG_ENABLE(sim-default-model,
547[ --enable-sim-default-model=model Specify default model to simulate.],
548[case "${enableval}" in
549 yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
550 *) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
551esac
552if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
553 echo "Setting default model = $sim_default_model" 6>&1
554fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
247fccde 555])
92f91d1f 556AC_SUBST(sim_default_model)
247fccde
AC
557
558
d89fa2d8 559dnl --enable-sim-hardware is for users of the simulator
b9a9cde4
AC
560dnl arg[1] Enable sim-hw by default? ("yes" or "no")
561dnl arg[2] is a space separated list of devices that override the defaults
562dnl arg[3] is a space separated list of extra target specific devices.
a77aa7ec
AC
563AC_DEFUN(SIM_AC_OPTION_HARDWARE,
564[
b9a9cde4
AC
565if test x"[$1]" = x"yes"; then
566 sim_hw_p=yes
567else
568 sim_hw_p=no
569fi
570if test "[$2]"; then
571 hardware="core pal glue"
572else
573 hardware="core pal glue [$3]"
574fi
575sim_hw_cflags="-DWITH_HW=1"
576sim_hw="$hardware"
577sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
a77aa7ec 578AC_ARG_ENABLE(sim-hardware,
d89fa2d8
AC
579[ --enable-sim-hardware=LIST Specify the hardware to be included in the build.],
580[
a77aa7ec 581case "${enableval}" in
b9a9cde4
AC
582 yes) sim_hw_p=yes;;
583 no) sim_hw_p=no;;
584 ,*) sim_hw_p=yes; hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
585 *,) sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
586 *) sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
a77aa7ec 587esac
b9a9cde4
AC
588if test "$sim_hw_p" != yes; then
589 sim_hw_objs=
590 sim_hw_cflags="-DWITH_HW=0"
591 sim_hw=
592else
593 sim_hw_cflags="-DWITH_HW=1"
594 # remove duplicates
595 sim_hw=""
596 sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
597 for i in x $hardware ; do
598 case " $f " in
599 x) ;;
600 *" $i "*) ;;
601 *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
602 esac
603 done
604fi
605if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
606 echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
d89fa2d8 607fi],[
b9a9cde4
AC
608if test "$sim_hw_p" != yes; then
609 sim_hw_objs=
610 sim_hw_cflags="-DWITH_HW=0"
611 sim_hw=
612fi
a77aa7ec 613if test x"$silent" != x"yes"; then
b9a9cde4 614 echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
a77aa7ec 615fi])dnl
f2de7dfd 616])
b9a9cde4
AC
617AC_SUBST(sim_hw_cflags)
618AC_SUBST(sim_hw_objs)
d89fa2d8 619AC_SUBST(sim_hw)
f2de7dfd 620
80b7b3a5 621
f2de7dfd
AC
622dnl --enable-sim-inline is for users that wish to ramp up the simulator's
623dnl performance by inlining functions.
278bda40
AC
624dnl Guarantee that unconfigured simulators do not do any inlining
625sim_inline="-DDEFAULT_INLINE=0"
f2de7dfd
AC
626AC_DEFUN(SIM_AC_OPTION_INLINE,
627[
628default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
629AC_ARG_ENABLE(sim-inline,
630[ --enable-sim-inline=inlines Specify which functions should be inlined.],
631[sim_inline=""
632case "$enableval" in
633 no) sim_inline="-DDEFAULT_INLINE=0";;
634 0) sim_inline="-DDEFAULT_INLINE=0";;
278bda40 635 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
f2de7dfd
AC
636 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
637 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
638 new_flag=""
639 case "$x" in
640 *_INLINE=*) new_flag="-D$x";;
641 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
278bda40
AC
642 *_INLINE) new_flag="-D$x=ALL_C_INLINE";;
643 *) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
f2de7dfd
AC
644 esac
645 if test x"$sim_inline" = x""; then
646 sim_inline="$new_flag"
647 else
648 sim_inline="$sim_inline $new_flag"
649 fi
650 done;;
651esac
652if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
653 echo "Setting inline flags = $sim_inline" 6>&1
fc4198bb
TT
654fi],[
655if test "x$cross_compiling" = "xno"; then
656 if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
657 sim_inline="${default_sim_inline}"
658 if test x"$silent" != x"yes"; then
659 echo "Setting inline flags = $sim_inline" 6>&1
660 fi
661 else
662 sim_inline=""
f2de7dfd
AC
663 fi
664else
fc4198bb 665 sim_inline="-DDEFAULT_INLINE=0"
f2de7dfd 666fi])dnl
a77aa7ec 667])
92f91d1f 668AC_SUBST(sim_inline)
a77aa7ec
AC
669
670
671AC_DEFUN(SIM_AC_OPTION_PACKAGES,
672[
673AC_ARG_ENABLE(sim-packages,
674[ --enable-sim-packages=list Specify the packages to be included in the build.],
675[packages=disklabel
676case "${enableval}" in
677 yes) ;;
678 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
679 ,*) packages="${packages}${enableval}";;
680 *,) packages="${enableval}${packages}";;
681 *) packages="${enableval}"'';;
682esac
683sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
684sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
685if test x"$silent" != x"yes" && test x"$packages" != x""; then
686 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
687fi],[packages=disklabel
688sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
689sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
690if test x"$silent" != x"yes"; then
691 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
692fi])dnl
a77aa7ec 693])
92f91d1f 694AC_SUBST(sim_packages)
a77aa7ec
AC
695
696
697AC_DEFUN(SIM_AC_OPTION_REGPARM,
698[
699AC_ARG_ENABLE(sim-regparm,
700[ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
701[case "${enableval}" in
702 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
703 no) sim_regparm="" ;;
704 yes) sim_regparm="-DWITH_REGPARM=3";;
705 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
706esac
707if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
708 echo "Setting regparm flags = $sim_regparm" 6>&1
709fi],[sim_regparm=""])dnl
a77aa7ec 710])
92f91d1f 711AC_SUBST(sim_regparm)
a77aa7ec
AC
712
713
714AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
715[
a35e91c3 716default_sim_reserved_bits="ifelse([$1],,1,[$1])"
a77aa7ec
AC
717AC_ARG_ENABLE(sim-reserved-bits,
718[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
719[case "${enableval}" in
720 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
721 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
722 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
723esac
724if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
725 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
a35e91c3 726fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
a77aa7ec 727])
92f91d1f 728AC_SUBST(sim_reserved_bits)
a77aa7ec
AC
729
730
731AC_DEFUN(SIM_AC_OPTION_SMP,
732[
a35e91c3 733default_sim_smp="ifelse([$1],,5,[$1])"
a77aa7ec 734AC_ARG_ENABLE(sim-smp,
a35e91c3 735[ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
a77aa7ec
AC
736[case "${enableval}" in
737 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
738 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
739 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
740esac
741if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
742 echo "Setting smp flags = $sim_smp" 6>&1
a35e91c3 743fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
a77aa7ec
AC
744if test x"$silent" != x"yes"; then
745 echo "Setting smp flags = $sim_smp" 6>&1
746fi])dnl
f2de7dfd 747])
92f91d1f 748AC_SUBST(sim_smp)
80b7b3a5 749
80b7b3a5 750
a77aa7ec
AC
751AC_DEFUN(SIM_AC_OPTION_STDCALL,
752[
753AC_ARG_ENABLE(sim-stdcall,
754[ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
755[case "${enableval}" in
756 no) sim_stdcall="" ;;
757 std*) sim_stdcall="-DWITH_STDCALL=1";;
758 yes) sim_stdcall="-DWITH_STDCALL=1";;
759 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
760esac
761if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
762 echo "Setting function call flags = $sim_stdcall" 6>&1
763fi],[sim_stdcall=""])dnl
a77aa7ec 764])
92f91d1f 765AC_SUBST(sim_stdcall)
a77aa7ec
AC
766
767
a35e91c3
AC
768AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
769[
770default_sim_xor_endian="ifelse([$1],,8,[$1])"
771AC_ARG_ENABLE(sim-xor-endian,
772[ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
a77aa7ec 773[case "${enableval}" in
a35e91c3
AC
774 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
775 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
776 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
a77aa7ec 777esac
a35e91c3
AC
778if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
779 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
780fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
a35e91c3 781])
92f91d1f 782AC_SUBST(sim_xor_endian)
a77aa7ec
AC
783
784
b9a9cde4 785dnl --enable-build-warnings is for developers of the simulator.
f2de7dfd
AC
786dnl it enables extra GCC specific warnings.
787AC_DEFUN(SIM_AC_OPTION_WARNINGS,
788[
b9a9cde4
AC
789AC_ARG_ENABLE(build-warnings,
790[ --enable-build-warnings[=LIST] Enable build-time compiler warnings],
791[build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
792case "${enableval}" in
793 yes) ;;
794 no) build_warnings="-w";;
795 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
796 build_warnings="${build_warnings} ${t}";;
797 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
798 build_warnings="${t} ${build_warnings}";;
799 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
f2de7dfd 800esac
b9a9cde4
AC
801if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
802 echo "Setting warning flags = $build_warnings" 6>&1
803fi],[build_warnings=""])dnl
f2de7dfd 804])
b9a9cde4 805AC_SUBST(build_warnings)
80b7b3a5 806
80b7b3a5 807
f2de7dfd
AC
808dnl Generate the Makefile in a target specific directory.
809dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
810dnl so this is a cover macro to tuck the details away of how we cope.
811dnl We cope by having autoconf generate two files and then merge them into
812dnl one afterwards. The two pieces of the common fragment are inserted into
813dnl the target's fragment at the appropriate points.
80b7b3a5 814
f2de7dfd
AC
815AC_DEFUN(SIM_AC_OUTPUT,
816[
80b7b3a5 817AC_LINK_FILES($sim_link_files, $sim_link_links)
88d5f8e8
DE
818AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
819[case "x$CONFIG_FILES" in
820 xMakefile*)
f2de7dfd
AC
821 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
822 rm -f Makesim1.tmp Makesim2.tmp Makefile
823 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
824 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
825 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
826 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
827 <Makefile.sim >Makefile
828 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
829 ;;
830 esac
80b7b3a5 831 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
f2de7dfd
AC
832])
833])
fc4198bb
TT
834
835# This file is derived from `gettext.m4'. The difference is that the
836# included macros assume Cygnus-style source and build trees.
837
838# Macro to add for using GNU gettext.
839# Ulrich Drepper <drepper@cygnus.com>, 1995.
840#
841# This file file be copied and used freely without restrictions. It can
842# be used in projects which are not available under the GNU Public License
843# but which still want to provide support for the GNU gettext functionality.
844# Please note that the actual code is *not* freely available.
845
846# serial 3
847
848AC_DEFUN(CY_WITH_NLS,
849 [AC_MSG_CHECKING([whether NLS is requested])
850 dnl Default is enabled NLS
851 AC_ARG_ENABLE(nls,
852 [ --disable-nls do not use Native Language Support],
853 USE_NLS=$enableval, USE_NLS=yes)
854 AC_MSG_RESULT($USE_NLS)
855 AC_SUBST(USE_NLS)
856
857 USE_INCLUDED_LIBINTL=no
858
859 dnl If we use NLS figure out what method
860 if test "$USE_NLS" = "yes"; then
861 AC_DEFINE(ENABLE_NLS)
862 AC_MSG_CHECKING([whether included gettext is requested])
863 AC_ARG_WITH(included-gettext,
864 [ --with-included-gettext use the GNU gettext library included here],
865 nls_cv_force_use_gnu_gettext=$withval,
866 nls_cv_force_use_gnu_gettext=no)
867 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
868
869 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
870 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
871 dnl User does not insist on using GNU NLS library. Figure out what
872 dnl to use. If gettext or catgets are available (in this order) we
873 dnl use this. Else we have to fall back to GNU NLS library.
874 dnl catgets is only used if permitted by option --with-catgets.
875 nls_cv_header_intl=
876 nls_cv_header_libgt=
877 CATOBJEXT=NONE
878
879 AC_CHECK_HEADER(libintl.h,
880 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
881 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
882 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
883
884 if test "$gt_cv_func_gettext_libc" != "yes"; then
885 AC_CHECK_LIB(intl, bindtextdomain,
886 [AC_CACHE_CHECK([for gettext in libintl],
887 gt_cv_func_gettext_libintl,
888 [AC_TRY_LINK([], [return (int) gettext ("")],
889 gt_cv_func_gettext_libintl=yes,
890 gt_cv_func_gettext_libintl=no)])])
891 fi
892
893 if test "$gt_cv_func_gettext_libc" = "yes" \
894 || test "$gt_cv_func_gettext_libintl" = "yes"; then
895 AC_DEFINE(HAVE_GETTEXT)
896 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
897 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
898 if test "$MSGFMT" != "no"; then
899 AC_CHECK_FUNCS(dcgettext)
900 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
901 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
902 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
903 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
904 return _nl_msg_cat_cntr],
905 [CATOBJEXT=.gmo
906 DATADIRNAME=share],
907 [CATOBJEXT=.mo
908 DATADIRNAME=lib])
909 INSTOBJEXT=.mo
910 fi
911 fi
912 ])
913
914 dnl In the standard gettext, we would now check for catgets.
915 dnl However, we never want to use catgets for our releases.
916
917 if test "$CATOBJEXT" = "NONE"; then
918 dnl Neither gettext nor catgets in included in the C library.
919 dnl Fall back on GNU gettext library.
920 nls_cv_use_gnu_gettext=yes
921 fi
922 fi
923
924 if test "$nls_cv_use_gnu_gettext" = "yes"; then
925 dnl Mark actions used to generate GNU NLS library.
926 INTLOBJS="\$(GETTOBJS)"
927 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
928 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
929 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
930 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
931 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
932 AC_SUBST(MSGFMT)
933 USE_INCLUDED_LIBINTL=yes
934 CATOBJEXT=.gmo
935 INSTOBJEXT=.mo
936 DATADIRNAME=share
937 INTLDEPS='$(top_builddir)/../intl/libintl.a'
938 INTLLIBS=$INTLDEPS
939 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
940 nls_cv_header_intl=libintl.h
941 nls_cv_header_libgt=libgettext.h
942 fi
943
944 dnl Test whether we really found GNU xgettext.
945 if test "$XGETTEXT" != ":"; then
946 dnl If it is no GNU xgettext we define it as : so that the
947 dnl Makefiles still can work.
948 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
949 : ;
950 else
951 AC_MSG_RESULT(
952 [found xgettext programs is not GNU xgettext; ignore it])
953 XGETTEXT=":"
954 fi
955 fi
956
957 # We need to process the po/ directory.
958 POSUB=po
959 else
960 DATADIRNAME=share
961 nls_cv_header_intl=libintl.h
962 nls_cv_header_libgt=libgettext.h
963 fi
964
965 # If this is used in GNU gettext we have to set USE_NLS to `yes'
966 # because some of the sources are only built for this goal.
967 if test "$PACKAGE" = gettext; then
968 USE_NLS=yes
969 USE_INCLUDED_LIBINTL=yes
970 fi
971
972 dnl These rules are solely for the distribution goal. While doing this
973 dnl we only have to keep exactly one list of the available catalogs
974 dnl in configure.in.
975 for lang in $ALL_LINGUAS; do
976 GMOFILES="$GMOFILES $lang.gmo"
977 POFILES="$POFILES $lang.po"
978 done
979
980 dnl Make all variables we use known to autoconf.
981 AC_SUBST(USE_INCLUDED_LIBINTL)
982 AC_SUBST(CATALOGS)
983 AC_SUBST(CATOBJEXT)
984 AC_SUBST(DATADIRNAME)
985 AC_SUBST(GMOFILES)
986 AC_SUBST(INSTOBJEXT)
987 AC_SUBST(INTLDEPS)
988 AC_SUBST(INTLLIBS)
989 AC_SUBST(INTLOBJS)
990 AC_SUBST(POFILES)
991 AC_SUBST(POSUB)
992 ])
993
994AC_DEFUN(CY_GNU_GETTEXT,
995 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
996 AC_REQUIRE([AC_PROG_CC])dnl
997 AC_REQUIRE([AC_PROG_RANLIB])dnl
998 AC_REQUIRE([AC_ISC_POSIX])dnl
999 AC_REQUIRE([AC_HEADER_STDC])dnl
1000 AC_REQUIRE([AC_C_CONST])dnl
1001 AC_REQUIRE([AC_C_INLINE])dnl
1002 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1003 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1004 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1005 AC_REQUIRE([AC_FUNC_MMAP])dnl
1006
1007 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1008unistd.h values.h sys/param.h])
1009 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1010__argz_count __argz_stringify __argz_next])
1011
1012 if test "${ac_cv_func_stpcpy+set}" != "set"; then
1013 AC_CHECK_FUNCS(stpcpy)
1014 fi
1015 if test "${ac_cv_func_stpcpy}" = "yes"; then
1016 AC_DEFINE(HAVE_STPCPY)
1017 fi
1018
1019 AM_LC_MESSAGES
1020 CY_WITH_NLS
1021
1022 if test "x$CATOBJEXT" != "x"; then
1023 if test "x$ALL_LINGUAS" = "x"; then
1024 LINGUAS=
1025 else
1026 AC_MSG_CHECKING(for catalogs to be installed)
1027 NEW_LINGUAS=
1028 for lang in ${LINGUAS=$ALL_LINGUAS}; do
1029 case "$ALL_LINGUAS" in
1030 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1031 esac
1032 done
1033 LINGUAS=$NEW_LINGUAS
1034 AC_MSG_RESULT($LINGUAS)
1035 fi
1036
1037 dnl Construct list of names of catalog files to be constructed.
1038 if test -n "$LINGUAS"; then
1039 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1040 fi
1041 fi
1042
1043 dnl The reference to <locale.h> in the installed <libintl.h> file
1044 dnl must be resolved because we cannot expect the users of this
1045 dnl to define HAVE_LOCALE_H.
1046 if test $ac_cv_header_locale_h = yes; then
1047 INCLUDE_LOCALE_H="#include <locale.h>"
1048 else
1049 INCLUDE_LOCALE_H="\
1050/* The system does not provide the header <locale.h>. Take care yourself. */"
1051 fi
1052 AC_SUBST(INCLUDE_LOCALE_H)
1053
1054 dnl Determine which catalog format we have (if any is needed)
1055 dnl For now we know about two different formats:
1056 dnl Linux libc-5 and the normal X/Open format
1057 if test -f $srcdir/po2tbl.sed.in; then
1058 if test "$CATOBJEXT" = ".cat"; then
1059 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1060
1061 dnl Transform the SED scripts while copying because some dumb SEDs
1062 dnl cannot handle comments.
1063 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
1064 fi
1065 dnl po2tbl.sed is always needed.
1066 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
1067 $srcdir/po2tbl.sed.in > po2tbl.sed
1068 fi
1069
1070 dnl In the intl/Makefile.in we have a special dependency which makes
1071 dnl only sense for gettext. We comment this out for non-gettext
1072 dnl packages.
1073 if test "$PACKAGE" = "gettext"; then
1074 GT_NO="#NO#"
1075 GT_YES=
1076 else
1077 GT_NO=
1078 GT_YES="#YES#"
1079 fi
1080 AC_SUBST(GT_NO)
1081 AC_SUBST(GT_YES)
1082
1083 MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
1084 AC_SUBST(MKINSTALLDIRS)
1085
1086 dnl *** For now the libtool support in intl/Makefile is not for real.
1087 l=
1088 AC_SUBST(l)
1089
1090 dnl Generate list of files to be processed by xgettext which will
1091 dnl be included in po/Makefile. But only do this if the po directory
1092 dnl exists in srcdir.
1093 if test -d $srcdir/po; then
1094 test -d po || mkdir po
1095 if test "x$srcdir" != "x."; then
1096 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1097 posrcprefix="$srcdir/"
1098 else
1099 posrcprefix="../$srcdir/"
1100 fi
1101 else
1102 posrcprefix="../"
1103 fi
1104 rm -f po/POTFILES
1105 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1106 < $srcdir/po/POTFILES.in > po/POTFILES
1107 fi
1108 ])
1109
1110# Search path for a program which passes the given test.
1111# Ulrich Drepper <drepper@cygnus.com>, 1996.
1112#
1113# This file file be copied and used freely without restrictions. It can
1114# be used in projects which are not available under the GNU Public License
1115# but which still want to provide support for the GNU gettext functionality.
1116# Please note that the actual code is *not* freely available.
1117
1118# serial 1
1119
1120dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1121dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1122AC_DEFUN(AM_PATH_PROG_WITH_TEST,
1123[# Extract the first word of "$2", so it can be a program name with args.
1124set dummy $2; ac_word=[$]2
1125AC_MSG_CHECKING([for $ac_word])
1126AC_CACHE_VAL(ac_cv_path_$1,
1127[case "[$]$1" in
1128 /*)
1129 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1130 ;;
1131 *)
1132 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1133 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1134 test -z "$ac_dir" && ac_dir=.
1135 if test -f $ac_dir/$ac_word; then
1136 if [$3]; then
1137 ac_cv_path_$1="$ac_dir/$ac_word"
1138 break
1139 fi
1140 fi
1141 done
1142 IFS="$ac_save_ifs"
1143dnl If no 4th arg is given, leave the cache variable unset,
1144dnl so AC_PATH_PROGS will keep looking.
1145ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1146])dnl
1147 ;;
1148esac])dnl
1149$1="$ac_cv_path_$1"
1150if test -n "[$]$1"; then
1151 AC_MSG_RESULT([$]$1)
1152else
1153 AC_MSG_RESULT(no)
1154fi
1155AC_SUBST($1)dnl
1156])
1157
1158# Check whether LC_MESSAGES is available in <locale.h>.
1159# Ulrich Drepper <drepper@cygnus.com>, 1995.
1160#
1161# This file file be copied and used freely without restrictions. It can
1162# be used in projects which are not available under the GNU Public License
1163# but which still want to provide support for the GNU gettext functionality.
1164# Please note that the actual code is *not* freely available.
1165
1166# serial 1
1167
1168AC_DEFUN(AM_LC_MESSAGES,
1169 [if test $ac_cv_header_locale_h = yes; then
1170 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1171 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1172 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1173 if test $am_cv_val_LC_MESSAGES = yes; then
1174 AC_DEFINE(HAVE_LC_MESSAGES)
1175 fi
1176 fi])
1177
b9a9cde4
AC
1178# Check to see if we're running under Cygwin32, without using
1179# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes".
1180# Otherwise set it to "no".
1181
1182dnl AM_CYGWIN32()
1183dnl You might think we can do this by checking for a cygwin32-specific
1184dnl cpp define.
1185AC_DEFUN(AM_CYGWIN32,
1186[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
1187[AC_TRY_COMPILE(,[int main () { return __CYGWIN32__; }],
1188am_cv_cygwin32=yes, am_cv_cygwin32=no)
1189rm -f conftest*])
1190CYGWIN32=
1191test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
1192
1193# Check to see if we're running under Win32, without using
1194# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe".
1195# Otherwise set it to "".
1196
1197dnl AM_EXEEXT()
1198dnl This knows we add .exe if we're building in the Cygwin32
1199dnl environment. But if we're not, then it compiles a test program
1200dnl to see if there is a suffix for executables.
1201AC_DEFUN(AM_EXEEXT,
1202dnl AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AM_CYGWIN32])
1203AC_MSG_CHECKING([for executable suffix])
1204[AC_CACHE_VAL(am_cv_exeext,
1205[if test "$CYGWIN32" = yes; then
1206am_cv_exeext=.exe
1207else
1208cat > am_c_test.c << 'EOF'
1209int main() {
1210/* Nothing needed here */
1211}
1212EOF
1213${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
1214am_cv_exeext=`ls am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//`
1215rm -f am_c_test*])
1216test x"${am_cv_exeext}" = x && am_cv_exeext=no
1217fi
1218EXEEXT=""
1219test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
1220AC_MSG_RESULT(${am_cv_exeext})
1221AC_SUBST(EXEEXT)])
1222
This page took 0.144385 seconds and 4 git commands to generate.