1 Fdnl See whether we can include both string.h and strings.h.
2 AC_DEFUN(gcc_AC_HEADER_STRING,
3 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
5 [AC_TRY_COMPILE([#include <string.h>
6 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
7 if test $gcc_cv_header_string = yes; then
8 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
12 dnl See whether we need a declaration for a function.
13 dnl The result is highly dependent on the INCLUDES passed in, so make sure
14 dnl to use a different cache variable name in this macro if it is invoked
15 dnl in a different context somewhere else.
16 dnl gcc_AC_CHECK_DECL(SYMBOL,
17 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
18 AC_DEFUN(gcc_AC_CHECK_DECL,
19 [AC_MSG_CHECKING([whether $1 is declared])
20 AC_CACHE_VAL(gcc_cv_have_decl_$1,
23 char *(*pfn) = (char *(*)) $1 ;
24 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
25 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
26 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
28 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
32 dnl Check multiple functions to see whether each needs a declaration.
33 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
34 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
35 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
36 AC_DEFUN(gcc_AC_CHECK_DECLS,
40 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
42 gcc_AC_CHECK_DECL($ac_func,
43 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
44 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
48 dnl Automatically generate config.h entries via autoheader.
50 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
51 AC_DEFINE([HAVE_DECL_\&], 1,
52 [Define to 1 if we found this declaration otherwise define to 0.]))dnl
56 dnl Check if we have vprintf and possibly _doprnt.
57 dnl Note autoconf checks for vprintf even though we care about vfprintf.
58 AC_DEFUN(gcc_AC_FUNC_VFPRINTF_DOPRNT,
62 if test $ac_cv_func_vprintf != yes ; then
64 if test $ac_cv_func__doprnt != yes ; then
72 dnl Check if we have strstr.
73 AC_DEFUN([gcc_AC_FUNC_STRSTR],
74 [AC_CHECK_FUNCS([strstr], [strstr=], [strstr=strstr.o])
77 dnl See if the printf functions in libc support %p in format strings.
78 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
79 [AC_CACHE_CHECK(whether the printf functions support %p,
80 gcc_cv_func_printf_ptr,
81 [AC_TRY_RUN([#include <stdio.h>
86 char *p = buf, *q = NULL;
87 sprintf(buf, "%p", p);
88 sscanf(buf, "%p", &q);
90 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
91 gcc_cv_func_printf_ptr=no)
92 rm -f core core.* *.core])
93 if test $gcc_cv_func_printf_ptr = yes ; then
94 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
98 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
99 AC_DEFUN(gcc_AC_PROG_LN_S,
100 [AC_MSG_CHECKING(whether ln -s works)
101 AC_CACHE_VAL(gcc_cv_prog_LN_S,
102 [rm -f conftestdata_t
104 if ln -s conftestdata_f conftestdata_t 2>/dev/null
106 gcc_cv_prog_LN_S="ln -s"
108 if ln conftestdata_f conftestdata_t 2>/dev/null
115 rm -f conftestdata_f conftestdata_t
117 LN_S="$gcc_cv_prog_LN_S"
118 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
121 if test "$gcc_cv_prog_LN_S" = "ln"; then
122 AC_MSG_RESULT([no, using ln])
124 AC_MSG_RESULT([no, and neither does ln, so using cp])
130 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
131 AC_DEFUN(gcc_AC_PROG_LN,
132 [AC_MSG_CHECKING(whether ln works)
133 AC_CACHE_VAL(gcc_cv_prog_LN,
134 [rm -f conftestdata_t
136 if ln conftestdata_f conftestdata_t 2>/dev/null
140 if ln -s conftestdata_f conftestdata_t 2>/dev/null
142 gcc_cv_prog_LN="ln -s"
147 rm -f conftestdata_f conftestdata_t
150 if test "$gcc_cv_prog_LN" = "ln"; then
153 if test "$gcc_cv_prog_LN" = "ln -s"; then
154 AC_MSG_RESULT([no, using ln -s])
156 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
162 dnl See whether the stage1 host compiler accepts the volatile keyword.
163 AC_DEFUN(gcc_AC_C_VOLATILE,
164 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
165 [AC_TRY_COMPILE(, [volatile int foo;],
166 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
167 if test $gcc_cv_c_volatile = yes ; then
168 AC_DEFINE(HAVE_VOLATILE, 1, [Define if your compiler understands volatile.])
172 dnl Check whether long double is supported. This differs from the
173 dnl built-in autoconf test in that it works for cross compiles.
174 AC_DEFUN(gcc_AC_C_LONG_DOUBLE,
175 [AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
176 [if test "$GCC" = yes; then
177 gcc_cv_c_long_double=yes
180 [/* The Stardent Vistra knows sizeof(long double), but does not support it. */
181 long double foo = 0.0;
182 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
183 switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
184 gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
186 if test $gcc_cv_c_long_double = yes; then
187 AC_DEFINE(HAVE_LONG_DOUBLE)
191 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
193 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
194 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
196 #include <sys/types.h>
197 #ifdef HAVE_SYS_STAT_H
198 # include <sys/stat.h>
205 #endif], [mkdir ("foo", 0);],
206 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
207 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
208 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
212 AC_DEFUN(gcc_AC_PROG_INSTALL,
213 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
214 # Find a good install program. We prefer a C program (faster),
215 # so one script is as good as another. But avoid the broken or
216 # incompatible versions:
217 # SysV /etc/install, /usr/sbin/install
218 # SunOS /usr/etc/install
221 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
222 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
223 # ./install, which can be erroneously created by make from ./install.sh.
224 AC_MSG_CHECKING(for a BSD compatible install)
225 if test -z "$INSTALL"; then
226 AC_CACHE_VAL(ac_cv_path_install,
227 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
228 for ac_dir in $PATH; do
229 # Account for people who put trailing slashes in PATH elements.
231 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
233 # OSF1 and SCO ODT 3.0 have their own names for install.
234 for ac_prog in ginstall scoinst install; do
235 if test -f $ac_dir/$ac_prog; then
236 if test $ac_prog = install &&
237 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
238 # AIX install. It has an incompatible calling convention.
239 # OSF/1 installbsd also uses dspmsg, but is usable.
242 ac_cv_path_install="$ac_dir/$ac_prog -c"
252 if test "${ac_cv_path_install+set}" = set; then
253 INSTALL="$ac_cv_path_install"
255 # As a last resort, use the slow shell script. We don't cache a
256 # path for INSTALL within a source directory, because that will
257 # break other packages using the cache if that directory is
258 # removed, or if the path is relative.
259 INSTALL="$ac_install_sh"
262 dnl We do special magic for INSTALL instead of AC_SUBST, to get
263 dnl relative paths right.
264 AC_MSG_RESULT($INSTALL)
267 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
268 # It thinks the first close brace ends the variable substitution.
269 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
270 AC_SUBST(INSTALL_PROGRAM)dnl
272 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
273 AC_SUBST(INSTALL_DATA)dnl
277 dnl This test replaces the one in autoconf.
278 dnl Currently this macro should have the same name as the autoconf macro
279 dnl because gettext's gettext.m4 (distributed in the automake package)
280 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
281 dnl give these diagnostics:
282 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
283 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
285 undefine([AC_ISC_POSIX])
286 AC_DEFUN(AC_ISC_POSIX,
288 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
289 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
294 dnl GCC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])
295 dnl like AC_PATH_PROG but use other cache variables
296 AC_DEFUN(GCC_PATH_PROG,
297 [# Extract the first word of "$2", so it can be a program name with args.
298 set dummy $2; ac_word=[$]2
299 AC_MSG_CHECKING([for $ac_word])
300 AC_CACHE_VAL(gcc_cv_path_$1,
303 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
306 gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
309 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
310 dnl $ac_dummy forces splitting on constant user-supplied paths.
311 dnl POSIX.2 word splitting is done only on the output of word expansions,
312 dnl not every word. This closes a longstanding sh security hole.
313 ac_dummy="ifelse([$4], , $PATH, [$4])"
314 for ac_dir in $ac_dummy; do
315 test -z "$ac_dir" && ac_dir=.
316 if test -f $ac_dir/$ac_word; then
317 gcc_cv_path_$1="$ac_dir/$ac_word"
322 dnl If no 3rd arg is given, leave the cache variable unset,
323 dnl so GCC_PATH_PROGS will keep looking.
324 ifelse([$3], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$3"
329 if test -n "[$]$1"; then
339 # Macro to add for using GNU gettext.
340 # Ulrich Drepper <drepper@cygnus.com>, 1995.
342 # This file can be copied and used freely without restrictions. It can
343 # be used in projects which are not available under the GNU Public License
344 # but which still want to provide support for the GNU gettext functionality.
345 # Please note that the actual code is *not* freely available.
349 AC_DEFUN(AM_WITH_NLS,
350 [AC_MSG_CHECKING([whether NLS is requested])
351 dnl Default is enabled NLS
353 [ --disable-nls do not use Native Language Support],
354 USE_NLS=$enableval, USE_NLS=yes)
355 AC_MSG_RESULT($USE_NLS)
358 USE_INCLUDED_LIBINTL=no
360 dnl If we use NLS figure out what method
361 if test "$USE_NLS" = "yes"; then
362 AC_DEFINE(ENABLE_NLS)
363 AC_MSG_CHECKING([whether included gettext is requested])
364 AC_ARG_WITH(included-gettext,
365 [ --with-included-gettext use the GNU gettext library included here],
366 nls_cv_force_use_gnu_gettext=$withval,
367 nls_cv_force_use_gnu_gettext=no)
368 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
370 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
371 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
372 dnl User does not insist on using GNU NLS library. Figure out what
373 dnl to use. If gettext or catgets are available (in this order) we
374 dnl use this. Else we have to fall back to GNU NLS library.
375 dnl catgets is only used if permitted by option --with-catgets.
380 AC_CHECK_HEADER(libintl.h,
381 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
382 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
383 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
385 if test "$gt_cv_func_gettext_libc" != "yes"; then
386 AC_CHECK_LIB(intl, bindtextdomain,
387 [AC_CACHE_CHECK([for gettext in libintl],
388 gt_cv_func_gettext_libintl,
389 [AC_CHECK_LIB(intl, gettext,
390 gt_cv_func_gettext_libintl=yes,
391 gt_cv_func_gettext_libintl=no)],
392 gt_cv_func_gettext_libintl=no)])
395 if test "$gt_cv_func_gettext_libintl" = "yes"; then
399 if test "$gt_cv_func_gettext_libc" = "yes" \
400 || test "$gt_cv_func_gettext_libintl" = "yes"; then
401 AC_DEFINE(HAVE_GETTEXT)
402 GCC_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
403 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
404 if test "$MSGFMT" != "no"; then
405 AC_CHECK_FUNCS(dcgettext)
406 GCC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
407 GCC_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
408 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
409 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
410 return _nl_msg_cat_cntr],
422 if test "$CATOBJEXT" = "NONE"; then
423 AC_MSG_CHECKING([whether catgets can be used])
425 [ --with-catgets use catgets functions if available],
426 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
427 AC_MSG_RESULT($nls_cv_use_catgets)
429 if test "$nls_cv_use_catgets" = "yes"; then
430 dnl No gettext in C library. Try catgets next.
431 AC_CHECK_LIB(i, main)
432 AC_CHECK_FUNC(catgets,
433 [AC_DEFINE(HAVE_CATGETS)
434 INTLOBJS="\$(CATOBJS)"
435 GCC_PATH_PROG(GENCAT, gencat, no)dnl
436 if test "$GENCAT" != "no"; then
437 GCC_PATH_PROG(GMSGFMT, gmsgfmt, no)
438 if test "$GMSGFMT" = "no"; then
439 GCC_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
440 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
441 if test "$GMSGFMT" = "msgfmt"; then
445 GCC_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
446 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
447 USE_INCLUDED_LIBINTL=yes
451 INTLDEPS='$(top_builddir)/intl/libintl.a'
453 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
454 nls_cv_header_intl=intl/libintl.h
455 nls_cv_header_libgt=intl/libgettext.h
460 if test "$CATOBJEXT" = "NONE"; then
461 dnl Neither gettext nor catgets in included in the C library.
462 dnl Fall back on GNU gettext library.
463 nls_cv_use_gnu_gettext=yes
467 if test "$nls_cv_use_gnu_gettext" = "yes"; then
468 dnl Mark actions used to generate GNU NLS library.
469 INTLOBJS="\$(GETTOBJS)"
470 GCC_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
471 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
472 GCC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
473 dnl If we didn't find either msgfmt or gmsgfmt, don't try to
474 dnl create a catalog.
475 if test "$MSGFMT" = "msgfmt" && test "$GMSGFMT" = "msgfmt"; then
478 GCC_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
479 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
481 USE_INCLUDED_LIBINTL=yes
485 INTLDEPS='$(top_builddir)/intl/libintl.a'
487 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
488 nls_cv_header_intl=intl/libintl.h
489 nls_cv_header_libgt=intl/libgettext.h
492 dnl Test whether we really found GNU xgettext.
493 if test "$XGETTEXT" != ":"; then
494 dnl If it is no GNU xgettext we define it as : so that the
495 dnl Makefiles still can work.
496 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
500 [found xgettext program is not GNU xgettext; ignore it])
507 # We need to process the po/ directory.
511 nls_cv_header_intl=intl/libintl.h
512 nls_cv_header_libgt=intl/libgettext.h
514 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
516 [case "$CONFIG_FILES" in *po/Makefile.in*)
517 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
521 # If this is used in GNU gettext we have to set USE_NLS to `yes'
522 # because some of the sources are only built for this goal.
523 if test "$PACKAGE" = gettext; then
525 USE_INCLUDED_LIBINTL=yes
528 dnl These rules are solely for the distribution goal. While doing this
529 dnl we only have to keep exactly one list of the available catalogs
531 for lang in $ALL_LINGUAS; do
532 GMOFILES="$GMOFILES $lang.gmo"
533 POFILES="$POFILES $lang.po"
536 dnl Make all variables we use known to autoconf.
537 AC_SUBST(USE_INCLUDED_LIBINTL)
540 AC_SUBST(DATADIRNAME)
550 AC_DEFUN(AM_GNU_GETTEXT,
551 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
552 AC_REQUIRE([AC_PROG_CC])dnl
553 AC_REQUIRE([AC_PROG_RANLIB])dnl
554 AC_REQUIRE([AC_ISC_POSIX])dnl
555 AC_REQUIRE([AC_HEADER_STDC])dnl
556 AC_REQUIRE([AC_C_CONST])dnl
557 AC_REQUIRE([AC_C_INLINE])dnl
558 AC_REQUIRE([AC_TYPE_OFF_T])dnl
559 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
560 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
562 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
563 unistd.h sys/param.h])
564 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
565 strdup __argz_count __argz_stringify __argz_next])
567 if test "${ac_cv_func_stpcpy+set}" != "set"; then
568 AC_CHECK_FUNCS(stpcpy)
570 if test "${ac_cv_func_stpcpy}" = "yes"; then
571 AC_DEFINE(HAVE_STPCPY)
577 if test "x$create_catalogs" = "xno"; then
578 AC_MSG_WARN([No program for building catalogs found -> building disabled])
581 if test "x$CATOBJEXT" != "x" && test "x$create_catalogs" != "xno" ; then
582 if test "x$ALL_LINGUAS" = "x"; then
585 AC_MSG_CHECKING(for catalogs to be installed)
586 if test "x$LINGUAS" = "x"; then
590 for lang in $ALL_LINGUAS; do
592 *" $lang "*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
597 AC_MSG_RESULT($LINGUAS)
600 dnl Construct list of names of catalog files to be constructed.
601 if test -n "$LINGUAS"; then
602 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
606 dnl The reference to <locale.h> in the installed <libintl.h> file
607 dnl must be resolved because we cannot expect the users of this
608 dnl to define HAVE_LOCALE_H.
609 if test $ac_cv_header_locale_h = yes; then
610 INCLUDE_LOCALE_H="#include <locale.h>"
613 /* The system does not provide the header <locale.h>. Take care yourself. */"
615 AC_SUBST(INCLUDE_LOCALE_H)
617 dnl Determine which catalog format we have (if any is needed)
618 dnl For now we know about two different formats:
619 dnl Linux libc-5 and the normal X/Open format
620 test -d intl || mkdir intl
621 if test "$CATOBJEXT" = ".cat"; then
622 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
624 dnl Transform the SED scripts while copying because some dumb SEDs
625 dnl cannot handle comments.
626 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
628 dnl po2tbl.sed is always needed.
629 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
630 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
632 dnl In the intl/Makefile.in we have a special dependency which makes
633 dnl only sense for gettext. We comment this out for non-gettext
635 if test "$PACKAGE" = "gettext"; then
645 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
646 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
647 dnl Try to locate is.
649 if test -n "$ac_aux_dir"; then
650 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
652 if test -z "$MKINSTALLDIRS"; then
653 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
655 AC_SUBST(MKINSTALLDIRS)
657 dnl *** For now the libtool support in intl/Makefile is not for real.
661 dnl Generate list of files to be processed by xgettext which will
662 dnl be included in po/Makefile.
663 test -d po || mkdir po
664 if test "x$srcdir" != "x."; then
665 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
666 posrcprefix="$srcdir/"
668 posrcprefix="../$srcdir/"
674 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
675 < $srcdir/po/POTFILES.in > po/POTFILES
678 # Check whether LC_MESSAGES is available in <locale.h>.
679 # Ulrich Drepper <drepper@cygnus.com>, 1995.
681 # This file can be copied and used freely without restrictions. It can
682 # be used in projects which are not available under the GNU Public License
683 # but which still want to provide support for the GNU gettext functionality.
684 # Please note that the actual code is *not* freely available.
688 AC_DEFUN(AM_LC_MESSAGES,
689 [if test $ac_cv_header_locale_h = yes; then
690 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
691 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
692 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
693 if test $am_cv_val_LC_MESSAGES = yes; then
694 AC_DEFINE(HAVE_LC_MESSAGES)
698 # Search path for a program which passes the given test.
699 # Ulrich Drepper <drepper@cygnus.com>, 1996.
701 # This file can be copied and used freely without restrictions. It can
702 # be used in projects which are not available under the GNU Public License
703 # but which still want to provide support for the GNU gettext functionality.
704 # Please note that the actual code is *not* freely available.
708 dnl GCC_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
709 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
710 AC_DEFUN(GCC_PATH_PROG_WITH_TEST,
711 [# Extract the first word of "$2", so it can be a program name with args.
712 set dummy $2; ac_word=[$]2
713 AC_MSG_CHECKING([for $ac_word])
714 AC_CACHE_VAL(gcc_cv_path_$1,
717 gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
720 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
721 for ac_dir in ifelse([$5], , $PATH, [$5]); do
722 test -z "$ac_dir" && ac_dir=.
723 if test -f $ac_dir/$ac_word; then
725 gcc_cv_path_$1="$ac_dir/$ac_word"
731 dnl If no 4th arg is given, leave the cache variable unset,
732 dnl so GCC_PATH_PROGS will keep looking.
733 ifelse([$4], , , [ test -z "[$]gcc_cv_path_$1" && gcc_cv_path_$1="$4"
738 if test -n "[$]$1"; then
746 # Check whether mmap can map an arbitrary page from /dev/zero or with
747 # MAP_ANONYMOUS, without MAP_FIXED.
748 AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
749 [AC_CHECK_FUNCS(getpagesize)
750 # The test program for the next two tests is the same except for one
752 changequote({{{,}}})dnl
753 {{{cat >ct-mmap.inc <<'EOF'
754 #include <sys/types.h>
755 #include <sys/mman.h>
761 #if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
762 # define MAP_ANONYMOUS MAP_ANON
765 /* This mess was copied from the GNU getpagesize.h. */
766 #ifndef HAVE_GETPAGESIZE
767 # ifdef HAVE_UNISTD_H
771 /* Assume that all systems that can run configure have sys/param.h. */
772 # ifndef HAVE_SYS_PARAM_H
773 # define HAVE_SYS_PARAM_H 1
777 # define getpagesize() sysconf(_SC_PAGESIZE)
778 # else /* no _SC_PAGESIZE */
779 # ifdef HAVE_SYS_PARAM_H
780 # include <sys/param.h>
781 # ifdef EXEC_PAGESIZE
782 # define getpagesize() EXEC_PAGESIZE
783 # else /* no EXEC_PAGESIZE */
785 # define getpagesize() NBPG * CLSIZE
788 # endif /* no CLSIZE */
791 # define getpagesize() NBPC
794 # define getpagesize() PAGESIZE
795 # endif /* PAGESIZE */
796 # endif /* no NBPC */
797 # endif /* no NBPG */
798 # endif /* no EXEC_PAGESIZE */
799 # else /* no HAVE_SYS_PARAM_H */
800 # define getpagesize() 8192 /* punt totally */
801 # endif /* no HAVE_SYS_PARAM_H */
802 # endif /* no _SC_PAGESIZE */
804 #endif /* no HAVE_GETPAGESIZE */
807 # define MAP_FAILED -1
811 #define perror_exit(str, val) \
812 do { perror(str); exit(val); } while (0)
814 /* Some versions of cygwin mmap require that munmap is called with the
815 same parameters as mmap. GCC expects that this is not the case.
816 Test for various forms of this problem. Warning - icky signal games. */
818 static sigset_t unblock_sigsegv;
828 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
829 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
831 return (char *) mmap (0, size, PROT_READ|PROT_WRITE,
832 MAP_PRIVATE, devzero, 0);
840 sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
844 /* Basic functionality test. */
848 char *x = anonmap (pg);
849 if (x == (char *) MAP_FAILED)
850 perror_exit("test 0 mmap", 2);
854 if (munmap(x, pg) < 0)
855 perror_exit("test 0 munmap", 3);
858 /* 1. If we map a 2-page region and unmap its second page, the first page
863 char *x = anonmap (pg * 2);
864 if (x == (char *)MAP_FAILED)
865 perror_exit ("test 1 mmap", 4);
867 signal (SIGSEGV, sigsegv);
869 perror_exit ("test 1 fault", 5);
874 if (munmap (x + pg, pg) < 0)
875 perror_exit ("test 1 munmap 1", 6);
881 perror_exit ("test 1 no fault", 7);
883 if (munmap (x, pg) < 0)
884 perror_exit ("test 1 munmap 2", 8);
887 /* 2. If we map a 2-page region and unmap its first page, the second
892 char *x = anonmap (pg * 2);
893 if (x == (char *)MAP_FAILED)
894 perror_exit ("test 2 mmap", 9);
896 signal (SIGSEGV, sigsegv);
898 perror_exit ("test 2 fault", 10);
903 if (munmap (x, pg) < 0)
904 perror_exit ("test 2 munmap 1", 11);
911 perror_exit ("test 2 no fault", 12);
914 if (munmap (x+pg, pg) < 0)
915 perror_exit ("test 2 munmap 2", 13);
918 /* 3. If we map two adjacent 1-page regions and unmap them both with
919 one munmap, both must go away.
921 Getting two adjacent 1-page regions with two mmap calls is slightly
922 tricky. All OS's tested skip over already-allocated blocks; therefore
923 we have been careful to unmap all allocated regions in previous tests.
924 HP/UX allocates pages backward in memory. No OS has yet been observed
925 to be so perverse as to leave unmapped space between consecutive calls
934 if (x == (char *)MAP_FAILED)
935 perror_exit ("test 3 mmap 1", 14);
937 if (y == (char *)MAP_FAILED)
938 perror_exit ("test 3 mmap 2", 15);
946 fprintf (stderr, "test 3 nonconsecutive pages - %lx, %lx\n",
947 (unsigned long)x, (unsigned long)y);
952 signal (SIGSEGV, sigsegv);
954 perror_exit ("test 3 fault", 17);
959 if (munmap (x, pg*2) < 0)
960 perror_exit ("test 3 munmap", 18);
965 perror_exit ("test 3 no fault 1", 19);
968 signal (SIGSEGV, sigsegv);
972 perror_exit ("test 3 no fault 2", 20);
979 sigemptyset (&unblock_sigsegv);
980 sigaddset (&unblock_sigsegv, SIGSEGV);
983 devzero = open ("/dev/zero", O_RDWR);
985 perror_exit ("open /dev/zero", 1);
998 AC_CACHE_CHECK(for working mmap from /dev/zero,
999 ac_cv_func_mmap_dev_zero,
1001 [#include "ct-mmap.inc"],
1002 ac_cv_func_mmap_dev_zero=yes,
1004 then ac_cv_func_mmap_dev_zero=no
1005 else ac_cv_func_mmap_dev_zero=buggy
1007 # If this is not cygwin, and /dev/zero is a character device, it's probably
1008 # safe to assume it works.
1010 cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
1011 * ) if test -c /dev/zero
1012 then ac_cv_func_mmap_dev_zero=yes
1013 else ac_cv_func_mmap_dev_zero=no
1017 if test $ac_cv_func_mmap_dev_zero = yes; then
1018 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
1019 [Define if mmap can get us zeroed pages from /dev/zero.])
1022 AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
1023 ac_cv_func_mmap_anon,
1025 [#define USE_MAP_ANON
1026 #include "ct-mmap.inc"],
1027 ac_cv_func_mmap_anon=yes,
1029 then ac_cv_func_mmap_anon=no
1030 else ac_cv_func_mmap_anon=buggy
1032 # Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
1033 # just because it's there. Some SCO Un*xen define it but don't implement it.
1034 ac_cv_func_mmap_anon=no)
1036 if test $ac_cv_func_mmap_anon = yes; then
1037 AC_DEFINE(HAVE_MMAP_ANON, 1,
1038 [Define if mmap can get us zeroed pages using MAP_ANON(YMOUS).])
1043 # Check whether mmap can map a plain file, without MAP_FIXED.
1044 AC_DEFUN([AC_FUNC_MMAP_FILE],
1045 [AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
1046 [# Create a file one thousand bytes long.
1047 for i in 1 2 3 4 5 6 7 8 9 0
1048 do for j in 1 2 3 4 5 6 7 8 9 0
1051 done > conftestdata$$
1054 /* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
1055 Richard Henderson and Alexandre Oliva.
1056 Check whether read-only mmap of a plain file works. */
1057 #include <sys/types.h>
1058 #include <sys/stat.h>
1060 #include <sys/mman.h>
1068 fd = open("conftestdata$$", O_RDONLY);
1072 if (fstat (fd, &st))
1075 x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
1076 if (x == (char *) -1)
1079 if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
1082 if (munmap(x, st.st_size) < 0)
1086 }], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
1087 ac_cv_func_mmap_file=no)])
1088 if test $ac_cv_func_mmap_file = yes; then
1089 AC_DEFINE(HAVE_MMAP_FILE, 1,
1090 [Define if read-only mmap of a plain file works.])
1094 dnl Locate a program and check that its version is acceptable.
1095 dnl AC_PROG_CHECK_VER(var, name, version-switch,
1096 dnl version-extract-regexp, version-glob)
1097 AC_DEFUN(gcc_AC_CHECK_PROG_VER,
1098 [AC_CHECK_PROG([$1], [$2], [$2])
1099 if test -n "[$]$1"; then
1100 # Found it, now check the version.
1101 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
1102 [changequote(<<,>>)dnl
1103 ac_prog_version=`<<$>>$1 $3 2>&1 |
1104 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
1105 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
1106 case $ac_prog_version in
1107 '') gcc_cv_prog_$2_modern=no;;
1109 gcc_cv_prog_$2_modern=yes;;
1110 *) gcc_cv_prog_$2_modern=no;;
1115 gcc_cv_prog_$2_modern=no