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