From 0be855ee827bf7e9043eeb626c4fd847704be2e6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 29 Dec 2020 02:48:31 +0100 Subject: [PATCH] gnulib-tool: Fix logic whether to add a dummy.c. * gnulib-tool (func_remove_if_blocks): New function. (func_modules_add_dummy): Use it to eliminate all conditional statements from the automake snippet. --- ChangeLog | 7 +++++++ gnulib-tool | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1481becc9b..29184d2b6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-12-28 Bruno Haible + + gnulib-tool: Fix logic whether to add a dummy.c. + * gnulib-tool (func_remove_if_blocks): New function. + (func_modules_add_dummy): Use it to eliminate all conditional statements + from the automake snippet. + 2020-12-28 Paul Eggert faccessat: revert recent EOVERFLOW change diff --git a/gnulib-tool b/gnulib-tool index faed693ff2..9044d6d2d5 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -3280,6 +3280,21 @@ func_determine_use_libtests () done } +# func_remove_if_blocks +# removes if...endif blocks from an automake snippet. +func_remove_if_blocks () +{ + sed -n -e '/^if / { + :a + n + s/^endif// + tb + ba + :b + } + p' +} + # func_modules_add_dummy # Input: # - local_gnulib_path from --local-dir @@ -3299,8 +3314,9 @@ func_modules_add_dummy () # contribute to lib_SOURCES. : else - # Extract the value of "lib_SOURCES += ...". + # Extract the value of unconditional "lib_SOURCES += ..." augmentations. for file in `func_get_automake_snippet "$module" | combine_lines | + func_remove_if_blocks | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do # Ignore .h files since they are not compiled. case "$file" in -- 2.39.5