* autoconf correction
[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)
25
26AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
27AC_CANONICAL_SYSTEM
28AC_ARG_PROGRAM
29AC_PROG_CC
30AC_PROG_INSTALL
31
32# Put a plausible default for CC_FOR_BUILD in Makefile.
33if test "x$cross_compiling" = "xno"; then
34 CC_FOR_BUILD='$(CC)'
35else
36 CC_FOR_BUILD=gcc
37fi
38AC_SUBST(CC_FOR_BUILD)
39
40AC_SUBST(CFLAGS)
41AC_SUBST(HDEFINES)
42AR=${AR-ar}
43AC_SUBST(AR)
44AC_PROG_RANLIB
45
46dnl We don't use gettext, but bfd does. So we do the appropriate checks
47dnl to see if there are intl libraries we should link against.
48ALL_LINGUAS=
49CY_GNU_GETTEXT
50
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*.
54AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
55AC_CHECK_HEADERS(sys/time.h sys/resource.h)
56AC_CHECK_HEADERS(fcntl.h fpu_control.h)
57AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
58AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
59
60# Check for socket libraries
61AC_CHECK_LIB(socket, bind)
62AC_CHECK_LIB(nsl, gethostbyname)
63
64. ${srcdir}/../../bfd/configure.host
65
66dnl Standard (and optional) simulator options.
67dnl Eventually all simulators will support these.
68dnl Do not add any here that cannot be supported by all simulators.
69dnl Do not add similar but different options to a particular simulator,
70dnl all shall eventually behave the same way.
71
72
73dnl We don't use automake, but we still want to support
74dnl --enable-maintainer-mode.
75USE_MAINTAINER_MODE=no
76AC_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="#" ;;
82esac
83if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
84 echo "Setting maintainer mode" 6>&1
85fi],[MAINT="#"])dnl
86AC_SUBST(MAINT)
87
88
89dnl This is a generic option to enable special byte swapping
90dnl insns on *any* cpu.
91AC_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="";;
97esac
98if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
99 echo "Setting bswap flags = $sim_bswap" 6>&1
100fi],[sim_bswap=""])dnl
101AC_SUBST(sim_bswap)
102
103
104AC_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"`;;
111esac
112if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
113 echo "Setting sim cflags = $sim_cflags" 6>&1
114fi],[sim_cflags=""])dnl
115AC_SUBST(sim_cflags)
116
117
118dnl --enable-sim-debug is for developers of the simulator
119dnl the allowable values are work-in-progress
120AC_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})'";;
126esac
127if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
128 echo "Setting sim debug = $sim_debug" 6>&1
129fi],[sim_debug=""])dnl
130AC_SUBST(sim_debug)
131
132
133dnl --enable-sim-stdio is for users of the simulator
134dnl It determines if IO from the program is routed through STDIO (buffered)
135AC_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="";;
141esac
142if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
143 echo "Setting stdio flags = $sim_stdio" 6>&1
144fi],[sim_stdio=""])dnl
145AC_SUBST(sim_stdio)
146
147
148dnl --enable-sim-trace is for users of the simulator
149dnl The argument is either a bitmask of things to enable [exactly what is
150dnl up to the simulator], or is a comma separated list of names of tracing
151dnl elements to enable. The latter is only supported on simulators that
152dnl use WITH_TRACE.
153AC_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)'" ;;
170esac
171if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
172 echo "Setting sim trace = $sim_trace" 6>&1
173fi],[sim_trace=""])dnl
174AC_SUBST(sim_trace)
175
176
177dnl --enable-sim-profile
178dnl The argument is either a bitmask of things to enable [exactly what is
179dnl up to the simulator], or is a comma separated list of names of profiling
180dnl elements to enable. The latter is only supported on simulators that
181dnl use WITH_PROFILE.
182AC_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)'" ;;
199esac
200if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
201 echo "Setting sim profile = $sim_profile" 6>&1
202fi],[sim_profile=""])dnl
203AC_SUBST(sim_profile)
204
205
206dnl Types used by common code
207AC_TYPE_SIGNAL
208
209dnl Detect exe extension
cd0fc7c3 210AC_EXEEXT
c906108c
SS
211
212dnl These are available to append to as desired.
213sim_link_files=
214sim_link_links=
215
216dnl Create tconfig.h either from simulator's tconfig.in or default one
217dnl in common.
218sim_link_links=tconfig.h
219if test -f ${srcdir}/tconfig.in
220then
221 sim_link_files=tconfig.in
222else
223 sim_link_files=../common/tconfig.in
224fi
225
226# targ-vals.def points to the libc macro description file.
227case "${target}" in
228*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
229esac
230sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
231sim_link_links="${sim_link_links} targ-vals.def"
232
233]) dnl End of SIM_AC_COMMON
234
235
236dnl Additional SIM options that can (optionally) be configured
237dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
238dnl Simulators that wish to use the relevant option specify the macro
239dnl in the simulator specific configure.in file between the SIM_AC_COMMON
240dnl and SIM_AC_OUTPUT lines.
241
242
243dnl Specify the running environment.
244dnl If the simulator invokes this in its configure.in then without this option
245dnl the default is the user environment and all are runtime selectable.
246dnl If the simulator doesn't invoke this, only the user environment is
247dnl supported.
248dnl ??? Until there is demonstrable value in doing something more complicated,
249dnl let's not.
250AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
251[
252AC_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="";;
261esac
262if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
263 echo "Setting sim environment = $sim_environment" 6>&1
264fi],
265[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
266])
267AC_SUBST(sim_environment)
268
269
270dnl Specify the alignment restrictions of the target architecture.
271dnl Without this option all possible alignment restrictions are accommodated.
272dnl arg[1] is hardwired target alignment
273dnl arg[2] is default target alignment
274AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
275wire_alignment="[$1]"
276default_alignment="[$2]"
277[
278AC_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="";;
305esac
306if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
307 echo "Setting alignment flags = $sim_alignment" 6>&1
308fi],
309[if test x"$default_alignment" != x; then
310 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
311else
312 if test x"$wire_alignment" != x; then
313 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
314 else
315 sim_alignment=
316 fi
317fi])dnl
318])dnl
319AC_SUBST(sim_alignment)
320
321
322dnl Conditionally compile in assertion statements.
323AC_DEFUN(SIM_AC_OPTION_ASSERT,
324[
325AC_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="";;
331esac
332if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
333 echo "Setting assert flags = $sim_assert" 6>&1
334fi],[sim_assert=""])dnl
335])
336AC_SUBST(sim_assert)
337
338
339
340dnl --enable-sim-bitsize is for developers of the simulator
341dnl It specifies the number of BITS in the target.
342dnl arg[1] is the number of bits in a word
343dnl arg[2] is the number assigned to the most significant bit
344dnl arg[3] is the number of bits in an address
345dnl arg[4] is the number of bits in an OpenFirmware cell.
346dnl FIXME: this information should be obtained from bfd/archure
347AC_DEFUN(SIM_AC_OPTION_BITSIZE,
348wire_word_bitsize="[$1]"
349wire_word_msb="[$2]"
350wire_address_bitsize="[$3]"
351wire_cell_bitsize="[$4]"
352[AC_ARG_ENABLE(sim-bitsize,
353[ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
354[sim_bitsize=
355case "${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") ;;
371esac
372# address bitsize
373tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
374case 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") ;;
379esac
380# cell bitsize
381tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
382case 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") ;;
387esac
388if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
389 echo "Setting bitsize flags = $sim_bitsize" 6>&1
390fi],
391[sim_bitsize=""
392if test x"$wire_word_bitsize" != x; then
393 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
394fi
395if test x"$wire_word_msb" != x; then
396 sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
397fi
398if test x"$wire_address_bitsize" != x; then
399 sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
400fi
401if test x"$wire_cell_bitsize" != x; then
402 sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
403fi])dnl
404])
405AC_SUBST(sim_bitsize)
406
407
408
409dnl --enable-sim-endian={yes,no,big,little} is for simulators
410dnl that support both big and little endian targets.
411dnl arg[1] is hardwired target endianness.
412dnl arg[2] is default target endianness.
413AC_DEFUN(SIM_AC_OPTION_ENDIAN,
414[
415wire_endian="[$1]"
416default_endian="[$2]"
417AC_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="";;
443esac
444if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
445 echo "Setting endian flags = $sim_endian" 6>&1
446fi],
447[if test x"$default_endian" != x; then
448 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
449else
450 if test x"$wire_endian" != x; then
451 sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
452 else
453 sim_endian=
454 fi
455fi])dnl
456])
457AC_SUBST(sim_endian)
458
459
460dnl --enable-sim-hostendian is for users of the simulator when
461dnl they find that AC_C_BIGENDIAN does not function correctly
462dnl (for instance in a canadian cross)
463AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
464[
465AC_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="";;
472esac
473if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
474 echo "Setting hostendian flags = $sim_hostendian" 6>&1
475fi],[
476if 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
483else
484 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
485fi])dnl
486])
487AC_SUBST(sim_hostendian)
488
489
490dnl --enable-sim-float is for developers of the simulator
491dnl It specifies the presence of hardware floating point
492dnl And optionally the bitsize of the floating point register.
493dnl arg[1] specifies the presence (or absence) of floating point hardware
494dnl arg[2] specifies the number of bits in a floating point register
495AC_DEFUN(SIM_AC_OPTION_FLOAT,
496[
497default_sim_float="[$1]"
498default_sim_float_bitsize="[$2]"
499AC_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="";;
507esac
508if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
509 echo "Setting float flags = $sim_float" 6>&1
510fi],[
511sim_float=
512if test x"${default_sim_float}" != x""; then
513 sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
514fi
515if test x"${default_sim_float_bitsize}" != x""; then
516 sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
517fi
518])dnl
519])
520AC_SUBST(sim_float)
521
522
523dnl The argument is the default cache size if none is specified.
524AC_DEFUN(SIM_AC_OPTION_SCACHE,
525[
526default_sim_scache="ifelse([$1],,0,[$1])"
527AC_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_cache=${enableval};;
533 *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
534 sim_scache="";;
535esac
536if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
537 echo "Setting scache size = $sim_scache" 6>&1
538fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
539])
540AC_SUBST(sim_scache)
541
542
543dnl The argument is the default model if none is specified.
544AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
545[
546default_sim_default_model="ifelse([$1],,0,[$1])"
547AC_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}\"'";;
552esac
553if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
554 echo "Setting default model = $sim_default_model" 6>&1
555fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
556])
557AC_SUBST(sim_default_model)
558
559
560dnl --enable-sim-hardware is for users of the simulator
561dnl arg[1] Enable sim-hw by default? ("yes" or "no")
562dnl arg[2] is a space separated list of devices that override the defaults
563dnl arg[3] is a space separated list of extra target specific devices.
564AC_DEFUN(SIM_AC_OPTION_HARDWARE,
565[
566if test x"[$1]" = x"yes"; then
567 sim_hw_p=yes
568else
569 sim_hw_p=no
570fi
571if test "[$2]"; then
572 hardware="core pal glue"
573else
574 hardware="core pal glue [$3]"
575fi
576sim_hw_cflags="-DWITH_HW=1"
577sim_hw="$hardware"
578sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
579AC_ARG_ENABLE(sim-hardware,
580[ --enable-sim-hardware=LIST Specify the hardware to be included in the build.],
581[
582case "${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/,/ /'`"'';;
588esac
589if test "$sim_hw_p" != yes; then
590 sim_hw_objs=
591 sim_hw_cflags="-DWITH_HW=0"
592 sim_hw=
593else
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
605fi
606if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
607 echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
608fi],[
609if test "$sim_hw_p" != yes; then
610 sim_hw_objs=
611 sim_hw_cflags="-DWITH_HW=0"
612 sim_hw=
613fi
614if test x"$silent" != x"yes"; then
615 echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
616fi])dnl
617])
618AC_SUBST(sim_hw_cflags)
619AC_SUBST(sim_hw_objs)
620AC_SUBST(sim_hw)
621
622
623dnl --enable-sim-inline is for users that wish to ramp up the simulator's
624dnl performance by inlining functions.
625dnl Guarantee that unconfigured simulators do not do any inlining
626sim_inline="-DDEFAULT_INLINE=0"
627AC_DEFUN(SIM_AC_OPTION_INLINE,
628[
629default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
630AC_ARG_ENABLE(sim-inline,
631[ --enable-sim-inline=inlines Specify which functions should be inlined.],
632[sim_inline=""
633case "$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;;
652esac
653if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
654 echo "Setting inline flags = $sim_inline" 6>&1
655fi],[
656if 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
665else
666 sim_inline="-DDEFAULT_INLINE=0"
667fi])dnl
668])
669AC_SUBST(sim_inline)
670
671
672AC_DEFUN(SIM_AC_OPTION_PACKAGES,
673[
674AC_ARG_ENABLE(sim-packages,
675[ --enable-sim-packages=list Specify the packages to be included in the build.],
676[packages=disklabel
677case "${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}"'';;
683esac
684sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
685sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
686if test x"$silent" != x"yes" && test x"$packages" != x""; then
687 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
688fi],[packages=disklabel
689sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
690sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
691if test x"$silent" != x"yes"; then
692 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
693fi])dnl
694])
695AC_SUBST(sim_packages)
696
697
698AC_DEFUN(SIM_AC_OPTION_REGPARM,
699[
700AC_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="";;
707esac
708if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
709 echo "Setting regparm flags = $sim_regparm" 6>&1
710fi],[sim_regparm=""])dnl
711])
712AC_SUBST(sim_regparm)
713
714
715AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
716[
717default_sim_reserved_bits="ifelse([$1],,1,[$1])"
718AC_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="";;
724esac
725if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
726 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
727fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
728])
729AC_SUBST(sim_reserved_bits)
730
731
732AC_DEFUN(SIM_AC_OPTION_SMP,
733[
734default_sim_smp="ifelse([$1],,5,[$1])"
735AC_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";;
741esac
742if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
743 echo "Setting smp flags = $sim_smp" 6>&1
744fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
745if test x"$silent" != x"yes"; then
746 echo "Setting smp flags = $sim_smp" 6>&1
747fi])dnl
748])
749AC_SUBST(sim_smp)
750
751
752AC_DEFUN(SIM_AC_OPTION_STDCALL,
753[
754AC_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="";;
761esac
762if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
763 echo "Setting function call flags = $sim_stdcall" 6>&1
764fi],[sim_stdcall=""])dnl
765])
766AC_SUBST(sim_stdcall)
767
768
769AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
770[
771default_sim_xor_endian="ifelse([$1],,8,[$1])"
772AC_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";;
778esac
779if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
780 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
781fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
782])
783AC_SUBST(sim_xor_endian)
784
785
786dnl --enable-build-warnings is for developers of the simulator.
787dnl it enables extra GCC specific warnings.
788AC_DEFUN(SIM_AC_OPTION_WARNINGS,
789[
790AC_ARG_ENABLE(build-warnings,
791[ --enable-build-warnings[=LIST] Enable build-time compiler warnings],
792[build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
793case "${enableval}" in
794 yes) ;;
795 no) build_warnings="-w";;
796 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
797 build_warnings="${build_warnings} ${t}";;
798 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
799 build_warnings="${t} ${build_warnings}";;
800 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
801esac
802if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
803 echo "Setting warning flags = $build_warnings" 6>&1
d4f3574e
SS
804fi
805WARN_CFLAGS=""
806WERROR_CFLAGS=""
807if test "x${build_warnings}" != x -a "x$GCC" = xyes
808then
809 # Separate out the -Werror flag as some files just cannot be
810 # compiled with it enabled.
811 for w in ${build_warnings}; do
812 case $w in
813 -Werr*) WERROR_CFLAGS=-Werror ;;
814 *) WARN_CFLAGS="${WARN_CFLAGS} $w"
815 esac
816 done
c906108c
SS
817fi],[build_warnings=""])dnl
818])
d4f3574e
SS
819AC_SUBST(WARN_CFLAGS)
820AC_SUBST(WERROR_CFLAGS)
c906108c
SS
821
822
823dnl Generate the Makefile in a target specific directory.
824dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
825dnl so this is a cover macro to tuck the details away of how we cope.
826dnl We cope by having autoconf generate two files and then merge them into
827dnl one afterwards. The two pieces of the common fragment are inserted into
828dnl the target's fragment at the appropriate points.
829
830AC_DEFUN(SIM_AC_OUTPUT,
831[
832AC_LINK_FILES($sim_link_files, $sim_link_links)
833AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in,
834[case "x$CONFIG_FILES" in
835 xMakefile*)
836 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
837 rm -f Makesim1.tmp Makesim2.tmp Makefile
838 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
839 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
840 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
841 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
842 <Makefile.sim >Makefile
843 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
844 ;;
845 esac
846 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
847])
848])
849
850# This file is derived from `gettext.m4'. The difference is that the
851# included macros assume Cygnus-style source and build trees.
852
853# Macro to add for using GNU gettext.
854# Ulrich Drepper <drepper@cygnus.com>, 1995.
855#
856# This file file be copied and used freely without restrictions. It can
857# be used in projects which are not available under the GNU Public License
858# but which still want to provide support for the GNU gettext functionality.
859# Please note that the actual code is *not* freely available.
860
861# serial 3
862
863AC_DEFUN(CY_WITH_NLS,
864 [AC_MSG_CHECKING([whether NLS is requested])
865 dnl Default is enabled NLS
866 AC_ARG_ENABLE(nls,
867 [ --disable-nls do not use Native Language Support],
868 USE_NLS=$enableval, USE_NLS=yes)
869 AC_MSG_RESULT($USE_NLS)
870 AC_SUBST(USE_NLS)
871
872 USE_INCLUDED_LIBINTL=no
873
874 dnl If we use NLS figure out what method
875 if test "$USE_NLS" = "yes"; then
876 AC_DEFINE(ENABLE_NLS)
877 AC_MSG_CHECKING([whether included gettext is requested])
878 AC_ARG_WITH(included-gettext,
879 [ --with-included-gettext use the GNU gettext library included here],
880 nls_cv_force_use_gnu_gettext=$withval,
881 nls_cv_force_use_gnu_gettext=no)
882 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
883
884 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
885 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
886 dnl User does not insist on using GNU NLS library. Figure out what
887 dnl to use. If gettext or catgets are available (in this order) we
888 dnl use this. Else we have to fall back to GNU NLS library.
889 dnl catgets is only used if permitted by option --with-catgets.
890 nls_cv_header_intl=
891 nls_cv_header_libgt=
892 CATOBJEXT=NONE
893
894 AC_CHECK_HEADER(libintl.h,
895 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
896 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
897 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
898
899 if test "$gt_cv_func_gettext_libc" != "yes"; then
900 AC_CHECK_LIB(intl, bindtextdomain,
901 [AC_CACHE_CHECK([for gettext in libintl],
902 gt_cv_func_gettext_libintl,
903 [AC_TRY_LINK([], [return (int) gettext ("")],
904 gt_cv_func_gettext_libintl=yes,
905 gt_cv_func_gettext_libintl=no)])])
906 fi
907
908 if test "$gt_cv_func_gettext_libc" = "yes" \
909 || test "$gt_cv_func_gettext_libintl" = "yes"; then
910 AC_DEFINE(HAVE_GETTEXT)
911 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
912 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
913 if test "$MSGFMT" != "no"; then
914 AC_CHECK_FUNCS(dcgettext)
915 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
916 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
917 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
918 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
919 return _nl_msg_cat_cntr],
920 [CATOBJEXT=.gmo
921 DATADIRNAME=share],
922 [CATOBJEXT=.mo
923 DATADIRNAME=lib])
924 INSTOBJEXT=.mo
925 fi
926 fi
927 ])
928
929 dnl In the standard gettext, we would now check for catgets.
930 dnl However, we never want to use catgets for our releases.
931
932 if test "$CATOBJEXT" = "NONE"; then
933 dnl Neither gettext nor catgets in included in the C library.
934 dnl Fall back on GNU gettext library.
935 nls_cv_use_gnu_gettext=yes
936 fi
937 fi
938
939 if test "$nls_cv_use_gnu_gettext" = "yes"; then
940 dnl Mark actions used to generate GNU NLS library.
941 INTLOBJS="\$(GETTOBJS)"
942 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
943 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
944 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
945 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
946 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
947 AC_SUBST(MSGFMT)
948 USE_INCLUDED_LIBINTL=yes
949 CATOBJEXT=.gmo
950 INSTOBJEXT=.mo
951 DATADIRNAME=share
952 INTLDEPS='$(top_builddir)/../intl/libintl.a'
953 INTLLIBS=$INTLDEPS
954 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
955 nls_cv_header_intl=libintl.h
956 nls_cv_header_libgt=libgettext.h
957 fi
958
959 dnl Test whether we really found GNU xgettext.
960 if test "$XGETTEXT" != ":"; then
961 dnl If it is no GNU xgettext we define it as : so that the
962 dnl Makefiles still can work.
963 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
964 : ;
965 else
966 AC_MSG_RESULT(
967 [found xgettext programs is not GNU xgettext; ignore it])
968 XGETTEXT=":"
969 fi
970 fi
971
972 # We need to process the po/ directory.
973 POSUB=po
974 else
975 DATADIRNAME=share
976 nls_cv_header_intl=libintl.h
977 nls_cv_header_libgt=libgettext.h
978 fi
979
980 # If this is used in GNU gettext we have to set USE_NLS to `yes'
981 # because some of the sources are only built for this goal.
982 if test "$PACKAGE" = gettext; then
983 USE_NLS=yes
984 USE_INCLUDED_LIBINTL=yes
985 fi
986
987 dnl These rules are solely for the distribution goal. While doing this
988 dnl we only have to keep exactly one list of the available catalogs
989 dnl in configure.in.
990 for lang in $ALL_LINGUAS; do
991 GMOFILES="$GMOFILES $lang.gmo"
992 POFILES="$POFILES $lang.po"
993 done
994
995 dnl Make all variables we use known to autoconf.
996 AC_SUBST(USE_INCLUDED_LIBINTL)
997 AC_SUBST(CATALOGS)
998 AC_SUBST(CATOBJEXT)
999 AC_SUBST(DATADIRNAME)
1000 AC_SUBST(GMOFILES)
1001 AC_SUBST(INSTOBJEXT)
1002 AC_SUBST(INTLDEPS)
1003 AC_SUBST(INTLLIBS)
1004 AC_SUBST(INTLOBJS)
1005 AC_SUBST(POFILES)
1006 AC_SUBST(POSUB)
1007 ])
1008
1009AC_DEFUN(CY_GNU_GETTEXT,
1010 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1011 AC_REQUIRE([AC_PROG_CC])dnl
1012 AC_REQUIRE([AC_PROG_RANLIB])dnl
1013 AC_REQUIRE([AC_ISC_POSIX])dnl
1014 AC_REQUIRE([AC_HEADER_STDC])dnl
1015 AC_REQUIRE([AC_C_CONST])dnl
1016 AC_REQUIRE([AC_C_INLINE])dnl
1017 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1018 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1019 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1020 AC_REQUIRE([AC_FUNC_MMAP])dnl
1021
1022 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1023unistd.h values.h sys/param.h])
1024 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1025__argz_count __argz_stringify __argz_next])
1026
1027 if test "${ac_cv_func_stpcpy+set}" != "set"; then
1028 AC_CHECK_FUNCS(stpcpy)
1029 fi
1030 if test "${ac_cv_func_stpcpy}" = "yes"; then
1031 AC_DEFINE(HAVE_STPCPY)
1032 fi
1033
1034 AM_LC_MESSAGES
1035 CY_WITH_NLS
1036
1037 if test "x$CATOBJEXT" != "x"; then
1038 if test "x$ALL_LINGUAS" = "x"; then
1039 LINGUAS=
1040 else
1041 AC_MSG_CHECKING(for catalogs to be installed)
1042 NEW_LINGUAS=
1043 for lang in ${LINGUAS=$ALL_LINGUAS}; do
1044 case "$ALL_LINGUAS" in
1045 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1046 esac
1047 done
1048 LINGUAS=$NEW_LINGUAS
1049 AC_MSG_RESULT($LINGUAS)
1050 fi
1051
1052 dnl Construct list of names of catalog files to be constructed.
1053 if test -n "$LINGUAS"; then
1054 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1055 fi
1056 fi
1057
1058 dnl The reference to <locale.h> in the installed <libintl.h> file
1059 dnl must be resolved because we cannot expect the users of this
1060 dnl to define HAVE_LOCALE_H.
1061 if test $ac_cv_header_locale_h = yes; then
1062 INCLUDE_LOCALE_H="#include <locale.h>"
1063 else
1064 INCLUDE_LOCALE_H="\
1065/* The system does not provide the header <locale.h>. Take care yourself. */"
1066 fi
1067 AC_SUBST(INCLUDE_LOCALE_H)
1068
1069 dnl Determine which catalog format we have (if any is needed)
1070 dnl For now we know about two different formats:
1071 dnl Linux libc-5 and the normal X/Open format
1072 if test -f $srcdir/po2tbl.sed.in; then
1073 if test "$CATOBJEXT" = ".cat"; then
1074 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1075
1076 dnl Transform the SED scripts while copying because some dumb SEDs
1077 dnl cannot handle comments.
1078 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
1079 fi
1080 dnl po2tbl.sed is always needed.
1081 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
1082 $srcdir/po2tbl.sed.in > po2tbl.sed
1083 fi
1084
1085 dnl In the intl/Makefile.in we have a special dependency which makes
1086 dnl only sense for gettext. We comment this out for non-gettext
1087 dnl packages.
1088 if test "$PACKAGE" = "gettext"; then
1089 GT_NO="#NO#"
1090 GT_YES=
1091 else
1092 GT_NO=
1093 GT_YES="#YES#"
1094 fi
1095 AC_SUBST(GT_NO)
1096 AC_SUBST(GT_YES)
1097
1098 MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
1099 AC_SUBST(MKINSTALLDIRS)
1100
1101 dnl *** For now the libtool support in intl/Makefile is not for real.
1102 l=
1103 AC_SUBST(l)
1104
1105 dnl Generate list of files to be processed by xgettext which will
1106 dnl be included in po/Makefile. But only do this if the po directory
1107 dnl exists in srcdir.
1108 if test -d $srcdir/po; then
1109 test -d po || mkdir po
1110 if test "x$srcdir" != "x."; then
1111 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1112 posrcprefix="$srcdir/"
1113 else
1114 posrcprefix="../$srcdir/"
1115 fi
1116 else
1117 posrcprefix="../"
1118 fi
1119 rm -f po/POTFILES
1120 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1121 < $srcdir/po/POTFILES.in > po/POTFILES
1122 fi
1123 ])
1124
1125# Search path for a program which passes the given test.
1126# Ulrich Drepper <drepper@cygnus.com>, 1996.
1127#
1128# This file file be copied and used freely without restrictions. It can
1129# be used in projects which are not available under the GNU Public License
1130# but which still want to provide support for the GNU gettext functionality.
1131# Please note that the actual code is *not* freely available.
1132
1133# serial 1
1134
1135dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1136dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1137AC_DEFUN(AM_PATH_PROG_WITH_TEST,
1138[# Extract the first word of "$2", so it can be a program name with args.
1139set dummy $2; ac_word=[$]2
1140AC_MSG_CHECKING([for $ac_word])
1141AC_CACHE_VAL(ac_cv_path_$1,
1142[case "[$]$1" in
1143 /*)
1144 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1145 ;;
1146 *)
1147 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1148 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1149 test -z "$ac_dir" && ac_dir=.
1150 if test -f $ac_dir/$ac_word; then
1151 if [$3]; then
1152 ac_cv_path_$1="$ac_dir/$ac_word"
1153 break
1154 fi
1155 fi
1156 done
1157 IFS="$ac_save_ifs"
1158dnl If no 4th arg is given, leave the cache variable unset,
1159dnl so AC_PATH_PROGS will keep looking.
1160ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1161])dnl
1162 ;;
1163esac])dnl
1164$1="$ac_cv_path_$1"
1165if test -n "[$]$1"; then
1166 AC_MSG_RESULT([$]$1)
1167else
1168 AC_MSG_RESULT(no)
1169fi
1170AC_SUBST($1)dnl
1171])
1172
1173# Check whether LC_MESSAGES is available in <locale.h>.
1174# Ulrich Drepper <drepper@cygnus.com>, 1995.
1175#
1176# This file file be copied and used freely without restrictions. It can
1177# be used in projects which are not available under the GNU Public License
1178# but which still want to provide support for the GNU gettext functionality.
1179# Please note that the actual code is *not* freely available.
1180
1181# serial 1
1182
1183AC_DEFUN(AM_LC_MESSAGES,
1184 [if test $ac_cv_header_locale_h = yes; then
1185 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1186 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1187 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1188 if test $am_cv_val_LC_MESSAGES = yes; then
1189 AC_DEFINE(HAVE_LC_MESSAGES)
1190 fi
1191 fi])
1192
c906108c
SS
1193
1194dnl --enable-cgen-maint support
1195AC_DEFUN(SIM_AC_OPTION_CGEN_MAINT,
1196[
1197cgen_maint=no
1198dnl Default is to use one in build tree.
1199cgen=../../cgen/cgen
1200cgendir='$(srcdir)/../../cgen'
1201dnl Having --enable-maintainer-mode take arguments is another way to go.
1202dnl ??? One can argue --with is more appropriate if one wants to specify
1203dnl a directory name, but what we're doing here is an enable/disable kind
1204dnl of thing and specifying both --enable and --with is klunky.
1205dnl If you reeely want this to be --with, go ahead and change it.
1206AC_ARG_ENABLE(cgen-maint,
1207[ --enable-cgen-maint[=DIR] build cgen generated files],
1208[case "${enableval}" in
1209 yes) cgen_maint=yes ;;
1210 no) cgen_maint=no ;;
1211 *)
1212 # argument is cgen install directory (not implemented yet).
1213 # Having a `share' directory might be more appropriate for the .scm,
1214 # .cpu, etc. files.
1215 cgendir=${cgen_maint}/lib/cgen
1216 cgen=${cgendir}/bin/cgen
1217 ;;
1218esac])dnl
1219dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno)
1220if test x${cgen_maint} != xno ; then
1221 CGEN_MAINT=''
1222else
1223 CGEN_MAINT='#'
1224fi
1225AC_SUBST(CGEN_MAINT)
1226AC_SUBST(cgendir)
1227AC_SUBST(cgen)
1228])
This page took 0.084438 seconds and 4 git commands to generate.