blob: f7f273e68f3305e69f851c50ca6c23df481b3ce5 [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>
Davide Pesavento7c02b472015-10-28 20:50:17 +010013int main() {}
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070014'''
15
16@conf
17def 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")