diff options
author | David Cournapeau <cournape@gmail.com> | 2009-03-11 13:23:44 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-03-11 13:23:44 +0000 |
commit | a082b6c2ece92b3a2ed572d55becd3546f9c801d (patch) | |
tree | 4fec43b035445859ac238d9a6fb2178fa9159177 /numpy/distutils/command/build_ext.py | |
parent | a2c67987055400e49c056f6301317a36dca5a244 (diff) | |
download | numpy-a082b6c2ece92b3a2ed572d55becd3546f9c801d.tar.gz |
Ugly hack to workaround some bug in mingw to make VS 2003 work with gfortran.
Diffstat (limited to 'numpy/distutils/command/build_ext.py')
-rw-r--r-- | numpy/distutils/command/build_ext.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 904cb9067..6787c0b30 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -16,7 +16,8 @@ from numpy.distutils.exec_command import exec_command from numpy.distutils.system_info import combine_paths from numpy.distutils.misc_util import filter_sources, has_f_sources, \ has_cxx_sources, get_ext_source_files, \ - get_numpy_include_dirs, is_sequence, get_build_architecture + get_numpy_include_dirs, is_sequence, get_build_architecture, \ + msvc_version from numpy.distutils.command.config_compiler import show_fortran_compilers try: @@ -387,6 +388,10 @@ class build_ext (old_build_ext): # expand libraries with fcompiler libraries as we are # not using fcompiler linker self._libs_with_msvc_and_fortran(fcompiler, libraries, library_dirs) + if fcompiler is not None and fcompiler.compiler_type == "gnu95": + if msvc_version(self.compiler) < 8: + self._add_dummy_mingwex_sym(c_sources) + libraries.append("_gfortran_workaround") elif ext.language in ['f77','f90'] and fcompiler is not None: linker = fcompiler.link_shared_object if ext.language=='c++' and cxx_compiler is not None: @@ -406,6 +411,14 @@ class build_ext (old_build_ext): debug=self.debug, build_temp=self.build_temp,**kws) + def _add_dummy_mingwex_sym(self, c_sources): + build_src = self.get_finalized_command("build_src").build_src + build_clib = self.get_finalized_command("build_clib").build_clib + objects = self.compiler.compile([os.path.join(build_src, + "gfortran_vs2003_hack.c")], + output_dir=self.build_temp) + self.compiler.create_static_lib(objects, "_gfortran_workaround", output_dir=build_clib, debug=self.debug) + def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries, c_library_dirs): if fcompiler is None: return |