]> git.draconx.ca Git - dxcommon.git/commitdiff
Avoid gratuitous library dependencies linking gnulib.
authorNick Bowler <nbowler@draconx.ca>
Thu, 22 Sep 2011 00:58:27 +0000 (20:58 -0400)
committerNick Bowler <nbowler@draconx.ca>
Thu, 22 Sep 2011 01:08:58 +0000 (21:08 -0400)
libcdecl doesn't use the readline module at all, but libtool happily
pulls it in as a dependency.  Handle library dependencies manually to
avoid this problem.

scripts/fix-gnulib.pl

index b8185fa642107538128023f844d76eb03191f286..834fb7a2e6fe0f0b3f4a11c7eaa11d3fb800422c 100755 (executable)
@@ -111,6 +111,14 @@ EOF
        # useful for non-recursive builds.  Strip them out.
        drop if (/^(AM_CPPFLAGS|AM_CFLAGS)/);
 
+       # Library dependencies are added automatically to libgnu.la by
+       # gnulib-tool.  Unfortunately, this means that everything linking
+       # against libgnu.la is forced to pull in the same deps, even if they're
+       # unneeded.  Furthermore, a libtool linker flag reordering bug prevents
+       # --as-needed from stripping out the useless deps, so it's better to
+       # handle them all manually.
+       drop if (/LDFLAGS/);
+
        # Rewrite automake hook targets to be more generic.
        if (s/^(.*)-local:/\1-gnulib:/) {
                print ".PHONY: $1-gnulib\n";