Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 4 | from waflib.Configure import conf |
| 5 | |
| 6 | def options(opt): |
Davide Pesavento | 1359cc3 | 2019-11-09 15:25:09 -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') |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [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 (use unix-dot ''' |
| 12 | '''locking mechanism instead). This option may be necessary if home ''' |
| 13 | '''directory is hosted on NFS.''') |
| 14 | |
| 15 | @conf |
| 16 | def check_sqlite3(self, *k, **kw): |
Davide Pesavento | 1359cc3 | 2019-11-09 15:25:09 -0500 | [diff] [blame] | 17 | 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] | 18 | mandatory = kw.get('mandatory', True) |
| 19 | var = kw.get('uselib_store', 'SQLITE3') |
| 20 | |
| 21 | if root: |
| 22 | self.check_cxx(lib='sqlite3', |
| 23 | msg='Checking for SQLite3 library', |
| 24 | define_name='HAVE_%s' % var, |
| 25 | uselib_store=var, |
| 26 | mandatory=mandatory, |
Davide Pesavento | 1359cc3 | 2019-11-09 15:25:09 -0500 | [diff] [blame] | 27 | includes='%s/include' % root, |
| 28 | libpath='%s/lib' % root) |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 29 | else: |
| 30 | try: |
| 31 | self.check_cfg(package='sqlite3', |
| 32 | args=['--cflags', '--libs'], |
| 33 | uselib_store='SQLITE3', |
| 34 | mandatory=True) |
| 35 | except: |
| 36 | self.check_cxx(lib='sqlite3', |
| 37 | msg='Checking for SQLite3 library', |
| 38 | define_name='HAVE_%s' % var, |
| 39 | uselib_store=var, |
| 40 | mandatory=mandatory) |