]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool: Fix logic whether to add a dummy.c.
authorBruno Haible <bruno@clisp.org>
Tue, 29 Dec 2020 01:48:31 +0000 (02:48 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 29 Dec 2020 01:56:21 +0000 (02:56 +0100)
* gnulib-tool (func_remove_if_blocks): New function.
(func_modules_add_dummy): Use it to eliminate all conditional statements
from the automake snippet.

ChangeLog
gnulib-tool

index 1481becc9b2fe25c855c958f8bc6f5554ffc44d9..29184d2b6b8867a2e8d3ed70f43e2e7e76b95460 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-12-28  Bruno Haible  <bruno@clisp.org>
+
+       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  <eggert@cs.ucla.edu>
 
        faccessat: revert recent EOVERFLOW change
index faed693ff2627fd0c91082ebc1b292bff6024c70..9044d6d2d507ec958b2c7c553107f53b46556abd 100755 (executable)
@@ -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