# C optimizations
Set("COPT" => '-O2');
if (Get("CPU_ARCH") ne "unknown" && Get("CPU_ARCH") ne "default") {
- Append("COPT", '-march=$(CPU_ARCH)');
+ Append("COPT", '-march=' . Get("CPU_ARCH"));
}
# C optimizations for highly exposed code
### 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 ###