Skip to content

Commit

Permalink
Require ngettext in test of system gettext implementation
Browse files Browse the repository at this point in the history
gcc currently uses ngettext in a number of places (gcc/cp/pt.c,
gcc/diagnostic.c, gcc/collect2.c).  Apparently there are (or used to
be) gettext implementations that lack ngettext.  See config/gettext.m4.

This patch arranges for intl/ to be compiled when the system gettext
lacks ngettext.

	* configure.ac: Invoke AM_GNU_GETTEXT with need_ngettext.
	* configure: Regenerate.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254486 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
amodra committed Nov 7, 2017
1 parent 8efdc82 commit 71ff36b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
5 changes: 5 additions & 0 deletions intl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2017-11-07 Alan Modra <amodra@gmail.com>

* configure.ac: Invoke AM_GNU_GETTEXT with need_ngettext.
* configure: Regenerate.

2016-11-15 Matthias Klose <doko@ubuntu.com>

* configure: Regenerate.
Expand Down
40 changes: 20 additions & 20 deletions intl/configure
Original file line number Diff line number Diff line change
Expand Up @@ -5813,7 +5813,7 @@ $as_echo "$nls_cv_force_use_gnu_gettext" >&6; }

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5
$as_echo_n "checking for GNU gettext in libc... " >&6; }
if test "${gt_cv_func_gnugettext1_libc+set}" = set; then :
if test "${gt_cv_func_gnugettext2_libc+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Expand All @@ -5825,23 +5825,23 @@ int
main ()
{
bindtextdomain ("", "");
return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings
return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_domain_bindings
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
gt_cv_func_gnugettext1_libc=yes
gt_cv_func_gnugettext2_libc=yes
else
gt_cv_func_gnugettext1_libc=no
gt_cv_func_gnugettext2_libc=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libc" >&5
$as_echo "$gt_cv_func_gnugettext1_libc" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext2_libc" >&5
$as_echo "$gt_cv_func_gnugettext2_libc" >&6; }

if test "$gt_cv_func_gnugettext1_libc" != "yes"; then
if test "$gt_cv_func_gnugettext2_libc" != "yes"; then



Expand Down Expand Up @@ -6223,7 +6223,7 @@ fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5
$as_echo_n "checking for GNU gettext in libintl... " >&6; }
if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then :
if test "${gt_cv_func_gnugettext2_libintl+set}" = set; then :
$as_echo_n "(cached) " >&6
else
gt_save_CPPFLAGS="$CPPFLAGS"
Expand All @@ -6243,19 +6243,19 @@ int
main ()
{
bindtextdomain ("", "");
return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0)
return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias (0)
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
gt_cv_func_gnugettext1_libintl=yes
gt_cv_func_gnugettext2_libintl=yes
else
gt_cv_func_gnugettext1_libintl=no
gt_cv_func_gnugettext2_libintl=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then
if test "$gt_cv_func_gnugettext2_libintl" != yes && test -n "$LIBICONV"; then
LIBS="$LIBS $LIBICONV"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand All @@ -6270,15 +6270,15 @@ int
main ()
{
bindtextdomain ("", "");
return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0)
return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias (0)
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
LIBINTL="$LIBINTL $LIBICONV"
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
gt_cv_func_gnugettext1_libintl=yes
gt_cv_func_gnugettext2_libintl=yes

fi
rm -f core conftest.err conftest.$ac_objext \
Expand All @@ -6287,12 +6287,12 @@ rm -f core conftest.err conftest.$ac_objext \
CPPFLAGS="$gt_save_CPPFLAGS"
LIBS="$gt_save_LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libintl" >&5
$as_echo "$gt_cv_func_gnugettext1_libintl" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext2_libintl" >&5
$as_echo "$gt_cv_func_gnugettext2_libintl" >&6; }
fi

if test "$gt_cv_func_gnugettext1_libc" = "yes" \
|| { test "$gt_cv_func_gnugettext1_libintl" = "yes" \
if test "$gt_cv_func_gnugettext2_libc" = "yes" \
|| { test "$gt_cv_func_gnugettext2_libintl" = "yes" \
&& test "$PACKAGE" != gettext-runtime \
&& test "$PACKAGE" != gettext-tools; }; then
gt_use_preinstalled_gnugettext=yes
Expand Down Expand Up @@ -6340,7 +6340,7 @@ $as_echo "$USE_NLS" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5
$as_echo_n "checking where the gettext function comes from... " >&6; }
if test "$gt_use_preinstalled_gnugettext" = "yes"; then
if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
if test "$gt_cv_func_gnugettext2_libintl" = "yes"; then
gt_source="external libintl"
else
gt_source="libc"
Expand All @@ -6355,7 +6355,7 @@ $as_echo "$gt_source" >&6; }
if test "$USE_NLS" = "yes"; then

if test "$gt_use_preinstalled_gnugettext" = "yes"; then
if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
if test "$gt_cv_func_gnugettext2_libintl" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5
$as_echo_n "checking how to link with libintl... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5
Expand Down
2 changes: 1 addition & 1 deletion intl/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AC_CONFIG_SRCDIR(gettext.c)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR(../config)
AM_GNU_GETTEXT_VERSION(0.12.1)
AM_GNU_GETTEXT
AM_GNU_GETTEXT([], [need-ngettext])

# This replaces the extensive use of DEFS in the original Makefile.in.
AC_DEFINE(IN_LIBINTL, 1, [Define because this is libintl.])
Expand Down

0 comments on commit 71ff36b

Please sign in to comment.