Skip to content

Commit

Permalink
bison-i18n: Improve usability.
Browse files Browse the repository at this point in the history
* modules/bison-i18n (Depends-on): Remove 'gettext'.
* m4/bison-i18n.m4 (BISON_I18N): Instead of bailing out if there is no
AM_GNU_GETTEXT invocation, just warn. Define BISON_LOCALEDIR also in
config.h, removing the need to do it in the Makefile.
  • Loading branch information
bhaible committed Dec 8, 2024
1 parent 66c8baa commit a7f1947
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2024-12-08 Bruno Haible <[email protected]>

bison-i18n: Improve usability.
* modules/bison-i18n (Depends-on): Remove 'gettext'.
* m4/bison-i18n.m4 (BISON_I18N): Instead of bailing out if there is no
AM_GNU_GETTEXT invocation, just warn. Define BISON_LOCALEDIR also in
config.h, removing the need to do it in the Makefile.

2024-12-08 Bruno Haible <[email protected]>

Update dependencies of modules that include "gettext.h".
Expand Down
25 changes: 18 additions & 7 deletions m4/bison-i18n.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# bison-i18n.m4
# serial 6
# serial 7
dnl Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
Expand All @@ -11,21 +11,30 @@ dnl From Bruno Haible.
dnl Support for internationalization of bison-generated parsers.

dnl BISON_I18N
dnl should be used in configure.ac, after AM_GNU_GETTEXT. If USE_NLS is yes, it
dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files
dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all.
dnl should be used in configure.ac, after AM_GNU_GETTEXT (if present).
dnl If USE_NLS is yes, it sets BISON_LOCALEDIR to indicate where to find
dnl the bison-runtime.mo files and defines YYENABLE_NLS if there are
dnl bison-runtime.mo files at all.
dnl Also it defines BISON_LOCALEDIR as macro in config.h, that expands to
dnl the corresponding C string.
AC_DEFUN([BISON_I18N],
[
if test -z "$USE_NLS"; then
echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." | sed -e 's/-/_/g' 1>&2
exit 1
m4_ifdef([AM_GNU][_GETTEXT],
[AC_MSG_WARN([[The BISON_I18N macro is used without being preceded by AM@&t@_GNU_GETTEXT.]])],
[AC_MSG_WARN([[The bison-i18n module has no effect in a package that is not internationalized.]])])
fi
BISON_LOCALEDIR=
BISON_USE_NLS=no
dnl If "$USE_NLS" is empty at this point, it means that this macro is used
dnl without being preceded by AM_GNU_GETTEXT. This is OK: it happens in
dnl packages that are not internationalized. In this case, or when the
dnl package is internationalized but the user specified --disable-nls,
dnl proceed with an empty value.
if test "$USE_NLS" = yes; then
dnl Determine bison's localedir.
dnl Generally, accept an option --with-bison-prefix=PREFIX to indicate where
dnl find bison's runtime data. Additionally, for users who have installed
dnl to find bison's runtime data. Additionally, for users who have installed
dnl bison in user directories, query the 'bison' program found in $PATH
dnl (but not when cross-compiling).
dnl Usually ${prefix}/share/locale, but can be influenced by the configure
Expand Down Expand Up @@ -79,6 +88,8 @@ AC_DEFUN([BISON_I18N],
datarootdir="${gl_saved_datarootdir}"
prefix="${gl_saved_prefix}"
AC_DEFINE_UNQUOTED([BISON_LOCALEDIR], [${BISON_LOCALEDIR_c}],
[Define to the directory where to find the localizations of the translation domain 'bison-runtime', as a C string.])
if test $BISON_USE_NLS = yes; then
AC_DEFINE([YYENABLE_NLS], [1],
[Define to 1 to internationalize bison runtime messages.])
Expand Down
1 change: 0 additions & 1 deletion modules/bison-i18n
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ m4/bison-i18n.m4
m4/build-to-host.m4

Depends-on:
gettext

configure.ac:
BISON_I18N
Expand Down

0 comments on commit a7f1947

Please sign in to comment.