> 2024-09-25  Bruno Haible  <[email protected]>
> 
>         build-to-host.m4: Add some convenience macros.

More of the same kind:


2024-10-11  Bruno Haible  <[email protected]>

        bison-i18n: Add support for mingw builds on Cygwin hosts.
        * m4/bison-i18n.m4 (BISON_I18N): Define also BISON_LOCALEDIR_c and
        BISON_LOCALEDIR_c_make.
        * modules/bison-i18n (Files): Add m4/build-to-host.m4.

2024-10-11  Bruno Haible  <[email protected]>

        build-to-host.m4: Add one more convenience macro.
        * m4/build-to-host.m4 (gl_BUILD_TO_HOST_DATADIR): New macro.

>From 886aa98d74e04c1c132f0a17ef3ee30e1e08ded2 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 11 Oct 2024 17:41:11 +0200
Subject: [PATCH 1/2] build-to-host.m4: Add one more convenience macro.

* m4/build-to-host.m4 (gl_BUILD_TO_HOST_DATADIR): New macro.
---
 ChangeLog           |  5 +++++
 m4/build-to-host.m4 | 23 ++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 0b47332948..517236fa6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-11  Bruno Haible  <[email protected]>
+
+	build-to-host.m4: Add one more convenience macro.
+	* m4/build-to-host.m4 (gl_BUILD_TO_HOST_DATADIR): New macro.
+
 2024-10-10  Bruno Haible  <[email protected]>
 
 	csharpcomp-script: Handle directories with spaces correctly.
diff --git a/m4/build-to-host.m4 b/m4/build-to-host.m4
index 2cff934f63..c416bca325 100644
--- a/m4/build-to-host.m4
+++ b/m4/build-to-host.m4
@@ -1,5 +1,5 @@
 # build-to-host.m4
-# serial 4
+# serial 5
 dnl Copyright (C) 2023-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,
@@ -107,6 +107,27 @@ AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR]
   prefix="${gl_saved_prefix}"
 ])
 
+dnl Defines datadir_c and datadir_c_make,
+dnl where datadir = $(datarootdir)
+AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR],
+[
+  dnl Find the final value of datadir.
+  gl_saved_prefix="${prefix}"
+  gl_saved_datarootdir="${datarootdir}"
+  gl_saved_datadir="${datadir}"
+  dnl Unfortunately, prefix gets only finally determined at the end of
+  dnl configure.
+  if test "X$prefix" = "XNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+  eval datarootdir="$datarootdir"
+  eval datadir="$datadir"
+  gl_BUILD_TO_HOST([datadir])
+  datadir="${gl_saved_datadir}"
+  datarootdir="${gl_saved_datarootdir}"
+  prefix="${gl_saved_prefix}"
+])
+
 dnl Defines libdir_c and libdir_c_make.
 AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR],
 [
-- 
2.34.1

>From e979e268f05361154186a64d9814d457098c4fd8 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 11 Oct 2024 17:43:02 +0200
Subject: [PATCH 2/2] bison-i18n: Add support for mingw builds on Cygwin hosts.

* m4/bison-i18n.m4 (BISON_I18N): Define also BISON_LOCALEDIR_c and
BISON_LOCALEDIR_c_make.
* modules/bison-i18n (Files): Add m4/build-to-host.m4.
---
 ChangeLog          |  7 +++++++
 m4/bison-i18n.m4   | 22 +++++++++++++++++++++-
 modules/bison-i18n |  1 +
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 517236fa6b..e56b67a268 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-11  Bruno Haible  <[email protected]>
+
+	bison-i18n: Add support for mingw builds on Cygwin hosts.
+	* m4/bison-i18n.m4 (BISON_I18N): Define also BISON_LOCALEDIR_c and
+	BISON_LOCALEDIR_c_make.
+	* modules/bison-i18n (Files): Add m4/build-to-host.m4.
+
 2024-10-11  Bruno Haible  <[email protected]>
 
 	build-to-host.m4: Add one more convenience macro.
diff --git a/m4/bison-i18n.m4 b/m4/bison-i18n.m4
index ad8c1b2edf..62aaa4f16e 100644
--- a/m4/bison-i18n.m4
+++ b/m4/bison-i18n.m4
@@ -1,5 +1,5 @@
 # bison-i18n.m4
-# serial 4
+# serial 5
 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,
@@ -56,6 +56,26 @@ AC_DEFUN([BISON_I18N]
       fi
     fi
     AC_SUBST([BISON_LOCALEDIR])
+
+    dnl Define BISON_LOCALEDIR_c and BISON_LOCALEDIR_c_make.
+    dnl Find the final value of BISON_LOCALEDIR.
+    gl_saved_prefix="${prefix}"
+    gl_saved_datarootdir="${datarootdir}"
+    gl_saved_localedir="${localedir}"
+    gl_saved_bisonlocaledir="${BISON_LOCALEDIR}"
+    dnl Unfortunately, prefix gets only finally determined at the end of
+    dnl configure.
+    if test "X$prefix" = "XNONE"; then
+      prefix="$ac_default_prefix"
+    fi
+    eval datarootdir="$datarootdir"
+    eval localedir="$localedir"
+    eval BISON_LOCALEDIR="$BISON_LOCALEDIR"
+    gl_BUILD_TO_HOST([BISON_LOCALEDIR])
+    BISON_LOCALEDIR="${gl_saved_bisonlocaledir}"
+    localedir="${gl_saved_localedir}"
+    datarootdir="${gl_saved_datarootdir}"
+    prefix="${gl_saved_prefix}"
   fi
   if test $BISON_USE_NLS = yes; then
     AC_DEFINE([YYENABLE_NLS], [1],
diff --git a/modules/bison-i18n b/modules/bison-i18n
index 0c763f1d92..b2bff0fadb 100644
--- a/modules/bison-i18n
+++ b/modules/bison-i18n
@@ -3,6 +3,7 @@ Support for internationalization of bison-generated parsers.
 
 Files:
 m4/bison-i18n.m4
+m4/build-to-host.m4
 
 Depends-on:
 gettext
-- 
2.34.1

Reply via email to