* config.gcc: Add an extra_header for ARM targets.
[official-gcc.git] / gcc / aclocal.m4
blob2c1554bb950d4e2a8dcdfd9c6fd0e476197f7183
1 sinclude(../config/acx.m4)
2 sinclude(../config/accross.m4)
4 dnl See if stdbool.h properly defines bool and true/false.
5 AC_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;],
10 ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
11 if 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.])
17 dnl See whether we can include both string.h and strings.h.
18 AC_DEFUN(gcc_AC_HEADER_STRING,
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)])
23 if test $gcc_cv_header_string = yes; then
24   AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
28 dnl See whether we need a declaration for a function.
29 dnl The result is highly dependent on the INCLUDES passed in, so make sure
30 dnl to use a different cache variable name in this macro if it is invoked
31 dnl in a different context somewhere else.
32 dnl gcc_AC_CHECK_DECL(SYMBOL,
33 dnl     [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
34 AC_DEFUN(gcc_AC_CHECK_DECL,
35 [AC_MSG_CHECKING([whether $1 is declared])
36 AC_CACHE_VAL(gcc_cv_have_decl_$1,
37 [AC_TRY_COMPILE([$4],
38 [#ifndef $1
39 char *(*pfn) = (char *(*)) $1 ;
40 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
41 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
42   AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
43 else
44   AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
46 ])dnl
48 dnl Check multiple functions to see whether each needs a declaration.
49 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
50 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
51 dnl     [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
52 AC_DEFUN(gcc_AC_CHECK_DECLS,
53 [for ac_func in $1
55 changequote(, )dnl
56   ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
57 changequote([, ])dnl
58 gcc_AC_CHECK_DECL($ac_func,
59   [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
60   [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
61 dnl It is possible that the include files passed in here are local headers
62 dnl which supply a backup declaration for the relevant prototype based on
63 dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
64 dnl will always return success.  E.g. see libiberty.h's handling of
65 dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
66 dnl 1 so that any local headers used do not provide their own prototype
67 dnl during this test.
68 #undef $ac_tr_decl
69 #define $ac_tr_decl 1
70   $4
72 done
73 dnl Automatically generate config.h entries via autoheader.
74 if test x = y ; then
75   patsubst(translit([$1], [a-z], [A-Z]), [\w+],
76     [AC_DEFINE([HAVE_DECL_\&], 1,
77       [Define to 1 if we found this declaration otherwise define to 0.])])dnl
81 dnl See if the printf functions in libc support %p in format strings.
82 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
83 [AC_CACHE_CHECK(whether the printf functions support %p,
84   gcc_cv_func_printf_ptr,
85 [AC_TRY_RUN([#include <stdio.h>
87 int main()
89   char buf[64];
90   char *p = buf, *q = NULL;
91   sprintf(buf, "%p", p);
92   sscanf(buf, "%p", &q);
93   return (p != q);
94 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
95         gcc_cv_func_printf_ptr=no)
96 rm -f core core.* *.core])
97 if test $gcc_cv_func_printf_ptr = yes ; then
98   AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
102 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
103 AC_DEFUN(gcc_AC_PROG_LN_S,
104 [AC_MSG_CHECKING(whether ln -s works)
105 AC_CACHE_VAL(gcc_cv_prog_LN_S,
106 [rm -f conftestdata_t
107 echo >conftestdata_f
108 if ln -s conftestdata_f conftestdata_t 2>/dev/null
109 then
110   gcc_cv_prog_LN_S="ln -s"
111 else
112   if ln conftestdata_f conftestdata_t 2>/dev/null
113   then
114     gcc_cv_prog_LN_S=ln
115   else
116     gcc_cv_prog_LN_S=cp
117   fi
119 rm -f conftestdata_f conftestdata_t
120 ])dnl
121 LN_S="$gcc_cv_prog_LN_S"
122 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
123   AC_MSG_RESULT(yes)
124 else
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
131 AC_SUBST(LN_S)dnl
134 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
135 AC_DEFUN(gcc_AC_PROG_LN,
136 [AC_MSG_CHECKING(whether ln works)
137 AC_CACHE_VAL(gcc_cv_prog_LN,
138 [rm -f conftestdata_t
139 echo >conftestdata_f
140 if ln conftestdata_f conftestdata_t 2>/dev/null
141 then
142   gcc_cv_prog_LN="ln"
143 else
144   if ln -s conftestdata_f conftestdata_t 2>/dev/null
145   then
146     gcc_cv_prog_LN="ln -s"
147   else
148     gcc_cv_prog_LN=cp
149   fi
151 rm -f conftestdata_f conftestdata_t
152 ])dnl
153 LN="$gcc_cv_prog_LN"
154 if test "$gcc_cv_prog_LN" = "ln"; then
155   AC_MSG_RESULT(yes)
156 else
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
163 AC_SUBST(LN)dnl
166 dnl Check whether _Bool is built-in.
167 AC_DEFUN(gcc_AC_C__BOOL,
168 [AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
169 [AC_TRY_COMPILE(,
170 [_Bool foo;],
171 gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
173 if test $gcc_cv_c__bool = yes; then
174   AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
178 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
179 dnl of the usual 2.
180 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
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)])
194 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
195   AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
199 AC_DEFUN(gcc_AC_PROG_INSTALL,
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.
211 AC_MSG_CHECKING(for a BSD compatible install)
212 if test -z "$INSTALL"; then
213 AC_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
249 dnl We do special magic for INSTALL instead of AC_SUBST, to get
250 dnl relative paths right.
251 AC_MSG_RESULT($INSTALL)
252 AC_SUBST(INSTALL)dnl
254 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
255 # It thinks the first close brace ends the variable substitution.
256 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
257 AC_SUBST(INSTALL_PROGRAM)dnl
259 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
260 AC_SUBST(INSTALL_DATA)dnl
263 dnl Test for GNAT.
264 dnl We require the gnatbind program, and a compiler driver that
265 dnl understands Ada.  The user may set the driver name explicitly
266 dnl with ADAC; also, the user's CC setting is tried.  Failing that,
267 dnl we try gcc and cc, then a sampling of names known to be used for
268 dnl the Ada driver on various systems.
270 dnl Sets the shell variable have_gnat to yes or no as appropriate, and
271 dnl substitutes GNATBIND and ADAC.
272 AC_DEFUN([gcc_AC_PROG_GNAT],
273 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
274 AC_CHECK_TOOL(GNATBIND, gnatbind, no)
275 AC_CACHE_CHECK([for compiler driver that understands Ada],
276                  gcc_cv_prog_adac,
277 [cat >conftest.adb <<EOF
278 procedure conftest is begin null; end conftest;
280 gcc_cv_prog_adac=no
281 # Have to do ac_tool_prefix and user overrides by hand.
282 for cand in ${ADAC+"$ADAC"} ${CC+"$CC"} \
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.
294   errors=`($cand -c conftest.adb) 2>&1 || echo failure`
295   if test x"$errors" = x; then
296     gcc_cv_prog_adac=$cand
297     break
298   fi
299 done
300 rm -f conftest.*])
301 ADAC=$gcc_cv_prog_adac
302 AC_SUBST(ADAC)
304 if test x$GNATBIND != xno && test x$ADAC != xno; then
305   have_gnat=yes
306 else
307   have_gnat=no
311 #serial 1
312 dnl This test replaces the one in autoconf.
313 dnl Currently this macro should have the same name as the autoconf macro
314 dnl because gettext's gettext.m4 (distributed in the automake package)
315 dnl still uses it.  Otherwise, the use in gettext.m4 makes autoheader
316 dnl give these diagnostics:
317 dnl   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
318 dnl   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
320 undefine([AC_ISC_POSIX])
321 AC_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   ]
329 dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
330 dnl like AC_PATH_PROG but use other cache variables
331 AC_DEFUN(GCC_PATH_PROG,
332 [# Extract the first word of "$2", so it can be a program name with args.
333 set dummy $2; ac_word=[$]2
334 AC_MSG_CHECKING([for $ac_word])
335 AC_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=":"
345 dnl $ac_dummy forces splitting on constant user-supplied paths.
346 dnl POSIX.2 word splitting is done only on the output of word expansions,
347 dnl 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"
357 dnl If no 3rd arg is given, leave the cache variable unset,
358 dnl so GCC_PATH_PROGS will keep looking.
359 ifelse([$3], , , [  test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
360 ])dnl
361   ;;
362 esac])dnl
363 $1="$gcc_cv_path_$1"
364 if test -n "[$]$1"; then
365   AC_MSG_RESULT([$]$1)
366 else
367   AC_MSG_RESULT(no)
369 AC_SUBST($1)dnl
372 # mmap(2) blacklisting.  Some platforms provide the mmap library routine
373 # but don't support all of the features we need from it.
374 AC_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
380 else
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])
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>
417 #include <sys/mman.h>
418 #include <unistd.h>
420 #ifndef MAP_ANONYMOUS
421 #define MAP_ANONYMOUS MAP_ANON
422 #endif
424 [int n = MAP_ANONYMOUS;],
425     gcc_cv_decl_map_anon=yes,
426     gcc_cv_decl_map_anon=no)])
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
447 if test $gcc_cv_func_mmap_file = yes; then
448   AC_DEFINE(HAVE_MMAP_FILE, 1,
449             [Define if read-only mmap of a plain file works.])
451 if 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.])
455 if test $gcc_cv_func_mmap_anon = yes; then
456   AC_DEFINE(HAVE_MMAP_ANON, 1,
457             [Define if mmap with MAP_ANON(YMOUS) works.])
461 dnl Locate a program and check that its version is acceptable.
462 dnl AC_PROG_CHECK_VER(var, name, version-switch,
463 dnl                  version-extract-regexp, version-glob)
464 AC_DEFUN(gcc_AC_CHECK_PROG_VER,
465 [AC_CHECK_PROG([$1], [$2], [$2])
466 if 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'`
472 changequote([,])dnl
473   echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
474 changequote(<<,>>)dnl
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
481 changequote([,])dnl
483 else
484   gcc_cv_prog_$2_modern=no
488 dnl Determine if enumerated bitfields are unsigned.   ISO C says they can 
489 dnl be either signed or unsigned.
491 AC_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>
494 enum t { BLAH = 128 } ;
495 struct s_t { enum t member : 8; } s ;
496 int main(void)
497 {            
498         s.member = BLAH;
499         if (s.member < 0) exit(1);
500         exit(0);
502 }, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
503 if 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.])
506 fi])
508 dnl Probe number of bits in a byte.
509 dnl Note C89 requires CHAR_BIT >= 8.
511 AC_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
518 found
519 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
521 if 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(,
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])
532    i=`expr $i + 1`
533  done
534  test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
536 if test $gcc_cv_c_nbby = failed; then
537   AC_MSG_ERROR(cannot determine number of bits in a byte)
538 else
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.])
542 fi])
544 dnl Checking for long long.
545 dnl By Caolan McNamara <caolan@skynet.ie>
546 dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
548 AC_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
557 AC_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
567 dnl Host character set probe.
568 dnl The EBCDIC values match the table in config/i370/i370.c;
569 dnl there are other versions of EBCDIC but GCC won't work with them.
571 AC_DEFUN([gcc_AC_C_CHARSET],
572 [AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
573   [AC_EGREP_CPP(ASCII,
574 [#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
575    && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
576 ASCII
577 #endif], ac_cv_c_charset=ASCII)
578   if test x${ac_cv_c_charset+set} != xset; then
579     AC_EGREP_CPP(EBCDIC,
580 [#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
581    && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
582 EBCDIC
583 #endif], ac_cv_c_charset=EBCDIC)
584   fi
585   if test x${ac_cv_c_charset+set} != xset; then
586     ac_cv_c_charset=unknown
587   fi])
588 if test $ac_cv_c_charset = unknown; then
589   AC_MSG_ERROR([*** Cannot determine host character set.])
590 elif test $ac_cv_c_charset = EBCDIC; then
591   AC_DEFINE(HOST_EBCDIC, 1,
592   [Define if the host execution character set is EBCDIC.])
593 fi])
595 #serial AM2
597 dnl From Bruno Haible.
599 AC_DEFUN([AM_ICONV],
601   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
602   dnl those with the standalone portable GNU libiconv installed).
604   am_cv_lib_iconv_ldpath=
605   AC_ARG_WITH([libiconv-prefix],
606 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
607     for dir in `echo "$withval" | tr : ' '`; do
608       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
609       if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
610     done
611    ])
613   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
614     am_cv_func_iconv="no, consider installing GNU libiconv"
615     am_cv_lib_iconv=no
616     AC_TRY_LINK([#include <stdlib.h>
617 #include <iconv.h>],
618       [iconv_t cd = iconv_open("","");
619        iconv(cd,NULL,NULL,NULL,NULL);
620        iconv_close(cd);],
621       am_cv_func_iconv=yes)
622     if test "$am_cv_func_iconv" != yes; then
623       am_save_LIBS="$LIBS"
624       LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
625       AC_TRY_LINK([#include <stdlib.h>
626 #include <iconv.h>],
627         [iconv_t cd = iconv_open("","");
628          iconv(cd,NULL,NULL,NULL,NULL);
629          iconv_close(cd);],
630         am_cv_lib_iconv=yes
631         am_cv_func_iconv=yes)
632       LIBS="$am_save_LIBS"
633     fi
634   ])
635   if test "$am_cv_func_iconv" = yes; then
636     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
637     AC_MSG_CHECKING([for iconv declaration])
638     AC_CACHE_VAL(am_cv_proto_iconv, [
639       AC_TRY_COMPILE([
640 #include <stdlib.h>
641 #include <iconv.h>
642 extern
643 #ifdef __cplusplus
645 #endif
646 #if defined(__STDC__) || defined(__cplusplus)
647 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
648 #else
649 size_t iconv();
650 #endif
651 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
652       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);"])
653     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
654     AC_MSG_RESULT([$]{ac_t:-
655          }[$]am_cv_proto_iconv)
656     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
657       [Define as const if the declaration of iconv() needs const.])
658   fi
659   LIBICONV=
660   if test "$am_cv_lib_iconv" = yes; then
661     LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
662   fi
663   AC_SUBST(LIBICONV)
666 ### Gettext macros begin here.
667 ### Changes for GCC marked by 'dnl GCC LOCAL'.
668 ### Note iconv.m4 appears above, as it's used for other reasons.
670 #serial AM1
672 dnl From Bruno Haible.
674 AC_DEFUN([AM_LANGINFO_CODESET],
676   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
677     [AC_TRY_LINK([#include <langinfo.h>],
678       [char* cs = nl_langinfo(CODESET);],
679       am_cv_langinfo_codeset=yes,
680       am_cv_langinfo_codeset=no)
681     ])
682   if test $am_cv_langinfo_codeset = yes; then
683     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
684       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
685   fi
688 #serial 1
689 # This test replaces the one in autoconf.
690 # Currently this macro should have the same name as the autoconf macro
691 # because gettext's gettext.m4 (distributed in the automake package)
692 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
693 # give these diagnostics:
694 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
695 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
697 undefine([AC_ISC_POSIX])
699 AC_DEFUN([AC_ISC_POSIX],
700   [
701     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
702     dnl GCC LOCAL: Use AC_SEARCH_LIBS.
703     AC_SEARCH_LIBS(strerror, cposix)
704   ]
707 #serial 2
709 # Test for the GNU C Library, version 2.1 or newer.
710 # From Bruno Haible.
712 AC_DEFUN([jm_GLIBC21],
713   [
714     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
715       ac_cv_gnu_library_2_1,
716       [AC_EGREP_CPP([Lucky GNU user],
717         [
718 #include <features.h>
719 #ifdef __GNU_LIBRARY__
720  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
721   Lucky GNU user
722  #endif
723 #endif
724         ],
725         ac_cv_gnu_library_2_1=yes,
726         ac_cv_gnu_library_2_1=no)
727       ]
728     )
729     AC_SUBST(GLIBC21)
730     GLIBC21="$ac_cv_gnu_library_2_1"
731   ]
734 # Check whether LC_MESSAGES is available in <locale.h>.
735 # Ulrich Drepper <drepper@cygnus.com>, 1995.
737 # This file can be copied and used freely without restrictions.  It can
738 # be used in projects which are not available under the GNU General Public
739 # License or the GNU Library General Public License but which still want
740 # to provide support for the GNU gettext functionality.
741 # Please note that the actual code of the GNU gettext library is covered
742 # by the GNU Library General Public License, and the rest of the GNU
743 # gettext package package is covered by the GNU General Public License.
744 # They are *not* in the public domain.
746 # serial 2
748 AC_DEFUN([AM_LC_MESSAGES],
749   [if test $ac_cv_header_locale_h = yes; then
750     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
751       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
752        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
753     if test $am_cv_val_LC_MESSAGES = yes; then
754       AC_DEFINE(HAVE_LC_MESSAGES, 1,
755         [Define if your <locale.h> file defines LC_MESSAGES.])
756     fi
757   fi])
759 # Search path for a program which passes the given test.
760 # Ulrich Drepper <drepper@cygnus.com>, 1996.
762 # This file can be copied and used freely without restrictions.  It can
763 # be used in projects which are not available under the GNU General Public
764 # License or the GNU Library General Public License but which still want
765 # to provide support for the GNU gettext functionality.
766 # Please note that the actual code of the GNU gettext library is covered
767 # by the GNU Library General Public License, and the rest of the GNU
768 # gettext package package is covered by the GNU General Public License.
769 # They are *not* in the public domain.
771 # serial 2
773 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
774 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
775 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
776 [# Extract the first word of "$2", so it can be a program name with args.
777 set dummy $2; ac_word=[$]2
778 AC_MSG_CHECKING([for $ac_word])
779 AC_CACHE_VAL(ac_cv_path_$1,
780 [case "[$]$1" in
781   /*)
782   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
783   ;;
784   *)
785   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
786   for ac_dir in ifelse([$5], , $PATH, [$5]); do
787     test -z "$ac_dir" && ac_dir=.
788     if test -f $ac_dir/$ac_word; then
789       if [$3]; then
790         ac_cv_path_$1="$ac_dir/$ac_word"
791         break
792       fi
793     fi
794   done
795   IFS="$ac_save_ifs"
796 dnl If no 4th arg is given, leave the cache variable unset,
797 dnl so AC_PATH_PROGS will keep looking.
798 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
799 ])dnl
800   ;;
801 esac])dnl
802 $1="$ac_cv_path_$1"
803 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
804   AC_MSG_RESULT([$]$1)
805 else
806   AC_MSG_RESULT(no)
808 AC_SUBST($1)dnl
811 # Macro to add for using GNU gettext.
812 # Ulrich Drepper <drepper@cygnus.com>, 1995.
814 # This file can be copied and used freely without restrictions.  It can
815 # be used in projects which are not available under the GNU General Public
816 # License or the GNU Library General Public License but which still want
817 # to provide support for the GNU gettext functionality.
818 # Please note that the actual code of the GNU gettext library is covered
819 # by the GNU Library General Public License, and the rest of the GNU
820 # gettext package package is covered by the GNU General Public License.
821 # They are *not* in the public domain.
823 # serial 10
825 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
826 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
827 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
828 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
829 dnl    AM-DISABLE-SHARED). Otherwise, a static library
830 dnl    $(top_builddir)/intl/libintl.a will be created.
831 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
832 dnl    implementations (in libc or libintl) without the ngettext() function
833 dnl    will be ignored.
834 dnl LIBDIR is used to find the intl libraries.  If empty,
835 dnl    the value `$(top_builddir)/intl/' is used.
837 dnl The result of the configuration is one of three cases:
838 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
839 dnl    and used.
840 dnl    Catalog format: GNU --> install in $(datadir)
841 dnl    Catalog extension: .mo after installation, .gmo in source tree
842 dnl 2) GNU gettext has been found in the system's C library.
843 dnl    Catalog format: GNU --> install in $(datadir)
844 dnl    Catalog extension: .mo after installation, .gmo in source tree
845 dnl 3) No internationalization, always use English msgid.
846 dnl    Catalog format: none
847 dnl    Catalog extension: none
848 dnl The use of .gmo is historical (it was needed to avoid overwriting the
849 dnl GNU format catalogs when building on a platform with an X/Open gettext),
850 dnl but we keep it in order not to force irrelevant filename changes on the
851 dnl maintainers.
853 AC_DEFUN([AM_WITH_NLS],
854   [AC_MSG_CHECKING([whether NLS is requested])
855     dnl Default is enabled NLS
856     AC_ARG_ENABLE(nls,
857       [  --disable-nls           do not use Native Language Support],
858       USE_NLS=$enableval, USE_NLS=yes)
859     AC_MSG_RESULT($USE_NLS)
860     AC_SUBST(USE_NLS)
862     BUILD_INCLUDED_LIBINTL=no
863     USE_INCLUDED_LIBINTL=no
864 dnl GCC LOCAL: Separate concept of link command line from dependencies.
865     INTLLIBS=
866     INTLDEPS=
868     dnl If we use NLS figure out what method
869     if test "$USE_NLS" = "yes"; then
870       AC_DEFINE(ENABLE_NLS, 1,
871         [Define to 1 if translation of program messages to the user's native language
872    is requested.])
873       AC_MSG_CHECKING([whether included gettext is requested])
874       AC_ARG_WITH(included-gettext,
875         [  --with-included-gettext use the GNU gettext library included here],
876         nls_cv_force_use_gnu_gettext=$withval,
877         nls_cv_force_use_gnu_gettext=no)
878       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
880       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
881       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
882         dnl User does not insist on using GNU NLS library.  Figure out what
883         dnl to use.  If GNU gettext is available we use this.  Else we have
884         dnl to fall back to GNU NLS library.
885         CATOBJEXT=NONE
887         dnl Add a version number to the cache macros.
888         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
889         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
891 dnl GCC LOCAL: Expose presence of libintl.h to C code.
892         AC_CHECK_HEADER(libintl.h,
893           [AC_DEFINE([HAVE_LIBINTL_H], 1,
894                 [Define if you have the <libintl.h> header file.])
895            AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
896             [AC_TRY_LINK([#include <libintl.h>
897 extern int _nl_msg_cat_cntr;],
898                [bindtextdomain ("", "");
899 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
900                gt_cv_func_gnugettext_libc=yes,
901                gt_cv_func_gnugettext_libc=no)])
903            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
904              AC_CACHE_CHECK([for GNU gettext in libintl],
905                gt_cv_func_gnugettext_libintl,
906                [gt_save_LIBS="$LIBS"
907                 LIBS="$LIBS -lintl $LIBICONV"
908                 AC_TRY_LINK([#include <libintl.h>
909 extern int _nl_msg_cat_cntr;],
910                   [bindtextdomain ("", "");
911 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
912                   gt_cv_func_gnugettext_libintl=yes,
913                   gt_cv_func_gnugettext_libintl=no)
914                 LIBS="$gt_save_LIBS"])
915            fi
917            dnl If an already present or preinstalled GNU gettext() is found,
918            dnl use it.  But if this macro is used in GNU gettext, and GNU
919            dnl gettext is already preinstalled in libintl, we update this
920            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
921            if test "$gt_cv_func_gnugettext_libc" = "yes" \
922               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
923                    && test "$PACKAGE" != gettext; }; then
924              AC_DEFINE(HAVE_GETTEXT, 1,
925                [Define if the GNU gettext() function is already present or preinstalled.])
927              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
928                dnl If iconv() is in a separate libiconv library, then anyone
929                dnl linking with libintl{.a,.so} also needs to link with
930                dnl libiconv.
931                INTLLIBS="-lintl $LIBICONV"
932              fi
934              gt_save_LIBS="$LIBS"
935              LIBS="$LIBS $INTLLIBS"
936              AC_CHECK_FUNCS(dcgettext)
937              LIBS="$gt_save_LIBS"
939              dnl Search for GNU msgfmt in the PATH.
940              AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
941                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
942              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
944              dnl Search for GNU xgettext in the PATH.
945              AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
946                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
948              CATOBJEXT=.gmo
949            fi
950         ])
952         if test "$CATOBJEXT" = "NONE"; then
953           dnl GNU gettext is not found in the C library.
954           dnl Fall back on GNU gettext library.
955           nls_cv_use_gnu_gettext=yes
956         fi
957       fi
959       if test "$nls_cv_use_gnu_gettext" = "yes"; then
960         dnl Mark actions used to generate GNU NLS library.
961         INTLOBJS="\$(GETTOBJS)"
962         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
963           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
964         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
965         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
966           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
967         AC_SUBST(MSGFMT)
968         BUILD_INCLUDED_LIBINTL=yes
969         USE_INCLUDED_LIBINTL=yes
970         CATOBJEXT=.gmo
971         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
972         INTLDEPS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a"
973         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
974       fi
976       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
977       dnl Test whether we really found GNU msgfmt.
978       if test "$GMSGFMT" != ":"; then
979         dnl If it is no GNU msgfmt we define it as : so that the
980         dnl Makefiles still can work.
981         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
982           : ;
983         else
984           AC_MSG_RESULT(
985             [found msgfmt program is not GNU msgfmt; ignore it])
986           GMSGFMT=":"
987         fi
988       fi
990       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
991       dnl Test whether we really found GNU xgettext.
992       if test "$XGETTEXT" != ":"; then
993         dnl If it is no GNU xgettext we define it as : so that the
994         dnl Makefiles still can work.
995         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
996           : ;
997         else
998           AC_MSG_RESULT(
999             [found xgettext program is not GNU xgettext; ignore it])
1000           XGETTEXT=":"
1001         fi
1002       fi
1004       dnl We need to process the po/ directory.
1005       POSUB=po
1006     fi
1007     AC_OUTPUT_COMMANDS(
1008      [for ac_file in $CONFIG_FILES; do
1009         # Support "outfile[:infile[:infile...]]"
1010         case "$ac_file" in
1011           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1012         esac
1013         # PO directories have a Makefile.in generated from Makefile.in.in.
1014         case "$ac_file" in */Makefile.in)
1015           # Adjust a relative srcdir.
1016           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1017           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1018           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1019           # In autoconf-2.13 it is called $ac_given_srcdir.
1020           # In autoconf-2.50 it is called $srcdir.
1021           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1022           case "$ac_given_srcdir" in
1023             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1024             /*) top_srcdir="$ac_given_srcdir" ;;
1025             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1026           esac
1027           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1028             rm -f "$ac_dir/POTFILES"
1029             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1030             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1031             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1032             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1033           fi
1034           ;;
1035         esac
1036       done])
1039     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1040     dnl to 'yes' because some of the testsuite requires it.
1041     if test "$PACKAGE" = gettext; then
1042       BUILD_INCLUDED_LIBINTL=yes
1043     fi
1045     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1046     dnl because plural.y uses bison specific features. It requires at least
1047     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1048     dnl compile.
1049     dnl bison is only needed for the maintainer (who touches plural.y). But in
1050     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1051     dnl the rule in general Makefile. Now, some people carelessly touch the
1052     dnl files or have a broken "make" program, hence the plural.c rule will
1053     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1054     dnl present or too old.
1055     AC_CHECK_PROGS([INTLBISON], [bison])
1056     if test -z "$INTLBISON"; then
1057       ac_verc_fail=yes
1058     else
1059       dnl Found it, now check the version.
1060       AC_MSG_CHECKING([version of bison])
1061 changequote(<<,>>)dnl
1062       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1063       case $ac_prog_version in
1064         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1065         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1066 changequote([,])dnl
1067            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1068         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1069       esac
1070       AC_MSG_RESULT([$ac_prog_version])
1071     fi
1072     if test $ac_verc_fail = yes; then
1073       INTLBISON=:
1074     fi
1076     dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
1078     dnl Make all variables we use known to autoconf.
1079     AC_SUBST(BUILD_INCLUDED_LIBINTL)
1080     AC_SUBST(USE_INCLUDED_LIBINTL)
1081     AC_SUBST(CATALOGS)
1082     AC_SUBST(CATOBJEXT)
1083     AC_SUBST(INTLLIBS)
1084     AC_SUBST(INTLDEPS)
1085     AC_SUBST(INTLOBJS)
1086     AC_SUBST(POSUB)
1087 dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
1088     if test $USE_INCLUDED_LIBINTL = yes; then
1089       AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
1090   [Define to use the libintl included with this package instead of any
1091    version in the system libraries.])
1092     fi
1094     dnl For backward compatibility. Some configure.ins may be using this.
1095     nls_cv_header_intl=
1096     nls_cv_header_libgt=
1098     dnl For backward compatibility. Some Makefiles may be using this.
1099     DATADIRNAME=share
1100     AC_SUBST(DATADIRNAME)
1102     dnl For backward compatibility. Some Makefiles may be using this.
1103     INSTOBJEXT=.mo
1104     AC_SUBST(INSTOBJEXT)
1106     dnl For backward compatibility. Some Makefiles may be using this.
1107     GENCAT=gencat
1108     AC_SUBST(GENCAT)
1109   ])
1111 dnl Usage: Just like AM_WITH_NLS, which see.
1112 AC_DEFUN([AM_GNU_GETTEXT],
1113   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1114    AC_REQUIRE([AC_PROG_CC])dnl
1115    AC_REQUIRE([AC_CANONICAL_HOST])dnl
1116    AC_REQUIRE([AC_PROG_RANLIB])dnl
1117    AC_REQUIRE([AC_ISC_POSIX])dnl
1118    AC_REQUIRE([AC_HEADER_STDC])dnl
1119    AC_REQUIRE([AC_C_CONST])dnl
1120    AC_REQUIRE([AC_C_INLINE])dnl
1121    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1122    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1123    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1124 dnl GCC LOCAL: Do not refer to AC_FUNC_MMAP, we have special needs.
1125 dnl   AC_REQUIRE([AC_FUNC_MMAP])dnl
1126    AC_REQUIRE([jm_GLIBC21])dnl
1128    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1129 stdlib.h string.h unistd.h sys/param.h])
1130    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1131 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1132 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1134    AM_ICONV
1135    AM_LANGINFO_CODESET
1136    AM_LC_MESSAGES
1137    AM_WITH_NLS([$1],[$2],[$3])
1139    dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
1140    dnl has been torn out and replaced with this more sensible scheme.
1141    if test "x$CATOBJEXT" != x; then
1142      AC_MSG_CHECKING(for catalogs to be installed)
1143      # Look for .po and .gmo files in the source directory.
1144      CATALOGS=
1145      XLINGUAS=
1146      for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
1147         # If there aren't any .gmo files the shell will give us the
1148         # literal string "../path/to/srcdir/po/*.gmo" which has to be
1149         # weeded out.
1150         case "$cat" in *\**)
1151             continue;;
1152         esac
1153         # The quadruple backslash is collapsed to a double backslash
1154         # by the backticks, then collapsed again by the double quotes,
1155         # leaving us with one backslash in the sed expression (right
1156         # before the dot that mustn't act as a wildcard).  The dot to
1157         # be escaped in the second expression is hiding inside CATOBJEXT.
1158         cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
1159         lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
1160         # The user is allowed to set LINGUAS to a list of languages to
1161         # install catalogs for.  If it's empty that means "all of them."
1162         if test "x$LINGUAS" = x; then
1163             CATALOGS="$CATALOGS $cat"
1164             XLINGUAS="$XLINGUAS $lang"
1165         else
1166           case "$LINGUAS" in *$lang*)
1167             CATALOGS="$CATALOGS $cat"
1168             XLINGUAS="$XLINGUAS $lang"
1169             ;;
1170           esac
1171         fi
1172      done
1173      LINGUAS="$XLINGUAS"
1174      AC_MSG_RESULT($LINGUAS)
1175    fi
1177    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1178    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1179    dnl Try to locate is.
1180    MKINSTALLDIRS=
1181    if test -n "$ac_aux_dir"; then
1182      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1183    fi
1184    if test -z "$MKINSTALLDIRS"; then
1185      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1186    fi
1187    AC_SUBST(MKINSTALLDIRS)
1189    dnl Enable libtool support if the surrounding package wishes it.
1190    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1191    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1192   ])
1194 AC_DEFUN(gcc_AC_INITFINI_ARRAY,
1195 [AC_ARG_ENABLE(initfini-array,
1196         [  --enable-initfini-array      use .init_array/.fini_array sections],
1197         [], [
1198 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1199                  gcc_cv_initfini_array, [dnl
1200   AC_TRY_RUN([
1201 static int x = -1;
1202 int main (void) { return x; }
1203 int foo (void) { x = 0; }
1204 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
1205              [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
1206              [gcc_cv_initfini_array=no])])
1207   enable_initfini_array=$gcc_cv_initfini_array
1209 if test $enable_initfini_array = yes; then
1210   AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
1211     [Define .init_array/.fini_array sections are available and working.])
1212 fi])
1214 dnl # _gcc_COMPUTE_GAS_VERSION
1215 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
1216 dnl #
1217 dnl # WARNING:
1218 dnl # gcc_cv_as_gas_srcdir must be defined before this.
1219 dnl # This gross requirement will go away eventually.
1220 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
1221 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1222 for f in $gcc_cv_as_bfd_srcdir/configure \
1223          $gcc_cv_as_gas_srcdir/configure \
1224          $gcc_cv_as_gas_srcdir/configure.in \
1225          $gcc_cv_as_gas_srcdir/Makefile.in ; do
1226   gcc_cv_gas_version=`grep '^VERSION=[[0-9]]*\.[[0-9]]*' $f`
1227   if test x$gcc_cv_gas_version != x; then
1228     break
1229   fi
1230 done
1231 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
1232 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
1233 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
1234 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
1236 dnl # gcc_GAS_VERSION_GTE_IFELSE(major, minor, patchlevel,
1237 dnl #                     [command_if_true = :], [command_if_false = :])
1238 dnl # Check to see if the version of GAS is greater than or
1239 dnl # equal to the specified version.
1240 dnl #
1241 dnl # The first ifelse() shortens the shell code if the patchlevel
1242 dnl # is unimportant (the usual case).  The others handle missing
1243 dnl # commands.  Note that the tests are structured so that the most
1244 dnl # common version number cases are tested first.
1245 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
1246 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION]) []dnl
1247 ifelse([$3],[0],
1248 [if test $gcc_cv_gas_major_version -eq $1 \
1249 && test $gcc_cv_gas_minor_version -ge $2 \
1250 || test $gcc_cv_gas_major_version -gt $1 ; then
1252 [if test $gcc_cv_gas_major_version -eq $1 \
1253 && (test $gcc_cv_gas_minor_version -gt $2 \
1254     || (test $gcc_cv_gas_minor_version -eq $2 \
1255         && test $gcc_cv_gas_patch_version -ge $3 )) \
1256 || test $gcc_cv_gas_major_version -gt $1 ; then
1258 ifelse([$4],[],[:],[$4])
1259 ifelse([$5],[],[],[else $5])
1261 ]) []dnl # gcc_GAS_VERSION_GTE_IFELSE