* gettext-runtime/install-tests/test-version.c: New file.
* gettext-runtime/install-tests/test-api.c: New file.
* gettext-runtime/install-tests/itest.pot: New file.
* gettext-runtime/install-tests/locale/en_US/LC_MESSAGES/itest.mo: New file.
* gettext-runtime/install-tests/Makefile.am: New file.
* gettext-runtime/configure.ac (INSTALLED_LIBINTL, PATH_SEPARATOR,
AUGMENT_SHLIBPATH): New variables.
(AC_CONFIG_FILES): Add install-tests/Makefile.
* gettext-runtime/Makefile.am (SUBDIRS): Add install-tests.
else
SUBDIR_libasprintf =
endif
-SUBDIRS = doc intl intl-java intl-csharp intl-d intl-modula2 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 install-tests
EXTRA_DIST = BUGS
ENABLE_SHARED="$enable_shared"
AC_SUBST([ENABLE_SHARED])
+dnl Test for features used in install-tests.
+dnl shlibpath_var and PATH_SEPARATOR are set by LT_INIT.
+if test $USE_INCLUDED_LIBINTL = yes; then
+ INSTALLED_LIBINTL="-lintl $INTL_MACOSX_LIBS"
+else
+ INSTALLED_LIBINTL=
+fi
+AC_SUBST([INSTALLED_LIBINTL])
+AC_SUBST([PATH_SEPARATOR])
+if test -n "${shlibpath_var}"; then
+ if test "${shlibpath_var}" = PATH; then
+ AUGMENT_SHLIBPATH="PATH='\$(bindir)'${PATH_SEPARATOR}\"\$\$PATH\";"
+ else
+ AUGMENT_SHLIBPATH="${shlibpath_var}='\$(libdir)':\"\$\$${shlibpath_var}\"; export ${shlibpath_var};"
+ fi
+else
+ AUGMENT_SHLIBPATH=
+fi
+AC_SUBST([AUGMENT_SHLIBPATH])
+
AC_CONFIG_SUBDIRS([intl])
AC_CONFIG_SUBDIRS([libasprintf])
AC_CONFIG_FILES([tests/Makefile])
+AC_CONFIG_FILES([install-tests/Makefile])
+
AC_OUTPUT
--- /dev/null
+## Makefile for gettext-runtime/install-tests.
+## 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.
+
+installcheck-local:
+ $(CC) -I$(includedir) -L$(libdir) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o test-version $(srcdir)/test-version.c $(INSTALLED_LIBINTL)
+ @AUGMENT_SHLIBPATH@ ./test-version
+ rm -rf test-version test-version$(EXEEXT)
+ $(CC) -I$(includedir) -L$(libdir) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ -DSRCDIR=\"$(srcdir)/\" \
+ $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o test-api $(srcdir)/test-api.c $(INSTALLED_LIBINTL)
+ @AUGMENT_SHLIBPATH@ ./test-api
+ rm -rf test-api test-api$(EXEEXT)
+ PATH='$(bindir)'@PATH_SEPARATOR@"$$PATH"; gettext --version | grep 'GNU gettext' > /dev/null
+
+EXTRA_DIST = \
+ test-version.c \
+ test-api.c locale/en_US/LC_MESSAGES/itest.mo
+CLEANFILES = \
+ test-version test-version$(EXEEXT) \
+ test-api test-api$(EXEEXT)
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# This file is distributed under the same license as the GNU gettext package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: GNU gettext 0.25\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2025-06-18 20:12+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: test-api.c:68
+msgid "She is the doppelganger of my fiancee."
+msgstr ""
--- /dev/null
+/* Test parts of the API.
+ 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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2025. */
+
+#include <libintl.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+# define ENGLISH "English_United States"
+# define ENCODING ".1252"
+
+# define LOCALE1 ENGLISH ENCODING
+
+#else
+
+# define LOCALE1 "en_US.UTF-8"
+
+#endif
+
+int
+main ()
+{
+ /* Clean up environment. */
+#if defined _WIN32 && !defined __CYGWIN__
+ _putenv ("LANGUAGE=");
+ _putenv ("OUTPUT_CHARSET=");
+#else
+ unsetenv ("LANGUAGE");
+ unsetenv ("OUTPUT_CHARSET");
+#endif
+
+ textdomain ("itest");
+
+#if defined _WIN32 && !defined __CYGWIN__
+ _putenv ("LC_ALL=" LOCALE1);
+#else
+ setenv ("LC_ALL", LOCALE1, 1);
+#endif
+ if (setlocale (LC_ALL, "") == NULL)
+ {
+ fprintf (stderr, "Skipping test: Locale %s is not installed.\n", LOCALE1);
+ return 0;
+ }
+
+ bindtextdomain ("itest", SRCDIR "locale");
+
+ bind_textdomain_codeset ("itest", "UTF-8");
+
+ const char *s = gettext ("She is the doppelganger of my fiancee.");
+ const char *expected = "She is the doppelgänger of my fiancée.";
+ if (strcmp (s, expected) != 0)
+ {
+ fprintf (stderr, "gettext() => %s\n", s);
+ fprintf (stderr, "Expected: %s\n", expected);
+ return 1;
+ }
+
+ return 0;
+}
--- /dev/null
+/* Test the version information.
+ 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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2025. */
+
+#include <libintl.h>
+
+#include <stdio.h>
+
+int
+main ()
+{
+#if defined LIBINTL_VERSION /* GNU libintl, not GNU libc */
+ if (!(libintl_version == LIBINTL_VERSION))
+ {
+ fprintf (stderr, "Installation problem: include file says version 0x%x, whereas library says version 0x%x\n",
+ LIBINTL_VERSION, libintl_version);
+ return 1;
+ }
+#endif
+
+ return 0;
+}