feature: now we support LuaJIT 2 on Windows (in the form of lua51.dll).

This commit is contained in:
Yichun Zhang (agentzh) 2015-10-30 21:17:28 +08:00
Родитель 4a9d4b11fb
Коммит 9fb2948c49
1 изменённых файлов: 48 добавлений и 25 удалений

73
config
Просмотреть файл

@ -14,33 +14,30 @@ ngx_lua_opt_L=
if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
# explicitly set LuaJIT paths
# 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"
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"
# 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"
# 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
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)"
# 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"
@ -52,9 +49,9 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
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"
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"
ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm -ldl"
fi
. auto/feature
@ -62,6 +59,32 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
# 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