From: Collin Funk Date: Thu, 4 Sep 2025 03:18:04 +0000 (-0700) Subject: gnulib-tool: Avoid Automake error when using --create-testdir (regr. today). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e676bbade56be51db3ad65c5ca1c5f3f6aa2c8c;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 956c4ab407..a016eec8f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-09-03 Collin Funk + + 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 gnulib-tool: In tests directories, augment AM_CFLAGS and AM_CXXFLAGS. diff --git a/gnulib-tool.sh b/gnulib-tool.sh index 2e9e70036c..566525742a 100755 --- a/gnulib-tool.sh +++ b/gnulib-tool.sh @@ -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}" diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 4abbacb710..c055786a03 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -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: