Two additional patches in this area:

2021-12-15  Bruno Haible  <br...@clisp.org>

        automake-subdir support: Support the libunistring modules.
        * m4/libunistring-base.m4 (gl_LIBUNISTRING_LIBHEADER): Use the value of
        the gl_source_base_prefix variable.

2021-12-15  Bruno Haible  <br...@clisp.org>

        automake-subdir support: Look for 'subdir-objects' also in configure.ac.
        * gnulib-tool: Look for the automake options also in the first argument
        of the AM_INIT_AUTOMAKE invocation in configure.ac.

>From b8124d982f454b8526b5e11934a2f71faac2b600 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Wed, 15 Dec 2021 21:49:41 +0100
Subject: [PATCH 1/3] automake-subdir support: Look for 'subdir-objects' also
 in configure.ac.

* gnulib-tool: Look for the automake options also in the first argument
of the AM_INIT_AUTOMAKE invocation in configure.ac.
---
 ChangeLog   |  6 ++++++
 gnulib-tool | 20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5048863fa..dafd27b66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-12-15  Bruno Haible  <br...@clisp.org>
+
+	automake-subdir support: Look for 'subdir-objects' also in configure.ac.
+	* gnulib-tool: Look for the automake options also in the first argument
+	of the AM_INIT_AUTOMAKE invocation in configure.ac.
+
 2021-12-15  Bruno Haible  <br...@clisp.org>
 
 	Add simple examples.
diff --git a/gnulib-tool b/gnulib-tool
index 70ea17a4c..0d2b7e635 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1594,7 +1594,6 @@ func_determine_path_separator
     # "autoconf --trace=AC_PREREQ" fails with an error message like this:
     #   m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
     #   autom4te: m4 failed with exit status: 1
-    prereqs=
     my_sed_traces='
       s,#.*$,,
       s,^dnl .*$,,
@@ -1621,10 +1620,25 @@ func_determine_path_separator
   # Determine whether --automake-subdir is supported.
   if $automake_subdir; then
     found_subdir_objects=false
+    if test -n "$configure_ac"; then
+      my_sed_traces='
+        s,#.*$,,
+        s,^dnl .*$,,
+        s, dnl .*$,,
+        /AM_INIT_AUTOMAKE/ {
+          s,^.*AM_INIT_AUTOMAKE([[ ]*\([^])]*\).*$,\1,p
+        }'
+      automake_options=`sed -n -e "$my_sed_traces" < "$configure_ac"`
+      for option in $automake_options; do
+        case "$option" in
+          subdir-objects ) found_subdir_objects=true ;;
+        esac
+      done
+    fi
     if test -f "${destdir:-.}"/Makefile.am; then
       automake_options=`sed -n -e 's/^AUTOMAKE_OPTIONS[	 ]*=\(.*\)$/\1/p' "${destdir:-.}"/Makefile.am`
-      for arg in $automake_options; do
-        case "$arg" in
+      for option in $automake_options; do
+        case "$option" in
           subdir-objects ) found_subdir_objects=true ;;
         esac
       done
-- 
2.25.1

>From aa4780cde60b76252e47bc6b00c111afbd2a9110 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Wed, 15 Dec 2021 23:24:48 +0100
Subject: [PATCH 3/3] automake-subdir support: Support the libunistring
 modules.

* m4/libunistring-base.m4 (gl_LIBUNISTRING_LIBHEADER): Use the value of
the gl_source_base_prefix variable.
---
 ChangeLog               | 6 ++++++
 m4/libunistring-base.m4 | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 197d497f8..1a8a8e79a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-12-15  Bruno Haible  <br...@clisp.org>
+
+	automake-subdir support: Support the libunistring modules.
+	* m4/libunistring-base.m4 (gl_LIBUNISTRING_LIBHEADER): Use the value of
+	the gl_source_base_prefix variable.
+
 2021-12-15  Bruno Haible  <br...@clisp.org>
 
 	automake-subdir support: Support arbitrary --source-base value.
diff --git a/m4/libunistring-base.m4 b/m4/libunistring-base.m4
index 657bc0ded..1c2063f57 100644
--- a/m4/libunistring-base.m4
+++ b/m4/libunistring-base.m4
@@ -1,4 +1,4 @@
-# libunistring-base.m4 serial 5
+# libunistring-base.m4 serial 6
 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -51,7 +51,11 @@ AC_DEFUN([gl_LIBUNISTRING_LIBHEADER],
   dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
   dnl gl_LIBUNISTRING_CORE if that macro has been run.
   if gl_LIBUNISTRING_VERSION_CMP([$1]); then
-    LIBUNISTRING_[]AS_TR_CPP([$2])='$2'
+    dnl It is OK to use a .h file in lib/ from within tests/, but not vice
+    dnl versa.
+    if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then
+      LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2"
+    fi
   else
     LIBUNISTRING_[]AS_TR_CPP([$2])=
   fi
-- 
2.25.1

Reply via email to