Bruno Haible [Tue, 1 Jul 2025 14:50:52 +0000 (16:50 +0200)]
autopoint: Don't fail if no gettext version is specified, part 2.
* gettext-tools/misc/autopoint.in (func_trace_sed): Recognize also macro calls
without arguments.
* gettext-tools/tests/autopoint-1: Update for new autopoint behaviour.
* gettext-tools/misc/autopoint.in: Instead of failing with "Missing version",
use version 0.23.1. Set omitintl=yes if there is no AM_GNU_GETTEXT invocation.
Bruno Haible [Thu, 5 Jun 2025 19:37:08 +0000 (21:37 +0200)]
build: Fix "make install" in MSVC builds with --enable-shared.
The problem was that intl-8.dll was not installed with execute permissions.
* gettext-runtime/intl/Makefile.am (install-exec-libintl): Use $(INSTALL),
not $(INSTALL_DATA), with libtool --mode=install.
* INSTALL.windows: Remove constraint to use --disable-shared on MSVC.
Thanks to Kirill Makurin <maiddaisuki@outlook.com> for fruitful discussions.
* autogen.sh: Among the gnulib-tests, avoid the modules array-map-tests,
array-oset-tests, carray-list-tests, and uninorm/decomposing-form-tests, since
they use variables from libgettextlib.
* gettext-tools/configure.ac (GL_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME): New
variable.
(WOE32DLL): New C macro.
(DLL_VARIABLE): On MSVC with --enable-shared, define to '__declspec(dllexport)'
when compiling libgettextlib, and define to '__declspec(dllimport)' when
compiling the programs in src/.
(LIBGETTEXTSRC_DLL_VARIABLE): New C macro.
* gettext-tools/gnulib-lib/Makefile.am (AM_CPPFLAGS): Define the C macro
IN_LIBGETTEXTLIB.
* gettext-tools/src/Makefile.am (libgettextsrc_la_CPPFLAGS): Define the C macro
IN_LIBGETTEXTSRC.
* gettext-tools/src/format.h: Use LIBGETTEXTSRC_DLL_VARIABLE instead of
DLL_VARIABLE.
* gettext-tools/src/message.h: Likewise.
* gettext-tools/src/msgl-cat.h: Likewise.
* gettext-tools/src/plural-table.h: Likewise.
* gettext-tools/src/po-charset.h: Likewise.
* gettext-tools/src/po-error.h: Likewise.
* gettext-tools/src/read-catalog.h: Likewise.
* gettext-tools/src/read-po.h: Likewise.
* gettext-tools/src/read-properties.h: Likewise.
* gettext-tools/src/read-stringtable.h: Likewise.
* gettext-tools/src/sentence.h: Likewise.
* gettext-tools/src/write-po.h: Likewise.
* gettext-tools/src/write-properties.h: Likewise.
* gettext-tools/src/write-stringtable.h: Likewise.
* gettext-tools/src/xerror-handler.h: Likewise.
* gettext-tools/libgettextpo/Makefile.am (config.h): Override the value of
LIBGETTEXTSRC_DLL_VARIABLE.
* gettext-runtime/configure.ac (WOE32DLL): New C macro.
(DLL_VARIABLE): Define to empty always.
Bruno Haible [Wed, 7 May 2025 16:07:15 +0000 (18:07 +0200)]
examples: Use infrastructure from gettext version 0.25.
* gettext-tools/examples/hello-*/configure.ac: Use AM_GNU_GETTEXT_VERSION with
version 0.25.
* gettext-tools/examples/hello-c++-kde/configure.in.in: Likewise.
Bruno Haible [Sun, 4 May 2025 23:50:26 +0000 (01:50 +0200)]
build: Avoid possible problems due to AC_REQUIRE in if/else branches.
* gettext-runtime/configure.ac: Use AS_IF when at least one of the if/else
branches invokes a complicated Autoconf macro.
* gettext-tools/configure.ac: Likewise.
Bruno Haible [Sun, 4 May 2025 15:31:11 +0000 (17:31 +0200)]
Avoid some clang -Wthread-safety-analysis warnings.
* gettext-tools/src/x-typescript-impl.h (sbru_init): Declare with
_GL_ATTRIBUTE_ACQUIRE_CAPABILITY.
(sbru_xdupfree_c): Declare with _GL_ATTRIBUTE_RELEASE_CAPABILITY.
Bruno Haible [Sun, 4 May 2025 14:42:38 +0000 (16:42 +0200)]
xgettext: Allow ignoring specific files in the POT-Creation-Date computation.
Reported by Vaclav Slavik <vaclav@slavik.io>
at <https://savannah.gnu.org/users/vslavik>.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add hashkey-string, set.
* gettext-tools/src/xgettext.c: Include gl_set.h, gl_xset.h, gl_hash_set.h,
hashkey-string.h.
(generated_files): New variables.
(long_options): New option '--generated'.
(main): Initialize generated_files. Handle the option '--generated'.
(usage): Document the option '--generated'.
(finalize_header): Filter out the generated_files from the file list.
* gettext-tools/doc/xgettext.texi: Document the option '--generated'.
* gettext-tools/tests/xgettext-git-1: Test the --generated option.
* NEWS: Mention the new option.
Bruno Haible [Sat, 3 May 2025 11:08:11 +0000 (13:08 +0200)]
doc: Clarify that the minimum needed GCC version is 4.4.
Rationale: With GCC version 4.1.2 or 4.2.1, all tree-sitter based extractors
in xgettext crash at runtime when compiled with optimization. Whereas
GCC 4.4.7 works fine.
Bruno Haible [Fri, 2 May 2025 15:02:17 +0000 (17:02 +0200)]
xgettext: Give a hint about --no-git when max_vc_mtime() took more than 10 sec.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add getrusage.
* gettext-tools/src/xgettext.c: Include <sys/resource.h>.
(max_mtime): New function.
(finalize_header): Invoke it.
Bruno Haible [Fri, 2 May 2025 14:06:45 +0000 (16:06 +0200)]
xgettext: Add an option to opt-out of the use of git for the POT-Creation-Date.
Reported by Serhii Tereshchenko at <https://savannah.gnu.org/bugs/?66865>.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add stat-time.
* gettext-tools/src/xgettext.c: Include stat-time.h.
(xgettext_no_git): New variable.
(long_options): Add option '--no-git'.
(main): Handle the option --no-git.
(usage): Document the option --no-git.
(struct accumulator): New type, copied from gnulib/lib/vc-mtime.c.
(accumulate): New function, copied from gnulib/lib/vc-mtime.c.
(max_mtime_without_git): New function, based on gnulib/lib/vc-mtime.c.
(finalize_header): Conditionally invoke max_mtime_without_git instead of
max_vc_mtime.
* gettext-tools/doc/xgettext.texi: Document the option --no-git.
* NEWS: Mention the change.
Bruno Haible [Fri, 25 Apr 2025 12:29:20 +0000 (14:29 +0200)]
Modula-2 support: Fix VPATH builds.
* gettext-runtime/intl-modula2/Makefile.am (install-modula2-sources): Take
Libintl.def from the build dir, not from the source dir.
* gettext-tools/tests/lang-modula2: Search for Libintl.def in the build dir,
not in the source dir.
Bruno Haible [Thu, 24 Apr 2025 23:33:16 +0000 (01:33 +0200)]
Modula-2 support: Add the runtime library.
* gnulib-local/m4/modula2.m4: New file.
* gnulib-local/modules/modula2: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Add modula2.m4 and the 'modula2'
module.
* autogen.sh (GNULIB_MODULES_RUNTIME_OTHER): Add modula2, modula2comp-script.
* gettext-runtime/intl-modula2/Libintl.def.in: New file.
* gettext-runtime/intl-modula2/Libintl.mod: New file.
* gettext-runtime/intl-modula2/LibintlFromC.def: New file.
* gettext-runtime/intl-modula2/Makefile.am: New file.
* gettext-runtime/intl-modula2/HACKING: New file.
* gettext-runtime/configure.ac: Invoke gt_MODULA2_CHOICE, gt_MODULA2COMP.
Determine VALUE_OF_LC_* for each LC_* constant. Set the variable BUILDMODULA2
and the Automake conditional BUILD_MODULA2.
* gettext-runtime/Makefile.am (SUBDIRS): Add intl-modula2.
* NEWS: Mention libintl_m2.so.
* gettext-runtime/NEWS: Likewise.
* PACKAGING: Add the interface and binary for the libintl_m2 library.
* DEPENDENCIES: Mention the Modula-2 compiler and runtime.
Bruno Haible [Wed, 23 Apr 2025 17:50:04 +0000 (19:50 +0200)]
xgettext: D: Allow comments between the parts of concatenated string literals.
* gettext-tools/src/x-d.c (is_add_expression_with_tilde): New function.
(is_string_literal, string_literal_accumulate_pieces): Use it.
* gettext-tools/tests/xgettext-d-2: Add another test case regarding string
concatenation.
Bruno Haible [Wed, 2 Apr 2025 12:07:39 +0000 (14:07 +0200)]
gettextize: Fix bad interactions between autoreconf and autopoint.
Reported by Sebastian Pipping <sebastian@pipping.org>
in <https://savannah.gnu.org/bugs/index.php?66968>.
* gettext-tools/m4/Makefile.am (aclocaldir): Remove variable.
(pkgdatadir, macrosdir): Add variables.
(macros_DATA): Renamed from aclocal_DATA.
(install-data-local, uninstall-local, uninstall-macros): New targets.
* gettext-tools/misc/gettextize.in: Copy the *.m4 files from
$datadir/gettext/m4, not from $datadir/aclocal.
* gettext-tools/doc/gettext.texi (aclocal): Don't recommend to add option
--install to ACLOCAL_MFLAGS. Instead, recommend one-time use of --system-acdir.
* PACKAGING: Expect *.m4 files in $prefix/share/gettext/m4, not in
$prefix/share/aclocal.
* NEWS: Mention the fix.
Bruno Haible [Tue, 1 Apr 2025 09:51:08 +0000 (11:51 +0200)]
D support: Add D support in the tools.
* autopull.sh: Check out tree-sitter-d. Set TREE_SITTER_D_VERSION.
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add unistr/u16-check,
unistr/u16-to-u8, unistr/u32-check, unistr/u32-to-u8.
* gettext-tools/build-aux/tree-sitter-d-portability.diff: New file.
* gettext-tools/configure.ac: Set TREE_SITTER_D_VERSION.
* gettext-tools/Makefile.am (EXTRA_DIST): Add the tree-sitter-d source code and
patch.
* gettext-tools/doc/lang-d.texi: New file.
* gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add it.
* gettext-tools/doc/gettext.texi (PO Files): Mention d-format.
(No string concatenation): Mention string concatenation and string interpolation
in D.
(Translators for other Languages): New subsection "D Format Strings".
(List of Programming Languages): Include lang-d.texi.
* gettext-tools/doc/xgettext.texi: Document the -L D option.
* gettext-tools/src/message.h (format_d): New enum value.
(NFORMATS): Increment.
* gettext-tools/src/message.c (format_language, format_language_pretty): Add an
entry for format_d.
* gettext-tools/src/format-d.c: New file, based on
gettext-tools/src/format-lisp.c.
* gettext-tools/src/format.h (formatstring_d): New declaration.
* gettext-tools/src/format.c (formatstring_parsers): Add formatstring_d.
* gettext-tools/src/x-d.h: New file.
* gettext-tools/src/x-d.c: New file, based on gettext-tools/src/x-rust.c and
gettext-tools/src/x-go.c.
* gettext-tools/src/html5-entities.h: New file.
* gettext-tools/src/xgettext.c: Include x-d.h.
(flag_table_d): New variable.
(main): Invoke init_flag_table_d, x_d_extract_all, x_d_keyword.
(usage): Document the -L D option.
(xgettext_record_flag): Support format_d.
(language_to_extractor, extension_to_language): Support D.
* gettext-tools/src/xg-message.c (decide_is_format, remember_a_message_plural):
Add better heuristic for c-format and d-format.
* gettext-tools/src/FILES: Mention format-d.c, x-d.h, x-d.c, html5-entities.h.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add x-d.h, html5-entities.h.
(FORMAT_SOURCE): Add format-d.c.
(libxgettextts2_a_SOURCES): Add d-parser.c, d-scanner.c.
(xgettext_SOURCES): Add x-d.c.
* gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add
format-d.c.
* gettext-tools/po/POTFILES.in: Add src/format-d.c, src/x-d.c.
* gettext-tools/woe32dll/gettextsrc-exports.c: Export formatstring_d.
* gettext-tools/tests/format-d-1: New file.
* gettext-tools/tests/format-d-2: New file.
* gettext-tools/tests/xgettext-d-1: New file.
* gettext-tools/tests/xgettext-d-2: New file.
* gettext-tools/tests/xgettext-d-3: New file.
* gettext-tools/tests/xgettext-d-4: New file.
* gettext-tools/tests/xgettext-d-5: New file, based on
gettext-tools/tests/xgettext-rust-5.
* gettext-tools/tests/xgettext-d-6: New file, based on
gettext-tools/tests/xgettext-rust-7.
* gettext-tools/tests/testdata/dprog.utf-8.d: New file.
* gettext-tools/tests/testdata/dprog.utf-8+bom.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-16be.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-16le.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-32be.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/testdata/dprog.utf-32le.d: New file, based on
gettext-tools/tests/testdata/dprog.utf-8.d.
* gettext-tools/tests/Makefile.am (TESTS): Add the new tests.
(EXTRA_DIST): Add the new testdata files.
* NEWS: Mention the D support.
Bruno Haible [Tue, 1 Apr 2025 00:18:40 +0000 (02:18 +0200)]
D support: Add the runtime library.
* gnulib-local/m4/d.m4: New file.
* gnulib-local/modules/d: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Add d.m4 and the 'd' module.
* autogen.sh (GNULIB_MODULES_RUNTIME_OTHER): Add d, dcomp-script.
* gettext-runtime/intl-d/Makefile.am: New file.
* gettext-runtime/intl-d/gnu/libintl/package.d: New file.
* gettext-runtime/intl-d/gnu/libintl/libintl.d: New file.
* gettext-runtime/intl-d/gnu/libintl/internal/low.d: New file.
* gettext-runtime/configure.ac: Invoke gt_D_CHOICE, gt_DCOMP. Set the variable
BUILDD and the Automake conditional BUILD_D.
* gettext-runtime/Makefile.am (SUBDIRS): Add intl-d.
* NEWS: Mention libintl_d.a.
* gettext-runtime/NEWS: Likewise.
* PACKAGING: Add the sources and binary for the libintl_d library.
* DEPENDENCIES: Mention the D compiler and runtime.
Bruno Haible [Tue, 25 Mar 2025 21:38:49 +0000 (22:38 +0100)]
doc: Small updates.
Reported by Michael Chirico <michaelchirico4@gmail.com>.
* gettext-tools/doc/gettext.texi (The LANGUAGE variable): Rephrase
recommendation for Norwegian users.
(Header Entry): Remove statement about old versions of Emacs.
Bruno Haible [Sat, 22 Mar 2025 12:20:36 +0000 (13:20 +0100)]
Update after gnulib changed.
* gettext-runtime/intl/setlocale.c: Include setlocale-fixes.h instead of
setlocale-messages.h.
(setlocale_unixlike) [__ANDROID__]: Use setlocale_fixed instead of setlocale.
(setlocale_improved): On Android, use setlocale_fixed_null instead of setlocale.
Bruno Haible [Fri, 21 Mar 2025 18:44:33 +0000 (19:44 +0100)]
Work around an strtoul() misfeature.
* gettext-runtime/src/ngettext.c: Include <ctype.h>.
(main): When parsing a nonnegative number, disallow leading whitespace and sign.
* gettext-tools/tests/tstngettext.c: Include <ctype.h>.
(worker_thread): When parsing a nonnegative number, disallow leading whitespace
and sign.
* gnulib-local/lib/markup.c (unescape_string_inplace): When parsing a numeric
character entity, disallow leading whitespace and sign, and report a too large
number as "non-permitted character" rather than "Numerical result out of range".
* gettext-tools/src/msgfmt.c (main): When parsing the '-a' argument, disallow
leading whitespace and sign and check whether the value is a power of 2.
* gettext-tools/src/read-stringtable.c: Include c-ctype.h.
(comment_line_end): When parsing a line number, disallow leading whitespace and
sign.