Bruno Haible [Sun, 16 Sep 2018 12:43:20 +0000 (14:43 +0200)]
Use newer macOS APIs when possible.
* gettext-runtime/m4/intlmacosx.m4 (gt_INTL_MACOSX): Check for
CFLocaleCopyPreferredLanguages.
* gettext-runtime/intl/langprefs.c (_nl_language_preferences_default): Use
CFLocaleCopyPreferredLanguages when it exists.
Bruno Haible [Sun, 16 Sep 2018 02:50:22 +0000 (04:50 +0200)]
libintl: Fix language preferences on macOS 10.12 or newer.
Reported by Kristian Rietveld <kris@loopnest.org> at
<https://savannah.gnu.org/bugs/?49560>.
* gettext-runtime/intl/langprefs.c (_nl_language_preferences_default): Handle
preferences elements of the form "ll-CC" in a reasonable way.
* NEWS: Mention the change.
Bruno Haible [Sun, 16 Sep 2018 01:09:06 +0000 (03:09 +0200)]
setlocale: Improve support for locales not supported by libc.
Reported by Dapeng Gao <peter@dpgao.cc> at
<https://savannah.gnu.org/bugs/?54479>.
* gettext-runtime/intl/setlocale.c: Include <stdio.h>.
(libintl_setlocale): Use a more error-tolerant strategy when the locale to be
set is not supported by libc: Emit warnings instead of failing.
Bruno Haible [Sat, 15 Sep 2018 22:26:26 +0000 (00:26 +0200)]
Reduce "make dist" time by 7 minutes.
* configure.ac (AM_INIT_AUTOMAKE): Remove dist-xz and dist-lzip options.
* Admin/release-steps: Mention how to create the tarballs with higher
compression after "make dist".
Bruno Haible [Tue, 24 Jul 2018 22:56:02 +0000 (00:56 +0200)]
Upgrade to newer help2man.
Reported by Bernhard M. Wiedemann in <https://savannah.gnu.org/bugs/?54367>.
* gettext-runtime/man/help2man: Upgrade to version 1.47.6, with one change:
$source ||= "$program $version";
replaced by
$source ||= "$package $version";
* gettext-tools/man/help2man: Likewise.
Bruno Haible [Tue, 24 Jul 2018 22:25:09 +0000 (00:25 +0200)]
Make it possible to copy&paste strings from the HTML-formatted man pages.
* gettext-runtime/man/Makefile.am (MAN2HTML_POSTPROCESS): New variable.
(gt_man2html): Use it.
* gettext-tools/man/Makefile.am (MAN2HTML_POSTPROCESS): New variable.
(gt_man2html): Use it.
Bruno Haible [Mon, 14 May 2018 18:57:34 +0000 (20:57 +0200)]
xgettext: Improve support for specialized vector syntax in Scheme.
Reported by Florent Angly <Florent.Angly@cslbehring.com>.
* gettext-tools/src/x-scheme.c (read_object): Don't call free_token on an
uninitialized token. Support recent syntax for homogeneous vector types (SRFI-4)
and byte vectors as well.
* NEWS: Mention the change.
Bruno Haible [Sat, 12 May 2018 17:58:49 +0000 (19:58 +0200)]
libintl: Ensure the *printf function overrides are POSIX compatible.
Reported by Eli Zaretskii <eliz@gnu.org>.
* gettext-runtime/intl/printf.c (USE_REPLACEMENT_CODE_ALWAYS): New macro.
(libintl_vfprintf, libintl_vsprintf, libintl_vsnprintf, libintl_vfwprintf,
libintl_vswprintf): Use it.
* NEWS: Mention the change.
Bruno Haible [Sat, 24 Mar 2018 15:20:03 +0000 (16:20 +0100)]
Add support for recent Java versions.
Reported by Emmanuel Bourg <ebourg@apache.org>
at <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892733>
via Santiago Vila.
* gettext-runtime/configure.ac: Require a Java compiler that supports
source-version 1.5 and target-version 1.6 (such as Java 6 or newer, or
GCJ 4.3 or newer).
* gettext-tools/src/write-java.c (msgdomain_write_java): Likewise
* gettext-tools/examples/hello-java-qtjambi/configure.ac: Likewise.
* gettext-tools/configure.ac: Require a Java compiler that supports
source-version 1.5 (such as Java 5 or newer, or GCJ 4.3 or newer).
* gettext-tools/examples/hello-java/configure.ac: Likewise.
* gettext-tools/examples/hello-java-awt/configure.ac: Likewise.
* gettext-tools/examples/hello-java-swing/configure.ac: Likewise.
* NEWS: Mention the change.
Bruno Haible [Sat, 6 Jan 2018 17:45:22 +0000 (18:45 +0100)]
Add support for new C++ preprocessing number tokens.
Reported by Moritz Bunkus <moritz@bunkus.org>
at <https://savannah.gnu.org/bugs/?50117>.
* gettext-tools/src/x-c.c (phase5_get): Recognize C++14 and C++17 extensions of
preprocessing number tokens.
* gettext-tools/tests/xgettext-c-22: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
* NEWS: Mention the change.
Bruno Haible [Sat, 6 Jan 2018 02:10:47 +0000 (03:10 +0100)]
xgettext: Add support for .properties files in UTF-8 encoding.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add read-file, unistr/u8-check.
* gettext-tools/src/read-properties: Read the file into memory, then find out
about its encoding, then start parsing it.
* gettext-tools/tests/xgettext-properties-2: New file.
* gettext-tools/tests/xgettext-properties-3: New file.
* gettext-tools/tests/xgettext-properties-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
* NEWS: Mention the change.
Bruno Haible [Fri, 5 Jan 2018 22:42:46 +0000 (23:42 +0100)]
Add support for .rsj files.
* gettext-tools/src/x-rst.h (EXTENSIONS_RST, SCANNERS_RST): Add RSJ scanner.
(extract_rsj): New declaration.
* gettext-tools/src/x-rst.c: Implement extraction from .rsj files.
* gettext-tools/src/xgettext.c (usage): Mention RSJ along with RST.
* gettext-tools/tests/xgettext-rst-1: New file.
* gettext-tools/tests/xgettext-rst-2: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
* gettext-tools/tests/lang-pascal: Extract from .rsj file, if the compiler
generated it.
* gettext-tools/doc/gettext.texi (RST): Mention that .rsj files are supported
as well.
* gettext-tools/doc/xgettext.texi (Choice of input file language): Mention RSJ
along with RST.
* NEWS: Mention the change.
Bruno Haible [Thu, 4 Jan 2018 09:52:13 +0000 (10:52 +0100)]
Use locales with the customary names.
On glibc systems, nowadays, the German and French locales are named
'de_DE.UTF-8' and 'fr_FR.UTF-8', respectively. This change avoids the need
to install similar locales with different names.
* gettext-tools/tests/gettext-3: Use locales with '.UTF-8' suffix.
* gettext-tools/tests/gettext-3-prg.c (lang): Likewise.
Bruno Haible [Wed, 3 Jan 2018 01:32:55 +0000 (02:32 +0100)]
Fix "make dist" of modified git checkouts.
This fixes error messages such as
tar: gettext-0.19.8.1.74-72e49-dirty/gettext-tools/gnulib-tests/test-term-ostream-xterm-linux-mandriva.out: file name is too long (max 99); not dumped
tar: gettext-0.19.8.1.74-72e49-dirty/gettext-runtime/intl-csharp/doc/GNU_Gettext_GettextResourceManager.html: file name is too long (max 99); not dumped
* configure.ac: Pass option 'tar-ustar' to AM_INIT_AUTOMAKE.
(am__tar): Use 'tar' option --format=ustar.
Bruno Haible [Tue, 2 Jan 2018 18:38:43 +0000 (19:38 +0100)]
Fix 'ar' invocation when cross-compiling and in 64-bit mode on AIX.
Reported by Benedikt Morbach <bmorbach@redhat.com>
at <https://savannah.gnu.org/bugs/?43037>.
* gettext-runtime/m4/intl.m4 (AM_INTL_SUBDIR): Require gl_PROG_AR_RANLIB if
available. Otherwise, use AC_PROG_RANLIB and set AR and ARFLAGS.
* gettext-runtime/intl/Makefile.in (AR): Use the value determined through
autoconf.
(ARFLAGS): New variable.
(libintl.a, libgnuintl.a): Use it.
* gettext-runtime/configure.ac: Invoke gl_PROG_AR_RANLIB.
* gettext-runtime/libasprintf/configure.ac: Likewise.
* gettext-tools/configure.ac: Likewise.
Bruno Haible [Sun, 24 Sep 2017 12:25:53 +0000 (14:25 +0200)]
Verify that system dependent strings in .mo files are NUL terminated.
Reported by Jakub Wilk <jwilk@jwilk.net> in
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876498>.
* gettext-runtime/intl/loadmsgcat.c (_nl_load_domain): Bail out if some of the
system-dependent strings has a last static segment that is not NUL terminated.
* gettext-tools/src/read-mo.c (get_sysdep_string): Likewise.
Bruno Haible [Sat, 15 Jul 2017 10:35:57 +0000 (12:35 +0200)]
Fix bug: gettextize does not add intlmacosx.m4 file.
Reported by Eli Zaretskii via Gavin Smith in
<http://lists.gnu.org/archive/html/bug-texinfo/2017-07/msg00026.html>.
* gettext-tools/misc/gettextize.in (m4filelist): Include intlmacosx.m4 also
when --intl option is not given.
* gettext-tools/doc/gettext.texi (aclocal): Add intlmacosx.m4 to file list.
Bruno Haible [Thu, 15 Jun 2017 20:51:11 +0000 (22:51 +0200)]
gettext.h: Update theoretical condition for use of variable size arrays.
Reported by Paul Eggert.
* gnulib-local/lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Extend
comment to include the theoretical condition for availability of variable size
arrays, if we could trust the value of __STDC_VERSION__.
Bruno Haible [Thu, 18 May 2017 23:15:33 +0000 (01:15 +0200)]
Update gettext-runtime files from gnulib.
* Makefile.am (distcheck-hook): Check also flexmember.m4, flexmember.h.
* gettext-runtime/intl/Makefile.in (SOURCES): Add flexmember.h.
* gettext-runtime/intl/flexmember.h: New file, from gnulib.
* gettext-runtime/intl/localcharset.c:
* localcharset.c (relocate2): Define fallback.
(get_charset_aliases): Invoke relocate2 instead of relocate. Free the
allocated memory.
* localcharset.c (WINDOWS_NATIVE): Don't define on Cygwin.
* localcharset.c (locale_charset) [WINDOWS_NATIVE]: Don't use the
return value from setlocale if it would lead to a buffer overrun.
* gettext-runtime/intl/localename.c:
* localename.c [__CYGWIN__]: Include <langinfo.h>, since this is
where NL_LOCALE_NAME is defined.
* localename.c (WINDOWS_NATIVE): Don't define on Cygwin.
* localename.c (gl_locale_name_thread_unsafe): Add clause for
Cygwin.
* localename.c (struct hash_node): Use FLEXIBLE_ARRAY_MEMBER.
* gettext-runtime/intl/lock.c:
* lock.c: On glibc systems without
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, use the fallback
implementation of rwlocks.
* lock.c [USE_POSIX_THREADS]
(glthread_rwlock_init_for_glibc): New function.
[USE_POSIX_THREADS] (glthread_rwlock_rdlock_multithreaded): Update
comment.
[USE_PTH_THREADS]: New implementation of rwlocks.
[USE_WINDOWS_THREADS] (glthread_rwlock_rdlock_func): Prefer writers over
readers.
* gettext-runtime/intl/lock.h:
* lock.h (pthread_rwlockattr_setkind_np): Don't declare
weak on non-glibc platforms.
* lock.h: On glibc systems without
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, use the fallback
implementation of rwlocks.
* lock.h [USE_POSIX_THREADS_WEAK]: Declare also
pthread_rwlockattr_init, pthread_rwlockattr_setkind_np,
pthread_rwlockattr_destroy weak.
* lock.h [USE_POSIX_THREADS]: Test
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlock initialization on glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlocks altogether on non-glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
[USE_PTH_THREADS]: Use a different implementation of rwlocks altogether.
* gettext-runtime/intl/relocatable.c:
* relocatable.c (relocate2): New function.
* relocatable.c (relocate): Assume pathname is non-NULL. Use
ISSLASH macro consistently. Avoid dangerous string concatenation idiom.
* gettext-runtime/intl/relocatable.h:
* relocatable.h (relocate2): New declaration/macro.
* gettext-runtime/intl/vasnprintf.c, gettext-runtime/libasprintf/vasnprintf.c:
* vasnprintf.c (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next.
* vasnprintf.c (USE_MSVC__SNPRINTF): New macro.
Everywhere, use !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF instead
of !HAVE_SNPRINTF_RETVAL_C99.
* vasnprintf.c (VASNPRINTF): Move comment down past two cpp
directives, so that it takes effect once again. This is clearly
not a proper change, and I will revert it once this bug is fixed:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817
* vasnprintf.c (IF_LINT): Treat GCC_LINT like lint.
* gettext-runtime/intl/verify.h:
* verify.h (verify) [!__GNUC__]:
Use shorter albeit meaningless string to bypass silly compiler limits.
* verify.h (assume): Treat GCC_LINT like lint.
* gettext-runtime/intl/xsize.h: Update.
* gettext-runtime/m4/Makefile.am (EXTRA_DIST): Add flexmember.m4.
* gettext-runtime/m4/extern-inline.m4: Update.
* gettext-runtime/m4/fcntl-o.m4: Update.
* gettext-runtime/m4/flexmember.m4: New file, from gnulib.
* gettext-runtime/m4/glibc2.m4: Update.
* gettext-runtime/m4/glibc21.m4: Update.
* gettext-runtime/m4/intdiv0.m4: Update.
* gettext-runtime/m4/intl.m4 (AM_INTL_SUBDIR): Require AC_C_FLEXIBLE_ARRAY_MEMBER.
* gettext-runtime/m4/intmax.m4: Update.
* gettext-runtime/m4/inttypes-pri.m4: Update.
* gettext-runtime/m4/inttypes_h.m4: Update.
* gettext-runtime/m4/lock.m4 (gl_LOCK): Invoke gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
* gettext-runtime/m4/longlong.m4: Update.
* gettext-runtime/m4/printf-posix.m4: Update.
* gettext-runtime/m4/progtest.m4: Update.
* gettext-runtime/m4/size_max.m4: Update.
* gettext-runtime/m4/stdint_h.m4: Update.
* gettext-runtime/m4/threadlib.m4 (gl_THREADLIB_BODY): Don't set
PTHREAD_IN_USE_DETECTION_HARD if configuring on Solaris 10 or newer.
Reported by Peter Felecan at <https://savannah.gnu.org/bugs/?32087>.
* gettext-runtime/m4/uintmax_t.m4: Update.
* gettext-runtime/m4/visibility.m4: Update.
* gettext-runtime/m4/wchar_t.m4: Update.
* gettext-runtime/m4/xsize.m4: Update.
* gettext-runtime/tests/test-lock.c:
* test-lock.c: On Mac OS X, use named semaphores, not unnamed
semaphores.
(USE_NAMED_SEMAPHORE, USE_UNNAMED_SEMAPHORE): New macros.
(atomic_int_semaphore): New macro.
* test-lock.c (USE_SEMAPHORE): Don't set if <semaphore.h> does not
exist.
* test-lock.c (USE_SEMAPHORE): New constant.
(struct atomic_int, init_atomic_int, get_atomic_int_value,
set_atomic_int_value) [USE_SEMAPHORE]: Define using a POSIX semaphore.
Suggested by Torvald Riegel <triegel@redhat.com>.
Bruno Haible [Mon, 15 May 2017 22:27:57 +0000 (00:27 +0200)]
Update after gnulib changed.
* gnulib-local/lib/getopt-core.h.diff: New file.
* gnulib-local/lib/getopt.in.h.diff: Remove file.
* gnulib-local/lib/unistd.in.h.diff: Update.
* gnulib-local/modules/fnmatch.diff: Update.
* gnulib-local/Makefile.am (EXTRA_DIST): Add lib/getopt-core.h.diff. Remove
lib/getopt.in.h.diff.
* gettext-runtime/m4/wint_t.m4: Update from gnulib.
* autogen.sh: In the gnulib-tool invocations, avoid gnulib test modules that
depend on 'hash' (because we use a different 'hash' module).
* .gitignore: Update.
Bruno Haible [Mon, 15 May 2017 16:22:29 +0000 (18:22 +0200)]
Respect the configure option --localedir.
Reported by Markus Gothe at https://savannah.gnu.org/bugs/index.php?49862 .
The AC_SUBSTed variable @localedir@ is supported since Autoconf 2.60.
* gettext-runtime/intl/Makefile.in (localedir): Set to @localedir@. Suggested
by Markus Gothe <nietzsche@lysator.liu.se>.
* gettext-runtime/m4/intldir.m4: Require Autoconf 2.60 or newer.
* gettext-tools/doc/gettext.texi (src/Makefile): Assume Autoconf 2.60 or newer.
Bruno Haible [Fri, 21 Apr 2017 23:40:18 +0000 (01:40 +0200)]
Avoid -Wundef warning in gettext.h.
* gnulib-local/lib/gettext.h: Test the value of ENABLE_NLS only if it is defined.
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00022.html>.
Bruno Haible [Wed, 19 Apr 2017 10:01:45 +0000 (12:01 +0200)]
PO mode: Fix recognition of C and C++ modes.
The variable 'mode-name' can contain a suffix, see
https://www.gnu.org/software/emacs/manual/html_node/ccmode/Minor-Modes.html
https://www.gnu.org/software/emacs/manual/html_node/emacs/Electric-C.html
Therefore use 'major-mode' instead of 'mode-name'.
* gettext-tools/misc/po-mode.el (po-preset-string-functions): Test major-mode,
not mode-name.
(po-mode-version-string): Bump to 2.25.
Reported at <https://savannah.gnu.org/bugs/index.php?50830>
by Peter Hull <peterhull90@gmail.com>.
Bruno Haible [Mon, 2 Jan 2017 00:00:00 +0000 (01:00 +0100)]
lock test: Fix performance problem on multi-core machines.
* gettext-runtime/tests/test-lock.c (USE_VOLATILE): New macro.
(struct atomic_int): New type.
(init_atomic_int, get_atomic_int_value, set_atomic_int_value): New
functions.
(lock_checker_done, rwlock_checker_done, reclock_checker_done): Define
as 'struct atomic_int'.
(lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock,
reclock_checker_thread, test_recursive_lock): Use the new functions.
Reported by Eric Blake in
https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html
and by Pádraig Brady in
http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html.
John Darrington [Thu, 15 Dec 2016 20:56:44 +0000 (21:56 +0100)]
msgfmt: Remove POT-Creation-Date field from the header in the output.
This helps reproducible builds.
Reported at <https://savannah.gnu.org/bugs/?49654>.
* gettext-tools/src/msgl-header.h (message_list_delete_header_field): New
declaration.
* gettext-tools/src/msgl-header.c (known_fields): New variable, extracted from
msgdomain_list_set_header_field.
(message_list_delete_header_field): New function.
* gettext-tools/src/write-mo.c: Include msgl-header.h.
(msgdomain_write_mo): Delete the POT-Creation-Date field.
* gettext-tools/src/write-java.c: Include msgl-header.h.
(msgdomain_write_java): Delete the POT-Creation-Date field.
* gettext-tools/src/write-csharp.c: Include msgl-header.h.
(msgdomain_write_csharp): Delete the POT-Creation-Date field.
* gettext-tools/src/write-resources.c: Include msgl-header.h.
(msgdomain_write_csharp_resources): Delete the POT-Creation-Date field.
* gettext-tools/src/write-tcl.c: Include msgl-header.h.
(msgdomain_write_tcl): Delete the POT-Creation-Date field.
* gettext-tools/src/write-qt.c: Include msgl-header.h.
(msgdomain_write_qt): Delete the POT-Creation-Date field.
* gettext-tools/src/write-desktop.c: Include msgl-header.h.
(msgdomain_write_desktop): Delete the POT-Creation-Date field.
* gettext-tools/src/write-xml.c: Include msgl-header.h.
(msgdomain_write_xml): Delete the POT-Creation-Date field.
* gettext-tools/tests/msgfmt-19: New file, based on
gettext-tools/tests/msgfmt-18.
* gettext-tools/tests/Makefile.am (TESTS): Add it.