### Compiling test programs ###
-sub TestCompile($) {
- my ($source) = @_;
- my $dir = 'conftest';
+sub TestCompile($$) {
+ my ($testname, $source) = @_;
+ my $dir = "conftest-$testname";
`rm -rf $dir && mkdir $dir`; $? and Fail "Cannot initialize $dir";
open SRC, ">$dir/conftest.c";
);
`$cmd`;
my $result = !$?;
+
+ `rm -rf $dir` unless Get("KEEP_CONFTEST");
+
+ return $result;
}
### Writing C headers with configuration ###
# Detect if thread-local storage is supported
if (Get("CONFIG_UCW_THREADS")) {
TestBool("CONFIG_UCW_TLS", "Checking if GCC supports thread-local storage", sub {
- if (UCW::Configure::C::TestCompile("__thread int i;\nint main(void) { return 0; }\n")) {
+ if (UCW::Configure::C::TestCompile("__thread", "__thread int i;\nint main(void) { return 0; }\n")) {
return 1;
} else {
return 0;