build: drop dependency on unused CoreServices framework

Change-Id: I91df33fafbcf275f7b41394112f8c002bc98af97
diff --git a/.waf-tools/osx-frameworks.py b/.waf-tools/osx-frameworks.py
index 477a7f7..76cd3df 100644
--- a/.waf-tools/osx-frameworks.py
+++ b/.waf-tools/osx-frameworks.py
@@ -4,48 +4,39 @@
 from waflib import Logs, Utils, TaskGen
 from waflib.Configure import conf
 
-OSX_SECURITY_CODE = '''
-#include <CoreFoundation/CoreFoundation.h>
-#include <Security/Security.h>
-#include <Security/SecRandom.h>
-#include <CoreServices/CoreServices.h>
-#include <Security/SecDigestTransform.h>
-int main() {}
-'''
+@conf
+def check_osx_framework_cxx(conf, fw_name, **kw):
+    conf.check_cxx(framework_name=fw_name,
+                   uselib_store='OSX_' + fw_name.upper(),
+                   fragment='#include <{0}/{0}.h>\nint main() {{}}'.format(fw_name),
+                   **kw)
 
-OSX_SYSTEMCONFIGURATION_CODE = '''
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-int main() {}
-'''
+@conf
+def check_osx_framework_mm(conf, fw_name, **kw):
+    conf.check_cxx(framework_name=fw_name,
+                   uselib_store='OSX_' + fw_name.upper(),
+                   fragment='#import <{0}/{0}.h>\nint main() {{}}'.format(fw_name),
+                   compile_filename='test.mm',
+                   **kw)
 
 @conf
 def check_osx_frameworks(conf, *k, **kw):
-    if Utils.unversioned_sys_platform() == "darwin":
+    if Utils.unversioned_sys_platform() == 'darwin':
         try:
-            conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION',
-                           mandatory=True)
-            conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES',
-                           mandatory=True)
-            conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY',
-                           use='OSX_COREFOUNDATION', fragment=OSX_SECURITY_CODE,
-                           mandatory=True)
-            conf.check_cxx(framework_name='SystemConfiguration', uselib_store='OSX_SYSTEMCONFIGURATION',
-                           use='OSX_COREFOUNDATION', fragment=OSX_SYSTEMCONFIGURATION_CODE,
-                           mandatory=True)
+            conf.check_osx_framework_cxx('CoreFoundation', mandatory=True)
+            conf.check_osx_framework_cxx('Security', use='OSX_COREFOUNDATION', mandatory=True)
+            conf.check_osx_framework_cxx('SystemConfiguration', use='OSX_COREFOUNDATION', mandatory=True)
 
-            conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION',
-                           mandatory=True, compile_filename='test.mm')
-            conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN',
-                           use="OSX_FOUNDATION", mandatory=True, compile_filename='test.mm')
+            conf.check_osx_framework_mm('Foundation', mandatory=True)
+            conf.check_osx_framework_mm('CoreWLAN', use='OSX_FOUNDATION', mandatory=True)
 
             conf.define('HAVE_OSX_FRAMEWORKS', 1)
             conf.env['HAVE_OSX_FRAMEWORKS'] = True
         except:
-            Logs.warn("Compiling on macOS, but required framework(s) is(are) not functional.")
-            Logs.warn("Note that the frameworks are known to work only with the Apple clang compiler.")
+            Logs.warn('Building on macOS, but one or more required frameworks are not functional.')
+            Logs.warn('Note that the frameworks are known to work only with the Apple clang compiler.')
 
 @TaskGen.extension('.mm')
 def m_hook(self, node):
-    """Alias .mm files to be compiled the same as .cpp files, gcc/clang will do the right thing."""
+    '''Alias .mm files to be compiled the same as .cpp files, clang will do the right thing.'''
     return self.create_compiled_task('cxx', node)
diff --git a/wscript b/wscript
index cfedb52..fa94ca3 100644
--- a/wscript
+++ b/wscript
@@ -19,34 +19,33 @@
 
     opt = opt.add_option_group('Library Options')
 
