1 dnl See whether we can include both string.h and strings.h.
2 AC_DEFUN(GCC_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)
12 dnl See whether we need a declaration for a function.
13 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
14 AC_DEFUN(GCC_NEED_DECLARATION,
15 [AC_MSG_CHECKING([whether $1 must be declared])
16 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
19 #ifdef STRING_WITH_STRINGS
26 # ifdef HAVE_STRINGS_H
38 #define rindex strrchr
44 [char *(*pfn) = (char *(*)) $1],
45 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
46 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
48 gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
49 AC_DEFINE_UNQUOTED($gcc_tr_decl)
55 dnl Check multiple functions to see whether each needs a declaration.
56 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
57 AC_DEFUN(GCC_NEED_DECLARATIONS,
60 GCC_NEED_DECLARATION($ac_func, $2)
64 dnl Check if we have vprintf and possibly _doprnt.
65 dnl Note autoconf checks for vprintf even though we care about vfprintf.
66 AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
70 if test $ac_cv_func_vprintf != yes ; then
72 if test $ac_cv_func__doprnt != yes ; then
80 dnl See if the printf functions in libc support %p in format strings.
81 AC_DEFUN(GCC_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)
101 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
102 AC_DEFUN(GCC_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_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_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)
175 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
177 AC_DEFUN(GCC_FUNC_MKDIR_TAKES_ONE_ARG,
178 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
180 #include <sys/types.h>
181 #ifdef HAVE_SYS_STAT_H
182 # include <sys/stat.h>
189 #endif], [mkdir ("foo", 0);],
190 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
191 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
192 AC_DEFINE(MKDIR_TAKES_ONE_ARG)
196 AC_DEFUN(EGCS_PROG_INSTALL,
197 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
198 # Find a good install program. We prefer a C program (faster),
199 # so one script is as good as another. But avoid the broken or
200 # incompatible versions:
201 # SysV /etc/install, /usr/sbin/install
202 # SunOS /usr/etc/install
205 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
206 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
207 # ./install, which can be erroneously created by make from ./install.sh.
208 AC_MSG_CHECKING(for a BSD compatible install)
209 if test -z "$INSTALL"; then
210 AC_CACHE_VAL(ac_cv_path_install,
211 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
212 for ac_dir in $PATH; do
213 # Account for people who put trailing slashes in PATH elements.
215 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
217 # OSF1 and SCO ODT 3.0 have their own names for install.
218 for ac_prog in ginstall scoinst install; do
219 if test -f $ac_dir/$ac_prog; then
220 if test $ac_prog = install &&
221 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
222 # AIX install. It has an incompatible calling convention.
223 # OSF/1 installbsd also uses dspmsg, but is usable.
226 ac_cv_path_install="$ac_dir/$ac_prog -c"
236 if test "${ac_cv_path_install+set}" = set; then
237 INSTALL="$ac_cv_path_install"
239 # As a last resort, use the slow shell script. We don't cache a
240 # path for INSTALL within a source directory, because that will
241 # break other packages using the cache if that directory is
242 # removed, or if the path is relative.
243 INSTALL="$ac_install_sh"
246 dnl We do special magic for INSTALL instead of AC_SUBST, to get
247 dnl relative paths right.
248 AC_MSG_RESULT($INSTALL)
251 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
252 # It thinks the first close brace ends the variable substitution.
253 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
254 AC_SUBST(INSTALL_PROGRAM)dnl
256 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
257 AC_SUBST(INSTALL_DATA)dnl
261 dnl This test replaces the one in autoconf.
262 dnl Currently this macro should have the same name as the autoconf macro
263 dnl because gettext's gettext.m4 (distributed in the automake package)
264 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
265 dnl give these diagnostics:
266 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
267 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
269 undefine([AC_ISC_POSIX])
270 AC_DEFUN(AC_ISC_POSIX,
272 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
273 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
277 # Macro to add for using GNU gettext.
278 # Ulrich Drepper <drepper@cygnus.com>, 1995.
280 # This file can be copied and used freely without restrictions. It can
281 # be used in projects which are not available under the GNU Public License
282 # but which still want to provide support for the GNU gettext functionality.
283 # Please note that the actual code is *not* freely available.
287 AC_DEFUN(AM_WITH_NLS,
288 [AC_MSG_CHECKING([whether NLS is requested])
289 dnl Default is enabled NLS
291 [ --disable-nls do not use Native Language Support],
292 USE_NLS=$enableval, USE_NLS=yes)
293 AC_MSG_RESULT($USE_NLS)
296 USE_INCLUDED_LIBINTL=no
298 dnl If we use NLS figure out what method
299 if test "$USE_NLS" = "yes"; then
300 AC_DEFINE(ENABLE_NLS)
301 AC_MSG_CHECKING([whether included gettext is requested])
302 AC_ARG_WITH(included-gettext,
303 [ --with-included-gettext use the GNU gettext library included here],
304 nls_cv_force_use_gnu_gettext=$withval,
305 nls_cv_force_use_gnu_gettext=no)
306 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
308 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
309 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
310 dnl User does not insist on using GNU NLS library. Figure out what
311 dnl to use. If gettext or catgets are available (in this order) we
312 dnl use this. Else we have to fall back to GNU NLS library.
313 dnl catgets is only used if permitted by option --with-catgets.
318 AC_CHECK_HEADER(libintl.h,
319 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
320 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
321 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
323 if test "$gt_cv_func_gettext_libc" != "yes"; then
324 AC_CHECK_LIB(intl, bindtextdomain,
325 [AC_CACHE_CHECK([for gettext in libintl],
326 gt_cv_func_gettext_libintl,
327 [AC_CHECK_LIB(intl, gettext,
328 gt_cv_func_gettext_libintl=yes,
329 gt_cv_func_gettext_libintl=no)],
330 gt_cv_func_gettext_libintl=no)])
333 if test "$gt_cv_func_gettext_libc" = "yes" \
334 || test "$gt_cv_func_gettext_libintl" = "yes"; then
335 AC_DEFINE(HAVE_GETTEXT)
336 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
337 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
338 if test "$MSGFMT" != "no"; then
339 AC_CHECK_FUNCS(dcgettext)
340 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
341 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
342 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
343 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
344 return _nl_msg_cat_cntr],
354 if test "$CATOBJEXT" = "NONE"; then
355 AC_MSG_CHECKING([whether catgets can be used])
357 [ --with-catgets use catgets functions if available],
358 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
359 AC_MSG_RESULT($nls_cv_use_catgets)
361 if test "$nls_cv_use_catgets" = "yes"; then
362 dnl No gettext in C library. Try catgets next.
363 AC_CHECK_LIB(i, main)
364 AC_CHECK_FUNC(catgets,
365 [AC_DEFINE(HAVE_CATGETS)
366 INTLOBJS="\$(CATOBJS)"
367 AC_PATH_PROG(GENCAT, gencat, no)dnl
368 if test "$GENCAT" != "no"; then
369 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
370 if test "$GMSGFMT" = "no"; then
371 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
372 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
374 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
375 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
376 USE_INCLUDED_LIBINTL=yes
380 INTLDEPS='$(top_builddir)/intl/libintl.a'
382 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
383 nls_cv_header_intl=intl/libintl.h
384 nls_cv_header_libgt=intl/libgettext.h
389 if test "$CATOBJEXT" = "NONE"; then
390 dnl Neither gettext nor catgets in included in the C library.
391 dnl Fall back on GNU gettext library.
392 nls_cv_use_gnu_gettext=yes
396 if test "$nls_cv_use_gnu_gettext" = "yes"; then
397 dnl Mark actions used to generate GNU NLS library.
398 INTLOBJS="\$(GETTOBJS)"
399 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
400 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
401 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
402 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
403 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
405 USE_INCLUDED_LIBINTL=yes
409 INTLDEPS='$(top_builddir)/intl/libintl.a'
411 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
412 nls_cv_header_intl=intl/libintl.h
413 nls_cv_header_libgt=intl/libgettext.h
416 dnl Test whether we really found GNU xgettext.
417 if test "$XGETTEXT" != ":"; then
418 dnl If it is no GNU xgettext we define it as : so that the
419 dnl Makefiles still can work.
420 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
424 [found xgettext program is not GNU xgettext; ignore it])
429 # We need to process the po/ directory.
433 nls_cv_header_intl=intl/libintl.h
434 nls_cv_header_libgt=intl/libgettext.h
436 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
438 [case "$CONFIG_FILES" in *po/Makefile.in*)
439 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
443 # If this is used in GNU gettext we have to set USE_NLS to `yes'
444 # because some of the sources are only built for this goal.
445 if test "$PACKAGE" = gettext; then
447 USE_INCLUDED_LIBINTL=yes
450 dnl These rules are solely for the distribution goal. While doing this
451 dnl we only have to keep exactly one list of the available catalogs
453 for lang in $ALL_LINGUAS; do
454 GMOFILES="$GMOFILES $lang.gmo"
455 POFILES="$POFILES $lang.po"
458 dnl Make all variables we use known to autoconf.
459 AC_SUBST(USE_INCLUDED_LIBINTL)
462 AC_SUBST(DATADIRNAME)
472 AC_DEFUN(AM_GNU_GETTEXT,
473 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
474 AC_REQUIRE([AC_PROG_CC])dnl
475 AC_REQUIRE([AC_PROG_RANLIB])dnl
476 AC_REQUIRE([AC_ISC_POSIX])dnl
477 AC_REQUIRE([AC_HEADER_STDC])dnl
478 AC_REQUIRE([AC_C_CONST])dnl
479 AC_REQUIRE([AC_C_INLINE])dnl
480 AC_REQUIRE([AC_TYPE_OFF_T])dnl
481 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
482 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
483 AC_REQUIRE([AC_FUNC_MMAP])dnl
485 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
486 unistd.h sys/param.h])
487 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
488 strdup __argz_count __argz_stringify __argz_next])
490 if test "${ac_cv_func_stpcpy+set}" != "set"; then
491 AC_CHECK_FUNCS(stpcpy)
493 if test "${ac_cv_func_stpcpy}" = "yes"; then
494 AC_DEFINE(HAVE_STPCPY)
500 if test "x$CATOBJEXT" != "x"; then
501 if test "x$ALL_LINGUAS" = "x"; then
504 AC_MSG_CHECKING(for catalogs to be installed)
506 for lang in ${LINGUAS=$ALL_LINGUAS}; do
507 case "$ALL_LINGUAS" in
508 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
512 AC_MSG_RESULT($LINGUAS)
515 dnl Construct list of names of catalog files to be constructed.
516 if test -n "$LINGUAS"; then
517 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
521 dnl The reference to <locale.h> in the installed <libintl.h> file
522 dnl must be resolved because we cannot expect the users of this
523 dnl to define HAVE_LOCALE_H.
524 if test $ac_cv_header_locale_h = yes; then
525 INCLUDE_LOCALE_H="#include <locale.h>"
528 /* The system does not provide the header <locale.h>. Take care yourself. */"
530 AC_SUBST(INCLUDE_LOCALE_H)
532 dnl Determine which catalog format we have (if any is needed)
533 dnl For now we know about two different formats:
534 dnl Linux libc-5 and the normal X/Open format
535 test -d intl || mkdir intl
536 if test "$CATOBJEXT" = ".cat"; then
537 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
539 dnl Transform the SED scripts while copying because some dumb SEDs
540 dnl cannot handle comments.
541 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
543 dnl po2tbl.sed is always needed.
544 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
545 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
547 dnl In the intl/Makefile.in we have a special dependency which makes
548 dnl only sense for gettext. We comment this out for non-gettext
550 if test "$PACKAGE" = "gettext"; then
560 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
561 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
562 dnl Try to locate is.
564 if test -n "$ac_aux_dir"; then
565 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
567 if test -z "$MKINSTALLDIRS"; then
568 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
570 AC_SUBST(MKINSTALLDIRS)
572 dnl *** For now the libtool support in intl/Makefile is not for real.
576 dnl Generate list of files to be processed by xgettext which will
577 dnl be included in po/Makefile.
578 test -d po || mkdir po
579 if test "x$srcdir" != "x."; then
580 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
581 posrcprefix="$srcdir/"
583 posrcprefix="../$srcdir/"
589 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
590 < $srcdir/po/POTFILES.in > po/POTFILES
593 # Check whether LC_MESSAGES is available in <locale.h>.
594 # Ulrich Drepper <drepper@cygnus.com>, 1995.
596 # This file can be copied and used freely without restrictions. It can
597 # be used in projects which are not available under the GNU Public License
598 # but which still want to provide support for the GNU gettext functionality.
599 # Please note that the actual code is *not* freely available.
603 AC_DEFUN(AM_LC_MESSAGES,
604 [if test $ac_cv_header_locale_h = yes; then
605 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
606 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
607 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
608 if test $am_cv_val_LC_MESSAGES = yes; then
609 AC_DEFINE(HAVE_LC_MESSAGES)
613 # Search path for a program which passes the given test.
614 # Ulrich Drepper <drepper@cygnus.com>, 1996.
616 # This file can be copied and used freely without restrictions. It can
617 # be used in projects which are not available under the GNU Public License
618 # but which still want to provide support for the GNU gettext functionality.
619 # Please note that the actual code is *not* freely available.
623 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
624 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
625 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
626 [# Extract the first word of "$2", so it can be a program name with args.
627 set dummy $2; ac_word=[$]2
628 AC_MSG_CHECKING([for $ac_word])
629 AC_CACHE_VAL(ac_cv_path_$1,
632 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
635 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
636 for ac_dir in ifelse([$5], , $PATH, [$5]); do
637 test -z "$ac_dir" && ac_dir=.
638 if test -f $ac_dir/$ac_word; then
640 ac_cv_path_$1="$ac_dir/$ac_word"
646 dnl If no 4th arg is given, leave the cache variable unset,
647 dnl so AC_PATH_PROGS will keep looking.
648 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
653 if test -n "[$]$1"; then