blob: 8a1f33f658b7e99d58231084013ccb19c5b4d372 [file] [log] [blame]
Alexander Afanasyev0ad7c212012-04-05 13:31:14 -07001## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3import waflib
4from waflib.Configure import conf
5from waflib import Utils,Logs,Errors
6
7@conf
8def _print_optional_features(conf):
9 # Write a summary of optional features status
10 print "---- Summary of optional NS-3 features:"
11 Logs.pprint ('RED', "---- Summary of optional NS-3 features:")
12 # for (name, caption, was_enabled, reason_not_enabled) in conf.env['NS3_OPTIONAL_FEATURES']:
13 # if was_enabled:
14 # status = 'enabled'
15 # else:
16 # status = 'not enabled (%s)' % reason_not_enabled
17 # print "%-30s: %s" % (caption, status)
18
19@conf
20def _check_dependencies(conf, required, mandatory):
21 # Logs.pprint ('CYAN', ' + %s' % required)
22 found = []
Alexander Afanasyev983b0e92012-04-26 12:44:18 -070023
24 libversion = "optimized"
25 if conf.options.ns3_debug:
26 libversion = "debug"
27
Alexander Afanasyev0ad7c212012-04-05 13:31:14 -070028 for module in required:
Alexander Afanasyev983b0e92012-04-26 12:44:18 -070029 retval = conf.check_cfg(package = 'libns3-dev-%s-%s' % (module, libversion),
Alexander Afanasyev0ad7c212012-04-05 13:31:14 -070030 args='--cflags --libs', mandatory=mandatory,
31 msg="Checking for ns3-%s" % module,
32 uselib_store='NS3_%s' % module.upper())
33 # Logs.pprint ('CYAN', 'NS3_%s' % module.upper())
34 if not retval is None:
35 found.append(module)
36 import copy
37 if not 'NS3_MODULES_FOUND' in conf.env:
38 conf.env['NS3_MODULES_FOUND'] = []
39 conf.env['NS3_MODULES_FOUND'] = conf.env['NS3_MODULES_FOUND'] + copy.copy(found)
40
41def modules_uselib(bld, names):
42 return ['NS3_%s' % name.upper() for name in names] + \
43 ['NS3_LIBRARY_%s' % name.upper() for name in names] + \
44 ['NS3_HEADERS_%s' % name.upper() for name in names]
45
46def modules_found(bld, needed):
47 for module in needed:
48 if not module in bld.env['NS3_MODULES_FOUND']:
49 return False
50 return True
51
52@conf
53def check_modules(conf, modules, mandatory = True):
54 import os
55
56 if not 'NS3_CHECK_MODULE_ONCE' in conf.env:
57 conf.env['NS3_CHECK_MODULE_ONCE'] = ''
58
59 conf.check_cfg(atleast_pkgconfig_version='0.0.0')
60
61 if conf.options.log4cxx:
62 conf.env.append_value('DEFINES', 'NS3_LOG_ENABLE')
63
64 conf._check_dependencies(modules, mandatory)
65 conf._print_optional_features
66
67@conf
68def print_ns3_feature_summary(conf):
69 Logs.pprint ('CYAN', "---- Summary of optional NS-3 features:")
70 conf._print_optional_features
71