testsuite: Use feature test rather than enumeration for complex

This commit is contained in:
Richard Henderson
2014-11-14 10:50:29 +01:00
parent b5ade2fb5d
commit f1301a54bb
2 changed files with 19 additions and 9 deletions

View File

@@ -223,6 +223,24 @@ proc libffi_target_compile { source dest type options } {
return [target_compile $source $dest $type $options]
}
# TEST should be a preprocessor condition. Returns true if it holds.
proc libffi_feature_test { test } {
set src "ffitest.c"
set f [open $src "w"]
puts $f "#include <ffi.h>"
puts $f $test
puts $f "xyzzy"
puts $f "#endif"
close $f
set lines [libffi_target_compile $src "" "preprocess" ""]
file delete $src
set last [lindex $lines end]
return [regexp -- "xyzzy" $last]
}
# Utility routines.
#