Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
| 4 | from waflib import Logs, Utils |
| 5 | from waflib.Configure import conf |
| 6 | |
| 7 | OSX_SECURITY_CODE=''' |
| 8 | #include <CoreFoundation/CoreFoundation.h> |
| 9 | #include <Security/Security.h> |
| 10 | #include <Security/SecRandom.h> |
| 11 | #include <CoreServices/CoreServices.h> |
| 12 | #include <Security/SecDigestTransform.h> |
Davide Pesavento | 7c02b47 | 2015-10-28 20:50:17 +0100 | [diff] [blame] | 13 | int main() {} |
Alexander Afanasyev | 1160baa | 2014-04-10 18:50:29 -0700 | [diff] [blame] | 14 | ''' |
| 15 | |
| 16 | @conf |
| 17 | def check_osx_security(conf, *k, **kw): |
| 18 | if Utils.unversioned_sys_platform() == "darwin": |
| 19 | try: |
| 20 | conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', |
| 21 | mandatory=True) |
| 22 | conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', |
| 23 | mandatory=True) |
| 24 | conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', |
| 25 | define_name='HAVE_SECURITY', use="OSX_COREFOUNDATION", |
| 26 | fragment=OSX_SECURITY_CODE, mandatory=True) |
| 27 | |
| 28 | conf.define('HAVE_OSX_SECURITY', 1) |
| 29 | conf.env['HAVE_OSX_SECURITY'] = True |
| 30 | except: |
| 31 | Logs.warn("Compiling on OSX, but CoreFoundation, CoreServices, or Security framework is not functional.") |
| 32 | Logs.warn("The frameworks are known to work only with Apple-specific compilers: llvm-gcc-4.2 or clang") |