'set up compiler settings, based on config'

def init_settings_from_config(self):

    cfg = self.config
    if ((sys.platform == 'win32') and (cfg.get('bundle_msvcp') is None)):
        if (os.environ.get('PYZMQ_BUNDLE_CRT') or ((sys.version_info >= (3, 5)) and (self.compiler_type == 'msvc') and (not os.environ.get('DISTUTILS_USE_SDK')) and doing_bdist)):
            cfg['bundle_msvcp'] = True
    if cfg['libzmq_extension']:
        settings = bundled_settings(self.debug)
    else:
        settings = settings_from_prefix(cfg['zmq_prefix'], self.bundle_libzmq_dylib)
    if ('have_sys_un_h' not in cfg):
        minus_zmq = copy.deepcopy(settings)
        try:
            minus_zmq['libraries'] = []
        except Exception:
            pass
        try:
            compile_and_forget(self.tempdir, pjoin('buildutils', 'check_sys_un.c'), **minus_zmq)
        except Exception as e:
            warn(('No    sys/un.h,    IPC_PATH_MAX_LEN    will    be    undefined:    %s' % e))
            cfg['have_sys_un_h'] = False
        else:
            cfg['have_sys_un_h'] = True
        self.save_config('config', cfg)
    if cfg['have_sys_un_h']:
        settings['define_macros'] = [('HAVE_SYS_UN_H', 1)]
    settings.setdefault('define_macros', [])
    settings.setdefault('include_dirs', [])
    settings['include_dirs'] += [pjoin('zmq', sub) for sub in ('utils', pjoin('backend', 'cython'), 'devices')]
    if (sys.platform.startswith('win') and (sys.version_info < (3, 3))):
        settings['include_dirs'].insert(0, pjoin('buildutils', 'include_win32'))
    for ext in self.distribution.ext_modules:
        if ext.name.startswith('zmq.lib'):
            continue
        for (attr, value) in settings.items():
            setattr(ext, attr, value)
    self.compiler_settings = settings
    self.save_config('compiler', settings)
