From: Bruno Haible Date: Sun, 8 Dec 2024 16:13:00 +0000 (+0100) Subject: bison-i18n: Improve usability. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a7f194718b36fab1f212316edf9aefff3b323577;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 3e0a5ab7ee..daed137dfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-12-08 Bruno Haible + + 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 Update dependencies of modules that include "gettext.h". diff --git a/m4/bison-i18n.m4 b/m4/bison-i18n.m4 index e5433a686a..3c6be12a06 100644 --- a/m4/bison-i18n.m4 +++ b/m4/bison-i18n.m4 @@ -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, @@ -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 @@ -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.]) diff --git a/modules/bison-i18n b/modules/bison-i18n index b2bff0fadb..2d36aadd56 100644 --- a/modules/bison-i18n +++ b/modules/bison-i18n @@ -6,7 +6,6 @@ m4/bison-i18n.m4 m4/build-to-host.m4 Depends-on: -gettext configure.ac: BISON_I18N