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 Check if we have vprintf and possibly _doprnt.
79 dnl Note autoconf checks for vprintf even though we care about vfprintf.
80 AC_DEFUN(gcc_AC_FUNC_VFPRINTF_DOPRNT,
84 if test $ac_cv_func_vprintf != yes ; then
86 if test $ac_cv_func__doprnt != yes ; then
94 dnl Check if we have strstr.
95 AC_DEFUN([gcc_AC_FUNC_STRSTR],
96 [AC_CHECK_FUNCS([strstr], [strstr=], [strstr=strstr.o])
99 dnl See if the printf functions in libc support %p in format strings.
100 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
101 [AC_CACHE_CHECK(whether the printf functions support %p,
102 gcc_cv_func_printf_ptr,
103 [AC_TRY_RUN([#include <stdio.h>
108 char *p = buf, *q = NULL;
109 sprintf(buf, "%p", p);
110 sscanf(buf, "%p", &q);
112 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
113 gcc_cv_func_printf_ptr=no)
114 rm -f core core.* *.core])
115 if test $gcc_cv_func_printf_ptr = yes ; then
116 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
120 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
121 AC_DEFUN(gcc_AC_PROG_LN_S,
122 [AC_MSG_CHECKING(whether ln -s works)
123 AC_CACHE_VAL(gcc_cv_prog_LN_S,
124 [rm -f conftestdata_t
126 if ln -s conftestdata_f conftestdata_t 2>/dev/null
128 gcc_cv_prog_LN_S="ln -s"
130 if ln conftestdata_f conftestdata_t 2>/dev/null
137 rm -f conftestdata_f conftestdata_t
139 LN_S="$gcc_cv_prog_LN_S"
140 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
143 if test "$gcc_cv_prog_LN_S" = "ln"; then
144 AC_MSG_RESULT([no, using ln])
146 AC_MSG_RESULT([no, and neither does ln, so using cp])
152 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
153 AC_DEFUN(gcc_AC_PROG_LN,
154 [AC_MSG_CHECKING(whether ln works)
155 AC_CACHE_VAL(gcc_cv_prog_LN,
156 [rm -f conftestdata_t
158 if ln conftestdata_f conftestdata_t 2>/dev/null
162 if ln -s conftestdata_f conftestdata_t 2>/dev/null
164 gcc_cv_prog_LN="ln -s"
169 rm -f conftestdata_f conftestdata_t
172 if test "$gcc_cv_prog_LN" = "ln"; then
175 if test "$gcc_cv_prog_LN" = "ln -s"; then
176 AC_MSG_RESULT([no, using ln -s])
178 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
184 dnl See whether the stage1 host compiler accepts the volatile keyword.
185 AC_DEFUN(gcc_AC_C_VOLATILE,
186 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
187 [AC_TRY_COMPILE(, [volatile int foo;],
188 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
189 if test $gcc_cv_c_volatile = yes ; then
190 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
194 dnl Check whether long double is supported. This differs from the
195 dnl built-in autoconf test in that it works for cross compiles.
196 AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
197 [AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
198 [if test "$GCC" = yes; then
199 gcc_cv_c_long_double=yes
202 [/* The Stardent Vistra knows sizeof(long double), but does not support it. */
203 long double foo = 0.0;
204 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
205 switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
206 gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
208 if test $gcc_cv_c_long_double = yes; then
209 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
210 [Define if your compiler supports the \`long double' type.])
214 dnl Check whether _Bool is built-in.
215 AC_DEFUN(gcc_AC_C__BOOL,
216 [AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
219 gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
221 if test $gcc_cv_c__bool = yes; then
222 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
226 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
228 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
229 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
231 #include <sys/types.h>
232 #ifdef HAVE_SYS_STAT_H
233 # include <sys/stat.h>
240 #endif], [mkdir ("foo", 0);],
241 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
242 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
243 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
247 AC_DEFUN(gcc_AC_PROG_INSTALL,
248 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
249 # Find a good install program. We prefer a C program (faster),
250 # so one script is as good as another. But avoid the broken or
251 # incompatible versions:
252 # SysV /etc/install, /usr/sbin/install
253 # SunOS /usr/etc/install
256 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
257 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
258 # ./install, which can be erroneously created by make from ./install.sh.
259 AC_MSG_CHECKING(for a BSD compatible install)
260 if test -z "$INSTALL"; then
261 AC_CACHE_VAL(ac_cv_path_install,
262 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
263 for ac_dir in $PATH; do
264 # Account for people who put trailing slashes in PATH elements.
266 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
268 # OSF1 and SCO ODT 3.0 have their own names for install.
269 for ac_prog in ginstall scoinst install; do
270 if test -f $ac_dir/$ac_prog; then
271 if test $ac_prog = install &&
272 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
273 # AIX install. It has an incompatible calling convention.
274 # OSF/1 installbsd also uses dspmsg, but is usable.
277 ac_cv_path_install="$ac_dir/$ac_prog -c"
287 if test "${ac_cv_path_install+set}" = set; then
288 INSTALL="$ac_cv_path_install"
290 # As a last resort, use the slow shell script. We don't cache a
291 # path for INSTALL within a source directory, because that will
292 # break other packages using the cache if that directory is
293 # removed, or if the path is relative.
294 INSTALL="$ac_install_sh"
297 dnl We do special magic for INSTALL instead of AC_SUBST, to get
298 dnl relative paths right.
299 AC_MSG_RESULT($INSTALL)
302 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
303 # It thinks the first close brace ends the variable substitution.
304 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
305 AC_SUBST(INSTALL_PROGRAM)dnl
307 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
308 AC_SUBST(INSTALL_DATA)dnl
312 dnl This test replaces the one in autoconf.
313 dnl Currently this macro should have the same name as the autoconf macro
314 dnl because gettext's gettext.m4 (distributed in the automake package)
315 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
316 dnl give these diagnostics:
317 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
318 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
320 undefine([AC_ISC_POSIX])
321 AC_DEFUN(AC_ISC_POSIX,
323 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
324 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
329 dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
330 dnl like AC_PATH_PROG but use other cache variables
331 AC_DEFUN(GCC_PATH_PROG,
332 [# Extract the first word of "$2", so it can be a program name with args.
333 set dummy $2; ac_word=[$]2
334 AC_MSG_CHECKING([for $ac_word])
335 AC_CACHE_VAL(gcc_cv_path_$1,
338 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
341 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
344 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
345 dnl $ac_dummy forces splitting on constant user-supplied paths.
346 dnl POSIX.2 word splitting is done only on the output of word expansions,
347 dnl not every word. This closes a longstanding sh security hole.
348 ac_dummy="ifelse([$4], , $PATH, [$4])"
349 for ac_dir in $ac_dummy; do
350 test -z "$ac_dir" && ac_dir=.
351 if test -f $ac_dir/$ac_word; then
352 gcc_cv_path_$1="$ac_dir/$ac_word"
357 dnl If no 3rd arg is given, leave the cache variable unset,
358 dnl so GCC_PATH_PROGS will keep looking.
359 ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
364 if test -n "[$]$1"; then
374 # Macro to add for using GNU gettext.
375 # Ulrich Drepper <drepper@cygnus.com>, 1995.
377 # This file can be copied and used freely without restrictions. It can
378 # be used in projects which are not available under the GNU Public License
379 # but which still want to provide support for the GNU gettext functionality.
380 # Please note that the actual code is *not* freely available.
384 AC_DEFUN(AM_WITH_NLS,
385 [AC_MSG_CHECKING([whether NLS is requested])
386 dnl Default is enabled NLS
388 [ --disable-nls do not use Native Language Support],
389 USE_NLS=$enableval, USE_NLS=yes)
390 AC_MSG_RESULT($USE_NLS)
393 USE_INCLUDED_LIBINTL=no
395 dnl If we use NLS figure out what method
396 if test "$USE_NLS" = "yes"; then
397 AC_DEFINE(ENABLE_NLS)
398 AC_MSG_CHECKING([whether included gettext is requested])
399 AC_ARG_WITH(included-gettext,
400 [ --with-included-gettext use the GNU gettext library included here],
401 nls_cv_force_use_gnu_gettext=$withval,
402 nls_cv_force_use_gnu_gettext=no)
403 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
405 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
406 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
407 dnl User does not insist on using GNU NLS library. Figure out what
408 dnl to use. If gettext or catgets are available (in this order) we
409 dnl use this. Else we have to fall back to GNU NLS library.
410 dnl catgets is only used if permitted by option --with-catgets.
415 AC_CHECK_HEADER(libintl.h,
416 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
417 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
418 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
420 if test "$gt_cv_func_gettext_libc" != "yes"; then
421 AC_CHECK_LIB(intl, bindtextdomain,
422 [AC_CACHE_CHECK([for gettext in libintl],
423 gt_cv_func_gettext_libintl,
424 [AC_CHECK_LIB(intl, gettext,
425 gt_cv_func_gettext_libintl=yes,
426 gt_cv_func_gettext_libintl=no)],
427 gt_cv_func_gettext_libintl=no)])
430 if test "$gt_cv_func_gettext_libintl" = "yes"; then
434 if test "$gt_cv_func_gettext_libc" = "yes" \
435 || test "$gt_cv_func_gettext_libintl" = "yes"; then
436 AC_DEFINE(HAVE_GETTEXT)
437 GCC_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
438 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
439 if test "$MSGFMT" != "no"; then
440 AC_CHECK_FUNCS(dcgettext)
441 GCC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
442 GCC_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
443 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
444 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
445 return _nl_msg_cat_cntr],
457 if test "$CATOBJEXT" = "NONE"; then
458 AC_MSG_CHECKING([whether catgets can be used])
460 [ --with-catgets use catgets functions if available],
461 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
462 AC_MSG_RESULT($nls_cv_use_catgets)
464 if test "$nls_cv_use_catgets" = "yes"; then
465 dnl No gettext in C library. Try catgets next.
466 AC_CHECK_LIB(i, main)
467 AC_CHECK_FUNC(catgets,
468 [AC_DEFINE(HAVE_CATGETS)
469 INTLOBJS="\$(CATOBJS)"
470 GCC_PATH_PROG(GENCAT, gencat, no)dnl
471 if test "$GENCAT" != "no"; then
472 GCC_PATH_PROG(GMSGFMT, gmsgfmt, no)
473 if test "$GMSGFMT" = "no"; then
474 GCC_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
475 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
476 if test "$GMSGFMT" = "msgfmt"; then
480 GCC_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
481 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
482 USE_INCLUDED_LIBINTL=yes
486 INTLDEPS='$(top_builddir)/intl/libintl.a'
488 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
489 nls_cv_header_intl=intl/libintl.h
490 nls_cv_header_libgt=intl/libgettext.h
495 if test "$CATOBJEXT" = "NONE"; then
496 dnl Neither gettext nor catgets in included in the C library.
497 dnl Fall back on GNU gettext library.
498 nls_cv_use_gnu_gettext=yes
502 if test "$nls_cv_use_gnu_gettext" = "yes"; then
503 dnl Mark actions used to generate GNU NLS library.
504 INTLOBJS="\$(GETTOBJS)"
505 GCC_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
506 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
507 GCC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
508 dnl If we didn't find either msgfmt or gmsgfmt, don't try to
509 dnl create a catalog.
510 if test "$MSGFMT" = "msgfmt" && test "$GMSGFMT" = "msgfmt"; then
513 GCC_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
514 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
516 USE_INCLUDED_LIBINTL=yes
520 INTLDEPS='$(top_builddir)/intl/libintl.a'
522 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
523 nls_cv_header_intl=intl/libintl.h
524 nls_cv_header_libgt=intl/libgettext.h
527 dnl Test whether we really found GNU xgettext.
528 if test "$XGETTEXT" != ":"; then
529 dnl If it is no GNU xgettext we define it as : so that the
530 dnl Makefiles still can work.
531 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
535 [found xgettext program is not GNU xgettext; ignore it])
542 # We need to process the po/ directory.
546 nls_cv_header_intl=intl/libintl.h
547 nls_cv_header_libgt=intl/libgettext.h
549 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
551 [case "$CONFIG_FILES" in *po/Makefile.in*)
552 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
556 # If this is used in GNU gettext we have to set USE_NLS to `yes'
557 # because some of the sources are only built for this goal.
558 if test "$PACKAGE" = gettext; then
560 USE_INCLUDED_LIBINTL=yes
563 dnl These rules are solely for the distribution goal. While doing this
564 dnl we only have to keep exactly one list of the available catalogs
566 for lang in $ALL_LINGUAS; do
567 GMOFILES="$GMOFILES $lang.gmo"
568 POFILES="$POFILES $lang.po"
571 dnl Make all variables we use known to autoconf.
572 AC_SUBST(USE_INCLUDED_LIBINTL)
575 AC_SUBST(DATADIRNAME)
585 AC_DEFUN(AM_GNU_GETTEXT,
586 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
587 AC_REQUIRE([AC_PROG_CC])dnl
588 AC_REQUIRE([AC_PROG_RANLIB])dnl
589 AC_REQUIRE([AC_ISC_POSIX])dnl
590 AC_REQUIRE([AC_HEADER_STDC])dnl
591 AC_REQUIRE([AC_C_CONST])dnl
592 AC_REQUIRE([AC_C_INLINE])dnl
593 AC_REQUIRE([AC_TYPE_OFF_T])dnl
594 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
595 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
597 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
598 unistd.h sys/param.h])
599 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
600 strdup __argz_count __argz_stringify __argz_next])
602 if test "${ac_cv_func_stpcpy+set}" != "set"; then
603 AC_CHECK_FUNCS(stpcpy)
605 if test "${ac_cv_func_stpcpy}" = "yes"; then
606 AC_DEFINE(HAVE_STPCPY)
612 if test "x$create_catalogs" = "xno"; then
613 AC_MSG_WARN([No program for building catalogs found -> building disabled])
616 if test "x$CATOBJEXT" != "x" && test "x$create_catalogs" != "xno" ; then
617 if test "x$ALL_LINGUAS" = "x"; then
620 AC_MSG_CHECKING(for catalogs to be installed)
621 if test "x$LINGUAS" = "x"; then
625 for lang in $ALL_LINGUAS; do
627 *" $lang "*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
632 AC_MSG_RESULT($LINGUAS)
635 dnl Construct list of names of catalog files to be constructed.
636 if test -n "$LINGUAS"; then
637 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
641 dnl The reference to <locale.h> in the installed <libintl.h> file
642 dnl must be resolved because we cannot expect the users of this
643 dnl to define HAVE_LOCALE_H.
644 if test $ac_cv_header_locale_h = yes; then
645 INCLUDE_LOCALE_H="#include <locale.h>"
648 /* The system does not provide the header <locale.h>. Take care yourself. */"
650 AC_SUBST(INCLUDE_LOCALE_H)
652 dnl Determine which catalog format we have (if any is needed)
653 dnl For now we know about two different formats:
654 dnl Linux libc-5 and the normal X/Open format
655 test -d intl || mkdir intl
656 if test "$CATOBJEXT" = ".cat"; then
657 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
659 dnl Transform the SED scripts while copying because some dumb SEDs
660 dnl cannot handle comments.
661 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
663 dnl po2tbl.sed is always needed.
664 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
665 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
667 dnl In the intl/Makefile.in we have a special dependency which makes
668 dnl only sense for gettext. We comment this out for non-gettext
670 if test "$PACKAGE" = "gettext"; then
680 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
681 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
682 dnl Try to locate is.
684 if test -n "$ac_aux_dir"; then
685 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
687 if test -z "$MKINSTALLDIRS"; then
688 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
690 AC_SUBST(MKINSTALLDIRS)
692 dnl *** For now the libtool support in intl/Makefile is not for real.
696 dnl Generate list of files to be processed by xgettext which will
697 dnl be included in po/Makefile.
698 test -d po || mkdir po
699 if test "x$srcdir" != "x."; then
700 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
701 posrcprefix="$srcdir/"
703 posrcprefix="../$srcdir/"
709 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
710 < $srcdir/po/POTFILES.in > po/POTFILES
713 # Check whether LC_MESSAGES is available in <locale.h>.
714 # Ulrich Drepper <drepper@cygnus.com>, 1995.
716 # This file can be copied and used freely without restrictions. It can
717 # be used in projects which are not available under the GNU Public License
718 # but which still want to provide support for the GNU gettext functionality.
719 # Please note that the actual code is *not* freely available.
723 AC_DEFUN(AM_LC_MESSAGES,
724 [if test $ac_cv_header_locale_h = yes; then
725 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
726 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
727 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
728 if test $am_cv_val_LC_MESSAGES = yes; then
729 AC_DEFINE(HAVE_LC_MESSAGES)
733 # Search path for a program which passes the given test.
734 # Ulrich Drepper <drepper@cygnus.com>, 1996.
736 # This file can be copied and used freely without restrictions. It can
737 # be used in projects which are not available under the GNU Public License
738 # but which still want to provide support for the GNU gettext functionality.
739 # Please note that the actual code is *not* freely available.
743 dnl GCC_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
744 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
745 AC_DEFUN(GCC_PATH_PROG_WITH_TEST,
746 [# Extract the first word of "$2", so it can be a program name with args.
747 set dummy $2; ac_word=[$]2
748 AC_MSG_CHECKING([for $ac_word])
749 AC_CACHE_VAL(gcc_cv_path_$1,
752 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
755 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
756 for ac_dir in ifelse([$5], , $PATH, [$5]); do
757 test -z "$ac_dir" && ac_dir=.
758 if test -f $ac_dir/$ac_word; then
760 gcc_cv_path_$1="$ac_dir/$ac_word"
766 dnl If no 4th arg is given, leave the cache variable unset,
767 dnl so GCC_PATH_PROGS will keep looking.
768 ifelse([$4], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$4"
773 if test -n "[$]$1"; then
781 # Check whether mmap can map an arbitrary page from /dev/zero or with
782 # MAP_ANONYMOUS, without MAP_FIXED.
783 AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
784 [AC_CHECK_FUNCS(getpagesize)
785 # The test program for the next two tests is the same except for one
787 changequote({{{,}}})dnl
788 {{{cat >ct-mmap.inc <<'EOF'
789 #include <sys/types.h>
790 #include <sys/mman.h>
796 #if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
797 # define MAP_ANONYMOUS MAP_ANON
800 /* This mess was copied from the GNU getpagesize.h. */
801 #ifndef HAVE_GETPAGESIZE
802 # ifdef HAVE_UNISTD_H
806 /* Assume that all systems that can run configure have sys/param.h. */
807 # ifndef HAVE_SYS_PARAM_H
808 # define HAVE_SYS_PARAM_H 1
812 # define getpagesize() sysconf(_SC_PAGESIZE)
813 # else /* no _SC_PAGESIZE */
814 # ifdef HAVE_SYS_PARAM_H
815 # include <sys/param.h>
816 # ifdef EXEC_PAGESIZE
817 # define getpagesize() EXEC_PAGESIZE
818 # else /* no EXEC_PAGESIZE */
820 # define getpagesize() NBPG * CLSIZE
823 # endif /* no CLSIZE */
826 # define getpagesize() NBPC
829 # define getpagesize() PAGESIZE
830 # endif /* PAGESIZE */
831 # endif /* no NBPC */
832 # endif /* no NBPG */
833 # endif /* no EXEC_PAGESIZE */
834 # else /* no HAVE_SYS_PARAM_H */
835 # define getpagesize() 8192 /* punt totally */
836 # endif /* no HAVE_SYS_PARAM_H */
837 # endif /* no _SC_PAGESIZE */
839 #endif /* no HAVE_GETPAGESIZE */
842 # define MAP_FAILED -1
846 #define perror_exit(str, val) \
847 do { perror(str); exit(val); } while (0)
849 /* Some versions of cygwin mmap require that munmap is called with the
850 same parameters as mmap. GCC expects that this is not the case.
851 Test for various forms of this problem. Warning - icky signal games. */
853 static sigset_t unblock_sigsegv;
863 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
864 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
866 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
867 MAP_PRIVATE, devzero, 0);
875 sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
879 /* Basic functionality test. */
883 char *x = anonmap (pg);
884 if (x == (char *) MAP_FAILED)
885 perror_exit("test 0 mmap", 2);
889 if (munmap(x, pg) < 0)
890 perror_exit("test 0 munmap", 3);
893 /* 1. If we map a 2-page region and unmap its second page, the first page
898 char *x = anonmap (pg * 2);
899 if (x == (char *)MAP_FAILED)
900 perror_exit ("test 1 mmap", 4);
902 signal (SIGSEGV, sigsegv);
904 perror_exit ("test 1 fault", 5);
909 if (munmap (x + pg, pg) < 0)
910 perror_exit ("test 1 munmap 1", 6);
916 perror_exit ("test 1 no fault", 7);
918 if (munmap (x, pg) < 0)
919 perror_exit ("test 1 munmap 2", 8);
922 /* 2. If we map a 2-page region and unmap its first page, the second
927 char *x = anonmap (pg * 2);
928 if (x == (char *)MAP_FAILED)
929 perror_exit ("test 2 mmap", 9);
931 signal (SIGSEGV, sigsegv);
933 perror_exit ("test 2 fault", 10);
938 if (munmap (x, pg) < 0)
939 perror_exit ("test 2 munmap 1", 11);
946 perror_exit ("test 2 no fault", 12);
949 if (munmap (x+pg, pg) < 0)
950 perror_exit ("test 2 munmap 2", 13);
953 /* 3. If we map two adjacent 1-page regions and unmap them both with
954 one munmap, both must go away.
956 Getting two adjacent 1-page regions with two mmap calls is slightly
957 tricky. All OS's tested skip over already-allocated blocks; therefore
958 we have been careful to unmap all allocated regions in previous tests.
959 HP/UX allocates pages backward in memory. No OS has yet been observed
960 to be so perverse as to leave unmapped space between consecutive calls
969 if (x == (char *)MAP_FAILED)
970 perror_exit ("test 3 mmap 1", 14);
972 if (y == (char *)MAP_FAILED)
973 perror_exit ("test 3 mmap 2", 15);
981 fprintf (stderr, "test 3 nonconsecutive pages - %lx, %lx\n",
982 (unsigned long)x, (unsigned long)y);
987 signal (SIGSEGV, sigsegv);
989 perror_exit ("test 3 fault", 17);
994 if (munmap (x, pg*2) < 0)
995 perror_exit ("test 3 munmap", 18);
1000 perror_exit ("test 3 no fault 1", 19);
1003 signal (SIGSEGV, sigsegv);
1004 if (setjmp (r) == 0)
1007 perror_exit ("test 3 no fault 2", 20);
1014 sigemptyset (&unblock_sigsegv);
1015 sigaddset (&unblock_sigsegv, SIGSEGV);
1016 pg = getpagesize ();
1017 #ifndef USE_MAP_ANON
1018 devzero = open ("/dev/zero", O_RDWR);
1020 perror_exit ("open /dev/zero", 1);
1033 AC_CACHE_CHECK(for working mmap from /dev/zero,
1034 ac_cv_func_mmap_dev_zero,
1036 [#include "ct-mmap.inc"],
1037 ac_cv_func_mmap_dev_zero=yes,
1039 then ac_cv_func_mmap_dev_zero=no
1040 else ac_cv_func_mmap_dev_zero=buggy
1042 # If this is not cygwin, and /dev/zero is a character device, it's probably
1043 # safe to assume it works.
1045 cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
1046 * ) if test -c /dev/zero
1047 then ac_cv_func_mmap_dev_zero=yes
1048 else ac_cv_func_mmap_dev_zero=no
1052 if test $ac_cv_func_mmap_dev_zero = yes; then
1053 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
1054 [Define if mmap can get us zeroed pages from /dev/zero.])
1057 AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
1058 ac_cv_func_mmap_anon,
1060 [#define USE_MAP_ANON
1061 #include "ct-mmap.inc"],
1062 ac_cv_func_mmap_anon=yes,
1064 then ac_cv_func_mmap_anon=no
1065 else ac_cv_func_mmap_anon=buggy
1067 # Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
1068 # just because it's there. Some SCO Un*xen define it but don't implement it.
1069 ac_cv_func_mmap_anon=no)
1071 if test $ac_cv_func_mmap_anon = yes; then
1072 AC_DEFINE(HAVE_MMAP_ANON, 1,
1073 [Define if mmap can get us zeroed pages using MAP_ANON(YMOUS).])
1078 # Check whether mmap can map a plain file, without MAP_FIXED.
1079 AC_DEFUN([AC_FUNC_MMAP_FILE],
1080 [AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
1081 [# Create a file one thousand bytes long.
1082 for i in 1 2 3 4 5 6 7 8 9 0
1083 do for j in 1 2 3 4 5 6 7 8 9 0
1086 done > conftestdata$$
1089 /* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
1090 Richard Henderson and Alexandre Oliva.
1091 Check whether read-only mmap of a plain file works. */
1092 #include <sys/types.h>
1093 #include <sys/stat.h>
1095 #include <sys/mman.h>
1103 fd = open("conftestdata$$", O_RDONLY);
1107 if (fstat (fd, &st))
1110 x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
1111 if (x == (char *) -1)
1114 if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
1117 if (munmap(x, st.st_size) < 0)
1121 }], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
1122 ac_cv_func_mmap_file=no)])
1123 if test $ac_cv_func_mmap_file = yes; then
1124 AC_DEFINE(HAVE_MMAP_FILE, 1,
1125 [Define if read-only mmap of a plain file works.])
1129 dnl Locate a program and check that its version is acceptable.
1130 dnl AC_PROG_CHECK_VER(var, name, version-switch,
1131 dnl version-extract-regexp, version-glob)
1132 AC_DEFUN(gcc_AC_CHECK_PROG_VER,
1133 [AC_CHECK_PROG([$1], [$2], [$2])
1134 if test -n "[$]$1"; then
1135 # Found it, now check the version.
1136 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
1137 [changequote(<<,>>)dnl
1138 ac_prog_version=`<<$>>$1 $3 2>&1 |
1139 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
1141 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
1142 changequote(<<,>>)dnl
1143 case $ac_prog_version in
1144 '') gcc_cv_prog_$2_modern=no;;
1146 gcc_cv_prog_$2_modern=yes;;
1147 *) gcc_cv_prog_$2_modern=no;;
1152 gcc_cv_prog_$2_modern=no