waf: accept env variable to append library

Change check_librt() to do everything it needs to check for librt.
This commit is contained in:
Lucas De Marchi 2016-05-21 12:11:48 -03:00
parent 3457dbcdf8
commit 9ac6c399e9
2 changed files with 13 additions and 14 deletions

View File

@ -184,12 +184,11 @@ class sitl(Board):
'-O3',
]
cfg.check_librt()
env.LIB += [
'm',
]
env.LIB += cfg.env.LIB_RT
cfg.check_librt(env)
env.LINKFLAGS += ['-pthread',]
env.AP_LIBRARIES += [
@ -216,12 +215,11 @@ class linux(Board):
'-O3',
]
cfg.check_librt()
env.LIB += [
'm',
]
env.LIB += cfg.env.LIB_RT
cfg.check_librt(env)
env.LINKFLAGS += ['-pthread',]
env.AP_LIBRARIES = [

View File

@ -125,8 +125,8 @@ def ap_common_checks(cfg):
)
@conf
def check_librt(cfg):
success = cfg.check(
def check_librt(cfg, env):
ret = cfg.check(
compiler='cxx',
fragment='''
#include <time.h>
@ -140,10 +140,11 @@ def check_librt(cfg):
mandatory=False,
)
if success:
return success
if ret:
return ret
return cfg.check(
compiler='cxx',
lib='rt',
)
ret = cfg.check(compiler='cxx', lib='rt')
if ret:
env.LIB += cfg.env['LIB_RT']
return ret