blob: 629fbfd735419adb0b09322180a751d616e55b57 [file] [log] [blame]
Alexander Afanasyev5cda2e02014-04-11 13:58:44 -07001# encoding: utf-8
2
3from waflib import Options, Logs
4from waflib.Configure import conf
5
6def addDependencyOptions(self, opt, name, extraHelp=''):
7 opt.add_option('--with-%s' % name, type='string', default=None,
8 dest='with_%s' % name,
9 help='Path to %s, e.g., /usr/local %s' % (name, extraHelp))
10setattr(Options.OptionsContext, "addDependencyOptions", addDependencyOptions)
11
12@conf
13def checkDependency(self, name, **kw):
14 root = kw.get('path', getattr(Options.options, 'with_%s' % name))
15 kw['msg'] = kw.get('msg', 'Checking for %s library' % name)
16 kw['uselib_store'] = kw.get('uselib_store', name.upper())
17 kw['define_name'] = kw.get('define_name', 'HAVE_%s' % kw['uselib_store'])
18 kw['mandatory'] = kw.get('mandatory', True)
19
20 if root:
Alexander Afanasyev39a7d6a2014-05-12 17:29:57 -070021 isOk = self.check_cxx(includes="%s/include" % root,
22 libpath="%s/lib" % root,
Alexander Afanasyev5cda2e02014-04-11 13:58:44 -070023 **kw)
24 else:
25 isOk = self.check_cxx(**kw)
26
27 if isOk:
28 self.env[kw['define_name']] = True