blob: 87ad5e85eb5d1261d8bf61b88f85f007d638abdf [file] [log] [blame]
Shuo Chenccfbe242014-04-29 23:57:51 +08001from waflib.Configure import conf
2
3def options(opt):
Davide Pesavento1359cc32019-11-09 15:25:09 -05004 opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
5 help='directory where SQLite3 is installed, e.g., /usr/local')
Shuo Chenccfbe242014-04-29 23:57:51 +08006 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
13def check_sqlite3(self, *k, **kw):
Davide Pesavento1359cc32019-11-09 15:25:09 -050014 root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
Shuo Chenccfbe242014-04-29 23:57:51 +080015 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 Pesavento1359cc32019-11-09 15:25:09 -050024 includes='%s/include' % root,
25 libpath='%s/lib' % root)
Shuo Chenccfbe242014-04-29 23:57:51 +080026 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)