| from waflib import Options |
| from waflib.Configure import conf |
| |
| def addDependencyOptions(self, opt, name, extraHelp=''): |
| opt.add_option('--with-%s' % name, metavar='PATH', |
| 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(includes='%s/include' % root, |
| libpath='%s/lib' % root, |
| **kw) |
| else: |
| isOk = self.check_cxx(**kw) |
| |
| if isOk: |
| self.env[kw['define_name']] = True |