X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/blobdiff_plain/0760e669cdb984633fffb2f99d20b019706ec597..03d1aa34d110422a3f7e41977c97b567095f064f:/scripts/fix-gnulib.pl diff --git a/scripts/fix-gnulib.pl b/scripts/fix-gnulib.pl index 17163c7..834fb7a 100755 --- a/scripts/fix-gnulib.pl +++ b/scripts/fix-gnulib.pl @@ -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"; @@ -174,9 +182,21 @@ if (defined $m4output) { open(M4OUT, '>', $m4output) or die "$m4output: $!\n"; - print M4OUT "dnl This file was generated by fix-gnulib.pl\n"; - print M4OUT "AC_DEFUN([$m4macro], [dnl\n"; + print M4OUT <