bugfix: the feature test for SSE 4.2 support did not really check if the local CPU indeed has it.
Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
This commit is contained in:
parent
79dc3c56aa
commit
eb8fc7771d
|
@ -632,18 +632,35 @@ _END_
|
|||
SUFFIX => '.c', TMPDIR => 1,
|
||||
UNLINK => 1);
|
||||
|
||||
print $out "int main(void) { return 0; }";
|
||||
print $out "
|
||||
int main(void) {
|
||||
#ifndef __SSE4_2__
|
||||
# error SSE 4.2 not found
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
";
|
||||
close $out;
|
||||
|
||||
my $ofile = tmpnam();
|
||||
my $comp = ($cc || 'cc');
|
||||
my $found;
|
||||
|
||||
if (system("$comp -o $ofile -msse4.2 -c $cfile") == 0 && -s $ofile) {
|
||||
print "INFO: found -msse4.2 in $comp.\n";
|
||||
$luajit_xcflags .= " -msse4.2";
|
||||
unlink $ofile;
|
||||
|
||||
} else {
|
||||
if (system("$comp -o $ofile -march=native -c $cfile") == 0 && -s $ofile) {
|
||||
print "INFO: found -msse4.2 in $comp.\n";
|
||||
$found = 1;
|
||||
$luajit_xcflags .= " -msse4.2";
|
||||
}
|
||||
}
|
||||
|
||||
if (-f $ofile) {
|
||||
unlink $ofile;
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
print "WARNING: -msse4.2 not supported in $comp.\n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue