diff --git a/util/configure b/util/configure index 9102396..969381c 100755 --- a/util/configure +++ b/util/configure @@ -88,6 +88,21 @@ my @modules = ( [stream_lua => 'ngx_stream_lua'], ); +my @lua_resty_libs = ( + 'core', + 'dns', + 'limit_traffic', + 'lock', + 'lrucache', + 'memcached', + 'mysql', + 'redis', + 'string', + 'upload', + 'upstream_healthcheck', + 'websocket', +); + my $without_resty_mods_regex; { my $s = '^--without-(' @@ -118,6 +133,17 @@ my $with_resty_mods_regex; $with_resty_mods_regex = qr/$s/; } +my $without_lua_resty_libs_regex; +{ + my $s = '^--without-lua_resty_(' + . join('|', + @lua_resty_libs + ) + . ')$'; + + $without_lua_resty_libs_regex = qr/$s/; +} + my $prefix = '/usr/local/openresty'; my $ngx_sbin; my %resty_opts; @@ -180,51 +206,6 @@ for my $opt (@ARGV) { $resty_opts{no_ndk} = 1; push @ngx_opts, $opt; - } elsif ($opt eq '--without-lua_cjson') { - $resty_opts{no_lua_cjson} = 1; - - } elsif ($opt eq '--without-lua_redis_parser') { - $resty_opts{no_lua_redis_parser} = 1; - - } elsif ($opt eq '--without-lua_resty_memcached') { - $resty_opts{no_lua_resty_memcached} = 1; - - } elsif ($opt eq '--without-lua_resty_redis') { - $resty_opts{no_lua_resty_redis} = 1; - - } elsif ($opt eq '--without-lua_resty_dns') { - $resty_opts{no_lua_resty_dns} = 1; - - } elsif ($opt eq '--without-lua_resty_mysql') { - $resty_opts{no_lua_resty_mysql} = 1; - - } elsif ($opt eq '--without-lua_resty_upload') { - $resty_opts{no_lua_resty_upload} = 1; - - } elsif ($opt eq '--without-lua_resty_string') { - $resty_opts{no_lua_resty_string} = 1; - - } elsif ($opt eq '--without-lua_resty_limit_traffic') { - $resty_opts{no_lua_resty_limit_traffic} = 1; - - } elsif ($opt eq '--without-lua_resty_websocket') { - $resty_opts{no_lua_resty_websocket} = 1; - - } elsif ($opt eq '--without-lua_resty_lock') { - $resty_opts{no_lua_resty_lock} = 1; - - } elsif ($opt eq '--without-lua_resty_lrucache') { - $resty_opts{no_lua_resty_lrucache} = 1; - - } elsif ($opt eq '--without-lua_resty_core') { - $resty_opts{no_lua_resty_core} = 1; - - } elsif ($opt eq '--without-lua_resty_upstream_healthcheck') { - $resty_opts{no_lua_resty_upstream_healthcheck} = 1; - - } elsif ($opt eq '--without-lua_rds_parser') { - $resty_opts{no_lua_rds_parser} = 1; - } elsif ($opt eq '--with-debug') { $resty_opts{debug} = 1; @@ -236,17 +217,32 @@ for my $opt (@ARGV) { } elsif ($opt =~ /^--with-ld-opt=(.*)/) { push @ngx_ld_opts, $1; + + } elsif ($opt eq '--without-ngx_devel_kit_module') { + $resty_opts{no_ndk} = 1; } elsif ($opt =~ $without_resty_mods_regex) { #die "no_$1\n"; $resty_opts{"no_$1"} = 1; - } elsif ($opt eq '--without-ngx_devel_kit_module') { - $resty_opts{no_ndk} = 1; - } elsif ($opt =~ $with_resty_mods_regex) { $resty_opts{"$1"} = 1; + } elsif ($opt =~ $without_lua_resty_libs_regex) { + $resty_opts{"no_lua_resty_$1"} = 1; + + } elsif ($opt =~ /--without-lua_resty_(.*)/) { + die "$opt : lib not included"; + + } elsif ($opt eq '--without-lua_cjson') { + $resty_opts{no_lua_cjson} = 1; + + } elsif ($opt eq '--without-lua_rds_parser') { + $resty_opts{no_lua_rds_parser} = 1; + + } elsif ($opt eq '--without-lua_redis_parser') { + $resty_opts{no_lua_redis_parser} = 1; + } elsif ($opt eq '--with-luajit') { $resty_opts{luajit} = 1; @@ -394,7 +390,7 @@ push @make_install_cmds, if ($platform ne 'msys') { push @make_install_cmds, - "ln -sf $ngx_sbin \$(DESTDIR)$prefix/bin/openresty"; + "ln -sf \$(DESTDIR)$ngx_sbin \$(DESTDIR)$prefix/bin/openresty"; } cd '../..'; # to the root @@ -1095,8 +1091,7 @@ _EOC_ "\$(MAKE) install$extra_opts"; } - for my $key (qw(dns memcached redis mysql string upload websocket - lock lrucache core upstream_healthcheck limit_traffic)) + for my $key (@lua_resty_libs) { unless ($opts->{"no_lua_resty_$key"}) { (my $key2 = $key) =~ s/_/-/g; @@ -1116,7 +1111,8 @@ _EOC_ } } - # configure opm: + # configure opm + { my $opm_dir = auto_complete 'opm'; my $target_dir; @@ -1129,7 +1125,7 @@ _EOC_ . "$root_dir/build/install bin/* $target_dir"; } - # configure resty-cli: + # configure resty-cli { my $resty_cli_dir = auto_complete 'resty-cli'; @@ -1143,7 +1139,8 @@ _EOC_ . "$root_dir/build/install bin/* $target_dir"; if ($platform ne 'msys') { - # patch the resty script: + + # patch the resty script print "patching the resty script with hard-coded nginx binary ", "path...\n"; @@ -1283,19 +1280,27 @@ _EOC_ --without-lua_cjson disable the lua-cjson library --without-lua_redis_parser disable the lua-redis-parser library --without-lua_rds_parser disable the lua-rds-parser library - --without-lua_resty_dns disable the lua-resty-dns library - --without-lua_resty_memcached disable the lua-resty-memcached library - --without-lua_resty_redis disable the lua-resty-redis library - --without-lua_resty_mysql disable the lua-resty-mysql library - --without-lua_resty_upload disable the lua-resty-upload library - --without-lua_resty_upstream_healthcheck - disable the lua-resty-upstream-healthcheck library - --without-lua_resty_string disable the lua-resty-string library - --without-lua_resty_websocket disable the lua-resty-websocket library - --without-lua_resty_limit_traffic disable the lua-resty-limit-traffic library - --without-lua_resty_lock disable the lua-resty-lock library - --without-lua_resty_lrucache disable the lua-resty-lrucache library - --without-lua_resty_core disable the lua-resty-core library +_EOC_ + + for my $name (@lua_resty_libs) { + + my $opt = " --without-lua_resty_${name}"; + $msg .= $opt; + + my $n = $opt_max_len - length $opt; + + if ($n > 0) { + $msg .= " " x $n; + + } else { + $msg .= "\n" . (" " x $opt_max_len); + } + + (my $name2 = $name) =~ s/_/-/g; + $msg .= "disable the lua-resty-${name2} library\n"; + } + + $msg .= <<'_EOC_'; --with-luajit enable and build the bundled LuaJIT 2.1 (the default) --with-luajit=DIR use the external LuaJIT 2.1 installation specified by DIR