Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
| 4 | ''' |
| 5 | |
| 6 | When 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 | |
| 20 | from waflib import Options |
| 21 | from waflib.Configure import conf |
| 22 | |
| 23 | @conf |
| 24 | def 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 Lehman | b45eed2 | 2015-01-13 14:58:07 -0600 | [diff] [blame^] | 33 | global_define=True, |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 34 | uselib_store=var, |
| 35 | mandatory=mandatory, |
Vince Lehman | b45eed2 | 2015-01-13 14:58:07 -0600 | [diff] [blame^] | 36 | includes="%s/include" % root, |
| 37 | libpath="%s/lib" % root) |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 38 | 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 | |
| 45 | def options(opt): |
| 46 | opt.add_option('--with-openssl', type='string', default=None, |
| 47 | dest='with_openssl', help='''Path to OpenSSL''') |