Here is a simple patch that fixes the conditionals when using
--gnu-make. It should be pretty easy to test with the Emacs script if
you would like to double check.

While working on another item in the TODO, I think I found a mistake
but it is hard for me to tell from diff'ing the output at the moment.

I think the two lines I've linked are referring to the same thing. The
'inctest' was changed to 'gentests' in commit
dc135c4fd14cdc219d316c61f344e64090cb33fd which is what I was working
on. Shouldn't the Python one be using 'self.emitter.tests_Makefile_am'
instead of 'self.emitter.lib_Makefile_am'?

https://git.savannah.gnu.org/cgit/gnulib.git/tree/pygnulib/GLImport.py#n1282
https://git.savannah.gnu.org/cgit/gnulib.git/tree/gnulib-tool#n6174

Collin
From ce0134f107655906963888080b6a3cb314b4ac97 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Mon, 4 Mar 2024 21:26:08 -0800
Subject: [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 40.

Follow gnulib-tool change
2021-12-18  Bruno Haible  <br...@clisp.org>
stdint: Fix handling of limits.h (regression 2021-12-16).

* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am)
(GLEmiter.tests_Makefile_am): If --gnu-make is used, assume that
AC_SUBSTed variables for conditionals are constructed by appending the
suffix '_CONDITION'.
---
 ChangeLog            | 11 +++++++++++
 gnulib-tool.py.TODO  | 13 -------------
 pygnulib/GLEmiter.py |  8 ++++----
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e6393e213d..06937dcba0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-03-04  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Follow gnulib-tool changes, part 40.
+	Follow gnulib-tool change
+	2021-12-18  Bruno Haible  <br...@clisp.org>
+	stdint: Fix handling of limits.h (regression 2021-12-16).
+	* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am)
+	(GLEmiter.tests_Makefile_am): If --gnu-make is used, assume that
+	AC_SUBSTed variables for conditionals are constructed by appending the
+	suffix '_CONDITION'.
+
 2024-03-04  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Follow gnulib-tool changes, part 39.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 1cb436d90d..72cf630b54 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -319,19 +319,6 @@ Date:   Sun Dec 19 12:49:16 2021 +0100
 
 --------------------------------------------------------------------------------
 
-commit 415fae8ddcb39d33f364c81b0f199e28c65bb539
-Author: Bruno Haible <br...@clisp.org>
-Date:   Sat Dec 18 11:43:20 2021 -0800
-
-    stdint: Fix handling of limits.h (regression 2021-12-16).
-
-    * modules/stdint (configure.ac): Revert last change.
-    * gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am):
-    If --gnu-make is used, assume that AC_SUBSTed variables for conditionals
-    are constructed by appending the suffix '_CONDITION'.
-
---------------------------------------------------------------------------------
-
 commit b8124d982f454b8526b5e11934a2f71faac2b600
 Author: Bruno Haible <br...@clisp.org>
 Date:   Wed Dec 15 21:49:41 2021 +0100
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 9435b10666..66833c4e98 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -641,7 +641,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
         module_indicator_prefix = self.config.getModuleIndicatorPrefix()
         ac_version = self.config['ac_version']
         destfile = os.path.normpath(destfile)
-        convert_to_gnu_make_1 = (re.compile(r'^if (.*)', re.MULTILINE), r'ifneq (,$(\1))')
+        convert_to_gnu_make_1 = (re.compile(r'^if (.*)', re.MULTILINE), r'ifneq (,$(\1_CONDITION))')
         emit = ''
 
         # When using GNU make, or when creating an includable Makefile.am snippet,
@@ -719,7 +719,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
                         if moduletable.isConditional(module):
                             name = module.getConditionalName()
                             if gnu_make:
-                                allsnippets += 'ifneq (,$(%s))\n' % name
+                                allsnippets += 'ifneq (,$(%s_CONDITION))\n' % name
                             else:
                                 allsnippets += 'if %s\n' % name
                     if gnu_make:
@@ -939,7 +939,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
         ac_version = self.config['ac_version']
         libtests = self.config['libtests']
         single_configure = self.config['single_configure']
-        convert_to_gnu_make_1 = (re.compile(r'^if (.*)', re.MULTILINE), r'ifneq (,$(\1))')
+        convert_to_gnu_make_1 = (re.compile(r'^if (.*)', re.MULTILINE), r'ifneq (,$(\1_CONDITION))')
         emit = ''
 
         if libtool:
@@ -1015,7 +1015,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
                         if moduletable.isConditional(module):
                             name = module.getConditionalName()
                             if gnu_make:
-                                snippet += 'ifneq (,$(%s))\n' % name
+                                snippet += 'ifneq (,$(%s_CONDITION))\n' % name
                             else:
                                 snippet += 'if %s\n' % name
                     if gnu_make:
-- 
2.44.0

Reply via email to