[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: m4/bison-i18n.m4: add --with-bisonlocaledir to assign BISON_LOCALEDI
From: |
Bruno Haible |
Subject: |
Re: m4/bison-i18n.m4: add --with-bisonlocaledir to assign BISON_LOCALEDIR |
Date: |
Sat, 02 May 2020 17:31:39 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) |
Hi Akim,
> Someone suggested that it would be nice to force a given value
> to BISON_LOCALEDIR in ./configure. Are you interested in that?
> I'm not a huge fan of adding tons of options to configure, I would
> rather have this macro take incoming values of $BISON_LOCALEDIR,
> and of course document it with AC_ARG_VAR.
The use-case "It is helpful for user to split the native compile and
cross compile" is relevant indeed: The existing code, that looks at
`bison --print-localedir`, is nonsense for the case of cross-compilation.
On some systems, e.g. a cross-compiled guix installation, there is
no direct relation between the --prefix with which the package that
contains the BISON_I18N invocation gets configured and the --prefix
which which bison was configured. So, some additional option is needed,
by which the build system or the builder can pass on the info.
I find an option --with-bison-prefix is better than --with-bison-localedir,
because
- --with-bison-localedir is rather technical, and there is no reason not
to assume that ${bison_localedir} = ${bison_prefix}/share/locale.
- There may be the need, in the future, to access other data files from
the bison runtime as well.
Done through this patch.
2020-05-02 Bruno Haible <address@hidden>
bison-i18n: Add support for cross-compilation.
Reported by Hongxu Jia <address@hidden> in
<https://lists.gnu.org/archive/html/bison-patches/2016-02/msg00000.html>
via Akim Demaille <address@hidden>.
* m4/bison-i18n.m4 (BISON_I18N): Accept a configure option
--with-bison-prefix=PREFIX and use it to determine BISON_LOCALEDIR.
Don't use bison's --print-localedir option when cross-compiling.
Also, fix an error message and a comment.
diff --git a/m4/bison-i18n.m4 b/m4/bison-i18n.m4
index 0abdcc4..6a5c27d 100644
--- a/m4/bison-i18n.m4
+++ b/m4/bison-i18n.m4
@@ -1,4 +1,4 @@
-# bison-i18n.m4 serial 3
+# bison-i18n.m4 serial 4
dnl Copyright (C) 2005-2006, 2009-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,31 +15,46 @@ dnl and defines YYENABLE_NLS if there are bison-runtime.mo
files at all.
AC_DEFUN([BISON_I18N],
[
if test -z "$USE_NLS"; then
- echo "The BISON-I18N macro is used without being preceded by
AM-GNU-GETTEXT." 1>&2
+ echo "The BISON-I18N macro is used without being preceded by
AM-GNU-GETTEXT." | sed -e 's/-/_/g' 1>&2
exit 1
fi
BISON_LOCALEDIR=
BISON_USE_NLS=no
if test "$USE_NLS" = yes; then
dnl Determine bison's localedir.
- dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON
variable.
- dnl But even is YACC is called "yacc", it may be a script that invokes
bison
- dnl and accepts the --print-localedir option.
- dnl YACC's default value is empty; BISON's default value is :.
- if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then
- BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-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 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
+ dnl options --datarootdir and --localedir.
+ BISON_LOCALEDIR="${localedir}"
+ AC_ARG_WITH([bison-prefix],
+ [[ with-bison-prefix=DIR search for bison's runtime data in
DIR/share]],
+ [if test "X$withval" != "X" && test "X$withval" != "Xno"; then
+ BISON_LOCALEDIR="$withval/share/locale"
+ fi
+ ])
+ if test $cross_compiling != yes; then
+ dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON
+ dnl variable. But even is YACC is called "yacc", it may be a script that
+ dnl invokes bison and accepts the --print-localedir option.
+ dnl YACC's default value is empty; BISON's default value is :.
+ if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then
+ BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir`
+ fi
fi
- AC_SUBST([BISON_LOCALEDIR])
if test -n "$BISON_LOCALEDIR"; then
dnl There is no need to enable internationalization if the user doesn't
dnl want message catalogs. So look at the language/locale names for
- dnl which the user wants message catalogs. This is $LINGUAS. If unset
- dnl or empty, he wants all of them.
+ dnl which the user wants message catalogs. This is $LINGUAS. If unset,
+ dnl he wants all of them; if non-empty, he wants some of them.
USER_LINGUAS="${LINGUAS-%UNSET%}"
if test -n "$USER_LINGUAS"; then
BISON_USE_NLS=yes
fi
fi
+ AC_SUBST([BISON_LOCALEDIR])
fi
if test $BISON_USE_NLS = yes; then
AC_DEFINE([YYENABLE_NLS], [1],