1 dnl See if stdbool.h properly defines bool and true/false.
2 AC_DEFUN(gcc_AC_HEADER_STDBOOL,
3 [AC_CACHE_CHECK([for working stdbool.h],
4 ac_cv_header_stdbool_h,
5 [AC_TRY_COMPILE([#include <stdbool.h>],
7 ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
8 if test $ac_cv_header_stdbool_h = yes; then
9 AC_DEFINE(HAVE_STDBOOL_H, 1,
10 [Define if you have a working <stdbool.h> header file.])
14 dnl See whether we can include both string.h and strings.h.
15 AC_DEFUN(gcc_AC_HEADER_STRING,
16 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
18 [AC_TRY_COMPILE([#include <string.h>
19 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
20 if test $gcc_cv_header_string = yes; then
21 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
25 dnl See whether we need a declaration for a function.
26 dnl The result is highly dependent on the INCLUDES passed in, so make sure
27 dnl to use a different cache variable name in this macro if it is invoked
28 dnl in a different context somewhere else.
29 dnl gcc_AC_CHECK_DECL(SYMBOL,
30 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
31 AC_DEFUN(gcc_AC_CHECK_DECL,
32 [AC_MSG_CHECKING([whether $1 is declared])
33 AC_CACHE_VAL(gcc_cv_have_decl_$1,
36 char *(*pfn) = (char *(*)) $1 ;
37 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
38 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
39 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
41 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
45 dnl Check multiple functions to see whether each needs a declaration.
46 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
47 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
48 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
49 AC_DEFUN(gcc_AC_CHECK_DECLS,
53 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
55 gcc_AC_CHECK_DECL($ac_func,
56 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
57 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
58 dnl It is possible that the include files passed in here are local headers
59 dnl which supply a backup declaration for the relevant prototype based on
60 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
61 dnl will always return success. E.g. see libiberty.h's handling of
62 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
63 dnl 1 so that any local headers used do not provide their own prototype
70 dnl Automatically generate config.h entries via autoheader.
72 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
73 [AC_DEFINE([HAVE_DECL_\&], 1,
74 [Define to 1 if we found this declaration otherwise define to 0.])])dnl
78 dnl See if the printf functions in libc support %p in format strings.
79 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
80 [AC_CACHE_CHECK(whether the printf functions support %p,
81 gcc_cv_func_printf_ptr,
82 [AC_TRY_RUN([#include <stdio.h>
87 char *p = buf, *q = NULL;
88 sprintf(buf, "%p", p);
89 sscanf(buf, "%p", &q);
91 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
92 gcc_cv_func_printf_ptr=no)
93 rm -f core core.* *.core])
94 if test $gcc_cv_func_printf_ptr = yes ; then
95 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
99 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
100 AC_DEFUN(gcc_AC_PROG_LN_S,
101 [AC_MSG_CHECKING(whether ln -s works)
102 AC_CACHE_VAL(gcc_cv_prog_LN_S,
103 [rm -f conftestdata_t
105 if ln -s conftestdata_f conftestdata_t 2>/dev/null
107 gcc_cv_prog_LN_S="ln -s"
109 if ln conftestdata_f conftestdata_t 2>/dev/null
116 rm -f conftestdata_f conftestdata_t
118 LN_S="$gcc_cv_prog_LN_S"
119 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
122 if test "$gcc_cv_prog_LN_S" = "ln"; then
123 AC_MSG_RESULT([no, using ln])
125 AC_MSG_RESULT([no, and neither does ln, so using cp])
131 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
132 AC_DEFUN(gcc_AC_PROG_LN,
133 [AC_MSG_CHECKING(whether ln works)
134 AC_CACHE_VAL(gcc_cv_prog_LN,
135 [rm -f conftestdata_t
137 if ln conftestdata_f conftestdata_t 2>/dev/null
141 if ln -s conftestdata_f conftestdata_t 2>/dev/null
143 gcc_cv_prog_LN="ln -s"
148 rm -f conftestdata_f conftestdata_t
151 if test "$gcc_cv_prog_LN" = "ln"; then
154 if test "$gcc_cv_prog_LN" = "ln -s"; then
155 AC_MSG_RESULT([no, using ln -s])
157 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
163 dnl See whether the stage1 host compiler accepts the volatile keyword.
164 AC_DEFUN(gcc_AC_C_VOLATILE,
165 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
166 [AC_TRY_COMPILE(, [volatile int foo;],
167 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
168 if test $gcc_cv_c_volatile = yes ; then
169 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
173 dnl Check whether long double is supported. This differs from the
174 dnl built-in autoconf test in that it works for cross compiles.
175 AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
176 [AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
177 [if test "$GCC" = yes; then
178 gcc_cv_c_long_double=yes
181 [/* The Stardent Vistra knows sizeof(long double), but does not support it. */
182 long double foo = 0.0;
183 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
184 switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
185 gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
187 if test $gcc_cv_c_long_double = yes; then
188 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
189 [Define if your compiler supports the \`long double' type.])
193 dnl Check whether _Bool is built-in.
194 AC_DEFUN(gcc_AC_C__BOOL,
195 [AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
198 gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
200 if test $gcc_cv_c__bool = yes; then
201 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
205 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
207 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
208 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
210 #include <sys/types.h>
211 #ifdef HAVE_SYS_STAT_H
212 # include <sys/stat.h>
219 #endif], [mkdir ("foo", 0);],
220 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
221 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
222 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
226 AC_DEFUN(gcc_AC_PROG_INSTALL,
227 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
228 # Find a good install program. We prefer a C program (faster),
229 # so one script is as good as another. But avoid the broken or
230 # incompatible versions:
231 # SysV /etc/install, /usr/sbin/install
232 # SunOS /usr/etc/install
235 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
236 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
237 # ./install, which can be erroneously created by make from ./install.sh.
238 AC_MSG_CHECKING(for a BSD compatible install)
239 if test -z "$INSTALL"; then
240 AC_CACHE_VAL(ac_cv_path_install,
241 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
242 for ac_dir in $PATH; do
243 # Account for people who put trailing slashes in PATH elements.
245 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
247 # OSF1 and SCO ODT 3.0 have their own names for install.
248 for ac_prog in ginstall scoinst install; do
249 if test -f $ac_dir/$ac_prog; then
250 if test $ac_prog = install &&
251 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
252 # AIX install. It has an incompatible calling convention.
253 # OSF/1 installbsd also uses dspmsg, but is usable.
256 ac_cv_path_install="$ac_dir/$ac_prog -c"
266 if test "${ac_cv_path_install+set}" = set; then
267 INSTALL="$ac_cv_path_install"
269 # As a last resort, use the slow shell script. We don't cache a
270 # path for INSTALL within a source directory, because that will
271 # break other packages using the cache if that directory is
272 # removed, or if the path is relative.
273 INSTALL="$ac_install_sh"
276 dnl We do special magic for INSTALL instead of AC_SUBST, to get
277 dnl relative paths right.
278 AC_MSG_RESULT($INSTALL)
281 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
282 # It thinks the first close brace ends the variable substitution.
283 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
284 AC_SUBST(INSTALL_PROGRAM)dnl
286 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
287 AC_SUBST(INSTALL_DATA)dnl
291 dnl We require the gnatbind program, and a compiler driver that
292 dnl understands Ada. The user may set the driver name explicitly
293 dnl with ADAC; also, the user's CC setting is tried. Failing that,
294 dnl we try gcc and cc, then a sampling of names known to be used for
295 dnl the Ada driver on various systems.
297 dnl Sets the shell variable have_gnat to yes or no as appropriate, and
298 dnl substitutes GNATBIND and ADAC.
299 AC_DEFUN([gcc_AC_PROG_GNAT],
300 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
301 AC_CHECK_TOOL(GNATBIND, gnatbind, no)
302 AC_CACHE_CHECK([for compiler driver that understands Ada],
304 [cat >conftest.adb <<EOF
305 procedure conftest is begin null; end conftest;
308 # Have to do ac_tool_prefix and user overrides by hand.
311 for cand in ${ac_tool_prefix}$user_adac $user_adac \
312 ${ac_tool_prefix}$user_cc $user_cc \
313 ${ac_tool_prefix}gcc gcc \
314 ${ac_tool_prefix}cc cc \
315 ${ac_tool_prefix}gnatgcc gnatgcc \
316 ${ac_tool_prefix}gnatcc gnatcc \
317 ${ac_tool_prefix}adagcc adagcc \
318 ${ac_tool_prefix}adacc adacc ; do
319 # There is a bug in all released versions of GCC which causes the
320 # driver to exit successfully when the appropriate language module
321 # has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
322 # Therefore we must check for the error message as well as an
324 errors=`($cand -c conftest.adb) 2>&1 || echo failure`
325 if test x"$errors" = x; then
326 gcc_cv_prog_adac=$cand
331 ADAC=$gcc_cv_prog_adac
334 if test x$GNATBIND != xno && test x$ADAC != xno; then
342 dnl This test replaces the one in autoconf.
343 dnl Currently this macro should have the same name as the autoconf macro
344 dnl because gettext's gettext.m4 (distributed in the automake package)
345 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
346 dnl give these diagnostics:
347 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
348 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
350 undefine([AC_ISC_POSIX])
351 AC_DEFUN(AC_ISC_POSIX,
353 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
354 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
359 dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
360 dnl like AC_PATH_PROG but use other cache variables
361 AC_DEFUN(GCC_PATH_PROG,
362 [# Extract the first word of "$2", so it can be a program name with args.
363 set dummy $2; ac_word=[$]2
364 AC_MSG_CHECKING([for $ac_word])
365 AC_CACHE_VAL(gcc_cv_path_$1,
368 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
371 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
374 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
375 dnl $ac_dummy forces splitting on constant user-supplied paths.
376 dnl POSIX.2 word splitting is done only on the output of word expansions,
377 dnl not every word. This closes a longstanding sh security hole.
378 ac_dummy="ifelse([$4], , $PATH, [$4])"
379 for ac_dir in $ac_dummy; do
380 test -z "$ac_dir" && ac_dir=.
381 if test -f $ac_dir/$ac_word; then
382 gcc_cv_path_$1="$ac_dir/$ac_word"
387 dnl If no 3rd arg is given, leave the cache variable unset,
388 dnl so GCC_PATH_PROGS will keep looking.
389 ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
394 if test -n "[$]$1"; then
402 # Check whether mmap can map an arbitrary page from /dev/zero or with
403 # MAP_ANONYMOUS, without MAP_FIXED.
404 AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
405 [AC_CHECK_FUNCS(getpagesize)
406 # The test program for the next two tests is the same except for one
408 changequote({{{,}}})dnl
409 {{{cat >ct-mmap.inc <<'EOF'
410 #include <sys/types.h>
411 #include <sys/mman.h>
417 #if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
418 # define MAP_ANONYMOUS MAP_ANON
421 /* This mess was copied from the GNU getpagesize.h. */
422 #ifndef HAVE_GETPAGESIZE
423 # ifdef HAVE_UNISTD_H
427 /* Assume that all systems that can run configure have sys/param.h. */
428 # ifndef HAVE_SYS_PARAM_H
429 # define HAVE_SYS_PARAM_H 1
433 # define getpagesize() sysconf(_SC_PAGESIZE)
434 # else /* no _SC_PAGESIZE */
435 # ifdef HAVE_SYS_PARAM_H
436 # include <sys/param.h>
437 # ifdef EXEC_PAGESIZE
438 # define getpagesize() EXEC_PAGESIZE
439 # else /* no EXEC_PAGESIZE */
441 # define getpagesize() NBPG * CLSIZE
444 # endif /* no CLSIZE */
447 # define getpagesize() NBPC
450 # define getpagesize() PAGESIZE
451 # endif /* PAGESIZE */
452 # endif /* no NBPC */
453 # endif /* no NBPG */
454 # endif /* no EXEC_PAGESIZE */
455 # else /* no HAVE_SYS_PARAM_H */
456 # define getpagesize() 8192 /* punt totally */
457 # endif /* no HAVE_SYS_PARAM_H */
458 # endif /* no _SC_PAGESIZE */
460 #endif /* no HAVE_GETPAGESIZE */
463 # define MAP_FAILED -1
467 #define perror_exit(str, val) \
468 do { perror(str); exit(val); } while (0)
470 /* Some versions of cygwin mmap require that munmap is called with the
471 same parameters as mmap. GCC expects that this is not the case.
472 Test for various forms of this problem. Warning - icky signal games. */
474 static sigset_t unblock_sigsegv;
484 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
485 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
487 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
488 MAP_PRIVATE, devzero, 0);
496 sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
500 /* Basic functionality test. */
504 char *x = anonmap (pg);
505 if (x == (char *) MAP_FAILED)
506 perror_exit("test 0 mmap", 2);
510 if (munmap(x, pg) < 0)
511 perror_exit("test 0 munmap", 3);
514 /* 1. If we map a 2-page region and unmap its second page, the first page
519 char *x = anonmap (pg * 2);
520 if (x == (char *)MAP_FAILED)
521 perror_exit ("test 1 mmap", 4);
523 signal (SIGSEGV, sigsegv);
525 perror_exit ("test 1 fault", 5);
530 if (munmap (x + pg, pg) < 0)
531 perror_exit ("test 1 munmap 1", 6);
537 perror_exit ("test 1 no fault", 7);
539 if (munmap (x, pg) < 0)
540 perror_exit ("test 1 munmap 2", 8);
543 /* 2. If we map a 2-page region and unmap its first page, the second
548 char *x = anonmap (pg * 2);
549 if (x == (char *)MAP_FAILED)
550 perror_exit ("test 2 mmap", 9);
552 signal (SIGSEGV, sigsegv);
554 perror_exit ("test 2 fault", 10);
559 if (munmap (x, pg) < 0)
560 perror_exit ("test 2 munmap 1", 11);
567 perror_exit ("test 2 no fault", 12);
570 if (munmap (x+pg, pg) < 0)
571 perror_exit ("test 2 munmap 2", 13);
574 /* 3. If we map two adjacent 1-page regions and unmap them both with
575 one munmap, both must go away.
577 Getting two adjacent 1-page regions with two mmap calls is slightly
578 tricky. All OS's tested skip over already-allocated blocks; therefore
579 we have been careful to unmap all allocated regions in previous tests.
580 HP/UX allocates pages backward in memory. No OS has yet been observed
581 to be so perverse as to leave unmapped space between consecutive calls
590 if (x == (char *)MAP_FAILED)
591 perror_exit ("test 3 mmap 1", 14);
593 if (y == (char *)MAP_FAILED)
594 perror_exit ("test 3 mmap 2", 15);
602 fprintf (stderr, "test 3 nonconsecutive pages - %lx, %lx\n",
603 (unsigned long)x, (unsigned long)y);
608 signal (SIGSEGV, sigsegv);
610 perror_exit ("test 3 fault", 17);
615 if (munmap (x, pg*2) < 0)
616 perror_exit ("test 3 munmap", 18);
621 perror_exit ("test 3 no fault 1", 19);
624 signal (SIGSEGV, sigsegv);
628 perror_exit ("test 3 no fault 2", 20);
635 sigemptyset (&unblock_sigsegv);
636 sigaddset (&unblock_sigsegv, SIGSEGV);
639 devzero = open ("/dev/zero", O_RDWR);
641 perror_exit ("open /dev/zero", 1);
654 AC_CACHE_CHECK(for working mmap from /dev/zero,
655 ac_cv_func_mmap_dev_zero,
657 [#include "ct-mmap.inc"],
658 ac_cv_func_mmap_dev_zero=yes,
660 then ac_cv_func_mmap_dev_zero=no
661 else ac_cv_func_mmap_dev_zero=buggy
663 # When cross-building, assume that this works, unless we know it
664 # doesn't. Of course, we have no way of knowing if there even is a /dev/zero
665 # on the host, let alone whether mmap will work on it.
667 cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
668 darwin* ) ac_cv_func_mmap_dev_zero=no ;;
669 * ) ac_cv_func_mmap_dev_zero=yes ;;
672 if test $ac_cv_func_mmap_dev_zero = yes; then
673 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
674 [Define if mmap can get us zeroed pages from /dev/zero.])
677 AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
678 ac_cv_func_mmap_anon,
680 [#define USE_MAP_ANON
681 #include "ct-mmap.inc"],
682 ac_cv_func_mmap_anon=yes,
684 then ac_cv_func_mmap_anon=no
685 else ac_cv_func_mmap_anon=buggy
687 # Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
688 # just because it's there. Some SCO Un*xen define it but don't implement it.
690 darwin* ) ac_cv_func_mmap_anon=yes ;;
691 * ) ac_cv_func_mmap_anon=no ;;
694 if test $ac_cv_func_mmap_anon = yes; then
695 AC_DEFINE(HAVE_MMAP_ANON, 1,
696 [Define if mmap can get us zeroed pages using MAP_ANON(YMOUS).])
701 # Check whether mmap can map a plain file, without MAP_FIXED.
702 AC_DEFUN([AC_FUNC_MMAP_FILE],
703 [AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
704 [# Create a file one thousand bytes long.
705 for i in 1 2 3 4 5 6 7 8 9 0
706 do for j in 1 2 3 4 5 6 7 8 9 0
709 done > conftestdata$$
712 /* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
713 Richard Henderson and Alexandre Oliva.
714 Check whether read-only mmap of a plain file works. */
715 #include <sys/types.h>
716 #include <sys/stat.h>
718 #include <sys/mman.h>
726 fd = open("conftestdata$$", O_RDONLY);
733 x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
734 if (x == (char *) -1)
737 if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
740 if (munmap(x, st.st_size) < 0)
744 }], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
746 darwin* ) ac_cv_func_mmap_file=yes ;;
747 * ) ac_cv_func_mmap_file=no ;;
749 if test $ac_cv_func_mmap_file = yes; then
750 AC_DEFINE(HAVE_MMAP_FILE, 1,
751 [Define if read-only mmap of a plain file works.])
755 dnl Locate a program and check that its version is acceptable.
756 dnl AC_PROG_CHECK_VER(var, name, version-switch,
757 dnl version-extract-regexp, version-glob)
758 AC_DEFUN(gcc_AC_CHECK_PROG_VER,
759 [AC_CHECK_PROG([$1], [$2], [$2])
760 if test -n "[$]$1"; then
761 # Found it, now check the version.
762 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
763 [changequote(<<,>>)dnl
764 ac_prog_version=`<<$>>$1 $3 2>&1 |
765 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
767 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
768 changequote(<<,>>)dnl
769 case $ac_prog_version in
770 '') gcc_cv_prog_$2_modern=no;;
772 gcc_cv_prog_$2_modern=yes;;
773 *) gcc_cv_prog_$2_modern=no;;
778 gcc_cv_prog_$2_modern=no
782 dnl Determine if enumerated bitfields are unsigned. ISO C says they can
783 dnl be either signed or unsigned.
785 AC_DEFUN(gcc_AC_C_ENUM_BF_UNSIGNED,
786 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
787 [AC_TRY_RUN(#include <stdlib.h>
788 enum t { BLAH = 128 } ;
789 struct s_t { enum t member : 8; } s ;
793 if (s.member < 0) exit(1);
796 }, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
797 if test $gcc_cv_enum_bf_unsigned = yes; then
798 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
799 [Define if enumerated bitfields are treated as unsigned values.])
802 dnl Host type sizes probe.
803 dnl By Kaveh R. Ghazi. One typo fixed since.
805 AC_DEFUN([gcc_AC_COMPILE_CHECK_SIZEOF],
806 [changequote(<<, >>)dnl
807 dnl The name to #define.
808 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
809 dnl The cache variable name.
810 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
812 AC_MSG_CHECKING(size of $1)
813 AC_CACHE_VAL(AC_CV_NAME,
814 [for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
815 AC_TRY_COMPILE([#include "confdefs.h"
816 #include <sys/types.h>
818 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
819 if test x$AC_CV_NAME != x ; then break; fi
822 if test x$AC_CV_NAME = x ; then
823 AC_MSG_ERROR([cannot determine a size for $1])
825 AC_MSG_RESULT($AC_CV_NAME)
826 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
827 undefine([AC_TYPE_NAME])dnl
828 undefine([AC_CV_NAME])dnl
831 dnl Probe number of bits in a byte.
832 dnl Note C89 requires CHAR_BIT >= 8.
834 AC_DEFUN(gcc_AC_C_CHAR_BIT,
835 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
837 [#ifdef HAVE_LIMITS_H
842 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
844 if test $gcc_cv_decl_char_bit = no; then
845 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
848 while test $i -lt 65; do
851 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
852 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
854 [gcc_cv_c_nbby=$i; break])
857 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
859 if test $gcc_cv_c_nbby = failed; then
860 AC_MSG_ERROR(cannot determine number of bits in a byte)
862 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
863 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
867 dnl Checking for long long.
868 dnl By Caolan McNamara <caolan@skynet.ie>
869 dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
871 AC_DEFUN([gcc_AC_C_LONG_LONG],
872 [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
873 [AC_TRY_COMPILE(,[long long int i;],
874 ac_cv_c_long_long=yes,
875 ac_cv_c_long_long=no)])
876 if test $ac_cv_c_long_long = yes; then
877 AC_DEFINE(HAVE_LONG_LONG, 1,
878 [Define if your compiler supports the \`long long' type.])
880 AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
881 [AC_TRY_COMPILE(,[__int64 i;],
883 ac_cv_c___int64=no)])
884 if test $ac_cv_c___int64 = yes; then
885 AC_DEFINE(HAVE___INT64, 1,
886 [Define if your compiler supports the \`__int64' type.])
890 dnl Host character set probe.
891 dnl The EBCDIC values match the table in config/i370/i370.c;
892 dnl there are other versions of EBCDIC but GCC won't work with them.
894 AC_DEFUN([gcc_AC_C_CHARSET],
895 [AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
897 [#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
898 && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
900 #endif], ac_cv_c_charset=ASCII)
901 if test x${ac_cv_c_charset+set} != xset; then
903 [#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
904 && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
906 #endif], ac_cv_c_charset=EBCDIC)
908 if test x${ac_cv_c_charset+set} != xset; then
909 ac_cv_c_charset=unknown
911 if test $ac_cv_c_charset = unknown; then
912 AC_MSG_ERROR([*** Cannot determine host character set.])
913 elif test $ac_cv_c_charset = EBCDIC; then
914 AC_DEFINE(HOST_EBCDIC, 1,
915 [Define if the host execution character set is EBCDIC.])
918 dnl Utility macro used by next two tests.
919 dnl AC_EXAMINE_OBJECT(C source code,
920 dnl commands examining object file,
921 dnl [commands to run if compile failed]):
923 dnl Compile the source code to an object file; then convert it into a
924 dnl printable representation. All unprintable characters and
925 dnl asterisks (*) are replaced by dots (.). All white space is
926 dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
927 dnl output, but runs of newlines are compressed to a single newline.
928 dnl Finally, line breaks are forcibly inserted so that no line is
929 dnl longer than 80 columns and the file ends with a newline. The
930 dnl result of all this processing is in the file conftest.dmp, which
931 dnl may be examined by the commands in the second argument.
933 AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
936 dnl Next bit cribbed from AC_TRY_COMPILE.
937 cat > conftest.$ac_ext <<EOF
938 [#line __oline__ "configure"
939 #include "confdefs.h"
942 if AC_TRY_EVAL(ac_compile); then
944 sed ['s/^[0-7]*[ ]*/ /
947 s/ [0-9][0-9][0-9]/./g
961 dnl Host endianness probe.
962 dnl This tests byte-within-word endianness. GCC actually needs
963 dnl to know word-within-larger-object endianness. They are the
964 dnl same on all presently supported hosts.
965 dnl Differs from AC_C_BIGENDIAN in that it does not require
966 dnl running a program on the host, and it defines the macro we
969 AC_DEFUN([gcc_AC_C_COMPILE_ENDIAN],
970 [AC_CACHE_CHECK(byte ordering, ac_cv_c_compile_endian,
971 [ac_cv_c_compile_endian=unknown
972 gcc_AC_EXAMINE_OBJECT([
976 /* This structure must have no internal padding. */
978 char prefix[sizeof "\nendian:" - 1];
983 #if SIZEOF_SHORT == 4
984 ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
986 ('A' << CHAR_BIT) | 'B',
989 [if grep 'endian:AB' conftest.dmp >/dev/null 2>&1; then
990 ac_cv_c_compile_endian=big-endian
991 elif grep 'endian:BA' conftest.dmp >/dev/null 2>&1; then
992 ac_cv_c_compile_endian=little-endian
995 if test $ac_cv_c_compile_endian = unknown; then
996 AC_MSG_ERROR([*** unable to determine endianness])
997 elif test $ac_cv_c_compile_endian = big-endian; then
998 AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1,
999 [Define if the host machine stores words of multi-word integers in
1004 dnl Floating point format probe.
1005 dnl The basic concept is the same as the above: grep the object
1006 dnl file for an interesting string. We have to watch out for
1007 dnl rounding changing the values in the object, however; this is
1008 dnl handled by ignoring the least significant byte of the float.
1010 dnl Does not know about VAX G-float or C4x idiosyncratic format.
1011 dnl It does know about PDP-10 idiosyncratic format, but this is
1012 dnl not presently supported by GCC. S/390 "binary floating point"
1013 dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1016 AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1017 [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1018 [gcc_AC_EXAMINE_OBJECT(
1019 [/* This will not work unless sizeof(double) == 8. */
1020 extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1022 /* This structure must have no internal padding. */
1023 struct possibility {
1029 #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1030 struct possibility table [] =
1032 C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1033 C( 3.53802595280598432000e+18), /* D__float - VAX */
1034 C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1035 C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1036 C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
1038 [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1039 ac_cv_c_float_format='IEEE (big-endian)'
1040 elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1041 ac_cv_c_float_format='IEEE (big-endian)'
1042 elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1043 ac_cv_c_float_format='IEEE (little-endian)'
1044 elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1045 ac_cv_c_float_format='IEEE (little-endian)'
1046 elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1047 ac_cv_c_float_format='VAX D-float'
1048 elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1049 ac_cv_c_float_format='PDP-10'
1050 elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1051 ac_cv_c_float_format='IBM 370 hex'
1053 AC_MSG_ERROR(Unknown floating point format)
1055 [AC_MSG_ERROR(compile failed)])
1057 # IEEE is the default format. If the float endianness isn't the same
1058 # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1059 # (which is a tristate: yes, no, default). This is only an issue with
1060 # IEEE; the other formats are only supported by a few machines each,
1061 # all with the same endianness.
1064 case $ac_cv_c_float_format in
1065 'IEEE (big-endian)' )
1066 if test $ac_cv_c_compile_endian = little-endian; then
1070 'IEEE (little-endian)' )
1071 if test $ac_cv_c_compile_endian = big-endian; then
1076 format=VAX_FLOAT_FORMAT
1079 format=PDP10_FLOAT_FORMAT
1082 format=IBM_FLOAT_FORMAT
1085 if test -n "$format"; then
1086 AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1087 [Define to the floating point format of the host machine, if not IEEE.])
1089 if test -n "$fbigend"; then
1090 AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1091 [Define to 1 if the host machine stores floating point numbers in
1092 memory with the word containing the sign bit at the lowest address,
1093 or to 0 if it does it the other way around.
1095 This macro should not be defined if the ordering is the same as for
1096 multi-word integers.])
1102 dnl From Bruno Haible.
1104 AC_DEFUN([AM_ICONV],
1106 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1107 dnl those with the standalone portable GNU libiconv installed).
1109 am_cv_lib_iconv_ldpath=
1110 AC_ARG_WITH([libiconv-prefix],
1111 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
1112 for dir in `echo "$withval" | tr : ' '`; do
1113 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
1114 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
1118 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1119 am_cv_func_iconv="no, consider installing GNU libiconv"
1121 AC_TRY_LINK([#include <stdlib.h>
1122 #include <iconv.h>],
1123 [iconv_t cd = iconv_open("","");
1124 iconv(cd,NULL,NULL,NULL,NULL);
1126 am_cv_func_iconv=yes)
1127 if test "$am_cv_func_iconv" != yes; then
1128 am_save_LIBS="$LIBS"
1129 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
1130 AC_TRY_LINK([#include <stdlib.h>
1131 #include <iconv.h>],
1132 [iconv_t cd = iconv_open("","");
1133 iconv(cd,NULL,NULL,NULL,NULL);
1136 am_cv_func_iconv=yes)
1137 LIBS="$am_save_LIBS"
1140 if test "$am_cv_func_iconv" = yes; then
1141 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1142 AC_MSG_CHECKING([for iconv declaration])
1143 AC_CACHE_VAL(am_cv_proto_iconv, [
1151 #if defined(__STDC__) || defined(__cplusplus)
1152 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1156 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1157 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);"])
1158 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1159 AC_MSG_RESULT([$]{ac_t:-
1160 }[$]am_cv_proto_iconv)
1161 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1162 [Define as const if the declaration of iconv() needs const.])
1165 if test "$am_cv_lib_iconv" = yes; then
1166 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
1171 ### Gettext macros begin here.
1172 ### Changes for GCC marked by 'dnl GCC LOCAL'.
1173 ### Note iconv.m4 appears above, as it's used for other reasons.
1177 dnl From Bruno Haible.
1179 AC_DEFUN([AM_LANGINFO_CODESET],
1181 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1182 [AC_TRY_LINK([#include <langinfo.h>],
1183 [char* cs = nl_langinfo(CODESET);],
1184 am_cv_langinfo_codeset=yes,
1185 am_cv_langinfo_codeset=no)
1187 if test $am_cv_langinfo_codeset = yes; then
1188 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1189 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1194 # This test replaces the one in autoconf.
1195 # Currently this macro should have the same name as the autoconf macro
1196 # because gettext's gettext.m4 (distributed in the automake package)
1197 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
1198 # give these diagnostics:
1199 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1200 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1202 undefine([AC_ISC_POSIX])
1204 AC_DEFUN([AC_ISC_POSIX],
1206 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1207 dnl GCC LOCAL: Use AC_SEARCH_LIBS.
1208 AC_SEARCH_LIBS(strerror, cposix)
1214 # Test for the GNU C Library, version 2.1 or newer.
1215 # From Bruno Haible.
1217 AC_DEFUN([jm_GLIBC21],
1219 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1220 ac_cv_gnu_library_2_1,
1221 [AC_EGREP_CPP([Lucky GNU user],
1223 #include <features.h>
1224 #ifdef __GNU_LIBRARY__
1225 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1230 ac_cv_gnu_library_2_1=yes,
1231 ac_cv_gnu_library_2_1=no)
1235 GLIBC21="$ac_cv_gnu_library_2_1"
1239 # Check whether LC_MESSAGES is available in <locale.h>.
1240 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1242 # This file can be copied and used freely without restrictions. It can
1243 # be used in projects which are not available under the GNU General Public
1244 # License or the GNU Library General Public License but which still want
1245 # to provide support for the GNU gettext functionality.
1246 # Please note that the actual code of the GNU gettext library is covered
1247 # by the GNU Library General Public License, and the rest of the GNU
1248 # gettext package package is covered by the GNU General Public License.
1249 # They are *not* in the public domain.
1253 AC_DEFUN([AM_LC_MESSAGES],
1254 [if test $ac_cv_header_locale_h = yes; then
1255 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1256 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1257 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1258 if test $am_cv_val_LC_MESSAGES = yes; then
1259 AC_DEFINE(HAVE_LC_MESSAGES, 1,
1260 [Define if your <locale.h> file defines LC_MESSAGES.])
1264 # Search path for a program which passes the given test.
1265 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1267 # This file can be copied and used freely without restrictions. It can
1268 # be used in projects which are not available under the GNU General Public
1269 # License or the GNU Library General Public License but which still want
1270 # to provide support for the GNU gettext functionality.
1271 # Please note that the actual code of the GNU gettext library is covered
1272 # by the GNU Library General Public License, and the rest of the GNU
1273 # gettext package package is covered by the GNU General Public License.
1274 # They are *not* in the public domain.
1278 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1279 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1280 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
1281 [# Extract the first word of "$2", so it can be a program name with args.
1282 set dummy $2; ac_word=[$]2
1283 AC_MSG_CHECKING([for $ac_word])
1284 AC_CACHE_VAL(ac_cv_path_$1,
1287 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1290 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1291 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1292 test -z "$ac_dir" && ac_dir=.
1293 if test -f $ac_dir/$ac_word; then
1295 ac_cv_path_$1="$ac_dir/$ac_word"
1301 dnl If no 4th arg is given, leave the cache variable unset,
1302 dnl so AC_PATH_PROGS will keep looking.
1303 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1308 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1309 AC_MSG_RESULT([$]$1)
1316 # Macro to add for using GNU gettext.
1317 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1319 # This file can be copied and used freely without restrictions. It can
1320 # be used in projects which are not available under the GNU General Public
1321 # License or the GNU Library General Public License but which still want
1322 # to provide support for the GNU gettext functionality.
1323 # Please note that the actual code of the GNU gettext library is covered
1324 # by the GNU Library General Public License, and the rest of the GNU
1325 # gettext package package is covered by the GNU General Public License.
1326 # They are *not* in the public domain.
1330 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
1331 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
1332 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1333 dnl depending on --{enable,disable}-{shared,static} and on the presence of
1334 dnl AM-DISABLE-SHARED). Otherwise, a static library
1335 dnl $(top_builddir)/intl/libintl.a will be created.
1336 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1337 dnl implementations (in libc or libintl) without the ngettext() function
1338 dnl will be ignored.
1339 dnl LIBDIR is used to find the intl libraries. If empty,
1340 dnl the value `$(top_builddir)/intl/' is used.
1342 dnl The result of the configuration is one of three cases:
1343 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1345 dnl Catalog format: GNU --> install in $(datadir)
1346 dnl Catalog extension: .mo after installation, .gmo in source tree
1347 dnl 2) GNU gettext has been found in the system's C library.
1348 dnl Catalog format: GNU --> install in $(datadir)
1349 dnl Catalog extension: .mo after installation, .gmo in source tree
1350 dnl 3) No internationalization, always use English msgid.
1351 dnl Catalog format: none
1352 dnl Catalog extension: none
1353 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1354 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1355 dnl but we keep it in order not to force irrelevant filename changes on the
1358 AC_DEFUN([AM_WITH_NLS],
1359 [AC_MSG_CHECKING([whether NLS is requested])
1360 dnl Default is enabled NLS
1362 [ --disable-nls do not use Native Language Support],
1363 USE_NLS=$enableval, USE_NLS=yes)
1364 AC_MSG_RESULT($USE_NLS)
1367 BUILD_INCLUDED_LIBINTL=no
1368 USE_INCLUDED_LIBINTL=no
1369 dnl GCC LOCAL: Separate concept of link command line from dependencies.
1373 dnl If we use NLS figure out what method
1374 if test "$USE_NLS" = "yes"; then
1375 AC_DEFINE(ENABLE_NLS, 1,
1376 [Define to 1 if translation of program messages to the user's native language
1378 AC_MSG_CHECKING([whether included gettext is requested])
1379 AC_ARG_WITH(included-gettext,
1380 [ --with-included-gettext use the GNU gettext library included here],
1381 nls_cv_force_use_gnu_gettext=$withval,
1382 nls_cv_force_use_gnu_gettext=no)
1383 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1385 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1386 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1387 dnl User does not insist on using GNU NLS library. Figure out what
1388 dnl to use. If GNU gettext is available we use this. Else we have
1389 dnl to fall back to GNU NLS library.
1392 dnl Add a version number to the cache macros.
1393 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
1394 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
1396 dnl GCC LOCAL: Expose presence of libintl.h to C code.
1397 AC_CHECK_HEADER(libintl.h,
1398 [AC_DEFINE([HAVE_LIBINTL_H], 1,
1399 [Define if you have the <libintl.h> header file.])
1400 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1401 [AC_TRY_LINK([#include <libintl.h>
1402 extern int _nl_msg_cat_cntr;],
1403 [bindtextdomain ("", "");
1404 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1405 gt_cv_func_gnugettext_libc=yes,
1406 gt_cv_func_gnugettext_libc=no)])
1408 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1409 AC_CACHE_CHECK([for GNU gettext in libintl],
1410 gt_cv_func_gnugettext_libintl,
1411 [gt_save_LIBS="$LIBS"
1412 LIBS="$LIBS -lintl $LIBICONV"
1413 AC_TRY_LINK([#include <libintl.h>
1414 extern int _nl_msg_cat_cntr;],
1415 [bindtextdomain ("", "");
1416 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1417 gt_cv_func_gnugettext_libintl=yes,
1418 gt_cv_func_gnugettext_libintl=no)
1419 LIBS="$gt_save_LIBS"])
1422 dnl If an already present or preinstalled GNU gettext() is found,
1423 dnl use it. But if this macro is used in GNU gettext, and GNU
1424 dnl gettext is already preinstalled in libintl, we update this
1425 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
1426 if test "$gt_cv_func_gnugettext_libc" = "yes" \
1427 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1428 && test "$PACKAGE" != gettext; }; then
1429 AC_DEFINE(HAVE_GETTEXT, 1,
1430 [Define if the GNU gettext() function is already present or preinstalled.])
1432 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1433 dnl If iconv() is in a separate libiconv library, then anyone
1434 dnl linking with libintl{.a,.so} also needs to link with
1436 INTLLIBS="-lintl $LIBICONV"
1439 gt_save_LIBS="$LIBS"
1440 LIBS="$LIBS $INTLLIBS"
1441 AC_CHECK_FUNCS(dcgettext)
1442 LIBS="$gt_save_LIBS"
1444 dnl Search for GNU msgfmt in the PATH.
1445 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1446 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1447 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1449 dnl Search for GNU xgettext in the PATH.
1450 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1451 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1457 if test "$CATOBJEXT" = "NONE"; then
1458 dnl GNU gettext is not found in the C library.
1459 dnl Fall back on GNU gettext library.
1460 nls_cv_use_gnu_gettext=yes
1464 if test "$nls_cv_use_gnu_gettext" = "yes"; then
1465 dnl Mark actions used to generate GNU NLS library.
1466 INTLOBJS="\$(GETTOBJS)"
1467 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1468 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1469 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1470 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1471 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1473 BUILD_INCLUDED_LIBINTL=yes
1474 USE_INCLUDED_LIBINTL=yes
1476 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
1477 INTLDEPS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a"
1478 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1481 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1482 dnl Test whether we really found GNU msgfmt.
1483 if test "$GMSGFMT" != ":"; then
1484 dnl If it is no GNU msgfmt we define it as : so that the
1485 dnl Makefiles still can work.
1486 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1490 [found msgfmt program is not GNU msgfmt; ignore it])
1495 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1496 dnl Test whether we really found GNU xgettext.
1497 if test "$XGETTEXT" != ":"; then
1498 dnl If it is no GNU xgettext we define it as : so that the
1499 dnl Makefiles still can work.
1500 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1504 [found xgettext program is not GNU xgettext; ignore it])
1509 dnl We need to process the po/ directory.
1513 [for ac_file in $CONFIG_FILES; do
1514 # Support "outfile[:infile[:infile...]]"
1516 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1518 # PO directories have a Makefile.in generated from Makefile.in.in.
1519 case "$ac_file" in */Makefile.in)
1520 # Adjust a relative srcdir.
1521 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1522 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1523 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1524 # In autoconf-2.13 it is called $ac_given_srcdir.
1525 # In autoconf-2.50 it is called $srcdir.
1526 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1527 case "$ac_given_srcdir" in
1528 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1529 /*) top_srcdir="$ac_given_srcdir" ;;
1530 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
1532 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1533 rm -f "$ac_dir/POTFILES"
1534 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1535 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1536 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1537 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1544 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1545 dnl to 'yes' because some of the testsuite requires it.
1546 if test "$PACKAGE" = gettext; then
1547 BUILD_INCLUDED_LIBINTL=yes
1550 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1551 dnl because plural.y uses bison specific features. It requires at least
1552 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1554 dnl bison is only needed for the maintainer (who touches plural.y). But in
1555 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1556 dnl the rule in general Makefile. Now, some people carelessly touch the
1557 dnl files or have a broken "make" program, hence the plural.c rule will
1558 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1559 dnl present or too old.
1560 AC_CHECK_PROGS([INTLBISON], [bison])
1561 if test -z "$INTLBISON"; then
1564 dnl Found it, now check the version.
1565 AC_MSG_CHECKING([version of bison])
1566 changequote(<<,>>)dnl
1567 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1568 case $ac_prog_version in
1569 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1570 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1572 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1573 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1575 AC_MSG_RESULT([$ac_prog_version])
1577 if test $ac_verc_fail = yes; then
1581 dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
1583 dnl Make all variables we use known to autoconf.
1584 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1585 AC_SUBST(USE_INCLUDED_LIBINTL)
1592 dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
1593 if test $USE_INCLUDED_LIBINTL = yes; then
1594 AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
1595 [Define to use the libintl included with this package instead of any
1596 version in the system libraries.])
1599 dnl For backward compatibility. Some configure.ins may be using this.
1601 nls_cv_header_libgt=
1603 dnl For backward compatibility. Some Makefiles may be using this.
1605 AC_SUBST(DATADIRNAME)
1607 dnl For backward compatibility. Some Makefiles may be using this.
1609 AC_SUBST(INSTOBJEXT)
1611 dnl For backward compatibility. Some Makefiles may be using this.
1616 dnl Usage: Just like AM_WITH_NLS, which see.
1617 AC_DEFUN([AM_GNU_GETTEXT],
1618 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1619 AC_REQUIRE([AC_PROG_CC])dnl
1620 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1621 AC_REQUIRE([AC_PROG_RANLIB])dnl
1622 AC_REQUIRE([AC_ISC_POSIX])dnl
1623 AC_REQUIRE([AC_HEADER_STDC])dnl
1624 AC_REQUIRE([AC_C_CONST])dnl
1625 AC_REQUIRE([AC_C_INLINE])dnl
1626 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1627 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1628 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1629 dnl GCC LOCAL: Do not refer to AC_FUNC_MMAP, we have special needs.
1630 dnl AC_REQUIRE([AC_FUNC_MMAP])dnl
1631 AC_REQUIRE([jm_GLIBC21])dnl
1633 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1634 stdlib.h string.h unistd.h sys/param.h])
1635 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1636 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1637 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1642 AM_WITH_NLS([$1],[$2],[$3])
1644 dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
1645 dnl has been torn out and replaced with this more sensible scheme.
1646 if test "x$CATOBJEXT" != x; then
1647 AC_MSG_CHECKING(for catalogs to be installed)
1648 # Look for .po and .gmo files in the source directory.
1651 for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
1652 # If there aren't any .gmo files the shell will give us the
1653 # literal string "../path/to/srcdir/po/*.gmo" which has to be
1655 case "$cat" in *\**)
1658 # The quadruple backslash is collapsed to a double backslash
1659 # by the backticks, then collapsed again by the double quotes,
1660 # leaving us with one backslash in the sed expression (right
1661 # before the dot that mustn't act as a wildcard). The dot to
1662 # be escaped in the second expression is hiding inside CATOBJEXT.
1663 cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
1664 lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
1665 # The user is allowed to set LINGUAS to a list of languages to
1666 # install catalogs for. If it's empty that means "all of them."
1667 if test "x$LINGUAS" = x; then
1668 CATALOGS="$CATALOGS $cat"
1669 XLINGUAS="$XLINGUAS $lang"
1671 case "$LINGUAS" in *$lang*)
1672 CATALOGS="$CATALOGS $cat"
1673 XLINGUAS="$XLINGUAS $lang"
1679 AC_MSG_RESULT($LINGUAS)
1682 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1683 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1684 dnl Try to locate is.
1686 if test -n "$ac_aux_dir"; then
1687 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1689 if test -z "$MKINSTALLDIRS"; then
1690 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1692 AC_SUBST(MKINSTALLDIRS)
1694 dnl Enable libtool support if the surrounding package wishes it.
1695 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1696 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1699 AC_DEFUN(gcc_AC_INITFINI_ARRAY,
1700 [AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1701 gcc_cv_initfinit_array, [dnl
1702 cat > conftest.c <<EOF
1704 int main (void) { return x; }
1705 int foo (void) { x = 0; }
1706 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1708 if AC_TRY_COMMAND([${CC-cc} -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1711 gcc_cv_initfinit_array=yes
1713 gcc_cv_initfinit_array=no
1716 gcc_cv_initfinit_array=no
1719 AC_SUBST(gcc_cv_initfinit_array)
1720 if test $gcc_cv_initfinit_array = yes; then
1721 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
1722 [Define .init_array/.fini_array sections are available and working.])