* gettext-tools/system-tests/Makefile.am: New file.
* gettext-tools/system-tests/README: New file.
* gettext-tools/system-tests/run-test: New file.
* gettext-tools/system-tests/testlocale.c: New file.
* gettext-tools/system-tests/intl-1-prg.c: New file.
* gettext-tools/system-tests/intl-3-prg.c: New file.
* gettext-tools/system-tests/intl-4-prg.c: New file.
* gettext-tools/system-tests/intl-5-prg.c: New file.
* gettext-tools/system-tests/intl-setlocale-1-prg.c: New file.
* gettext-tools/system-tests/intl-setlocale-2-prg.c: New file.
* gettext-tools/system-tests/intl-thread-1-prg.c: New file.
* gettext-tools/system-tests/intl-thread-2-prg.c: New file.
* gettext-tools/system-tests/intl-thread-3-prg.c: New file.
* gettext-tools/system-tests/format-c-3-prg.c: New file.
* gettext-tools/system-tests/format-c-4-prg.c: New file.
* gettext-tools/system-tests/format-c-5-prg.c: New file.
* gettext-tools/system-tests/plural-1-prg.c: New file.
* gettext-tools/Makefile.am (SUBDIRS): Add system-tests.
* gettext-tools/configure.ac (TEST_SYSTEM_LIBINTL): New conditional.
(AC_CONFIG_FILES): Add system-tests/Makefile.
* gettext-tools/tests/init.cfg: Include init-env from the tests/ directory.
* gettext-tools/tests/intl-5-prg.c: When USE_SYSTEM_LIBINTL is defined, use the
system's <libintl.h>.
* gettext-tools/tests/intl-setlocale-1-prg.c: Likewise.
* gettext-tools/tests/intl-setlocale-2-prg.c: Likewise.
* gettext-tools/tests/intl-thread-1-prg.c: Likewise.
* gettext-tools/tests/intl-thread-2-prg.c: Likewise.
* gettext-tools/tests/intl-thread-3-prg.c: Likewise.
* gettext-tools/tests/intl-1-prg.c: When USE_SYSTEM_LIBINTL is defined, use the
system's <libintl.h>.
* gettext-tools/tests/intl-3-prg.c: Likewise.
* gettext-tools/tests/intl-4-prg.c: Likewise.
* gettext-tools/tests/format-c-3-prg.c: Likewise.
* gettext-tools/tests/format-c-4-prg.c: Likewise.
* gettext-tools/tests/plural-1-prg.c: Likewise.
* gettext-tools/tests/format-c-5-prg.c: When USE_SYSTEM_LIBINTL is defined, use
the system's <libintl.h> and setenv instead of xsetenv, and no fake setlocale.
* gettext-tools/tests/format-c-3: When USE_SYSTEM_LIBINTL is defined, try
$LOCALE_FR and $LOCALE_FR_UTF8.
* gettext-tools/tests/format-c-4: Likewise.
* gettext-tools/tests/plural-1: Likewise.
* gettext-tools/tests/format-c-5: When USE_SYSTEM_LIBINTL is defined, try fa_IR
and fa_IR.UTF-8.
/gettext-tools/projects/Makefile.in
/gettext-tools/src/Makefile.in
/gettext-tools/styles/Makefile.in
+/gettext-tools/system-tests/Makefile.in
/gettext-tools/tests/Makefile.in
/gnulib-local/Makefile.in
/gettext-tools/src/Makefile
/gettext-tools/src/user-email
/gettext-tools/styles/Makefile
+/gettext-tools/system-tests/Makefile
/gettext-tools/tests/Makefile
/gettext-tools/tests/init-env
/gnulib-local/Makefile
/gettext-tools/src/gnu.gettext.DumpResource.exe
/gettext-tools/src/gnu.gettext.GetURL
/gettext-tools/src/gnu.gettext.GetURL.exe
+/gettext-tools/system-tests/cake
+/gettext-tools/system-tests/cake.exe
+/gettext-tools/system-tests/fc3
+/gettext-tools/system-tests/fc3.exe
+/gettext-tools/system-tests/fc4
+/gettext-tools/system-tests/fc4.exe
+/gettext-tools/system-tests/fc5
+/gettext-tools/system-tests/fc5.exe
+/gettext-tools/system-tests/intl-1-prg
+/gettext-tools/system-tests/intl-1-prg.exe
+/gettext-tools/system-tests/intl-3-prg
+/gettext-tools/system-tests/intl-3-prg.exe
+/gettext-tools/system-tests/intl-4-prg
+/gettext-tools/system-tests/intl-4-prg.exe
+/gettext-tools/system-tests/intl-5-prg
+/gettext-tools/system-tests/intl-5-prg.exe
+/gettext-tools/system-tests/intl-setlocale-1-prg
+/gettext-tools/system-tests/intl-setlocale-1-prg.exe
+/gettext-tools/system-tests/intl-setlocale-2-prg
+/gettext-tools/system-tests/intl-setlocale-2-prg.exe
+/gettext-tools/system-tests/intl-thread-1-prg
+/gettext-tools/system-tests/intl-thread-1-prg.exe
+/gettext-tools/system-tests/intl-thread-2-prg
+/gettext-tools/system-tests/intl-thread-2-prg.exe
+/gettext-tools/system-tests/intl-thread-3-prg
+/gettext-tools/system-tests/intl-thread-3-prg.exe
+/gettext-tools/system-tests/testlocale
+/gettext-tools/system-tests/testlocale.exe
/gettext-tools/tests/cake
/gettext-tools/tests/cake.exe
/gettext-tools/tests/fc3
# Logs generated by Automake:
/gettext-runtime/tests/*.log
/gettext-runtime/tests/*.trs
+/gettext-tools/system-tests/*.log
+/gettext-tools/system-tests/*.trs
/gettext-tools/tests/*.log
/gettext-tools/tests/*.trs
# Other.
AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
-SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples its
+SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests system-tests gnulib-tests examples its
EXTRA_DIST = misc/DISCLAIM
MOSTLYCLEANFILES = core *.stackdump
fi
AC_SUBST([TESTLIBASPRINTF])
+dnl Check whether to execute tests of the system (vendor-provided) libintl API.
+dnl We execute these tests if and only if we don't install our own libintl.
+AM_CONDITIONAL([TEST_SYSTEM_LIBINTL], [test $USE_INCLUDED_LIBINTL = no])
+
dnl Generate the version information file in the intl/ directory.
test -d intl || mkdir intl
echo "GNU gettext library from gettext-$VERSION" > intl/VERSION
AC_CONFIG_FILES([m4/Makefile])
AC_CONFIG_FILES([tests/Makefile])
-
AC_CONFIG_FILES([tests/init-env])
+AC_CONFIG_FILES([system-tests/Makefile])
+
AC_CONFIG_FILES([gnulib-tests/Makefile])
AC_OUTPUT
--- /dev/null
+## Makefile for the gettext-tools/system-tests subdirectory of GNU gettext
+## Copyright (C) 1995-2018 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.11 gnits no-dependencies color-tests
+EXTRA_DIST =
+MOSTLYCLEANFILES = core *.stackdump
+
+EXTRA_DIST += README run-test
+
+# For debugging memory leaks and memory allocation bugs.
+# You should build with --disable-shared when using valgrind.
+CHECKER =
+#CHECKER = valgrind --tool=memcheck --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes
+#CHECKER = valgrind --tool=massif --format=html --depth=10 --stacks=no
+
+TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \
+ abs_srcdir=$(abs_srcdir) \
+ abs_top_srcdir=$(abs_top_srcdir) \
+ GETTEXT="$(CHECKER) tstgettext" \
+ NGETTEXT="$(CHECKER) tstngettext" \
+ XGETTEXT="$(CHECKER) xgettext" \
+ MSGATTRIB="$(CHECKER) msgattrib" \
+ MSGCAT="$(CHECKER) msgcat" \
+ MSGCMP="$(CHECKER) msgcmp" \
+ MSGCOMM="$(CHECKER) msgcomm" \
+ MSGCONV="$(CHECKER) msgconv" \
+ MSGEN="$(CHECKER) msgen" \
+ MSGEXEC="$(CHECKER) msgexec" \
+ MSGFILTER="$(CHECKER) msgfilter" \
+ MSGFMT="$(CHECKER) msgfmt" \
+ MSGGREP="$(CHECKER) msggrep" \
+ MSGINIT="$(CHECKER) msginit" \
+ MSGMERGE="$(CHECKER) msgmerge" \
+ MSGUNFMT="$(CHECKER) msgunfmt" \
+ MSGUNIQ="$(CHECKER) msguniq" \
+ RECODE="$(CHECKER) recode" \
+ CONFIG_SHELL='$(SHELL)'
+
+LOG_COMPILER = $(SHELL) $(srcdir)/run-test
+
+# It is important that the gnulib-generated *.h files are not visible here,
+# except for config.h.
+AM_CPPFLAGS = -I..
+
+# The USE_SYSTEM_LIBINTL flag distinguishes a compilation in the system-tests/
+# directory from a compilation in the tests/ directory.
+DEFS = -DUSE_SYSTEM_LIBINTL @DEFS@
+
+if TEST_SYSTEM_LIBINTL
+
+TESTS = intl-1 intl-2 intl-3 intl-4 intl-5 \
+ intl-setlocale-1 intl-setlocale-2 \
+ intl-thread-1 intl-thread-2 intl-thread-3 \
+ format-c-3 format-c-4 format-c-5 plural-1
+.PHONY: $(TESTS)
+
+# Auxiliary programs used by the tests.
+check_PROGRAMS = testlocale intl-1-prg intl-3-prg intl-4-prg intl-5-prg intl-setlocale-1-prg intl-setlocale-2-prg intl-thread-1-prg intl-thread-2-prg intl-thread-3-prg cake fc3 fc4 fc5
+testlocale_SOURCES = testlocale.c
+intl_1_prg_SOURCES = intl-1-prg.c
+intl_3_prg_SOURCES = intl-3-prg.c
+intl_4_prg_SOURCES = intl-4-prg.c
+intl_5_prg_SOURCES = intl-5-prg.c
+intl_setlocale_1_prg_SOURCES = intl-setlocale-1-prg.c
+intl_setlocale_2_prg_SOURCES = intl-setlocale-2-prg.c
+intl_thread_1_prg_SOURCES = intl-thread-1-prg.c
+intl_thread_1_prg_CFLAGS = $(intl_thread_1_prg_CFLAGS_@HAVE_NEWLOCALE@)
+intl_thread_1_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
+intl_thread_1_prg_LDADD = $(LDADD) $(intl_thread_1_prg_LDADD_@HAVE_NEWLOCALE@)
+intl_thread_1_prg_LDADD_1 = -lpthread
+intl_thread_2_prg_SOURCES = intl-thread-2-prg.c
+intl_thread_2_prg_CFLAGS = $(intl_thread_2_prg_CFLAGS_@HAVE_NEWLOCALE@)
+intl_thread_2_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
+intl_thread_2_prg_LDADD = $(LDADD) $(intl_thread_2_prg_LDADD_@HAVE_NEWLOCALE@)
+intl_thread_2_prg_LDADD_1 = -lpthread
+intl_thread_3_prg_SOURCES = intl-thread-3-prg.c
+intl_thread_3_prg_CFLAGS = $(intl_thread_3_prg_CFLAGS_@HAVE_NEWLOCALE@)
+intl_thread_3_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
+intl_thread_3_prg_LDADD = $(LDADD) $(intl_thread_3_prg_LDADD_@HAVE_NEWLOCALE@)
+intl_thread_3_prg_LDADD_1 = -lpthread
+cake_SOURCES = plural-1-prg.c
+fc3_SOURCES = format-c-3-prg.c
+fc4_SOURCES = format-c-4-prg.c
+fc5_SOURCES = format-c-5-prg.c
+
+endif
+
+# Clean up after Solaris cc.
+clean-local:
+ rm -rf SunWS_cache
--- /dev/null
+This directory contains tests of the system (vendor-provided) libintl
+or libc.
+
+Whereas the gettext-runtime/intl/ directory is tested as part of
+gettext-tools/tests/.
--- /dev/null
+#include "../tests/format-c-3-prg.c"
--- /dev/null
+#include "../tests/format-c-4-prg.c"
--- /dev/null
+#include "../tests/format-c-5-prg.c"
--- /dev/null
+#include "../tests/intl-1-prg.c"
--- /dev/null
+#include "../tests/intl-3-prg.c"
--- /dev/null
+#include "../tests/intl-4-prg.c"
--- /dev/null
+#include "../tests/intl-5-prg.c"
--- /dev/null
+#include "../tests/intl-setlocale-1-prg.c"
--- /dev/null
+#include "../tests/intl-setlocale-2-prg.c"
--- /dev/null
+#include "../tests/intl-thread-1-prg.c"
--- /dev/null
+#include "../tests/intl-thread-2-prg.c"
--- /dev/null
+#include "../tests/intl-thread-3-prg.c"
--- /dev/null
+#include "../tests/plural-1-prg.c"
--- /dev/null
+#!/bin/sh
+# Run a test whose source and data files are located in the ../tests/ directory.
+
+srcdir="$srcdir/../tests"
+abs_srcdir="$abs_srcdir/../tests"
+USE_SYSTEM_LIBINTL=yes
+export srcdir abs_srcdir USE_SYSTEM_LIBINTL
+
+testname=`echo "$1" | sed 's,^.*/,,'`
+shift
+
+exec /bin/sh "$srcdir/$testname" "$@"
--- /dev/null
+#include "../tests/testlocale.c"
EOF
test -d fc3-dir || mkdir fc3-dir
-test -d fc3-dir/de || mkdir fc3-dir/de
-test -d fc3-dir/de/LC_MESSAGES || mkdir fc3-dir/de/LC_MESSAGES
+test -d fc3-dir/fr || mkdir fc3-dir/fr
+test -d fc3-dir/fr/LC_MESSAGES || mkdir fc3-dir/fr/LC_MESSAGES
: ${MSGFMT=msgfmt}
-${MSGFMT} -o fc3-dir/de/LC_MESSAGES/fc3.mo fc3-de.po
+${MSGFMT} -o fc3-dir/fr/LC_MESSAGES/fc3.mo fc3-de.po
: ${MSGUNFMT=msgunfmt}
-${MSGUNFMT} -o fc3-de.po.tmp fc3-dir/de/LC_MESSAGES/fc3.mo || Exit 1
+${MSGUNFMT} -o fc3-de.po.tmp fc3-dir/fr/LC_MESSAGES/fc3.mo || Exit 1
LC_ALL=C tr -d '\r' < fc3-de.po.tmp > fc3-de.po.un || Exit 1
: ${DIFF=diff}
${DIFF} fc3-de.po fc3-de.po.un || Exit 1
-LANGUAGE= ../fc3 de_DE
-result=$?
+if test -z "$USE_SYSTEM_LIBINTL"; then
+ # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+ # the test on all platforms.
-exit $result
+ LANGUAGE= ../fc3 fr_FR || Exit 1
+
+else
+ # In the system-tests/ dir: Don't use a fake setlocale.
+
+ : ${LOCALE_FR=fr_FR}
+ : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+ if test $LOCALE_FR != none; then
+ prepare_locale_ fc3-dir/fr fc3-dir/$LOCALE_FR
+ LANGUAGE= ../fc3 $LOCALE_FR || Exit 1
+ fi
+ if test $LOCALE_FR_UTF8 != none; then
+ prepare_locale_ fc3-dir/fr fc3-dir/$LOCALE_FR_UTF8
+ LANGUAGE= ../fc3 $LOCALE_FR_UTF8 || Exit 1
+ fi
+ if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no french locale is installed"
+ else
+ echo "Skipping test: no french locale is supported"
+ fi
+ Exit 77
+ fi
+
+fi
+
+Exit 0
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
-#include "xsetenv.h"
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
/* Disable the override of setlocale that libgnuintl.h activates on MacOS X
and Windows. This test relies on the fake setlocale function in
EOF
test -d fc4-dir || mkdir fc4-dir
-test -d fc4-dir/de || mkdir fc4-dir/de
-test -d fc4-dir/de/LC_MESSAGES || mkdir fc4-dir/de/LC_MESSAGES
+test -d fc4-dir/fr || mkdir fc4-dir/fr
+test -d fc4-dir/fr/LC_MESSAGES || mkdir fc4-dir/fr/LC_MESSAGES
: ${MSGFMT=msgfmt}
-${MSGFMT} -o fc4-dir/de/LC_MESSAGES/fc4.mo fc4-de.po
+${MSGFMT} -o fc4-dir/fr/LC_MESSAGES/fc4.mo fc4-de.po
: ${MSGUNFMT=msgunfmt}
-${MSGUNFMT} -o fc4-de.po.tmp fc4-dir/de/LC_MESSAGES/fc4.mo || Exit 1
+${MSGUNFMT} -o fc4-de.po.tmp fc4-dir/fr/LC_MESSAGES/fc4.mo || Exit 1
LC_ALL=C tr -d '\r' < fc4-de.po.tmp > fc4-de.po.un || Exit 1
: ${DIFF=diff}
${DIFF} fc4-de.po fc4-de.po.un || Exit 1
-LANGUAGE= ../fc4 de_DE
-result=$?
+if test -z "$USE_SYSTEM_LIBINTL"; then
+ # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+ # the test on all platforms.
-exit $result
+ LANGUAGE= ../fc4 fr_FR || Exit 1
+
+else
+ # In the system-tests/ dir: Don't use a fake setlocale.
+
+ : ${LOCALE_FR=fr_FR}
+ : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+ if test $LOCALE_FR != none; then
+ prepare_locale_ fc4-dir/fr fc4-dir/$LOCALE_FR
+ LANGUAGE= ../fc4 $LOCALE_FR || Exit 1
+ fi
+ if test $LOCALE_FR_UTF8 != none; then
+ prepare_locale_ fc4-dir/fr fc4-dir/$LOCALE_FR_UTF8
+ LANGUAGE= ../fc4 $LOCALE_FR_UTF8 || Exit 1
+ fi
+ if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no french locale is installed"
+ else
+ echo "Skipping test: no french locale is supported"
+ fi
+ Exit 77
+ fi
+
+fi
+
+Exit 0
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
-#include "xsetenv.h"
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
/* Disable the override of setlocale that libgnuintl.h activates on MacOS X
and Windows. This test relies on the fake setlocale function in
: ${DIFF=diff}
${DIFF} fa.po fa.po.un || Exit 1
-LANGUAGE= ../fc5 fa_IR
-case $? in
- 0) ;;
- 77)
+if test -z "$USE_SYSTEM_LIBINTL"; then
+ # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+ # the test on all platforms.
+
+ LANGUAGE= ../fc5 fa_IR
+ case $? in
+ 0) ;;
+ 77)
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: locale fa_IR not installed"
+ else
+ echo "Skipping test: locale fa_IR not supported"
+ fi
+ Exit 77;;
+ *) Exit 1;;
+ esac
+
+else
+ # In the system-tests/ dir: Don't use a fake setlocale.
+
+ skipped=true
+
+ prepare_locale_ fa fa_IR
+ LANGUAGE= ../fc5 fa_IR
+ case $? in
+ 0) skipped=false ;;
+ 77) ;;
+ *) Exit 1;;
+ esac
+
+ prepare_locale_ fa fa_IR.UTF-8
+ LANGUAGE= ../fc5 fa_IR.UTF-8
+ case $? in
+ 0) skipped=false ;;
+ 77) ;;
+ *) Exit 1;;
+ esac
+
+ if $skipped; then
if test -f /usr/bin/localedef; then
- echo "Skipping test: locale fa_IR not installed"
+ echo "Skipping test: no Farsi locale is installed"
else
- echo "Skipping test: locale fa_IR not supported"
+ echo "Skipping test: no Farsi locale is supported"
fi
- Exit 77;;
- *) Exit 1;;
-esac
+ Exit 77
+ fi
+
+fi
Exit 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "xsetenv.h"
/* For %Id to work, we need the real setlocale(), not the fake one. */
-#if !(__GLIBC__ >= 2 && !defined __UCLIBC__)
+#if !USE_SYSTEM_LIBINTL && !(__GLIBC__ >= 2 && !defined __UCLIBC__)
# include "setlocale.c"
#endif
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
#define _(string) gettext (string)
-test -f "./init-env" \
- && . "./init-env"
+# This file extends the init.sh (provided by gnulib).
+
+# Set environment variables for the tests.
+. ../tests/init-env
prepare_locale_ ()
{
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
-#include "xsetenv.h"
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
int
main (int argc, char *argv[])
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
-#include "xsetenv.h"
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
int
main (int argc, char *argv[])
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "xsetenv.h"
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
int
main (int argc, char *argv[])
# include <sys/resource.h>
#endif
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
int
main ()
#include <stdlib.h>
#include <stdio.h>
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
#define N_(string) string
#include <stdio.h>
#include <string.h>
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
int
main (void)
#include <pthread.h>
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
/* Name of locale to use in thread1. */
const char *locale_name_1;
#include <pthread.h>
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
/* Name of locale to use in thread1. */
const char *locale_name_1;
#include <pthread.h>
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
/* Name of locale to use in thread1. */
const char *locale_name_1;
: ${DIFF=diff}
${DIFF} plural-1-fr.po.strip plural-1-fr.po.un || Exit 1
-: ${DIFF=diff}
-echo 'un morceau de gateau' > plural-1-cake.ok
-LANGUAGE= ../cake fr 1 > plural-1-cake.tmp || Exit 1
-LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
-${DIFF} plural-1-cake.ok cake.out || Exit 1
-echo '2 morceaux de gateau' > plural-1-cake.ok
-LANGUAGE= ../cake fr 2 > plural-1-cake.tmp || Exit 1
-LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
-${DIFF} plural-1-cake.ok cake.out || Exit 1
-echo '10 morceaux de gateau' > plural-1-cake.ok
-LANGUAGE= ../cake fr 10 > plural-1-cake.tmp || Exit 1
-LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
-${DIFF} plural-1-cake.ok cake.out || Exit 1
+func_do_test ()
+{
+ echo 'un morceau de gateau' > plural-1-cake.ok
+ LANGUAGE= ../cake "$1" 1 > plural-1-cake.tmp || Exit 1
+ LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
+ ${DIFF} plural-1-cake.ok cake.out || Exit 1
+ echo '2 morceaux de gateau' > plural-1-cake.ok
+ LANGUAGE= ../cake "$1" 2 > plural-1-cake.tmp || Exit 1
+ LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
+ ${DIFF} plural-1-cake.ok cake.out || Exit 1
+ echo '10 morceaux de gateau' > plural-1-cake.ok
+ LANGUAGE= ../cake "$1" 10 > plural-1-cake.tmp || Exit 1
+ LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
+ ${DIFF} plural-1-cake.ok cake.out || Exit 1
+}
+
+if test -z "$USE_SYSTEM_LIBINTL"; then
+ # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+ # the test on all platforms.
+
+ func_do_test fr
+
+else
+ # In the system-tests/ dir: Don't use a fake setlocale.
+
+ : ${LOCALE_FR=fr_FR}
+ : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+ if test $LOCALE_FR != none; then
+ prepare_locale_ plural-1-dir/fr plural-1-dir/$LOCALE_FR
+ func_do_test $LOCALE_FR
+ fi
+ if test $LOCALE_FR_UTF8 != none; then
+ prepare_locale_ plural-1-dir/fr plural-1-dir/$LOCALE_FR_UTF8
+ func_do_test $LOCALE_FR_UTF8
+ fi
+ if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no french locale is installed"
+ else
+ echo "Skipping test: no french locale is supported"
+ fi
+ Exit 77
+ fi
+
+fi
Exit 0
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
-#include "xsetenv.h"
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
/* Disable the override of setlocale that libgnuintl.h activates on MacOS X
and Windows. This test relies on the fake setlocale function in