OSDN Git Service

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