summaryrefslogtreecommitdiff
path: root/numpy/distutils
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils')
-rw-r--r--numpy/distutils/command/autodist.py14
-rw-r--r--numpy/distutils/command/config.py6
2 files changed, 19 insertions, 1 deletions
diff --git a/numpy/distutils/command/autodist.py b/numpy/distutils/command/autodist.py
index f246eb9f9..fe40119ef 100644
--- a/numpy/distutils/command/autodist.py
+++ b/numpy/distutils/command/autodist.py
@@ -23,3 +23,17 @@ static %(inline)s int static_func (void)
return kw
return ''
+
+def check_compiler_gcc4(cmd):
+ """Return True if the C compiler is GCC 4.x."""
+ cmd._check_compiler()
+ body = """
+int
+main()
+{
+#ifndef __GNUC__ && (__GNUC__ >= 4)
+die in an horrible death
+#endif
+}
+"""
+ return cmd.try_compile(body, None, None)
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py
index 67e4030a7..00821d260 100644
--- a/numpy/distutils/command/config.py
+++ b/numpy/distutils/command/config.py
@@ -15,7 +15,7 @@ from distutils.ccompiler import CompileError, LinkError
import distutils
from numpy.distutils.exec_command import exec_command
from numpy.distutils.mingw32ccompiler import generate_manifest
-from numpy.distutils.command.autodist import check_inline
+from numpy.distutils.command.autodist import check_inline, check_compiler_gcc4
LANG_EXT['f77'] = '.f'
LANG_EXT['f90'] = '.f90'
@@ -346,6 +346,10 @@ int main ()
otherwise."""
return check_inline(self)
+ def check_compiler_gcc4(self):
+ """Return True if the C compiler is gcc >= 4."""
+ return check_compiler_gcc4(self)
+
def get_output(self, body, headers=None, include_dirs=None,
libraries=None, library_dirs=None,
lang="c"):