summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gettext-tools/tests/ChangeLog15
-rw-r--r--gettext-tools/tests/Makefile.am3
-rwxr-xr-xgettext-tools/tests/lang-bash9
-rwxr-xr-xgettext-tools/tests/lang-clisp9
-rwxr-xr-xgettext-tools/tests/lang-gawk9
-rwxr-xr-xgettext-tools/tests/lang-java9
-rwxr-xr-xgettext-tools/tests/lang-librep9
-rwxr-xr-xgettext-tools/tests/lang-php9
-rwxr-xr-xgettext-tools/tests/lang-sh9
-rw-r--r--gettext-tools/tests/testlocale.c42
10 files changed, 122 insertions, 1 deletions
diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog
index 050727d..d9fa34a 100644
--- a/gettext-tools/tests/ChangeLog
+++ b/gettext-tools/tests/ChangeLog
@@ -1,5 +1,20 @@
2003-12-05 Bruno Haible <bruno@clisp.org>
+ * testlocale.c: New file.
+ * Makefile.am (noinst_PROGRAMS): Add testlocale.
+ (testlocale_SOURCES): New variable.
+ * lang-bash: Skip the test if the testlocale program determines that
+ the locale is not usable. (For example on glibc systems with no
+ installed fr_FR locale.)
+ * lang-clisp: Likewise.
+ * lang-gawk: Likewise.
+ * lang-java: Likewise.
+ * lang-librep: Likewise.
+ * lang-php: Likewise.
+ * lang-sh: Likewise.
+
+2003-12-05 Bruno Haible <bruno@clisp.org>
+
* lang-c: Use ANSI C function declaration syntax.
* lang-objc: Likewise.
diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am
index b1c0f6a..899d29b 100644
--- a/gettext-tools/tests/Makefile.am
+++ b/gettext-tools/tests/Makefile.am
@@ -155,13 +155,14 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
LDADD = $(LDADD_@USE_INCLUDED_LIBINTL@)
LDADD_yes = ../intl/libintl.la
LDADD_no = ../intl/libgnuintl.la @LTLIBINTL@
-noinst_PROGRAMS = tstgettext tstngettext cake fc3 fc4
+noinst_PROGRAMS = tstgettext tstngettext testlocale cake fc3 fc4
tstgettext_SOURCES = tstgettext.c setlocale.c
tstgettext_CFLAGS = -DINSTALLDIR=\".\"
tstgettext_LDADD = ../lib/libgettextlib.la $(LDADD)
tstngettext_SOURCES = tstngettext.c setlocale.c
tstngettext_CFLAGS = -DINSTALLDIR=\".\"
tstngettext_LDADD = ../lib/libgettextlib.la $(LDADD)
+testlocale_SOURCES = testlocale.c
cake_SOURCES = plural-1-prg.c setlocale.c
cake_LDADD = ../lib/libgettextlib.la $(LDADD)
fc3_SOURCES = format-c-3-prg.c setlocale.c
diff --git a/gettext-tools/tests/lang-bash b/gettext-tools/tests/lang-bash
index 030e77c..0fff7e3 100755
--- a/gettext-tools/tests/lang-bash
+++ b/gettext-tools/tests/lang-bash
@@ -89,6 +89,15 @@ case `bash -c 'echo $BASH_VERSION'` in
*) rm -fr $tmpfiles; exit 77;;
esac
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
tmpfiles="$tmpfiles prog.nok prog.ok prog.out"
# Expected result when bash is built without i18n support.
cat <<\EOF > prog.nok
diff --git a/gettext-tools/tests/lang-clisp b/gettext-tools/tests/lang-clisp
index 5e1c4e8..b4700f2 100755
--- a/gettext-tools/tests/lang-clisp
+++ b/gettext-tools/tests/lang-clisp
@@ -95,6 +95,15 @@ version=`echo $version | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'`
clisp -norc -x "(sys::exit (not (>= $version 2.28)))" >/dev/null \
|| { rm -fr $tmpfiles; exit 77; }
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
tmpfiles="$tmpfiles prog.ok prog.out"
: ${DIFF=diff}
cat <<\EOF > prog.ok
diff --git a/gettext-tools/tests/lang-gawk b/gettext-tools/tests/lang-gawk
index 3d61d79..b81441d 100755
--- a/gettext-tools/tests/lang-gawk
+++ b/gettext-tools/tests/lang-gawk
@@ -89,6 +89,15 @@ case `gawk --version 2>&1 | sed -e 's/^[^0-9]*//'` in
rm -fr $tmpfiles; exit 77;;
esac
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
# Test that gawk wasn't built with --disable-nls.
: ${LOCALE_FR=fr_FR}
LANGUAGE= LC_ALL=$LOCALE_FR gawk --version | grep logiciel > /dev/null
diff --git a/gettext-tools/tests/lang-java b/gettext-tools/tests/lang-java
index e759093..fd3b87f 100755
--- a/gettext-tools/tests/lang-java
+++ b/gettext-tools/tests/lang-java
@@ -94,6 +94,15 @@ tmpfiles="$tmpfiles prog_fr.class"
: ${MSGFMT=msgfmt}
${MSGFMT} -j -d . -r prog -l fr fr.po || exit 1
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
tmpfiles="$tmpfiles prog.ok prog.out"
: ${DIFF=diff}
cat <<\EOF > prog.ok
diff --git a/gettext-tools/tests/lang-librep b/gettext-tools/tests/lang-librep
index a14e3e3..fda3e94 100755
--- a/gettext-tools/tests/lang-librep
+++ b/gettext-tools/tests/lang-librep
@@ -75,6 +75,15 @@ case `rep --version | sed -e 's/^[^0-9]*//'` in
rm -fr $tmpfiles; exit 77;;
esac
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
tmpfiles="$tmpfiles prog.ok prog.out"
: ${DIFF=diff}
cat <<\EOF > prog.ok
diff --git a/gettext-tools/tests/lang-php b/gettext-tools/tests/lang-php
index 8d2d174..f5468b8 100755
--- a/gettext-tools/tests/lang-php
+++ b/gettext-tools/tests/lang-php
@@ -71,6 +71,15 @@ case `(php -v) 2>/dev/null` in
*) rm -fr $tmpfiles; exit 77;;
esac
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
tmpfiles="$tmpfiles prog.ok prog.out"
: ${DIFF=diff}
cat <<\EOF > prog.ok
diff --git a/gettext-tools/tests/lang-sh b/gettext-tools/tests/lang-sh
index d36996d..000cfec 100755
--- a/gettext-tools/tests/lang-sh
+++ b/gettext-tools/tests/lang-sh
@@ -79,6 +79,15 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
: ${MSGFMT=msgfmt}
${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
+# Test whether the fr_FR locale is installed.
+: ${LOCALE_FR=fr_FR}
+LC_ALL=$LOCALE_FR ./testlocale
+case $? in
+ 0) ;;
+ 77) rm -fr $tmpfiles; exit 77;;
+ *) exit 1;;
+esac
+
tmpfiles="$tmpfiles prog.ok prog.out"
: ${DIFF=diff}
cat <<\EOF > prog.ok
diff --git a/gettext-tools/tests/testlocale.c b/gettext-tools/tests/testlocale.c
new file mode 100644
index 0000000..c2f814f
--- /dev/null
+++ b/gettext-tools/tests/testlocale.c
@@ -0,0 +1,42 @@
+/* testlocale - test whether the locale given by the environment is installed.
+ Copyright (C) 2003 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 2, 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, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <locale.h>
+#include <stdio.h>
+
+/* This must match intl/localename.c. */
+#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
+# define HAVE_LOCALE_NULL
+#endif
+
+int
+main (int argc, char *argv[])
+{
+/* This test must match the one in intl/localename.c. */
+#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
+ if (setlocale (LC_ALL, "") == NULL)
+ {
+ fprintf (stderr, "Couldn't set locale.\n");
+ exit (77);
+ }
+#endif
+ exit (0);
+}