diff --git a/README.md b/README.md index dc8a4867..c5504abf 100644 --- a/README.md +++ b/README.md @@ -325,6 +325,17 @@ export LUAJIT_INC=/path/to/luajit/include/luajit-2.1 --add-module=/path/to/stream-lua-nginx-module ``` +Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the +`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) +directive, for example, + +```nginx +load_module /path/to/modules/ngx_stream_lua_module.so; +``` + +Also, please notr, that if you have `stream` module itself also muilt as dynamic module, you MUST load it **before** `stream_lua` module. + + [Back to TOC](#table-of-contents) Community diff --git a/config b/config index 921004b5..b770c306 100644 --- a/config +++ b/config @@ -284,14 +284,20 @@ END fi fi + +ngx_module_incs= +ngx_module_libs= +STREAM_LUA_SRCS= +STREAM_LUA_DEPS= + if [ $ngx_found = yes ]; then # this is a hack to persuade nginx's build system to favor # the paths set by our user environments: CFLAGS="$ngx_lua_opt_I $CFLAGS" NGX_LD_OPT="$ngx_lua_opt_L $NGX_LD_OPT" - CORE_INCS="$CORE_INCS $ngx_feature_path" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + ngx_module_incs="$ngx_module_incs $ngx_feature_path" + ngx_module_libs="$ngx_module_libs $ngx_feature_libs" else cat << END $0: error: ngx_stream_lua_module requires the Lua library. @@ -299,9 +305,7 @@ END exit 1 fi -ngx_addon_name=ngx_stream_lua_module -STREAM_MODULES="$STREAM_MODULES ngx_stream_lua_module" -NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ +STREAM_LUA_SRCS="$STREAM_LUA_SRCS \ $ngx_addon_dir/src/ngx_stream_lua_module.c \ $ngx_addon_dir/src/ngx_stream_lua_directive.c \ $ngx_addon_dir/src/ngx_stream_lua_lex.c \ @@ -338,7 +342,7 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ $ngx_addon_dir/src/ngx_stream_lua_initworkerby.c \ " -NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ +STREAM_LUA_DEPS="$STREAM_LUA_DEPS \ $ngx_addon_dir/src/ddebug.h \ $ngx_addon_dir/src/ngx_stream_lua_common.h \ $ngx_addon_dir/src/ngx_stream_lua_lex.h \ @@ -375,6 +379,23 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ $ngx_addon_dir/src/ngx_stream_lua_initworkerby.h \ " +ngx_addon_name=ngx_stream_lua_module +if test -n "$ngx_module_link"; then + ngx_module_type=STREAM + ngx_module_name="$ngx_addon_name" + ngx_module_deps="$STREAM_LUA_DEPS" + ngx_module_srcs="$STREAM_LUA_SRCS" + + . auto/module +else + STREAM_MODULES="$STREAM_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $STREAM_LUA_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $STREAM_LUA_DEPS" + + CORE_INCS="$CORE_INCS $ngx_module_incs" + CORE_LIBS="$CORE_LIBS $ngx_module_libs" +fi + ngx_feature="export symbols by default (-E)" ngx_feature_libs="-Wl,-E" ngx_feature_name=