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