Skip to content

Commit 4f29543

Browse files
committed
feature: this module can now be built as a "dynamic module" with NGINX 1.9.11+ via the --add-dynamic-module=PATH option of ./configure.
1 parent 91c6590 commit 4f29543

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

README.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,14 @@ Build the source with this module:
299299
make install
300300
```
301301

302+
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
303+
`./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)
304+
directive, for example,
305+
306+
```nginx
307+
load_module /path/to/modules/ngx_http_lua_module.so;
308+
```
309+
302310
[Back to TOC](#table-of-contents)
303311

304312
C Macro Configurations

config

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,17 @@ END
284284
fi
285285
fi
286286

287+
ngx_module_incs=
288+
ngx_module_libs=
289+
287290
if [ $ngx_found = yes ]; then
288291
# this is a hack to persuade nginx's build system to favor
289292
# the paths set by our user environments:
290293
CFLAGS="$ngx_lua_opt_I $CFLAGS"
291294
NGX_LD_OPT="$ngx_lua_opt_L $NGX_LD_OPT"
292295

293-
CORE_INCS="$CORE_INCS $ngx_feature_path"
294-
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
296+
ngx_module_incs="$ngx_module_incs $ngx_feature_path"
297+
ngx_module_libs="$ngx_module_libs $ngx_feature_libs"
295298
else
296299
cat << END
297300
$0: error: ngx_http_lua_module requires the Lua library.
@@ -463,9 +466,21 @@ ngx_feature_test='setsockopt(1, SOL_SOCKET, SO_PASSCRED, NULL, 0);'
463466

464467
. auto/feature
465468

466-
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name"
467-
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_LUA_SRCS"
468-
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_LUA_DEPS"
469+
if test -n "$ngx_module_link"; then
470+
ngx_module_type=HTTP_AUX_FILTER
471+
ngx_module_name=$ngx_addon_name
472+
ngx_module_deps="$HTTP_LUA_DEPS"
473+
ngx_module_srcs="$HTTP_LUA_SRCS"
474+
475+
. auto/module
476+
else
477+
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name"
478+
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_LUA_SRCS"
479+
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_LUA_DEPS"
480+
481+
CORE_INCS="$CORE_INCS $ngx_module_incs"
482+
CORE_LIBS="$CORE_LIBS $ngx_module_libs"
483+
fi
469484

470485
#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'"
471486
#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'"

doc/HttpLuaModule.wiki

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ Build the source with this module:
233233
make install
234234
</geshi>
235235

236+
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
237+
`./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)
238+
directive, for example,
239+
240+
```nginx
241+
load_module /path/to/modules/ngx_http_lua_module.so;
242+
```
243+
236244
== C Macro Configurations ==
237245

238246
While building this module either via OpenResty or with the NGINX core, you can define the following C macros via the C compiler options:

0 commit comments

Comments
 (0)