]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gnulib-tool: Avoid Automake error when using --create-testdir (regr. today).
authorCollin Funk <collin.funk1@gmail.com>
Thu, 4 Sep 2025 03:18:04 +0000 (20:18 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Thu, 4 Sep 2025 03:18:04 +0000 (20:18 -0700)
* gnulib-tool.sh (func_emit_tests_Makefile_am): Initialize AM_CFLAGS and
AM_CXXFLAGS when creating a test directory.
* pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Likewise.

ChangeLog
gnulib-tool.sh
pygnulib/GLEmiter.py

index 956c4ab407ffce41300c9b406b79d6e04fbcb15d..a016eec8f07b75abad8d3bd8d440523e4ddaff95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-09-03  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool: Avoid Automake error when using --create-testdir (regr. today).
+       * gnulib-tool.sh (func_emit_tests_Makefile_am): Initialize AM_CFLAGS and
+       AM_CXXFLAGS when creating a test directory.
+       * pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Likewise.
+
 2025-09-03  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: In tests directories, augment AM_CFLAGS and AM_CXXFLAGS.
index 2e9e70036c833aed1a62961f91b18793c9e113e0..566525742ac1826da204cf9cc7c7c8289dff26d9 100755 (executable)
@@ -4458,6 +4458,14 @@ func_emit_tests_Makefile_am ()
   if ! $for_test; then
     # Enable or disable warnings as suitable for the Gnulib coding style.
     cflags_for_gnulib_code=" \$(GL_CFLAG_GNULIB_WARNINGS)"
+  else
+    # Make sure AM_CFLAGS is set or Automake will error when we append to it
+    # using '+='.
+    echo 'AM_CFLAGS ='
+    # Likewise for AM_CXXFLAGS.
+    if test -n "$uses_cxx"; then
+      echo 'AM_CXXFLAGS ='
+    fi
   fi
   # The primary place to add these options is AM_CFLAGS.
   echo "AM_CFLAGS += @GL_CFLAG_ALLOW_WARNINGS@${cflags_for_gnulib_code}"
index 4abbacb71031ff019c6900293cc72812b426b00e..c055786a037a66f042f510316cae25e2497851d0 100644 (file)
@@ -1242,6 +1242,13 @@ AC_DEFUN([%V1%_LIBSOURCES], [
         if not for_test:
             # Enable or disable warnings as suitable for the Gnulib coding style.
             cflags_for_gnulib_code = ' $(GL_CFLAG_GNULIB_WARNINGS)'
+        else:
+            # Make sure AM_CFLAGS is set or Automake will error when we append to it
+            # using '+='.
+            emit += 'AM_CFLAGS =\n'
+            # Likewise for AM_CXXFLAGS.
+            if uses_cxx:
+                emit += 'AM_CXXFLAGS =\n'
         # The primary place to add these options is AM_CFLAGS.
         emit += 'AM_CFLAGS += @GL_CFLAG_ALLOW_WARNINGS@%s\n' % (cflags_for_gnulib_code)
         if uses_cxx: