Alexander Afanasyev | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
Alexander Afanasyev | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 4 | from waflib.Configure import conf |
| 5 | |
| 6 | def options(opt): |
Davide Pesavento | 1af6ccd | 2019-11-09 15:20:27 -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 | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 9 | opt.add_option('--without-sqlite-locking', action='store_false', default=True, |
| 10 | dest='with_sqlite_locking', |
| 11 | help='''Disable filesystem locking in sqlite3 database ''' |
| 12 | '''(use unix-dot locking mechanism instead). ''' |
| 13 | '''This option may be necessary if home directory is hosted on NFS.''') |
| 14 | |
| 15 | @conf |
| 16 | def check_sqlite3(self, *k, **kw): |
Davide Pesavento | 1af6ccd | 2019-11-09 15:20:27 -0500 | [diff] [blame] | 17 | root = k and k[0] or kw.get('path', self.options.sqlite3_dir) |
Alexander Afanasyev | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 18 | mandatory = kw.get('mandatory', True) |
| 19 | var = kw.get('uselib_store', 'SQLITE3') |
| 20 | |
Alexander Afanasyev | 08d1874 | 2018-03-15 16:31:28 -0400 | [diff] [blame] | 21 | if not self.options.with_sqlite_locking: |
| 22 | conf.define('DISABLE_SQLITE3_FS_LOCKING', 1) |
| 23 | |
Alexander Afanasyev | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 24 | if root: |
| 25 | self.check_cxx(lib='sqlite3', |
| 26 | msg='Checking for SQLite3 library', |
| 27 | define_name='HAVE_%s' % var, |
| 28 | uselib_store=var, |
| 29 | mandatory=mandatory, |
Davide Pesavento | 1af6ccd | 2019-11-09 15:20:27 -0500 | [diff] [blame] | 30 | includes='%s/include' % root, |
| 31 | libpath='%s/lib' % root) |
Alexander Afanasyev | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 32 | else: |
| 33 | try: |
| 34 | self.check_cfg(package='sqlite3', |
| 35 | args=['--cflags', '--libs'], |
Alexander Afanasyev | 4ffcff2 | 2014-09-02 15:39:20 -0700 | [diff] [blame] | 36 | uselib_store='SQLITE3', |
| 37 | mandatory=True) |
| 38 | except: |
| 39 | self.check_cxx(lib='sqlite3', |
| 40 | msg='Checking for SQLite3 library', |
| 41 | define_name='HAVE_%s' % var, |
| 42 | uselib_store=var, |
| 43 | mandatory=mandatory) |