Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
| 4 | from waflib import Options |
| 5 | from waflib.Configure import conf |
| 6 | |
| 7 | def options(opt): |
| 8 | opt.add_option('--with-sqlite3', type='string', default=None, |
| 9 | dest='with_sqlite3', help='''Path to SQLite3, e.g., /usr/local''') |
| 10 | |
| 11 | @conf |
| 12 | def check_sqlite3(self, *k, **kw): |
| 13 | root = k and k[0] or kw.get('path', None) or Options.options.with_sqlite3 |
| 14 | mandatory = kw.get('mandatory', True) |
| 15 | var = kw.get('uselib_store', 'SQLITE3') |
| 16 | |
| 17 | if root: |
| 18 | self.check_cxx(lib='sqlite3', |
| 19 | msg='Checking for SQLite3 library', |
| 20 | define_name='HAVE_%s' % var, |
| 21 | uselib_store=var, |
| 22 | mandatory=mandatory, |
| 23 | cxxflags="-I%s/include" % root, |
| 24 | linkflags="-L%s/lib" % root) |
| 25 | else: |
| 26 | try: |
| 27 | self.check_cfg(package='sqlite3', |
| 28 | args=['--cflags', '--libs'], |
| 29 | uselib_store='SQLITE3', |
| 30 | mandatory=True) |
| 31 | except: |
| 32 | self.check_cxx(lib='sqlite3', |
| 33 | msg='Checking for SQLite3 library', |
| 34 | define_name='HAVE_%s' % var, |
| 35 | uselib_store=var, |
| 36 | mandatory=mandatory) |