]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Modula-2 support: Add the runtime library.
authorBruno Haible <bruno@clisp.org>
Thu, 24 Apr 2025 23:33:16 +0000 (01:33 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 25 Apr 2025 01:16:21 +0000 (03:16 +0200)
* 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.

16 files changed:
.gitignore
DEPENDENCIES
NEWS
PACKAGING
autogen.sh
gettext-runtime/Makefile.am
gettext-runtime/NEWS
gettext-runtime/configure.ac
gettext-runtime/intl-modula2/HACKING [new file with mode: 0644]
gettext-runtime/intl-modula2/Libintl.def.in [new file with mode: 0644]
gettext-runtime/intl-modula2/Libintl.mod [new file with mode: 0644]
gettext-runtime/intl-modula2/LibintlFromC.def [new file with mode: 0644]
gettext-runtime/intl-modula2/Makefile.am [new file with mode: 0644]
gnulib-local/Makefile.am
gnulib-local/m4/modula2.m4 [new file with mode: 0644]
gnulib-local/modules/modula2 [new file with mode: 0644]

index 6db330f677af86dd1bc96d2c6fbdd1bae7361077..e6b28d4c9338f4be37a5e67dbb02bd09acd57c74 100644 (file)
 /gettext-runtime/intl-csharp/Makefile.in
 /gettext-runtime/intl-java/Makefile.in
 /gettext-runtime/intl-d/Makefile.in
+/gettext-runtime/intl-modula2/Makefile.in
 /gettext-runtime/libasprintf/aclocal.m4
 /gettext-runtime/libasprintf/configure
 /gettext-runtime/libasprintf/config.h.in
@@ -638,6 +639,8 @@ autom4te.cache/
 /gettext-runtime/intl-csharp/Makefile
 /gettext-runtime/intl-java/Makefile
 /gettext-runtime/intl-d/Makefile
+/gettext-runtime/intl-modula2/Makefile
+/gettext-runtime/intl-modula2/Libintl.def
 /gettext-runtime/libasprintf/Makefile
 /gettext-runtime/libasprintf/config.h
 /gettext-runtime/libasprintf/libtool
@@ -703,6 +706,7 @@ autom4te.cache/
 
 # Directories generated by "make" and erased by "make clean":
 /gettext-runtime/intl/**/.libs/
+/gettext-runtime/intl-modula2/**/.libs/
 /gettext-runtime/libasprintf/**/.libs/
 /gettext-tools/libgettextpo/**/.libs/
 /gettext-tools/src/**/.libs/
@@ -717,6 +721,7 @@ autom4te.cache/
 /gettext-runtime/intl-java/**/*.class
 /gettext-runtime/intl-java/libintl.jar
 /gettext-runtime/intl-d/libintl_d.a
+/gettext-runtime/intl-modula2/libintl_m2.la
 /gettext-runtime/libasprintf/libasprintf.la
 /gettext-runtime/man/gettext.1
 /gettext-runtime/man/gettext.1.html
index e0382ab4388e7f706308637de08c3883e788a6a7..c8ee564c57f88af111065982f407bacec60e1389 100644 (file)
@@ -153,6 +153,17 @@ The following packages should be installed before GNU gettext is installed
   + If more than one D compiler is installed, set the environment variable
     DC, to disambiguate.
 
+* The GNU Modula-2 compiler and runtime.
+  + Recommended.
+    Needed for building libintl_m2.so.
+  + Homepage:
+    https://www.nongnu.org/gm2/about.html
+    https://gcc.gnu.org/
+  + Pre-built package name:
+    - On Debian and Debian-based systems: gm2,
+    - On Red Hat distributions: gcc-gm2, libgm2.
+    - Other: https://repology.org/project/gcc-gm2/versions
+
 * git 1.6 or newer
   + Recommended.
     Needed by the 'autopoint' program, if not configured with --without-git
diff --git a/NEWS b/NEWS
index fa424785d47b4db45c40a3a7f5da4dde5021ce04..1ff57871b5f442571d78e8f2c0de38d0932ee772 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@ Version 0.25 - April 2025
     - 'msgfmt -c' now verifies the syntax of translations of D format
       strings.
     - A new example 'hello-d' has been added.
+  * Modula-2:
+    - A new library libintl_m2.so contains the runtime for using GNU gettext
+      message catalogs in the Modula-2 programming language.
 
 Version 0.24.1 - April 2025
 
index 8711569296da1a778b8ba68c5b0338bbeef7f9ce..a646725d6761996318dff15f562a56baeeb21345 100644 (file)
--- a/PACKAGING
+++ b/PACKAGING
@@ -90,6 +90,9 @@ is according to the following file list.
       $prefix/include/d/gnu/libintl/libintl.d
       $prefix/include/d/gnu/libintl/internal/low.d
 
+      $prefix/lib/libintl_m2.*
+      $prefix/include/m2/Libintl.def
+
       $prefix/lib/libasprintf.*
       $prefix/include/autosprintf.h
       $prefix/share/doc/libasprintf/autosprintf*.html
index b875ce1e5e7c66fa2d6021ce97b4f3aa119685fd..7355f59e9db9b3123ad42d6dfd2d70fdb064006a 100755 (executable)
@@ -128,6 +128,8 @@ if ! $skip_gnulib; then
     java
     javacomp-script
     manywarnings
+    modula2
+    modula2comp-script
   '
   $GNULIB_TOOL --dir=gettext-runtime --lib=libgrt --source-base=gnulib-lib --m4-base=gnulib-m4 --no-libtool --local-dir=gnulib-local --local-symlink \
     --import $GNULIB_MODULES_RUNTIME_FOR_SRC $GNULIB_MODULES_RUNTIME_OTHER || exit $?
index 057df11455d8fa1e353439a2b2a8b4f41d227daa..542f8c490f95443bf16ce6ab4c789c0c82ad9e3b 100644 (file)
@@ -26,7 +26,7 @@ SUBDIR_libasprintf = libasprintf
 else
 SUBDIR_libasprintf =
 endif
-SUBDIRS = doc intl intl-java intl-csharp intl-d gnulib-lib $(SUBDIR_libasprintf) src po man m4 tests
+SUBDIRS = doc intl intl-java intl-csharp intl-d intl-modula2 gnulib-lib $(SUBDIR_libasprintf) src po man m4 tests
 
 EXTRA_DIST = BUGS
 
index dfd2b6936df1411a8bbf37ba6d2586c45e4983b3..b6ec64fdea9bcc6885e9c2b3a87ea64408cc1f3e 100644 (file)
@@ -2,6 +2,8 @@ Version 0.25 - April 2025
 
 * New library: libintl_d.a contains the runtime for using GNU gettext
   message catalogs in the D programming language.
+* New library: libintl_m2.so contains the runtime for using GNU gettext
+  message catalogs in the Modula-2 programming language.
 
 Version 0.23 - December 2023
 
index 1ab9f1e2abaff577cb6247a75f511a4156ec4f7d..2ffd37be95fc9386ac123ee083912ee6a1353e60 100644 (file)
@@ -170,6 +170,40 @@ AH_BOTTOM([
 #endif
 ])
 
+gt_MODULA2_CHOICE
+if test "$MODULA2_CHOICE" != no; then
+  gt_MODULA2COMP
+  if test -n "$M2C"; then
+    BUILDMODULA2=yes
+    AC_COMPUTE_INT([VALUE_OF_LC_ALL],      [LC_ALL],      [#include <locale.h>])
+    AC_COMPUTE_INT([VALUE_OF_LC_CTYPE],    [LC_CTYPE],    [#include <locale.h>])
+    AC_COMPUTE_INT([VALUE_OF_LC_NUMERIC],  [LC_NUMERIC],  [#include <locale.h>])
+    AC_COMPUTE_INT([VALUE_OF_LC_TIME],     [LC_TIME],     [#include <locale.h>])
+    AC_COMPUTE_INT([VALUE_OF_LC_COLLATE],  [LC_COLLATE],  [#include <locale.h>])
+    AC_COMPUTE_INT([VALUE_OF_LC_MONETARY], [LC_MONETARY], [#include <locale.h>])
+    AC_COMPUTE_INT([VALUE_OF_LC_MESSAGES], [LC_MESSAGES], [
+      #include <locale.h>
+      #if defined _WIN32 && !defined __CYGWIN__
+      # define LC_MESSAGES 1729
+      #endif
+    ])
+    AC_SUBST([VALUE_OF_LC_ALL])
+    AC_SUBST([VALUE_OF_LC_CTYPE])
+    AC_SUBST([VALUE_OF_LC_NUMERIC])
+    AC_SUBST([VALUE_OF_LC_TIME])
+    AC_SUBST([VALUE_OF_LC_COLLATE])
+    AC_SUBST([VALUE_OF_LC_MONETARY])
+    AC_SUBST([VALUE_OF_LC_MESSAGES])
+  else
+    BUILDMODULA2=no
+  fi
+else
+  BUILDMODULA2=no
+fi
+AC_SUBST([BUILDMODULA2])
+AM_CONDITIONAL([BUILD_MODULA2], [test $BUILDMODULA2 = yes])
+AM_CONDITIONAL([USE_INCLUDED_LIBINTL], [test $USE_INCLUDED_LIBINTL = yes])
+
 dnl Check for tools needed for formatting the documentation.
 ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
 AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl])
@@ -226,6 +260,9 @@ AC_CONFIG_FILES([intl-csharp/Makefile])
 
 AC_CONFIG_FILES([intl-d/Makefile])
 
+AC_CONFIG_FILES([intl-modula2/Makefile])
+AC_CONFIG_FILES([intl-modula2/Libintl.def])
+
 AC_CONFIG_FILES([gnulib-lib/Makefile])
 
 AC_CONFIG_FILES([src/Makefile])
diff --git a/gettext-runtime/intl-modula2/HACKING b/gettext-runtime/intl-modula2/HACKING
new file mode 100644 (file)
index 0000000..f608dcb
--- /dev/null
@@ -0,0 +1,81 @@
+All you need to know when hacking (modifying) this directory.
+
+
+Target platforms
+================
+
+Only GNU Modula-2 is supported. We don't care about other Modula-2
+implementations.
+
+All platforms supported by GNU Modula-2 are supported. IIRC, this
+means all platforms supported by GCC.
+
+
+Requirements
+============
+
+You will need reasonably recent versions of the build tools:
+
+* The GNU Modula-2 compiler and runtime.
+  + Homepage:
+    https://www.nongnu.org/gm2/about.html
+    https://gcc.gnu.org/
+  + Documentation:
+    https://gcc.gnu.org/onlinedocs/gm2/index.html
+  + Pre-built package name:
+    - On Debian and Debian-based systems: gm2,
+    - On Red Hat distributions: gcc-gm2, libgm2.
+    - Other: https://repology.org/project/gcc-gm2/versions
+
+
+Modula-2 dialects
+=================
+
+Essentially, there is PIM4 and ISO.
+<https://gcc.gnu.org/onlinedocs/gm2/Dialect.html>
+
+For GNU Modula-2, PIM4 is the default, and -fiso enables ISO extensions.
+
+You need to make sure that the code in this directory does not use ISO
+extensions. To do so, run
+  $ gm2 *.mod
+and
+  $ gm2 -fiso *.mod
+and verify that the result is identical in size.
+
+The ISO extensions or differences between PIM4 and ISO are essentially:
+  * Added data types LONGINT, LONGREAL, COMPLEX, LONGCOMPLEX.
+  * A LOOP control that is more general than WHILE and REPEAT.
+    An EXIT statement, like 'break' in C.
+  * Module definition syntax:
+      DEFINITION MODULE      ->  INTERFACE
+      IMPLEMENTATION MODULE  ->  IMPLEMENTATION
+  * More explicit control over visibility and re-exporting.
+  * Coroutines.
+  * Exceptions.
+  * Added and extended standard library modules.
+
+
+Language reference
+==================
+
+For PIM4: https://freepages.modula2.org/report4/modula-2.html
+
+
+Standard libraries
+==================
+
+PIM4 library reference:
+https://gcc.gnu.org/onlinedocs/gm2/Standard-procedures.html#Standard-procedures-and-functions-common-to-PIM-and-ISO
+https://gcc.gnu.org/onlinedocs/gm2/Base-libraries.html
+https://gcc.gnu.org/onlinedocs/gm2/The-PIM-system-module.html
+
+ISO library reference:
+https://gcc.gnu.org/onlinedocs/gm2/Standard-procedures.html#ISO-specific-standard-procedures-and-functions
+https://gcc.gnu.org/onlinedocs/gm2/M2-ISO-Libraries.html
+https://gcc.gnu.org/onlinedocs/gm2/The-ISO-system-module.html
+https://www.modula2.org/reference/isomodules/
+
+Implementation in GNU Modula-2:
+  - The default library is in gcc/m2/gm2-libs/.
+  - The ISO library is in gcc/m2/gm2-libs-iso/.
diff --git a/gettext-runtime/intl-modula2/Libintl.def.in b/gettext-runtime/intl-modula2/Libintl.def.in
new file mode 100644 (file)
index 0000000..db82cdb
--- /dev/null
@@ -0,0 +1,68 @@
+(* High-level Modula-2 binding to the GNU libintl library.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  *)
+
+(* Written by Bruno Haible <bruno@clisp.org>, 2025.  *)
+
+DEFINITION MODULE Libintl;
+
+FROM DynamicStrings IMPORT String;
+
+(* The values of these constants are platform-dependent. *)
+CONST LC_ALL = @VALUE_OF_LC_ALL@;
+      LC_CTYPE = @VALUE_OF_LC_CTYPE@;
+      LC_NUMERIC = @VALUE_OF_LC_NUMERIC@;
+      LC_TIME = @VALUE_OF_LC_TIME@;
+      LC_COLLATE = @VALUE_OF_LC_COLLATE@;
+      LC_MONETARY = @VALUE_OF_LC_MONETARY@;
+      LC_MESSAGES = @VALUE_OF_LC_MESSAGES@;
+
+(* const char *setlocale (int category, const char *locale); *)
+PROCEDURE SetLocale (category: INTEGER; locale: ARRAY OF CHAR);
+
+(* The *Gettext procedures return a 'String', not an 'ARRAY OF CHAR', because
+   working with 'ARRAY OF CHAR'
+     - is clumsy (manual code for copying such arrays in many places),
+     - is inefficient (copying such arrays takes time),
+     - introduces arbitrary limits on the length of such arrays. *)
+
+(* const char *gettext (const char *msgid); *)
+PROCEDURE Gettext (msgid: ARRAY OF CHAR) : String;
+
+(* const char *dgettext (const char *domainname, const char *msgid); *)
+PROCEDURE DGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR) : String;
+
+(* const char *dcgettext (const char *domainname, const char *msgid, int category); *)
+PROCEDURE DCGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR; category: INTEGER) : String;
+
+(* const char *ngettext (const char *msgid, const char *msgid_plural, unsigned long n); *)
+PROCEDURE NGettext (msgid: ARRAY OF CHAR; msgid_plural: ARRAY OF CHAR; n: CARDINAL) : String;
+
+(* const char *dngettext (const char *domainname, const char *msgid, const char *msgid_plural, unsigned long n); *)
+PROCEDURE DNGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR; msgid_plural: ARRAY OF CHAR; n: CARDINAL) : String;
+
+(* const char *dcngettext (const char *domainname, const char *msgid, const char *msgid_plural, unsigned long n, int category); *)
+PROCEDURE DCNGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR; msgid_plural: ARRAY OF CHAR; n: CARDINAL; category: INTEGER) : String;
+
+(* const char *textdomain (const char *domainname); *)
+PROCEDURE TextDomain (domainname: ARRAY OF CHAR);
+
+(* const char *bindtextdomain (const char *domainname, const char *dirname); *)
+PROCEDURE BindTextDomain (domainname: ARRAY OF CHAR; dirname: ARRAY OF CHAR);
+
+(* const char *bind_textdomain_codeset (const char *domainname, const char *codeset); *)
+PROCEDURE BindTextDomainCodeset (domainname: ARRAY OF CHAR; codeset: ARRAY OF CHAR);
+
+END Libintl.
diff --git a/gettext-runtime/intl-modula2/Libintl.mod b/gettext-runtime/intl-modula2/Libintl.mod
new file mode 100644 (file)
index 0000000..1461283
--- /dev/null
@@ -0,0 +1,104 @@
+(* High-level Modula-2 binding to the GNU libintl library.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  *)
+
+(* Written by Bruno Haible <bruno@clisp.org>, 2025.  *)
+
+IMPLEMENTATION MODULE Libintl;
+
+FROM LibintlFromC IMPORT setlocale,
+                         gettext, dgettext, dcgettext,
+                         ngettext, dngettext, dcngettext,
+                         textdomain, bindtextdomain, bind_textdomain_codeset;
+FROM DynamicStrings IMPORT InitStringCharStar, CopyOut;
+FROM SYSTEM IMPORT ADDRESS, ADR;
+
+PROCEDURE SetLocale (category: INTEGER; locale: ARRAY OF CHAR);
+VAR
+  unused: ADDRESS;
+BEGIN
+  unused := setlocale(category, ADR(locale));
+END SetLocale;
+
+PROCEDURE Gettext (msgid: ARRAY OF CHAR) : String;
+VAR
+  ret: String;
+BEGIN
+  ret := InitStringCharStar(gettext(ADR(msgid)));
+  RETURN ret;
+END Gettext;
+
+PROCEDURE DGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR) : String;
+VAR
+  ret: String;
+BEGIN
+  ret := InitStringCharStar(dgettext(ADR(domainname), ADR(msgid)));
+  RETURN ret;
+END DGettext;
+
+PROCEDURE DCGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR; category: INTEGER) : String;
+VAR
+  ret: String;
+BEGIN
+  ret := InitStringCharStar(dcgettext(ADR(domainname), ADR(msgid), category));
+  RETURN ret;
+END DCGettext;
+
+PROCEDURE NGettext (msgid: ARRAY OF CHAR; msgid_plural: ARRAY OF CHAR; n: CARDINAL) : String;
+VAR
+  ret: String;
+BEGIN
+  ret := InitStringCharStar(ngettext(ADR(msgid), ADR(msgid_plural), n));
+  RETURN ret;
+END NGettext;
+
+PROCEDURE DNGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR; msgid_plural: ARRAY OF CHAR; n: CARDINAL) : String;
+VAR
+  ret: String;
+BEGIN
+  ret := InitStringCharStar(dngettext(ADR(domainname), ADR(msgid), ADR(msgid_plural), n));
+  RETURN ret;
+END DNGettext;
+
+PROCEDURE DCNGettext (domainname: ARRAY OF CHAR; msgid: ARRAY OF CHAR; msgid_plural: ARRAY OF CHAR; n: CARDINAL; category: INTEGER) : String;
+VAR
+  ret: String;
+BEGIN
+  ret := InitStringCharStar(dcngettext(ADR(domainname), ADR(msgid), ADR(msgid_plural), n, category));
+  RETURN ret;
+END DCNGettext;
+
+PROCEDURE TextDomain (domainname: ARRAY OF CHAR);
+VAR
+  unused: ADDRESS;
+BEGIN
+  unused := textdomain(ADR(domainname));
+END TextDomain;
+
+PROCEDURE BindTextDomain (domainname: ARRAY OF CHAR; dirname: ARRAY OF CHAR);
+VAR
+  unused: ADDRESS;
+BEGIN
+  unused := bindtextdomain(ADR(domainname), ADR(dirname));
+END BindTextDomain;
+
+PROCEDURE BindTextDomainCodeset (domainname: ARRAY OF CHAR; codeset: ARRAY OF CHAR);
+VAR
+  unused: ADDRESS;
+BEGIN
+  unused := bind_textdomain_codeset(ADR(domainname), ADR(codeset));
+END BindTextDomainCodeset;
+
+END Libintl.
diff --git a/gettext-runtime/intl-modula2/LibintlFromC.def b/gettext-runtime/intl-modula2/LibintlFromC.def
new file mode 100644 (file)
index 0000000..99a7742
--- /dev/null
@@ -0,0 +1,58 @@
+(* Low-level Modula-2 binding to the GNU libintl library.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  *)
+
+(* Written by Bruno Haible <bruno@clisp.org>, 2025.  *)
+
+DEFINITION MODULE FOR "C" LibintlFromC;
+
+FROM SYSTEM IMPORT ADDRESS,
+                   CSIZE_T (* should map to 'unsigned long' *);
+
+EXPORT UNQUALIFIED setlocale,
+                   gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext,
+                   textdomain, bindtextdomain, bind_textdomain_codeset;
+
+(* const char *setlocale (int category, const char *locale); *)
+PROCEDURE setlocale (category: INTEGER; locale: ADDRESS) : ADDRESS;
+
+(* const char *gettext (const char *msgid); *)
+PROCEDURE gettext (msgid: ADDRESS) : ADDRESS;
+
+(* const char *dgettext (const char *domainname, const char *msgid); *)
+PROCEDURE dgettext (domainname: ADDRESS; msgid: ADDRESS) : ADDRESS;
+
+(* const char *dcgettext (const char *domainname, const char *msgid, int category); *)
+PROCEDURE dcgettext (domainname: ADDRESS; msgid: ADDRESS; category: INTEGER) : ADDRESS;
+
+(* const char *ngettext (const char *msgid, const char *msgid_plural, unsigned long n); *)
+PROCEDURE ngettext (msgid: ADDRESS; msgid_plural: ADDRESS; n: CSIZE_T) : ADDRESS;
+
+(* const char *dngettext (const char *domainname, const char *msgid, const char *msgid_plural, unsigned long n); *)
+PROCEDURE dngettext (domainname: ADDRESS; msgid: ADDRESS; msgid_plural: ADDRESS; n: CSIZE_T) : ADDRESS;
+
+(* const char *dcngettext (const char *domainname, const char *msgid, const char *msgid_plural, unsigned long n, int category); *)
+PROCEDURE dcngettext (domainname: ADDRESS; msgid: ADDRESS; msgid_plural: ADDRESS; n: CSIZE_T; category: INTEGER) : ADDRESS;
+
+(* const char *textdomain (const char *domainname); *)
+PROCEDURE textdomain (domainname: ADDRESS) : ADDRESS;
+
+(* const char *bindtextdomain (const char *domainname, const char *dirname); *)
+PROCEDURE bindtextdomain (domainname: ADDRESS; dirname: ADDRESS) : ADDRESS;
+
+(* const char *bind_textdomain_codeset (const char *domainname, const char *codeset); *)
+PROCEDURE bind_textdomain_codeset (domainname: ADDRESS; codeset: ADDRESS) : ADDRESS;
+
+END LibintlFromC.
diff --git a/gettext-runtime/intl-modula2/Makefile.am b/gettext-runtime/intl-modula2/Makefile.am
new file mode 100644 (file)
index 0000000..e17af97
--- /dev/null
@@ -0,0 +1,114 @@
+## Makefile for the gettext-runtime/intl-modula2 subdirectory of GNU gettext
+## Copyright (C) 2025 Free Software Foundation, Inc.
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = 1.10 gnu
+
+EXTRA_DIST =
+BUILT_SOURCES =
+MOSTLYCLEANFILES = core *.stackdump
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+SUFFIXES =
+
+RM = rm -f
+
+# Cf. <https://lists.nongnu.org/archive/html/gm2/2025-04/msg00015.html>
+# and <https://lists.nongnu.org/archive/html/gm2/2025-04/msg00022.html>
+m2includedir = $(includedir)/m2
+
+if BUILD_MODULA2
+lib_LTLIBRARIES = libintl_m2.la
+endif
+nodist_libintl_m2_la_SOURCES = Libintl.def
+libintl_m2_la_SOURCES        = Libintl.mod LibintlFromC.def
+if BUILD_MODULA2
+# What object files to include in libintl_m2.la.
+libintl_m2_la_LIBADD       = Libintl.lo
+libintl_m2_la_DEPENDENCIES = Libintl.lo
+if USE_INCLUDED_LIBINTL
+libintl_m2_la_LIBADD       += ../intl/libintl.la
+endif
+
+BUILT_SOURCES += Libintl.def
+
+# Rules for compiling a .mod file, that work even without a VPATH variable.
+AM_M2FLAGS = -I. -I$(srcdir)
+Libintl.lo: Libintl.def $(srcdir)/Libintl.mod $(srcdir)/LibintlFromC.def
+       $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(M2C) $(AM_M2FLAGS) $(M2FLAGS) -c -o $@ $(srcdir)/Libintl.mod
+
+# Libtool's library version information for libintl_m2.
+# Before making a gettext release, you must change this according to the
+# libtool documentation, section "Library interface versions".
+LTV_CURRENT=0
+LTV_REVISION=0
+LTV_AGE=0
+
+# How to build libintl_m2.la.
+libintl_m2_la_LDFLAGS = \
+  -no-undefined \
+  -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
+  -rpath $(libdir)
+
+# Installation of libintl_m2.la.
+
+install-exec-local: install-exec-libintl
+install-exec-libintl: libintl_m2.la
+       $(mkdir_p) $(DESTDIR)$(libdir)
+       $(LIBTOOL) --mode=install \
+         $(INSTALL_DATA) libintl_m2.la $(DESTDIR)$(libdir)/libintl_m2.la; \
+       if test "@RELOCATABLE@" = yes; then \
+         dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl_m2.la | sed -e "s,^',," -e "s,'\$$,,"`; \
+         if test -n "$$dependencies"; then \
+           rm -f $(DESTDIR)$(libdir)/libintl_m2.la; \
+         fi; \
+       fi
+
+installdirs-local: installdirs-libintl
+installdirs-libintl:
+       $(mkdir_p) $(DESTDIR)$(libdir)
+
+uninstall-local: uninstall-libintl
+uninstall-libintl:
+       $(LIBTOOL) --mode=uninstall \
+         rm -f $(DESTDIR)$(libdir)/libintl_m2.la
+
+
+install-data-local: install-modula2-sources
+installdirs-local: installdirs-modula2-sources
+uninstall-local: uninstall-modula2-sources
+
+install-modula2-sources:
+       $(MKDIR_P) $(DESTDIR)$(m2includedir)
+       @for f in Libintl.def; do \
+         echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(m2includedir)/$$f"; \
+         $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(m2includedir)/$$f; \
+       done
+
+installdirs-modula2-sources:
+       $(MKDIR_P) $(DESTDIR)$(m2includedir)
+
+uninstall-modula2-sources:
+       @for f in Libintl.def; do \
+         echo "$(RM) $(DESTDIR)$(m2includedir)/$$f"; \
+         $(RM) $(DESTDIR)$(m2includedir)/$$f; \
+       done
+
+endif
+
+EXTRA_DIST += HACKING
index 8006071002714c22946c941d56f6438ef0fcdbd5..9365d30564e55526a05176bbfd87eec09577ad33 100644 (file)
@@ -151,6 +151,7 @@ m4/backupfile.m4 \
 m4/d.m4 \
 m4/java.m4 \
 m4/libxml.m4 \
+m4/modula2.m4 \
 modules/backupfile \
 modules/closeout \
 modules/d \
@@ -163,6 +164,7 @@ modules/libtextstyle-dummy \
 modules/libxml \
 modules/markup \
 modules/mem-hash-map \
+modules/modula2 \
 modules/xerror \
 modules/xgetcwd.diff
 
diff --git a/gnulib-local/m4/modula2.m4 b/gnulib-local/m4/modula2.m4
new file mode 100644 (file)
index 0000000..5a6386a
--- /dev/null
@@ -0,0 +1,20 @@
+# modula2.m4
+# serial 1
+dnl Copyright (C) 2025 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.
+dnl This file is offered as-is, without any warranty.
+
+# Sets MODULA2_CHOICE to 'yes' or 'no', depending on the preferred use of
+# Modula-2.
+AC_DEFUN([gt_MODULA2_CHOICE],
+[
+  AC_MSG_CHECKING([whether to use Modula-2])
+  AC_ARG_ENABLE(modula2,
+    [  --disable-modula2       do not build Modula-2 sources],
+    [MODULA2_CHOICE="$enableval"],
+    [MODULA2_CHOICE=yes])
+  AC_MSG_RESULT([$MODULA2_CHOICE])
+  AC_SUBST([MODULA2_CHOICE])
+])
diff --git a/gnulib-local/modules/modula2 b/gnulib-local/modules/modula2
new file mode 100644 (file)
index 0000000..8225189
--- /dev/null
@@ -0,0 +1,20 @@
+Description:
+Find user preferences regarding the use of Modula-2.
+
+Files:
+m4/modula2.m4
+
+Depends-on:
+
+configure.ac:
+gt_MODULA2_CHOICE
+
+Makefile.am:
+
+Include:
+
+License:
+GPL
+
+Maintainer:
+Bruno Haible