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 AC_DEFUN(EGCS_PROG_INSTALL,
176 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
177 # Find a good install program. We prefer a C program (faster),
178 # so one script is as good as another. But avoid the broken or
179 # incompatible versions:
180 # SysV /etc/install, /usr/sbin/install
181 # SunOS /usr/etc/install
184 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
185 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
186 # ./install, which can be erroneously created by make from ./install.sh.
187 AC_MSG_CHECKING(for a BSD compatible install)
188 if test -z "$INSTALL"; then
189 AC_CACHE_VAL(ac_cv_path_install,
190 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
191 for ac_dir in $PATH; do
192 # Account for people who put trailing slashes in PATH elements.
194 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
196 # OSF1 and SCO ODT 3.0 have their own names for install.
197 for ac_prog in ginstall scoinst install; do
198 if test -f $ac_dir/$ac_prog; then
199 if test $ac_prog = install &&
200 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
201 # AIX install. It has an incompatible calling convention.
202 # OSF/1 installbsd also uses dspmsg, but is usable.
205 ac_cv_path_install="$ac_dir/$ac_prog -c"
215 if test "${ac_cv_path_install+set}" = set; then
216 INSTALL="$ac_cv_path_install"
218 # As a last resort, use the slow shell script. We don't cache a
219 # path for INSTALL within a source directory, because that will
220 # break other packages using the cache if that directory is
221 # removed, or if the path is relative.
222 INSTALL="$ac_install_sh"
225 dnl We do special magic for INSTALL instead of AC_SUBST, to get
226 dnl relative paths right.
227 AC_MSG_RESULT($INSTALL)
230 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
231 # It thinks the first close brace ends the variable substitution.
232 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
233 AC_SUBST(INSTALL_PROGRAM)dnl
235 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
236 AC_SUBST(INSTALL_DATA)dnl
240 dnl This test replaces the one in autoconf.
241 dnl Currently this macro should have the same name as the autoconf macro
242 dnl because gettext's gettext.m4 (distributed in the automake package)
243 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
244 dnl give these diagnostics:
245 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
246 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
248 undefine([AC_ISC_POSIX])
249 AC_DEFUN(AC_ISC_POSIX,
251 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
252 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
256 # Macro to add for using GNU gettext.
257 # Ulrich Drepper <drepper@cygnus.com>, 1995.
259 # This file can be copied and used freely without restrictions. It can
260 # be used in projects which are not available under the GNU Public License
261 # but which still want to provide support for the GNU gettext functionality.
262 # Please note that the actual code is *not* freely available.
266 AC_DEFUN(AM_WITH_NLS,
267 [AC_MSG_CHECKING([whether NLS is requested])
268 dnl Default is enabled NLS
270 [ --disable-nls do not use Native Language Support],
271 USE_NLS=$enableval, USE_NLS=yes)
272 AC_MSG_RESULT($USE_NLS)
275 USE_INCLUDED_LIBINTL=no
277 dnl If we use NLS figure out what method
278 if test "$USE_NLS" = "yes"; then
279 AC_DEFINE(ENABLE_NLS)
280 AC_MSG_CHECKING([whether included gettext is requested])
281 AC_ARG_WITH(included-gettext,
282 [ --with-included-gettext use the GNU gettext library included here],
283 nls_cv_force_use_gnu_gettext=$withval,
284 nls_cv_force_use_gnu_gettext=no)
285 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
287 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
288 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
289 dnl User does not insist on using GNU NLS library. Figure out what
290 dnl to use. If gettext or catgets are available (in this order) we
291 dnl use this. Else we have to fall back to GNU NLS library.
292 dnl catgets is only used if permitted by option --with-catgets.
297 AC_CHECK_HEADER(libintl.h,
298 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
299 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
300 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
302 if test "$gt_cv_func_gettext_libc" != "yes"; then
303 AC_CHECK_LIB(intl, bindtextdomain,
304 [AC_CACHE_CHECK([for gettext in libintl],
305 gt_cv_func_gettext_libintl,
306 [AC_CHECK_LIB(intl, gettext,
307 gt_cv_func_gettext_libintl=yes,
308 gt_cv_func_gettext_libintl=no)],
309 gt_cv_func_gettext_libintl=no)])
312 if test "$gt_cv_func_gettext_libc" = "yes" \
313 || test "$gt_cv_func_gettext_libintl" = "yes"; then
314 AC_DEFINE(HAVE_GETTEXT)
315 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
316 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
317 if test "$MSGFMT" != "no"; then
318 AC_CHECK_FUNCS(dcgettext)
319 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
320 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
321 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
322 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
323 return _nl_msg_cat_cntr],
333 if test "$CATOBJEXT" = "NONE"; then
334 AC_MSG_CHECKING([whether catgets can be used])
336 [ --with-catgets use catgets functions if available],
337 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
338 AC_MSG_RESULT($nls_cv_use_catgets)
340 if test "$nls_cv_use_catgets" = "yes"; then
341 dnl No gettext in C library. Try catgets next.
342 AC_CHECK_LIB(i, main)
343 AC_CHECK_FUNC(catgets,
344 [AC_DEFINE(HAVE_CATGETS)
345 INTLOBJS="\$(CATOBJS)"
346 AC_PATH_PROG(GENCAT, gencat, no)dnl
347 if test "$GENCAT" != "no"; then
348 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
349 if test "$GMSGFMT" = "no"; then
350 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
351 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
353 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
354 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
355 USE_INCLUDED_LIBINTL=yes
359 INTLDEPS='$(top_builddir)/intl/libintl.a'
361 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
362 nls_cv_header_intl=intl/libintl.h
363 nls_cv_header_libgt=intl/libgettext.h
368 if test "$CATOBJEXT" = "NONE"; then
369 dnl Neither gettext nor catgets in included in the C library.
370 dnl Fall back on GNU gettext library.
371 nls_cv_use_gnu_gettext=yes
375 if test "$nls_cv_use_gnu_gettext" = "yes"; then
376 dnl Mark actions used to generate GNU NLS library.
377 INTLOBJS="\$(GETTOBJS)"
378 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
379 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
380 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
381 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
382 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
384 USE_INCLUDED_LIBINTL=yes
388 INTLDEPS='$(top_builddir)/intl/libintl.a'
390 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
391 nls_cv_header_intl=intl/libintl.h
392 nls_cv_header_libgt=intl/libgettext.h
395 dnl Test whether we really found GNU xgettext.
396 if test "$XGETTEXT" != ":"; then
397 dnl If it is no GNU xgettext we define it as : so that the
398 dnl Makefiles still can work.
399 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
403 [found xgettext program is not GNU xgettext; ignore it])
408 # We need to process the po/ directory.
412 nls_cv_header_intl=intl/libintl.h
413 nls_cv_header_libgt=intl/libgettext.h
415 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
417 [case "$CONFIG_FILES" in *po/Makefile.in*)
418 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
422 # If this is used in GNU gettext we have to set USE_NLS to `yes'
423 # because some of the sources are only built for this goal.
424 if test "$PACKAGE" = gettext; then
426 USE_INCLUDED_LIBINTL=yes
429 dnl These rules are solely for the distribution goal. While doing this
430 dnl we only have to keep exactly one list of the available catalogs
432 for lang in $ALL_LINGUAS; do
433 GMOFILES="$GMOFILES $lang.gmo"
434 POFILES="$POFILES $lang.po"
437 dnl Make all variables we use known to autoconf.
438 AC_SUBST(USE_INCLUDED_LIBINTL)
441 AC_SUBST(DATADIRNAME)
451 AC_DEFUN(AM_GNU_GETTEXT,
452 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
453 AC_REQUIRE([AC_PROG_CC])dnl
454 AC_REQUIRE([AC_PROG_RANLIB])dnl
455 AC_REQUIRE([AC_ISC_POSIX])dnl
456 AC_REQUIRE([AC_HEADER_STDC])dnl
457 AC_REQUIRE([AC_C_CONST])dnl
458 AC_REQUIRE([AC_C_INLINE])dnl
459 AC_REQUIRE([AC_TYPE_OFF_T])dnl
460 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
461 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
462 AC_REQUIRE([AC_FUNC_MMAP])dnl
464 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
465 unistd.h sys/param.h])
466 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
467 strdup __argz_count __argz_stringify __argz_next])
469 if test "${ac_cv_func_stpcpy+set}" != "set"; then
470 AC_CHECK_FUNCS(stpcpy)
472 if test "${ac_cv_func_stpcpy}" = "yes"; then
473 AC_DEFINE(HAVE_STPCPY)
479 if test "x$CATOBJEXT" != "x"; then
480 if test "x$ALL_LINGUAS" = "x"; then
483 AC_MSG_CHECKING(for catalogs to be installed)
485 for lang in ${LINGUAS=$ALL_LINGUAS}; do
486 case "$ALL_LINGUAS" in
487 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
491 AC_MSG_RESULT($LINGUAS)
494 dnl Construct list of names of catalog files to be constructed.
495 if test -n "$LINGUAS"; then
496 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
500 dnl The reference to <locale.h> in the installed <libintl.h> file
501 dnl must be resolved because we cannot expect the users of this
502 dnl to define HAVE_LOCALE_H.
503 if test $ac_cv_header_locale_h = yes; then
504 INCLUDE_LOCALE_H="#include <locale.h>"
507 /* The system does not provide the header <locale.h>. Take care yourself. */"
509 AC_SUBST(INCLUDE_LOCALE_H)
511 dnl Determine which catalog format we have (if any is needed)
512 dnl For now we know about two different formats:
513 dnl Linux libc-5 and the normal X/Open format
514 test -d intl || mkdir intl
515 if test "$CATOBJEXT" = ".cat"; then
516 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
518 dnl Transform the SED scripts while copying because some dumb SEDs
519 dnl cannot handle comments.
520 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
522 dnl po2tbl.sed is always needed.
523 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
524 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
526 dnl In the intl/Makefile.in we have a special dependency which makes
527 dnl only sense for gettext. We comment this out for non-gettext
529 if test "$PACKAGE" = "gettext"; then
539 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
540 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
541 dnl Try to locate is.
543 if test -n "$ac_aux_dir"; then
544 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
546 if test -z "$MKINSTALLDIRS"; then
547 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
549 AC_SUBST(MKINSTALLDIRS)
551 dnl *** For now the libtool support in intl/Makefile is not for real.
555 dnl Generate list of files to be processed by xgettext which will
556 dnl be included in po/Makefile.
557 test -d po || mkdir po
558 if test "x$srcdir" != "x."; then
559 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
560 posrcprefix="$srcdir/"
562 posrcprefix="../$srcdir/"
568 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
569 < $srcdir/po/POTFILES.in > po/POTFILES
572 # Check whether LC_MESSAGES is available in <locale.h>.
573 # Ulrich Drepper <drepper@cygnus.com>, 1995.
575 # This file can be copied and used freely without restrictions. It can
576 # be used in projects which are not available under the GNU Public License
577 # but which still want to provide support for the GNU gettext functionality.
578 # Please note that the actual code is *not* freely available.
582 AC_DEFUN(AM_LC_MESSAGES,
583 [if test $ac_cv_header_locale_h = yes; then
584 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
585 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
586 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
587 if test $am_cv_val_LC_MESSAGES = yes; then
588 AC_DEFINE(HAVE_LC_MESSAGES)
592 # Search path for a program which passes the given test.
593 # Ulrich Drepper <drepper@cygnus.com>, 1996.
595 # This file can be copied and used freely without restrictions. It can
596 # be used in projects which are not available under the GNU Public License
597 # but which still want to provide support for the GNU gettext functionality.
598 # Please note that the actual code is *not* freely available.
602 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
603 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
604 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
605 [# Extract the first word of "$2", so it can be a program name with args.
606 set dummy $2; ac_word=[$]2
607 AC_MSG_CHECKING([for $ac_word])
608 AC_CACHE_VAL(ac_cv_path_$1,
611 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
614 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
615 for ac_dir in ifelse([$5], , $PATH, [$5]); do
616 test -z "$ac_dir" && ac_dir=.
617 if test -f $ac_dir/$ac_word; then
619 ac_cv_path_$1="$ac_dir/$ac_word"
625 dnl If no 4th arg is given, leave the cache variable unset,
626 dnl so AC_PATH_PROGS will keep looking.
627 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
632 if test -n "[$]$1"; then