1# bison-i18n.m4 serial 2 2 3dnl Copyright (C) 2005-2006, 2009-2015, 2018-2021 Free Software 4dnl Foundation, Inc. 5 6dnl This file is free software; the Free Software Foundation 7dnl gives unlimited permission to copy and/or distribute it, 8dnl with or without modifications, as long as this notice is preserved. 9 10dnl From Bruno Haible. 11 12dnl Support for internationalization of bison-generated parsers. 13 14dnl BISON_I18N 15dnl should be used in configure.ac, after AM_GNU_GETTEXT. If USE_NLS is yes, it 16dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files 17dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all. 18AC_DEFUN([BISON_I18N], 19[ 20 if test -z "$USE_NLS"; then 21 echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2 22 exit 1 23 fi 24 BISON_LOCALEDIR= 25 BISON_USE_NLS=no 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` 34 fi 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 43 BISON_USE_NLS=yes 44 fi 45 fi 46 fi 47 if test $BISON_USE_NLS = yes; then 48 AC_DEFINE([YYENABLE_NLS], 1, 49 [Define to 1 to internationalize bison runtime messages.]) 50 fi 51]) 52