1 sinclude(../config/accross.m4)
3 dnl See if stdbool.h properly defines bool and true/false.
4 AC_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>],
9 ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
10 if 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.])
16 dnl See whether we can include both string.h and strings.h.
17 AC_DEFUN(gcc_AC_HEADER_STRING,
18 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
20 [AC_TRY_COMPILE([#include <string.h>
21 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
22 if test $gcc_cv_header_string = yes; then
23 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
27 dnl See whether we need a declaration for a function.
28 dnl The result is highly dependent on the INCLUDES passed in, so make sure
29 dnl to use a different cache variable name in this macro if it is invoked
30 dnl in a different context somewhere else.
31 dnl gcc_AC_CHECK_DECL(SYMBOL,
32 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
33 AC_DEFUN(gcc_AC_CHECK_DECL,
34 [AC_MSG_CHECKING([whether $1 is declared])
35 AC_CACHE_VAL(gcc_cv_have_decl_$1,
38 char *(*pfn) = (char *(*)) $1 ;
39 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
40 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
41 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
43 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
47 dnl Check multiple functions to see whether each needs a declaration.
48 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
49 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
50 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
51 AC_DEFUN(gcc_AC_CHECK_DECLS,
55 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
57 gcc_AC_CHECK_DECL($ac_func,
58 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
59 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
60 dnl It is possible that the include files passed in here are local headers
61 dnl which supply a backup declaration for the relevant prototype based on
62 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
63 dnl will always return success. E.g. see libiberty.h's handling of
64 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
65 dnl 1 so that any local headers used do not provide their own prototype
72 dnl Automatically generate config.h entries via autoheader.
74 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
75 [AC_DEFINE([HAVE_DECL_\&], 1,
76 [Define to 1 if we found this declaration otherwise define to 0.])])dnl
80 dnl See if the printf functions in libc support %p in format strings.
81 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
82 [AC_CACHE_CHECK(whether the printf functions support %p,
83 gcc_cv_func_printf_ptr,
84 [AC_TRY_RUN([#include <stdio.h>
89 char *p = buf, *q = NULL;
90 sprintf(buf, "%p", p);
91 sscanf(buf, "%p", &q);
93 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
94 gcc_cv_func_printf_ptr=no)
95 rm -f core core.* *.core])
96 if test $gcc_cv_func_printf_ptr = yes ; then
97 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
101 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
102 AC_DEFUN(gcc_AC_PROG_LN_S,
103 [AC_MSG_CHECKING(whether ln -s works)
104 AC_CACHE_VAL(gcc_cv_prog_LN_S,
105 [rm -f conftestdata_t
107 if ln -s conftestdata_f conftestdata_t 2>/dev/null
109 gcc_cv_prog_LN_S="ln -s"
111 if ln conftestdata_f conftestdata_t 2>/dev/null
118 rm -f conftestdata_f conftestdata_t
120 LN_S="$gcc_cv_prog_LN_S"
121 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
124 if test "$gcc_cv_prog_LN_S" = "ln"; then
125 AC_MSG_RESULT([no, using ln])
127 AC_MSG_RESULT([no, and neither does ln, so using cp])
133 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
134 AC_DEFUN(gcc_AC_PROG_LN,
135 [AC_MSG_CHECKING(whether ln works)
136 AC_CACHE_VAL(gcc_cv_prog_LN,
137 [rm -f conftestdata_t
139 if ln conftestdata_f conftestdata_t 2>/dev/null
143 if ln -s conftestdata_f conftestdata_t 2>/dev/null
145 gcc_cv_prog_LN="ln -s"
150 rm -f conftestdata_f conftestdata_t
153 if test "$gcc_cv_prog_LN" = "ln"; then
156 if test "$gcc_cv_prog_LN" = "ln -s"; then
157 AC_MSG_RESULT([no, using ln -s])
159 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
165 dnl See whether the stage1 host compiler accepts the volatile keyword.
166 AC_DEFUN(gcc_AC_C_VOLATILE,
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)])
170 if test $gcc_cv_c_volatile = yes ; then
171 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
175 dnl Check whether long double is supported. This differs from the
176 dnl built-in autoconf test in that it works for cross compiles.
177 AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
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
183 [/* The Stardent Vistra knows sizeof(long double), but does not support it. */
184 long double foo = 0.0;
185 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
186 switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
187 gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
189 if test $gcc_cv_c_long_double = yes; then
190 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
191 [Define if your compiler supports the \`long double' type.])
195 dnl Check whether _Bool is built-in.
196 AC_DEFUN(gcc_AC_C__BOOL,
197 [AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
200 gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
202 if test $gcc_cv_c__bool = yes; then
203 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
207 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
209 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
210 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
212 #include <sys/types.h>
213 #ifdef HAVE_SYS_STAT_H
214 # include <sys/stat.h>
221 #endif], [mkdir ("foo", 0);],
222 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
223 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
224 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
228 AC_DEFUN(gcc_AC_PROG_INSTALL,
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
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.
240 AC_MSG_CHECKING(for a BSD compatible install)
241 if test -z "$INSTALL"; then
242 AC_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.
247 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
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.
258 ac_cv_path_install="$ac_dir/$ac_prog -c"
268 if test "${ac_cv_path_install+set}" = set; then
269 INSTALL="$ac_cv_path_install"
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"
278 dnl We do special magic for INSTALL instead of AC_SUBST, to get
279 dnl relative paths right.
280 AC_MSG_RESULT($INSTALL)
283 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
284 # It thinks the first close brace ends the variable substitution.
285 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
286 AC_SUBST(INSTALL_PROGRAM)dnl
288 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
289 AC_SUBST(INSTALL_DATA)dnl
293 dnl We require the gnatbind program, and a compiler driver that
294 dnl understands Ada. The user may set the driver name explicitly
295 dnl with ADAC; also, the user's CC setting is tried. Failing that,
296 dnl we try gcc and cc, then a sampling of names known to be used for
297 dnl the Ada driver on various systems.
299 dnl Sets the shell variable have_gnat to yes or no as appropriate, and
300 dnl substitutes GNATBIND and ADAC.
301 AC_DEFUN([gcc_AC_PROG_GNAT],
302 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
303 AC_CHECK_TOOL(GNATBIND, gnatbind, no)
304 AC_CACHE_CHECK([for compiler driver that understands Ada],
306 [cat >conftest.adb <<EOF
307 procedure conftest is begin null; end conftest;
310 # Have to do ac_tool_prefix and user overrides by hand.
311 for cand in ${ADAC+"$ADAC"} ${CC+"$CC"} \
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
323 errors=`($cand -c conftest.adb) 2>&1 || echo failure`
324 if test x"$errors" = x; then
325 gcc_cv_prog_adac=$cand
330 ADAC=$gcc_cv_prog_adac
333 if test x$GNATBIND != xno && test x$ADAC != xno; then
341 dnl This test replaces the one in autoconf.
342 dnl Currently this macro should have the same name as the autoconf macro
343 dnl because gettext's gettext.m4 (distributed in the automake package)
344 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
345 dnl give these diagnostics:
346 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
347 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
349 undefine([AC_ISC_POSIX])
350 AC_DEFUN(AC_ISC_POSIX,
352 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
353 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
358 dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
359 dnl like AC_PATH_PROG but use other cache variables
360 AC_DEFUN(GCC_PATH_PROG,
361 [# Extract the first word of "$2", so it can be a program name with args.
362 set dummy $2; ac_word=[$]2
363 AC_MSG_CHECKING([for $ac_word])
364 AC_CACHE_VAL(gcc_cv_path_$1,
367 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
370 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
373 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
374 dnl $ac_dummy forces splitting on constant user-supplied paths.
375 dnl POSIX.2 word splitting is done only on the output of word expansions,
376 dnl 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"
386 dnl If no 3rd arg is given, leave the cache variable unset,
387 dnl so GCC_PATH_PROGS will keep looking.
388 ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
393 if test -n "[$]$1"; then
401 # Check whether mmap can map an arbitrary page from /dev/zero or with
402 # MAP_ANONYMOUS, without MAP_FIXED.
403 AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
404 [AC_CHECK_FUNCS(getpagesize)
405 # The test program for the next two tests is the same except for one
407 changequote({{{,}}})dnl
408 {{{cat >ct-mmap.inc <<'EOF'
409 #include <sys/types.h>
410 #include <sys/mman.h>
416 #if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
417 # define MAP_ANONYMOUS MAP_ANON
420 /* This mess was copied from the GNU getpagesize.h. */
421 #ifndef HAVE_GETPAGESIZE
422 # ifdef HAVE_UNISTD_H
426 /* Assume that all systems that can run configure have sys/param.h. */
427 # ifndef HAVE_SYS_PARAM_H
428 # define HAVE_SYS_PARAM_H 1
432 # define getpagesize() sysconf(_SC_PAGESIZE)
433 # else /* no _SC_PAGESIZE */
434 # ifdef HAVE_SYS_PARAM_H
435 # include <sys/param.h>
436 # ifdef EXEC_PAGESIZE
437 # define getpagesize() EXEC_PAGESIZE
438 # else /* no EXEC_PAGESIZE */
440 # define getpagesize() NBPG * CLSIZE
443 # endif /* no CLSIZE */
446 # define getpagesize() NBPC
449 # define getpagesize() PAGESIZE
450 # endif /* PAGESIZE */
451 # endif /* no NBPC */
452 # endif /* no NBPG */
453 # endif /* no EXEC_PAGESIZE */
454 # else /* no HAVE_SYS_PARAM_H */
455 # define getpagesize() 8192 /* punt totally */
456 # endif /* no HAVE_SYS_PARAM_H */
457 # endif /* no _SC_PAGESIZE */
459 #endif /* no HAVE_GETPAGESIZE */
462 # define MAP_FAILED -1
466 #define perror_exit(str, val) \
467 do { perror(str); exit(val); } while (0)
469 /* Some versions of cygwin mmap require that munmap is called with the
470 same parameters as mmap. GCC expects that this is not the case.
471 Test for various forms of this problem. Warning - icky signal games. */
473 static sigset_t unblock_sigsegv;
483 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
484 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
486 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
487 MAP_PRIVATE, devzero, 0);
495 sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
499 /* Basic functionality test. */
503 char *x = anonmap (pg);
504 if (x == (char *) MAP_FAILED)
505 perror_exit("test 0 mmap", 2);
509 if (munmap(x, pg) < 0)
510 perror_exit("test 0 munmap", 3);
513 /* 1. If we map a 2-page region and unmap its second page, the first page
518 char *x = anonmap (pg * 2);
519 if (x == (char *)MAP_FAILED)
520 perror_exit ("test 1 mmap", 4);
522 signal (SIGSEGV, sigsegv);
524 perror_exit ("test 1 fault", 5);
529 if (munmap (x + pg, pg) < 0)
530 perror_exit ("test 1 munmap 1", 6);
536 perror_exit ("test 1 no fault", 7);
538 if (munmap (x, pg) < 0)
539 perror_exit ("test 1 munmap 2", 8);
542 /* 2. If we map a 2-page region and unmap its first page, the second
547 char *x = anonmap (pg * 2);
548 if (x == (char *)MAP_FAILED)
549 perror_exit ("test 2 mmap", 9);
551 signal (SIGSEGV, sigsegv);
553 perror_exit ("test 2 fault", 10);
558 if (munmap (x, pg) < 0)
559 perror_exit ("test 2 munmap 1", 11);
566 perror_exit ("test 2 no fault", 12);
569 if (munmap (x+pg, pg) < 0)
570 perror_exit ("test 2 munmap 2", 13);
573 /* 3. If we map two adjacent 1-page regions and unmap them both with
574 one munmap, both must go away.
576 Getting two adjacent 1-page regions with two mmap calls is slightly
577 tricky. All OS's tested skip over already-allocated blocks; therefore
578 we have been careful to unmap all allocated regions in previous tests.
579 HP/UX allocates pages backward in memory. No OS has yet been observed
580 to be so perverse as to leave unmapped space between consecutive calls
589 if (x == (char *)MAP_FAILED)
590 perror_exit ("test 3 mmap 1", 14);
592 if (y == (char *)MAP_FAILED)
593 perror_exit ("test 3 mmap 2", 15);
601 fprintf (stderr, "test 3 nonconsecutive pages - %lx, %lx\n",
602 (unsigned long)x, (unsigned long)y);
607 signal (SIGSEGV, sigsegv);
609 perror_exit ("test 3 fault", 17);
614 if (munmap (x, pg*2) < 0)
615 perror_exit ("test 3 munmap", 18);
620 perror_exit ("test 3 no fault 1", 19);
623 signal (SIGSEGV, sigsegv);
627 perror_exit ("test 3 no fault 2", 20);
634 sigemptyset (&unblock_sigsegv);
635 sigaddset (&unblock_sigsegv, SIGSEGV);
638 devzero = open ("/dev/zero", O_RDWR);
640 perror_exit ("open /dev/zero", 1);
653 AC_CACHE_CHECK(for working mmap from /dev/zero,
654 ac_cv_func_mmap_dev_zero,
656 [#include "ct-mmap.inc"],
657 ac_cv_func_mmap_dev_zero=yes,
659 then ac_cv_func_mmap_dev_zero=no
660 else ac_cv_func_mmap_dev_zero=buggy
662 # When cross-building, assume that this works, unless we know it
663 # doesn't. Of course, we have no way of knowing if there even is a /dev/zero
664 # on the host, let alone whether mmap will work on it.
666 cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
667 darwin* ) ac_cv_func_mmap_dev_zero=no ;;
668 * ) ac_cv_func_mmap_dev_zero=yes ;;
671 if test $ac_cv_func_mmap_dev_zero = yes; then
672 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
673 [Define if mmap can get us zeroed pages from /dev/zero.])
676 AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
677 ac_cv_func_mmap_anon,
679 [#define USE_MAP_ANON
680 #include "ct-mmap.inc"],
681 ac_cv_func_mmap_anon=yes,
683 then ac_cv_func_mmap_anon=no
684 else ac_cv_func_mmap_anon=buggy
686 # Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
687 # just because it's there. Some SCO Un*xen define it but don't implement it.
689 darwin* ) ac_cv_func_mmap_anon=yes ;;
690 * ) ac_cv_func_mmap_anon=no ;;
693 if test $ac_cv_func_mmap_anon = yes; then
694 AC_DEFINE(HAVE_MMAP_ANON, 1,
695 [Define if mmap can get us zeroed pages using MAP_ANON(YMOUS).])
700 # Check whether mmap can map a plain file, without MAP_FIXED.
701 AC_DEFUN([AC_FUNC_MMAP_FILE],
702 [AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
703 [# Create a file one thousand bytes long.
704 for i in 1 2 3 4 5 6 7 8 9 0
705 do for j in 1 2 3 4 5 6 7 8 9 0
708 done > conftestdata$$
711 /* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
712 Richard Henderson and Alexandre Oliva.
713 Check whether read-only mmap of a plain file works. */
714 #include <sys/types.h>
715 #include <sys/stat.h>
717 #include <sys/mman.h>
725 fd = open("conftestdata$$", O_RDONLY);
732 x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
733 if (x == (char *) -1)
736 if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
739 if (munmap(x, st.st_size) < 0)
743 }], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
745 darwin* ) ac_cv_func_mmap_file=yes ;;
746 * ) ac_cv_func_mmap_file=no ;;
748 if test $ac_cv_func_mmap_file = yes; then
749 AC_DEFINE(HAVE_MMAP_FILE, 1,
750 [Define if read-only mmap of a plain file works.])
754 dnl Locate a program and check that its version is acceptable.
755 dnl AC_PROG_CHECK_VER(var, name, version-switch,
756 dnl version-extract-regexp, version-glob)
757 AC_DEFUN(gcc_AC_CHECK_PROG_VER,
758 [AC_CHECK_PROG([$1], [$2], [$2])
759 if test -n "[$]$1"; then
760 # Found it, now check the version.
761 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
762 [changequote(<<,>>)dnl
763 ac_prog_version=`<<$>>$1 $3 2>&1 |
764 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
766 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
767 changequote(<<,>>)dnl
768 case $ac_prog_version in
769 '') gcc_cv_prog_$2_modern=no;;
771 gcc_cv_prog_$2_modern=yes;;
772 *) gcc_cv_prog_$2_modern=no;;
777 gcc_cv_prog_$2_modern=no
781 dnl Determine if enumerated bitfields are unsigned. ISO C says they can
782 dnl be either signed or unsigned.
784 AC_DEFUN(gcc_AC_C_ENUM_BF_UNSIGNED,
785 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
786 [AC_TRY_RUN(#include <stdlib.h>
787 enum t { BLAH = 128 } ;
788 struct s_t { enum t member : 8; } s ;
792 if (s.member < 0) exit(1);
795 }, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
796 if test $gcc_cv_enum_bf_unsigned = yes; then
797 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
798 [Define if enumerated bitfields are treated as unsigned values.])
801 dnl Probe number of bits in a byte.
802 dnl Note C89 requires CHAR_BIT >= 8.
804 AC_DEFUN(gcc_AC_C_CHAR_BIT,
805 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
807 [#ifdef HAVE_LIMITS_H
812 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
814 if test $gcc_cv_decl_char_bit = no; then
815 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
818 while test $i -lt 65; do
821 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
822 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
824 [gcc_cv_c_nbby=$i; break])
827 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
829 if test $gcc_cv_c_nbby = failed; then
830 AC_MSG_ERROR(cannot determine number of bits in a byte)
832 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
833 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
837 dnl Checking for long long.
838 dnl By Caolan McNamara <caolan@skynet.ie>
839 dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
841 AC_DEFUN([gcc_AC_C_LONG_LONG],
842 [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
843 [AC_TRY_COMPILE(,[long long int i;],
844 ac_cv_c_long_long=yes,
845 ac_cv_c_long_long=no)])
846 if test $ac_cv_c_long_long = yes; then
847 AC_DEFINE(HAVE_LONG_LONG, 1,
848 [Define if your compiler supports the \`long long' type.])
850 AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
851 [AC_TRY_COMPILE(,[__int64 i;],
853 ac_cv_c___int64=no)])
854 if test $ac_cv_c___int64 = yes; then
855 AC_DEFINE(HAVE___INT64, 1,
856 [Define if your compiler supports the \`__int64' type.])
860 dnl Host character set probe.
861 dnl The EBCDIC values match the table in config/i370/i370.c;
862 dnl there are other versions of EBCDIC but GCC won't work with them.
864 AC_DEFUN([gcc_AC_C_CHARSET],
865 [AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
867 [#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
868 && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
870 #endif], ac_cv_c_charset=ASCII)
871 if test x${ac_cv_c_charset+set} != xset; then
873 [#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
874 && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
876 #endif], ac_cv_c_charset=EBCDIC)
878 if test x${ac_cv_c_charset+set} != xset; then
879 ac_cv_c_charset=unknown
881 if test $ac_cv_c_charset = unknown; then
882 AC_MSG_ERROR([*** Cannot determine host character set.])
883 elif test $ac_cv_c_charset = EBCDIC; then
884 AC_DEFINE(HOST_EBCDIC, 1,
885 [Define if the host execution character set is EBCDIC.])
890 dnl From Bruno Haible.
894 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
895 dnl those with the standalone portable GNU libiconv installed).
897 am_cv_lib_iconv_ldpath=
898 AC_ARG_WITH([libiconv-prefix],
899 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
900 for dir in `echo "$withval" | tr : ' '`; do
901 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
902 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
906 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
907 am_cv_func_iconv="no, consider installing GNU libiconv"
909 AC_TRY_LINK([#include <stdlib.h>
911 [iconv_t cd = iconv_open("","");
912 iconv(cd,NULL,NULL,NULL,NULL);
914 am_cv_func_iconv=yes)
915 if test "$am_cv_func_iconv" != yes; then
917 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
918 AC_TRY_LINK([#include <stdlib.h>
920 [iconv_t cd = iconv_open("","");
921 iconv(cd,NULL,NULL,NULL,NULL);
924 am_cv_func_iconv=yes)
928 if test "$am_cv_func_iconv" = yes; then
929 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
930 AC_MSG_CHECKING([for iconv declaration])
931 AC_CACHE_VAL(am_cv_proto_iconv, [
939 #if defined(__STDC__) || defined(__cplusplus)
940 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
944 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
945 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);"])
946 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
947 AC_MSG_RESULT([$]{ac_t:-
948 }[$]am_cv_proto_iconv)
949 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
950 [Define as const if the declaration of iconv() needs const.])
953 if test "$am_cv_lib_iconv" = yes; then
954 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
959 ### Gettext macros begin here.
960 ### Changes for GCC marked by 'dnl GCC LOCAL'.
961 ### Note iconv.m4 appears above, as it's used for other reasons.
965 dnl From Bruno Haible.
967 AC_DEFUN([AM_LANGINFO_CODESET],
969 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
970 [AC_TRY_LINK([#include <langinfo.h>],
971 [char* cs = nl_langinfo(CODESET);],
972 am_cv_langinfo_codeset=yes,
973 am_cv_langinfo_codeset=no)
975 if test $am_cv_langinfo_codeset = yes; then
976 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
977 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
982 # This test replaces the one in autoconf.
983 # Currently this macro should have the same name as the autoconf macro
984 # because gettext's gettext.m4 (distributed in the automake package)
985 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
986 # give these diagnostics:
987 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
988 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
990 undefine([AC_ISC_POSIX])
992 AC_DEFUN([AC_ISC_POSIX],
994 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
995 dnl GCC LOCAL: Use AC_SEARCH_LIBS.
996 AC_SEARCH_LIBS(strerror, cposix)
1002 # Test for the GNU C Library, version 2.1 or newer.
1003 # From Bruno Haible.
1005 AC_DEFUN([jm_GLIBC21],
1007 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1008 ac_cv_gnu_library_2_1,
1009 [AC_EGREP_CPP([Lucky GNU user],
1011 #include <features.h>
1012 #ifdef __GNU_LIBRARY__
1013 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1018 ac_cv_gnu_library_2_1=yes,
1019 ac_cv_gnu_library_2_1=no)
1023 GLIBC21="$ac_cv_gnu_library_2_1"
1027 # Check whether LC_MESSAGES is available in <locale.h>.
1028 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1030 # This file can be copied and used freely without restrictions. It can
1031 # be used in projects which are not available under the GNU General Public
1032 # License or the GNU Library General Public License but which still want
1033 # to provide support for the GNU gettext functionality.
1034 # Please note that the actual code of the GNU gettext library is covered
1035 # by the GNU Library General Public License, and the rest of the GNU
1036 # gettext package package is covered by the GNU General Public License.
1037 # They are *not* in the public domain.
1041 AC_DEFUN([AM_LC_MESSAGES],
1042 [if test $ac_cv_header_locale_h = yes; then
1043 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1044 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1045 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1046 if test $am_cv_val_LC_MESSAGES = yes; then
1047 AC_DEFINE(HAVE_LC_MESSAGES, 1,
1048 [Define if your <locale.h> file defines LC_MESSAGES.])
1052 # Search path for a program which passes the given test.
1053 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1055 # This file can be copied and used freely without restrictions. It can
1056 # be used in projects which are not available under the GNU General Public
1057 # License or the GNU Library General Public License but which still want
1058 # to provide support for the GNU gettext functionality.
1059 # Please note that the actual code of the GNU gettext library is covered
1060 # by the GNU Library General Public License, and the rest of the GNU
1061 # gettext package package is covered by the GNU General Public License.
1062 # They are *not* in the public domain.
1066 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1067 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1068 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
1069 [# Extract the first word of "$2", so it can be a program name with args.
1070 set dummy $2; ac_word=[$]2
1071 AC_MSG_CHECKING([for $ac_word])
1072 AC_CACHE_VAL(ac_cv_path_$1,
1075 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1078 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1079 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1080 test -z "$ac_dir" && ac_dir=.
1081 if test -f $ac_dir/$ac_word; then
1083 ac_cv_path_$1="$ac_dir/$ac_word"
1089 dnl If no 4th arg is given, leave the cache variable unset,
1090 dnl so AC_PATH_PROGS will keep looking.
1091 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1096 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1097 AC_MSG_RESULT([$]$1)
1104 # Macro to add for using GNU gettext.
1105 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1107 # This file can be copied and used freely without restrictions. It can
1108 # be used in projects which are not available under the GNU General Public
1109 # License or the GNU Library General Public License but which still want
1110 # to provide support for the GNU gettext functionality.
1111 # Please note that the actual code of the GNU gettext library is covered
1112 # by the GNU Library General Public License, and the rest of the GNU
1113 # gettext package package is covered by the GNU General Public License.
1114 # They are *not* in the public domain.
1118 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
1119 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
1120 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1121 dnl depending on --{enable,disable}-{shared,static} and on the presence of
1122 dnl AM-DISABLE-SHARED). Otherwise, a static library
1123 dnl $(top_builddir)/intl/libintl.a will be created.
1124 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1125 dnl implementations (in libc or libintl) without the ngettext() function
1126 dnl will be ignored.
1127 dnl LIBDIR is used to find the intl libraries. If empty,
1128 dnl the value `$(top_builddir)/intl/' is used.
1130 dnl The result of the configuration is one of three cases:
1131 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1133 dnl Catalog format: GNU --> install in $(datadir)
1134 dnl Catalog extension: .mo after installation, .gmo in source tree
1135 dnl 2) GNU gettext has been found in the system's C library.
1136 dnl Catalog format: GNU --> install in $(datadir)
1137 dnl Catalog extension: .mo after installation, .gmo in source tree
1138 dnl 3) No internationalization, always use English msgid.
1139 dnl Catalog format: none
1140 dnl Catalog extension: none
1141 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1142 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1143 dnl but we keep it in order not to force irrelevant filename changes on the
1146 AC_DEFUN([AM_WITH_NLS],
1147 [AC_MSG_CHECKING([whether NLS is requested])
1148 dnl Default is enabled NLS
1150 [ --disable-nls do not use Native Language Support],
1151 USE_NLS=$enableval, USE_NLS=yes)
1152 AC_MSG_RESULT($USE_NLS)
1155 BUILD_INCLUDED_LIBINTL=no
1156 USE_INCLUDED_LIBINTL=no
1157 dnl GCC LOCAL: Separate concept of link command line from dependencies.
1161 dnl If we use NLS figure out what method
1162 if test "$USE_NLS" = "yes"; then
1163 AC_DEFINE(ENABLE_NLS, 1,
1164 [Define to 1 if translation of program messages to the user's native language
1166 AC_MSG_CHECKING([whether included gettext is requested])
1167 AC_ARG_WITH(included-gettext,
1168 [ --with-included-gettext use the GNU gettext library included here],
1169 nls_cv_force_use_gnu_gettext=$withval,
1170 nls_cv_force_use_gnu_gettext=no)
1171 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1173 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1174 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1175 dnl User does not insist on using GNU NLS library. Figure out what
1176 dnl to use. If GNU gettext is available we use this. Else we have
1177 dnl to fall back to GNU NLS library.
1180 dnl Add a version number to the cache macros.
1181 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
1182 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
1184 dnl GCC LOCAL: Expose presence of libintl.h to C code.
1185 AC_CHECK_HEADER(libintl.h,
1186 [AC_DEFINE([HAVE_LIBINTL_H], 1,
1187 [Define if you have the <libintl.h> header file.])
1188 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1189 [AC_TRY_LINK([#include <libintl.h>
1190 extern int _nl_msg_cat_cntr;],
1191 [bindtextdomain ("", "");
1192 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1193 gt_cv_func_gnugettext_libc=yes,
1194 gt_cv_func_gnugettext_libc=no)])
1196 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1197 AC_CACHE_CHECK([for GNU gettext in libintl],
1198 gt_cv_func_gnugettext_libintl,
1199 [gt_save_LIBS="$LIBS"
1200 LIBS="$LIBS -lintl $LIBICONV"
1201 AC_TRY_LINK([#include <libintl.h>
1202 extern int _nl_msg_cat_cntr;],
1203 [bindtextdomain ("", "");
1204 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1205 gt_cv_func_gnugettext_libintl=yes,
1206 gt_cv_func_gnugettext_libintl=no)
1207 LIBS="$gt_save_LIBS"])
1210 dnl If an already present or preinstalled GNU gettext() is found,
1211 dnl use it. But if this macro is used in GNU gettext, and GNU
1212 dnl gettext is already preinstalled in libintl, we update this
1213 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
1214 if test "$gt_cv_func_gnugettext_libc" = "yes" \
1215 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1216 && test "$PACKAGE" != gettext; }; then
1217 AC_DEFINE(HAVE_GETTEXT, 1,
1218 [Define if the GNU gettext() function is already present or preinstalled.])
1220 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1221 dnl If iconv() is in a separate libiconv library, then anyone
1222 dnl linking with libintl{.a,.so} also needs to link with
1224 INTLLIBS="-lintl $LIBICONV"
1227 gt_save_LIBS="$LIBS"
1228 LIBS="$LIBS $INTLLIBS"
1229 AC_CHECK_FUNCS(dcgettext)
1230 LIBS="$gt_save_LIBS"
1232 dnl Search for GNU msgfmt in the PATH.
1233 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1234 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1235 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1237 dnl Search for GNU xgettext in the PATH.
1238 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1239 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1245 if test "$CATOBJEXT" = "NONE"; then
1246 dnl GNU gettext is not found in the C library.
1247 dnl Fall back on GNU gettext library.
1248 nls_cv_use_gnu_gettext=yes
1252 if test "$nls_cv_use_gnu_gettext" = "yes"; then
1253 dnl Mark actions used to generate GNU NLS library.
1254 INTLOBJS="\$(GETTOBJS)"
1255 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1256 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1257 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1258 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1259 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1261 BUILD_INCLUDED_LIBINTL=yes
1262 USE_INCLUDED_LIBINTL=yes
1264 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
1265 INTLDEPS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a"
1266 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1269 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1270 dnl Test whether we really found GNU msgfmt.
1271 if test "$GMSGFMT" != ":"; then
1272 dnl If it is no GNU msgfmt we define it as : so that the
1273 dnl Makefiles still can work.
1274 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1278 [found msgfmt program is not GNU msgfmt; ignore it])
1283 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1284 dnl Test whether we really found GNU xgettext.
1285 if test "$XGETTEXT" != ":"; then
1286 dnl If it is no GNU xgettext we define it as : so that the
1287 dnl Makefiles still can work.
1288 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1292 [found xgettext program is not GNU xgettext; ignore it])
1297 dnl We need to process the po/ directory.
1301 [for ac_file in $CONFIG_FILES; do
1302 # Support "outfile[:infile[:infile...]]"
1304 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1306 # PO directories have a Makefile.in generated from Makefile.in.in.
1307 case "$ac_file" in */Makefile.in)
1308 # Adjust a relative srcdir.
1309 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1310 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1311 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1312 # In autoconf-2.13 it is called $ac_given_srcdir.
1313 # In autoconf-2.50 it is called $srcdir.
1314 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1315 case "$ac_given_srcdir" in
1316 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1317 /*) top_srcdir="$ac_given_srcdir" ;;
1318 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
1320 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1321 rm -f "$ac_dir/POTFILES"
1322 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1323 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1324 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1325 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1332 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1333 dnl to 'yes' because some of the testsuite requires it.
1334 if test "$PACKAGE" = gettext; then
1335 BUILD_INCLUDED_LIBINTL=yes
1338 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1339 dnl because plural.y uses bison specific features. It requires at least
1340 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1342 dnl bison is only needed for the maintainer (who touches plural.y). But in
1343 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1344 dnl the rule in general Makefile. Now, some people carelessly touch the
1345 dnl files or have a broken "make" program, hence the plural.c rule will
1346 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1347 dnl present or too old.
1348 AC_CHECK_PROGS([INTLBISON], [bison])
1349 if test -z "$INTLBISON"; then
1352 dnl Found it, now check the version.
1353 AC_MSG_CHECKING([version of bison])
1354 changequote(<<,>>)dnl
1355 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1356 case $ac_prog_version in
1357 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1358 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1360 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1361 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1363 AC_MSG_RESULT([$ac_prog_version])
1365 if test $ac_verc_fail = yes; then
1369 dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
1371 dnl Make all variables we use known to autoconf.
1372 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1373 AC_SUBST(USE_INCLUDED_LIBINTL)
1380 dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
1381 if test $USE_INCLUDED_LIBINTL = yes; then
1382 AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
1383 [Define to use the libintl included with this package instead of any
1384 version in the system libraries.])
1387 dnl For backward compatibility. Some configure.ins may be using this.
1389 nls_cv_header_libgt=
1391 dnl For backward compatibility. Some Makefiles may be using this.
1393 AC_SUBST(DATADIRNAME)
1395 dnl For backward compatibility. Some Makefiles may be using this.
1397 AC_SUBST(INSTOBJEXT)
1399 dnl For backward compatibility. Some Makefiles may be using this.
1404 dnl Usage: Just like AM_WITH_NLS, which see.
1405 AC_DEFUN([AM_GNU_GETTEXT],
1406 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1407 AC_REQUIRE([AC_PROG_CC])dnl
1408 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1409 AC_REQUIRE([AC_PROG_RANLIB])dnl
1410 AC_REQUIRE([AC_ISC_POSIX])dnl
1411 AC_REQUIRE([AC_HEADER_STDC])dnl
1412 AC_REQUIRE([AC_C_CONST])dnl
1413 AC_REQUIRE([AC_C_INLINE])dnl
1414 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1415 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1416 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1417 dnl GCC LOCAL: Do not refer to AC_FUNC_MMAP, we have special needs.
1418 dnl AC_REQUIRE([AC_FUNC_MMAP])dnl
1419 AC_REQUIRE([jm_GLIBC21])dnl
1421 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1422 stdlib.h string.h unistd.h sys/param.h])
1423 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1424 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1425 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1430 AM_WITH_NLS([$1],[$2],[$3])
1432 dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
1433 dnl has been torn out and replaced with this more sensible scheme.
1434 if test "x$CATOBJEXT" != x; then
1435 AC_MSG_CHECKING(for catalogs to be installed)
1436 # Look for .po and .gmo files in the source directory.
1439 for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
1440 # If there aren't any .gmo files the shell will give us the
1441 # literal string "../path/to/srcdir/po/*.gmo" which has to be
1443 case "$cat" in *\**)
1446 # The quadruple backslash is collapsed to a double backslash
1447 # by the backticks, then collapsed again by the double quotes,
1448 # leaving us with one backslash in the sed expression (right
1449 # before the dot that mustn't act as a wildcard). The dot to
1450 # be escaped in the second expression is hiding inside CATOBJEXT.
1451 cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
1452 lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
1453 # The user is allowed to set LINGUAS to a list of languages to
1454 # install catalogs for. If it's empty that means "all of them."
1455 if test "x$LINGUAS" = x; then
1456 CATALOGS="$CATALOGS $cat"
1457 XLINGUAS="$XLINGUAS $lang"
1459 case "$LINGUAS" in *$lang*)
1460 CATALOGS="$CATALOGS $cat"
1461 XLINGUAS="$XLINGUAS $lang"
1467 AC_MSG_RESULT($LINGUAS)
1470 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1471 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1472 dnl Try to locate is.
1474 if test -n "$ac_aux_dir"; then
1475 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1477 if test -z "$MKINSTALLDIRS"; then
1478 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1480 AC_SUBST(MKINSTALLDIRS)
1482 dnl Enable libtool support if the surrounding package wishes it.
1483 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1484 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1487 AC_DEFUN(gcc_AC_INITFINI_ARRAY,
1488 [AC_ARG_ENABLE(initfini-array,
1489 [ --enable-initfini-array use .init_array/.fini_array sections],
1491 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1492 gcc_cv_initfini_array, [dnl
1495 int main (void) { return x; }
1496 int foo (void) { x = 0; }
1497 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
1498 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
1499 [gcc_cv_initfini_array=no])])
1500 enable_initfini_array=$gcc_cv_initfini_array
1502 if test $enable_initfini_array = yes; then
1503 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
1504 [Define .init_array/.fini_array sections are available and working.])
1507 dnl # _gcc_COMPUTE_GAS_VERSION
1508 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
1511 dnl # gcc_cv_as_gas_srcdir must be defined before this.
1512 dnl # This gross requirement will go away eventually.
1513 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
1514 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1515 for f in $gcc_cv_as_bfd_srcdir/configure \
1516 $gcc_cv_as_gas_srcdir/configure \
1517 $gcc_cv_as_gas_srcdir/configure.in \
1518 $gcc_cv_as_gas_srcdir/Makefile.in ; do
1519 gcc_cv_gas_version=`grep '^VERSION=[[0-9]]*\.[[0-9]]*' $f`
1520 if test x$gcc_cv_gas_version != x; then
1524 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
1525 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
1526 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
1527 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
1529 dnl # gcc_GAS_VERSION_GTE_IFELSE(major, minor, patchlevel,
1530 dnl # [command_if_true = :], [command_if_false = :])
1531 dnl # Check to see if the version of GAS is greater than or
1532 dnl # equal to the specified version.
1534 dnl # The first ifelse() shortens the shell code if the patchlevel
1535 dnl # is unimportant (the usual case). The others handle missing
1536 dnl # commands. Note that the tests are structured so that the most
1537 dnl # common version number cases are tested first.
1538 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
1539 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION]) []dnl
1541 [if test $gcc_cv_gas_major_version -eq $1 \
1542 && test $gcc_cv_gas_minor_version -ge $2 \
1543 || test $gcc_cv_gas_major_version -gt $1 ; then
1545 [if test $gcc_cv_gas_major_version -eq $1 \
1546 && (test $gcc_cv_gas_minor_version -gt $2 \
1547 || (test $gcc_cv_gas_minor_version -eq $2 \
1548 && test $gcc_cv_gas_patch_version -ge $3 )) \
1549 || test $gcc_cv_gas_major_version -gt $1 ; then
1551 ifelse([$4],[],[:],[$4])
1552 ifelse([$5],[],[],[else $5])
1554 ]) []dnl # gcc_GAS_VERSION_GTE_IFELSE