]> git.draconx.ca Git - cdecl99.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.

Makefile.am
fix-gnulib.pl

index 16da7f13396922e5eb23db3f94beafbfa124ab92..580641dfa2979844824af9231bf5594442fe2b78 100644 (file)
@@ -37,12 +37,12 @@ lib_LTLIBRARIES = libcdecl.la
 libcdecl_la_LDFLAGS = -export-symbols-regex '^cdecl_[[:lower:]]'
 libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
        src/output.c src/explain.c src/declare.c src/i18n.c
-libcdecl_la_LIBADD = $(LTLIBINTL) $(LTLIBTHREAD) libgnu.la
+libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
 $(libcdecl_la_OBJECTS): $(gnulib_headers)
 
 bin_PROGRAMS = cdecl99
 cdecl99_SOURCES = src/cdecl99.c
-cdecl99_LDADD = libcdecl.la libgnu.la
+cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
 $(cdecl99_OBJECTS): $(gnulib_headers)
 
 src/parse.lo: src/scan.h
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";