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