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