Merge pull request #237 from tschwinge/libffi_feature_test
Simplify/fix libffi_feature_test
This commit is contained in:
@@ -225,20 +225,21 @@ proc libffi_target_compile { source dest type options } {
|
|||||||
|
|
||||||
# TEST should be a preprocessor condition. Returns true if it holds.
|
# TEST should be a preprocessor condition. Returns true if it holds.
|
||||||
proc libffi_feature_test { test } {
|
proc libffi_feature_test { test } {
|
||||||
set src "ffitest.c"
|
set src "ffitest[pid].c"
|
||||||
|
|
||||||
set f [open $src "w"]
|
set f [open $src "w"]
|
||||||
puts $f "#include <ffi.h>"
|
puts $f "#include <ffi.h>"
|
||||||
puts $f $test
|
puts $f $test
|
||||||
puts $f "xyzzy"
|
puts $f "/* OK */"
|
||||||
|
puts $f "#else"
|
||||||
|
puts $f "# error Failed $test"
|
||||||
puts $f "#endif"
|
puts $f "#endif"
|
||||||
close $f
|
close $f
|
||||||
|
|
||||||
set lines [libffi_target_compile $src "" "preprocess" ""]
|
set lines [libffi_target_compile $src /dev/null assembly ""]
|
||||||
file delete $src
|
file delete $src
|
||||||
|
|
||||||
set last [lindex $lines end]
|
return [string match "" $lines]
|
||||||
return [regexp -- "xyzzy" $last]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Utility routines.
|
# Utility routines.
|
||||||
|
|||||||
Reference in New Issue
Block a user