Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame^] | 4 | from waflib import Options, Logs |
Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 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, |
Alexander Afanasyev | ae80f10 | 2014-05-12 17:20:46 -0700 | [diff] [blame] | 23 | includes="%s/include" % root, |
| 24 | libpath="%s/lib" % root) |
Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 25 | else: |
| 26 | try: |
| 27 | self.check_cfg(package='sqlite3', |
| 28 | args=['--cflags', '--libs'], |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame^] | 29 | global_define=True, |
| 30 | define_name='HAVE_%s' % var, |
Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 31 | uselib_store='SQLITE3', |
| 32 | mandatory=True) |
| 33 | except: |
| 34 | self.check_cxx(lib='sqlite3', |
| 35 | msg='Checking for SQLite3 library', |
| 36 | define_name='HAVE_%s' % var, |
| 37 | uselib_store=var, |
| 38 | mandatory=mandatory) |