-    opt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
-                   help='''Build unit tests''')
+    opt.add_option('--with-examples', action='store_true', default=False,
+                   help='Build examples')
+
+    opt.add_option('--with-tests', action='store_true', default=False,
+                   help='Build unit tests')
 
     opt.add_option('--without-tools', action='store_false', default=True, dest='with_tools',
-                   help='''Do not build tools''')
-
-    opt.add_option('--with-examples', action='store_true', default=False, dest='with_examples',
-                   help='''Build examples''')
+                   help='Do not build tools')
 
     opt.add_option('--without-sqlite-locking', action='store_false', default=True,
                    dest='with_sqlite_locking',
-                   help='''Disable filesystem locking in sqlite3 database '''
-                        '''(use unix-dot locking mechanism instead). '''
-                        '''This option may be necessary if home directory is hosted on NFS.''')
+                   help='Disable filesystem locking in sqlite3 database '
+                        '(use unix-dot locking mechanism instead). '
+                        'This option may be necessary if the home directory is hosted on NFS.')
 
     opt.add_option('--without-osx-keychain', action='store_false', default=True,
-                   dest='with_osx_keychain',
-                   help='''On Darwin, do not use OSX keychain as a default TPM''')
+                   dest='with_osx_keychain', help='Do not use macOS Keychain as default TPM (macOS only)')
 
     opt.add_option('--enable-static', action='store_true', default=False,
-                   dest='enable_static', help='''Build static library (disabled by default)''')
+                   dest='enable_static', help='Build static library (disabled by default)')
     opt.add_option('--disable-static', action='store_false', default=False,
-                   dest='enable_static', help='''Do not build static library (disabled by default)''')
+                   dest='enable_static', help='Do not build static library (disabled by default)')
 
     opt.add_option('--enable-shared', action='store_true', default=True,
-                   dest='enable_shared', help='''Build shared library (enabled by default)''')
+                   dest='enable_shared', help='Build shared library (enabled by default)')
     opt.add_option('--disable-shared', action='store_false', default=True,
-                   dest='enable_shared', help='''Do not build shared library (enabled by default)''')
+                   dest='enable_shared', help='Do not build shared library (enabled by default)')
 
 def configure(conf):
     conf.start_msg('Building static library')
@@ -165,7 +164,7 @@
             target='ndn-cxx-mm',
             name='ndn-cxx-mm',
             source=bld.path.ant_glob(['src/**/*-osx.mm']),
-            use='version BOOST OPENSSL SQLITE3 RT PTHREAD OSX_COREFOUNDATION OSX_CORESERVICES OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN',
+            use='version BOOST OPENSSL SQLITE3 RT PTHREAD OSX_COREFOUNDATION OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN',
             includes='src')
 
     libndn_cxx = dict(
@@ -183,7 +182,7 @@
 
     if bld.env['HAVE_OSX_FRAMEWORKS']:
         libndn_cxx['source'] += bld.path.ant_glob('src/**/*-osx.cpp')
-        libndn_cxx['use'] += ' OSX_COREFOUNDATION OSX_CORESERVICES OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN'
+        libndn_cxx['use'] += ' OSX_COREFOUNDATION OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN'
 
     if bld.env['HAVE_NETLINK']:
         libndn_cxx['source'] += bld.path.ant_glob('src/**/*netlink*.cpp')
@@ -221,7 +220,7 @@
 
     EXTRA_FRAMEWORKS = ''
     if bld.env['HAVE_OSX_FRAMEWORKS']:
-        EXTRA_FRAMEWORKS = '-framework CoreFoundation -framework CoreServices -framework Security -framework SystemConfiguration -framework Foundation -framework CoreWLAN'
+        EXTRA_FRAMEWORKS = '-framework CoreFoundation -framework Security -framework SystemConfiguration -framework Foundation -framework CoreWLAN'
 
     def uniq(alist):
         seen = set()
@@ -281,8 +280,8 @@
         bld(features='sphinx',
             name='manpages',
             builder='man',
-            outdir='docs/manpages',
             config='docs/conf.py',
+            outdir='docs/manpages',
             source=bld.path.ant_glob('docs/manpages/**/*.rst'),
             install_path='${MANDIR}',
             VERSION=VERSION)