summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2014-07-06 17:17:41 +0900
committerDavid Cournapeau <cournape@gmail.com>2014-07-06 17:17:41 +0900
commit4769fe79bb5c2d4649fa2845009a0ceae94524c2 (patch)
treeba1231d72d55aaec332b51da3e996c0364bdccd4 /numpy/distutils/command
parent66c792b0e2c3ba68e844e92770f312074ed9bc4a (diff)
downloadnumpy-4769fe79bb5c2d4649fa2845009a0ceae94524c2.tar.gz
FEAT: add check_gcc_function_attribute check.
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r--numpy/distutils/command/autodist.py17
-rw-r--r--numpy/distutils/command/config.py6
2 files changed, 22 insertions, 1 deletions
diff --git a/numpy/distutils/command/autodist.py b/numpy/distutils/command/autodist.py
index 1b9b1dd57..5602f3857 100644
--- a/numpy/distutils/command/autodist.py
+++ b/numpy/distutils/command/autodist.py
@@ -41,3 +41,20 @@ main()
}
"""
return cmd.try_compile(body, None, None)
+
+
+def check_gcc_function_attribute(cmd, attribute, name):
+ """Return True if the given function attribute is supported."""
+ cmd._check_compiler()
+ body = """
+int %s %s(void*);
+
+int
+main()
+{
+}
+""" % (attribute, name)
+ ret, output = cmd.try_output_compile(body, None, None)
+ if not ret or len(output) > 0:
+ return False
+ return True
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py
index e96b88319..0334f342c 100644
--- a/numpy/distutils/command/config.py
+++ b/numpy/distutils/command/config.py
@@ -16,7 +16,8 @@ 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, check_compiler_gcc4
+from numpy.distutils.command.autodist import (check_gcc_function_attribute,
+ check_inline, check_compiler_gcc4)
from numpy.distutils.compat import get_exception
LANG_EXT['f77'] = '.f'
@@ -422,6 +423,9 @@ int main ()
"""Return True if the C compiler is gcc >= 4."""
return check_compiler_gcc4(self)
+ def check_gcc_function_attribute(self, attribute, name):
+ return check_gcc_function_attribute(self, attribute, name)
+
def get_output(self, body, headers=None, include_dirs=None,
libraries=None, library_dirs=None,
lang="c", use_tee=None):