blob: e2ba7d05c45986f1f03bcf423de97dbe091c7e3f [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,
33 uselib_store=var,
34 mandatory=mandatory,
35 cxxflags="-I%s/include" % root,
36 linkflags="-L%s/lib" % root)
37 else:
38 libcrypto = self.check_cxx(lib=['ssl', 'crypto'],
39 msg='Checking for OpenSSL library',
40 define_name='HAVE_%s' % var,
41 uselib_store=var,
42 mandatory=mandatory)
43
44def options(opt):
45 opt.add_option('--with-openssl', type='string', default=None,
46 dest='with_openssl', help='''Path to OpenSSL''')