OSDN Git Service

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