@@ -153,14 +153,17 @@ else
153
153
fi
154
154
fi
155
155
156
+ ngx_module_incs=
157
+ ngx_module_libs=
158
+
156
159
if [ $ngx_found = yes ]; then
157
160
# this is a hack to persuade nginx's build system to favor
158
161
# the paths set by our user environment
159
162
CFLAGS="$ngx_lua_opt_I $CFLAGS"
160
163
NGX_LD_OPT="$ngx_lua_opt_L $NGX_LD_OPT"
161
164
162
- CORE_INCS ="$CORE_INCS $ngx_feature_path"
163
- CORE_LIBS ="$CORE_LIBS $ngx_feature_libs"
165
+ ngx_module_incs ="$ngx_module_incs $ngx_feature_path"
166
+ ngx_module_libs ="$ngx_module_libs $ngx_feature_libs"
164
167
else
165
168
cat << END
166
169
$0: error: ngx_stream_lua_module requires the LuaJIT library.
@@ -175,7 +178,8 @@ ngx_feature_run=no
175
178
ngx_feature_incs="#include <luajit.h>"
176
179
ngx_feature_test="#if !defined(LUAJIT_VERSION_NUM) || LUAJIT_VERSION_NUM < 20000
177
180
# error unsupported LuaJIT version
178
- #endif"
181
+ #endif
182
+ "
179
183
180
184
. auto/feature
181
185
@@ -193,7 +197,8 @@ ngx_feature_run=no
193
197
ngx_feature_incs="#include <lua.h>"
194
198
ngx_feature_test="#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM != 501
195
199
# error unsupported Lua language version
196
- #endif"
200
+ #endif
201
+ "
197
202
198
203
. auto/feature
199
204
207
212
# ----------------------------------------
208
213
209
214
ngx_feature="LuaJIT has FFI"
210
- ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a $luajit_ld_opt"
211
- ngx_feature_run=yes
215
+ CC_TEST_FLAGS="$ngx_lua_opt_I $CFLAGS"
216
+ ngx_feature_libs="$ngx_module_libs"
217
+ ngx_feature_run=no
212
218
ngx_feature_incs="#include <lualib.h>
213
219
#include <lauxlib.h>
214
- #include <assert.h>"
220
+ #include <assert.h>
221
+ "
215
222
ngx_feature_test="lua_State *L = luaL_newstate();
216
223
assert(L != NULL);
217
- luaopen_ffi(L);"
224
+ luaopen_ffi(L);
225
+ "
218
226
219
227
. auto/feature
220
228
228
236
# ----------------------------------------
229
237
230
238
ngx_addon_name=ngx_stream_lua_module
231
- NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
239
+ STREAM_LUA_SRCS=" \
232
240
$ngx_addon_dir/src/ngx_stream_lua_api.c \
233
241
$ngx_addon_dir/src/ngx_stream_lua_request.c \
234
242
$ngx_addon_dir/src/ngx_stream_lua_module.c \
@@ -274,8 +282,9 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
274
282
$ngx_addon_dir/src/ngx_stream_lua_input_filters.c \
275
283
"
276
284
277
- NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
285
+ STREAM_LUA_DEPS=" \
278
286
$ngx_addon_dir/src/ddebug.h \
287
+ $ngx_addon_dir/src/ngx_stream_lua_autoconf.h \
279
288
$ngx_addon_dir/src/api/ngx_stream_lua_api.h \
280
289
$ngx_addon_dir/src/ngx_stream_lua_request.h \
281
290
$ngx_addon_dir/src/ngx_stream_lua_common.h \
@@ -316,8 +325,6 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
316
325
$ngx_addon_dir/src/ngx_stream_lua_input_filters.h \
317
326
"
318
327
319
- STREAM_MODULES="$STREAM_MODULES $ngx_addon_name"
320
-
321
328
# ----------------------------------------
322
329
323
330
ngx_feature="export symbols by default (-E)"
@@ -379,6 +386,24 @@ ngx_feature_test='struct sigaction act;
379
386
380
387
# ----------------------------------------
381
388
389
+ if [ -n "$ngx_module_link" ]; then
390
+ ngx_module_type=STREAM
391
+ ngx_module_name=$ngx_addon_name
392
+ ngx_module_deps="$STREAM_LUA_DEPS"
393
+ ngx_module_srcs="$STREAM_LUA_SRCS"
394
+
395
+ . auto/module
396
+ else
397
+ STREAM_MODULES="$STREAM_MODULES $ngx_addon_name"
398
+ NGX_ADDON_SRCS="$NGX_ADDON_SRCS $STREAM_LUA_SRCS"
399
+ NGX_ADDON_DEPS="$NGX_ADDON_DEPS $STREAM_LUA_DEPS"
400
+
401
+ CORE_INCS="$CORE_INCS $ngx_module_incs"
402
+ CORE_LIBS="$CORE_LIBS $ngx_module_libs"
403
+ fi
404
+
405
+ # ----------------------------------------
406
+
382
407
if [ $USE_PCRE = YES -o $PCRE != NONE ] && [ $PCRE != NO -a $PCRE != YES ]; then
383
408
# force pcre_version symbol to be required when PCRE is statically linked
384
409
case "$NGX_PLATFORM" in
@@ -426,5 +451,4 @@ USE_SHA1=YES
426
451
427
452
CORE_INCS="$CORE_INCS $ngx_addon_dir/src/api"
428
453
429
- #CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'"
430
- #CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'"
454
+ echo "/* DO NOT EDIT! This file was automatically generated by config */" > "$ngx_addon_dir/src/ngx_stream_lua_autoconf.h"
0 commit comments