blob: 3d4e46ed0c26f160a3a66e8edc588b3d180e73cc [file] [log] [blame]
Yingdi Yuc9843cf2014-08-04 17:52:19 -07001#! /usr/bin/env python
2# encoding: utf-8
3
Yingdi Yu0c3e5912015-03-17 14:22:38 -07004from waflib import Options, Logs
Yingdi Yuc9843cf2014-08-04 17:52:19 -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
11@conf
12def check_sqlite3(self, *k, **kw):
13 root = k and k[0] or kw.get('path', None) or Options.options.with_sqlite3
14 mandatory = kw.get('mandatory', True)
15 var = kw.get('uselib_store', 'SQLITE3')
16
17 if root:
18 self.check_cxx(lib='sqlite3',
19 msg='Checking for SQLite3 library',
20 define_name='HAVE_%s' % var,
21 uselib_store=var,
22 mandatory=mandatory,
23 includes="%s/include" % root,
24 libpath="%s/lib" % root)
25 else:
26 try:
27 self.check_cfg(package='sqlite3',
28 args=['--cflags', '--libs'],
Yingdi Yu0c3e5912015-03-17 14:22:38 -070029 global_define=True,
30 define_name='HAVE_%s' % var,
Yingdi Yuc9843cf2014-08-04 17:52:19 -070031 uselib_store='SQLITE3',
32 mandatory=True)
33 except:
34 self.check_cxx(lib='sqlite3',
35 msg='Checking for SQLite3 library',
36 define_name='HAVE_%s' % var,
37 uselib_store=var,
38 mandatory=mandatory)