]>
Commit | Line | Data |
---|---|---|
6d8e724d | 1 | # bison-i18n.m4 serial 2 |
e141f4d4 | 2 | dnl Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. |
f7ab6a50 PE |
3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | |
5 | dnl with or without modifications, as long as this notice is preserved. | |
6 | ||
7 | dnl From Bruno Haible. | |
8 | ||
9 | dnl Support for internationalization of bison-generated parsers. | |
10 | ||
11 | dnl BISON_I18N | |
12 | dnl should be used in configure.ac, after AM_GNU_GETTEXT. If USE_NLS is yes, it | |
13 | dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files | |
14 | dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all. | |
15 | AC_DEFUN([BISON_I18N], | |
16 | [ | |
17 | if test -z "$USE_NLS"; then | |
18 | echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2 | |
19 | exit 1 | |
20 | fi | |
21 | BISON_LOCALEDIR= | |
6d8e724d | 22 | BISON_USE_NLS=no |
f7ab6a50 | 23 | if test "$USE_NLS" = yes; then |
6d8e724d | 24 | dnl Determine bison's localedir. |
f7ab6a50 | 25 | dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON variable. |
6d8e724d PE |
26 | dnl But even is YACC is called "yacc", it may be a script that invokes bison |
27 | dnl and accepts the --print-localedir option. | |
28 | dnl YACC's default value is empty; BISON's default value is :. | |
29 | if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then | |
30 | BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir` | |
f7ab6a50 PE |
31 | fi |
32 | AC_SUBST([BISON_LOCALEDIR]) | |
33 | if test -n "$BISON_LOCALEDIR"; then | |
6d8e724d PE |
34 | dnl There is no need to enable internationalization if the user doesn't |
35 | dnl want message catalogs. So look at the language/locale names for | |
36 | dnl which the user wants message catalogs. This is $LINGUAS. If unset | |
37 | dnl or empty, he wants all of them. | |
f7ab6a50 PE |
38 | USER_LINGUAS="${LINGUAS-%UNSET%}" |
39 | if test -n "$USER_LINGUAS"; then | |
40 | BISON_USE_NLS=yes | |
f7ab6a50 | 41 | fi |
f7ab6a50 | 42 | fi |
f7ab6a50 PE |
43 | fi |
44 | if test $BISON_USE_NLS = yes; then | |
45 | AC_DEFINE([YYENABLE_NLS], 1, | |
46 | [Define to 1 to internationalize bison runtime messages.]) | |
47 | fi | |
48 | ]) |