From: Michael Adam Date: Mon, 22 Dec 2014 09:38:37 +0000 (+0100) Subject: TODO wafsamba: fix treatment of rpath-linkflags X-Git-Url: http://git.samba.org/?p=obnox%2Fsamba%2Fsamba-obnox.git;a=commitdiff_plain;h=6bd1fc0234bcc45e7f3075d441716b6dc39e9dd0 TODO wafsamba: fix treatment of rpath-linkflags --- diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py index f94b0b7ca8c..56ba7da0a53 100644 --- a/buildtools/wafsamba/samba_conftests.py +++ b/buildtools/wafsamba/samba_conftests.py @@ -511,13 +511,18 @@ def CHECK_XSLTPROC_MANPAGES(conf): waf_config_c_parse_flags = config_c.parse_flags; def samba_config_c_parse_flags(line, uselib, env): - waf_config_c_parse_flags(line, uselib, env) + # + # We do a special treatment of the rpath components + # in the linkflags line, because currently the upstream + # parse_flags function is incomplete with respect to + # treatment of the rpath. The remainder of the linkflags + # line is later passed to the original funcion. + # + lst1 = shlex.split(line) + lst2 = [] + while lst1: + x = lst1.pop(0) - try: - linkflags = env['LINKFLAGS_' + uselib] - except KeyError: - linkflags = [] - for x in linkflags: # # NOTE on special treatment of -Wl,-R and -Wl,-rpath: # @@ -527,17 +532,28 @@ def samba_config_c_parse_flags(line, uselib, env): # RPATH later, and hence can potentially lead to linking # in too old versions of our internal libs. # - if x.startswith('-Wl,-R,'): + if x == '-Wl,-rpath' or x == '-Wl,-R': + linkflags.remove(x) + x = lst1.pop(0) + if x.startswith('-Wl,'): + rpath = x[4:] + else: + rpath = x + elif x.startswith('-Wl,-R,'): rpath = x[7:] elif x.startswith('-Wl,-R'): rpath = x[6:] elif x.startswith('-Wl,-rpath,'): rpath = x[11:] else: + lst2.append(x) continue env.append_value('RPATH_' + uselib, rpath) - linkflags.remove(x) + + line2 = ' '.join(lst2) + waf_config_c_parse_flags(line2, uselib, env) return + config_c.parse_flags = samba_config_c_parse_flags