blob: 9bcb3a85ea849e1f01f208fc4d3216fbed60bbf4 [file] [log] [blame]
Alexander Afanasyev1160baa2014-04-10 18:50:29 -07001#! /usr/bin/env python
2# encoding: utf-8
3
4from waflib import Logs, Utils
5from waflib.Configure import conf
6
7OSX_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
14int main(int argc, char **argv) {
15 (void)argc; (void)argv;
16 return 0;
17}
18'''
19
20@conf
21def 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")