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:
#
# 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