+2024-12-08 Bruno Haible <bruno@clisp.org>
+
+ 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 <bruno@clisp.org>
Update dependencies of modules that include "gettext.h".
# 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,
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
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.])