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