From: Bruno Haible Date: Thu, 29 Jan 2026 18:28:59 +0000 (+0100) Subject: gettext: Partially update to gettext 1.0. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fgnulib.git gettext: Partially update to gettext 1.0. * m4/gettext.m4: Update from gettext 1.0. * m4/nls.m4: Likewise. * m4/progtest.m4: Likewise. --- diff --git a/ChangeLog b/ChangeLog index 8fc07e94d3..6acf890d4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2026-01-29 Bruno Haible + + gettext: Partially update to gettext 1.0. + * m4/gettext.m4: Update from gettext 1.0. + * m4/nls.m4: Likewise. + * m4/progtest.m4: Likewise. + 2026-01-29 Bruno Haible relocatable-prog-wrapper: Fix syntax error on Linux (regr. 2025-12-09). diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 493ea7e7f2..71472f05b6 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,6 +1,6 @@ # gettext.m4 -# serial 81 (gettext-0.23) -dnl Copyright (C) 1995-2014, 2016, 2018-2026 Free Software Foundation, Inc. +# serial 86 (gettext-1.0) +dnl Copyright (C) 1995-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,9 +15,7 @@ dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2024. +dnl From Ulrich Drepper, Bruno Haible, Daiku Ueno. dnl Macro to add for using GNU gettext. @@ -93,9 +91,18 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) - dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. + dnl On Mac OS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX + dnl On native Windows, libintl requires linking with advapi32, + dnl because langprefs.c (_nl_language_preferences_win32_95) uses functions + dnl from advapi32.dll. + AC_REQUIRE([AC_CANONICAL_HOST]) + INTL_WINDOWS_LIBS= + case "$host_os" in + mingw* | windows*) INTL_WINDOWS_LIBS='-ladvapi32' ;; + esac + dnl Set USE_NLS. AC_REQUIRE([AM_NLS]) @@ -119,15 +126,15 @@ AC_DEFUN([AM_GNU_GETTEXT], if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no m4_if(gt_building_libintl_in_same_build_tree, yes, [ - 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 + AC_MSG_CHECKING([whether included libintl is requested]) + AC_ARG_WITH([included-libintl], + [ --with-included-libintl use the GNU libintl library included here], + gt_cv_force_use_gnu_libintl=$withval, + gt_cv_force_use_gnu_libintl=no) + AC_MSG_RESULT([$gt_cv_force_use_gnu_libintl]) + + gt_cv_use_gnu_libintl="$gt_cv_force_use_gnu_libintl" + if test "$gt_cv_force_use_gnu_libintl" != "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 @@ -151,13 +158,37 @@ changequote([,])dnl gt_expression_test_code= fi + dnl In the test code below: + dnl * We test for the presence of _nl_msg_cat_cntr because GNU libc and + dnl libintl define this variable, whereas Solaris 10 libc/libintl + dnl (which we don't want to use, as it does not support GNU .mo files) + dnl does not define it. + dnl * We don't test for _nl_msg_cat_cntr on MSVC, because the use of a + dnl variable under MSVC depends on whether it is exported by a shared + dnl library or a static library: If libintl is a shared library, we + dnl would have to declare it with __declspec(dllimport), whereas if it + dnl is a static library, we would have to declare it without such a + dnl __declspec. But libintl comes with just one header file, + dnl , that does not declare _nl_msg_cat_cntr and that does + dnl not tell us whether the library was built shared or static. + dnl * We test for the presence of _nl_domain_bindings because GNU libc + dnl defines this variable, whereas NetBSD libc (which we don't want to + dnl use, as it was broken at least in 2002) does not define it. + dnl * We test for the presence of _nl_expand_alias because GNU libintl + dnl defines this function, whereas NetBSD libintl (which we don't want + dnl to use, as it was broken at least in 2002) does not define it. + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#if defined _MSC_VER +#define _nl_msg_cat_cntr 0 +#else extern int _nl_msg_cat_cntr; +#endif extern int *_nl_domain_bindings; #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) #else @@ -169,7 +200,28 @@ $gt_revision_test_code bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ]])], - [eval "$gt_func_gnugettext_libc=yes"], + [dnl Solaris 11.[0-3] doesn't strip the CODESET part from the locale name, + dnl when looking for a message catalog. E.g. when the locale is fr_FR.UTF-8, + dnl on Solaris 11.[0-3] it looks for + dnl /fr_FR.UTF-8/LC_MESSAGES/.mo + dnl /fr.UTF-8/LC_MESSAGES/.mo + dnl Similarly, on Solaris 11 OpenIndiana and Solaris 11 OmniOS it looks only for + dnl /fr_FR.UTF-8/LC_MESSAGES/.mo + dnl Reported at . + dnl On Solaris 11.4 this is fixed: it looks for + dnl /fr_FR.UTF-8/LC_MESSAGES/.mo + dnl /fr.UTF-8/LC_MESSAGES/.mo + dnl /fr_FR/LC_MESSAGES/.mo + dnl /fr/LC_MESSAGES/.mo + if test "`uname -sr`" = 'SunOS 5.11'; then + case `uname -v` in + 11.4 | 11.4.*) eval "$gt_func_gnugettext_libc=yes" ;; + *) eval "$gt_func_gnugettext_libc=no" ;; + esac + else + eval "$gt_func_gnugettext_libc=yes" + fi + ], [eval "$gt_func_gnugettext_libc=no"])]) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then @@ -194,7 +246,11 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION [[ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#if defined _MSC_VER +#define _nl_msg_cat_cntr 0 +#else extern int _nl_msg_cat_cntr; +#endif extern #ifdef __cplusplus "C" @@ -213,11 +269,13 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION [eval "$gt_func_gnugettext_libintl=yes"], [eval "$gt_func_gnugettext_libintl=no"]) dnl Now see whether libintl exists and depends on libiconv or other - dnl OS dependent libraries, specifically on macOS and AIX. - gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS" - AC_REQUIRE([AC_CANONICAL_HOST]) + dnl OS dependent libraries, specifically on macOS, AIX, and native + dnl Windows. + gt_LIBINTL_EXTRA= case "$host_os" in - aix*) gt_LIBINTL_EXTRA="-lpthread" ;; + darwin*) gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS" ;; + aix*) gt_LIBINTL_EXTRA="-lpthread" ;; + mingw* | windows*) gt_LIBINTL_EXTRA="$INTL_WINDOWS_LIBS" ;; esac if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \ && { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then @@ -227,7 +285,11 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION [[ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#if defined _MSC_VER +#define _nl_msg_cat_cntr 0 +#else extern int _nl_msg_cat_cntr; +#endif extern #ifdef __cplusplus "C" @@ -273,11 +335,15 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION 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 + gt_cv_use_gnu_libintl=yes fi fi - if test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_REQUIRE([AC_CANONICAL_HOST]) + if test "$gt_cv_use_gnu_libintl" = "yes" \ + || case "$host_os" in cygwin*) true;; *) false;; esac; then + dnl GNU gettext is not found in the C library or is, + dnl like on Cygwin, a component of the C library. dnl Mark actions used to generate GNU NLS library. USE_INCLUDED_LIBINTL=yes LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" @@ -287,7 +353,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then + || test "$gt_cv_use_gnu_libintl" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi @@ -295,15 +361,24 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Some extra flags are needed during linking. + || test "$gt_cv_use_gnu_libintl" = "yes"; then + dnl Some extra options are needed during linking. LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi + if test -n "$INTL_WINDOWS_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$gt_cv_use_gnu_libintl" = "yes"; then + dnl Some extra options are needed during linking. + LIBINTL="$LIBINTL $INTL_WINDOWS_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_WINDOWS_LIBS" + fi + fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then + || test "$gt_cv_use_gnu_libintl" = "yes"; then AC_DEFINE([ENABLE_NLS], [1], [Define to 1 if translation of program messages to the user's native language is requested.]) diff --git a/m4/nls.m4 b/m4/nls.m4 index 9e36c937cb..0b5ef2609b 100644 --- a/m4/nls.m4 +++ b/m4/nls.m4 @@ -1,7 +1,6 @@ # nls.m4 -# serial 6 (gettext-0.20.2) -dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2026 Free -dnl Software Foundation, Inc. +# serial 7 (gettext-1.0) +dnl Copyright (C) 1995-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -16,9 +15,7 @@ dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. +dnl From Ulrich Drepper, Bruno Haible. AC_PREREQ([2.50]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 index 73ba99a084..9ee97e3fb6 100644 --- a/m4/progtest.m4 +++ b/m4/progtest.m4 @@ -1,6 +1,6 @@ # progtest.m4 -# serial 11 (gettext-0.26) -dnl Copyright (C) 1996-2003, 2005, 2008-2026 Free Software Foundation, Inc. +# serial 12 (gettext-1.0) +dnl Copyright (C) 1996-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,8 +15,7 @@ dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. -dnl Authors: -dnl Ulrich Drepper , 1996. +dnl From Ulrich Drepper, Bruno Haible. AC_PREREQ([2.53])