]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add an optional 'need-ngettext' parameter, used to ignore pre-ngettext versions
authorBruno Haible <bruno@clisp.org>
Sun, 11 Mar 2001 16:14:05 +0000 (16:14 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 11 Mar 2001 16:14:05 +0000 (16:14 +0000)
of GNU gettext.

m4/ChangeLog
m4/gettext.m4

index 3e6b821125327b3f94e7809cfd722d4d113d4e90..2780a2dee8c089c7a743c0236eaf2ed12503d4a1 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-11  Bruno Haible  <haible@clisp.cons.org>
+
+       * gettext.m4 (AM_WITH_NLS): Accept a second argument 'need-ngettext'.
+       If it is given, check for the presence of ngettext() as well.
+
 2001-03-10  Bruno Haible  <haible@clisp.cons.org>
 
        * signed.m4: Quote first argument of AC_DEFUN.
index ab3f0fe0b4d9bb2c10cb0fd3536a6af9ee4a01ef..606d4177017a64fb92d8b0ae2cebec43e777cc29 100644 (file)
@@ -8,12 +8,15 @@
 
 # serial 8
 
-dnl Usage: AM_WITH_NLS([SYMBOL], [LIBDIR]).
-dnl If SYMBOL is specified and is 'use-libtool', then a libtool library
+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
@@ -64,12 +67,16 @@ AC_DEFUN([AM_WITH_NLS],
         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 <libintl.h>
 extern int _nl_msg_cat_cntr;],
               [bindtextdomain ("", "");
-return (int) gettext ("") + _nl_msg_cat_cntr],
+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)])
 
@@ -81,7 +88,7 @@ return (int) gettext ("") + _nl_msg_cat_cntr],
                AC_TRY_LINK([#include <libintl.h>
 extern int _nl_msg_cat_cntr;],
                  [bindtextdomain ("", "");
-return (int) gettext ("") + _nl_msg_cat_cntr],
+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"])
@@ -125,7 +132,7 @@ return (int) gettext ("") + _nl_msg_cat_cntr],
        BUILD_INCLUDED_LIBINTL=yes
        USE_INCLUDED_LIBINTL=yes
         CATOBJEXT=.gmo
-       INTLLIBS='ifelse([$2],[],$(top_builddir)/intl,[$2])/libintl.ifelse([$1], use-libtool, [l], [])a'
+       INTLLIBS='ifelse([$3],[],$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a'
        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
       fi