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