blob: 7ddbf0f4437eb31392e1a9e68e2493f04df96535 [file] [log] [blame]
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07001#! /usr/bin/env python
2# encoding: utf-8
3
Alexander Afanasyev08d18742018-03-15 16:31:28 -04004from waflib import Options, Logs
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -07005from waflib.Configure import conf
6
7def options(opt):
8 opt.add_option('--with-sqlite3', type='string', default=None,
9 dest='with_sqlite3', help='''Path to SQLite3, e.g., /usr/local''')
10 opt.add_option('--without-sqlite-locking', action='store_false', default=True,
11 dest='with_sqlite_locking',
12 help='''Disable filesystem locking in sqlite3 database '''
13 '''(use unix-dot locking mechanism instead). '''
14 '''This option may be necessary if home directory is hosted on NFS.''')
15
16@conf
17def check_sqlite3(self, *k, **kw):
18 root = k and k[0] or kw.get('path', None) or Options.options.with_sqlite3
19 mandatory = kw.get('mandatory', True)
20 var = kw.get('uselib_store', 'SQLITE3')
21
Alexander Afanasyev08d18742018-03-15 16:31:28 -040022 if not self.options.with_sqlite_locking:
23 conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)
24
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070025 if root:
26 self.check_cxx(lib='sqlite3',
27 msg='Checking for SQLite3 library',
28 define_name='HAVE_%s' % var,
29 uselib_store=var,
30 mandatory=mandatory,
31 includes="%s/include" % root,
32 libpath="%s/lib" % root)
33 else:
34 try:
35 self.check_cfg(package='sqlite3',
36 args=['--cflags', '--libs'],
Alexander Afanasyev08d18742018-03-15 16:31:28 -040037 global_define=True,
38 define_name='HAVE_%s' % var,
Alexander Afanasyev4ffcff22014-09-02 15:39:20 -070039 uselib_store='SQLITE3',
40 mandatory=True)
41 except:
42 self.check_cxx(lib='sqlite3',
43 msg='Checking for SQLite3 library',
44 define_name='HAVE_%s' % var,
45 uselib_store=var,
46 mandatory=mandatory)