Skip to content

Commit

Permalink
bugfix: for statically linked luajit, we need to pass -ldl to the lin…
Browse files Browse the repository at this point in the history
…ker. thanks cf2012 for the report in openresty/openresty#40.
  • Loading branch information
agentzh committed Jul 9, 2014
1 parent 6929e7d commit 5e94463
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions config
Expand Up @@ -18,6 +18,19 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then

. auto/feature

if [ $ngx_found = no ]; then
# retry 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"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R$LUAJIT_LIB -L$LUAJIT_LIB -lluajit-5.1 -lm -ldl"
else
ngx_feature_libs="-L$LUAJIT_LIB -lluajit-5.1 -lm -ldl"
fi

. auto/feature
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.
Expand Down Expand Up @@ -161,6 +174,18 @@ END
fi
. auto/feature
fi

if [ $ngx_found = no ]; then
# Gentoo with LuaJIT-2.0, retry 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
fi
fi

Expand Down

0 comments on commit 5e94463

Please sign in to comment.