blob: dae6a869bc61f8478d80f683e698d13da0550185 [file] [log] [blame]
Yingdi Yu40cd1c32014-04-17 15:02:17 -07001#! /usr/bin/env python
2# encoding: utf-8
3
4'''
5
6When using this tool, the wscript will look like:
7
8 def options(opt):
9 opt.tool_options('openssl')
10
11 def configure(conf):
12 conf.load('compiler_cxx openssl')
13 conf.check_openssl()
14
15 def build(bld):
16 bld(source='main.cpp', target='app', use='OPENSSL')
17
18'''
19
20from waflib import Options
21from waflib.Configure import conf
22
23@conf
24def check_openssl(self,*k,**kw):
25 root = k and k[0] or kw.get('path', None) or Options.options.with_openssl
26 mandatory = kw.get('mandatory', True)
27 var = kw.get('uselib_store', 'OPENSSL')
28
29 if root:
30 libcrypto = self.check_cxx(lib=['ssl', 'crypto'],
31 msg='Checking for OpenSSL library',
32 define_name='HAVE_%s' % var,
Vince Lehmanb45eed22015-01-13 14:58:07 -060033 global_define=True,
Yingdi Yu40cd1c32014-04-17 15:02:17 -070034 uselib_store=var,
35 mandatory=mandatory,
Vince Lehmanb45eed22015-01-13 14:58:07 -060036 includes="%s/include" % root,
37 libpath="%s/lib" % root)
Yingdi Yu40cd1c32014-04-17 15:02:17 -070038 else:
39 libcrypto = self.check_cxx(lib=['ssl', 'crypto'],
40 msg='Checking for OpenSSL library',
41 define_name='HAVE_%s' % var,
42 uselib_store=var,
43 mandatory=mandatory)
44
45def options(opt):
46 opt.add_option('--with-openssl', type='string', default=None,
47 dest='with_openssl', help='''Path to OpenSSL''')