build: Allow customization of paths for libpcap, librt, and libresolv
Change-Id: Id54955f33f0df728b8fad2a22de9592ce783adf1
diff --git a/.waf-tools/dependency-checker.py b/.waf-tools/dependency-checker.py
new file mode 100644
index 0000000..5751c62
--- /dev/null
+++ b/.waf-tools/dependency-checker.py
@@ -0,0 +1,28 @@
+# encoding: utf-8
+
+from waflib import Options, Logs
+from waflib.Configure import conf
+
+def addDependencyOptions(self, opt, name, extraHelp=''):
+ opt.add_option('--with-%s' % name, type='string', default=None,
+ dest='with_%s' % name,
+ help='Path to %s, e.g., /usr/local %s' % (name, extraHelp))
+setattr(Options.OptionsContext, "addDependencyOptions", addDependencyOptions)
+
+@conf
+def checkDependency(self, name, **kw):
+ root = kw.get('path', getattr(Options.options, 'with_%s' % name))
+ kw['msg'] = kw.get('msg', 'Checking for %s library' % name)
+ kw['uselib_store'] = kw.get('uselib_store', name.upper())
+ kw['define_name'] = kw.get('define_name', 'HAVE_%s' % kw['uselib_store'])
+ kw['mandatory'] = kw.get('mandatory', True)
+
+ if root:
+ isOk = self.check_cxx(cxxflags="-I%s/include" % root,
+ linkflags="-L%s/lib" % root,
+ **kw)
+ else:
+ isOk = self.check_cxx(**kw)
+
+ if isOk:
+ self.env[kw['define_name']] = True