[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module bison-i18n
From: |
Bruno Haible |
Subject: |
Re: new module bison-i18n |
Date: |
Fri, 18 Aug 2006 21:39:47 +0200 |
User-agent: |
KMail/1.9.1 |
Paul Eggert wrote:
> Good idea, thanks. Two minor points:
>
> > if test -n "$BISON_LOCALEDIR"; then
> > USER_LINGUAS="${LINGUAS-%UNSET%}"
> > if test -n "$USER_LINGUAS"; then
>
> What is the significance of the %UNSET% here? I.e., why is an unset
> LINGUAS treated as nonempty? Maybe a comment would help?
OK, I'm adding a comment.
> > if test -n "$YACC"; then
> > case "$YACC" in
> > *bison*)
> > if ($YACC --print-localedir) >/dev/null 2>&1; then
>
> This doesn't look quite right, since "yacc" is an alias for "bison" on
> some implementations, so "yacc --print-localedir" will work. For
> example, I've installed Bison 2.3 in my home directory, so:
>
> $ yacc -print-localedir
> /home/eggert/opt/Linux-i686/bison-2.3/share/locale
I didn't handle this case, fearing that a non-Bison yacc would create
undesired files or read from standard input or things like that. But
since you think it's safe, I'm changing it.
> How about something like the following code instead?
> It's a bit shorter and easier for me to read
... whereas I need extra comments in order to understand the intent of
such code.
I did this change, and installed it into gnulib.
Bruno
diff -u -r1.1 bison-i18n.m4
--- bison-i18n.m4 2 Aug 2006 13:33:14 -0000 1.1
+++ bison-i18n.m4 18 Aug 2006 19:30:43 -0000
@@ -1,5 +1,5 @@
-# bison-i18n.m4 serial 1 (bison-2.1)
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
+# bison-i18n.m4 serial 2
+dnl Copyright (C) 2005-2006 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.
@@ -19,38 +19,27 @@
exit 1
fi
BISON_LOCALEDIR=
+ BISON_USE_NLS=no
if test "$USE_NLS" = yes; then
+ dnl Determine bison's localedir.
dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON
variable.
- if test -n "$YACC"; then
- case "$YACC" in
- *bison*)
- if ($YACC --print-localedir) >/dev/null 2>&1; then
- BISON_LOCALEDIR=`$YACC --print-localedir`
- fi
- ;;
- esac
- else
- if test -n "$BISON"; then
- if test "$BISON" != ":"; then
- if ($BISON --print-localedir) >/dev/null 2>&1; then
- BISON_LOCALEDIR=`$BISON --print-localedir`
- fi
- fi
- fi
+ dnl But even is YACC is called "yacc", it may be a script that invokes
bison
+ dnl and accepts the --print-localedir option.
+ dnl YACC's default value is empty; BISON's default value is :.
+ if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then
+ BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir`
fi
AC_SUBST([BISON_LOCALEDIR])
if test -n "$BISON_LOCALEDIR"; then
+ dnl There is no need to enable internationalization if the user doesn't
+ dnl want message catalogs. So look at the language/locale names for
+ dnl which the user wants message catalogs. This is $LINGUAS. If unset
+ dnl or empty, he wants all of them.
USER_LINGUAS="${LINGUAS-%UNSET%}"
if test -n "$USER_LINGUAS"; then
BISON_USE_NLS=yes
- else
- BISON_USE_NLS=no
fi
- else
- BISON_USE_NLS=no
fi
- else
- BISON_USE_NLS=no
fi
if test $BISON_USE_NLS = yes; then
AC_DEFINE([YYENABLE_NLS], 1,