diff --git a/auto/config.gcc b/auto/config.gcc new file mode 100644 index 0000000000..bd9062a4f7 --- /dev/null +++ b/auto/config.gcc @@ -0,0 +1,402 @@ +ngx_feature="Lua library" +ngx_feature_libs="-llua -lm" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs="#include " +ngx_feature_path= +ngx_feature_test="#if LUA_VERSION_NUM != 501 +# error unsupported Lua language version +#endif +(void) luaL_newstate();" +ngx_lua_opt_I= +ngx_lua_opt_L= + +if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then + # explicitly set LuaJIT paths + + if [ "$NGX_PLATFORM" = win32 ]; then + ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (win32)" + ngx_feature_path="$LUAJIT_INC" + ngx_lua_opt_I="-I$LUAJIT_INC" + ngx_lua_opt_L="-L$LUAJIT_LIB" + + # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. + SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" + CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" + SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" + NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" + + # LuaJIT's win32 build uses the library file name lua51.dll. + ngx_feature_libs="$ngx_lua_opt_L -llua51" + + . auto/feature + + # clean up + CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" + else + + # attempt to link with -ldl, static linking on Linux requires it. + ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env, with -ldl)" + ngx_feature_path="$LUAJIT_INC" + ngx_lua_opt_I="-I$LUAJIT_INC" + ngx_lua_opt_L="-L$LUAJIT_LIB" + + # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. + SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" + CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" + SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" + NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm -ldl" + else + ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm -ldl" + fi + + . auto/feature + + # clean up + CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" + + if [ $ngx_found = no ]; then + # retry without -ldl + ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env)" + ngx_feature_path="$LUAJIT_INC" + ngx_lua_opt_I="-I$LUAJIT_INC" + ngx_lua_opt_L="-L$LUAJIT_LIB" + + # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. + SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" + CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" + SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" + NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm" + else + ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm" + fi + + . auto/feature + + # clean up + CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" + fi + fi + + if [ $ngx_found = no ]; then + cat << END + $0: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUAJIT_LIB is defined as $LUAJIT_LIB and LUAJIT_INC (path for lua.h) $LUAJIT_INC, but we cannot find LuaJIT there. +END + exit 1 + fi + + case "$NGX_PLATFORM" in + Darwin:*) + case "$NGX_MACHINE" in + amd64 | x86_64 | i386) + echo "adding extra linking options needed by LuaJIT" + ngx_feature_libs="$ngx_feature_libs -pagezero_size 10000 -image_base 100000000" + ;; + + *) + ;; + esac + ;; + + *) + ;; + esac +else + if [ -n "$LUA_INC" -o -n "$LUA_LIB" ]; then + # explicitly set Lua paths + ngx_feature="Lua library in $LUA_LIB and $LUA_INC (specified by the LUA_LIB and LUA_INC env)" + ngx_feature_path="$LUA_INC" + ngx_lua_opt_I="-I$LUA_INC" + ngx_lua_opt_L="-L$LUA_LIB" + + # ensure that our -I$LUA_INC and -L$LUA_LIB is at the first. + SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" + CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" + SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" + NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R$LUA_LIB $ngx_lua_opt_L -llua -lm -ldl" + else + ngx_feature_libs="$ngx_lua_opt_L -llua -lm -ldl" + fi + + . auto/feature + + # clean up + CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" + + if [ $ngx_found = no ]; then + # retry without -ldl + + ngx_feature_path="$LUA_INC" + ngx_lua_opt_I="-I$LUA_INC" + ngx_lua_opt_L="-L$LUA_LIB" + + # ensure that our -I$LUA_INC and -L$LUA_LIB is at the first. + SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" + CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" + SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" + NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R$LUA_LIB $ngx_lua_opt_L -llua -lm" + else + ngx_feature_libs="$ngx_lua_opt_L -llua -lm" + fi + + . auto/feature + + # clean up + CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" + fi + + if [ $ngx_found = no ]; then + cat << END + $0: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUA_LIB is defined as $LUA_LIB and LUA_INC (path for lua.h) is $LUA_INC, but we cannot find standard Lua there. +END + exit 1 + fi + else + # auto-discovery + ngx_feature="Lua library" + ngx_feature_libs="-llua -lm" + . auto/feature + + if [ $ngx_found = no ]; then + # OpenBSD-5.2 + ngx_feature="Lua library in /usr/local/" + ngx_feature_path="/usr/local/include/lua-5.1" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm" + else + ngx_feature_libs="-L/usr/local/lib -llua5.1 -lm" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # OpenBSD < 5.2 + ngx_feature="Lua library in /usr/local/" + ngx_feature_path="/usr/local/include" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm" + else + ngx_feature_libs="-L/usr/local/lib -llua -lm" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # NetBSD + ngx_feature="Lua library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include/" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lm -llua" + else + ngx_feature_libs="-L/usr/pkg/lib -lm -llua" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # MacPorts + ngx_feature="Lua library in /opt/local/" + ngx_feature_path="/opt/local/include" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lm -llua" + else + ngx_feature_libs="-L/opt/local/lib -lm -llua" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # FreeBSD + ngx_feature="Lua library in /usr/local/*/lua51/" + ngx_feature_path="/usr/local/include/lua51" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib/lua51 -L/usr/local/lib/lua51 -llua -lm" + else + ngx_feature_libs="-L/usr/local/lib/lua51 -llua -lm" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # Debian + ngx_feature="Lua library in /usr/" + ngx_feature_path="/usr/include/lua5.1" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -llua5.1" + else + ngx_feature_libs="-L/usr/lib -lm -llua5.1" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # FreeBSD with luajit-2.0 from ports collection + ngx_feature="LuaJIT library in /usr/local/" + ngx_feature_path="/usr/local/include/luajit-2.0" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lluajit-5.1 -lm" + else + ngx_feature_libs="-L/usr/local/lib -lluajit-5.1 -lm" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # Gentoo with LuaJIT-2.0, try with -ldl + ngx_feature="LuaJIT library in /usr/" + ngx_feature_path="/usr/include/luajit-2.0" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1 -ldl" + else + ngx_feature_libs="-L/usr/lib -lm -lluajit-5.1 -ldl" + fi + . auto/feature + fi + + if [ $ngx_found = no ]; then + # Gentoo with LuaJIT 2.0 + ngx_feature="LuaJIT library in /usr/" + ngx_feature_path="/usr/include/luajit-2.0" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1" + else + ngx_feature_libs="-L/usr/lib -lm -lluajit-5.1" + fi + . auto/feature + fi + fi +fi + +ngx_module_incs= +ngx_module_libs= + +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" + + ngx_module_incs="$ngx_module_incs $ngx_feature_path" + ngx_module_libs="$ngx_module_libs $ngx_feature_libs" +else + cat << END + $0: error: ngx_http_lua_module requires the Lua library. +END + exit 1 +fi + +. $ngx_addon_dir/auto/sources; + +ngx_feature="export symbols by default (-E)" +ngx_feature_libs="-Wl,-E" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs="#include " +ngx_feature_path= +ngx_feature_test='printf("hello");' + +. auto/feature + +if [ $ngx_found = yes ]; then + CORE_LIBS="-Wl,-E $CORE_LIBS" +fi + +# for Cygwin +ngx_feature="export symbols by default (--export-all-symbols)" +ngx_feature_libs="-Wl,--export-all-symbols" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs="#include " +ngx_feature_path= +ngx_feature_test='printf("hello");' + +. auto/feature + +if [ $ngx_found = yes ]; then + CORE_LIBS="-Wl,--export-all-symbols $CORE_LIBS" +fi + +ngx_feature="SO_PASSCRED" +ngx_feature_libs= +ngx_feature_name="NGX_HTTP_LUA_HAVE_SO_PASSCRED" +ngx_feature_run=no +ngx_feature_incs="#include +#include " +ngx_feature_path= +ngx_feature_test='setsockopt(1, SOL_SOCKET, SO_PASSCRED, NULL, 0);' + +. auto/feature + +ngx_feature="__attribute__(constructor)" +ngx_feature_libs= +ngx_feature_name="NGX_HTTP_LUA_HAVE_CONSTRUCTOR" +ngx_feature_run=yes +ngx_feature_incs="#include +int a = 2; +__attribute__((constructor)) +static void foo(void) +{ + a = 0; +} +" +ngx_feature_test="exit(a);" +SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" +CC_TEST_FLAGS="-Werror -Wall $CC_TEST_FLAGS" + +. auto/feature + +CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + +# ---------------------------------------- + +ngx_feature="malloc_trim" +ngx_feature_libs= +ngx_feature_name="NGX_HTTP_LUA_HAVE_MALLOC_TRIM" +ngx_feature_run=yes +ngx_feature_incs="#include +#include " +ngx_feature_test="int rc = malloc_trim((size_t) 0); printf(\"%d\", rc);" +SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" +CC_TEST_FLAGS="-Werror -Wall $CC_TEST_FLAGS" + +. auto/feature + +CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" + +# ---------------------------------------- + +if test -n "$ngx_module_link"; then + ngx_module_type=HTTP_AUX_FILTER + ngx_module_name=$ngx_addon_name + ngx_module_deps="$HTTP_LUA_DEPS" + ngx_module_srcs="$HTTP_LUA_SRCS" + + . auto/module +else + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_LUA_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_LUA_DEPS" + + CORE_INCS="$CORE_INCS $ngx_module_incs" + CORE_LIBS="$CORE_LIBS $ngx_module_libs" +fi + +#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'" +#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'" diff --git a/auto/config.msvc b/auto/config.msvc new file mode 100644 index 0000000000..a827bf5d89 --- /dev/null +++ b/auto/config.msvc @@ -0,0 +1,76 @@ +ngx_feature="Lua library" +ngx_feature_libs="lua51.lib" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs="#include " +ngx_feature_path= +ngx_feature_test="#if LUA_VERSION_NUM != 501 +# error unsupported Lua language version +#endif +(void) luaL_newstate();" +ngx_lua_opt_L= + +if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then + # LuaJIT VM + ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (win32, msvc)" + ngx_feature_path="$LUAJIT_INC" + ngx_lua_opt_L="-LIBPATH:$LUAJIT_LIB" + +elif [ -n "$LUA_INC" -o -n "$LUA_LIB" ]; then + # Lua VM + ngx_feature="Lua library in $LUA_LIB and $LUA_INC (win32, msvc)" + ngx_feature_path="$LUA_INC" + ngx_lua_opt_L="-LIBPATH:$LUA_LIB" +fi + +SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" +NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" + +. auto/feature + +NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" + +if [ $ngx_found = no ]; then + cat << END + $0: error: ngx_http_lua_module requires the Lua or LuaJIT library but we cannot find them; check LUA_INC/LUA_LIB or LUAJIT_INC/LUAJIT_LIB environment variables. +END + exit 1 +fi + +# set compiler options for ngx_lua module + +#CFLAGS="$ngx_lua_opt_I $CFLAGS" +#NGX_LD_OPT="$ngx_lua_opt_L $NGX_LD_OPT" + +ngx_module_incs="$ngx_module_incs $ngx_feature_path" +ngx_module_libs="$ngx_module_libs $ngx_feature_libs" + +CORE_LINK="$CORE_LINK $ngx_lua_opt_L" + +. $ngx_addon_dir/auto/sources; + +ngx_feature="SO_PASSCRED" +ngx_feature_libs="Ws2_32.lib" +ngx_feature_name="NGX_HTTP_LUA_HAVE_SO_PASSCRED" +ngx_feature_run=no +ngx_feature_incs="#include " +ngx_feature_path= +ngx_feature_test='setsockopt(1, SOL_SOCKET, SO_PASSCRED, NULL, 0);' + +. auto/feature + +if test -n "$ngx_module_link"; then + ngx_module_type=HTTP_AUX_FILTER + ngx_module_name=$ngx_addon_name + ngx_module_deps="$HTTP_LUA_DEPS" + ngx_module_srcs="$HTTP_LUA_SRCS" + + . auto/module +else + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_LUA_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_LUA_DEPS" + + CORE_INCS="$CORE_INCS $ngx_module_incs" + CORE_LIBS="$CORE_LIBS $ngx_module_libs" +fi diff --git a/auto/sources b/auto/sources new file mode 100644 index 0000000000..51cb38bcbf --- /dev/null +++ b/auto/sources @@ -0,0 +1,132 @@ +ngx_addon_name=ngx_http_lua_module +HTTP_LUA_SRCS=" \ + $ngx_addon_dir/src/ngx_http_lua_script.c \ + $ngx_addon_dir/src/ngx_http_lua_log.c \ + $ngx_addon_dir/src/ngx_http_lua_subrequest.c \ + $ngx_addon_dir/src/ngx_http_lua_ndk.c \ + $ngx_addon_dir/src/ngx_http_lua_control.c \ + $ngx_addon_dir/src/ngx_http_lua_time.c \ + $ngx_addon_dir/src/ngx_http_lua_misc.c \ + $ngx_addon_dir/src/ngx_http_lua_variable.c \ + $ngx_addon_dir/src/ngx_http_lua_string.c \ + $ngx_addon_dir/src/ngx_http_lua_output.c \ + $ngx_addon_dir/src/ngx_http_lua_headers.c \ + $ngx_addon_dir/src/ngx_http_lua_req_body.c \ + $ngx_addon_dir/src/ngx_http_lua_uri.c \ + $ngx_addon_dir/src/ngx_http_lua_args.c \ + $ngx_addon_dir/src/ngx_http_lua_ctx.c \ + $ngx_addon_dir/src/ngx_http_lua_regex.c \ + $ngx_addon_dir/src/ngx_http_lua_module.c \ + $ngx_addon_dir/src/ngx_http_lua_headers_out.c \ + $ngx_addon_dir/src/ngx_http_lua_headers_in.c \ + $ngx_addon_dir/src/ngx_http_lua_directive.c \ + $ngx_addon_dir/src/ngx_http_lua_consts.c \ + $ngx_addon_dir/src/ngx_http_lua_exception.c \ + $ngx_addon_dir/src/ngx_http_lua_util.c \ + $ngx_addon_dir/src/ngx_http_lua_cache.c \ + $ngx_addon_dir/src/ngx_http_lua_contentby.c \ + $ngx_addon_dir/src/ngx_http_lua_rewriteby.c \ + $ngx_addon_dir/src/ngx_http_lua_accessby.c \ + $ngx_addon_dir/src/ngx_http_lua_setby.c \ + $ngx_addon_dir/src/ngx_http_lua_capturefilter.c \ + $ngx_addon_dir/src/ngx_http_lua_clfactory.c \ + $ngx_addon_dir/src/ngx_http_lua_pcrefix.c \ + $ngx_addon_dir/src/ngx_http_lua_headerfilterby.c \ + $ngx_addon_dir/src/ngx_http_lua_shdict.c \ + $ngx_addon_dir/src/ngx_http_lua_socket_tcp.c \ + $ngx_addon_dir/src/ngx_http_lua_api.c \ + $ngx_addon_dir/src/ngx_http_lua_logby.c \ + $ngx_addon_dir/src/ngx_http_lua_sleep.c \ + $ngx_addon_dir/src/ngx_http_lua_semaphore.c\ + $ngx_addon_dir/src/ngx_http_lua_coroutine.c \ + $ngx_addon_dir/src/ngx_http_lua_bodyfilterby.c \ + $ngx_addon_dir/src/ngx_http_lua_initby.c \ + $ngx_addon_dir/src/ngx_http_lua_initworkerby.c \ + $ngx_addon_dir/src/ngx_http_lua_socket_udp.c \ + $ngx_addon_dir/src/ngx_http_lua_req_method.c \ + $ngx_addon_dir/src/ngx_http_lua_phase.c \ + $ngx_addon_dir/src/ngx_http_lua_uthread.c \ + $ngx_addon_dir/src/ngx_http_lua_timer.c \ + $ngx_addon_dir/src/ngx_http_lua_config.c \ + $ngx_addon_dir/src/ngx_http_lua_worker.c \ + $ngx_addon_dir/src/ngx_http_lua_ssl_certby.c \ + $ngx_addon_dir/src/ngx_http_lua_ssl_ocsp.c \ + $ngx_addon_dir/src/ngx_http_lua_lex.c \ + $ngx_addon_dir/src/ngx_http_lua_balancer.c \ + $ngx_addon_dir/src/ngx_http_lua_ssl_session_storeby.c \ + $ngx_addon_dir/src/ngx_http_lua_ssl_session_fetchby.c \ + $ngx_addon_dir/src/ngx_http_lua_ssl.c \ + $ngx_addon_dir/src/ngx_http_lua_log_ringbuf.c \ + " + +HTTP_LUA_DEPS=" \ + $ngx_addon_dir/src/ddebug.h \ + $ngx_addon_dir/src/ngx_http_lua_script.h \ + $ngx_addon_dir/src/ngx_http_lua_log.h \ + $ngx_addon_dir/src/ngx_http_lua_subrequest.h \ + $ngx_addon_dir/src/ngx_http_lua_ndk.h \ + $ngx_addon_dir/src/ngx_http_lua_control.h \ + $ngx_addon_dir/src/ngx_http_lua_time.h \ + $ngx_addon_dir/src/ngx_http_lua_string.h \ + $ngx_addon_dir/src/ngx_http_lua_misc.h \ + $ngx_addon_dir/src/ngx_http_lua_variable.h \ + $ngx_addon_dir/src/ngx_http_lua_output.h \ + $ngx_addon_dir/src/ngx_http_lua_headers.h \ + $ngx_addon_dir/src/ngx_http_lua_uri.h \ + $ngx_addon_dir/src/ngx_http_lua_req_body.h \ + $ngx_addon_dir/src/ngx_http_lua_args.h \ + $ngx_addon_dir/src/ngx_http_lua_ctx.h \ + $ngx_addon_dir/src/ngx_http_lua_regex.h \ + $ngx_addon_dir/src/ngx_http_lua_common.h \ + $ngx_addon_dir/src/ngx_http_lua_directive.h \ + $ngx_addon_dir/src/ngx_http_lua_headers_out.h \ + $ngx_addon_dir/src/ngx_http_lua_headers_in.h \ + $ngx_addon_dir/src/ngx_http_lua_consts.h \ + $ngx_addon_dir/src/ngx_http_lua_exception.h \ + $ngx_addon_dir/src/ngx_http_lua_util.h \ + $ngx_addon_dir/src/ngx_http_lua_cache.h \ + $ngx_addon_dir/src/ngx_http_lua_contentby.h \ + $ngx_addon_dir/src/ngx_http_lua_rewriteby.h \ + $ngx_addon_dir/src/ngx_http_lua_accessby.h \ + $ngx_addon_dir/src/ngx_http_lua_setby.h \ + $ngx_addon_dir/src/ngx_http_lua_capturefilter.h \ + $ngx_addon_dir/src/ngx_http_lua_clfactory.h \ + $ngx_addon_dir/src/ngx_http_lua_pcrefix.h \ + $ngx_addon_dir/src/ngx_http_lua_headerfilterby.h \ + $ngx_addon_dir/src/ngx_http_lua_shdict.h \ + $ngx_addon_dir/src/ngx_http_lua_socket_tcp.h \ + $ngx_addon_dir/src/api/ngx_http_lua_api.h \ + $ngx_addon_dir/src/ngx_http_lua_logby.h \ + $ngx_addon_dir/src/ngx_http_lua_sleep.h \ + $ngx_addon_dir/src/ngx_http_lua_semaphore.h\ + $ngx_addon_dir/src/ngx_http_lua_coroutine.h \ + $ngx_addon_dir/src/ngx_http_lua_bodyfilterby.h \ + $ngx_addon_dir/src/ngx_http_lua_initby.h \ + $ngx_addon_dir/src/ngx_http_lua_initworkerby.h \ + $ngx_addon_dir/src/ngx_http_lua_socket_udp.h \ + $ngx_addon_dir/src/ngx_http_lua_req_method.h \ + $ngx_addon_dir/src/ngx_http_lua_phase.h \ + $ngx_addon_dir/src/ngx_http_lua_probe.h \ + $ngx_addon_dir/src/ngx_http_lua_uthread.h \ + $ngx_addon_dir/src/ngx_http_lua_timer.h \ + $ngx_addon_dir/src/ngx_http_lua_config.h \ + $ngx_addon_dir/src/ngx_http_lua_worker.h \ + $ngx_addon_dir/src/ngx_http_lua_ssl_certby.h \ + $ngx_addon_dir/src/ngx_http_lua_lex.h \ + $ngx_addon_dir/src/ngx_http_lua_balancer.h \ + $ngx_addon_dir/src/ngx_http_lua_ssl_session_storeby.h \ + $ngx_addon_dir/src/ngx_http_lua_ssl_session_fetchby.h \ + $ngx_addon_dir/src/ngx_http_lua_ssl.h \ + $ngx_addon_dir/src/ngx_http_lua_log_ringbuf.h \ + " + +#CFLAGS="$CFLAGS -DNDK_SET_VAR" +have=NDK_SET_VAR . auto/have + +NGX_DTRACE_PROVIDERS="$NGX_DTRACE_PROVIDERS $ngx_addon_dir/dtrace/ngx_lua_provider.d" +NGX_TAPSET_SRCS="$NGX_TAPSET_SRCS $ngx_addon_dir/tapset/ngx_lua.stp" + +USE_MD5=YES +USE_SHA1=YES + +CORE_INCS="$CORE_INCS $ngx_addon_dir/src/api" diff --git a/config b/config index 044deb974e..228ace96a5 100644 --- a/config +++ b/config @@ -1,532 +1,17 @@ -ngx_feature="Lua library" -ngx_feature_libs="-llua -lm" -ngx_feature_name= -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_test="#if LUA_VERSION_NUM != 501 -# error unsupported Lua language version -#endif -(void) luaL_newstate();" -ngx_lua_opt_I= -ngx_lua_opt_L= - -if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then - # explicitly set LuaJIT paths - - if [ "$NGX_PLATFORM" = win32 ]; then - ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (win32)" - ngx_feature_path="$LUAJIT_INC" - ngx_lua_opt_I="-I$LUAJIT_INC" - ngx_lua_opt_L="-L$LUAJIT_LIB" - - # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - # LuaJIT's win32 build uses the library file name lua51.dll. - ngx_feature_libs="$ngx_lua_opt_L -llua51" - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - else - - # attempt to link with -ldl, static linking on Linux requires it. - ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env, with -ldl)" - ngx_feature_path="$LUAJIT_INC" - ngx_lua_opt_I="-I$LUAJIT_INC" - ngx_lua_opt_L="-L$LUAJIT_LIB" - - # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm -ldl" - else - ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm -ldl" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - - if [ $ngx_found = no ]; then - # retry without -ldl - ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env)" - ngx_feature_path="$LUAJIT_INC" - ngx_lua_opt_I="-I$LUAJIT_INC" - ngx_lua_opt_L="-L$LUAJIT_LIB" - - # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm" - else - ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - fi - fi - - if [ $ngx_found = no ]; then - cat << END - $0: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUAJIT_LIB is defined as $LUAJIT_LIB and LUAJIT_INC (path for lua.h) $LUAJIT_INC, but we cannot find LuaJIT there. -END - exit 1 - fi - - case "$NGX_PLATFORM" in - Darwin:*) - case "$NGX_MACHINE" in - amd64 | x86_64 | i386) - echo "adding extra linking options needed by LuaJIT" - ngx_feature_libs="$ngx_feature_libs -pagezero_size 10000 -image_base 100000000" - ;; - - *) - ;; - esac - ;; - - *) - ;; - esac -else - if [ -n "$LUA_INC" -o -n "$LUA_LIB" ]; then - # explicitly set Lua paths - ngx_feature="Lua library in $LUA_LIB and $LUA_INC (specified by the LUA_LIB and LUA_INC env)" - ngx_feature_path="$LUA_INC" - ngx_lua_opt_I="-I$LUA_INC" - ngx_lua_opt_L="-L$LUA_LIB" - - # ensure that our -I$LUA_INC and -L$LUA_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUA_LIB $ngx_lua_opt_L -llua -lm -ldl" - else - ngx_feature_libs="$ngx_lua_opt_L -llua -lm -ldl" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - - if [ $ngx_found = no ]; then - # retry without -ldl - - ngx_feature_path="$LUA_INC" - ngx_lua_opt_I="-I$LUA_INC" - ngx_lua_opt_L="-L$LUA_LIB" - - # ensure that our -I$LUA_INC and -L$LUA_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUA_LIB $ngx_lua_opt_L -llua -lm" - else - ngx_feature_libs="$ngx_lua_opt_L -llua -lm" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - fi - - if [ $ngx_found = no ]; then - cat << END - $0: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUA_LIB is defined as $LUA_LIB and LUA_INC (path for lua.h) is $LUA_INC, but we cannot find standard Lua there. -END - exit 1 - fi - else - # auto-discovery - ngx_feature="Lua library" - ngx_feature_libs="-llua -lm" - . auto/feature - - if [ $ngx_found = no ]; then - # OpenBSD-5.2 - ngx_feature="Lua library in /usr/local/" - ngx_feature_path="/usr/local/include/lua-5.1" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm" - else - ngx_feature_libs="-L/usr/local/lib -llua5.1 -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # OpenBSD < 5.2 - ngx_feature="Lua library in /usr/local/" - ngx_feature_path="/usr/local/include" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm" - else - ngx_feature_libs="-L/usr/local/lib -llua -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # NetBSD - ngx_feature="Lua library in /usr/pkg/" - ngx_feature_path="/usr/pkg/include/" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lm -llua" - else - ngx_feature_libs="-L/usr/pkg/lib -lm -llua" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # MacPorts - ngx_feature="Lua library in /opt/local/" - ngx_feature_path="/opt/local/include" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lm -llua" - else - ngx_feature_libs="-L/opt/local/lib -lm -llua" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # FreeBSD - ngx_feature="Lua library in /usr/local/*/lua51/" - ngx_feature_path="/usr/local/include/lua51" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib/lua51 -L/usr/local/lib/lua51 -llua -lm" - else - ngx_feature_libs="-L/usr/local/lib/lua51 -llua -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # Debian - ngx_feature="Lua library in /usr/" - ngx_feature_path="/usr/include/lua5.1" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -llua5.1" - else - ngx_feature_libs="-L/usr/lib -lm -llua5.1" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # FreeBSD with luajit-2.0 from ports collection - ngx_feature="LuaJIT library in /usr/local/" - ngx_feature_path="/usr/local/include/luajit-2.0" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lluajit-5.1 -lm" - else - ngx_feature_libs="-L/usr/local/lib -lluajit-5.1 -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # Gentoo with LuaJIT-2.0, try with -ldl - ngx_feature="LuaJIT library in /usr/" - ngx_feature_path="/usr/include/luajit-2.0" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1 -ldl" - else - ngx_feature_libs="-L/usr/lib -lm -lluajit-5.1 -ldl" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # Gentoo with LuaJIT 2.0 - ngx_feature="LuaJIT library in /usr/" - ngx_feature_path="/usr/include/luajit-2.0" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1" - else - ngx_feature_libs="-L/usr/lib -lm -lluajit-5.1" - fi - . auto/feature - fi - fi -fi - -ngx_module_incs= -ngx_module_libs= - -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" - - ngx_module_incs="$ngx_module_incs $ngx_feature_path" - ngx_module_libs="$ngx_module_libs $ngx_feature_libs" -else - cat << END - $0: error: ngx_http_lua_module requires the Lua library. -END - exit 1 -fi - -ngx_addon_name=ngx_http_lua_module -HTTP_LUA_SRCS=" \ - $ngx_addon_dir/src/ngx_http_lua_script.c \ - $ngx_addon_dir/src/ngx_http_lua_log.c \ - $ngx_addon_dir/src/ngx_http_lua_subrequest.c \ - $ngx_addon_dir/src/ngx_http_lua_ndk.c \ - $ngx_addon_dir/src/ngx_http_lua_control.c \ - $ngx_addon_dir/src/ngx_http_lua_time.c \ - $ngx_addon_dir/src/ngx_http_lua_misc.c \ - $ngx_addon_dir/src/ngx_http_lua_variable.c \ - $ngx_addon_dir/src/ngx_http_lua_string.c \ - $ngx_addon_dir/src/ngx_http_lua_output.c \ - $ngx_addon_dir/src/ngx_http_lua_headers.c \ - $ngx_addon_dir/src/ngx_http_lua_req_body.c \ - $ngx_addon_dir/src/ngx_http_lua_uri.c \ - $ngx_addon_dir/src/ngx_http_lua_args.c \ - $ngx_addon_dir/src/ngx_http_lua_ctx.c \ - $ngx_addon_dir/src/ngx_http_lua_regex.c \ - $ngx_addon_dir/src/ngx_http_lua_module.c \ - $ngx_addon_dir/src/ngx_http_lua_headers_out.c \ - $ngx_addon_dir/src/ngx_http_lua_headers_in.c \ - $ngx_addon_dir/src/ngx_http_lua_directive.c \ - $ngx_addon_dir/src/ngx_http_lua_consts.c \ - $ngx_addon_dir/src/ngx_http_lua_exception.c \ - $ngx_addon_dir/src/ngx_http_lua_util.c \ - $ngx_addon_dir/src/ngx_http_lua_cache.c \ - $ngx_addon_dir/src/ngx_http_lua_contentby.c \ - $ngx_addon_dir/src/ngx_http_lua_rewriteby.c \ - $ngx_addon_dir/src/ngx_http_lua_accessby.c \ - $ngx_addon_dir/src/ngx_http_lua_setby.c \ - $ngx_addon_dir/src/ngx_http_lua_capturefilter.c \ - $ngx_addon_dir/src/ngx_http_lua_clfactory.c \ - $ngx_addon_dir/src/ngx_http_lua_pcrefix.c \ - $ngx_addon_dir/src/ngx_http_lua_headerfilterby.c \ - $ngx_addon_dir/src/ngx_http_lua_shdict.c \ - $ngx_addon_dir/src/ngx_http_lua_socket_tcp.c \ - $ngx_addon_dir/src/ngx_http_lua_api.c \ - $ngx_addon_dir/src/ngx_http_lua_logby.c \ - $ngx_addon_dir/src/ngx_http_lua_sleep.c \ - $ngx_addon_dir/src/ngx_http_lua_semaphore.c\ - $ngx_addon_dir/src/ngx_http_lua_coroutine.c \ - $ngx_addon_dir/src/ngx_http_lua_bodyfilterby.c \ - $ngx_addon_dir/src/ngx_http_lua_initby.c \ - $ngx_addon_dir/src/ngx_http_lua_initworkerby.c \ - $ngx_addon_dir/src/ngx_http_lua_socket_udp.c \ - $ngx_addon_dir/src/ngx_http_lua_req_method.c \ - $ngx_addon_dir/src/ngx_http_lua_phase.c \ - $ngx_addon_dir/src/ngx_http_lua_uthread.c \ - $ngx_addon_dir/src/ngx_http_lua_timer.c \ - $ngx_addon_dir/src/ngx_http_lua_config.c \ - $ngx_addon_dir/src/ngx_http_lua_worker.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_certby.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_ocsp.c \ - $ngx_addon_dir/src/ngx_http_lua_lex.c \ - $ngx_addon_dir/src/ngx_http_lua_balancer.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_storeby.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_fetchby.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl.c \ - $ngx_addon_dir/src/ngx_http_lua_log_ringbuf.c \ - " - -HTTP_LUA_DEPS=" \ - $ngx_addon_dir/src/ddebug.h \ - $ngx_addon_dir/src/ngx_http_lua_script.h \ - $ngx_addon_dir/src/ngx_http_lua_log.h \ - $ngx_addon_dir/src/ngx_http_lua_subrequest.h \ - $ngx_addon_dir/src/ngx_http_lua_ndk.h \ - $ngx_addon_dir/src/ngx_http_lua_control.h \ - $ngx_addon_dir/src/ngx_http_lua_time.h \ - $ngx_addon_dir/src/ngx_http_lua_string.h \ - $ngx_addon_dir/src/ngx_http_lua_misc.h \ - $ngx_addon_dir/src/ngx_http_lua_variable.h \ - $ngx_addon_dir/src/ngx_http_lua_output.h \ - $ngx_addon_dir/src/ngx_http_lua_headers.h \ - $ngx_addon_dir/src/ngx_http_lua_uri.h \ - $ngx_addon_dir/src/ngx_http_lua_req_body.h \ - $ngx_addon_dir/src/ngx_http_lua_args.h \ - $ngx_addon_dir/src/ngx_http_lua_ctx.h \ - $ngx_addon_dir/src/ngx_http_lua_regex.h \ - $ngx_addon_dir/src/ngx_http_lua_common.h \ - $ngx_addon_dir/src/ngx_http_lua_directive.h \ - $ngx_addon_dir/src/ngx_http_lua_headers_out.h \ - $ngx_addon_dir/src/ngx_http_lua_headers_in.h \ - $ngx_addon_dir/src/ngx_http_lua_consts.h \ - $ngx_addon_dir/src/ngx_http_lua_exception.h \ - $ngx_addon_dir/src/ngx_http_lua_util.h \ - $ngx_addon_dir/src/ngx_http_lua_cache.h \ - $ngx_addon_dir/src/ngx_http_lua_contentby.h \ - $ngx_addon_dir/src/ngx_http_lua_rewriteby.h \ - $ngx_addon_dir/src/ngx_http_lua_accessby.h \ - $ngx_addon_dir/src/ngx_http_lua_setby.h \ - $ngx_addon_dir/src/ngx_http_lua_capturefilter.h \ - $ngx_addon_dir/src/ngx_http_lua_clfactory.h \ - $ngx_addon_dir/src/ngx_http_lua_pcrefix.h \ - $ngx_addon_dir/src/ngx_http_lua_headerfilterby.h \ - $ngx_addon_dir/src/ngx_http_lua_shdict.h \ - $ngx_addon_dir/src/ngx_http_lua_socket_tcp.h \ - $ngx_addon_dir/src/api/ngx_http_lua_api.h \ - $ngx_addon_dir/src/ngx_http_lua_logby.h \ - $ngx_addon_dir/src/ngx_http_lua_sleep.h \ - $ngx_addon_dir/src/ngx_http_lua_semaphore.h\ - $ngx_addon_dir/src/ngx_http_lua_coroutine.h \ - $ngx_addon_dir/src/ngx_http_lua_bodyfilterby.h \ - $ngx_addon_dir/src/ngx_http_lua_initby.h \ - $ngx_addon_dir/src/ngx_http_lua_initworkerby.h \ - $ngx_addon_dir/src/ngx_http_lua_socket_udp.h \ - $ngx_addon_dir/src/ngx_http_lua_req_method.h \ - $ngx_addon_dir/src/ngx_http_lua_phase.h \ - $ngx_addon_dir/src/ngx_http_lua_probe.h \ - $ngx_addon_dir/src/ngx_http_lua_uthread.h \ - $ngx_addon_dir/src/ngx_http_lua_timer.h \ - $ngx_addon_dir/src/ngx_http_lua_config.h \ - $ngx_addon_dir/src/ngx_http_lua_worker.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl_certby.h \ - $ngx_addon_dir/src/ngx_http_lua_lex.h \ - $ngx_addon_dir/src/ngx_http_lua_balancer.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_storeby.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_fetchby.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl.h \ - $ngx_addon_dir/src/ngx_http_lua_log_ringbuf.h \ - " - -CFLAGS="$CFLAGS -DNDK_SET_VAR" - -ngx_feature="export symbols by default (-E)" -ngx_feature_libs="-Wl,-E" -ngx_feature_name= -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_test='printf("hello");' - -. auto/feature - -if [ $ngx_found = yes ]; then - CORE_LIBS="-Wl,-E $CORE_LIBS" -fi - -# for Cygwin -ngx_feature="export symbols by default (--export-all-symbols)" -ngx_feature_libs="-Wl,--export-all-symbols" -ngx_feature_name= -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_test='printf("hello");' - -. auto/feature - -if [ $ngx_found = yes ]; then - CORE_LIBS="-Wl,--export-all-symbols $CORE_LIBS" -fi - -NGX_DTRACE_PROVIDERS="$NGX_DTRACE_PROVIDERS $ngx_addon_dir/dtrace/ngx_lua_provider.d" -NGX_TAPSET_SRCS="$NGX_TAPSET_SRCS $ngx_addon_dir/tapset/ngx_lua.stp" - -USE_MD5=YES -USE_SHA1=YES - -CORE_INCS="$CORE_INCS $ngx_addon_dir/src/api" - -ngx_feature="SO_PASSCRED" -ngx_feature_libs= -ngx_feature_name="NGX_HTTP_LUA_HAVE_SO_PASSCRED" -ngx_feature_run=no -ngx_feature_incs="#include -#include " -ngx_feature_path= -ngx_feature_test='setsockopt(1, SOL_SOCKET, SO_PASSCRED, NULL, 0);' - -. auto/feature - -ngx_feature="__attribute__(constructor)" -ngx_feature_libs= -ngx_feature_name="NGX_HTTP_LUA_HAVE_CONSTRUCTOR" -ngx_feature_run=yes -ngx_feature_incs="#include -int a = 2; -__attribute__((constructor)) -static void foo(void) -{ - a = 0; -} -" -ngx_feature_test="exit(a);" -SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" -CC_TEST_FLAGS="-Werror -Wall $CC_TEST_FLAGS" - -. auto/feature - -CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - -# ---------------------------------------- - -ngx_feature="malloc_trim" -ngx_feature_libs= -ngx_feature_name="NGX_HTTP_LUA_HAVE_MALLOC_TRIM" -ngx_feature_run=yes -ngx_feature_incs="#include -#include " -ngx_feature_test="int rc = malloc_trim((size_t) 0); printf(\"%d\", rc);" -SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" -CC_TEST_FLAGS="-Werror -Wall $CC_TEST_FLAGS" - -. auto/feature - -CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - -# ---------------------------------------- - -if test -n "$ngx_module_link"; then - ngx_module_type=HTTP_AUX_FILTER - ngx_module_name=$ngx_addon_name - ngx_module_deps="$HTTP_LUA_DEPS" - ngx_module_srcs="$HTTP_LUA_SRCS" - - . auto/module -else - HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" - NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_LUA_SRCS" - NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_LUA_DEPS" - - CORE_INCS="$CORE_INCS $ngx_module_incs" - CORE_LIBS="$CORE_LIBS $ngx_module_libs" -fi +case $NGX_CC_NAME in + gcc | clang) + echo "using gcc-specific config" + . $ngx_addon_dir/auto/config.gcc; + ;; + msvc) + echo "using msvc-specific config" + . $ngx_addon_dir/auto/config.msvc; + ;; + *) + echo "using untested compiler to build the module"; + . $ngx_addon_dir/auto/config.gcc; + ;; +esac #CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'" #CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'"