Paul Eggert wrote: > The command "./gnulib-tool --test libtextstyle-optional" fails with the > last few output lines as follows. I tried going back into the past but > didn't find an old Gnulib version where the command worked (though the > failure symptoms differed), so I don't think this is purely due to > recent Gnulib changes. > > > gcc -DHAVE_CONFIG_H -I. -I../../gltests -DGNULIB_STRICT_CHECKING=1 -I. > -I../../gltests -I.. -I../../gltests/.. -I../gllib > -I../../gltests/../gllib -DSRCDIR=\"../../gltests/\" -Wno-error -g -O2 > -MT test_libtextstyle-test-libtextstyle.o -MD -MP -MF > .deps/test_libtextstyle-test-libtextstyle.Tpo -c -o > test_libtextstyle-test-libtextstyle.o `test -f 'test-libtextstyle.c' || > echo '../../gltests/'`test-libtextstyle.c > ../../gltests/test-libtextstyle.c:20:10: fatal error: textstyle.h: No > such file or directory > 20 | #include <textstyle.h> > | ^~~~~~~~~~~~~ > compilation terminated.
Thanks for the report. Fixed through the attached two patches. Up until yesterday, only the second one would have been necessary. Now, also the 'gen-header' module needs to be repeated in tests/Makefile.am; this is handled by the first patch. There is no problem when the option --single-configure is used. So, the situation is that there are two configure.ac files: one at the top level and one in gltests/. $ grep TEXTSTYLE config.status S["GL_GENERATE_TEXTSTYLE_H_FALSE"]="" S["GL_GENERATE_TEXTSTYLE_H_TRUE"]="#" S["TEXTSTYLE_H"]="" $ grep TEXTSTYLE gltests/config.status S["LIBTEXTSTYLE_PREFIX"]="" S["LTLIBTEXTSTYLE"]="" S["LIBTEXTSTYLE"]="" S["HAVE_LIBTEXTSTYLE"]="no" S["GL_GENERATE_TEXTSTYLE_H_FALSE"]="#" S["GL_GENERATE_TEXTSTYLE_H_TRUE"]="" S["TEXTSTYLE_H"]="textstyle.h" So, the module 'libtextstyle-optional' is special: The AC_SUBSTed values, such as TEXTSTYLE_H, are different in the two configurations. This is because the gl_LIBTEXTSTYLE_OPTIONAL invocation comes only in the tests. As a consequence, omitting the module in the tests/configure.ac is not OK. 2021-12-25 Bruno Haible <br...@clisp.org> gnulib-tool: Fix handling of module libtextstyle-optional. Reported by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00152.html>. * gnulib-tool (func_repeat_module_in_tests): New function. (func_emit_tests_Makefile_am, func_create_testdir): Use it for the file list and when creating tests/Makefile.am. 2021-12-25 Bruno Haible <br...@clisp.org> gnulib-tool: Respect applicability 'all' without --single-configure. * gnulib-tool (func_verify_tests_module): Treat modules with applicability 'all' like 'tests' modules, not like 'main' modules.
>From 83948c64d10c77fb964e6523a9524729d6a66f32 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 25 Dec 2021 12:19:13 +0100 Subject: [PATCH 1/2] gnulib-tool: Respect applicability 'all' without --single-configure. * gnulib-tool (func_verify_tests_module): Treat modules with applicability 'all' like 'tests' modules, not like 'main' modules. --- ChangeLog | 6 ++++++ gnulib-tool | 30 +++++++++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e31734e2..cc9c38192 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-12-25 Bruno Haible <br...@clisp.org> + + gnulib-tool: Respect applicability 'all' without --single-configure. + * gnulib-tool (func_verify_tests_module): Treat modules with + applicability 'all' like 'tests' modules, not like 'main' modules. + 2021-12-24 Paul Eggert <egg...@cs.ucla.edu> maint: avoid empty lines in recipes diff --git a/gnulib-tool b/gnulib-tool index 0d4f246d8..c2607c95a 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -1894,19 +1894,6 @@ func_verify_nontests_module () esac } -# func_verify_tests_module -# verifies a module name, considering only tests modules -# Input: -# - local_gnulib_path from --local-dir -# - module module name argument -func_verify_tests_module () -{ - case "$module" in - *-tests ) func_verify_module ;; - * ) module= ;; - esac -} - # Suffix of a sed expression that extracts a particular field from a # module description. # A field starts with a line that contains a keyword, such as 'Description', @@ -2793,6 +2780,23 @@ func_get_tests_module () fi } +# func_verify_tests_module +# verifies a module name, considering only tests modules and modules with +# applicability 'all'. +# Input: +# - local_gnulib_path from --local-dir +# - modcache true or false, from --cache-modules/--no-cache-modules +# - module module name argument +func_verify_tests_module () +{ + func_verify_module + if test -n "$module"; then + if test `func_get_applicability $module` = main; then + module= + fi + fi +} + # func_get_dependencies_recursively module # Input: # - local_gnulib_path from --local-dir -- 2.25.1
>From 9af17c55629c4cbe2facdc9edb5242136567ebba Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 25 Dec 2021 14:30:57 +0100 Subject: [PATCH 2/2] gnulib-tool: Fix handling of module libtextstyle-optional. Reported by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00152.html>. * gnulib-tool (func_repeat_module_in_tests): New function. (func_emit_tests_Makefile_am, func_create_testdir): Use it for the file list and when creating tests/Makefile.am. --- ChangeLog | 9 +++++++++ gnulib-tool | 41 +++++++++++++++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc9c38192..54b3a3548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2021-12-25 Bruno Haible <br...@clisp.org> + + gnulib-tool: Fix handling of module libtextstyle-optional. + Reported by Paul Eggert in + <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00152.html>. + * gnulib-tool (func_repeat_module_in_tests): New function. + (func_emit_tests_Makefile_am, func_create_testdir): Use it for the file + list and when creating tests/Makefile.am. + 2021-12-25 Bruno Haible <br...@clisp.org> gnulib-tool: Respect applicability 'all' without --single-configure. diff --git a/gnulib-tool b/gnulib-tool index c2607c95a..9b7cf334a 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -2797,6 +2797,27 @@ func_verify_tests_module () fi } +# func_repeat_module_in_tests +# tests whether, when the tests have their own configure.ac script, a given +# module should be repeated in the tests, although it was already among the main +# modules. +# Input: +# - module module name argument +func_repeat_module_in_tests () +{ + case "$module" in + libtextstyle-optional) + # This module is special because it relies on a gl_LIBTEXTSTYLE_OPTIONAL + # invocation that it does not itself do or require. Therefore if the + # tests contain such an invocation, the module - as part of tests - + # will produce different AC_SUBSTed variable values than the same module + # - as part of the main configure.ac -. + echo true ;; + *) + echo false ;; + esac +} + # func_get_dependencies_recursively module # Input: # - local_gnulib_path from --local-dir @@ -4132,7 +4153,11 @@ func_emit_tests_Makefile_am () { for module in $modules; do if $for_test && ! $single_configure; then - func_verify_tests_module + if `func_repeat_module_in_tests`; then + func_verify_module + else + func_verify_tests_module + fi else func_verify_module fi @@ -6478,11 +6503,15 @@ func_create_testdir () if $single_configure; then func_modules_to_filelist_separately else - func_modules_to_filelist - if test $verbose -ge 0; then - echo "File list:" - echo "$files" | sed -e 's/^/ /' - fi + main_modules="$modules" + testsrelated_modules=`for module in $modules; do + if \`func_repeat_module_in_tests\`; then + echo $module + fi + done` + saved_modules="$modules" + func_modules_to_filelist_separately + modules="$saved_modules" fi # Add files for which the copy in gnulib is newer than the one that # "automake --add-missing --copy" would provide. -- 2.25.1