--- gettext-0.10.38/m4/gettext.m4 Thu May 17 15:35:37 2001 +++ gettext/m4/gettext.m4 Mon Jun 11 20:29:28 2001 @@ -6,39 +6,40 @@ # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. -# serial 9 +# serial 10 -dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). -dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library -dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, -dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). Otherwise, a static library -dnl $(top_builddir)/intl/libintl.a will be created. -dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext -dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. -dnl LIBDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. -dnl -dnl The result of the configuration is one of three cases: -dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled -dnl and used. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 2) GNU gettext has been found in the system's C library. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 3) No internationalization, always use English msgid. -dnl Catalog format: none -dnl Catalog extension: none -dnl The use of .gmo is historical (it was needed to avoid overwriting the -dnl GNU format catalogs when building on a platform with an X/Open gettext), -dnl but we keep it in order not to force irrelevant filename changes on the -dnl maintainers. -dnl +# AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]) +# ------------------------------------------------- +# If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library +# $(top_builddir)/intl/libintl.la will be created (shared and/or static, +# depending on --{enable,disable}-{shared,static} and on the presence of +# AM-DISABLE-SHARED). Otherwise, a static library +# $(top_builddir)/intl/libintl.a will be created. +# If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +# implementations (in libc or libintl) without the ngettext() function +# will be ignored. +# LIBDIR is used to find the intl libraries. If empty, +# the value `$(top_builddir)/intl/' is used. +# +# The result of the configuration is one of three cases: +# 1) GNU gettext, as included in the intl subdirectory, will be compiled +# and used. +# Catalog format: GNU --> install in $(datadir) +# Catalog extension: .mo after installation, .gmo in source tree +# 2) GNU gettext has been found in the system's C library. +# Catalog format: GNU --> install in $(datadir) +# Catalog extension: .mo after installation, .gmo in source tree +# 3) No internationalization, always use English msgid. +# Catalog format: none +# Catalog extension: none +# The use of .gmo is historical (it was needed to avoid overwriting the +# GNU format catalogs when building on a platform with an X/Open gettext), +# but we keep it in order not to force irrelevant filename changes on the +# maintainers. +# AC_DEFUN([AM_WITH_NLS], [AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS + # Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) @@ -49,125 +50,9 @@ USE_INCLUDED_LIBINTL=no INTLLIBS= - dnl If we use NLS figure out what method + # If we use NLS figure out what method if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If GNU gettext is available we use this. Else we have - dnl to fall back to GNU NLS library. - CATOBJEXT=NONE - - dnl Add a version number to the cache macros. - define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) - define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) - - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - AC_TRY_LINK([#include -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - dnl If iconv() is in a separate libiconv library, then anyone - dnl linking with libintl{.a,.so} also needs to link with - dnl libiconv. - INTLLIBS="-lintl $LIBICONV" - fi - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - AC_CHECK_FUNCS(dcgettext) - LIBS="$gt_save_LIBS" - - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl - if test "$MSGFMT" != "no"; then - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - fi - - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - - CATOBJEXT=.gmo - fi - ]) - - if test "$CATOBJEXT" = "NONE"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - INTLOBJS="\$(GETTOBJS)" - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - AC_SUBST(MSGFMT) - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - fi - - dnl We need to process the po/ directory. - POSUB=po + _GT_GETTEXT_METHOD($@) fi AC_OUTPUT_COMMANDS( [for ac_file in $CONFIG_FILES; do @@ -198,34 +83,33 @@ done]) - dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL - dnl to 'yes' because some of the testsuite requires it. + # If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + # to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext; then BUILD_INCLUDED_LIBINTL=yes fi - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. + # intl/plural.c is generated from intl/plural.y. It requires bison, + # because plural.y uses bison specific features. It requires at least + # bison-1.26 because earlier versions generate a plural.c that doesn't + # compile. + # bison is only needed for the maintainer (who touches plural.y). But in + # order to avoid separate Makefiles or --enable-maintainer-mode, we put + # the rule in general Makefile. Now, some people carelessly touch the + # files or have a broken "make" program, hence the plural.c rule will + # sometimes fire. To avoid an error, defines BISON to ":" if it is not + # present or too old. AC_CHECK_PROGS([INTLBISON], [bison]) if test -z "$INTLBISON"; then ac_verc_fail=yes else - dnl Found it, now check the version. + # Found it, now check the version. AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` + ac_prog_version=`$INTLBISON --version 2>&1 | + sed -n 's/^.*GNU Bison .* \([[0-9]]*\.[[0-9.]]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl + 1.2[[6-9]]* | 1.[[3-9][0-9]]* | [[2-9]].*) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac @@ -235,15 +119,15 @@ INTLBISON=: fi - dnl These rules are solely for the distribution goal. While doing this - dnl we only have to keep exactly one list of the available catalogs - dnl in configure.in. + # These rules are solely for the distribution goal. While doing this + # we only have to keep exactly one list of the available catalogs + # in configure.in. for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done - dnl Make all variables we use known to autoconf. + # Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATALOGS) @@ -254,24 +138,24 @@ AC_SUBST(POFILES) AC_SUBST(POSUB) - dnl For backward compatibility. Some configure.ins may be using this. + # For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= - dnl For backward compatibility. Some Makefiles may be using this. + # For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST(DATADIRNAME) - dnl For backward compatibility. Some Makefiles may be using this. + # For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST(INSTOBJEXT) - dnl For backward compatibility. Some Makefiles may be using this. + # For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) ]) -dnl Usage: Just like AM_WITH_NLS, which see. +# Usage: Just like AM_WITH_NLS, which see. AC_DEFUN([AM_GNU_GETTEXT], [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_CC])dnl @@ -324,15 +208,15 @@ AC_MSG_RESULT($LINGUAS) fi - dnl Construct list of names of catalog files to be constructed. + # Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate is. + # If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + # find the mkinstalldirs script in another subdir but $(top_srcdir). + # Try to locate is. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" @@ -342,7 +226,146 @@ fi AC_SUBST(MKINSTALLDIRS) - dnl Enable libtool support if the surrounding package wishes it. + # Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) + + +# _GT_GETTEXT_METHOD([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]) +# -------------------------------------------------------- +# Find out which method to use. +AC_DEFUN([_GT_GETTEXT_METHOD], +[AC_DEFINE([ENABLE_NLS], 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) +AC_MSG_CHECKING([whether included gettext is requested]) +AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) +AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + +nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" +if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + # User does not insist on using GNU NLS library. Figure out what to + # use. If GNU gettext is available we use this. Else we have to + # fall back to GNU NLS library. + CATOBJEXT=NONE + + dnl Add a version number to the cache macros. + define([gt_cv_func_gnugettext_libc], + [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) + define([gt_cv_func_gnugettext_libintl], + [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) + + # Check whether we should use the installed Gettext. + _GT_INSTALLED_GETTEXT($@) + + if test "$CATOBJEXT" = "NONE"; then + # GNU gettext is not found in the C library. Fall back on GNU + # gettext library. + nls_cv_use_gnu_gettext=yes + fi +fi + +if test "$nls_cv_use_gnu_gettext" = "yes"; then + # Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_SUBST(MSGFMT) + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INTLLIBS="ifelse([$3], [], + [\$(top_builddir)/intl], + [$3])/libintl.ifelse([$1], use-libtool, + [l], + [])a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` +fi + +# Test whether we really found GNU xgettext. +if test "$XGETTEXT" != ":"; then + # If it is no GNU xgettext we define it as : so that the + # Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else + AC_MSG_RESULT([found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi +fi + +# We need to process the po/ directory. +POSUB=po +])# _GT_GETTEXT_METHOD + + +# _GT_INSTALLED_GETTEXT([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]) +# ----------------------------------------------------------- +# Check whether we should use the installed Gettext suite. +AC_DEFUN([_GT_INSTALLED_GETTEXT], +[AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +extern int _nl_msg_cat_cntr;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], need-ngettext, + [ + (int) ngettext ("", "", 0)], + [])[ + _nl_msg_cat_cntr], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $LIBICONV" + AC_TRY_LINK([#include +extern int _nl_msg_cat_cntr;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], need-ngettext, + [ + (int) ngettext ("", "", 0)], + [])[ + _nl_msg_cat_cntr], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + LIBS="$gt_save_LIBS"]) + fi + + # If an already present or preinstalled GNU gettext() is found, + # use it. But if this macro is used in GNU gettext, and GNU + # gettext is already preinstalled in libintl, we update this + # libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + # If iconv() is in a separate libiconv library, then anyone + # linking with libintl{.a,.so} also needs to link with + # libiconv. + INTLLIBS="-lintl $LIBICONV" + fi + + gt_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + AC_CHECK_FUNCS(dcgettext) + LIBS="$gt_save_LIBS" + + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + if test "$MSGFMT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + fi + + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + CATOBJEXT=.gmo + fi +])])# _GT_INSTALLED_GETTEXT