]> gcc.gnu.org Git - gcc.git/blame - gcc/aclocal.m4
re PR bootstrap/3163 ([3.3 Only] gcc/aclocal.m4 mmap test fails on UnixWare 7.1.1)
[gcc.git] / gcc / aclocal.m4
CommitLineData
4977bab6
ZW
1sinclude(../config/accross.m4)
2
827ae6cf
RO
3dnl See if stdbool.h properly defines bool and true/false.
4AC_DEFUN(gcc_AC_HEADER_STDBOOL,
5[AC_CACHE_CHECK([for working stdbool.h],
6 ac_cv_header_stdbool_h,
7[AC_TRY_COMPILE([#include <stdbool.h>],
8[bool foo = false;],
9ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
10if test $ac_cv_header_stdbool_h = yes; then
11 AC_DEFINE(HAVE_STDBOOL_H, 1,
12 [Define if you have a working <stdbool.h> header file.])
13fi
14])
15
16dnl See whether we can include both string.h and strings.h.
99e757d5 17AC_DEFUN(gcc_AC_HEADER_STRING,
ccc7d11a
KG
18[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
19 gcc_cv_header_string,
20[AC_TRY_COMPILE([#include <string.h>
21#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
22if test $gcc_cv_header_string = yes; then
91029a29 23 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
ccc7d11a
KG
24fi
25])
26
2f51182a 27dnl See whether we need a declaration for a function.
86cf1cbd
KG
28dnl The result is highly dependent on the INCLUDES passed in, so make sure
29dnl to use a different cache variable name in this macro if it is invoked
30dnl in a different context somewhere else.
f31e826b
KG
31dnl gcc_AC_CHECK_DECL(SYMBOL,
32dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
33AC_DEFUN(gcc_AC_CHECK_DECL,
34[AC_MSG_CHECKING([whether $1 is declared])
35AC_CACHE_VAL(gcc_cv_have_decl_$1,
36[AC_TRY_COMPILE([$4],
86cf1cbd
KG
37[#ifndef $1
38char *(*pfn) = (char *(*)) $1 ;
f31e826b
KG
39#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
40if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
41 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
a81fb89e 42else
f31e826b 43 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
2f51182a
DE
44fi
45])dnl
ac64120e 46
a81fb89e 47dnl Check multiple functions to see whether each needs a declaration.
f31e826b
KG
48dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
49dnl gcc_AC_CHECK_DECLS(SYMBOLS,
50dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
51AC_DEFUN(gcc_AC_CHECK_DECLS,
a81fb89e
KG
52[for ac_func in $1
53do
f31e826b
KG
54changequote(, )dnl
55 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
86cf1cbd 56changequote([, ])dnl
f31e826b
KG
57gcc_AC_CHECK_DECL($ac_func,
58 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
59 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
7afe8c41
KG
60dnl It is possible that the include files passed in here are local headers
61dnl which supply a backup declaration for the relevant prototype based on
62dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
63dnl will always return success. E.g. see libiberty.h's handling of
64dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
65dnl 1 so that any local headers used do not provide their own prototype
66dnl during this test.
67#undef $ac_tr_decl
68#define $ac_tr_decl 1
f31e826b
KG
69 $4
70)
a81fb89e 71done
86cf1cbd
KG
72dnl Automatically generate config.h entries via autoheader.
73if test x = y ; then
74 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
05e12634
ZW
75 [AC_DEFINE([HAVE_DECL_\&], 1,
76 [Define to 1 if we found this declaration otherwise define to 0.])])dnl
86cf1cbd 77fi
a81fb89e
KG
78])
79
f1b54f9b 80dnl See if the printf functions in libc support %p in format strings.
99e757d5 81AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
f1b54f9b
KG
82[AC_CACHE_CHECK(whether the printf functions support %p,
83 gcc_cv_func_printf_ptr,
84[AC_TRY_RUN([#include <stdio.h>
85
86cf1cbd 86int main()
f1b54f9b
KG
87{
88 char buf[64];
89 char *p = buf, *q = NULL;
90 sprintf(buf, "%p", p);
91 sscanf(buf, "%p", &q);
86cf1cbd 92 return (p != q);
f1b54f9b
KG
93}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
94 gcc_cv_func_printf_ptr=no)
95rm -f core core.* *.core])
96if test $gcc_cv_func_printf_ptr = yes ; then
91029a29 97 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
f1b54f9b
KG
98fi
99])
100
ac64120e 101dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
99e757d5 102AC_DEFUN(gcc_AC_PROG_LN_S,
ac64120e
JW
103[AC_MSG_CHECKING(whether ln -s works)
104AC_CACHE_VAL(gcc_cv_prog_LN_S,
e566af04
MH
105[rm -f conftestdata_t
106echo >conftestdata_f
107if ln -s conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
108then
109 gcc_cv_prog_LN_S="ln -s"
110else
e566af04 111 if ln conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
112 then
113 gcc_cv_prog_LN_S=ln
114 else
115 gcc_cv_prog_LN_S=cp
116 fi
117fi
e566af04 118rm -f conftestdata_f conftestdata_t
ac64120e
JW
119])dnl
120LN_S="$gcc_cv_prog_LN_S"
121if test "$gcc_cv_prog_LN_S" = "ln -s"; then
122 AC_MSG_RESULT(yes)
123else
124 if test "$gcc_cv_prog_LN_S" = "ln"; then
125 AC_MSG_RESULT([no, using ln])
126 else
127 AC_MSG_RESULT([no, and neither does ln, so using cp])
128 fi
129fi
130AC_SUBST(LN_S)dnl
131])
132
133dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
99e757d5 134AC_DEFUN(gcc_AC_PROG_LN,
ac64120e
JW
135[AC_MSG_CHECKING(whether ln works)
136AC_CACHE_VAL(gcc_cv_prog_LN,
e566af04
MH
137[rm -f conftestdata_t
138echo >conftestdata_f
139if ln conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
140then
141 gcc_cv_prog_LN="ln"
142else
e566af04 143 if ln -s conftestdata_f conftestdata_t 2>/dev/null
ac64120e
JW
144 then
145 gcc_cv_prog_LN="ln -s"
146 else
147 gcc_cv_prog_LN=cp
148 fi
149fi
e566af04 150rm -f conftestdata_f conftestdata_t
ac64120e
JW
151])dnl
152LN="$gcc_cv_prog_LN"
153if test "$gcc_cv_prog_LN" = "ln"; then
154 AC_MSG_RESULT(yes)
155else
156 if test "$gcc_cv_prog_LN" = "ln -s"; then
157 AC_MSG_RESULT([no, using ln -s])
158 else
159 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
160 fi
161fi
162AC_SUBST(LN)dnl
163])
76143254 164
e9b4fabf 165dnl See whether the stage1 host compiler accepts the volatile keyword.
99e757d5 166AC_DEFUN(gcc_AC_C_VOLATILE,
e9b4fabf
JL
167[AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
168[AC_TRY_COMPILE(, [volatile int foo;],
169 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
170if test $gcc_cv_c_volatile = yes ; then
91029a29 171 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
e9b4fabf
JL
172fi
173])
174
04cabffc
KG
175dnl Check whether long double is supported. This differs from the
176dnl built-in autoconf test in that it works for cross compiles.
99e757d5 177AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
04cabffc
KG
178[AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
179[if test "$GCC" = yes; then
180 gcc_cv_c_long_double=yes
181else
182AC_TRY_COMPILE(,
183[/* The Stardent Vistra knows sizeof(long double), but does not support it. */
184long double foo = 0.0;
185/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
186switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
187gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
188fi])
189if test $gcc_cv_c_long_double = yes; then
05e12634
ZW
190 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
191 [Define if your compiler supports the \`long double' type.])
04cabffc
KG
192fi
193])
194
827ae6cf
RO
195dnl Check whether _Bool is built-in.
196AC_DEFUN(gcc_AC_C__BOOL,
197[AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
198[AC_TRY_COMPILE(,
199[_Bool foo;],
200gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
201])
202if test $gcc_cv_c__bool = yes; then
203 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
204fi
205])
206
75923b2f
MK
207dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
208dnl of the usual 2.
99e757d5 209AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
75923b2f
MK
210[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
211[AC_TRY_COMPILE([
212#include <sys/types.h>
213#ifdef HAVE_SYS_STAT_H
214# include <sys/stat.h>
215#endif
216#ifdef HAVE_UNISTD_H
217# include <unistd.h>
218#endif
219#ifdef HAVE_DIRECT_H
220# include <direct.h>
221#endif], [mkdir ("foo", 0);],
222 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
223if test $gcc_cv_mkdir_takes_one_arg = yes ; then
91029a29 224 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
75923b2f
MK
225fi
226])
227
99e757d5 228AC_DEFUN(gcc_AC_PROG_INSTALL,
76143254
JL
229[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
230# Find a good install program. We prefer a C program (faster),
231# so one script is as good as another. But avoid the broken or
232# incompatible versions:
233# SysV /etc/install, /usr/sbin/install
234# SunOS /usr/etc/install
235# IRIX /sbin/install
236# AIX /bin/install
237# AFS /usr/afsws/bin/install, which mishandles nonexistent args
238# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
239# ./install, which can be erroneously created by make from ./install.sh.
240AC_MSG_CHECKING(for a BSD compatible install)
241if test -z "$INSTALL"; then
242AC_CACHE_VAL(ac_cv_path_install,
243[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
244 for ac_dir in $PATH; do
245 # Account for people who put trailing slashes in PATH elements.
246 case "$ac_dir/" in
247 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
248 *)
249 # OSF1 and SCO ODT 3.0 have their own names for install.
250 for ac_prog in ginstall scoinst install; do
251 if test -f $ac_dir/$ac_prog; then
252 if test $ac_prog = install &&
253 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
254 # AIX install. It has an incompatible calling convention.
255 # OSF/1 installbsd also uses dspmsg, but is usable.
256 :
257 else
258 ac_cv_path_install="$ac_dir/$ac_prog -c"
259 break 2
260 fi
261 fi
262 done
263 ;;
264 esac
265 done
266 IFS="$ac_save_IFS"
267])dnl
268 if test "${ac_cv_path_install+set}" = set; then
269 INSTALL="$ac_cv_path_install"
270 else
271 # As a last resort, use the slow shell script. We don't cache a
272 # path for INSTALL within a source directory, because that will
273 # break other packages using the cache if that directory is
274 # removed, or if the path is relative.
275 INSTALL="$ac_install_sh"
276 fi
277fi
278dnl We do special magic for INSTALL instead of AC_SUBST, to get
279dnl relative paths right.
280AC_MSG_RESULT($INSTALL)
5643c767 281AC_SUBST(INSTALL)dnl
76143254
JL
282
283# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
284# It thinks the first close brace ends the variable substitution.
285test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
286AC_SUBST(INSTALL_PROGRAM)dnl
287
288test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
289AC_SUBST(INSTALL_DATA)dnl
290])
ab87f8c8 291
67f28219
ZW
292dnl Test for GNAT.
293dnl We require the gnatbind program, and a compiler driver that
294dnl understands Ada. The user may set the driver name explicitly
295dnl with ADAC; also, the user's CC setting is tried. Failing that,
296dnl we try gcc and cc, then a sampling of names known to be used for
297dnl the Ada driver on various systems.
298dnl
299dnl Sets the shell variable have_gnat to yes or no as appropriate, and
300dnl substitutes GNATBIND and ADAC.
301AC_DEFUN([gcc_AC_PROG_GNAT],
302[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
303AC_CHECK_TOOL(GNATBIND, gnatbind, no)
304AC_CACHE_CHECK([for compiler driver that understands Ada],
305 gcc_cv_prog_adac,
306[cat >conftest.adb <<EOF
307procedure conftest is begin null; end conftest;
308EOF
309gcc_cv_prog_adac=no
310# Have to do ac_tool_prefix and user overrides by hand.
eb4b5f93 311for cand in ${ADAC+"$ADAC"} ${CC+"$CC"} \
67f28219
ZW
312 ${ac_tool_prefix}gcc gcc \
313 ${ac_tool_prefix}cc cc \
314 ${ac_tool_prefix}gnatgcc gnatgcc \
315 ${ac_tool_prefix}gnatcc gnatcc \
316 ${ac_tool_prefix}adagcc adagcc \
317 ${ac_tool_prefix}adacc adacc ; do
318 # There is a bug in all released versions of GCC which causes the
319 # driver to exit successfully when the appropriate language module
320 # has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
321 # Therefore we must check for the error message as well as an
322 # unsuccessful exit.
7be33370 323 errors=`($cand -c conftest.adb) 2>&1 || echo failure`
67f28219
ZW
324 if test x"$errors" = x; then
325 gcc_cv_prog_adac=$cand
326 break
327 fi
328done
329rm -f conftest.*])
330ADAC=$gcc_cv_prog_adac
331AC_SUBST(ADAC)
332
333if test x$GNATBIND != xno && test x$ADAC != xno; then
334 have_gnat=yes
335else
336 have_gnat=no
337fi
338])
339
ab87f8c8
JL
340#serial 1
341dnl This test replaces the one in autoconf.
342dnl Currently this macro should have the same name as the autoconf macro
343dnl because gettext's gettext.m4 (distributed in the automake package)
344dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
345dnl give these diagnostics:
346dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
347dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
348
349undefine([AC_ISC_POSIX])
350AC_DEFUN(AC_ISC_POSIX,
351 [
352 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
353 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
354 ]
355)
356
00036f5c
PT
357
358dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
359dnl like AC_PATH_PROG but use other cache variables
360AC_DEFUN(GCC_PATH_PROG,
361[# Extract the first word of "$2", so it can be a program name with args.
362set dummy $2; ac_word=[$]2
363AC_MSG_CHECKING([for $ac_word])
364AC_CACHE_VAL(gcc_cv_path_$1,
365[case "[$]$1" in
366 /*)
367 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
368 ;;
369 ?:/*)
370 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
371 ;;
372 *)
373 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
374dnl $ac_dummy forces splitting on constant user-supplied paths.
375dnl POSIX.2 word splitting is done only on the output of word expansions,
376dnl not every word. This closes a longstanding sh security hole.
377 ac_dummy="ifelse([$4], , $PATH, [$4])"
378 for ac_dir in $ac_dummy; do
379 test -z "$ac_dir" && ac_dir=.
380 if test -f $ac_dir/$ac_word; then
381 gcc_cv_path_$1="$ac_dir/$ac_word"
382 break
383 fi
384 done
385 IFS="$ac_save_ifs"
386dnl If no 3rd arg is given, leave the cache variable unset,
387dnl so GCC_PATH_PROGS will keep looking.
388ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
389])dnl
390 ;;
391esac])dnl
392$1="$gcc_cv_path_$1"
393if test -n "[$]$1"; then
394 AC_MSG_RESULT([$]$1)
395else
396 AC_MSG_RESULT(no)
397fi
398AC_SUBST($1)dnl
399])
400
1072ec3f
ZW
401# mmap(2) blacklisting. Some platforms provide the mmap library routine
402# but don't support all of the features we need from it.
403AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
404[if test $ac_cv_header_sys_mman_h != yes \
405 || test $ac_cv_func_mmap != yes; then
406 gcc_cv_func_mmap_file=no
407 gcc_cv_func_mmap_dev_zero=no
408 gcc_cv_func_mmap_anon=no
409else
410 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
411 gcc_cv_func_mmap_file,
412 [# Add a system to this blacklist if
413 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
414 # memory area containing the same data that you'd get if you applied
415 # read() to the same fd. The only system known to have a problem here
416 # is VMS, where text files have record structure.
417 case "$host_os" in
418 vms*)
419 gcc_cv_func_mmap_file=no ;;
420 *)
421 gcc_cv_func_mmap_file=yes;;
422 esac])
423 AC_CACHE_CHECK([whether mmap from /dev/zero works],
424 gcc_cv_func_mmap_dev_zero,
425 [# Add a system to this blacklist if it has mmap() but /dev/zero
426 # does not exist, or if mmapping /dev/zero does not give anonymous
427 # zeroed pages with both the following properties:
428 # 1. If you map N consecutive pages in with one call, and then
429 # unmap any subset of those pages, the pages that were not
430 # explicitly unmapped remain accessible.
431 # 2. If you map two adjacent blocks of memory and then unmap them
432 # both at once, they must both go away.
433 # Systems known to be in this category are Windows (all variants),
434 # VMS, and Darwin.
435 case "$host_os" in
436 vms* | cygwin* | pe | mingw* | darwin*)
437 gcc_cv_func_mmap_dev_zero=no ;;
438 *)
439 gcc_cv_func_mmap_dev_zero=yes;;
440 esac])
441
442 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
443 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
444 [AC_TRY_COMPILE(
445[#include <sys/types.h>
4acab94b 446#include <sys/mman.h>
1072ec3f 447#include <unistd.h>
825b6926 448
1072ec3f
ZW
449#ifndef MAP_ANONYMOUS
450#define MAP_ANONYMOUS MAP_ANON
825b6926 451#endif
1072ec3f
ZW
452],
453[int n = MAP_ANONYMOUS;],
454 gcc_cv_decl_map_anon=yes,
455 gcc_cv_decl_map_anon=no)])
456
457 if test $gcc_cv_decl_map_anon = no; then
458 gcc_cv_func_mmap_anon=no
459 else
460 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
461 gcc_cv_func_mmap_anon,
462 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
463 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
464 # doesn't give anonymous zeroed pages with the same properties listed
465 # above for use of /dev/zero.
466 # Systems known to be in this category are Windows, VMS, and SCO Unix.
467 case "$host_os" in
468 vms* | cygwin* | pe | mingw* | sco* | udk* )
469 gcc_cv_func_mmap_anon=no ;;
470 *)
471 gcc_cv_func_mmap_anon=yes;;
472 esac])
473 fi
825b6926
ZW
474fi
475
1072ec3f 476if test $gcc_cv_func_mmap_file = yes; then
56f02b88
ZW
477 AC_DEFINE(HAVE_MMAP_FILE, 1,
478 [Define if read-only mmap of a plain file works.])
479fi
1072ec3f
ZW
480if test $gcc_cv_func_mmap_dev_zero = yes; then
481 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
482 [Define if mmap of /dev/zero works.])
483fi
484if test $gcc_cv_func_mmap_anon = yes; then
485 AC_DEFINE(HAVE_MMAP_ANON, 1,
486 [Define if mmap with MAP_ANON(YMOUS) works.])
487fi
56f02b88 488])
09fa0705
ZW
489
490dnl Locate a program and check that its version is acceptable.
491dnl AC_PROG_CHECK_VER(var, name, version-switch,
492dnl version-extract-regexp, version-glob)
493AC_DEFUN(gcc_AC_CHECK_PROG_VER,
494[AC_CHECK_PROG([$1], [$2], [$2])
495if test -n "[$]$1"; then
496 # Found it, now check the version.
497 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
498[changequote(<<,>>)dnl
499 ac_prog_version=`<<$>>$1 $3 2>&1 |
500 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
05e12634 501changequote([,])dnl
09fa0705 502 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
05e12634 503changequote(<<,>>)dnl
09fa0705
ZW
504 case $ac_prog_version in
505 '') gcc_cv_prog_$2_modern=no;;
506 <<$5>>)
507 gcc_cv_prog_$2_modern=yes;;
508 *) gcc_cv_prog_$2_modern=no;;
509 esac
510changequote([,])dnl
511])
512else
513 gcc_cv_prog_$2_modern=no
514fi
515])
75e93faa
ZW
516
517dnl Determine if enumerated bitfields are unsigned. ISO C says they can
518dnl be either signed or unsigned.
519dnl
520AC_DEFUN(gcc_AC_C_ENUM_BF_UNSIGNED,
521[AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
522[AC_TRY_RUN(#include <stdlib.h>
523enum t { BLAH = 128 } ;
524struct s_t { enum t member : 8; } s ;
525int main(void)
526{
527 s.member = BLAH;
528 if (s.member < 0) exit(1);
529 exit(0);
530
531}, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
532if test $gcc_cv_enum_bf_unsigned = yes; then
533 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
534 [Define if enumerated bitfields are treated as unsigned values.])
535fi])
536
75e93faa
ZW
537dnl Probe number of bits in a byte.
538dnl Note C89 requires CHAR_BIT >= 8.
539dnl
540AC_DEFUN(gcc_AC_C_CHAR_BIT,
541[AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
542[AC_EGREP_CPP(found,
543[#ifdef HAVE_LIMITS_H
544#include <limits.h>
545#endif
546#ifdef CHAR_BIT
547found
548#endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
549])
550if test $gcc_cv_decl_char_bit = no; then
551 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
552[i=8
553 gcc_cv_c_nbby=
554 while test $i -lt 65; do
555 AC_TRY_COMPILE(,
4e70264f
ZW
556 [switch(0) {
557 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
558 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
559 ; }],
560 [gcc_cv_c_nbby=$i; break])
75e93faa
ZW
561 i=`expr $i + 1`
562 done
563 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
564])
565if test $gcc_cv_c_nbby = failed; then
566 AC_MSG_ERROR(cannot determine number of bits in a byte)
567else
568 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
569 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
570fi
571fi])
572
573dnl Checking for long long.
574dnl By Caolan McNamara <caolan@skynet.ie>
575dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
576dnl
577AC_DEFUN([gcc_AC_C_LONG_LONG],
578[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
579 [AC_TRY_COMPILE(,[long long int i;],
580 ac_cv_c_long_long=yes,
581 ac_cv_c_long_long=no)])
582 if test $ac_cv_c_long_long = yes; then
583 AC_DEFINE(HAVE_LONG_LONG, 1,
584 [Define if your compiler supports the \`long long' type.])
585 fi
586AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
587 [AC_TRY_COMPILE(,[__int64 i;],
588 ac_cv_c___int64=yes,
589 ac_cv_c___int64=no)])
590 if test $ac_cv_c___int64 = yes; then
591 AC_DEFINE(HAVE___INT64, 1,
592 [Define if your compiler supports the \`__int64' type.])
593 fi
594])
84c041a1
ZW
595
596dnl Host character set probe.
597dnl The EBCDIC values match the table in config/i370/i370.c;
598dnl there are other versions of EBCDIC but GCC won't work with them.
599dnl
600AC_DEFUN([gcc_AC_C_CHARSET],
601[AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
602 [AC_EGREP_CPP(ASCII,
603[#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
604 && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
605ASCII
606#endif], ac_cv_c_charset=ASCII)
607 if test x${ac_cv_c_charset+set} != xset; then
608 AC_EGREP_CPP(EBCDIC,
609[#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
610 && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
611EBCDIC
612#endif], ac_cv_c_charset=EBCDIC)
613 fi
614 if test x${ac_cv_c_charset+set} != xset; then
615 ac_cv_c_charset=unknown
616 fi])
617if test $ac_cv_c_charset = unknown; then
618 AC_MSG_ERROR([*** Cannot determine host character set.])
619elif test $ac_cv_c_charset = EBCDIC; then
620 AC_DEFINE(HOST_EBCDIC, 1,
621 [Define if the host execution character set is EBCDIC.])
622fi])
623
f91abfce
TT
624#serial AM2
625
626dnl From Bruno Haible.
627
628AC_DEFUN([AM_ICONV],
629[
630 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
631 dnl those with the standalone portable GNU libiconv installed).
632
b7f2fb96 633 am_cv_lib_iconv_ldpath=
f91abfce
TT
634 AC_ARG_WITH([libiconv-prefix],
635[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
636 for dir in `echo "$withval" | tr : ' '`; do
637 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
b7f2fb96 638 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
f91abfce
TT
639 done
640 ])
641
642 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
643 am_cv_func_iconv="no, consider installing GNU libiconv"
644 am_cv_lib_iconv=no
645 AC_TRY_LINK([#include <stdlib.h>
646#include <iconv.h>],
647 [iconv_t cd = iconv_open("","");
648 iconv(cd,NULL,NULL,NULL,NULL);
649 iconv_close(cd);],
650 am_cv_func_iconv=yes)
651 if test "$am_cv_func_iconv" != yes; then
652 am_save_LIBS="$LIBS"
b7f2fb96 653 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
f91abfce
TT
654 AC_TRY_LINK([#include <stdlib.h>
655#include <iconv.h>],
656 [iconv_t cd = iconv_open("","");
657 iconv(cd,NULL,NULL,NULL,NULL);
658 iconv_close(cd);],
659 am_cv_lib_iconv=yes
660 am_cv_func_iconv=yes)
661 LIBS="$am_save_LIBS"
662 fi
663 ])
664 if test "$am_cv_func_iconv" = yes; then
665 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
666 AC_MSG_CHECKING([for iconv declaration])
667 AC_CACHE_VAL(am_cv_proto_iconv, [
668 AC_TRY_COMPILE([
669#include <stdlib.h>
670#include <iconv.h>
671extern
672#ifdef __cplusplus
673"C"
674#endif
675#if defined(__STDC__) || defined(__cplusplus)
676size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
677#else
678size_t iconv();
679#endif
680], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
681 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);"])
682 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
683 AC_MSG_RESULT([$]{ac_t:-
684 }[$]am_cv_proto_iconv)
685 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
686 [Define as const if the declaration of iconv() needs const.])
687 fi
688 LIBICONV=
689 if test "$am_cv_lib_iconv" = yes; then
b7f2fb96 690 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
f91abfce
TT
691 fi
692 AC_SUBST(LIBICONV)
693])
71a94577
ZW
694
695### Gettext macros begin here.
696### Changes for GCC marked by 'dnl GCC LOCAL'.
697### Note iconv.m4 appears above, as it's used for other reasons.
698
699#serial AM1
700
701dnl From Bruno Haible.
702
703AC_DEFUN([AM_LANGINFO_CODESET],
704[
705 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
706 [AC_TRY_LINK([#include <langinfo.h>],
707 [char* cs = nl_langinfo(CODESET);],
708 am_cv_langinfo_codeset=yes,
709 am_cv_langinfo_codeset=no)
710 ])
711 if test $am_cv_langinfo_codeset = yes; then
712 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
713 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
714 fi
715])
716
717#serial 1
718# This test replaces the one in autoconf.
719# Currently this macro should have the same name as the autoconf macro
720# because gettext's gettext.m4 (distributed in the automake package)
721# still uses it. Otherwise, the use in gettext.m4 makes autoheader
722# give these diagnostics:
723# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
724# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
725
726undefine([AC_ISC_POSIX])
727
728AC_DEFUN([AC_ISC_POSIX],
729 [
730 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
731 dnl GCC LOCAL: Use AC_SEARCH_LIBS.
732 AC_SEARCH_LIBS(strerror, cposix)
733 ]
734)
735
736#serial 2
737
738# Test for the GNU C Library, version 2.1 or newer.
739# From Bruno Haible.
740
741AC_DEFUN([jm_GLIBC21],
742 [
743 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
744 ac_cv_gnu_library_2_1,
745 [AC_EGREP_CPP([Lucky GNU user],
746 [
747#include <features.h>
748#ifdef __GNU_LIBRARY__
749 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
750 Lucky GNU user
751 #endif
752#endif
753 ],
754 ac_cv_gnu_library_2_1=yes,
755 ac_cv_gnu_library_2_1=no)
756 ]
757 )
758 AC_SUBST(GLIBC21)
759 GLIBC21="$ac_cv_gnu_library_2_1"
760 ]
761)
762
763# Check whether LC_MESSAGES is available in <locale.h>.
764# Ulrich Drepper <drepper@cygnus.com>, 1995.
765#
766# This file can be copied and used freely without restrictions. It can
767# be used in projects which are not available under the GNU General Public
768# License or the GNU Library General Public License but which still want
769# to provide support for the GNU gettext functionality.
770# Please note that the actual code of the GNU gettext library is covered
771# by the GNU Library General Public License, and the rest of the GNU
772# gettext package package is covered by the GNU General Public License.
773# They are *not* in the public domain.
774
775# serial 2
776
777AC_DEFUN([AM_LC_MESSAGES],
778 [if test $ac_cv_header_locale_h = yes; then
779 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
780 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
781 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
782 if test $am_cv_val_LC_MESSAGES = yes; then
783 AC_DEFINE(HAVE_LC_MESSAGES, 1,
784 [Define if your <locale.h> file defines LC_MESSAGES.])
785 fi
786 fi])
787
788# Search path for a program which passes the given test.
789# Ulrich Drepper <drepper@cygnus.com>, 1996.
790#
791# This file can be copied and used freely without restrictions. It can
792# be used in projects which are not available under the GNU General Public
793# License or the GNU Library General Public License but which still want
794# to provide support for the GNU gettext functionality.
795# Please note that the actual code of the GNU gettext library is covered
796# by the GNU Library General Public License, and the rest of the GNU
797# gettext package package is covered by the GNU General Public License.
798# They are *not* in the public domain.
799
800# serial 2
801
802dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
803dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
804AC_DEFUN([AM_PATH_PROG_WITH_TEST],
805[# Extract the first word of "$2", so it can be a program name with args.
806set dummy $2; ac_word=[$]2
807AC_MSG_CHECKING([for $ac_word])
808AC_CACHE_VAL(ac_cv_path_$1,
809[case "[$]$1" in
810 /*)
811 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
812 ;;
813 *)
814 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
815 for ac_dir in ifelse([$5], , $PATH, [$5]); do
816 test -z "$ac_dir" && ac_dir=.
817 if test -f $ac_dir/$ac_word; then
818 if [$3]; then
819 ac_cv_path_$1="$ac_dir/$ac_word"
820 break
821 fi
822 fi
823 done
824 IFS="$ac_save_ifs"
825dnl If no 4th arg is given, leave the cache variable unset,
826dnl so AC_PATH_PROGS will keep looking.
827ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
828])dnl
829 ;;
830esac])dnl
831$1="$ac_cv_path_$1"
832if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
833 AC_MSG_RESULT([$]$1)
834else
835 AC_MSG_RESULT(no)
836fi
837AC_SUBST($1)dnl
838])
839
840# Macro to add for using GNU gettext.
841# Ulrich Drepper <drepper@cygnus.com>, 1995.
842#
843# This file can be copied and used freely without restrictions. It can
844# be used in projects which are not available under the GNU General Public
845# License or the GNU Library General Public License but which still want
846# to provide support for the GNU gettext functionality.
847# Please note that the actual code of the GNU gettext library is covered
848# by the GNU Library General Public License, and the rest of the GNU
849# gettext package package is covered by the GNU General Public License.
850# They are *not* in the public domain.
851
852# serial 10
853
854dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
855dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
856dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
857dnl depending on --{enable,disable}-{shared,static} and on the presence of
858dnl AM-DISABLE-SHARED). Otherwise, a static library
859dnl $(top_builddir)/intl/libintl.a will be created.
860dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
861dnl implementations (in libc or libintl) without the ngettext() function
862dnl will be ignored.
863dnl LIBDIR is used to find the intl libraries. If empty,
864dnl the value `$(top_builddir)/intl/' is used.
865dnl
866dnl The result of the configuration is one of three cases:
867dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
868dnl and used.
869dnl Catalog format: GNU --> install in $(datadir)
870dnl Catalog extension: .mo after installation, .gmo in source tree
871dnl 2) GNU gettext has been found in the system's C library.
872dnl Catalog format: GNU --> install in $(datadir)
873dnl Catalog extension: .mo after installation, .gmo in source tree
874dnl 3) No internationalization, always use English msgid.
875dnl Catalog format: none
876dnl Catalog extension: none
877dnl The use of .gmo is historical (it was needed to avoid overwriting the
878dnl GNU format catalogs when building on a platform with an X/Open gettext),
879dnl but we keep it in order not to force irrelevant filename changes on the
880dnl maintainers.
881dnl
882AC_DEFUN([AM_WITH_NLS],
883 [AC_MSG_CHECKING([whether NLS is requested])
884 dnl Default is enabled NLS
885 AC_ARG_ENABLE(nls,
886 [ --disable-nls do not use Native Language Support],
887 USE_NLS=$enableval, USE_NLS=yes)
888 AC_MSG_RESULT($USE_NLS)
889 AC_SUBST(USE_NLS)
890
891 BUILD_INCLUDED_LIBINTL=no
892 USE_INCLUDED_LIBINTL=no
77c06844 893dnl GCC LOCAL: Separate concept of link command line from dependencies.
71a94577 894 INTLLIBS=
77c06844 895 INTLDEPS=
71a94577
ZW
896
897 dnl If we use NLS figure out what method
898 if test "$USE_NLS" = "yes"; then
899 AC_DEFINE(ENABLE_NLS, 1,
900 [Define to 1 if translation of program messages to the user's native language
901 is requested.])
902 AC_MSG_CHECKING([whether included gettext is requested])
903 AC_ARG_WITH(included-gettext,
904 [ --with-included-gettext use the GNU gettext library included here],
905 nls_cv_force_use_gnu_gettext=$withval,
906 nls_cv_force_use_gnu_gettext=no)
907 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
908
909 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
910 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
911 dnl User does not insist on using GNU NLS library. Figure out what
912 dnl to use. If GNU gettext is available we use this. Else we have
913 dnl to fall back to GNU NLS library.
914 CATOBJEXT=NONE
915
916 dnl Add a version number to the cache macros.
917 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
918 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
919
191bf464 920dnl GCC LOCAL: Expose presence of libintl.h to C code.
71a94577 921 AC_CHECK_HEADER(libintl.h,
191bf464
ZW
922 [AC_DEFINE([HAVE_LIBINTL_H], 1,
923 [Define if you have the <libintl.h> header file.])
924 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
71a94577
ZW
925 [AC_TRY_LINK([#include <libintl.h>
926extern int _nl_msg_cat_cntr;],
927 [bindtextdomain ("", "");
928return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
929 gt_cv_func_gnugettext_libc=yes,
930 gt_cv_func_gnugettext_libc=no)])
931
932 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
933 AC_CACHE_CHECK([for GNU gettext in libintl],
934 gt_cv_func_gnugettext_libintl,
935 [gt_save_LIBS="$LIBS"
936 LIBS="$LIBS -lintl $LIBICONV"
937 AC_TRY_LINK([#include <libintl.h>
938extern int _nl_msg_cat_cntr;],
939 [bindtextdomain ("", "");
940return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
941 gt_cv_func_gnugettext_libintl=yes,
942 gt_cv_func_gnugettext_libintl=no)
943 LIBS="$gt_save_LIBS"])
944 fi
945
946 dnl If an already present or preinstalled GNU gettext() is found,
947 dnl use it. But if this macro is used in GNU gettext, and GNU
948 dnl gettext is already preinstalled in libintl, we update this
949 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
950 if test "$gt_cv_func_gnugettext_libc" = "yes" \
951 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
952 && test "$PACKAGE" != gettext; }; then
953 AC_DEFINE(HAVE_GETTEXT, 1,
954 [Define if the GNU gettext() function is already present or preinstalled.])
955
956 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
957 dnl If iconv() is in a separate libiconv library, then anyone
958 dnl linking with libintl{.a,.so} also needs to link with
959 dnl libiconv.
960 INTLLIBS="-lintl $LIBICONV"
961 fi
962
963 gt_save_LIBS="$LIBS"
964 LIBS="$LIBS $INTLLIBS"
965 AC_CHECK_FUNCS(dcgettext)
966 LIBS="$gt_save_LIBS"
967
968 dnl Search for GNU msgfmt in the PATH.
969 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
970 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
971 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
972
973 dnl Search for GNU xgettext in the PATH.
974 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
975 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
976
977 CATOBJEXT=.gmo
978 fi
979 ])
980
981 if test "$CATOBJEXT" = "NONE"; then
982 dnl GNU gettext is not found in the C library.
983 dnl Fall back on GNU gettext library.
984 nls_cv_use_gnu_gettext=yes
985 fi
986 fi
987
988 if test "$nls_cv_use_gnu_gettext" = "yes"; then
989 dnl Mark actions used to generate GNU NLS library.
990 INTLOBJS="\$(GETTOBJS)"
991 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
992 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
993 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
994 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
995 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
996 AC_SUBST(MSGFMT)
997 BUILD_INCLUDED_LIBINTL=yes
998 USE_INCLUDED_LIBINTL=yes
999 CATOBJEXT=.gmo
1000 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
77c06844 1001 INTLDEPS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a"
71a94577
ZW
1002 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1003 fi
1004
1005 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1006 dnl Test whether we really found GNU msgfmt.
1007 if test "$GMSGFMT" != ":"; then
1008 dnl If it is no GNU msgfmt we define it as : so that the
1009 dnl Makefiles still can work.
1010 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1011 : ;
1012 else
1013 AC_MSG_RESULT(
1014 [found msgfmt program is not GNU msgfmt; ignore it])
1015 GMSGFMT=":"
1016 fi
1017 fi
1018
1019 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1020 dnl Test whether we really found GNU xgettext.
1021 if test "$XGETTEXT" != ":"; then
1022 dnl If it is no GNU xgettext we define it as : so that the
1023 dnl Makefiles still can work.
1024 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1025 : ;
1026 else
1027 AC_MSG_RESULT(
1028 [found xgettext program is not GNU xgettext; ignore it])
1029 XGETTEXT=":"
1030 fi
1031 fi
1032
1033 dnl We need to process the po/ directory.
1034 POSUB=po
1035 fi
1036 AC_OUTPUT_COMMANDS(
1037 [for ac_file in $CONFIG_FILES; do
1038 # Support "outfile[:infile[:infile...]]"
1039 case "$ac_file" in
1040 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1041 esac
1042 # PO directories have a Makefile.in generated from Makefile.in.in.
1043 case "$ac_file" in */Makefile.in)
1044 # Adjust a relative srcdir.
1045 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1046 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1047 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1048 # In autoconf-2.13 it is called $ac_given_srcdir.
1049 # In autoconf-2.50 it is called $srcdir.
1050 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1051 case "$ac_given_srcdir" in
1052 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1053 /*) top_srcdir="$ac_given_srcdir" ;;
1054 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
1055 esac
1056 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1057 rm -f "$ac_dir/POTFILES"
1058 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1059 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1060 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1061 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1062 fi
1063 ;;
1064 esac
1065 done])
1066
1067
1068 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1069 dnl to 'yes' because some of the testsuite requires it.
1070 if test "$PACKAGE" = gettext; then
1071 BUILD_INCLUDED_LIBINTL=yes
1072 fi
1073
1074 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1075 dnl because plural.y uses bison specific features. It requires at least
1076 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1077 dnl compile.
1078 dnl bison is only needed for the maintainer (who touches plural.y). But in
1079 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1080 dnl the rule in general Makefile. Now, some people carelessly touch the
1081 dnl files or have a broken "make" program, hence the plural.c rule will
1082 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1083 dnl present or too old.
1084 AC_CHECK_PROGS([INTLBISON], [bison])
1085 if test -z "$INTLBISON"; then
1086 ac_verc_fail=yes
1087 else
1088 dnl Found it, now check the version.
1089 AC_MSG_CHECKING([version of bison])
1090changequote(<<,>>)dnl
1091 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1092 case $ac_prog_version in
1093 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1094 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1095changequote([,])dnl
1096 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1097 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1098 esac
1099 AC_MSG_RESULT([$ac_prog_version])
1100 fi
1101 if test $ac_verc_fail = yes; then
1102 INTLBISON=:
1103 fi
1104
9f6682b7 1105 dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
71a94577
ZW
1106
1107 dnl Make all variables we use known to autoconf.
1108 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1109 AC_SUBST(USE_INCLUDED_LIBINTL)
1110 AC_SUBST(CATALOGS)
1111 AC_SUBST(CATOBJEXT)
71a94577 1112 AC_SUBST(INTLLIBS)
77c06844 1113 AC_SUBST(INTLDEPS)
71a94577 1114 AC_SUBST(INTLOBJS)
71a94577 1115 AC_SUBST(POSUB)
191bf464
ZW
1116dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
1117 if test $USE_INCLUDED_LIBINTL = yes; then
1118 AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
1119 [Define to use the libintl included with this package instead of any
1120 version in the system libraries.])
1121 fi
71a94577
ZW
1122
1123 dnl For backward compatibility. Some configure.ins may be using this.
1124 nls_cv_header_intl=
1125 nls_cv_header_libgt=
1126
1127 dnl For backward compatibility. Some Makefiles may be using this.
1128 DATADIRNAME=share
1129 AC_SUBST(DATADIRNAME)
1130
1131 dnl For backward compatibility. Some Makefiles may be using this.
1132 INSTOBJEXT=.mo
1133 AC_SUBST(INSTOBJEXT)
1134
1135 dnl For backward compatibility. Some Makefiles may be using this.
1136 GENCAT=gencat
1137 AC_SUBST(GENCAT)
1138 ])
1139
1140dnl Usage: Just like AM_WITH_NLS, which see.
1141AC_DEFUN([AM_GNU_GETTEXT],
1142 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1143 AC_REQUIRE([AC_PROG_CC])dnl
1144 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1145 AC_REQUIRE([AC_PROG_RANLIB])dnl
1146 AC_REQUIRE([AC_ISC_POSIX])dnl
1147 AC_REQUIRE([AC_HEADER_STDC])dnl
1148 AC_REQUIRE([AC_C_CONST])dnl
1149 AC_REQUIRE([AC_C_INLINE])dnl
1150 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1151 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1152 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1153dnl GCC LOCAL: Do not refer to AC_FUNC_MMAP, we have special needs.
1154dnl AC_REQUIRE([AC_FUNC_MMAP])dnl
1155 AC_REQUIRE([jm_GLIBC21])dnl
1156
1157 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1158stdlib.h string.h unistd.h sys/param.h])
1159 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1160getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1161strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1162
1163 AM_ICONV
1164 AM_LANGINFO_CODESET
1165 AM_LC_MESSAGES
1166 AM_WITH_NLS([$1],[$2],[$3])
1167
9f6682b7
ZW
1168 dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
1169 dnl has been torn out and replaced with this more sensible scheme.
1170 if test "x$CATOBJEXT" != x; then
1171 AC_MSG_CHECKING(for catalogs to be installed)
1172 # Look for .po and .gmo files in the source directory.
1173 CATALOGS=
1174 XLINGUAS=
1175 for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
1176 # If there aren't any .gmo files the shell will give us the
1177 # literal string "../path/to/srcdir/po/*.gmo" which has to be
1178 # weeded out.
1179 case "$cat" in *\**)
1180 continue;;
1181 esac
1182 # The quadruple backslash is collapsed to a double backslash
1183 # by the backticks, then collapsed again by the double quotes,
1184 # leaving us with one backslash in the sed expression (right
1185 # before the dot that mustn't act as a wildcard). The dot to
1186 # be escaped in the second expression is hiding inside CATOBJEXT.
1187 cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
1188 lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
1189 # The user is allowed to set LINGUAS to a list of languages to
1190 # install catalogs for. If it's empty that means "all of them."
1191 if test "x$LINGUAS" = x; then
1192 CATALOGS="$CATALOGS $cat"
1193 XLINGUAS="$XLINGUAS $lang"
1194 else
1195 case "$LINGUAS" in *$lang*)
1196 CATALOGS="$CATALOGS $cat"
1197 XLINGUAS="$XLINGUAS $lang"
1198 ;;
1199 esac
1200 fi
1201 done
1202 LINGUAS="$XLINGUAS"
1203 AC_MSG_RESULT($LINGUAS)
71a94577
ZW
1204 fi
1205
1206 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1207 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1208 dnl Try to locate is.
1209 MKINSTALLDIRS=
1210 if test -n "$ac_aux_dir"; then
1211 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1212 fi
1213 if test -z "$MKINSTALLDIRS"; then
1214 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1215 fi
1216 AC_SUBST(MKINSTALLDIRS)
1217
1218 dnl Enable libtool support if the surrounding package wishes it.
1219 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1220 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1221 ])
07cf4226
DM
1222
1223AC_DEFUN(gcc_AC_INITFINI_ARRAY,
eb70d86d
AS
1224[AC_ARG_ENABLE(initfini-array,
1225 [ --enable-initfini-array use .init_array/.fini_array sections],
1226 [], [
1227AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
918c4fe4 1228 gcc_cv_initfini_array, [dnl
eb70d86d 1229 AC_TRY_RUN([
07cf4226
DM
1230static int x = -1;
1231int main (void) { return x; }
1232int foo (void) { x = 0; }
eb70d86d 1233int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
918c4fe4
AS
1234 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
1235 [gcc_cv_initfini_array=no])])
eb70d86d
AS
1236 enable_initfini_array=$gcc_cv_initfini_array
1237])
1238if test $enable_initfini_array = yes; then
1239 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
1240 [Define .init_array/.fini_array sections are available and working.])
1241fi])
ad9c4d9f
NN
1242
1243dnl # _gcc_COMPUTE_GAS_VERSION
1244dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
1245dnl #
1246dnl # WARNING:
1247dnl # gcc_cv_as_gas_srcdir must be defined before this.
1248dnl # This gross requirement will go away eventually.
1249AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
1250[gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1251for f in $gcc_cv_as_bfd_srcdir/configure \
1252 $gcc_cv_as_gas_srcdir/configure \
1253 $gcc_cv_as_gas_srcdir/configure.in \
1254 $gcc_cv_as_gas_srcdir/Makefile.in ; do
1255 gcc_cv_gas_version=`grep '^VERSION=[[0-9]]*\.[[0-9]]*' $f`
1256 if test x$gcc_cv_gas_version != x; then
1257 break
1258 fi
1259done
1260gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
1261gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
1262gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
1263]) []dnl # _gcc_COMPUTE_GAS_VERSION
1264
1265dnl # gcc_GAS_VERSION_GTE_IFELSE(major, minor, patchlevel,
1266dnl # [command_if_true = :], [command_if_false = :])
1267dnl # Check to see if the version of GAS is greater than or
1268dnl # equal to the specified version.
1269dnl #
1270dnl # The first ifelse() shortens the shell code if the patchlevel
1271dnl # is unimportant (the usual case). The others handle missing
1272dnl # commands. Note that the tests are structured so that the most
1273dnl # common version number cases are tested first.
1274AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
1275[AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION]) []dnl
1276ifelse([$3],[0],
1277[if test $gcc_cv_gas_major_version -eq $1 \
1278&& test $gcc_cv_gas_minor_version -ge $2 \
1279|| test $gcc_cv_gas_major_version -gt $1 ; then
1280],
1281[if test $gcc_cv_gas_major_version -eq $1 \
1282&& (test $gcc_cv_gas_minor_version -gt $2 \
1283 || (test $gcc_cv_gas_minor_version -eq $2 \
1284 && test $gcc_cv_gas_patch_version -ge $3 )) \
1285|| test $gcc_cv_gas_major_version -gt $1 ; then
1286])
1287ifelse([$4],[],[:],[$4])
1288ifelse([$5],[],[],[else $5])
1289fi
1290]) []dnl # gcc_GAS_VERSION_GTE_IFELSE
1291
This page took 1.024082 seconds and 5 git commands to generate.