blob: a6b6c76a34e2b016e5c4c1b579fa284acf3d7367 [file] [log] [blame]
Alexander Afanasyeva1ae0a12014-01-28 15:21:02 -08001#! /usr/bin/env python
2# encoding: utf-8
3
4'''
5
6When using this tool, the wscript will look like:
7
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -07008 def options(opt):
9 opt.tool_options('openssl')
Alexander Afanasyeva1ae0a12014-01-28 15:21:02 -080010
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070011 def configure(conf):
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070012 conf.load('compiler_cxx openssl')
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070013 conf.check_openssl()
Alexander Afanasyeva1ae0a12014-01-28 15:21:02 -080014
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070015 def build(bld):
16 bld(source='main.cpp', target='app', use='OPENSSL')
Alexander Afanasyeva1ae0a12014-01-28 15:21:02 -080017
18'''
19
20from waflib import Options
21from waflib.Configure import conf
22
23@conf
24def check_openssl(self,*k,**kw):
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070025 root = k and k[0] or kw.get('path', None) or Options.options.with_openssl
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070026 mandatory = kw.get('mandatory', True)
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070027 var = kw.get('uselib_store', 'OPENSSL')
Alexander Afanasyeva1ae0a12014-01-28 15:21:02 -080028
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070029 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,
Alexander Afanasyevae80f102014-05-12 17:20:46 -070035 includes="%s/include" % root,
36 libpath="%s/lib" % root)
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070037 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,
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070042 mandatory=mandatory)
Alexander Afanasyeva1ae0a12014-01-28 15:21:02 -080043
44def options(opt):
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070045 opt.add_option('--with-openssl', type='string', default=None,
Alexander Afanasyev5e1288e2014-03-28 11:11:48 -070046 dest='with_openssl', help='''Path to OpenSSL''')