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