blob: a4f43cfa3e9e07632dcfaac3ff3caf75348278c0 [file] [log] [blame]
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07001from waflib.Configure import conf
2
3def options(opt):
Davide Pesavento1af6ccd2019-11-09 15:20:27 -05004 opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
5 help='directory where SQLite3 is installed, e.g., /usr/local')
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07006 opt.add_option('--without-sqlite-locking', action='store_false', default=True,
7 dest='with_sqlite_locking',
8 help='''Disable filesystem locking in sqlite3 database '''
9 '''(use unix-dot locking mechanism instead). '''
10 '''This option may be necessary if home directory is hosted on NFS.''')
11
12@conf
13def check_sqlite3(self, *k, **kw):
Davide Pesavento1af6ccd2019-11-09 15:20:27 -050014 root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070015 mandatory = kw.get('mandatory', True)
16 var = kw.get('uselib_store', 'SQLITE3')
17
Alexander Afanasyev08d18742018-03-15 16:31:28 -040018 if not self.options.with_sqlite_locking:
19 conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)
20
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070021 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 Pesavento1af6ccd2019-11-09 15:20:27 -050027 includes='%s/include' % root,
28 libpath='%s/lib' % root)
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070029 else:
30 try:
31 self.check_cfg(package='sqlite3',
32 args=['--cflags', '--libs'],
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070033 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)