blob: 840c18246b899c00d209a0fc9ba776feac39d9c7 [file] [log] [blame]
Shuo Chenccfbe242014-04-29 23:57:51 +08001#! /usr/bin/env python
2# encoding: utf-8
3
Shuo Chenccfbe242014-04-29 23:57:51 +08004from waflib.Configure import conf
5
6def options(opt):
Davide Pesavento1359cc32019-11-09 15:25:09 -05007 opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
8 help='directory where SQLite3 is installed, e.g., /usr/local')
Shuo Chenccfbe242014-04-29 23:57:51 +08009 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
16def check_sqlite3(self, *k, **kw):
Davide Pesavento1359cc32019-11-09 15:25:09 -050017 root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
Shuo Chenccfbe242014-04-29 23:57:51 +080018 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 Pesavento1359cc32019-11-09 15:25:09 -050027 includes='%s/include' % root,
28 libpath='%s/lib' % root)
Shuo Chenccfbe242014-04-29 23:57:51 +080029 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)