1*75f6d617Schristos# gettext.m4 serial 13 (gettext-0.11.1) 2*75f6d617Schristosdnl Copyright (C) 1995-2002 Free Software Foundation, Inc. 3*75f6d617Schristosdnl This file is free software, distributed under the terms of the GNU 4*75f6d617Schristosdnl General Public License. As a special exception to the GNU General 5*75f6d617Schristosdnl Public License, this file may be distributed as part of a program 6*75f6d617Schristosdnl that contains a configuration script generated by Autoconf, under 7*75f6d617Schristosdnl the same distribution terms as the rest of that program. 8*75f6d617Schristosdnl 9*75f6d617Schristosdnl This file can can be used in projects which are not available under 10*75f6d617Schristosdnl the GNU General Public License or the GNU Library General Public 11*75f6d617Schristosdnl License but which still want to provide support for the GNU gettext 12*75f6d617Schristosdnl functionality. 13*75f6d617Schristosdnl Please note that the actual code of the GNU gettext library is covered 14*75f6d617Schristosdnl by the GNU Library General Public License, and the rest of the GNU 15*75f6d617Schristosdnl gettext package package is covered by the GNU General Public License. 16*75f6d617Schristosdnl They are *not* in the public domain. 17*75f6d617Schristos 18*75f6d617Schristosdnl Authors: 19*75f6d617Schristosdnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. 20*75f6d617Schristosdnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. 21*75f6d617Schristos 22*75f6d617Schristosdnl Macro to add for using GNU gettext. 23*75f6d617Schristos 24*75f6d617Schristosdnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). 25*75f6d617Schristosdnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The 26*75f6d617Schristosdnl default (if it is not specified or empty) is 'no-libtool'. 27*75f6d617Schristosdnl INTLSYMBOL should be 'external' for packages with no intl directory, 28*75f6d617Schristosdnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. 29*75f6d617Schristosdnl If INTLSYMBOL is 'use-libtool', then a libtool library 30*75f6d617Schristosdnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, 31*75f6d617Schristosdnl depending on --{enable,disable}-{shared,static} and on the presence of 32*75f6d617Schristosdnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library 33*75f6d617Schristosdnl $(top_builddir)/intl/libintl.a will be created. 34*75f6d617Schristosdnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext 35*75f6d617Schristosdnl implementations (in libc or libintl) without the ngettext() function 36*75f6d617Schristosdnl will be ignored. 37*75f6d617Schristosdnl INTLDIR is used to find the intl libraries. If empty, 38*75f6d617Schristosdnl the value `$(top_builddir)/intl/' is used. 39*75f6d617Schristosdnl 40*75f6d617Schristosdnl The result of the configuration is one of three cases: 41*75f6d617Schristosdnl 1) GNU gettext, as included in the intl subdirectory, will be compiled 42*75f6d617Schristosdnl and used. 43*75f6d617Schristosdnl Catalog format: GNU --> install in $(datadir) 44*75f6d617Schristosdnl Catalog extension: .mo after installation, .gmo in source tree 45*75f6d617Schristosdnl 2) GNU gettext has been found in the system's C library. 46*75f6d617Schristosdnl Catalog format: GNU --> install in $(datadir) 47*75f6d617Schristosdnl Catalog extension: .mo after installation, .gmo in source tree 48*75f6d617Schristosdnl 3) No internationalization, always use English msgid. 49*75f6d617Schristosdnl Catalog format: none 50*75f6d617Schristosdnl Catalog extension: none 51*75f6d617Schristosdnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. 52*75f6d617Schristosdnl The use of .gmo is historical (it was needed to avoid overwriting the 53*75f6d617Schristosdnl GNU format catalogs when building on a platform with an X/Open gettext), 54*75f6d617Schristosdnl but we keep it in order not to force irrelevant filename changes on the 55*75f6d617Schristosdnl maintainers. 56*75f6d617Schristosdnl 57*75f6d617SchristosAC_DEFUN([AM_GNU_GETTEXT], 58*75f6d617Schristos[ 59*75f6d617Schristos dnl Argument checking. 60*75f6d617Schristos ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , 61*75f6d617Schristos [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT 62*75f6d617Schristos])])])])]) 63*75f6d617Schristos ifelse([$2], [], , [ifelse([$2], [need-ngettext], , 64*75f6d617Schristos [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT 65*75f6d617Schristos])])]) 66*75f6d617Schristos define(gt_included_intl, ifelse([$1], [external], [no], [yes])) 67*75f6d617Schristos define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) 68*75f6d617Schristos 69*75f6d617Schristos AC_REQUIRE([AM_PO_SUBDIRS])dnl 70*75f6d617Schristos ifelse(gt_included_intl, yes, [ 71*75f6d617Schristos AC_REQUIRE([AM_INTL_SUBDIR])dnl 72*75f6d617Schristos ]) 73*75f6d617Schristos 74*75f6d617Schristos dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. 75*75f6d617Schristos AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) 76*75f6d617Schristos AC_REQUIRE([AC_LIB_RPATH]) 77*75f6d617Schristos 78*75f6d617Schristos AC_MSG_CHECKING([whether NLS is requested]) 79*75f6d617Schristos dnl Default is enabled NLS 80*75f6d617Schristos AC_ARG_ENABLE(nls, 81*75f6d617Schristos [ --disable-nls do not use Native Language Support], 82*75f6d617Schristos USE_NLS=$enableval, USE_NLS=yes) 83*75f6d617Schristos AC_MSG_RESULT($USE_NLS) 84*75f6d617Schristos AC_SUBST(USE_NLS) 85*75f6d617Schristos 86*75f6d617Schristos ifelse(gt_included_intl, yes, [ 87*75f6d617Schristos BUILD_INCLUDED_LIBINTL=no 88*75f6d617Schristos USE_INCLUDED_LIBINTL=no 89*75f6d617Schristos ]) 90*75f6d617Schristos LIBINTL= 91*75f6d617Schristos LTLIBINTL= 92*75f6d617Schristos POSUB= 93*75f6d617Schristos 94*75f6d617Schristos dnl If we use NLS figure out what method 95*75f6d617Schristos if test "$USE_NLS" = "yes"; then 96*75f6d617Schristos gt_use_preinstalled_gnugettext=no 97*75f6d617Schristos ifelse(gt_included_intl, yes, [ 98*75f6d617Schristos AC_MSG_CHECKING([whether included gettext is requested]) 99*75f6d617Schristos AC_ARG_WITH(included-gettext, 100*75f6d617Schristos [ --with-included-gettext use the GNU gettext library included here], 101*75f6d617Schristos nls_cv_force_use_gnu_gettext=$withval, 102*75f6d617Schristos nls_cv_force_use_gnu_gettext=no) 103*75f6d617Schristos AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) 104*75f6d617Schristos 105*75f6d617Schristos nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" 106*75f6d617Schristos if test "$nls_cv_force_use_gnu_gettext" != "yes"; then 107*75f6d617Schristos ]) 108*75f6d617Schristos dnl User does not insist on using GNU NLS library. Figure out what 109*75f6d617Schristos dnl to use. If GNU gettext is available we use this. Else we have 110*75f6d617Schristos dnl to fall back to GNU NLS library. 111*75f6d617Schristos 112*75f6d617Schristos dnl Add a version number to the cache macros. 113*75f6d617Schristos define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1)) 114*75f6d617Schristos define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) 115*75f6d617Schristos define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) 116*75f6d617Schristos 117*75f6d617Schristos AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, 118*75f6d617Schristos [AC_TRY_LINK([#include <libintl.h> 119*75f6d617Schristosextern int _nl_msg_cat_cntr; 120*75f6d617Schristosextern int *_nl_domain_bindings;], 121*75f6d617Schristos [bindtextdomain ("", ""); 122*75f6d617Schristosreturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], 123*75f6d617Schristos gt_cv_func_gnugettext_libc=yes, 124*75f6d617Schristos gt_cv_func_gnugettext_libc=no)]) 125*75f6d617Schristos 126*75f6d617Schristos if test "$gt_cv_func_gnugettext_libc" != "yes"; then 127*75f6d617Schristos dnl Sometimes libintl requires libiconv, so first search for libiconv. 128*75f6d617Schristos ifelse(gt_included_intl, yes, , [ 129*75f6d617Schristos AM_ICONV_LINK 130*75f6d617Schristos ]) 131*75f6d617Schristos dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL 132*75f6d617Schristos dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) 133*75f6d617Schristos dnl because that would add "-liconv" to LIBINTL and LTLIBINTL 134*75f6d617Schristos dnl even if libiconv doesn't exist. 135*75f6d617Schristos AC_LIB_LINKFLAGS_BODY([intl]) 136*75f6d617Schristos AC_CACHE_CHECK([for GNU gettext in libintl], 137*75f6d617Schristos gt_cv_func_gnugettext_libintl, 138*75f6d617Schristos [gt_save_CPPFLAGS="$CPPFLAGS" 139*75f6d617Schristos CPPFLAGS="$CPPFLAGS $INCINTL" 140*75f6d617Schristos gt_save_LIBS="$LIBS" 141*75f6d617Schristos LIBS="$LIBS $LIBINTL" 142*75f6d617Schristos dnl Now see whether libintl exists and does not depend on libiconv. 143*75f6d617Schristos AC_TRY_LINK([#include <libintl.h> 144*75f6d617Schristosextern int _nl_msg_cat_cntr; 145*75f6d617Schristosextern int *_nl_domain_bindings; 146*75f6d617Schristosextern 147*75f6d617Schristos#ifdef __cplusplus 148*75f6d617Schristos"C" 149*75f6d617Schristos#endif 150*75f6d617Schristosconst char *_nl_expand_alias ();], 151*75f6d617Schristos [bindtextdomain ("", ""); 152*75f6d617Schristosreturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)], 153*75f6d617Schristos gt_cv_func_gnugettext_libintl=yes, 154*75f6d617Schristos gt_cv_func_gnugettext_libintl=no) 155*75f6d617Schristos dnl Now see whether libintl exists and depends on libiconv. 156*75f6d617Schristos if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then 157*75f6d617Schristos LIBS="$LIBS $LIBICONV" 158*75f6d617Schristos AC_TRY_LINK([#include <libintl.h> 159*75f6d617Schristosextern int _nl_msg_cat_cntr; 160*75f6d617Schristosextern int *_nl_domain_bindings; 161*75f6d617Schristosextern 162*75f6d617Schristos#ifdef __cplusplus 163*75f6d617Schristos"C" 164*75f6d617Schristos#endif 165*75f6d617Schristosconst char *_nl_expand_alias ();], 166*75f6d617Schristos [bindtextdomain ("", ""); 167*75f6d617Schristosreturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)], 168*75f6d617Schristos [LIBINTL="$LIBINTL $LIBICONV" 169*75f6d617Schristos LTLIBINTL="$LTLIBINTL $LTLIBICONV" 170*75f6d617Schristos gt_cv_func_gnugettext_libintl=yes 171*75f6d617Schristos ]) 172*75f6d617Schristos fi 173*75f6d617Schristos CPPFLAGS="$gt_save_CPPFLAGS" 174*75f6d617Schristos LIBS="$gt_save_LIBS"]) 175*75f6d617Schristos fi 176*75f6d617Schristos 177*75f6d617Schristos dnl If an already present or preinstalled GNU gettext() is found, 178*75f6d617Schristos dnl use it. But if this macro is used in GNU gettext, and GNU 179*75f6d617Schristos dnl gettext is already preinstalled in libintl, we update this 180*75f6d617Schristos dnl libintl. (Cf. the install rule in intl/Makefile.in.) 181*75f6d617Schristos if test "$gt_cv_func_gnugettext_libc" = "yes" \ 182*75f6d617Schristos || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ 183*75f6d617Schristos && test "$PACKAGE" != gettext; }; then 184*75f6d617Schristos gt_use_preinstalled_gnugettext=yes 185*75f6d617Schristos else 186*75f6d617Schristos dnl Reset the values set by searching for libintl. 187*75f6d617Schristos LIBINTL= 188*75f6d617Schristos LTLIBINTL= 189*75f6d617Schristos INCINTL= 190*75f6d617Schristos fi 191*75f6d617Schristos 192*75f6d617Schristos ifelse(gt_included_intl, yes, [ 193*75f6d617Schristos if test "$gt_use_preinstalled_gnugettext" != "yes"; then 194*75f6d617Schristos dnl GNU gettext is not found in the C library. 195*75f6d617Schristos dnl Fall back on included GNU gettext library. 196*75f6d617Schristos nls_cv_use_gnu_gettext=yes 197*75f6d617Schristos fi 198*75f6d617Schristos fi 199*75f6d617Schristos 200*75f6d617Schristos if test "$nls_cv_use_gnu_gettext" = "yes"; then 201*75f6d617Schristos dnl Mark actions used to generate GNU NLS library. 202*75f6d617Schristos INTLOBJS="\$(GETTOBJS)" 203*75f6d617Schristos BUILD_INCLUDED_LIBINTL=yes 204*75f6d617Schristos USE_INCLUDED_LIBINTL=yes 205*75f6d617Schristos LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" 206*75f6d617Schristos LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" 207*75f6d617Schristos LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` 208*75f6d617Schristos fi 209*75f6d617Schristos 210*75f6d617Schristos if test "$gt_use_preinstalled_gnugettext" = "yes" \ 211*75f6d617Schristos || test "$nls_cv_use_gnu_gettext" = "yes"; then 212*75f6d617Schristos dnl Mark actions to use GNU gettext tools. 213*75f6d617Schristos CATOBJEXT=.gmo 214*75f6d617Schristos fi 215*75f6d617Schristos ]) 216*75f6d617Schristos 217*75f6d617Schristos if test "$gt_use_preinstalled_gnugettext" = "yes" \ 218*75f6d617Schristos || test "$nls_cv_use_gnu_gettext" = "yes"; then 219*75f6d617Schristos AC_DEFINE(ENABLE_NLS, 1, 220*75f6d617Schristos [Define to 1 if translation of program messages to the user's native language 221*75f6d617Schristos is requested.]) 222*75f6d617Schristos else 223*75f6d617Schristos USE_NLS=no 224*75f6d617Schristos fi 225*75f6d617Schristos fi 226*75f6d617Schristos 227*75f6d617Schristos if test "$USE_NLS" = "yes"; then 228*75f6d617Schristos 229*75f6d617Schristos if test "$gt_use_preinstalled_gnugettext" = "yes"; then 230*75f6d617Schristos if test "$gt_cv_func_gnugettext_libintl" = "yes"; then 231*75f6d617Schristos AC_MSG_CHECKING([how to link with libintl]) 232*75f6d617Schristos AC_MSG_RESULT([$LIBINTL]) 233*75f6d617Schristos AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) 234*75f6d617Schristos fi 235*75f6d617Schristos 236*75f6d617Schristos dnl For backward compatibility. Some packages may be using this. 237*75f6d617Schristos AC_DEFINE(HAVE_GETTEXT, 1, 238*75f6d617Schristos [Define if the GNU gettext() function is already present or preinstalled.]) 239*75f6d617Schristos AC_DEFINE(HAVE_DCGETTEXT, 1, 240*75f6d617Schristos [Define if the GNU dcgettext() function is already present or preinstalled.]) 241*75f6d617Schristos fi 242*75f6d617Schristos 243*75f6d617Schristos dnl We need to process the po/ directory. 244*75f6d617Schristos POSUB=po 245*75f6d617Schristos fi 246*75f6d617Schristos 247*75f6d617Schristos ifelse(gt_included_intl, yes, [ 248*75f6d617Schristos dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL 249*75f6d617Schristos dnl to 'yes' because some of the testsuite requires it. 250*75f6d617Schristos if test "$PACKAGE" = gettext; then 251*75f6d617Schristos BUILD_INCLUDED_LIBINTL=yes 252*75f6d617Schristos fi 253*75f6d617Schristos 254*75f6d617Schristos dnl Make all variables we use known to autoconf. 255*75f6d617Schristos AC_SUBST(BUILD_INCLUDED_LIBINTL) 256*75f6d617Schristos AC_SUBST(USE_INCLUDED_LIBINTL) 257*75f6d617Schristos AC_SUBST(CATOBJEXT) 258*75f6d617Schristos AC_SUBST(INTLOBJS) 259*75f6d617Schristos 260*75f6d617Schristos dnl For backward compatibility. Some configure.ins may be using this. 261*75f6d617Schristos nls_cv_header_intl= 262*75f6d617Schristos nls_cv_header_libgt= 263*75f6d617Schristos 264*75f6d617Schristos dnl For backward compatibility. Some Makefiles may be using this. 265*75f6d617Schristos DATADIRNAME=share 266*75f6d617Schristos AC_SUBST(DATADIRNAME) 267*75f6d617Schristos 268*75f6d617Schristos dnl For backward compatibility. Some Makefiles may be using this. 269*75f6d617Schristos INSTOBJEXT=.mo 270*75f6d617Schristos AC_SUBST(INSTOBJEXT) 271*75f6d617Schristos 272*75f6d617Schristos dnl For backward compatibility. Some Makefiles may be using this. 273*75f6d617Schristos GENCAT=gencat 274*75f6d617Schristos AC_SUBST(GENCAT) 275*75f6d617Schristos 276*75f6d617Schristos dnl Enable libtool support if the surrounding package wishes it. 277*75f6d617Schristos INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix 278*75f6d617Schristos AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) 279*75f6d617Schristos ]) 280*75f6d617Schristos 281*75f6d617Schristos dnl For backward compatibility. Some Makefiles may be using this. 282*75f6d617Schristos INTLLIBS="$LIBINTL" 283*75f6d617Schristos AC_SUBST(INTLLIBS) 284*75f6d617Schristos 285*75f6d617Schristos dnl Make all documented variables known to autoconf. 286*75f6d617Schristos AC_SUBST(LIBINTL) 287*75f6d617Schristos AC_SUBST(LTLIBINTL) 288*75f6d617Schristos AC_SUBST(POSUB) 289*75f6d617Schristos]) 290*75f6d617Schristos 291*75f6d617Schristos 292*75f6d617Schristosdnl Checks for all prerequisites of the po subdirectory, 293*75f6d617Schristosdnl except for USE_NLS. 294*75f6d617SchristosAC_DEFUN([AM_PO_SUBDIRS], 295*75f6d617Schristos[ 296*75f6d617Schristos AC_REQUIRE([AC_PROG_MAKE_SET])dnl 297*75f6d617Schristos AC_REQUIRE([AC_PROG_INSTALL])dnl 298*75f6d617Schristos AC_REQUIRE([AM_MKINSTALLDIRS])dnl 299*75f6d617Schristos 300*75f6d617Schristos dnl Perform the following tests also if --disable-nls has been given, 301*75f6d617Schristos dnl because they are needed for "make dist" to work. 302*75f6d617Schristos 303*75f6d617Schristos dnl Search for GNU msgfmt in the PATH. 304*75f6d617Schristos dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. 305*75f6d617Schristos dnl The second test excludes FreeBSD msgfmt. 306*75f6d617Schristos AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, 307*75f6d617Schristos [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && 308*75f6d617Schristos (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], 309*75f6d617Schristos :) 310*75f6d617Schristos AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) 311*75f6d617Schristos 312*75f6d617Schristos dnl Search for GNU xgettext 0.11 or newer in the PATH. 313*75f6d617Schristos dnl The first test excludes Solaris xgettext and early GNU xgettext versions. 314*75f6d617Schristos dnl The second test excludes FreeBSD xgettext. 315*75f6d617Schristos AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, 316*75f6d617Schristos [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && 317*75f6d617Schristos (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], 318*75f6d617Schristos :) 319*75f6d617Schristos dnl Remove leftover from FreeBSD xgettext call. 320*75f6d617Schristos rm -f messages.po 321*75f6d617Schristos 322*75f6d617Schristos dnl Search for GNU msgmerge 0.11 or newer in the PATH. 323*75f6d617Schristos AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, 324*75f6d617Schristos [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) 325*75f6d617Schristos 326*75f6d617Schristos dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. 327*75f6d617Schristos dnl Test whether we really found GNU msgfmt. 328*75f6d617Schristos if test "$GMSGFMT" != ":"; then 329*75f6d617Schristos dnl If it is no GNU msgfmt we define it as : so that the 330*75f6d617Schristos dnl Makefiles still can work. 331*75f6d617Schristos if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && 332*75f6d617Schristos (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then 333*75f6d617Schristos : ; 334*75f6d617Schristos else 335*75f6d617Schristos GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` 336*75f6d617Schristos AC_MSG_RESULT( 337*75f6d617Schristos [found $GMSGFMT program is not GNU msgfmt; ignore it]) 338*75f6d617Schristos GMSGFMT=":" 339*75f6d617Schristos fi 340*75f6d617Schristos fi 341*75f6d617Schristos 342*75f6d617Schristos dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. 343*75f6d617Schristos dnl Test whether we really found GNU xgettext. 344*75f6d617Schristos if test "$XGETTEXT" != ":"; then 345*75f6d617Schristos dnl If it is no GNU xgettext we define it as : so that the 346*75f6d617Schristos dnl Makefiles still can work. 347*75f6d617Schristos if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && 348*75f6d617Schristos (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then 349*75f6d617Schristos : ; 350*75f6d617Schristos else 351*75f6d617Schristos AC_MSG_RESULT( 352*75f6d617Schristos [found xgettext program is not GNU xgettext; ignore it]) 353*75f6d617Schristos XGETTEXT=":" 354*75f6d617Schristos fi 355*75f6d617Schristos dnl Remove leftover from FreeBSD xgettext call. 356*75f6d617Schristos rm -f messages.po 357*75f6d617Schristos fi 358*75f6d617Schristos 359*75f6d617Schristos AC_OUTPUT_COMMANDS([ 360*75f6d617Schristos for ac_file in $CONFIG_FILES; do 361*75f6d617Schristos # Support "outfile[:infile[:infile...]]" 362*75f6d617Schristos case "$ac_file" in 363*75f6d617Schristos *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; 364*75f6d617Schristos esac 365*75f6d617Schristos # PO directories have a Makefile.in generated from Makefile.in.in. 366*75f6d617Schristos case "$ac_file" in */Makefile.in) 367*75f6d617Schristos # Adjust a relative srcdir. 368*75f6d617Schristos ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` 369*75f6d617Schristos ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" 370*75f6d617Schristos ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` 371*75f6d617Schristos # In autoconf-2.13 it is called $ac_given_srcdir. 372*75f6d617Schristos # In autoconf-2.50 it is called $srcdir. 373*75f6d617Schristos test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" 374*75f6d617Schristos case "$ac_given_srcdir" in 375*75f6d617Schristos .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; 376*75f6d617Schristos /*) top_srcdir="$ac_given_srcdir" ;; 377*75f6d617Schristos *) top_srcdir="$ac_dots$ac_given_srcdir" ;; 378*75f6d617Schristos esac 379*75f6d617Schristos if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then 380*75f6d617Schristos rm -f "$ac_dir/POTFILES" 381*75f6d617Schristos test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" 382*75f6d617Schristos cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" 383*75f6d617Schristos # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend 384*75f6d617Schristos # on $ac_dir but don't depend on user-specified configuration 385*75f6d617Schristos # parameters. 386*75f6d617Schristos if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then 387*75f6d617Schristos # The LINGUAS file contains the set of available languages. 388*75f6d617Schristos if test -n "$ALL_LINGUAS"; then 389*75f6d617Schristos test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" 390*75f6d617Schristos fi 391*75f6d617Schristos ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` 392*75f6d617Schristos # Hide the ALL_LINGUAS assigment from automake. 393*75f6d617Schristos eval 'ALL_LINGUAS''=$ALL_LINGUAS_' 394*75f6d617Schristos fi 395*75f6d617Schristos case "$ac_given_srcdir" in 396*75f6d617Schristos .) srcdirpre= ;; 397*75f6d617Schristos *) srcdirpre='$(srcdir)/' ;; 398*75f6d617Schristos esac 399*75f6d617Schristos POFILES= 400*75f6d617Schristos GMOFILES= 401*75f6d617Schristos UPDATEPOFILES= 402*75f6d617Schristos DUMMYPOFILES= 403*75f6d617Schristos for lang in $ALL_LINGUAS; do 404*75f6d617Schristos POFILES="$POFILES $srcdirpre$lang.po" 405*75f6d617Schristos GMOFILES="$GMOFILES $srcdirpre$lang.gmo" 406*75f6d617Schristos UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" 407*75f6d617Schristos DUMMYPOFILES="$DUMMYPOFILES $lang.nop" 408*75f6d617Schristos done 409*75f6d617Schristos # CATALOGS depends on both $ac_dir and the user's LINGUAS 410*75f6d617Schristos # environment variable. 411*75f6d617Schristos INST_LINGUAS= 412*75f6d617Schristos if test -n "$ALL_LINGUAS"; then 413*75f6d617Schristos for presentlang in $ALL_LINGUAS; do 414*75f6d617Schristos useit=no 415*75f6d617Schristos if test "%UNSET%" != "$LINGUAS"; then 416*75f6d617Schristos desiredlanguages="$LINGUAS" 417*75f6d617Schristos else 418*75f6d617Schristos desiredlanguages="$ALL_LINGUAS" 419*75f6d617Schristos fi 420*75f6d617Schristos for desiredlang in $desiredlanguages; do 421*75f6d617Schristos # Use the presentlang catalog if desiredlang is 422*75f6d617Schristos # a. equal to presentlang, or 423*75f6d617Schristos # b. a variant of presentlang (because in this case, 424*75f6d617Schristos # presentlang can be used as a fallback for messages 425*75f6d617Schristos # which are not translated in the desiredlang catalog). 426*75f6d617Schristos case "$desiredlang" in 427*75f6d617Schristos "$presentlang"*) useit=yes;; 428*75f6d617Schristos esac 429*75f6d617Schristos done 430*75f6d617Schristos if test $useit = yes; then 431*75f6d617Schristos INST_LINGUAS="$INST_LINGUAS $presentlang" 432*75f6d617Schristos fi 433*75f6d617Schristos done 434*75f6d617Schristos fi 435*75f6d617Schristos CATALOGS= 436*75f6d617Schristos if test -n "$INST_LINGUAS"; then 437*75f6d617Schristos for lang in $INST_LINGUAS; do 438*75f6d617Schristos CATALOGS="$CATALOGS $lang.gmo" 439*75f6d617Schristos done 440*75f6d617Schristos fi 441*75f6d617Schristos test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" 442*75f6d617Schristos sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" 443*75f6d617Schristos for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do 444*75f6d617Schristos if test -f "$f"; then 445*75f6d617Schristos case "$f" in 446*75f6d617Schristos *.orig | *.bak | *~) ;; 447*75f6d617Schristos *) cat "$f" >> "$ac_dir/Makefile" ;; 448*75f6d617Schristos esac 449*75f6d617Schristos fi 450*75f6d617Schristos done 451*75f6d617Schristos fi 452*75f6d617Schristos ;; 453*75f6d617Schristos esac 454*75f6d617Schristos done], 455*75f6d617Schristos [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute 456*75f6d617Schristos # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it 457*75f6d617Schristos # from automake. 458*75f6d617Schristos eval 'ALL_LINGUAS''="$ALL_LINGUAS"' 459*75f6d617Schristos # Capture the value of LINGUAS because we need it to compute CATALOGS. 460*75f6d617Schristos LINGUAS="${LINGUAS-%UNSET%}" 461*75f6d617Schristos ]) 462*75f6d617Schristos]) 463*75f6d617Schristos 464*75f6d617Schristos 465*75f6d617Schristosdnl Checks for all prerequisites of the intl subdirectory, 466*75f6d617Schristosdnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, 467*75f6d617Schristosdnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. 468*75f6d617SchristosAC_DEFUN([AM_INTL_SUBDIR], 469*75f6d617Schristos[ 470*75f6d617Schristos AC_REQUIRE([AC_PROG_INSTALL])dnl 471*75f6d617Schristos AC_REQUIRE([AM_MKINSTALLDIRS])dnl 472*75f6d617Schristos AC_REQUIRE([AC_PROG_CC])dnl 473*75f6d617Schristos AC_REQUIRE([AC_CANONICAL_HOST])dnl 474*75f6d617Schristos AC_REQUIRE([AC_PROG_RANLIB])dnl 475*75f6d617Schristos AC_REQUIRE([AC_ISC_POSIX])dnl 476*75f6d617Schristos AC_REQUIRE([AC_HEADER_STDC])dnl 477*75f6d617Schristos AC_REQUIRE([AC_C_CONST])dnl 478*75f6d617Schristos AC_REQUIRE([AC_C_INLINE])dnl 479*75f6d617Schristos AC_REQUIRE([AC_TYPE_OFF_T])dnl 480*75f6d617Schristos AC_REQUIRE([AC_TYPE_SIZE_T])dnl 481*75f6d617Schristos AC_REQUIRE([AC_FUNC_ALLOCA])dnl 482*75f6d617Schristos AC_REQUIRE([AC_FUNC_MMAP])dnl 483*75f6d617Schristos AC_REQUIRE([jm_GLIBC21])dnl 484*75f6d617Schristos 485*75f6d617Schristos AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ 486*75f6d617Schristosstdlib.h string.h unistd.h sys/param.h]) 487*75f6d617Schristos AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ 488*75f6d617Schristosgeteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ 489*75f6d617Schristosstrcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) 490*75f6d617Schristos 491*75f6d617Schristos AM_ICONV 492*75f6d617Schristos AM_LANGINFO_CODESET 493*75f6d617Schristos AM_LC_MESSAGES 494*75f6d617Schristos 495*75f6d617Schristos dnl intl/plural.c is generated from intl/plural.y. It requires bison, 496*75f6d617Schristos dnl because plural.y uses bison specific features. It requires at least 497*75f6d617Schristos dnl bison-1.26 because earlier versions generate a plural.c that doesn't 498*75f6d617Schristos dnl compile. 499*75f6d617Schristos dnl bison is only needed for the maintainer (who touches plural.y). But in 500*75f6d617Schristos dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put 501*75f6d617Schristos dnl the rule in general Makefile. Now, some people carelessly touch the 502*75f6d617Schristos dnl files or have a broken "make" program, hence the plural.c rule will 503*75f6d617Schristos dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not 504*75f6d617Schristos dnl present or too old. 505*75f6d617Schristos AC_CHECK_PROGS([INTLBISON], [bison]) 506*75f6d617Schristos if test -z "$INTLBISON"; then 507*75f6d617Schristos ac_verc_fail=yes 508*75f6d617Schristos else 509*75f6d617Schristos dnl Found it, now check the version. 510*75f6d617Schristos AC_MSG_CHECKING([version of bison]) 511*75f6d617Schristoschangequote(<<,>>)dnl 512*75f6d617Schristos ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` 513*75f6d617Schristos case $ac_prog_version in 514*75f6d617Schristos '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 515*75f6d617Schristos 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) 516*75f6d617Schristoschangequote([,])dnl 517*75f6d617Schristos ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; 518*75f6d617Schristos *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; 519*75f6d617Schristos esac 520*75f6d617Schristos AC_MSG_RESULT([$ac_prog_version]) 521*75f6d617Schristos fi 522*75f6d617Schristos if test $ac_verc_fail = yes; then 523*75f6d617Schristos INTLBISON=: 524*75f6d617Schristos fi 525*75f6d617Schristos]) 526*75f6d617Schristos 527*75f6d617Schristos 528*75f6d617SchristosAC_DEFUN([AM_MKINSTALLDIRS], 529*75f6d617Schristos[ 530*75f6d617Schristos dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly 531*75f6d617Schristos dnl find the mkinstalldirs script in another subdir but $(top_srcdir). 532*75f6d617Schristos dnl Try to locate is. 533*75f6d617Schristos MKINSTALLDIRS= 534*75f6d617Schristos if test -n "$ac_aux_dir"; then 535*75f6d617Schristos MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" 536*75f6d617Schristos fi 537*75f6d617Schristos if test -z "$MKINSTALLDIRS"; then 538*75f6d617Schristos MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" 539*75f6d617Schristos fi 540*75f6d617Schristos AC_SUBST(MKINSTALLDIRS) 541*75f6d617Schristos]) 542