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