Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 1 | from waflib.Configure import conf |
| 2 | |
| 3 | def options(opt): |
Davide Pesavento | 1359cc3 | 2019-11-09 15:25:09 -0500 | [diff] [blame] | 4 | opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir', |
| 5 | help='directory where SQLite3 is installed, e.g., /usr/local') |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 6 | opt.add_option('--without-sqlite-locking', action='store_false', default=True, |
| 7 | dest='with_sqlite_locking', |
| 8 | help='''Disable filesystem locking in sqlite3 database (use unix-dot ''' |
| 9 | '''locking mechanism instead). This option may be necessary if home ''' |
| 10 | '''directory is hosted on NFS.''') |
| 11 | |
| 12 | @conf |
| 13 | def check_sqlite3(self, *k, **kw): |
Davide Pesavento | 1359cc3 | 2019-11-09 15:25:09 -0500 | [diff] [blame] | 14 | root = k and k[0] or kw.get('path', self.options.sqlite3_dir) |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 15 | mandatory = kw.get('mandatory', True) |
| 16 | var = kw.get('uselib_store', 'SQLITE3') |
| 17 | |
| 18 | if root: |
| 19 | self.check_cxx(lib='sqlite3', |
| 20 | msg='Checking for SQLite3 library', |
| 21 | define_name='HAVE_%s' % var, |
| 22 | uselib_store=var, |
| 23 | mandatory=mandatory, |
Davide Pesavento | 1359cc3 | 2019-11-09 15:25:09 -0500 | [diff] [blame] | 24 | includes='%s/include' % root, |
| 25 | libpath='%s/lib' % root) |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 26 | else: |
| 27 | try: |
| 28 | self.check_cfg(package='sqlite3', |
| 29 | args=['--cflags', '--libs'], |
| 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) |