From: Bruno Haible Date: Tue, 20 Nov 2001 14:52:33 +0000 (+0000) Subject: Allow packages to use a preinstalled libintl library without carrying the X-Git-Tag: v0.11~280 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f5f49209a1b0724a72ee4602b699e759aafc6ac;p=thirdparty%2Fgettext.git Allow packages to use a preinstalled libintl library without carrying the intl/ source with them. --- diff --git a/NEWS b/NEWS index 14a557c3e..c9de033ef 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,9 @@ Version 0.11 - XXX 2001 * A fuzzy attribute of the header entry of a message catalog is now ignored by the tools, i.e. it is used even if marked fuzzy. + +* gettextize has a new option --intl which determines whether a copy of the + intl directory is included in the package. Version 0.10.40 - September 2001 diff --git a/doc/ChangeLog b/doc/ChangeLog index a040898ef..8ee695765 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,11 @@ +2001-11-18 Bruno Haible + + * gettext.texi (Prerequisites): Update for autoconf-2.50 users. + (gettextize Invocation): Document option --intl. + (configure.in): Update for autoconf-2.50 users. Document possibility + to work without intl directory. + (aclocal): Likewise. + 2001-11-17 Bruno Haible * msgfmt.texi: --check-accelerators has optional argument. diff --git a/doc/gettext.texi b/doc/gettext.texi index 2663e18eb..886ddc3c1 100644 --- a/doc/gettext.texi +++ b/doc/gettext.texi @@ -4958,7 +4958,8 @@ internationalized shell scripts within your own package: GNU want to see the translation of shell script messages. @item -Your package should use Autoconf and have a @file{configure.in} file. +Your package should use Autoconf and have a @file{configure.in} or +@file{configure.ac} file. If it does not, you have to learn how. The Autoconf documentation is quite well written, it is a good idea that you print it and get familiar with it. @@ -5033,6 +5034,14 @@ maintainer is used to apply to the sources. Because running @itemx --force Force replacement of files which already exist. +@item --intl +Install the libintl sources in a subdirectory named @file{intl/}. +This libintl will be used to provide internationalization on systems +that don't have GNU libintl installed. If this option is omitted, +the call to @code{AM_GNU_GETTEXT} in @file{configure.in} should read: +@samp{AM_GNU_GETTEXT([external])}, and internationalization will not +be enabled on systems lacking GNU gettext. + @item -h @itemx --help Display this help and exit. @@ -5184,6 +5193,9 @@ but rather by using the @code{LINGUAS} environment variable @node configure.in, config.guess, po/LINGUAS, Adjusting Files @subsection @file{configure.in} at top level +@file{configure.in} or @file{configure.ac} - this is the source from which +@code{autoconf} generates the @file{configure} script. + @enumerate @item Declare the package and version. @@ -5217,6 +5229,13 @@ AM_GNU_GETTEXT This call is purposely simple, even if it generates a lot of configure time checking and actions. +If you have suppressed the @file{intl/} subdirectory by calling +@code{gettextize} without @samp{--intl} option, this call should read + +@example +AM_GNU_GETTEXT([external]) +@end example + @item Have output files created. The @code{AC_OUTPUT} directive, at the end of your @file{configure.in} @@ -5224,7 +5243,7 @@ file, needs to be modified in two ways: @example AC_OUTPUT([@var{existing configuration files} intl/Makefile po/Makefile.in], -@var{existing additional actions}]) +[@var{existing additional actions}]) @end example The modification to the first argument to @code{AC_OUTPUT} asks @@ -5232,12 +5251,17 @@ for substitution in the @file{intl/} and @file{po/} directories. Note the @samp{.in} suffix used for @file{po/} only. This is because the distributed file is really @file{po/Makefile.in.in}. +If you have suppressed the @file{intl/} subdirectory by calling +@code{gettextize} without @samp{--intl} option, then you don't need to +add @code{intl/Makefile} to the @code{AC_OUTPUT} line. + @end enumerate @node config.guess, aclocal, configure.in, Adjusting Files @subsection @file{config.guess}, @file{config.sub} at top level -You need to add the GNU @file{config.guess} and @file{config.sub} files +If you don't have suppressed the @file{intl/} subdirectory, +you need to add the GNU @file{config.guess} and @file{config.sub} files to your distribution. They are needed because the @file{intl/} directory has platform dependent support for determining the locale's character encoding and therefore needs to identify the platform. @@ -5266,13 +5290,15 @@ If you do not have an @file{aclocal.m4} file in your distribution, the simplest is to concatenate the files @file{codeset.m4}, @file{gettext.m4}, @file{glibc21.m4}, @file{iconv.m4}, @file{isc-posix.m4}, @file{lcmessage.m4}, @file{progtest.m4} from GNU @code{gettext}'s -@file{m4/} directory into a single file. +@file{m4/} directory into a single file. If you have suppressed the +@file{intl/} directory, only @file{gettext.m4}, @file{iconv.m4}, +@file{progtest.m4} need to be concatenated. If you already have an @file{aclocal.m4} file, then you will have to merge the said macro files into your @file{aclocal.m4}. Note that if you are upgrading from a previous release of GNU @code{gettext}, you should most probably @emph{replace} the macros (@code{AM_GNU_GETTEXT}, -@code{AM_WITH_NLS}, etc.), as they usually +etc.), as they usually change a little from one release of GNU @code{gettext} to the next. Their contents may vary as we get more experience with strange systems out there. diff --git a/m4/ChangeLog b/m4/ChangeLog index 532e92a7d..f5a7069b9 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,10 @@ +2001-11-18 Bruno Haible + + * gettext.m4: Split into submacros. + (AM_GNU_GETTEXT): Allow the first argument to be 'external'. Verify + the first two arguments. Add --with-libintl-prefix option. + (AM_WITH_LIBINTL, AM_PO_SUBDIRS, AM_INTL_SUBDIR): New macros. + 2001-11-11 Bruno Haible * gettext.m4 (AM_GNU_GETTEXT): For builds with $builddir != $srcdir, diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 4b0445839..72cc71369 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,5 +1,6 @@ # Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. +# Ulrich Drepper , 1995-2000. +# Bruno Haible , 2000-2001. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public @@ -10,13 +11,17 @@ # gettext package package is covered by the GNU General Public License. # They are *not* in the public domain. -# serial 10 +# serial 11 -dnl Usage: AM_GNU_GETTEXT([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). -dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [LIBDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL 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 AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', 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 @@ -35,53 +40,52 @@ 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 If INTLSYMBOL is 'external', only cases 2 and 3 can occur. 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 AC_DEFUN([AM_GNU_GETTEXT], - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([jm_GLIBC21])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) - - AM_ICONV - AM_LANGINFO_CODESET - AM_LC_MESSAGES +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_WITH_LIBINTL])dnl + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) - AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no - INTLLIBS= + ]) + INTLLIBS= + POSUB= - dnl 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 + dnl 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.]) + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], @@ -89,274 +93,109 @@ strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - gt_use_preinstalled_gnugettext=no 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. 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]) + define(gt_api_version, ifelse([$2], [need-ngettext], 2, 1)) + define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]gt_api_version[_libc]) + define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]gt_api_version[_libintl]) - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include + 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 + [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 + ifelse(gt_included_intl, yes, , [ + AM_ICONV + ]) + 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 - gt_use_preinstalled_gnugettext=yes - fi - ]) + [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 + gt_use_preinstalled_gnugettext=yes + fi + ]) + ifelse(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on included GNU gettext library. - nls_cv_use_gnu_gettext=yes + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes fi fi - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - 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 libiconv. - INTLLIBS="-lintl $LIBICONV" - fi - - dnl For backward compatibility. Some packages may be using this. - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - AC_CHECK_FUNCS(dcgettext) - LIBS="$gt_save_LIBS" - - fi - if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. INTLOBJS="\$(GETTOBJS)" - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - 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/ $//'` + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + INTLLIBS="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions to use GNU gettext tools. + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi + ]) - dnl We need to process the po/ directory. - POSUB=po - fi - - dnl Perform the following tests also if --disable-nls has been given, - dnl because they are needed for "make dist" to work. - - dnl Search for GNU msgfmt in the PATH. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext in the PATH. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - - dnl Search for GNU msgmerge 0.11 or newer in the PATH. - AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found msgfmt program is not GNU msgfmt; ignore it]) - GMSGFMT=":" + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + 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 libiconv. + INTLLIBS="-lintl $LIBICONV" fi - fi - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - 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 >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) fi - AC_OUTPUT_COMMANDS( - [for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - # ALL_LINGUAS, GMOFILES, POFILES depend on $ac_dir but don't - # depend on user-specified configuration parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - GMOFILES= - POFILES= - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - POFILES="$POFILES $srcdirpre$lang.po" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@POFILES@|$POFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - fi - ;; - esac - done], - [# Capture the value of obsolete $ALL_LINGUAS because we need it to - # compute GMOFILES, POFILES, CATALOGS. But hide it from automake. - eval 'ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) - + dnl We need to process the po/ directory. + POSUB=po + fi + ifelse(gt_included_intl, yes, [ 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 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. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl 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'` - 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 - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi - dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATOBJEXT) - AC_SUBST(INTLLIBS) AC_SUBST(INTLOBJS) - AC_SUBST(POSUB) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= @@ -374,19 +213,247 @@ changequote([,])dnl GENCAT=gencat AC_SUBST(GENCAT) - 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. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) + + dnl Make all documented variables known to autoconf. + AC_SUBST(INTLLIBS) + AC_SUBST(POSUB) +]) + + +AC_DEFUN([AM_WITH_LIBINTL], +[ + AC_ARG_WITH([libintl-prefix], +[ --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) +]) + + +dnl Checks for all prerequisites of the intl subdirectory, +dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, +dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext in the PATH. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then + : ; + else + AC_MSG_RESULT( + [found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + 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 >/dev/null 2>&1; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" + # ALL_LINGUAS, GMOFILES, POFILES depend on $ac_dir but don't + # depend on user-specified configuration parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + GMOFILES= + POFILES= + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + POFILES="$POFILES $srcdirpre$lang.po" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/POTFILES =/r $ac_dir/POTFILES" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@POFILES@|$POFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + fi + ;; + esac + done], + [# Capture the value of obsolete $ALL_LINGUAS because we need it to + # compute GMOFILES, POFILES, CATALOGS. But hide it from automake. + eval 'ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + + +dnl Checks for all prerequisites of the po subdirectory, +dnl except for USE_NLS. +AC_DEFUN([AM_INTL_SUBDIR], +[ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) + + AM_ICONV + AM_LANGINFO_CODESET + AM_LC_MESSAGES + + 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. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl 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'` + 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 + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +AC_DEFUN([AM_MKINSTALLDIRS]), +[ + 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. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) +]) diff --git a/misc/ChangeLog b/misc/ChangeLog index 65a2ad544..6d5d9d675 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,9 @@ +2001-11-18 Bruno Haible + + * gettextize.in: New option --intl. + (intldir): New variable. + Don't populate intl subdirectory if --intl is omitted. + 2001-11-19 Karl Eichwalder * po-mode.el (po-ediff-quit): New function. diff --git a/misc/gettextize.in b/misc/gettextize.in index feecf8b94..cb321bdb5 100644 --- a/misc/gettextize.in +++ b/misc/gettextize.in @@ -24,6 +24,7 @@ echo=echo progname=$0 force=0 +intldir= configstatus=0 origdir=`pwd` usage="\ @@ -32,6 +33,7 @@ Usage: gettextize [OPTION]... [package-dir] --version print version information and exit -c, --copy copy files instead of making symlinks -f, --force force writing of new files even if old exist + --intl install libintl in a subdirectory Report bugs to ." package=@PACKAGE@ version=@VERSION@ @@ -39,18 +41,21 @@ try_ln_s=: while test $# -gt 0; do case "$1" in - -c | --copy | --c* ) + -c | --copy | --cop | --co | --c ) shift try_ln_s=false ;; - -f | --force | --f* ) + -f | --force | --forc | --for | --fo | --f ) shift force=1 ;; - -r | --run | --r* ) + -r | --run | --ru | --r ) shift configstatus=1 ;; - --help | --h* ) + --help | --hel | --he | --h ) $echo "$usage"; exit 0 ;; - --version | --v* ) + --intl | --int | --in | --i ) + shift + intldir=yes ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) echo "$progname (GNU $package) $version" $echo "Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -122,11 +127,13 @@ if test -d intl; then fi done) else - $echo "Creating intl/ subdirectory" - mkdir intl || { - $echo "failed to create intl/ subdirectory" - exit 1; - } + if test -n "$intldir"; then + $echo "Creating intl/ subdirectory" + mkdir intl || { + $echo "failed to create intl/ subdirectory" + exit 1; + } + fi fi test -d po || { @@ -155,23 +162,29 @@ for file in *; do done # Copy files to intl/ subdirectory. -cd intl -for file in *; do - if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then - rm -f $srcdir/intl/$file - if test $file != plural.c; then - ($try_ln_s && ln -s $gettext_dir/intl/$file $srcdir/intl/$file && $echo "Symlinking file intl/$file") 2>/dev/null || - { $echo "Copying file intl/$file"; cp $file $srcdir/intl/$file; } - else - # plural.c is a generated file; it must be copied and touched. - $echo "Copying file intl/$file"; cp $file $srcdir/intl/$file - sleep 2; touch $srcdir/intl/$file +if test -n "$intldir"; then + cd intl + for file in *; do + if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then + rm -f $srcdir/intl/$file + if test $file != plural.c; then + ($try_ln_s && ln -s $gettext_dir/intl/$file $srcdir/intl/$file && $echo "Symlinking file intl/$file") 2>/dev/null || + { $echo "Copying file intl/$file"; cp $file $srcdir/intl/$file; } + else + # plural.c is a generated file; it must be copied and touched. + $echo "Copying file intl/$file"; cp $file $srcdir/intl/$file + sleep 2; touch $srcdir/intl/$file + fi fi - fi -done + done + cd .. +else + echo "Not copying intl/ directory. Please use AM_GNU_GETTEXT([external])" + echo "in order to cause autoconfiguration to look for an external libintl." +fi # Copy files to po/ subdirectory. -cd ../po +cd po for file in *; do rm -f $srcdir/po/$file ($try_ln_s && ln -s $gettext_dir/po/$file $srcdir/po/$file && $echo "Symlinking file po/$file") 2>/dev/null || @@ -206,8 +219,12 @@ rm -f $srcdir/po/ChangeLog.tmp echo echo "Please add the files" -echo " codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4" -echo " progtest.m4" +if test -n "$intldir"; then + echo " codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4" + echo " progtest.m4" +else + echo " gettext.m4 iconv.m4 progtest.m4" +fi echo "from the @datadir@/aclocal directory to your autoconf macro directory" if test -f $srcdir/Makefile.am; then echo "and run 'aclocal' to regenerate the aclocal.m4 file."