From 799001bfae7d1adda09e011b436168770b145bd2 Mon Sep 17 00:00:00 2001 From: Severin Strobl Date: Tue, 19 Nov 2019 10:32:09 +0100 Subject: [PATCH] Support versioned shared libraries. Shared libraries often use a suffix encoding their version which should be handled when parsing linker flags. --- waflib/Tools/c_config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py index 8bf3a87f..537af03c 100644 --- a/waflib/Tools/c_config.py +++ b/waflib/Tools/c_config.py @@ -107,6 +107,8 @@ def parse_flags(self, line, uselib_store, env=None, force_static=False, posix=No lex.commenters = '' lst = list(lex) + so_re = re.compile(r"\.so(?:\.[0-9]+)*$") + # append_unique is not always possible # for example, apple flags may require both -arch i386 and -arch ppc uselib = uselib_store @@ -184,7 +186,7 @@ def parse_flags(self, line, uselib_store, env=None, force_static=False, posix=No app('CFLAGS', tmp) app('CXXFLAGS', tmp) app('LINKFLAGS', tmp) - elif x.endswith(('.a', '.so', '.dylib', '.lib')): + elif x.endswith(('.a', '.dylib', '.lib')) or so_re.search(x): appu('LINKFLAGS', x) # not cool, #762 else: self.to_log('Unhandled flag %r' % x)