gnulib-tool: fix generated code when libtests contains module 'alloca'
(too old to reply)
Bruno Haible
2017-05-15 21:21:28 UTC
The use of gnulib-tool in gettext currently fails:

gnulib-tests/Makefile.gnulib:55: error: @LTALLOCA@ used but 'LTALLOCA' is undefined
gnulib-tests/Makefile.am:20: 'gnulib-tests/Makefile.gnulib' included from here

What triggers this, is that gettext uses the module 'copy-file', whose tests
now have a new dependency chain towards the module 'alloca':

copy-file -> utimens -> utime
utimens-tests, utime-tests -> nanosleep -> select -> alloca

The generated Makefile.am lines

libtests_a_LIBADD += @LTALLOCA@

are wrong, because libtests.a is a "convenience library", not a "libtool library".
The special thing about the code in function func_emit_tests_Makefile_am
is that it deals with both a possibly libtool library (namely
${libname}.${libext}) and a convenience library (namely libtests.a).

This patch fixes it.

2017-05-15 Bruno Haible <***@clisp.org>

gnulib-tool: Fix generated code when libtests contains module 'alloca'.
* gnulib-tool (func_emit_tests_Makefile_am): For libtests.a, use
@ALLOCA@, not @***@.

diff --git a/gnulib-tool b/gnulib-tool
index 5dd77f7..f3463b6 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -3828,8 +3828,8 @@ func_emit_tests_Makefile_am ()
-e "$sed_transform_check_PROGRAMS" \
-e "$sed_replace_include_guard_prefix"
if $use_libtests && test "$module" = 'alloca'; then
- echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
- echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
+ echo "libtests_a_LIBADD += @ALLOCA@"
+ echo "libtests_a_DEPENDENCIES += @ALLOCA@"
} > "$tmp"/amsnippet
# Skip the contents if it's entirely empty.