From: Todd C. Miller <Todd.Miller@courtesan.com> Date: Mon, 18 Jun 2012 18:29:06 +0000 (-0400) Subject: Older versions of Solaris lack ngettext() X-Git-Tag: SUDO_1_8_6^2~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c74d4063132c1f8cacd54fbdc26070b85b60b6da;p=sudo Older versions of Solaris lack ngettext() --- diff --git a/config.h.in b/config.h.in index ce56c7fad..1945205ba 100644 --- a/config.h.in +++ b/config.h.in @@ -363,6 +363,9 @@ /* Define to 1 if you have the <netgroup.h> header file. */ #undef HAVE_NETGROUP_H +/* Define to 1 if you have the `ngettext' function. */ +#undef HAVE_NGETTEXT + /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO diff --git a/configure b/configure index 4df7fd855..3335866f8 100755 --- a/configure +++ b/configure @@ -17912,7 +17912,20 @@ fi eval gettext_result="\$$gettext_name" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gettext_result" >&5 $as_echo "$gettext_result" >&6; } - test "$gettext_result" = "yes" && break + if test "$gettext_result" = "yes"; then + for ac_func in ngettext +do : + ac_fn_c_check_func "$LINENO" "ngettext" "ac_cv_func_ngettext" +if test "x$ac_cv_func_ngettext" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NGETTEXT 1 +_ACEOF + +fi +done + + break + fi done LIBS="$OLIBS" diff --git a/configure.in b/configure.in index 265a78dd4..6ea479f6a 100644 --- a/configure.in +++ b/configure.in @@ -2421,7 +2421,10 @@ if test "$enable_nls" != "no"; then ]) eval gettext_result="\$$gettext_name" AC_MSG_RESULT($gettext_result) - test "$gettext_result" = "yes" && break + if test "$gettext_result" = "yes"; then + AC_CHECK_FUNCS(ngettext) + break + fi done LIBS="$OLIBS" diff --git a/include/gettext.h b/include/gettext.h index ac2663c4c..b3ea285ca 100644 --- a/include/gettext.h +++ b/include/gettext.h @@ -43,6 +43,15 @@ dngettext(DEFAULT_TEXT_DOMAIN, String, String_Plural, N) # endif +/* + * Older versions of Solaris lack ngettext() so we have to kludge it. + */ +# ifndef HAVE_NGETTEXT +# undef ngettext +# define ngettext(String, String_Plural, N) \ + ((N) == 1 ? gettext(String) : gettext(String_Plural)) +# endif + /* Gettext convenience macros */ # define _(String) gettext(String) # define gettext_noop(String) String