OSDN Git Service

* c-typeck.c (common_type): Correct comment.
[pf3gnuchains/gcc-fork.git] / gcc / aclocal.m4
1 sinclude(../config/acx.m4)
2 sinclude(../config/accross.m4)
3 sinclude(../config/gettext.m4)
4 sinclude(../config/progtest.m4)
5
6 dnl See whether we need a declaration for a function.
7 dnl The result is highly dependent on the INCLUDES passed in, so make sure
8 dnl to use a different cache variable name in this macro if it is invoked
9 dnl in a different context somewhere else.
10 dnl gcc_AC_CHECK_DECL(SYMBOL,
11 dnl     [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
12 AC_DEFUN([gcc_AC_CHECK_DECL],
13 [AC_MSG_CHECKING([whether $1 is declared])
14 AC_CACHE_VAL(gcc_cv_have_decl_$1,
15 [AC_TRY_COMPILE([$4],
16 [#ifndef $1
17 char *(*pfn) = (char *(*)) $1 ;
18 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
19 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
20   AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
21 else
22   AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
23 fi
24 ])dnl
25
26 dnl Check multiple functions to see whether each needs a declaration.
27 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
28 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
29 dnl     [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
30 AC_DEFUN([gcc_AC_CHECK_DECLS],
31 [for ac_func in $1
32 do
33 changequote(, )dnl
34   ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
35 changequote([, ])dnl
36 gcc_AC_CHECK_DECL($ac_func,
37   [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
38   [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
39 dnl It is possible that the include files passed in here are local headers
40 dnl which supply a backup declaration for the relevant prototype based on
41 dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
42 dnl will always return success.  E.g. see libiberty.h's handling of
43 dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
44 dnl 1 so that any local headers used do not provide their own prototype
45 dnl during this test.
46 #undef $ac_tr_decl
47 #define $ac_tr_decl 1
48   $4
49 )
50 done
51 dnl Automatically generate config.h entries via autoheader.
52 if test x = y ; then
53   patsubst(translit([$1], [a-z], [A-Z]), [\w+],
54     [AC_DEFINE([HAVE_DECL_\&], 1,
55       [Define to 1 if we found this declaration otherwise define to 0.])])dnl
56 fi
57 ])
58
59 dnl 'make compare' can be significantly faster, if cmp itself can
60 dnl skip bytes instead of using tail.  The test being performed is
61 dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
62 dnl but we need to sink errors and handle broken shells.  We also test
63 dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
64 dnl accepted by cmp on some systems.
65 AC_DEFUN([gcc_AC_PROG_CMP_IGNORE_INITIAL],
66 [AC_CACHE_CHECK([for cmp's capabilities], gcc_cv_prog_cmp_skip,
67 [ echo abfoo >t1
68   echo cdfoo >t2
69   gcc_cv_prog_cmp_skip=slowcompare
70   if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
71     if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
72       :
73     else
74       gcc_cv_prog_cmp_skip=gnucompare
75     fi
76   fi
77   if test $gcc_cv_prog_cmp_skip = slowcompare ; then
78     if cmp t1 t2 2 2 > /dev/null 2>&1; then
79       if cmp t1 t2 1 1 > /dev/null 2>&1; then
80         :
81       else
82         gcc_cv_prog_cmp_skip=fastcompare
83       fi
84     fi
85   fi
86   rm t1 t2
87 ])
88 make_compare_target=$gcc_cv_prog_cmp_skip
89 AC_SUBST(make_compare_target)
90 ])
91
92 dnl See if the printf functions in libc support %p in format strings.
93 AC_DEFUN([gcc_AC_FUNC_PRINTF_PTR],
94 [AC_CACHE_CHECK(whether the printf functions support %p,
95   gcc_cv_func_printf_ptr,
96 [AC_TRY_RUN([#include <stdio.h>
97
98 int main()
99 {
100   char buf[64];
101   char *p = buf, *q = NULL;
102   sprintf(buf, "%p", p);
103   sscanf(buf, "%p", &q);
104   return (p != q);
105 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
106         gcc_cv_func_printf_ptr=no)
107 rm -f core core.* *.core])
108 if test $gcc_cv_func_printf_ptr = yes ; then
109   AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
110 fi
111 ])
112
113 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
114 AC_DEFUN([gcc_AC_PROG_LN_S],
115 [AC_MSG_CHECKING(whether ln -s works)
116 AC_CACHE_VAL(gcc_cv_prog_LN_S,
117 [rm -f conftestdata_t
118 echo >conftestdata_f
119 if ln -s conftestdata_f conftestdata_t 2>/dev/null
120 then
121   gcc_cv_prog_LN_S="ln -s"
122 else
123   if ln conftestdata_f conftestdata_t 2>/dev/null
124   then
125     gcc_cv_prog_LN_S=ln
126   else
127     gcc_cv_prog_LN_S=cp
128   fi
129 fi
130 rm -f conftestdata_f conftestdata_t
131 ])dnl
132 LN_S="$gcc_cv_prog_LN_S"
133 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
134   AC_MSG_RESULT(yes)
135 else
136   if test "$gcc_cv_prog_LN_S" = "ln"; then
137     AC_MSG_RESULT([no, using ln])
138   else
139     AC_MSG_RESULT([no, and neither does ln, so using cp])
140   fi
141 fi
142 AC_SUBST(LN_S)dnl
143 ])
144
145 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
146 AC_DEFUN([gcc_AC_PROG_LN],
147 [AC_MSG_CHECKING(whether ln works)
148 AC_CACHE_VAL(gcc_cv_prog_LN,
149 [rm -f conftestdata_t
150 echo >conftestdata_f
151 if ln conftestdata_f conftestdata_t 2>/dev/null
152 then
153   gcc_cv_prog_LN="ln"
154 else
155   if ln -s conftestdata_f conftestdata_t 2>/dev/null
156   then
157     gcc_cv_prog_LN="ln -s"
158   else
159     gcc_cv_prog_LN=cp
160   fi
161 fi
162 rm -f conftestdata_f conftestdata_t
163 ])dnl
164 LN="$gcc_cv_prog_LN"
165 if test "$gcc_cv_prog_LN" = "ln"; then
166   AC_MSG_RESULT(yes)
167 else
168   if test "$gcc_cv_prog_LN" = "ln -s"; then
169     AC_MSG_RESULT([no, using ln -s])
170   else
171     AC_MSG_RESULT([no, and neither does ln -s, so using cp])
172   fi
173 fi
174 AC_SUBST(LN)dnl
175 ])
176
177 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
178 dnl of the usual 2.
179 AC_DEFUN([gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG],
180 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
181 [AC_TRY_COMPILE([
182 #include <sys/types.h>
183 #ifdef HAVE_SYS_STAT_H
184 # include <sys/stat.h>
185 #endif
186 #ifdef HAVE_UNISTD_H
187 # include <unistd.h>
188 #endif
189 #ifdef HAVE_DIRECT_H
190 # include <direct.h>
191 #endif], [mkdir ("foo", 0);], 
192         gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
193 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
194   AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
195 fi
196 ])
197
198 AC_DEFUN([gcc_AC_PROG_INSTALL],
199 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
200 # Find a good install program.  We prefer a C program (faster),
201 # so one script is as good as another.  But avoid the broken or
202 # incompatible versions:
203 # SysV /etc/install, /usr/sbin/install
204 # SunOS /usr/etc/install
205 # IRIX /sbin/install
206 # AIX /bin/install
207 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
208 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
209 # ./install, which can be erroneously created by make from ./install.sh.
210 AC_MSG_CHECKING(for a BSD compatible install)
211 if test -z "$INSTALL"; then
212 AC_CACHE_VAL(ac_cv_path_install,
213 [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
214   for ac_dir in $PATH; do
215     # Account for people who put trailing slashes in PATH elements.
216     case "$ac_dir/" in
217     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
218     *)
219       # OSF1 and SCO ODT 3.0 have their own names for install.
220       for ac_prog in ginstall scoinst install; do
221         if test -f $ac_dir/$ac_prog; then
222           if test $ac_prog = install &&
223             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
224             # AIX install.  It has an incompatible calling convention.
225             # OSF/1 installbsd also uses dspmsg, but is usable.
226             :
227           else
228             ac_cv_path_install="$ac_dir/$ac_prog -c"
229             break 2
230           fi
231         fi
232       done
233       ;;
234     esac
235   done
236   IFS="$ac_save_IFS"
237 ])dnl
238   if test "${ac_cv_path_install+set}" = set; then
239     INSTALL="$ac_cv_path_install"
240   else
241     # As a last resort, use the slow shell script.  We don't cache a
242     # path for INSTALL within a source directory, because that will
243     # break other packages using the cache if that directory is
244     # removed, or if the path is relative.
245     INSTALL="$ac_install_sh"
246   fi
247 fi
248 dnl We do special magic for INSTALL instead of AC_SUBST, to get
249 dnl relative paths right.
250 AC_MSG_RESULT($INSTALL)
251 AC_SUBST(INSTALL)dnl
252
253 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
254 # It thinks the first close brace ends the variable substitution.
255 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
256 AC_SUBST(INSTALL_PROGRAM)dnl
257
258 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
259 AC_SUBST(INSTALL_DATA)dnl
260 ])
261
262 dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
263 dnl like AC_PATH_PROG but use other cache variables
264 AC_DEFUN([GCC_PATH_PROG],
265 [# Extract the first word of "$2", so it can be a program name with args.
266 set dummy $2; ac_word=[$]2
267 AC_MSG_CHECKING([for $ac_word])
268 AC_CACHE_VAL(gcc_cv_path_$1,
269 [case "[$]$1" in
270   /*)
271   gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
272   ;;
273   ?:/*)                  
274   gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
275   ;;
276   *)
277   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
278 dnl $ac_dummy forces splitting on constant user-supplied paths.
279 dnl POSIX.2 word splitting is done only on the output of word expansions,
280 dnl not every word.  This closes a longstanding sh security hole.
281   ac_dummy="ifelse([$4], , $PATH, [$4])"
282   for ac_dir in $ac_dummy; do 
283     test -z "$ac_dir" && ac_dir=.
284     if test -f $ac_dir/$ac_word; then
285       gcc_cv_path_$1="$ac_dir/$ac_word"
286       break
287     fi
288   done
289   IFS="$ac_save_ifs"
290 dnl If no 3rd arg is given, leave the cache variable unset,
291 dnl so GCC_PATH_PROGS will keep looking.
292 ifelse([$3], , , [  test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
293 ])dnl
294   ;;
295 esac])dnl
296 $1="$gcc_cv_path_$1"
297 if test -n "[$]$1"; then
298   AC_MSG_RESULT([$]$1)
299 else
300   AC_MSG_RESULT(no)
301 fi
302 AC_SUBST($1)dnl
303 ])
304
305 # mmap(2) blacklisting.  Some platforms provide the mmap library routine
306 # but don't support all of the features we need from it.
307 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
308 [if test $ac_cv_header_sys_mman_h != yes \
309  || test $ac_cv_func_mmap != yes; then
310    gcc_cv_func_mmap_file=no
311    gcc_cv_func_mmap_dev_zero=no
312    gcc_cv_func_mmap_anon=no
313 else
314    AC_CACHE_CHECK([whether read-only mmap of a plain file works], 
315   gcc_cv_func_mmap_file,
316   [# Add a system to this blacklist if 
317    # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
318    # memory area containing the same data that you'd get if you applied
319    # read() to the same fd.  The only system known to have a problem here
320    # is VMS, where text files have record structure.
321    case "$host_os" in
322      vms* | ultrix*) 
323         gcc_cv_func_mmap_file=no ;;
324      *)
325         gcc_cv_func_mmap_file=yes;;
326    esac])
327    AC_CACHE_CHECK([whether mmap from /dev/zero works],
328   gcc_cv_func_mmap_dev_zero,
329   [# Add a system to this blacklist if it has mmap() but /dev/zero
330    # does not exist, or if mmapping /dev/zero does not give anonymous
331    # zeroed pages with both the following properties:
332    # 1. If you map N consecutive pages in with one call, and then
333    #    unmap any subset of those pages, the pages that were not
334    #    explicitly unmapped remain accessible.
335    # 2. If you map two adjacent blocks of memory and then unmap them
336    #    both at once, they must both go away.
337    # Systems known to be in this category are Windows (all variants),
338    # VMS, and Darwin.
339    case "$host_os" in
340      vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
341         gcc_cv_func_mmap_dev_zero=no ;;
342      *)
343         gcc_cv_func_mmap_dev_zero=yes;;
344    esac])
345
346    # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
347    AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
348     [AC_TRY_COMPILE(
349 [#include <sys/types.h>
350 #include <sys/mman.h>
351 #include <unistd.h>
352
353 #ifndef MAP_ANONYMOUS
354 #define MAP_ANONYMOUS MAP_ANON
355 #endif
356 ],
357 [int n = MAP_ANONYMOUS;],
358     gcc_cv_decl_map_anon=yes,
359     gcc_cv_decl_map_anon=no)])
360
361    if test $gcc_cv_decl_map_anon = no; then
362      gcc_cv_func_mmap_anon=no
363    else
364      AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
365      gcc_cv_func_mmap_anon,
366   [# Add a system to this blacklist if it has mmap() and MAP_ANON or
367    # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
368    # doesn't give anonymous zeroed pages with the same properties listed
369    # above for use of /dev/zero.
370    # Systems known to be in this category are Windows, VMS, and SCO Unix.
371    case "$host_os" in
372      vms* | cygwin* | pe | mingw* | sco* | udk* )
373         gcc_cv_func_mmap_anon=no ;;
374      *)
375         gcc_cv_func_mmap_anon=yes;;
376    esac])
377    fi
378 fi
379
380 if test $gcc_cv_func_mmap_file = yes; then
381   AC_DEFINE(HAVE_MMAP_FILE, 1,
382             [Define if read-only mmap of a plain file works.])
383 fi
384 if test $gcc_cv_func_mmap_dev_zero = yes; then
385   AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
386             [Define if mmap of /dev/zero works.])
387 fi
388 if test $gcc_cv_func_mmap_anon = yes; then
389   AC_DEFINE(HAVE_MMAP_ANON, 1,
390             [Define if mmap with MAP_ANON(YMOUS) works.])
391 fi
392 ])
393
394 dnl Locate a program and check that its version is acceptable.
395 dnl AC_PROG_CHECK_VER(var, name, version-switch,
396 dnl                  version-extract-regexp, version-glob)
397 AC_DEFUN([gcc_AC_CHECK_PROG_VER],
398 [AC_CHECK_PROG([$1], [$2], [$2])
399 if test -n "[$]$1"; then
400   # Found it, now check the version.
401   AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
402 [changequote(<<,>>)dnl
403   ac_prog_version=`<<$>>$1 $3 2>&1 |
404                    sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
405 changequote([,])dnl
406   echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
407 changequote(<<,>>)dnl
408   case $ac_prog_version in
409     '')     gcc_cv_prog_$2_modern=no;;
410     <<$5>>)
411             gcc_cv_prog_$2_modern=yes;;
412     *)      gcc_cv_prog_$2_modern=no;;
413   esac
414 changequote([,])dnl
415 ])
416 else
417   gcc_cv_prog_$2_modern=no
418 fi
419 ])
420
421 dnl Determine if enumerated bitfields are unsigned.   ISO C says they can 
422 dnl be either signed or unsigned.
423 dnl
424 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
425 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
426 [AC_TRY_RUN(#include <stdlib.h>
427 enum t { BLAH = 128 } ;
428 struct s_t { enum t member : 8; } s ;
429 int main(void)
430 {            
431         s.member = BLAH;
432         if (s.member < 0) exit(1);
433         exit(0);
434
435 }, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
436 if test $gcc_cv_enum_bf_unsigned = yes; then
437   AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
438     [Define if enumerated bitfields are treated as unsigned values.])
439 fi])
440
441 dnl Probe number of bits in a byte.
442 dnl Note C89 requires CHAR_BIT >= 8.
443 dnl
444 AC_DEFUN([gcc_AC_C_CHAR_BIT],
445 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
446 [AC_EGREP_CPP(found,
447 [#ifdef HAVE_LIMITS_H
448 #include <limits.h>
449 #endif
450 #ifdef CHAR_BIT
451 found
452 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
453 ])
454 if test $gcc_cv_decl_char_bit = no; then
455   AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
456 [i=8
457  gcc_cv_c_nbby=
458  while test $i -lt 65; do
459    AC_TRY_COMPILE(,
460      [switch(0) {
461   case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
462   case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
463   ; }], 
464      [gcc_cv_c_nbby=$i; break])
465    i=`expr $i + 1`
466  done
467  test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
468 ])
469 if test $gcc_cv_c_nbby = failed; then
470   AC_MSG_ERROR(cannot determine number of bits in a byte)
471 else
472   AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
473   [Define as the number of bits in a byte, if \`limits.h' doesn't.])
474 fi
475 fi])
476
477 dnl Checking for long long.
478 dnl By Caolan McNamara <caolan@skynet.ie>
479 dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
480 dnl
481 AC_DEFUN([gcc_AC_C_LONG_LONG],
482 [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
483   [AC_TRY_COMPILE(,[long long int i;],
484          ac_cv_c_long_long=yes,
485          ac_cv_c_long_long=no)])
486   if test $ac_cv_c_long_long = yes; then
487     AC_DEFINE(HAVE_LONG_LONG, 1,
488       [Define if your compiler supports the \`long long' type.])
489   fi
490 AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
491   [AC_TRY_COMPILE(,[__int64 i;],
492         ac_cv_c___int64=yes,
493         ac_cv_c___int64=no)])
494   if test $ac_cv_c___int64 = yes; then
495     AC_DEFINE(HAVE___INT64, 1,
496       [Define if your compiler supports the \`__int64' type.])
497   fi
498 ])
499
500 #serial AM2
501
502 dnl From Bruno Haible.
503
504 AC_DEFUN([AM_ICONV],
505 [
506   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
507   dnl those with the standalone portable GNU libiconv installed).
508
509   am_cv_lib_iconv_ldpath=
510   AC_ARG_WITH([libiconv-prefix],
511 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
512     for dir in `echo "$withval" | tr : ' '`; do
513       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
514       if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
515     done
516    ])
517
518   AC_CHECK_HEADERS([iconv.h])
519
520   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
521     am_cv_func_iconv="no, consider installing GNU libiconv"
522     am_cv_lib_iconv=no
523     AC_TRY_LINK([#include <stdlib.h>
524 #include <iconv.h>],
525       [iconv_t cd = iconv_open("","");
526        iconv(cd,NULL,NULL,NULL,NULL);
527        iconv_close(cd);],
528       am_cv_func_iconv=yes)
529     if test "$am_cv_func_iconv" != yes; then
530       am_save_LIBS="$LIBS"
531       LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
532       AC_TRY_LINK([#include <stdlib.h>
533 #include <iconv.h>],
534         [iconv_t cd = iconv_open("","");
535          iconv(cd,NULL,NULL,NULL,NULL);
536          iconv_close(cd);],
537         am_cv_lib_iconv=yes
538         am_cv_func_iconv=yes)
539       LIBS="$am_save_LIBS"
540     fi
541   ])
542   if test "$am_cv_func_iconv" = yes; then
543     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
544     AC_MSG_CHECKING([for iconv declaration])
545     AC_CACHE_VAL(am_cv_proto_iconv, [
546       AC_TRY_COMPILE([
547 #include <stdlib.h>
548 #include <iconv.h>
549 extern
550 #ifdef __cplusplus
551 "C"
552 #endif
553 #if defined(__STDC__) || defined(__cplusplus)
554 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
555 #else
556 size_t iconv();
557 #endif
558 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
559       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);"])
560     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
561     AC_MSG_RESULT([$]{ac_t:-
562          }[$]am_cv_proto_iconv)
563     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
564       [Define as const if the declaration of iconv() needs const.])
565   fi
566   LIBICONV=
567   if test "$am_cv_lib_iconv" = yes; then
568     LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
569   fi
570   AC_SUBST(LIBICONV)
571 ])
572
573 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
574 [AC_ARG_ENABLE(initfini-array,
575         [  --enable-initfini-array      use .init_array/.fini_array sections],
576         [], [
577 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
578                  gcc_cv_initfini_array, [dnl
579   AC_TRY_RUN([
580 static int x = -1;
581 int main (void) { return x; }
582 int foo (void) { x = 0; }
583 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
584              [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
585              [gcc_cv_initfini_array=no])])
586   enable_initfini_array=$gcc_cv_initfini_array
587 ])
588 if test $enable_initfini_array = yes; then
589   AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
590     [Define .init_array/.fini_array sections are available and working.])
591 fi])
592
593 dnl # _gcc_COMPUTE_GAS_VERSION
594 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
595 dnl #
596 dnl # WARNING:
597 dnl # gcc_cv_as_gas_srcdir must be defined before this.
598 dnl # This gross requirement will go away eventually.
599 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
600 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
601 for f in $gcc_cv_as_bfd_srcdir/configure \
602          $gcc_cv_as_gas_srcdir/configure \
603          $gcc_cv_as_gas_srcdir/configure.in \
604          $gcc_cv_as_gas_srcdir/Makefile.in ; do
605   gcc_cv_gas_version=`grep '^VERSION=[[0-9]]*\.[[0-9]]*' $f`
606   if test x$gcc_cv_gas_version != x; then
607     break
608   fi
609 done
610 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
611 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
612 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
613 case $gcc_cv_gas_patch_version in
614   "") gcc_cv_gas_patch_version="0" ;;
615 esac
616 gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
617                             + $gcc_cv_gas_minor_version \) \* 1000 \
618                             + $gcc_cv_gas_patch_version`
619 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
620
621 dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
622 dnl #                     [command_if_true = :], [command_if_false = :])
623 dnl # Check to see if the version of GAS is greater than or
624 dnl # equal to the specified version.
625 dnl #
626 dnl # The first ifelse() shortens the shell code if the patchlevel
627 dnl # is unimportant (the usual case).  The others handle missing
628 dnl # commands.  Note that the tests are structured so that the most
629 dnl # common version number cases are tested first.
630 AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
631 [ifelse([$1], elf,
632  [if test $in_tree_gas_is_elf = yes \
633   &&],
634  [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
635   then dnl
636 ifelse([$5],,:,[$5])[]dnl
637 ifelse([$6],,,[
638   else $6])
639 fi])
640
641 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
642 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
643 ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
644                   [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
645
646 dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
647 dnl [extra switches to as], [assembler input],
648 dnl [extra testing logic], [command if feature available])
649 dnl
650 dnl Checks for an assembler feature.  If we are building an in-tree
651 dnl gas, the feature is available if the associated assembler version
652 dnl is greater than or equal to major.minor.patchlevel.  If not, then
653 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
654 dnl if assembly succeeds.  If EXTRA TESTING LOGIC is not the empty string,
655 dnl then it is run instead of simply setting CV to "yes" - it is responsible
656 dnl for doing so, if appropriate.
657 AC_DEFUN([gcc_GAS_CHECK_FEATURE],
658 [AC_CACHE_CHECK([assembler for $1], [$2],
659  [[$2]=no
660   ifelse([$3],,,[dnl
661   if test $in_tree_gas = yes; then
662     gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
663   el])if test x$gcc_cv_as != x; then
664     echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
665     if AC_TRY_COMMAND([$gcc_cv_as $4 -o conftest.o conftest.s >&AC_FD_CC])
666     then
667         ifelse([$6],, [$2]=yes, [$6])
668     else
669       echo "configure: failed program was" >&AC_FD_CC
670       cat conftest.s >&AC_FD_CC
671     fi
672     rm -f conftest.o conftest.s
673   fi])
674 ifelse([$7],,,[dnl
675 if test $[$2] = yes; then
676   $7
677 fi])])
678
679 # lcmessage.m4 serial 3 (gettext-0.11.3)
680 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
681 dnl This file is free software, distributed under the terms of the GNU
682 dnl General Public License.  As a special exception to the GNU General
683 dnl Public License, this file may be distributed as part of a program
684 dnl that contains a configuration script generated by Autoconf, under
685 dnl the same distribution terms as the rest of that program.
686 dnl
687 dnl This file can can be used in projects which are not available under
688 dnl the GNU General Public License or the GNU Library General Public
689 dnl License but which still want to provide support for the GNU gettext
690 dnl functionality.
691 dnl Please note that the actual code of the GNU gettext library is covered
692 dnl by the GNU Library General Public License, and the rest of the GNU
693 dnl gettext package package is covered by the GNU General Public License.
694 dnl They are *not* in the public domain.
695
696 dnl Authors:
697 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
698
699 # Check whether LC_MESSAGES is available in <locale.h>.
700
701 AC_DEFUN([AM_LC_MESSAGES],
702 [
703   AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
704     [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
705        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
706   if test $am_cv_val_LC_MESSAGES = yes; then
707     AC_DEFINE(HAVE_LC_MESSAGES, 1,
708       [Define if your <locale.h> file defines LC_MESSAGES.])
709   fi
710 ])