mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
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
25
util/configure
vendored
25
util/configure
vendored
@ -632,18 +632,35 @@ _END_
|
|||||||
SUFFIX => '.c', TMPDIR => 1,
|
SUFFIX => '.c', TMPDIR => 1,
|
||||||
UNLINK => 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;
|
close $out;
|
||||||
|
|
||||||
my $ofile = tmpnam();
|
my $ofile = tmpnam();
|
||||||
my $comp = ($cc || 'cc');
|
my $comp = ($cc || 'cc');
|
||||||
|
my $found;
|
||||||
|
|
||||||
if (system("$comp -o $ofile -msse4.2 -c $cfile") == 0 && -s $ofile) {
|
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;
|
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";
|
print "WARNING: -msse4.2 not supported in $comp.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user