blob: 3d4e46ed0c26f160a3a66e8edc588b3d180e73cc [file] [log] [blame]
Alexander Afanasyev1160baa2014-04-10 18:50:29 -07001#! /usr/bin/env python
2# encoding: utf-8
3
Alexander Afanasyev01515792014-12-16 14:20:01 -08004from waflib import Options, Logs
Alexander Afanasyev1160baa2014-04-10 18:50:29 -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,
Alexander Afanasyevae80f102014-05-12 17:20:46 -070023 includes="%s/include" % root,
24 libpath="%s/lib" % root)
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070025 else:
26 try:
27 self.check_cfg(package='sqlite3',
28 args=['--cflags', '--libs'],
Alexander Afanasyev01515792014-12-16 14:20:01 -080029 global_define=True,
30 define_name='HAVE_%s' % var,
Alexander Afanasyev1160baa2014-04-10 18:50:29 -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)