]> Savannah Git Hosting - gnulib.git/commitdiff
bison-i18n: Improve usability.
authorBruno Haible <bruno@clisp.org>
Sun, 8 Dec 2024 16:13:00 +0000 (17:13 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 8 Dec 2024 16:33:47 +0000 (17:33 +0100)
* 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.

ChangeLog
m4/bison-i18n.m4
modules/bison-i18n

index 3e0a5ab7ee59ac89f626d592853dff3309347ad3..daed137dfe60ceee1d74c8a3fe41a89937dd0eb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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".
index e5433a686a48d3c989eb3cd98287974504fd7093..3c6be12a062af373ac63b15ab88c454b158ef95d 100644 (file)
@@ -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.])
index b2bff0fadb0a718a9a44e0e4e7f7199e32e8213a..2d36aadd5640946534b990c5c8d0af0abb18d99b 100644 (file)
@@ -6,7 +6,6 @@ m4/bison-i18n.m4
 m4/build-to-host.m4
 
 Depends-on:
-gettext
 
 configure.ac:
 BISON_I18N