summaryrefslogtreecommitdiff
path: root/numpy/core/setup.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2007-12-22 03:20:08 +0000
committerDavid Cournapeau <cournape@gmail.com>2007-12-22 03:20:08 +0000
commit2d914ba6055da226a039dd846b19363532a26254 (patch)
tree5d34ced0a8a54caaf49e57f265232ca479e4e8ba /numpy/core/setup.py
parentb8964ed9b2ee180111d9b72052a0e19cb536a89f (diff)
downloadnumpy-2d914ba6055da226a039dd846b19363532a26254.tar.gz
Add code to test for a declaration in header
Diffstat (limited to 'numpy/core/setup.py')
-rw-r--r--numpy/core/setup.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index d51c3110b..1ec9be8e7 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -39,6 +39,19 @@ def configuration(parent_package='',top_path=None):
header_dir = 'include/numpy' # this is relative to config.path_in_package
+ def generate_declaration_test(symbol, includes):
+ main_src = """
+int main()
+{
+#ifndef %s
+ (void) %s;
+#endif
+ ;
+ return 0;
+}""" % (symbol, symbol)
+
+ return "\n".join([includes, main_src])
+
def generate_config_h(ext, build_dir):
target = join(build_dir,'config.h')
if newer(__file__,target):
@@ -58,12 +71,18 @@ def configuration(parent_package='',top_path=None):
raise SystemError,"Failed to test configuration. "\
"See previous error messages for more information."
- # Python 2.3 causes a segfault when
- # trying to re-acquire the thread-state
- # which is done in error-handling
- # ufunc code. NPY_ALLOW_C_API and friends
- # cause the segfault. So, we disable threading
- # for now.
+ def test_declaration(symbol, includes = ""):
+ code = generate_declaration_test(symbol, includes)
+ result = config_cmd.try_run(code, include_dirs = [python_include],
+ library_dirs = default_lib_dirs)
+ return result
+
+ # Python 2.3 causes a segfault when
+ # trying to re-acquire the thread-state
+ # which is done in error-handling
+ # ufunc code. NPY_ALLOW_C_API and friends
+ # cause the segfault. So, we disable threading
+ # for now.
if sys.version[:5] < '2.4.2':
nosmp = 1
else: