Browse Source

waf: cxx_checks: add check_librt()

That function verifies for the necessity of linking against librt. If so, then
it checks if it is possible to do so.
master
Gustavo Jose de Sousa 9 years ago committed by Lucas De Marchi
parent
commit
f10c150e70
  1. 24
      Tools/ardupilotwaf/cxx_checks.py

24
Tools/ardupilotwaf/cxx_checks.py

@ -123,3 +123,27 @@ def ap_common_checks(cfg): @@ -123,3 +123,27 @@ def ap_common_checks(cfg):
msg="Checking for NEED_CMATH_ISNAN_STD_NAMESPACE",
mandatory=False,
)
@conf
def check_librt(cfg):
success = cfg.check(
compiler='cxx',
fragment='''
#include <time.h>
int main() {
clock_gettime(CLOCK_REALTIME, NULL);
}''',
msg='Checking for need to link with librt',
okmsg='not necessary',
errmsg='necessary',
mandatory=False,
)
if success:
return success
return cfg.check(
compiler='cxx',
lib='rt',
)

Loading…
Cancel
Save