blob: ad5b930cfc0c97947cadf3979f285d845e2e5b6c [file] [log] [blame]
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07001#! /usr/bin/env python
2# encoding: utf-8
3
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07004from waflib.Configure import conf
5
6def options(opt):
Davide Pesavento1af6ccd2019-11-09 15:20:27 -05007 opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
8 help='directory where SQLite3 is installed, e.g., /usr/local')
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07009 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
16def check_sqlite3(self, *k, **kw):
Davide Pesavento1af6ccd2019-11-09 15:20:27 -050017 root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070018 mandatory = kw.get('mandatory', True)
19 var = kw.get('uselib_store', 'SQLITE3')
20
Alexander Afanasyev08d18742018-03-15 16:31:28 -040021 if not self.options.with_sqlite_locking:
22 conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)
23
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070024 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 Pesavento1af6ccd2019-11-09 15:20:27 -050030 includes='%s/include' % root,
31 libpath='%s/lib' % root)
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070032 else:
33 try:
34 self.check_cfg(package='sqlite3',
35 args=['--cflags', '--libs'],
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070036 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)