feature: now we automatically add the -msse4.2 compilation option for building the bundled LuaJIT when it is available.

This commit is contained in:
Yichun Zhang (agentzh)
2017-03-19 22:20:31 -07:00
parent b59ef879a5
commit 6b82ea1099
2 changed files with 141 additions and 93 deletions

23
util/configure vendored
View File

@ -5,6 +5,7 @@ use strict;
use warnings;
use File::Spec;
use File::Temp qw( tempfile tmpnam );
sub shell ($@);
sub env ($$);
@ -625,6 +626,28 @@ _END_
$luajit_xcflags .= " -DLUAJIT_ENABLE_LUA52COMPAT";
}
{
# check -msse4.2
my ($out, $cfile) = tempfile("resty-config-XXXXXX",
SUFFIX => '.c', TMPDIR => 1,
UNLINK => 1);
print $out "int main(void) { return 0; }";
close $out;
my $ofile = tmpnam();
my $comp = ($cc || 'cc');
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 {
print "WARNING: -msse4.2 not supported in $comp.\n";
}
}
if ($opts->{debug}) {
$luajit_xcflags .= " -DLUA_USE_APICHECK -DLUA_USE_ASSERT";
$luajit_xcflags =~ s/^ +//;