]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/aclocal.m4
safe-ctype.h (HC_UNKNOWN, [...]): New #defines.
[thirdparty/gcc.git] / gcc / aclocal.m4
CommitLineData
4665e56c 1sinclude(../config/acx.m4)
4977bab6
ZW
2sinclude(../config/accross.m4)
3
827ae6cf
RO
4dnl See if stdbool.h properly defines bool and true/false.
5AC_DEFUN(gcc_AC_HEADER_STDBOOL,
6[AC_CACHE_CHECK([for working stdbool.h],
7 ac_cv_header_stdbool_h,
8[AC_TRY_COMPILE([#include <stdbool.h>],
9[bool foo = false;],
10ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
11if test $ac_cv_header_stdbool_h = yes; then
12 AC_DEFINE(HAVE_STDBOOL_H, 1,
13 [Define if you have a working <stdbool.h> header file.])
14fi
15])
16
17dnl See whether we can include both string.h and strings.h.
99e757d5 18AC_DEFUN(gcc_AC_HEADER_STRING,
ccc7d11a
KG
19[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
20 gcc_cv_header_string,
21[AC_TRY_COMPILE([#include <string.h>
22#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
23if test $gcc_cv_header_string = yes; then
91029a29 24 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
ccc7d11a
KG
25fi
26])
27
2f51182a 28dnl See whether we need a declaration for a function.
86cf1cbd
KG
29dnl The result is highly dependent on the INCLUDES passed in, so make sure
30dnl to use a different cache variable name in this macro if it is invoked
31dnl in a different context somewhere else.
f31e826b
KG
32dnl gcc_AC_CHECK_DECL(SYMBOL,
33dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
34AC_DEFUN(gcc_AC_CHECK_DECL,
35[AC_MSG_CHECKING([whether $1 is declared])
36AC_CACHE_VAL(gcc_cv_have_decl_$1,
37[AC_TRY_COMPILE([$4],
86cf1cbd
KG
38[#ifndef $1
39char *(*pfn) = (char *(*)) $1 ;
f31e826b
KG
40#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
41if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
42 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
a81fb89e 43else
f31e826b 44 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
2f51182a
DE
45fi
46])dnl
ac64120e 47
a81fb89e 48dnl Check multiple functions to see whether each needs a declaration.
f31e826b
KG
49dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
50dnl gcc_AC_CHECK_DECLS(SYMBOLS,
51dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
52AC_DEFUN(gcc_AC_CHECK_DECLS,
a81fb89e
KG
53[for ac_func in $1
54do
f31e826b
KG
55changequote(, )dnl
56 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
86cf1cbd 57changequote([, ])dnl
f31e826b
KG
58gcc_AC_CHECK_DECL($ac_func,
59 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
60 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
7afe8c41
KG
61dnl It is possible that the include files passed in here are local headers
62dnl which supply a backup declaration for the relevant prototype based on
63dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
64dnl will always return success. E.g. see libiberty.h's handling of
65dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
66dnl 1 so that any local headers used do not provide their own prototype
67dnl during this test.
68#undef $ac_tr_decl
69#define $ac_tr_decl 1
f31e826b
KG
70 $4
71)
a81fb89e 72done
86cf1cbd
KG
73dnl Automatically generate config.h entries via autoheader.
74if test x = y ; then
75 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
05e12634
ZW
76 [AC_DEFINE([HAVE_DECL_\&], 1,
77 [Define to 1 if we found this declaration otherwise define to 0.])])dnl
86cf1cbd 78fi
a81fb89e
KG
79])
80
f1b54f9b 81dnl See if the printf functions in libc support %p in format strings.
99e757d5 82AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
f1b54f9b
KG
83[AC_CACHE_CHECK(whether the printf functions support %p,
84 gcc_cv_func_printf_ptr,
85[AC_TRY_RUN([#include <stdio.h>
86
86cf1cbd 87int main()
f1b54f9b
KG
88{
89 char buf[64];
90 char *p = buf, *q = NULL;
91 sprintf(buf, "%p", p);
92 sscanf(buf, "%p", &q);
86cf1cbd 93 return (p != q);
f1b54f9b
KG
94}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
95 gcc_cv_func_printf_ptr=no)
96rm -f core core.* *.core])
97if test $gcc_cv_func_printf_ptr = yes ; then
91029a29 98 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
f1b54f9b
KG
99fi
100])
101
ac64120e 102dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
99e757d5 103AC_DEFUN(gcc_AC_PROG_LN_S,
ac64120e
JW
104[AC_MSG_CHECKING(whether ln -s works)
105AC_CACHE_VAL(gcc_cv_prog_LN_S,
e566af04
MH
106[rm -f conftestdata_t
107echo >conftestdata_f
108if ln -s conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
109then
110 gcc_cv_prog_LN_S="ln -s"
111else
e566af04 112 if ln conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
113 then
114 gcc_cv_prog_LN_S=ln
115 else
116 gcc_cv_prog_LN_S=cp
117 fi
118fi
e566af04 119rm -f conftestdata_f conftestdata_t
ac64120e
JW
120])dnl
121LN_S="$gcc_cv_prog_LN_S"
122if test "$gcc_cv_prog_LN_S" = "ln -s"; then
123 AC_MSG_RESULT(yes)
124else
125 if test "$gcc_cv_prog_LN_S" = "ln"; then
126 AC_MSG_RESULT([no, using ln])
127 else
128 AC_MSG_RESULT([no, and neither does ln, so using cp])
129 fi
130fi
131AC_SUBST(LN_S)dnl
132])
133
134dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
99e757d5 135AC_DEFUN(gcc_AC_PROG_LN,
ac64120e
JW
136[AC_MSG_CHECKING(whether ln works)
137AC_CACHE_VAL(gcc_cv_prog_LN,
e566af04
MH
138[rm -f conftestdata_t
139echo >conftestdata_f
140if ln conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
141then
142 gcc_cv_prog_LN="ln"
143else
e566af04 144 if ln -s conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
145 then
146 gcc_cv_prog_LN="ln -s"
147 else
148 gcc_cv_prog_LN=cp
149 fi
150fi
e566af04 151rm -f conftestdata_f conftestdata_t
ac64120e
JW
152])dnl
153LN="$gcc_cv_prog_LN"
154if test "$gcc_cv_prog_LN" = "ln"; then
155 AC_MSG_RESULT(yes)
156else
157 if test "$gcc_cv_prog_LN" = "ln -s"; then
158 AC_MSG_RESULT([no, using ln -s])
159 else
160 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
161 fi
162fi
163AC_SUBST(LN)dnl
164])
76143254 165
827ae6cf
RO
166dnl Check whether _Bool is built-in.
167AC_DEFUN(gcc_AC_C__BOOL,
168[AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
169[AC_TRY_COMPILE(,
170[_Bool foo;],
171gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
172])
173if test $gcc_cv_c__bool = yes; then
174 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
175fi
176])
177
75923b2f
MK
178dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
179dnl of the usual 2.
99e757d5 180AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
75923b2f
MK
181[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
182[AC_TRY_COMPILE([
183#include <sys/types.h>
184#ifdef HAVE_SYS_STAT_H
185# include <sys/stat.h>
186#endif
187#ifdef HAVE_UNISTD_H
188# include <unistd.h>
189#endif
190#ifdef HAVE_DIRECT_H
191# include <direct.h>
192#endif], [mkdir ("foo", 0);],
193 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
194if test $gcc_cv_mkdir_takes_one_arg = yes ; then
91029a29 195 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
75923b2f
MK
196fi
197])
198
99e757d5 199AC_DEFUN(gcc_AC_PROG_INSTALL,
76143254
JL
200[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
201# Find a good install program. We prefer a C program (faster),
202# so one script is as good as another. But avoid the broken or
203# incompatible versions:
204# SysV /etc/install, /usr/sbin/install
205# SunOS /usr/etc/install
206# IRIX /sbin/install
207# AIX /bin/install
208# AFS /usr/afsws/bin/install, which mishandles nonexistent args
209# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
210# ./install, which can be erroneously created by make from ./install.sh.
211AC_MSG_CHECKING(for a BSD compatible install)
212if test -z "$INSTALL"; then
213AC_CACHE_VAL(ac_cv_path_install,
214[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
215 for ac_dir in $PATH; do
216 # Account for people who put trailing slashes in PATH elements.
217 case "$ac_dir/" in
218 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
219 *)
220 # OSF1 and SCO ODT 3.0 have their own names for install.
221 for ac_prog in ginstall scoinst install; do
222 if test -f $ac_dir/$ac_prog; then
223 if test $ac_prog = install &&
224 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
225 # AIX install. It has an incompatible calling convention.
226 # OSF/1 installbsd also uses dspmsg, but is usable.
227 :
228 else
229 ac_cv_path_install="$ac_dir/$ac_prog -c"
230 break 2
231 fi
232 fi
233 done
234 ;;
235 esac
236 done
237 IFS="$ac_save_IFS"
238])dnl
239 if test "${ac_cv_path_install+set}" = set; then
240 INSTALL="$ac_cv_path_install"
241 else
242 # As a last resort, use the slow shell script. We don't cache a
243 # path for INSTALL within a source directory, because that will
244 # break other packages using the cache if that directory is
245 # removed, or if the path is relative.
246 INSTALL="$ac_install_sh"
247 fi
248fi
249dnl We do special magic for INSTALL instead of AC_SUBST, to get
250dnl relative paths right.
251AC_MSG_RESULT($INSTALL)
5643c767 252AC_SUBST(INSTALL)dnl
76143254
JL
253
254# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
255# It thinks the first close brace ends the variable substitution.
256test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
257AC_SUBST(INSTALL_PROGRAM)dnl
258
259test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
260AC_SUBST(INSTALL_DATA)dnl
261])
ab87f8c8 262
67f28219
ZW
263dnl Test for GNAT.
264dnl We require the gnatbind program, and a compiler driver that
265dnl understands Ada. The user may set the driver name explicitly
266dnl with ADAC; also, the user's CC setting is tried. Failing that,
267dnl we try gcc and cc, then a sampling of names known to be used for
268dnl the Ada driver on various systems.
269dnl
270dnl Sets the shell variable have_gnat to yes or no as appropriate, and
271dnl substitutes GNATBIND and ADAC.
272AC_DEFUN([gcc_AC_PROG_GNAT],
273[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
274AC_CHECK_TOOL(GNATBIND, gnatbind, no)
275AC_CACHE_CHECK([for compiler driver that understands Ada],
276 gcc_cv_prog_adac,
277[cat >conftest.adb <<EOF
278procedure conftest is begin null; end conftest;
279EOF
280gcc_cv_prog_adac=no
281# Have to do ac_tool_prefix and user overrides by hand.
eb4b5f93 282for cand in ${ADAC+"$ADAC"} ${CC+"$CC"} \
67f28219
ZW
283 ${ac_tool_prefix}gcc gcc \
284 ${ac_tool_prefix}cc cc \
285 ${ac_tool_prefix}gnatgcc gnatgcc \
286 ${ac_tool_prefix}gnatcc gnatcc \
287 ${ac_tool_prefix}adagcc adagcc \
288 ${ac_tool_prefix}adacc adacc ; do
289 # There is a bug in all released versions of GCC which causes the
290 # driver to exit successfully when the appropriate language module
291 # has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
292 # Therefore we must check for the error message as well as an
293 # unsuccessful exit.
7be33370 294 errors=`($cand -c conftest.adb) 2>&1 || echo failure`
67f28219
ZW
295 if test x"$errors" = x; then
296 gcc_cv_prog_adac=$cand
297 break
298 fi
299done
300rm -f conftest.*])
301ADAC=$gcc_cv_prog_adac
302AC_SUBST(ADAC)
303
304if test x$GNATBIND != xno && test x$ADAC != xno; then
305 have_gnat=yes
306else
307 have_gnat=no
308fi
309])
310
ab87f8c8
JL
311#serial 1
312dnl This test replaces the one in autoconf.
313dnl Currently this macro should have the same name as the autoconf macro
314dnl because gettext's gettext.m4 (distributed in the automake package)
315dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
316dnl give these diagnostics:
317dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
318dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
319
320undefine([AC_ISC_POSIX])
321AC_DEFUN(AC_ISC_POSIX,
322 [
323 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
324 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
325 ]
326)
327
00036f5c
PT
328
329dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
330dnl like AC_PATH_PROG but use other cache variables
331AC_DEFUN(GCC_PATH_PROG,
332[# Extract the first word of "$2", so it can be a program name with args.
333set dummy $2; ac_word=[$]2
334AC_MSG_CHECKING([for $ac_word])
335AC_CACHE_VAL(gcc_cv_path_$1,
336[case "[$]$1" in
337 /*)
338 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
339 ;;
340 ?:/*)
341 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
342 ;;
343 *)
344 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
345dnl $ac_dummy forces splitting on constant user-supplied paths.
346dnl POSIX.2 word splitting is done only on the output of word expansions,
347dnl not every word. This closes a longstanding sh security hole.
348 ac_dummy="ifelse([$4], , $PATH, [$4])"
349 for ac_dir in $ac_dummy; do
350 test -z "$ac_dir" && ac_dir=.
351 if test -f $ac_dir/$ac_word; then
352 gcc_cv_path_$1="$ac_dir/$ac_word"
353 break
354 fi
355 done
356 IFS="$ac_save_ifs"
357dnl If no 3rd arg is given, leave the cache variable unset,
358dnl so GCC_PATH_PROGS will keep looking.
359ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
360])dnl
361 ;;
362esac])dnl
363$1="$gcc_cv_path_$1"
364if test -n "[$]$1"; then
365 AC_MSG_RESULT([$]$1)
366else
367 AC_MSG_RESULT(no)
368fi
369AC_SUBST($1)dnl
370])
371
1072ec3f
ZW
372# mmap(2) blacklisting. Some platforms provide the mmap library routine
373# but don't support all of the features we need from it.
374AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
375[if test $ac_cv_header_sys_mman_h != yes \
376 || test $ac_cv_func_mmap != yes; then
377 gcc_cv_func_mmap_file=no
378 gcc_cv_func_mmap_dev_zero=no
379 gcc_cv_func_mmap_anon=no
380else
381 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
382 gcc_cv_func_mmap_file,
383 [# Add a system to this blacklist if
384 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
385 # memory area containing the same data that you'd get if you applied
386 # read() to the same fd. The only system known to have a problem here
387 # is VMS, where text files have record structure.
388 case "$host_os" in
389 vms*)
390 gcc_cv_func_mmap_file=no ;;
391 *)
392 gcc_cv_func_mmap_file=yes;;
393 esac])
394 AC_CACHE_CHECK([whether mmap from /dev/zero works],
395 gcc_cv_func_mmap_dev_zero,
396 [# Add a system to this blacklist if it has mmap() but /dev/zero
397 # does not exist, or if mmapping /dev/zero does not give anonymous
398 # zeroed pages with both the following properties:
399 # 1. If you map N consecutive pages in with one call, and then
400 # unmap any subset of those pages, the pages that were not
401 # explicitly unmapped remain accessible.
402 # 2. If you map two adjacent blocks of memory and then unmap them
403 # both at once, they must both go away.
404 # Systems known to be in this category are Windows (all variants),
405 # VMS, and Darwin.
406 case "$host_os" in
407 vms* | cygwin* | pe | mingw* | darwin*)
408 gcc_cv_func_mmap_dev_zero=no ;;
409 *)
410 gcc_cv_func_mmap_dev_zero=yes;;
411 esac])
412
413 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
414 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
415 [AC_TRY_COMPILE(
416[#include <sys/types.h>
4acab94b 417#include <sys/mman.h>
1072ec3f 418#include <unistd.h>
825b6926 419
1072ec3f
ZW
420#ifndef MAP_ANONYMOUS
421#define MAP_ANONYMOUS MAP_ANON
825b6926 422#endif
1072ec3f
ZW
423],
424[int n = MAP_ANONYMOUS;],
425 gcc_cv_decl_map_anon=yes,
426 gcc_cv_decl_map_anon=no)])
427
428 if test $gcc_cv_decl_map_anon = no; then
429 gcc_cv_func_mmap_anon=no
430 else
431 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
432 gcc_cv_func_mmap_anon,
433 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
434 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
435 # doesn't give anonymous zeroed pages with the same properties listed
436 # above for use of /dev/zero.
437 # Systems known to be in this category are Windows, VMS, and SCO Unix.
438 case "$host_os" in
439 vms* | cygwin* | pe | mingw* | sco* | udk* )
440 gcc_cv_func_mmap_anon=no ;;
441 *)
442 gcc_cv_func_mmap_anon=yes;;
443 esac])
444 fi
825b6926
ZW
445fi
446
1072ec3f 447if test $gcc_cv_func_mmap_file = yes; then
56f02b88
ZW
448 AC_DEFINE(HAVE_MMAP_FILE, 1,
449 [Define if read-only mmap of a plain file works.])
450fi
1072ec3f
ZW
451if test $gcc_cv_func_mmap_dev_zero = yes; then
452 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
453 [Define if mmap of /dev/zero works.])
454fi
455if test $gcc_cv_func_mmap_anon = yes; then
456 AC_DEFINE(HAVE_MMAP_ANON, 1,
457 [Define if mmap with MAP_ANON(YMOUS) works.])
458fi
56f02b88 459])
09fa0705
ZW
460
461dnl Locate a program and check that its version is acceptable.
462dnl AC_PROG_CHECK_VER(var, name, version-switch,
463dnl version-extract-regexp, version-glob)
464AC_DEFUN(gcc_AC_CHECK_PROG_VER,
465[AC_CHECK_PROG([$1], [$2], [$2])
466if test -n "[$]$1"; then
467 # Found it, now check the version.
468 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
469[changequote(<<,>>)dnl
470 ac_prog_version=`<<$>>$1 $3 2>&1 |
471 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
05e12634 472changequote([,])dnl
09fa0705 473 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
05e12634 474changequote(<<,>>)dnl
09fa0705
ZW
475 case $ac_prog_version in
476 '') gcc_cv_prog_$2_modern=no;;
477 <<$5>>)
478 gcc_cv_prog_$2_modern=yes;;
479 *) gcc_cv_prog_$2_modern=no;;
480 esac
481changequote([,])dnl
482])
483else
484 gcc_cv_prog_$2_modern=no
485fi
486])
75e93faa
ZW
487
488dnl Determine if enumerated bitfields are unsigned. ISO C says they can
489dnl be either signed or unsigned.
490dnl
491AC_DEFUN(gcc_AC_C_ENUM_BF_UNSIGNED,
492[AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
493[AC_TRY_RUN(#include <stdlib.h>
494enum t { BLAH = 128 } ;
495struct s_t { enum t member : 8; } s ;
496int main(void)
497{
498 s.member = BLAH;
499 if (s.member < 0) exit(1);
500 exit(0);
501
502}, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
503if test $gcc_cv_enum_bf_unsigned = yes; then
504 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
505 [Define if enumerated bitfields are treated as unsigned values.])
506fi])
507
75e93faa
ZW
508dnl Probe number of bits in a byte.
509dnl Note C89 requires CHAR_BIT >= 8.
510dnl
511AC_DEFUN(gcc_AC_C_CHAR_BIT,
512[AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
513[AC_EGREP_CPP(found,
514[#ifdef HAVE_LIMITS_H
515#include <limits.h>
516#endif
517#ifdef CHAR_BIT
518found
519#endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
520])
521if test $gcc_cv_decl_char_bit = no; then
522 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
523[i=8
524 gcc_cv_c_nbby=
525 while test $i -lt 65; do
526 AC_TRY_COMPILE(,
4e70264f
ZW
527 [switch(0) {
528 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
529 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
530 ; }],
531 [gcc_cv_c_nbby=$i; break])
75e93faa
ZW
532 i=`expr $i + 1`
533 done
534 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
535])
536if test $gcc_cv_c_nbby = failed; then
537 AC_MSG_ERROR(cannot determine number of bits in a byte)
538else
539 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
540 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
541fi
542fi])
543
544dnl Checking for long long.
545dnl By Caolan McNamara <caolan@skynet.ie>
546dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
547dnl
548AC_DEFUN([gcc_AC_C_LONG_LONG],
549[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
550 [AC_TRY_COMPILE(,[long long int i;],
551 ac_cv_c_long_long=yes,
552 ac_cv_c_long_long=no)])
553 if test $ac_cv_c_long_long = yes; then
554 AC_DEFINE(HAVE_LONG_LONG, 1,
555 [Define if your compiler supports the \`long long' type.])
556 fi
557AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
558 [AC_TRY_COMPILE(,[__int64 i;],
559 ac_cv_c___int64=yes,
560 ac_cv_c___int64=no)])
561 if test $ac_cv_c___int64 = yes; then
562 AC_DEFINE(HAVE___INT64, 1,
563 [Define if your compiler supports the \`__int64' type.])
564 fi
565])
84c041a1 566
f91abfce
TT
567#serial AM2
568
569dnl From Bruno Haible.
570
571AC_DEFUN([AM_ICONV],
572[
573 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
574 dnl those with the standalone portable GNU libiconv installed).
575
b7f2fb96 576 am_cv_lib_iconv_ldpath=
f91abfce
TT
577 AC_ARG_WITH([libiconv-prefix],
578[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
579 for dir in `echo "$withval" | tr : ' '`; do
580 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
b7f2fb96 581 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
f91abfce
TT
582 done
583 ])
584
585 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
586 am_cv_func_iconv="no, consider installing GNU libiconv"
587 am_cv_lib_iconv=no
588 AC_TRY_LINK([#include <stdlib.h>
589#include <iconv.h>],
590 [iconv_t cd = iconv_open("","");
591 iconv(cd,NULL,NULL,NULL,NULL);
592 iconv_close(cd);],
593 am_cv_func_iconv=yes)
594 if test "$am_cv_func_iconv" != yes; then
595 am_save_LIBS="$LIBS"
b7f2fb96 596 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
f91abfce
TT
597 AC_TRY_LINK([#include <stdlib.h>
598#include <iconv.h>],
599 [iconv_t cd = iconv_open("","");
600 iconv(cd,NULL,NULL,NULL,NULL);
601 iconv_close(cd);],
602 am_cv_lib_iconv=yes
603 am_cv_func_iconv=yes)
604 LIBS="$am_save_LIBS"
605 fi
606 ])
607 if test "$am_cv_func_iconv" = yes; then
608 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
609 AC_MSG_CHECKING([for iconv declaration])
610 AC_CACHE_VAL(am_cv_proto_iconv, [
611 AC_TRY_COMPILE([
612#include <stdlib.h>
613#include <iconv.h>
614extern
615#ifdef __cplusplus
616"C"
617#endif
618#if defined(__STDC__) || defined(__cplusplus)
619size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
620#else
621size_t iconv();
622#endif
623], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
624 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
625 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
626 AC_MSG_RESULT([$]{ac_t:-
627 }[$]am_cv_proto_iconv)
628 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
629 [Define as const if the declaration of iconv() needs const.])
630 fi
631 LIBICONV=
632 if test "$am_cv_lib_iconv" = yes; then
b7f2fb96 633 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
f91abfce
TT
634 fi
635 AC_SUBST(LIBICONV)
636])
71a94577
ZW
637
638### Gettext macros begin here.
639### Changes for GCC marked by 'dnl GCC LOCAL'.
640### Note iconv.m4 appears above, as it's used for other reasons.
641
642#serial AM1
643
644dnl From Bruno Haible.
645
646AC_DEFUN([AM_LANGINFO_CODESET],
647[
648 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
649 [AC_TRY_LINK([#include <langinfo.h>],
650 [char* cs = nl_langinfo(CODESET);],
651 am_cv_langinfo_codeset=yes,
652 am_cv_langinfo_codeset=no)
653 ])
654 if test $am_cv_langinfo_codeset = yes; then
655 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
656 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
657 fi
658])
659
660#serial 1
661# This test replaces the one in autoconf.
662# Currently this macro should have the same name as the autoconf macro
663# because gettext's gettext.m4 (distributed in the automake package)
664# still uses it. Otherwise, the use in gettext.m4 makes autoheader
665# give these diagnostics:
666# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
667# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
668
669undefine([AC_ISC_POSIX])
670
671AC_DEFUN([AC_ISC_POSIX],
672 [
673 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
674 dnl GCC LOCAL: Use AC_SEARCH_LIBS.
675 AC_SEARCH_LIBS(strerror, cposix)
676 ]
677)
678
679#serial 2
680
681# Test for the GNU C Library, version 2.1 or newer.
682# From Bruno Haible.
683
684AC_DEFUN([jm_GLIBC21],
685 [
686 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
687 ac_cv_gnu_library_2_1,
688 [AC_EGREP_CPP([Lucky GNU user],
689 [
690#include <features.h>
691#ifdef __GNU_LIBRARY__
692 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
693 Lucky GNU user
694 #endif
695#endif
696 ],
697 ac_cv_gnu_library_2_1=yes,
698 ac_cv_gnu_library_2_1=no)
699 ]
700 )
701 AC_SUBST(GLIBC21)
702 GLIBC21="$ac_cv_gnu_library_2_1"
703 ]
704)
705
706# Check whether LC_MESSAGES is available in <locale.h>.
707# Ulrich Drepper <drepper@cygnus.com>, 1995.
708#
709# This file can be copied and used freely without restrictions. It can
710# be used in projects which are not available under the GNU General Public
711# License or the GNU Library General Public License but which still want
712# to provide support for the GNU gettext functionality.
713# Please note that the actual code of the GNU gettext library is covered
714# by the GNU Library General Public License, and the rest of the GNU
715# gettext package package is covered by the GNU General Public License.
716# They are *not* in the public domain.
717
718# serial 2
719
720AC_DEFUN([AM_LC_MESSAGES],
721 [if test $ac_cv_header_locale_h = yes; then
722 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
723 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
724 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
725 if test $am_cv_val_LC_MESSAGES = yes; then
726 AC_DEFINE(HAVE_LC_MESSAGES, 1,
727 [Define if your <locale.h> file defines LC_MESSAGES.])
728 fi
729 fi])
730
731# Search path for a program which passes the given test.
732# Ulrich Drepper <drepper@cygnus.com>, 1996.
733#
734# This file can be copied and used freely without restrictions. It can
735# be used in projects which are not available under the GNU General Public
736# License or the GNU Library General Public License but which still want
737# to provide support for the GNU gettext functionality.
738# Please note that the actual code of the GNU gettext library is covered
739# by the GNU Library General Public License, and the rest of the GNU
740# gettext package package is covered by the GNU General Public License.
741# They are *not* in the public domain.
742
743# serial 2
744
745dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
746dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
747AC_DEFUN([AM_PATH_PROG_WITH_TEST],
748[# Extract the first word of "$2", so it can be a program name with args.
749set dummy $2; ac_word=[$]2
750AC_MSG_CHECKING([for $ac_word])
751AC_CACHE_VAL(ac_cv_path_$1,
752[case "[$]$1" in
753 /*)
754 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
755 ;;
756 *)
757 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
758 for ac_dir in ifelse([$5], , $PATH, [$5]); do
759 test -z "$ac_dir" && ac_dir=.
760 if test -f $ac_dir/$ac_word; then
761 if [$3]; then
762 ac_cv_path_$1="$ac_dir/$ac_word"
763 break
764 fi
765 fi
766 done
767 IFS="$ac_save_ifs"
768dnl If no 4th arg is given, leave the cache variable unset,
769dnl so AC_PATH_PROGS will keep looking.
770ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
771])dnl
772 ;;
773esac])dnl
774$1="$ac_cv_path_$1"
775if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
776 AC_MSG_RESULT([$]$1)
777else
778 AC_MSG_RESULT(no)
779fi
780AC_SUBST($1)dnl
781])
782
783# Macro to add for using GNU gettext.
784# Ulrich Drepper <drepper@cygnus.com>, 1995.
785#
786# This file can be copied and used freely without restrictions. It can
787# be used in projects which are not available under the GNU General Public
788# License or the GNU Library General Public License but which still want
789# to provide support for the GNU gettext functionality.
790# Please note that the actual code of the GNU gettext library is covered
791# by the GNU Library General Public License, and the rest of the GNU
792# gettext package package is covered by the GNU General Public License.
793# They are *not* in the public domain.
794
795# serial 10
796
797dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
798dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
799dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
800dnl depending on --{enable,disable}-{shared,static} and on the presence of
801dnl AM-DISABLE-SHARED). Otherwise, a static library
802dnl $(top_builddir)/intl/libintl.a will be created.
803dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
804dnl implementations (in libc or libintl) without the ngettext() function
805dnl will be ignored.
806dnl LIBDIR is used to find the intl libraries. If empty,
807dnl the value `$(top_builddir)/intl/' is used.
808dnl
809dnl The result of the configuration is one of three cases:
810dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
811dnl and used.
812dnl Catalog format: GNU --> install in $(datadir)
813dnl Catalog extension: .mo after installation, .gmo in source tree
814dnl 2) GNU gettext has been found in the system's C library.
815dnl Catalog format: GNU --> install in $(datadir)
816dnl Catalog extension: .mo after installation, .gmo in source tree
817dnl 3) No internationalization, always use English msgid.
818dnl Catalog format: none
819dnl Catalog extension: none
820dnl The use of .gmo is historical (it was needed to avoid overwriting the
821dnl GNU format catalogs when building on a platform with an X/Open gettext),
822dnl but we keep it in order not to force irrelevant filename changes on the
823dnl maintainers.
824dnl
825AC_DEFUN([AM_WITH_NLS],
826 [AC_MSG_CHECKING([whether NLS is requested])
827 dnl Default is enabled NLS
828 AC_ARG_ENABLE(nls,
829 [ --disable-nls do not use Native Language Support],
830 USE_NLS=$enableval, USE_NLS=yes)
831 AC_MSG_RESULT($USE_NLS)
832 AC_SUBST(USE_NLS)
833
834 BUILD_INCLUDED_LIBINTL=no
835 USE_INCLUDED_LIBINTL=no
77c06844 836dnl GCC LOCAL: Separate concept of link command line from dependencies.
71a94577 837 INTLLIBS=
77c06844 838 INTLDEPS=
71a94577
ZW
839
840 dnl If we use NLS figure out what method
841 if test "$USE_NLS" = "yes"; then
842 AC_DEFINE(ENABLE_NLS, 1,
843 [Define to 1 if translation of program messages to the user's native language
844 is requested.])
845 AC_MSG_CHECKING([whether included gettext is requested])
846 AC_ARG_WITH(included-gettext,
847 [ --with-included-gettext use the GNU gettext library included here],
848 nls_cv_force_use_gnu_gettext=$withval,
849 nls_cv_force_use_gnu_gettext=no)
850 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
851
852 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
853 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
854 dnl User does not insist on using GNU NLS library. Figure out what
855 dnl to use. If GNU gettext is available we use this. Else we have
856 dnl to fall back to GNU NLS library.
857 CATOBJEXT=NONE
858
859 dnl Add a version number to the cache macros.
860 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
861 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
862
191bf464 863dnl GCC LOCAL: Expose presence of libintl.h to C code.
71a94577 864 AC_CHECK_HEADER(libintl.h,
191bf464
ZW
865 [AC_DEFINE([HAVE_LIBINTL_H], 1,
866 [Define if you have the <libintl.h> header file.])
867 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
71a94577
ZW
868 [AC_TRY_LINK([#include <libintl.h>
869extern int _nl_msg_cat_cntr;],
870 [bindtextdomain ("", "");
871return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
872 gt_cv_func_gnugettext_libc=yes,
873 gt_cv_func_gnugettext_libc=no)])
874
875 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
876 AC_CACHE_CHECK([for GNU gettext in libintl],
877 gt_cv_func_gnugettext_libintl,
878 [gt_save_LIBS="$LIBS"
879 LIBS="$LIBS -lintl $LIBICONV"
880 AC_TRY_LINK([#include <libintl.h>
881extern int _nl_msg_cat_cntr;],
882 [bindtextdomain ("", "");
883return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
884 gt_cv_func_gnugettext_libintl=yes,
885 gt_cv_func_gnugettext_libintl=no)
886 LIBS="$gt_save_LIBS"])
887 fi
888
889 dnl If an already present or preinstalled GNU gettext() is found,
890 dnl use it. But if this macro is used in GNU gettext, and GNU
891 dnl gettext is already preinstalled in libintl, we update this
892 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
893 if test "$gt_cv_func_gnugettext_libc" = "yes" \
894 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
895 && test "$PACKAGE" != gettext; }; then
896 AC_DEFINE(HAVE_GETTEXT, 1,
897 [Define if the GNU gettext() function is already present or preinstalled.])
898
899 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
900 dnl If iconv() is in a separate libiconv library, then anyone
901 dnl linking with libintl{.a,.so} also needs to link with
902 dnl libiconv.
903 INTLLIBS="-lintl $LIBICONV"
904 fi
905
906 gt_save_LIBS="$LIBS"
907 LIBS="$LIBS $INTLLIBS"
908 AC_CHECK_FUNCS(dcgettext)
909 LIBS="$gt_save_LIBS"
910
911 dnl Search for GNU msgfmt in the PATH.
912 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
913 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
914 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
915
916 dnl Search for GNU xgettext in the PATH.
917 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
918 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
919
920 CATOBJEXT=.gmo
921 fi
922 ])
923
924 if test "$CATOBJEXT" = "NONE"; then
925 dnl GNU gettext is not found in the C library.
926 dnl Fall back on GNU gettext library.
927 nls_cv_use_gnu_gettext=yes
928 fi
929 fi
930
931 if test "$nls_cv_use_gnu_gettext" = "yes"; then
932 dnl Mark actions used to generate GNU NLS library.
933 INTLOBJS="\$(GETTOBJS)"
934 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
935 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
936 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
937 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
938 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
939 AC_SUBST(MSGFMT)
940 BUILD_INCLUDED_LIBINTL=yes
941 USE_INCLUDED_LIBINTL=yes
942 CATOBJEXT=.gmo
943 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
77c06844 944 INTLDEPS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a"
71a94577
ZW
945 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
946 fi
947
948 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
949 dnl Test whether we really found GNU msgfmt.
950 if test "$GMSGFMT" != ":"; then
951 dnl If it is no GNU msgfmt we define it as : so that the
952 dnl Makefiles still can work.
953 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
954 : ;
955 else
956 AC_MSG_RESULT(
957 [found msgfmt program is not GNU msgfmt; ignore it])
958 GMSGFMT=":"
959 fi
960 fi
961
962 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
963 dnl Test whether we really found GNU xgettext.
964 if test "$XGETTEXT" != ":"; then
965 dnl If it is no GNU xgettext we define it as : so that the
966 dnl Makefiles still can work.
967 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
968 : ;
969 else
970 AC_MSG_RESULT(
971 [found xgettext program is not GNU xgettext; ignore it])
972 XGETTEXT=":"
973 fi
974 fi
975
976 dnl We need to process the po/ directory.
977 POSUB=po
978 fi
979 AC_OUTPUT_COMMANDS(
980 [for ac_file in $CONFIG_FILES; do
981 # Support "outfile[:infile[:infile...]]"
982 case "$ac_file" in
983 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
984 esac
985 # PO directories have a Makefile.in generated from Makefile.in.in.
986 case "$ac_file" in */Makefile.in)
987 # Adjust a relative srcdir.
988 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
989 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
990 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
991 # In autoconf-2.13 it is called $ac_given_srcdir.
992 # In autoconf-2.50 it is called $srcdir.
993 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
994 case "$ac_given_srcdir" in
995 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
996 /*) top_srcdir="$ac_given_srcdir" ;;
997 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
998 esac
999 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1000 rm -f "$ac_dir/POTFILES"
1001 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1002 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1003 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1004 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1005 fi
1006 ;;
1007 esac
1008 done])
1009
1010
1011 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1012 dnl to 'yes' because some of the testsuite requires it.
1013 if test "$PACKAGE" = gettext; then
1014 BUILD_INCLUDED_LIBINTL=yes
1015 fi
1016
1017 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1018 dnl because plural.y uses bison specific features. It requires at least
1019 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1020 dnl compile.
1021 dnl bison is only needed for the maintainer (who touches plural.y). But in
1022 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1023 dnl the rule in general Makefile. Now, some people carelessly touch the
1024 dnl files or have a broken "make" program, hence the plural.c rule will
1025 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1026 dnl present or too old.
1027 AC_CHECK_PROGS([INTLBISON], [bison])
1028 if test -z "$INTLBISON"; then
1029 ac_verc_fail=yes
1030 else
1031 dnl Found it, now check the version.
1032 AC_MSG_CHECKING([version of bison])
1033changequote(<<,>>)dnl
1034 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1035 case $ac_prog_version in
1036 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1037 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1038changequote([,])dnl
1039 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1040 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1041 esac
1042 AC_MSG_RESULT([$ac_prog_version])
1043 fi
1044 if test $ac_verc_fail = yes; then
1045 INTLBISON=:
1046 fi
1047
9f6682b7 1048 dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
71a94577
ZW
1049
1050 dnl Make all variables we use known to autoconf.
1051 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1052 AC_SUBST(USE_INCLUDED_LIBINTL)
1053 AC_SUBST(CATALOGS)
1054 AC_SUBST(CATOBJEXT)
71a94577 1055 AC_SUBST(INTLLIBS)
77c06844 1056 AC_SUBST(INTLDEPS)
71a94577 1057 AC_SUBST(INTLOBJS)
71a94577 1058 AC_SUBST(POSUB)
191bf464
ZW
1059dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
1060 if test $USE_INCLUDED_LIBINTL = yes; then
1061 AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
1062 [Define to use the libintl included with this package instead of any
1063 version in the system libraries.])
1064 fi
71a94577
ZW
1065
1066 dnl For backward compatibility. Some configure.ins may be using this.
1067 nls_cv_header_intl=
1068 nls_cv_header_libgt=
1069
1070 dnl For backward compatibility. Some Makefiles may be using this.
1071 DATADIRNAME=share
1072 AC_SUBST(DATADIRNAME)
1073
1074 dnl For backward compatibility. Some Makefiles may be using this.
1075 INSTOBJEXT=.mo
1076 AC_SUBST(INSTOBJEXT)
1077
1078 dnl For backward compatibility. Some Makefiles may be using this.
1079 GENCAT=gencat
1080 AC_SUBST(GENCAT)
1081 ])
1082
1083dnl Usage: Just like AM_WITH_NLS, which see.
1084AC_DEFUN([AM_GNU_GETTEXT],
1085 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1086 AC_REQUIRE([AC_PROG_CC])dnl
1087 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1088 AC_REQUIRE([AC_PROG_RANLIB])dnl
1089 AC_REQUIRE([AC_ISC_POSIX])dnl
1090 AC_REQUIRE([AC_HEADER_STDC])dnl
1091 AC_REQUIRE([AC_C_CONST])dnl
1092 AC_REQUIRE([AC_C_INLINE])dnl
1093 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1094 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1095 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1096dnl GCC LOCAL: Do not refer to AC_FUNC_MMAP, we have special needs.
1097dnl AC_REQUIRE([AC_FUNC_MMAP])dnl
1098 AC_REQUIRE([jm_GLIBC21])dnl
1099
1100 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1101stdlib.h string.h unistd.h sys/param.h])
1102 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1103getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1104strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1105
1106 AM_ICONV
1107 AM_LANGINFO_CODESET
1108 AM_LC_MESSAGES
1109 AM_WITH_NLS([$1],[$2],[$3])
1110
9f6682b7
ZW
1111 dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
1112 dnl has been torn out and replaced with this more sensible scheme.
1113 if test "x$CATOBJEXT" != x; then
1114 AC_MSG_CHECKING(for catalogs to be installed)
1115 # Look for .po and .gmo files in the source directory.
1116 CATALOGS=
1117 XLINGUAS=
1118 for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
1119 # If there aren't any .gmo files the shell will give us the
1120 # literal string "../path/to/srcdir/po/*.gmo" which has to be
1121 # weeded out.
1122 case "$cat" in *\**)
1123 continue;;
1124 esac
1125 # The quadruple backslash is collapsed to a double backslash
1126 # by the backticks, then collapsed again by the double quotes,
1127 # leaving us with one backslash in the sed expression (right
1128 # before the dot that mustn't act as a wildcard). The dot to
1129 # be escaped in the second expression is hiding inside CATOBJEXT.
1130 cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
1131 lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
1132 # The user is allowed to set LINGUAS to a list of languages to
1133 # install catalogs for. If it's empty that means "all of them."
1134 if test "x$LINGUAS" = x; then
1135 CATALOGS="$CATALOGS $cat"
1136 XLINGUAS="$XLINGUAS $lang"
1137 else
1138 case "$LINGUAS" in *$lang*)
1139 CATALOGS="$CATALOGS $cat"
1140 XLINGUAS="$XLINGUAS $lang"
1141 ;;
1142 esac
1143 fi
1144 done
1145 LINGUAS="$XLINGUAS"
1146 AC_MSG_RESULT($LINGUAS)
71a94577
ZW
1147 fi
1148
1149 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1150 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1151 dnl Try to locate is.
1152 MKINSTALLDIRS=
1153 if test -n "$ac_aux_dir"; then
1154 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1155 fi
1156 if test -z "$MKINSTALLDIRS"; then
1157 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1158 fi
1159 AC_SUBST(MKINSTALLDIRS)
1160
1161 dnl Enable libtool support if the surrounding package wishes it.
1162 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1163 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1164 ])
07cf4226
DM
1165
1166AC_DEFUN(gcc_AC_INITFINI_ARRAY,
eb70d86d
AS
1167[AC_ARG_ENABLE(initfini-array,
1168 [ --enable-initfini-array use .init_array/.fini_array sections],
1169 [], [
1170AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
918c4fe4 1171 gcc_cv_initfini_array, [dnl
eb70d86d 1172 AC_TRY_RUN([
07cf4226
DM
1173static int x = -1;
1174int main (void) { return x; }
1175int foo (void) { x = 0; }
eb70d86d 1176int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
918c4fe4
AS
1177 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
1178 [gcc_cv_initfini_array=no])])
eb70d86d
AS
1179 enable_initfini_array=$gcc_cv_initfini_array
1180])
1181if test $enable_initfini_array = yes; then
1182 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
1183 [Define .init_array/.fini_array sections are available and working.])
1184fi])
ad9c4d9f
NN
1185
1186dnl # _gcc_COMPUTE_GAS_VERSION
1187dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
1188dnl #
1189dnl # WARNING:
1190dnl # gcc_cv_as_gas_srcdir must be defined before this.
1191dnl # This gross requirement will go away eventually.
1192AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
1193[gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1194for f in $gcc_cv_as_bfd_srcdir/configure \
1195 $gcc_cv_as_gas_srcdir/configure \
1196 $gcc_cv_as_gas_srcdir/configure.in \
1197 $gcc_cv_as_gas_srcdir/Makefile.in ; do
1198 gcc_cv_gas_version=`grep '^VERSION=[[0-9]]*\.[[0-9]]*' $f`
1199 if test x$gcc_cv_gas_version != x; then
1200 break
1201 fi
1202done
1203gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
1204gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
1205gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
1206]) []dnl # _gcc_COMPUTE_GAS_VERSION
1207
1208dnl # gcc_GAS_VERSION_GTE_IFELSE(major, minor, patchlevel,
1209dnl # [command_if_true = :], [command_if_false = :])
1210dnl # Check to see if the version of GAS is greater than or
1211dnl # equal to the specified version.
1212dnl #
1213dnl # The first ifelse() shortens the shell code if the patchlevel
1214dnl # is unimportant (the usual case). The others handle missing
1215dnl # commands. Note that the tests are structured so that the most
1216dnl # common version number cases are tested first.
1217AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
1218[AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION]) []dnl
1219ifelse([$3],[0],
1220[if test $gcc_cv_gas_major_version -eq $1 \
1221&& test $gcc_cv_gas_minor_version -ge $2 \
1222|| test $gcc_cv_gas_major_version -gt $1 ; then
1223],
1224[if test $gcc_cv_gas_major_version -eq $1 \
1225&& (test $gcc_cv_gas_minor_version -gt $2 \
1226 || (test $gcc_cv_gas_minor_version -eq $2 \
1227 && test $gcc_cv_gas_patch_version -ge $3 )) \
1228|| test $gcc_cv_gas_major_version -gt $1 ; then
1229])
1230ifelse([$4],[],[:],[$4])
1231ifelse([$5],[],[],[else $5])
1232fi
1233]) []dnl # gcc_GAS_VERSION_GTE_IFELSE
1234