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> |
| 13 | |
| 14 | int main(int argc, char **argv) { |
| 15 | (void)argc; (void)argv; |
| 16 | return 0; |
| 17 | } |
| 18 | ''' |
| 19 | |
| 20 | @conf |
| 21 | def check_osx_security(conf, *k, **kw): |
| 22 | if Utils.unversioned_sys_platform() == "darwin": |
| 23 | try: |
| 24 | conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', |
| 25 | mandatory=True) |
| 26 | conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', |
| 27 | mandatory=True) |
| 28 | conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', |
| 29 | define_name='HAVE_SECURITY', use="OSX_COREFOUNDATION", |
| 30 | fragment=OSX_SECURITY_CODE, mandatory=True) |
| 31 | |
| 32 | conf.define('HAVE_OSX_SECURITY', 1) |
| 33 | conf.env['HAVE_OSX_SECURITY'] = True |
| 34 | except: |
| 35 | Logs.warn("Compiling on OSX, but CoreFoundation, CoreServices, or Security framework is not functional.") |
| 36 | Logs.warn("The frameworks are known to work only with Apple-specific compilers: llvm-gcc-4.2 or clang") |