feature: ./configure: the user flags specified by the --with-luajit-xcflags=FLAGS option are not appended to the default flags instead of being prepended. thanks spacewander for the report in #256.

This commit is contained in:
Yichun Zhang (agentzh)
2017-05-06 17:38:10 -07:00
parent dafd10b27d
commit a8ea810fdc
2 changed files with 33 additions and 20 deletions

17
util/configure vendored
View File

@ -129,6 +129,7 @@ my @ngx_rpaths;
my $cc;
my $cores;
my $luajit_xcflags = '';
my $user_luajit_xcflags;
my $no_luajit_lua52;
my (@ngx_opts, @ngx_cc_opts, @ngx_ld_opts);
@ -256,7 +257,7 @@ for my $opt (@ARGV) {
$resty_opts{luajit_path} = $1;
} elsif ($opt =~ /^--with-luajit-xcflags=(.*)/) {
$luajit_xcflags .= " $1";
$user_luajit_xcflags .= " $1";
} elsif ($opt =~ /^--without-luajit-lua52/) {
$no_luajit_lua52 = 1;
@ -621,11 +622,14 @@ _END_
}
if (!$no_luajit_lua52
&& (!$luajit_xcflags || $luajit_xcflags !~ /-DLUAJIT_ENABLE_LUA52COMPAT\b/))
&& (!$user_luajit_xcflags
|| $user_luajit_xcflags !~ /-DLUAJIT_ENABLE_LUA52COMPAT\b/))
{
$luajit_xcflags .= " -DLUAJIT_ENABLE_LUA52COMPAT";
}
if (!$user_luajit_xcflags
|| $user_luajit_xcflags !~ /-msse4\.2\b/)
{
# check -msse4.2
my ($out, $cfile) = tempfile("resty-config-XXXXXX",
@ -667,10 +671,19 @@ int main(void) {
if ($opts->{debug}) {
$luajit_xcflags .= " -DLUA_USE_APICHECK -DLUA_USE_ASSERT";
if ($user_luajit_xcflags) {
$luajit_xcflags .= $user_luajit_xcflags;
}
$luajit_xcflags =~ s/^ +//;
$extra_opts .= qq{ Q= XCFLAGS='$luajit_xcflags'};
} else {
if ($user_luajit_xcflags) {
$luajit_xcflags .= $user_luajit_xcflags;
}
if ($luajit_xcflags) {
$luajit_xcflags =~ s/^ +//;
$extra_opts .= qq{ XCFLAGS='$luajit_xcflags'};