bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool: Fix logic whether to add a dummy.c


From: Bruno Haible
Subject: gnulib-tool: Fix logic whether to add a dummy.c
Date: Tue, 29 Dec 2020 02:56:44 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

A testdir created through

  ./gnulib-tool --create-testdir --dir=... --single-configure unistr/u8-uctomb 
libunistring-optional

fails to build on Solaris 11 OpenIndiana when a libunistring is already
installed, because the gltests/Makefile references a gllib/libgnu.a which
has not been built: The statements

  rm -f libgnu.a
  ar cr libgnu.a
  ranlib libgnu.a

are not sufficient to create a libgnu.a on this platform. A dummy.o is
required.

This patch fixes it.


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.

diff --git a/gnulib-tool b/gnulib-tool
index faed693..9044d6d 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]