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 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(AC_GCC_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)
194 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
196 AC_DEFUN(GCC_FUNC_MKDIR_TAKES_ONE_ARG,
197 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
199 #include <sys/types.h>
200 #ifdef HAVE_SYS_STAT_H
201 # include <sys/stat.h>
208 #endif], [mkdir ("foo", 0);],
209 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
210 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
211 AC_DEFINE(MKDIR_TAKES_ONE_ARG)
215 AC_DEFUN(EGCS_PROG_INSTALL,
216 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
217 # Find a good install program. We prefer a C program (faster),
218 # so one script is as good as another. But avoid the broken or
219 # incompatible versions:
220 # SysV /etc/install, /usr/sbin/install
221 # SunOS /usr/etc/install
224 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
225 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
226 # ./install, which can be erroneously created by make from ./install.sh.
227 AC_MSG_CHECKING(for a BSD compatible install)
228 if test -z "$INSTALL"; then
229 AC_CACHE_VAL(ac_cv_path_install,
230 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
231 for ac_dir in $PATH; do
232 # Account for people who put trailing slashes in PATH elements.
234 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
236 # OSF1 and SCO ODT 3.0 have their own names for install.
237 for ac_prog in ginstall scoinst install; do
238 if test -f $ac_dir/$ac_prog; then
239 if test $ac_prog = install &&
240 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
241 # AIX install. It has an incompatible calling convention.
242 # OSF/1 installbsd also uses dspmsg, but is usable.
245 ac_cv_path_install="$ac_dir/$ac_prog -c"
255 if test "${ac_cv_path_install+set}" = set; then
256 INSTALL="$ac_cv_path_install"
258 # As a last resort, use the slow shell script. We don't cache a
259 # path for INSTALL within a source directory, because that will
260 # break other packages using the cache if that directory is
261 # removed, or if the path is relative.
262 INSTALL="$ac_install_sh"
265 dnl We do special magic for INSTALL instead of AC_SUBST, to get
266 dnl relative paths right.
267 AC_MSG_RESULT($INSTALL)
270 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
271 # It thinks the first close brace ends the variable substitution.
272 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
273 AC_SUBST(INSTALL_PROGRAM)dnl
275 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
276 AC_SUBST(INSTALL_DATA)dnl
280 dnl This test replaces the one in autoconf.
281 dnl Currently this macro should have the same name as the autoconf macro
282 dnl because gettext's gettext.m4 (distributed in the automake package)
283 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
284 dnl give these diagnostics:
285 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
286 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
288 undefine([AC_ISC_POSIX])
289 AC_DEFUN(AC_ISC_POSIX,
291 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
292 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
296 # Macro to add for using GNU gettext.
297 # Ulrich Drepper <drepper@cygnus.com>, 1995.
299 # This file can be copied and used freely without restrictions. It can
300 # be used in projects which are not available under the GNU Public License
301 # but which still want to provide support for the GNU gettext functionality.
302 # Please note that the actual code is *not* freely available.
306 AC_DEFUN(AM_WITH_NLS,
307 [AC_MSG_CHECKING([whether NLS is requested])
308 dnl Default is enabled NLS
310 [ --disable-nls do not use Native Language Support],
311 USE_NLS=$enableval, USE_NLS=yes)
312 AC_MSG_RESULT($USE_NLS)
315 USE_INCLUDED_LIBINTL=no
317 dnl If we use NLS figure out what method
318 if test "$USE_NLS" = "yes"; then
319 AC_DEFINE(ENABLE_NLS)
320 AC_MSG_CHECKING([whether included gettext is requested])
321 AC_ARG_WITH(included-gettext,
322 [ --with-included-gettext use the GNU gettext library included here],
323 nls_cv_force_use_gnu_gettext=$withval,
324 nls_cv_force_use_gnu_gettext=no)
325 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
327 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
328 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
329 dnl User does not insist on using GNU NLS library. Figure out what
330 dnl to use. If gettext or catgets are available (in this order) we
331 dnl use this. Else we have to fall back to GNU NLS library.
332 dnl catgets is only used if permitted by option --with-catgets.
337 AC_CHECK_HEADER(libintl.h,
338 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
339 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
340 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
342 if test "$gt_cv_func_gettext_libc" != "yes"; then
343 AC_CHECK_LIB(intl, bindtextdomain,
344 [AC_CACHE_CHECK([for gettext in libintl],
345 gt_cv_func_gettext_libintl,
346 [AC_CHECK_LIB(intl, gettext,
347 gt_cv_func_gettext_libintl=yes,
348 gt_cv_func_gettext_libintl=no)],
349 gt_cv_func_gettext_libintl=no)])
352 if test "$gt_cv_func_gettext_libc" = "yes" \
353 || test "$gt_cv_func_gettext_libintl" = "yes"; then
354 AC_DEFINE(HAVE_GETTEXT)
355 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
356 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
357 if test "$MSGFMT" != "no"; then
358 AC_CHECK_FUNCS(dcgettext)
359 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
360 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
361 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
362 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
363 return _nl_msg_cat_cntr],
373 if test "$CATOBJEXT" = "NONE"; then
374 AC_MSG_CHECKING([whether catgets can be used])
376 [ --with-catgets use catgets functions if available],
377 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
378 AC_MSG_RESULT($nls_cv_use_catgets)
380 if test "$nls_cv_use_catgets" = "yes"; then
381 dnl No gettext in C library. Try catgets next.
382 AC_CHECK_LIB(i, main)
383 AC_CHECK_FUNC(catgets,
384 [AC_DEFINE(HAVE_CATGETS)
385 INTLOBJS="\$(CATOBJS)"
386 AC_PATH_PROG(GENCAT, gencat, no)dnl
387 if test "$GENCAT" != "no"; then
388 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
389 if test "$GMSGFMT" = "no"; then
390 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
391 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
393 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
394 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
395 USE_INCLUDED_LIBINTL=yes
399 INTLDEPS='$(top_builddir)/intl/libintl.a'
401 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
402 nls_cv_header_intl=intl/libintl.h
403 nls_cv_header_libgt=intl/libgettext.h
408 if test "$CATOBJEXT" = "NONE"; then
409 dnl Neither gettext nor catgets in included in the C library.
410 dnl Fall back on GNU gettext library.
411 nls_cv_use_gnu_gettext=yes
415 if test "$nls_cv_use_gnu_gettext" = "yes"; then
416 dnl Mark actions used to generate GNU NLS library.
417 INTLOBJS="\$(GETTOBJS)"
418 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
419 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
420 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
421 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
422 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
424 USE_INCLUDED_LIBINTL=yes
428 INTLDEPS='$(top_builddir)/intl/libintl.a'
430 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
431 nls_cv_header_intl=intl/libintl.h
432 nls_cv_header_libgt=intl/libgettext.h
435 dnl Test whether we really found GNU xgettext.
436 if test "$XGETTEXT" != ":"; then
437 dnl If it is no GNU xgettext we define it as : so that the
438 dnl Makefiles still can work.
439 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
443 [found xgettext program is not GNU xgettext; ignore it])
448 # We need to process the po/ directory.
452 nls_cv_header_intl=intl/libintl.h
453 nls_cv_header_libgt=intl/libgettext.h
455 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
457 [case "$CONFIG_FILES" in *po/Makefile.in*)
458 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
462 # If this is used in GNU gettext we have to set USE_NLS to `yes'
463 # because some of the sources are only built for this goal.
464 if test "$PACKAGE" = gettext; then
466 USE_INCLUDED_LIBINTL=yes
469 dnl These rules are solely for the distribution goal. While doing this
470 dnl we only have to keep exactly one list of the available catalogs
472 for lang in $ALL_LINGUAS; do
473 GMOFILES="$GMOFILES $lang.gmo"
474 POFILES="$POFILES $lang.po"
477 dnl Make all variables we use known to autoconf.
478 AC_SUBST(USE_INCLUDED_LIBINTL)
481 AC_SUBST(DATADIRNAME)
491 AC_DEFUN(AM_GNU_GETTEXT,
492 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
493 AC_REQUIRE([AC_PROG_CC])dnl
494 AC_REQUIRE([AC_PROG_RANLIB])dnl
495 AC_REQUIRE([AC_ISC_POSIX])dnl
496 AC_REQUIRE([AC_HEADER_STDC])dnl
497 AC_REQUIRE([AC_C_CONST])dnl
498 AC_REQUIRE([AC_C_INLINE])dnl
499 AC_REQUIRE([AC_TYPE_OFF_T])dnl
500 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
501 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
502 AC_REQUIRE([AC_FUNC_MMAP])dnl
504 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
505 unistd.h sys/param.h])
506 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
507 strdup __argz_count __argz_stringify __argz_next])
509 if test "${ac_cv_func_stpcpy+set}" != "set"; then
510 AC_CHECK_FUNCS(stpcpy)
512 if test "${ac_cv_func_stpcpy}" = "yes"; then
513 AC_DEFINE(HAVE_STPCPY)
519 if test "x$CATOBJEXT" != "x"; then
520 if test "x$ALL_LINGUAS" = "x"; then
523 AC_MSG_CHECKING(for catalogs to be installed)
525 for lang in ${LINGUAS=$ALL_LINGUAS}; do
526 case "$ALL_LINGUAS" in
527 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
531 AC_MSG_RESULT($LINGUAS)
534 dnl Construct list of names of catalog files to be constructed.
535 if test -n "$LINGUAS"; then
536 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
540 dnl The reference to <locale.h> in the installed <libintl.h> file
541 dnl must be resolved because we cannot expect the users of this
542 dnl to define HAVE_LOCALE_H.
543 if test $ac_cv_header_locale_h = yes; then
544 INCLUDE_LOCALE_H="#include <locale.h>"
547 /* The system does not provide the header <locale.h>. Take care yourself. */"
549 AC_SUBST(INCLUDE_LOCALE_H)
551 dnl Determine which catalog format we have (if any is needed)
552 dnl For now we know about two different formats:
553 dnl Linux libc-5 and the normal X/Open format
554 test -d intl || mkdir intl
555 if test "$CATOBJEXT" = ".cat"; then
556 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
558 dnl Transform the SED scripts while copying because some dumb SEDs
559 dnl cannot handle comments.
560 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
562 dnl po2tbl.sed is always needed.
563 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
564 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
566 dnl In the intl/Makefile.in we have a special dependency which makes
567 dnl only sense for gettext. We comment this out for non-gettext
569 if test "$PACKAGE" = "gettext"; then
579 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
580 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
581 dnl Try to locate is.
583 if test -n "$ac_aux_dir"; then
584 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
586 if test -z "$MKINSTALLDIRS"; then
587 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
589 AC_SUBST(MKINSTALLDIRS)
591 dnl *** For now the libtool support in intl/Makefile is not for real.
595 dnl Generate list of files to be processed by xgettext which will
596 dnl be included in po/Makefile.
597 test -d po || mkdir po
598 if test "x$srcdir" != "x."; then
599 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
600 posrcprefix="$srcdir/"
602 posrcprefix="../$srcdir/"
608 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
609 < $srcdir/po/POTFILES.in > po/POTFILES
612 # Check whether LC_MESSAGES is available in <locale.h>.
613 # Ulrich Drepper <drepper@cygnus.com>, 1995.
615 # This file can be copied and used freely without restrictions. It can
616 # be used in projects which are not available under the GNU Public License
617 # but which still want to provide support for the GNU gettext functionality.
618 # Please note that the actual code is *not* freely available.
622 AC_DEFUN(AM_LC_MESSAGES,
623 [if test $ac_cv_header_locale_h = yes; then
624 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
625 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
626 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
627 if test $am_cv_val_LC_MESSAGES = yes; then
628 AC_DEFINE(HAVE_LC_MESSAGES)
632 # Search path for a program which passes the given test.
633 # Ulrich Drepper <drepper@cygnus.com>, 1996.
635 # This file can be copied and used freely without restrictions. It can
636 # be used in projects which are not available under the GNU Public License
637 # but which still want to provide support for the GNU gettext functionality.
638 # Please note that the actual code is *not* freely available.
642 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
643 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
644 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
645 [# Extract the first word of "$2", so it can be a program name with args.
646 set dummy $2; ac_word=[$]2
647 AC_MSG_CHECKING([for $ac_word])
648 AC_CACHE_VAL(ac_cv_path_$1,
651 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
654 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
655 for ac_dir in ifelse([$5], , $PATH, [$5]); do
656 test -z "$ac_dir" && ac_dir=.
657 if test -f $ac_dir/$ac_word; then
659 ac_cv_path_$1="$ac_dir/$ac_word"
665 dnl If no 4th arg is given, leave the cache variable unset,
666 dnl so AC_PATH_PROGS will keep looking.
667 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
672 if test -n "[$]$1"; then