blob: 4f2c01690d2a08a98ec948c59480e7b91d6be7af [file] [log] [blame]
Alexander Afanasyev1160baa2014-04-10 18:50:29 -07001#! /usr/bin/env python
2# encoding: utf-8
3
Alexander Afanasyev1160baa2014-04-10 18:50:29 -07004from waflib.Configure import conf
5
6def options(opt):
Davide Pesavento77f1c762019-02-19 03:20:49 -05007 opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
8 help='directory where SQLite3 is installed, e.g., /usr/local')
Alexander Afanasyev1160baa2014-04-10 18:50:29 -07009
10@conf
11def check_sqlite3(self, *k, **kw):
Davide Pesavento77f1c762019-02-19 03:20:49 -050012 root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070013 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 Pesavento77f1c762019-02-19 03:20:49 -050022 includes='%s/include' % root,
23 libpath='%s/lib' % root)
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070024 else:
25 try:
26 self.check_cfg(package='sqlite3',
27 args=['--cflags', '--libs'],
Alexander Afanasyev01515792014-12-16 14:20:01 -080028 global_define=True,
29 define_name='HAVE_%s' % var,
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070030 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)