diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index a350ba753..f0746f827 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -853,17 +853,18 @@ AC_DEFUN([%V1%_LIBSOURCES], [ emit += '%s_%s_LDFLAGS += -no-undefined\n' % (libname, libext) # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining # the link dependencies of all modules. - listing = list() links = [module.getLink() for module in modules if not module.isTests()] + ulinks = list() for link in links: - link = constants.nlremove(link) - position = link.find(' when linking with libtool') - if position != -1: - link = link[:position] - listing += [link] - listing = sorted(set([link for link in listing if link != ''])) - for link in listing: + for lib in link: + lib = constants.nlremove(lib) + position = lib.find(' when linking with libtool') + if position != -1: + lib = lib[:position] + ulinks += [lib] + ulinks = sorted(set(ulinks)) + for link in ulinks: emit += '%s_%s_LDFLAGS += %s\n' % (libname, libext, link) emit += '\n' if pobase: diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 19ade5e8d..27a01be43 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -1374,13 +1374,17 @@ for the following .h files.') # Get link directives. links = [module.getLink() for module in self.moduletable['main']] - links = sorted(set([link for link in links if link.strip()])) - if links: + ulinks = list() + for link in links: + for lib in link: + ulinks += [lib] + ulinks = sorted(set(ulinks)) + if ulinks: print(''' You may need to use the following Makefile variables when linking. Use them in _LDADD when linking a program, or in _a_LDFLAGS or _la_LDFLAGS when linking a library.''') - for link in links: + for link in ulinks: print(' %s' % link) # Print reminders. diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index f2f9df4ac..9560bc273 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -791,13 +791,11 @@ Include:|Link:|License:|Maintainer:)' Return link directive.''' section = 'Link:' if 'link' not in self.cache: - if section not in self.content: - result = string() - else: # if section in self.content + parts = list() + if section in self.content: snippet = self.content.split(section)[-1] snippet = snippet.replace('\r\n', '\n') lines = ['%s\n' % line for line in snippet.split('\n')] - parts = list() for line in lines: regex = '^(Description|Comment|Status|Notice|Applicability|' regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|' @@ -808,8 +806,8 @@ Include:|Link:|License:|Maintainer:)' break parts += [line] parts = [part.strip() for part in parts if part.strip()] - result = ''.join(parts) - self.cache['link'] = result + # result = ' '.join(parts) + self.cache['link'] = parts return(self.cache['link']) def getLicense(self):