summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r--numpy/distutils/command/build_ext.py36
-rw-r--r--numpy/distutils/command/config.py14
2 files changed, 41 insertions, 9 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index 6cc7ce5bd..93bb3464a 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -391,6 +391,33 @@ class build_ext (old_build_ext):
def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries, c_library_dirs):
if fcompiler is None: return
+
+ for libname in c_libraries:
+ if libname.startswith('msvc'): continue
+ fileexists = False
+ for libdir in c_library_dirs or []:
+ libfile = os.path.join(libdir,'%s.lib' % (libname))
+ if os.path.isfile(libfile):
+ fileexists = True
+ break
+ if fileexists: continue
+ # make g77-compiled static libs available to MSVC
+ fileexists = False
+ for libdir in c_library_dirs:
+ libfile = os.path.join(libdir,'lib%s.a' % (libname))
+ if os.path.isfile(libfile):
+ # copy libname.a file to name.lib so that MSVC linker
+ # can find it
+ libfile2 = os.path.join(self.build_temp, libname + '.lib')
+ copy_file(libfile, libfile2)
+ if self.build_temp not in c_library_dirs:
+ c_library_dirs.append(self.build_temp)
+ fileexists = True
+ break
+ if fileexists: continue
+ log.warn('could not find library %r in directories %s' \
+ % (libname, c_library_dirs))
+
# Always use system linker when using MSVC compiler.
f_lib_dirs = []
for dir in fcompiler.library_dirs:
@@ -404,17 +431,16 @@ class build_ext (old_build_ext):
c_library_dirs.extend(f_lib_dirs)
# make g77-compiled static libs available to MSVC
- lib_added = False
for lib in fcompiler.libraries:
- if not lib.startswith('msvcr'):
+ if not lib.startswith('msvc'):
c_libraries.append(lib)
p = combine_paths(f_lib_dirs, 'lib' + lib + '.a')
if p:
dst_name = os.path.join(self.build_temp, lib + '.lib')
- copy_file(p[0], dst_name)
- if not lib_added:
+ if not os.path.isfile(dst_name):
+ copy_file(p[0], dst_name)
+ if self.build_temp not in c_library_dirs:
c_library_dirs.append(self.build_temp)
- lib_added = True
return
def get_source_files (self):
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py
index 0d13d8e53..090c639a3 100644
--- a/numpy/distutils/command/config.py
+++ b/numpy/distutils/command/config.py
@@ -72,23 +72,29 @@ class config(old_config):
if libname not in libraries:
libraries.append(libname)
for libname in libraries:
- if libname.startswith('msvcr'): continue
+ if libname.startswith('msvc'): continue
fileexists = False
for libdir in library_dirs or []:
libfile = os.path.join(libdir,'%s.lib' % (libname))
if os.path.isfile(libfile):
fileexists = True
break
- if fileexists:
- continue
+ if fileexists: continue
# make g77-compiled static libs available to MSVC
+ fileexists = False
for libdir in library_dirs:
libfile = os.path.join(libdir,'lib%s.a' % (libname))
if os.path.isfile(libfile):
# copy libname.a file to name.lib so that MSVC linker
# can find it
- copy_file(libfile, os.path.join(libdir,'%s.lib' % (libname)))
+ libfile2 = os.path.join(libdir,'%s.lib' % (libname))
+ copy_file(libfile, libfile2)
+ self.temp_files.append(libfile2)
+ fileexists = True
break
+ if fileexists: continue
+ log.warn('could not find library %r in directories %s' \
+ % (libname, library_dirs))
return self._wrap_method(old_config._link,lang,
(body, headers, include_dirs,
libraries, library_dirs, lang))