|
10 | 10 | from distutils.command.config import LANG_EXT |
11 | 11 | from distutils import log |
12 | 12 | from distutils.file_util import copy_file |
| 13 | +from distutils.msvccompiler import get_build_version as get_build_msvc_version |
13 | 14 | from numpy.distutils.exec_command import exec_command |
| 15 | +from numpy.distutils.misc_util import msvc_runtime_library |
| 16 | +from numpy.distutils.mingw32compiler import msvc_manifest_xml |
14 | 17 |
|
15 | 18 | LANG_EXT['f77'] = '.f' |
16 | 19 | LANG_EXT['f90'] = '.f90' |
@@ -110,6 +113,21 @@ def _link (self, body, |
110 | 113 | if fileexists: continue |
111 | 114 | log.warn('could not find library %r in directories %s' \ |
112 | 115 | % (libname, library_dirs)) |
| 116 | + elif self.compiler.compiler_type == 'mingw32': |
| 117 | + msver = get_build_msvc_version() |
| 118 | + if msver is not None: |
| 119 | + if msver >= 8: |
| 120 | + # check msvcr major version are the same for linking and |
| 121 | + # embedding |
| 122 | + msvcv = msvc_runtime_library() |
| 123 | + if msvcv: |
| 124 | + maj = msvcv[5:6] |
| 125 | + if not maj == int(msver): |
| 126 | + raise ValueError, |
| 127 | + "Dyscrepancy between linked msvcr " \ |
| 128 | + "(%f) and the one about to be embedded " \ |
| 129 | + "(%f)" % (int(msver), maj) |
| 130 | + |
113 | 131 | return self._wrap_method(old_config._link,lang, |
114 | 132 | (body, headers, include_dirs, |
115 | 133 | libraries, library_dirs, lang)) |
|
0 commit comments