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