aclocal.m4 revision 52284
152284Sobriendnl See whether we can include both string.h and strings.h.
252284SobrienAC_DEFUN(GCC_HEADER_STRING,
352284Sobrien[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
452284Sobrien  gcc_cv_header_string,
552284Sobrien[AC_TRY_COMPILE([#include <string.h>
652284Sobrien#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
752284Sobrienif test $gcc_cv_header_string = yes; then
852284Sobrien  AC_DEFINE(STRING_WITH_STRINGS)
952284Sobrienfi
1052284Sobrien])
1152284Sobrien
1250397Sobriendnl See whether we need a declaration for a function.
1350397Sobriendnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
1450397SobrienAC_DEFUN(GCC_NEED_DECLARATION,
1550397Sobrien[AC_MSG_CHECKING([whether $1 must be declared])
1650397SobrienAC_CACHE_VAL(gcc_cv_decl_needed_$1,
1750397Sobrien[AC_TRY_COMPILE([
1850397Sobrien#include <stdio.h>
1952284Sobrien#ifdef STRING_WITH_STRINGS
2052284Sobrien# include <string.h>
2152284Sobrien# include <strings.h>
2250397Sobrien#else
2352284Sobrien# ifdef HAVE_STRING_H
2452284Sobrien#  include <string.h>
2552284Sobrien# else
2652284Sobrien#  ifdef HAVE_STRINGS_H
2752284Sobrien#   include <strings.h>
2852284Sobrien#  endif
2952284Sobrien# endif
3050397Sobrien#endif
3150397Sobrien#ifdef HAVE_STDLIB_H
3250397Sobrien#include <stdlib.h>
3350397Sobrien#endif
3450397Sobrien#ifdef HAVE_UNISTD_H
3550397Sobrien#include <unistd.h>
3650397Sobrien#endif
3750397Sobrien#ifndef HAVE_RINDEX
3850397Sobrien#define rindex strrchr
3950397Sobrien#endif
4050397Sobrien#ifndef HAVE_INDEX
4150397Sobrien#define index strchr
4250397Sobrien#endif
4350397Sobrien$2],
4450397Sobrien[char *(*pfn) = (char *(*)) $1],
4550397Sobrieneval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
4650397Sobrienif eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
4750397Sobrien  AC_MSG_RESULT(yes)
4850397Sobrien  gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
4950397Sobrien  AC_DEFINE_UNQUOTED($gcc_tr_decl)
5050397Sobrienelse
5150397Sobrien  AC_MSG_RESULT(no)
5250397Sobrienfi
5350397Sobrien])dnl
5450397Sobrien
5550397Sobriendnl Check multiple functions to see whether each needs a declaration.
5650397Sobriendnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
5750397SobrienAC_DEFUN(GCC_NEED_DECLARATIONS,
5850397Sobrien[for ac_func in $1
5950397Sobriendo
6050397SobrienGCC_NEED_DECLARATION($ac_func, $2)
6150397Sobriendone
6250397Sobrien])
6350397Sobrien
6450397Sobriendnl Check if we have vprintf and possibly _doprnt.
6550397Sobriendnl Note autoconf checks for vprintf even though we care about vfprintf.
6650397SobrienAC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
6750397Sobrien[AC_FUNC_VPRINTF
6850397Sobrienvfprintf=
6950397Sobriendoprint=
7050397Sobrienif test $ac_cv_func_vprintf != yes ; then
7150397Sobrien  vfprintf=vfprintf.o
7250397Sobrien  if test $ac_cv_func__doprnt != yes ; then
7350397Sobrien    doprint=doprint.o
7450397Sobrien  fi
7550397Sobrienfi
7650397SobrienAC_SUBST(vfprintf)
7750397SobrienAC_SUBST(doprint)
7850397Sobrien])    
7950397Sobrien
8050397Sobriendnl See if the printf functions in libc support %p in format strings.
8150397SobrienAC_DEFUN(GCC_FUNC_PRINTF_PTR,
8250397Sobrien[AC_CACHE_CHECK(whether the printf functions support %p,
8350397Sobrien  gcc_cv_func_printf_ptr,
8450397Sobrien[AC_TRY_RUN([#include <stdio.h>
8550397Sobrien
8650397Sobrienmain()
8750397Sobrien{
8850397Sobrien  char buf[64];
8950397Sobrien  char *p = buf, *q = NULL;
9050397Sobrien  sprintf(buf, "%p", p);
9150397Sobrien  sscanf(buf, "%p", &q);
9250397Sobrien  exit (p != q);
9350397Sobrien}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
9450397Sobrien	gcc_cv_func_printf_ptr=no)
9550397Sobrienrm -f core core.* *.core])
9650397Sobrienif test $gcc_cv_func_printf_ptr = yes ; then
9750397Sobrien  AC_DEFINE(HAVE_PRINTF_PTR)
9850397Sobrienfi
9950397Sobrien])
10050397Sobrien
10150397Sobriendnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
10250397SobrienAC_DEFUN(GCC_PROG_LN_S,
10350397Sobrien[AC_MSG_CHECKING(whether ln -s works)
10450397SobrienAC_CACHE_VAL(gcc_cv_prog_LN_S,
10550397Sobrien[rm -f conftestdata_t
10650397Sobrienecho >conftestdata_f
10750397Sobrienif ln -s conftestdata_f conftestdata_t 2>/dev/null
10850397Sobrienthen
10950397Sobrien  gcc_cv_prog_LN_S="ln -s"
11050397Sobrienelse
11150397Sobrien  if ln conftestdata_f conftestdata_t 2>/dev/null
11250397Sobrien  then
11350397Sobrien    gcc_cv_prog_LN_S=ln
11450397Sobrien  else
11550397Sobrien    gcc_cv_prog_LN_S=cp
11650397Sobrien  fi
11750397Sobrienfi
11850397Sobrienrm -f conftestdata_f conftestdata_t
11950397Sobrien])dnl
12050397SobrienLN_S="$gcc_cv_prog_LN_S"
12150397Sobrienif test "$gcc_cv_prog_LN_S" = "ln -s"; then
12250397Sobrien  AC_MSG_RESULT(yes)
12350397Sobrienelse
12450397Sobrien  if test "$gcc_cv_prog_LN_S" = "ln"; then
12550397Sobrien    AC_MSG_RESULT([no, using ln])
12650397Sobrien  else
12750397Sobrien    AC_MSG_RESULT([no, and neither does ln, so using cp])
12850397Sobrien  fi
12950397Sobrienfi
13050397SobrienAC_SUBST(LN_S)dnl
13150397Sobrien])
13250397Sobrien
13350397Sobriendnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
13450397SobrienAC_DEFUN(GCC_PROG_LN,
13550397Sobrien[AC_MSG_CHECKING(whether ln works)
13650397SobrienAC_CACHE_VAL(gcc_cv_prog_LN,
13750397Sobrien[rm -f conftestdata_t
13850397Sobrienecho >conftestdata_f
13950397Sobrienif ln conftestdata_f conftestdata_t 2>/dev/null
14050397Sobrienthen
14150397Sobrien  gcc_cv_prog_LN="ln"
14250397Sobrienelse
14350397Sobrien  if ln -s conftestdata_f conftestdata_t 2>/dev/null
14450397Sobrien  then
14550397Sobrien    gcc_cv_prog_LN="ln -s"
14650397Sobrien  else
14750397Sobrien    gcc_cv_prog_LN=cp
14850397Sobrien  fi
14950397Sobrienfi
15050397Sobrienrm -f conftestdata_f conftestdata_t
15150397Sobrien])dnl
15250397SobrienLN="$gcc_cv_prog_LN"
15350397Sobrienif test "$gcc_cv_prog_LN" = "ln"; then
15450397Sobrien  AC_MSG_RESULT(yes)
15550397Sobrienelse
15650397Sobrien  if test "$gcc_cv_prog_LN" = "ln -s"; then
15750397Sobrien    AC_MSG_RESULT([no, using ln -s])
15850397Sobrien  else
15950397Sobrien    AC_MSG_RESULT([no, and neither does ln -s, so using cp])
16050397Sobrien  fi
16150397Sobrienfi
16250397SobrienAC_SUBST(LN)dnl
16350397Sobrien])
16450397Sobrien
16550397Sobriendnl See whether the stage1 host compiler accepts the volatile keyword.
16650397SobrienAC_DEFUN(GCC_C_VOLATILE,
16750397Sobrien[AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
16850397Sobrien[AC_TRY_COMPILE(, [volatile int foo;],
16950397Sobrien        gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
17050397Sobrienif test $gcc_cv_c_volatile = yes ; then
17150397Sobrien  AC_DEFINE(HAVE_VOLATILE)
17250397Sobrienfi
17350397Sobrien])
17450397Sobrien
17552284Sobriendnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
17652284Sobriendnl of the usual 2.
17752284SobrienAC_DEFUN(GCC_FUNC_MKDIR_TAKES_ONE_ARG,
17852284Sobrien[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
17952284Sobrien[AC_TRY_COMPILE([
18052284Sobrien#include <sys/types.h>
18152284Sobrien#ifdef HAVE_SYS_STAT_H
18252284Sobrien# include <sys/stat.h>
18352284Sobrien#endif
18452284Sobrien#ifdef HAVE_UNISTD_H
18552284Sobrien# include <unistd.h>
18652284Sobrien#endif
18752284Sobrien#ifdef HAVE_DIRECT_H
18852284Sobrien# include <direct.h>
18952284Sobrien#endif], [mkdir ("foo", 0);], 
19052284Sobrien        gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
19152284Sobrienif test $gcc_cv_mkdir_takes_one_arg = yes ; then
19252284Sobrien  AC_DEFINE(MKDIR_TAKES_ONE_ARG)
19352284Sobrienfi
19452284Sobrien])
19552284Sobrien
19650397SobrienAC_DEFUN(EGCS_PROG_INSTALL,
19750397Sobrien[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
19850397Sobrien# Find a good install program.  We prefer a C program (faster),
19950397Sobrien# so one script is as good as another.  But avoid the broken or
20050397Sobrien# incompatible versions:
20150397Sobrien# SysV /etc/install, /usr/sbin/install
20250397Sobrien# SunOS /usr/etc/install
20350397Sobrien# IRIX /sbin/install
20450397Sobrien# AIX /bin/install
20550397Sobrien# AFS /usr/afsws/bin/install, which mishandles nonexistent args
20650397Sobrien# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
20750397Sobrien# ./install, which can be erroneously created by make from ./install.sh.
20850397SobrienAC_MSG_CHECKING(for a BSD compatible install)
20950397Sobrienif test -z "$INSTALL"; then
21050397SobrienAC_CACHE_VAL(ac_cv_path_install,
21150397Sobrien[  IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
21250397Sobrien  for ac_dir in $PATH; do
21350397Sobrien    # Account for people who put trailing slashes in PATH elements.
21450397Sobrien    case "$ac_dir/" in
21550397Sobrien    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
21650397Sobrien    *)
21750397Sobrien      # OSF1 and SCO ODT 3.0 have their own names for install.
21850397Sobrien      for ac_prog in ginstall scoinst install; do
21950397Sobrien        if test -f $ac_dir/$ac_prog; then
22050397Sobrien	  if test $ac_prog = install &&
22150397Sobrien            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
22250397Sobrien	    # AIX install.  It has an incompatible calling convention.
22350397Sobrien	    # OSF/1 installbsd also uses dspmsg, but is usable.
22450397Sobrien	    :
22550397Sobrien	  else
22650397Sobrien	    ac_cv_path_install="$ac_dir/$ac_prog -c"
22750397Sobrien	    break 2
22850397Sobrien	  fi
22950397Sobrien	fi
23050397Sobrien      done
23150397Sobrien      ;;
23250397Sobrien    esac
23350397Sobrien  done
23450397Sobrien  IFS="$ac_save_IFS"
23550397Sobrien])dnl
23650397Sobrien  if test "${ac_cv_path_install+set}" = set; then
23750397Sobrien    INSTALL="$ac_cv_path_install"
23850397Sobrien  else
23950397Sobrien    # As a last resort, use the slow shell script.  We don't cache a
24050397Sobrien    # path for INSTALL within a source directory, because that will
24150397Sobrien    # break other packages using the cache if that directory is
24250397Sobrien    # removed, or if the path is relative.
24350397Sobrien    INSTALL="$ac_install_sh"
24450397Sobrien  fi
24550397Sobrienfi
24650397Sobriendnl We do special magic for INSTALL instead of AC_SUBST, to get
24750397Sobriendnl relative paths right.
24850397SobrienAC_MSG_RESULT($INSTALL)
24950397SobrienAC_SUBST(INSTALL)dnl
25050397Sobrien
25150397Sobrien# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
25250397Sobrien# It thinks the first close brace ends the variable substitution.
25350397Sobrientest -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
25450397SobrienAC_SUBST(INSTALL_PROGRAM)dnl
25550397Sobrien
25650397Sobrientest -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
25750397SobrienAC_SUBST(INSTALL_DATA)dnl
25850397Sobrien])
25952284Sobrien
26052284Sobrien#serial 1
26152284Sobriendnl This test replaces the one in autoconf.
26252284Sobriendnl Currently this macro should have the same name as the autoconf macro
26352284Sobriendnl because gettext's gettext.m4 (distributed in the automake package)
26452284Sobriendnl still uses it.  Otherwise, the use in gettext.m4 makes autoheader
26552284Sobriendnl give these diagnostics:
26652284Sobriendnl   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
26752284Sobriendnl   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
26852284Sobrien
26952284Sobrienundefine([AC_ISC_POSIX])
27052284SobrienAC_DEFUN(AC_ISC_POSIX,
27152284Sobrien  [
27252284Sobrien    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
27352284Sobrien    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
27452284Sobrien  ]
27552284Sobrien)
27652284Sobrien
27752284Sobrien# Macro to add for using GNU gettext.
27852284Sobrien# Ulrich Drepper <drepper@cygnus.com>, 1995.
27952284Sobrien#
28052284Sobrien# This file can be copied and used freely without restrictions.  It can
28152284Sobrien# be used in projects which are not available under the GNU Public License
28252284Sobrien# but which still want to provide support for the GNU gettext functionality.
28352284Sobrien# Please note that the actual code is *not* freely available.
28452284Sobrien
28552284Sobrien# serial 5
28652284Sobrien
28752284SobrienAC_DEFUN(AM_WITH_NLS,
28852284Sobrien  [AC_MSG_CHECKING([whether NLS is requested])
28952284Sobrien    dnl Default is enabled NLS
29052284Sobrien    AC_ARG_ENABLE(nls,
29152284Sobrien      [  --disable-nls           do not use Native Language Support],
29252284Sobrien      USE_NLS=$enableval, USE_NLS=yes)
29352284Sobrien    AC_MSG_RESULT($USE_NLS)
29452284Sobrien    AC_SUBST(USE_NLS)
29552284Sobrien
29652284Sobrien    USE_INCLUDED_LIBINTL=no
29752284Sobrien
29852284Sobrien    dnl If we use NLS figure out what method
29952284Sobrien    if test "$USE_NLS" = "yes"; then
30052284Sobrien      AC_DEFINE(ENABLE_NLS)
30152284Sobrien      AC_MSG_CHECKING([whether included gettext is requested])
30252284Sobrien      AC_ARG_WITH(included-gettext,
30352284Sobrien        [  --with-included-gettext use the GNU gettext library included here],
30452284Sobrien        nls_cv_force_use_gnu_gettext=$withval,
30552284Sobrien        nls_cv_force_use_gnu_gettext=no)
30652284Sobrien      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
30752284Sobrien
30852284Sobrien      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
30952284Sobrien      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
31052284Sobrien        dnl User does not insist on using GNU NLS library.  Figure out what
31152284Sobrien        dnl to use.  If gettext or catgets are available (in this order) we
31252284Sobrien        dnl use this.  Else we have to fall back to GNU NLS library.
31352284Sobrien	dnl catgets is only used if permitted by option --with-catgets.
31452284Sobrien	nls_cv_header_intl=
31552284Sobrien	nls_cv_header_libgt=
31652284Sobrien	CATOBJEXT=NONE
31752284Sobrien
31852284Sobrien	AC_CHECK_HEADER(libintl.h,
31952284Sobrien	  [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
32052284Sobrien	    [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
32152284Sobrien	       gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
32252284Sobrien
32352284Sobrien	   if test "$gt_cv_func_gettext_libc" != "yes"; then
32452284Sobrien	     AC_CHECK_LIB(intl, bindtextdomain,
32552284Sobrien	       [AC_CACHE_CHECK([for gettext in libintl],
32652284Sobrien		 gt_cv_func_gettext_libintl,
32752284Sobrien		 [AC_CHECK_LIB(intl, gettext,
32852284Sobrien		  gt_cv_func_gettext_libintl=yes,
32952284Sobrien		  gt_cv_func_gettext_libintl=no)],
33052284Sobrien		 gt_cv_func_gettext_libintl=no)])
33152284Sobrien	   fi
33252284Sobrien
33352284Sobrien	   if test "$gt_cv_func_gettext_libc" = "yes" \
33452284Sobrien	      || test "$gt_cv_func_gettext_libintl" = "yes"; then
33552284Sobrien	      AC_DEFINE(HAVE_GETTEXT)
33652284Sobrien	      AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
33752284Sobrien		[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
33852284Sobrien	      if test "$MSGFMT" != "no"; then
33952284Sobrien		AC_CHECK_FUNCS(dcgettext)
34052284Sobrien		AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
34152284Sobrien		AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
34252284Sobrien		  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
34352284Sobrien		AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
34452284Sobrien			       return _nl_msg_cat_cntr],
34552284Sobrien		  [CATOBJEXT=.gmo
34652284Sobrien		   DATADIRNAME=share],
34752284Sobrien		  [CATOBJEXT=.mo
34852284Sobrien		   DATADIRNAME=lib])
34952284Sobrien		INSTOBJEXT=.mo
35052284Sobrien	      fi
35152284Sobrien	    fi
35252284Sobrien	])
35352284Sobrien
35452284Sobrien        if test "$CATOBJEXT" = "NONE"; then
35552284Sobrien	  AC_MSG_CHECKING([whether catgets can be used])
35652284Sobrien	  AC_ARG_WITH(catgets,
35752284Sobrien	    [  --with-catgets          use catgets functions if available],
35852284Sobrien	    nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
35952284Sobrien	  AC_MSG_RESULT($nls_cv_use_catgets)
36052284Sobrien
36152284Sobrien	  if test "$nls_cv_use_catgets" = "yes"; then
36252284Sobrien	    dnl No gettext in C library.  Try catgets next.
36352284Sobrien	    AC_CHECK_LIB(i, main)
36452284Sobrien	    AC_CHECK_FUNC(catgets,
36552284Sobrien	      [AC_DEFINE(HAVE_CATGETS)
36652284Sobrien	       INTLOBJS="\$(CATOBJS)"
36752284Sobrien	       AC_PATH_PROG(GENCAT, gencat, no)dnl
36852284Sobrien	       if test "$GENCAT" != "no"; then
36952284Sobrien		 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
37052284Sobrien		 if test "$GMSGFMT" = "no"; then
37152284Sobrien		   AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
37252284Sobrien		    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
37352284Sobrien		 fi
37452284Sobrien		 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
37552284Sobrien		   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
37652284Sobrien		 USE_INCLUDED_LIBINTL=yes
37752284Sobrien		 CATOBJEXT=.cat
37852284Sobrien		 INSTOBJEXT=.cat
37952284Sobrien		 DATADIRNAME=lib
38052284Sobrien		 INTLDEPS='$(top_builddir)/intl/libintl.a'
38152284Sobrien		 INTLLIBS=$INTLDEPS
38252284Sobrien		 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
38352284Sobrien		 nls_cv_header_intl=intl/libintl.h
38452284Sobrien		 nls_cv_header_libgt=intl/libgettext.h
38552284Sobrien	       fi])
38652284Sobrien	  fi
38752284Sobrien        fi
38852284Sobrien
38952284Sobrien        if test "$CATOBJEXT" = "NONE"; then
39052284Sobrien	  dnl Neither gettext nor catgets in included in the C library.
39152284Sobrien	  dnl Fall back on GNU gettext library.
39252284Sobrien	  nls_cv_use_gnu_gettext=yes
39352284Sobrien        fi
39452284Sobrien      fi
39552284Sobrien
39652284Sobrien      if test "$nls_cv_use_gnu_gettext" = "yes"; then
39752284Sobrien        dnl Mark actions used to generate GNU NLS library.
39852284Sobrien        INTLOBJS="\$(GETTOBJS)"
39952284Sobrien        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
40052284Sobrien	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
40152284Sobrien        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
40252284Sobrien        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
40352284Sobrien	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
40452284Sobrien        AC_SUBST(MSGFMT)
40552284Sobrien	USE_INCLUDED_LIBINTL=yes
40652284Sobrien        CATOBJEXT=.gmo
40752284Sobrien        INSTOBJEXT=.mo
40852284Sobrien        DATADIRNAME=share
40952284Sobrien	INTLDEPS='$(top_builddir)/intl/libintl.a'
41052284Sobrien	INTLLIBS=$INTLDEPS
41152284Sobrien	LIBS=`echo $LIBS | sed -e 's/-lintl//'`
41252284Sobrien        nls_cv_header_intl=intl/libintl.h
41352284Sobrien        nls_cv_header_libgt=intl/libgettext.h
41452284Sobrien      fi
41552284Sobrien
41652284Sobrien      dnl Test whether we really found GNU xgettext.
41752284Sobrien      if test "$XGETTEXT" != ":"; then
41852284Sobrien	dnl If it is no GNU xgettext we define it as : so that the
41952284Sobrien	dnl Makefiles still can work.
42052284Sobrien	if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
42152284Sobrien	  : ;
42252284Sobrien	else
42352284Sobrien	  AC_MSG_RESULT(
42452284Sobrien	    [found xgettext program is not GNU xgettext; ignore it])
42552284Sobrien	  XGETTEXT=":"
42652284Sobrien	fi
42752284Sobrien      fi
42852284Sobrien
42952284Sobrien      # We need to process the po/ directory.
43052284Sobrien      POSUB=po
43152284Sobrien    else
43252284Sobrien      DATADIRNAME=share
43352284Sobrien      nls_cv_header_intl=intl/libintl.h
43452284Sobrien      nls_cv_header_libgt=intl/libgettext.h
43552284Sobrien    fi
43652284Sobrien    AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
43752284Sobrien    AC_OUTPUT_COMMANDS(
43852284Sobrien     [case "$CONFIG_FILES" in *po/Makefile.in*)
43952284Sobrien        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
44052284Sobrien      esac])
44152284Sobrien
44252284Sobrien
44352284Sobrien    # If this is used in GNU gettext we have to set USE_NLS to `yes'
44452284Sobrien    # because some of the sources are only built for this goal.
44552284Sobrien    if test "$PACKAGE" = gettext; then
44652284Sobrien      USE_NLS=yes
44752284Sobrien      USE_INCLUDED_LIBINTL=yes
44852284Sobrien    fi
44952284Sobrien
45052284Sobrien    dnl These rules are solely for the distribution goal.  While doing this
45152284Sobrien    dnl we only have to keep exactly one list of the available catalogs
45252284Sobrien    dnl in configure.in.
45352284Sobrien    for lang in $ALL_LINGUAS; do
45452284Sobrien      GMOFILES="$GMOFILES $lang.gmo"
45552284Sobrien      POFILES="$POFILES $lang.po"
45652284Sobrien    done
45752284Sobrien
45852284Sobrien    dnl Make all variables we use known to autoconf.
45952284Sobrien    AC_SUBST(USE_INCLUDED_LIBINTL)
46052284Sobrien    AC_SUBST(CATALOGS)
46152284Sobrien    AC_SUBST(CATOBJEXT)
46252284Sobrien    AC_SUBST(DATADIRNAME)
46352284Sobrien    AC_SUBST(GMOFILES)
46452284Sobrien    AC_SUBST(INSTOBJEXT)
46552284Sobrien    AC_SUBST(INTLDEPS)
46652284Sobrien    AC_SUBST(INTLLIBS)
46752284Sobrien    AC_SUBST(INTLOBJS)
46852284Sobrien    AC_SUBST(POFILES)
46952284Sobrien    AC_SUBST(POSUB)
47052284Sobrien  ])
47152284Sobrien
47252284SobrienAC_DEFUN(AM_GNU_GETTEXT,
47352284Sobrien  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
47452284Sobrien   AC_REQUIRE([AC_PROG_CC])dnl
47552284Sobrien   AC_REQUIRE([AC_PROG_RANLIB])dnl
47652284Sobrien   AC_REQUIRE([AC_ISC_POSIX])dnl
47752284Sobrien   AC_REQUIRE([AC_HEADER_STDC])dnl
47852284Sobrien   AC_REQUIRE([AC_C_CONST])dnl
47952284Sobrien   AC_REQUIRE([AC_C_INLINE])dnl
48052284Sobrien   AC_REQUIRE([AC_TYPE_OFF_T])dnl
48152284Sobrien   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
48252284Sobrien   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
48352284Sobrien   AC_REQUIRE([AC_FUNC_MMAP])dnl
48452284Sobrien
48552284Sobrien   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
48652284Sobrienunistd.h sys/param.h])
48752284Sobrien   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
48852284Sobrienstrdup __argz_count __argz_stringify __argz_next])
48952284Sobrien
49052284Sobrien   if test "${ac_cv_func_stpcpy+set}" != "set"; then
49152284Sobrien     AC_CHECK_FUNCS(stpcpy)
49252284Sobrien   fi
49352284Sobrien   if test "${ac_cv_func_stpcpy}" = "yes"; then
49452284Sobrien     AC_DEFINE(HAVE_STPCPY)
49552284Sobrien   fi
49652284Sobrien
49752284Sobrien   AM_LC_MESSAGES
49852284Sobrien   AM_WITH_NLS
49952284Sobrien
50052284Sobrien   if test "x$CATOBJEXT" != "x"; then
50152284Sobrien     if test "x$ALL_LINGUAS" = "x"; then
50252284Sobrien       LINGUAS=
50352284Sobrien     else
50452284Sobrien       AC_MSG_CHECKING(for catalogs to be installed)
50552284Sobrien       NEW_LINGUAS=
50652284Sobrien       for lang in ${LINGUAS=$ALL_LINGUAS}; do
50752284Sobrien         case "$ALL_LINGUAS" in
50852284Sobrien          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
50952284Sobrien         esac
51052284Sobrien       done
51152284Sobrien       LINGUAS=$NEW_LINGUAS
51252284Sobrien       AC_MSG_RESULT($LINGUAS)
51352284Sobrien     fi
51452284Sobrien
51552284Sobrien     dnl Construct list of names of catalog files to be constructed.
51652284Sobrien     if test -n "$LINGUAS"; then
51752284Sobrien       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
51852284Sobrien     fi
51952284Sobrien   fi
52052284Sobrien
52152284Sobrien   dnl The reference to <locale.h> in the installed <libintl.h> file
52252284Sobrien   dnl must be resolved because we cannot expect the users of this
52352284Sobrien   dnl to define HAVE_LOCALE_H.
52452284Sobrien   if test $ac_cv_header_locale_h = yes; then
52552284Sobrien     INCLUDE_LOCALE_H="#include <locale.h>"
52652284Sobrien   else
52752284Sobrien     INCLUDE_LOCALE_H="\
52852284Sobrien/* The system does not provide the header <locale.h>.  Take care yourself.  */"
52952284Sobrien   fi
53052284Sobrien   AC_SUBST(INCLUDE_LOCALE_H)
53152284Sobrien
53252284Sobrien   dnl Determine which catalog format we have (if any is needed)
53352284Sobrien   dnl For now we know about two different formats:
53452284Sobrien   dnl   Linux libc-5 and the normal X/Open format
53552284Sobrien   test -d intl || mkdir intl
53652284Sobrien   if test "$CATOBJEXT" = ".cat"; then
53752284Sobrien     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
53852284Sobrien
53952284Sobrien     dnl Transform the SED scripts while copying because some dumb SEDs
54052284Sobrien     dnl cannot handle comments.
54152284Sobrien     sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
54252284Sobrien   fi
54352284Sobrien   dnl po2tbl.sed is always needed.
54452284Sobrien   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
54552284Sobrien     $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
54652284Sobrien
54752284Sobrien   dnl In the intl/Makefile.in we have a special dependency which makes
54852284Sobrien   dnl only sense for gettext.  We comment this out for non-gettext
54952284Sobrien   dnl packages.
55052284Sobrien   if test "$PACKAGE" = "gettext"; then
55152284Sobrien     GT_NO="#NO#"
55252284Sobrien     GT_YES=
55352284Sobrien   else
55452284Sobrien     GT_NO=
55552284Sobrien     GT_YES="#YES#"
55652284Sobrien   fi
55752284Sobrien   AC_SUBST(GT_NO)
55852284Sobrien   AC_SUBST(GT_YES)
55952284Sobrien
56052284Sobrien   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
56152284Sobrien   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
56252284Sobrien   dnl Try to locate is.
56352284Sobrien   MKINSTALLDIRS=
56452284Sobrien   if test -n "$ac_aux_dir"; then
56552284Sobrien     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
56652284Sobrien   fi
56752284Sobrien   if test -z "$MKINSTALLDIRS"; then
56852284Sobrien     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
56952284Sobrien   fi
57052284Sobrien   AC_SUBST(MKINSTALLDIRS)
57152284Sobrien
57252284Sobrien   dnl *** For now the libtool support in intl/Makefile is not for real.
57352284Sobrien   l=
57452284Sobrien   AC_SUBST(l)
57552284Sobrien
57652284Sobrien   dnl Generate list of files to be processed by xgettext which will
57752284Sobrien   dnl be included in po/Makefile.
57852284Sobrien   test -d po || mkdir po
57952284Sobrien   if test "x$srcdir" != "x."; then
58052284Sobrien     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
58152284Sobrien       posrcprefix="$srcdir/"
58252284Sobrien     else
58352284Sobrien       posrcprefix="../$srcdir/"
58452284Sobrien     fi
58552284Sobrien   else
58652284Sobrien     posrcprefix="../"
58752284Sobrien   fi
58852284Sobrien   rm -f po/POTFILES
58952284Sobrien   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,	$posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
59052284Sobrien	< $srcdir/po/POTFILES.in > po/POTFILES
59152284Sobrien  ])
59252284Sobrien
59352284Sobrien# Check whether LC_MESSAGES is available in <locale.h>.
59452284Sobrien# Ulrich Drepper <drepper@cygnus.com>, 1995.
59552284Sobrien#
59652284Sobrien# This file can be copied and used freely without restrictions.  It can
59752284Sobrien# be used in projects which are not available under the GNU Public License
59852284Sobrien# but which still want to provide support for the GNU gettext functionality.
59952284Sobrien# Please note that the actual code is *not* freely available.
60052284Sobrien
60152284Sobrien# serial 1
60252284Sobrien
60352284SobrienAC_DEFUN(AM_LC_MESSAGES,
60452284Sobrien  [if test $ac_cv_header_locale_h = yes; then
60552284Sobrien    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
60652284Sobrien      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
60752284Sobrien       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
60852284Sobrien    if test $am_cv_val_LC_MESSAGES = yes; then
60952284Sobrien      AC_DEFINE(HAVE_LC_MESSAGES)
61052284Sobrien    fi
61152284Sobrien  fi])
61252284Sobrien
61352284Sobrien# Search path for a program which passes the given test.
61452284Sobrien# Ulrich Drepper <drepper@cygnus.com>, 1996.
61552284Sobrien#
61652284Sobrien# This file can be copied and used freely without restrictions.  It can
61752284Sobrien# be used in projects which are not available under the GNU Public License
61852284Sobrien# but which still want to provide support for the GNU gettext functionality.
61952284Sobrien# Please note that the actual code is *not* freely available.
62052284Sobrien
62152284Sobrien# serial 1
62252284Sobrien
62352284Sobriendnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
62452284Sobriendnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
62552284SobrienAC_DEFUN(AM_PATH_PROG_WITH_TEST,
62652284Sobrien[# Extract the first word of "$2", so it can be a program name with args.
62752284Sobrienset dummy $2; ac_word=[$]2
62852284SobrienAC_MSG_CHECKING([for $ac_word])
62952284SobrienAC_CACHE_VAL(ac_cv_path_$1,
63052284Sobrien[case "[$]$1" in
63152284Sobrien  /*)
63252284Sobrien  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
63352284Sobrien  ;;
63452284Sobrien  *)
63552284Sobrien  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
63652284Sobrien  for ac_dir in ifelse([$5], , $PATH, [$5]); do
63752284Sobrien    test -z "$ac_dir" && ac_dir=.
63852284Sobrien    if test -f $ac_dir/$ac_word; then
63952284Sobrien      if [$3]; then
64052284Sobrien	ac_cv_path_$1="$ac_dir/$ac_word"
64152284Sobrien	break
64252284Sobrien      fi
64352284Sobrien    fi
64452284Sobrien  done
64552284Sobrien  IFS="$ac_save_ifs"
64652284Sobriendnl If no 4th arg is given, leave the cache variable unset,
64752284Sobriendnl so AC_PATH_PROGS will keep looking.
64852284Sobrienifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
64952284Sobrien])dnl
65052284Sobrien  ;;
65152284Sobrienesac])dnl
65252284Sobrien$1="$ac_cv_path_$1"
65352284Sobrienif test -n "[$]$1"; then
65452284Sobrien  AC_MSG_RESULT([$]$1)
65552284Sobrienelse
65652284Sobrien  AC_MSG_RESULT(no)
65752284Sobrienfi
65852284SobrienAC_SUBST($1)dnl
65952284Sobrien])
660