diff options
author | David Cournapeau <cournape@gmail.com> | 2009-04-30 08:52:00 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-04-30 08:52:00 +0000 |
commit | 6ad5e7cda74b5f22db5201c9b306bc641dca4264 (patch) | |
tree | cffb924e7553ab0eadd264e1d5ff97f30cc2943f /numpy/distutils/command | |
parent | 9d309955e758e6d699565e09a697535a5237431c (diff) | |
download | numpy-6ad5e7cda74b5f22db5201c9b306bc641dca4264.tar.gz |
Do not harcode visibility macro, enable it for gcc 4.
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r-- | numpy/distutils/command/autodist.py | 14 | ||||
-rw-r--r-- | numpy/distutils/command/config.py | 6 |
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"): |