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