OSDN Git Service

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