summaryrefslogtreecommitdiff
path: root/numpy/distutils/fcompiler/gnu.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-06-30 17:04:09 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-06-30 17:04:09 +0000
commitdfefe9591f959d78b886133ae46eb572e404064c (patch)
tree81d0c10fea2bddc7b3e15d58892ad05ad208f48c /numpy/distutils/fcompiler/gnu.py
parente8dda82fe6b30865aa8059df4ba3abaae6568892 (diff)
downloadnumpy-dfefe9591f959d78b886133ae46eb572e404064c.tar.gz
Update gfortran support on win64
We don't link the gfortran runtime when built with MS compilers: there are some incompatibilities between libgfortran and dependent libraries (mingwex, etc..) and the MS C runtime. Instead, we will implement the needed function from libgfortran and compile it with MS compiler, with the MS C runtime.
Diffstat (limited to 'numpy/distutils/fcompiler/gnu.py')
-rw-r--r--numpy/distutils/fcompiler/gnu.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py
index 8e25d1cb0..d55c7b0a2 100644
--- a/numpy/distutils/fcompiler/gnu.py
+++ b/numpy/distutils/fcompiler/gnu.py
@@ -2,6 +2,7 @@ import re
import os
import sys
import warnings
+import platform
from numpy.distutils.cpuinfo import cpu
from numpy.distutils.fcompiler import FCompiler
@@ -19,6 +20,13 @@ _R_ARCHS = {"ppc": r"^Target: (powerpc-.*)$",
"x86_64": r"^Target: (i686-.*)$",
"ppc64": r"^Target: (powerpc-.*)$",}
+# XXX: handle cross compilation
+def is_win64():
+ return sys.platform == "win32" and platform.architecture()[0] == "64bit"
+
+if is_win64():
+ _EXTRAFLAGS = ["-fno-leading-underscore"]
+
class GnuFCompiler(FCompiler):
compiler_type = 'gnu'
compiler_aliases = ('g77',)
@@ -220,10 +228,10 @@ class Gnu95FCompiler(GnuFCompiler):
executables = {
'version_cmd' : ["<F90>", "--version"],
'compiler_f77' : [None, "-Wall", "-ffixed-form",
- "-fno-second-underscore"],
- 'compiler_f90' : [None, "-Wall", "-fno-second-underscore"],
+ "-fno-second-underscore"] + _EXTRAFLAGS,
+ 'compiler_f90' : [None, "-Wall", "-fno-second-underscore"] + _EXTRAFLAGS,
'compiler_fix' : [None, "-Wall", "-ffixed-form",
- "-fno-second-underscore"],
+ "-fno-second-underscore"] + _EXTRAFLAGS,
'linker_so' : ["<F90>", "-Wall"],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"],
@@ -291,6 +299,13 @@ class Gnu95FCompiler(GnuFCompiler):
i = opt.index("gcc")
opt.insert(i+1, "mingwex")
opt.insert(i+1, "mingw32")
+ # XXX: fix this mess, does not work for mingw
+ if is_win64():
+ c_compiler = self.c_compiler
+ if c_compiler and c_compiler.compiler_type == "msvc":
+ return []
+ else:
+ raise NotImplementedError("Only MS compiler supported with gfortran on win64")
return opt
def get_target(self):
@@ -303,6 +318,11 @@ class Gnu95FCompiler(GnuFCompiler):
return m.group(1)
return ""
+ def get_flags_opt(self):
+ if is_win64():
+ return ['-O0']
+ else:
+ return GnuFCompiler.get_flags_opt(self)
def _can_target(cmd, arch):
"""Return true is the command supports the -arch flag for the given
architecture."""