blob: 4f2c01690d2a08a98ec948c59480e7b91d6be7af [file] [log] [blame]
Zhiyi Zhang8617a792017-01-17 16:45:56 -08001#! /usr/bin/env python
2# encoding: utf-8
3
Zhiyi Zhang8617a792017-01-17 16:45:56 -08004from waflib.Configure import conf
5
6def options(opt):
Davide Pesavento55d98602019-10-15 22:40:05 -04007 opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
8 help='directory where SQLite3 is installed, e.g., /usr/local')
Zhiyi Zhang8617a792017-01-17 16:45:56 -08009
10@conf
11def check_sqlite3(self, *k, **kw):
Davide Pesavento55d98602019-10-15 22:40:05 -040012 root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
Zhiyi Zhang8617a792017-01-17 16:45:56 -080013 mandatory = kw.get('mandatory', True)
14 var = kw.get('uselib_store', 'SQLITE3')
15
16 if root:
17 self.check_cxx(lib='sqlite3',
18 msg='Checking for SQLite3 library',
19 define_name='HAVE_%s' % var,
20 uselib_store=var,
21 mandatory=mandatory,
Davide Pesavento55d98602019-10-15 22:40:05 -040022 includes='%s/include' % root,
23 libpath='%s/lib' % root)
Zhiyi Zhang8617a792017-01-17 16:45:56 -080024 else:
25 try:
26 self.check_cfg(package='sqlite3',
27 args=['--cflags', '--libs'],
28 global_define=True,
29 define_name='HAVE_%s' % var,
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)