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