if Options.options.developer:
# we add these here to ensure that -Wstrict-prototypes is not set during configure
- conf.ADD_CFLAGS('-Wall -g -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Werror-implicit-function-declaration -Wformat=2 -Wno-format-y2k -Wl,-no-undefined',
+ conf.ADD_CFLAGS('-Wall -g -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Werror-implicit-function-declaration -Wformat=2 -Wno-format-y2k',
testflags=True)
+ conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
+
if Options.options.picky_developer:
conf.ADD_CFLAGS('-Werror', testflags=True)
conf.env['EXTRA_CFLAGS'] = []
conf.env['EXTRA_CFLAGS'].extend(TO_LIST(flags))
+@conf
+def ADD_LDFLAGS(conf, flags, testflags=False):
+ '''add some LDFLAGS to the command line
+ optionally set testflags to ensure all the flags work
+ '''
+ if testflags:
+ ok_flags=[]
+ for f in flags.split():
+ if CHECK_CFLAGS(conf, f):
+ ok_flags.append(f)
+ flags = ok_flags
+ if not 'EXTRA_LDFLAGS' in conf.env:
+ conf.env['EXTRA_LDFLAGS'] = []
+ conf.env['EXTRA_LDFLAGS'].extend(TO_LIST(flags))
+
@conf
return ret
+def CURRENT_LDFLAGS(bld, target, cflags, hide_symbols=False):
+ '''work out the current loader flags. local flags are added first'''
+ flags = CURRENT_CFLAGS(bld, target, cflags, hide_symbols=hide_symbols)
+ if 'EXTRA_LDFLAGS' in bld.env:
+ flags.extend(bld.env['EXTRA_LDFLAGS'])
+ return flags
+
+
@conf
def CHECK_CC_ENV(conf):
"""trim whitespaces from 'CC'.
features = features,
source = [],
target = bundled_name,
- samba_cflags = CURRENT_CFLAGS(bld, libname, cflags),
+ samba_cflags = CURRENT_LDFLAGS(bld, libname, cflags),
depends_on = depends_on,
samba_deps = deps,
samba_includes = includes,
features = features,
source = [],
target = binname,
- samba_cflags = CURRENT_CFLAGS(bld, binname, cflags),
+ samba_cflags = CURRENT_LDFLAGS(bld, binname, cflags),
samba_deps = deps,
samba_includes = includes,
local_include = local_include,
import os
from samba_utils import SET_TARGET_TYPE
-from samba_autoconf import CURRENT_CFLAGS
+from samba_autoconf import CURRENT_CFLAGS, CURRENT_LDFLAGS
def to_list(str):
'''Split a list, preserving quoted strings and existing lists'''
features = features,
source = [],
target = bundled_name,
- samba_cflags = CURRENT_CFLAGS(bld, libname, cflags),
+ samba_cflags = CURRENT_LDFLAGS(bld, libname, cflags),
samba_deps = deps,
samba_includes = includes,
vnum = vnum,
features = features,
source = [],
target = binname,
- samba_cflags = CURRENT_CFLAGS(bld, binname, cflags),
+ samba_cflags = CURRENT_LDFLAGS(bld, binname, cflags),
samba_deps = deps,
samba_includes = includes,
local_include = True,